REM:
1. 修正SOAP库部分checkstyle警告
2. 数据库忽略添加重复的设备
This commit is contained in:
huangxin 2020-04-22 11:25:36 +08:00
parent e10168956c
commit cf5183d1e3
4 changed files with 2339 additions and 620 deletions

View File

@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.wss4j.dom.WSConstants;
@ -23,6 +24,7 @@ import org.apache.wss4j.dom.handler.WSHandlerConstants;
/**
* The type Dp tech.
*/
@Slf4j
public class DPTechImpl implements DisposeEntryManager {
/**
* Gets version.
@ -63,6 +65,7 @@ public class DPTechImpl implements DisposeEntryManager {
public List<DisposeDeviceCapacity> getDeviceCapacity() {
List<DisposeDeviceCapacity> capList = new ArrayList<>();
try {
String devs = cleanTypePort.getAllDetectDevices();
if (devs != null && devs.length() > 0) {
@ -97,6 +100,10 @@ public class DPTechImpl implements DisposeEntryManager {
.protectIpV6(proIPv6.toArray(new String[0]))
.build());
}
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
}
return capList;
}
@ -108,9 +115,15 @@ public class DPTechImpl implements DisposeEntryManager {
*/
@Override
public boolean getDeviceLinkStatus() {
try {
List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject();
return objs != null;
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return false;
}
}
/**
@ -133,7 +146,13 @@ public class DPTechImpl implements DisposeEntryManager {
@Override
@SuppressWarnings("unchecked")
public <T> T getAllDetectionObject() {
try {
return (T) cleanTypePort.getAllDetectionObjectFromUMC().getDetectionObjectDataForService();
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return null;
}
}
/**
@ -145,7 +164,13 @@ public class DPTechImpl implements DisposeEntryManager {
@Override
@SuppressWarnings("unchecked")
public <T> T getAllProtectionObject() {
try {
return (T) cleanTypePort.getAllProtectionObjectFromUMC().getProtectionObjectDataForService();
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return null;
}
}
/**
@ -154,11 +179,16 @@ public class DPTechImpl implements DisposeEntryManager {
* @return the detection object device json
* @throws JsonProcessingException the json processing exception
*/
public String getDetectionObjectDeviceJson() throws JsonProcessingException {
public String getDetectionObjectDeviceJson(){
try {
ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC();
ObjectMapper mapper = new ObjectMapper();
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(typePort);
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return "{}";
}
}
/**
@ -168,7 +198,13 @@ public class DPTechImpl implements DisposeEntryManager {
*/
@Override
public String getProtectDevices() {
try {
return cleanTypePort.getAllProtectDevices();
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return "";
}
}
/**
@ -178,7 +214,13 @@ public class DPTechImpl implements DisposeEntryManager {
*/
@Override
public String getDetectionDevices() {
try {
return cleanTypePort.getAllDetectDevices();
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return "";
}
}
/**

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dispose.mapper.DisposeDeviceMapper">
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id" parameterType="com.dispose.pojo.entity.DisposeDevice">
INSERT INTO
INSERT IGNORE INTO
dispose_device(ipAddr, type,
areaCode, name, manufacturer,
model, version, readme, status)

View File

@ -138,7 +138,7 @@ public class DisposeDeviceMapperTest extends InitTestEnvironment {
* @throws JsonProcessingException the json processing exception
*/
@Test
public void t99_delDisposeDeviceByIp() throws JsonProcessingException {
public void t0_delDisposeDeviceByIp() throws JsonProcessingException {
String ipAddr = "10.88.77.15";
disposeDeviceMapper.delDisposeDeviceByIp(ipAddr);