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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.wss4j.dom.WSConstants; import org.apache.wss4j.dom.WSConstants;
@ -23,6 +24,7 @@ import org.apache.wss4j.dom.handler.WSHandlerConstants;
/** /**
* The type Dp tech. * The type Dp tech.
*/ */
@Slf4j
public class DPTechImpl implements DisposeEntryManager { public class DPTechImpl implements DisposeEntryManager {
/** /**
* Gets version. * Gets version.
@ -63,6 +65,7 @@ public class DPTechImpl implements DisposeEntryManager {
public List<DisposeDeviceCapacity> getDeviceCapacity() { public List<DisposeDeviceCapacity> getDeviceCapacity() {
List<DisposeDeviceCapacity> capList = new ArrayList<>(); List<DisposeDeviceCapacity> capList = new ArrayList<>();
try {
String devs = cleanTypePort.getAllDetectDevices(); String devs = cleanTypePort.getAllDetectDevices();
if (devs != null && devs.length() > 0) { if (devs != null && devs.length() > 0) {
@ -97,6 +100,10 @@ public class DPTechImpl implements DisposeEntryManager {
.protectIpV6(proIPv6.toArray(new String[0])) .protectIpV6(proIPv6.toArray(new String[0]))
.build()); .build());
} }
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
}
return capList; return capList;
} }
@ -108,9 +115,15 @@ public class DPTechImpl implements DisposeEntryManager {
*/ */
@Override @Override
public boolean getDeviceLinkStatus() { public boolean getDeviceLinkStatus() {
try {
List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject(); List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject();
return objs != null; return objs != null;
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return false;
}
} }
/** /**
@ -133,7 +146,13 @@ public class DPTechImpl implements DisposeEntryManager {
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getAllDetectionObject() { public <T> T getAllDetectionObject() {
try {
return (T) cleanTypePort.getAllDetectionObjectFromUMC().getDetectionObjectDataForService(); 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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getAllProtectionObject() { public <T> T getAllProtectionObject() {
try {
return (T) cleanTypePort.getAllProtectionObjectFromUMC().getProtectionObjectDataForService(); 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 * @return the detection object device json
* @throws JsonProcessingException the json processing exception * @throws JsonProcessingException the json processing exception
*/ */
public String getDetectionObjectDeviceJson() throws JsonProcessingException { public String getDetectionObjectDeviceJson(){
try {
ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC(); ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC();
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(typePort); 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 @Override
public String getProtectDevices() { public String getProtectDevices() {
try {
return cleanTypePort.getAllProtectDevices(); return cleanTypePort.getAllProtectDevices();
} catch (Exception ex) {
log.error(ex.getMessage());
ex.printStackTrace();
return "";
}
} }
/** /**
@ -178,7 +214,13 @@ public class DPTechImpl implements DisposeEntryManager {
*/ */
@Override @Override
public String getDetectionDevices() { public String getDetectionDevices() {
try {
return cleanTypePort.getAllDetectDevices(); 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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dispose.mapper.DisposeDeviceMapper"> <mapper namespace="com.dispose.mapper.DisposeDeviceMapper">
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id" parameterType="com.dispose.pojo.entity.DisposeDevice"> <insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id" parameterType="com.dispose.pojo.entity.DisposeDevice">
INSERT INTO INSERT IGNORE INTO
dispose_device(ipAddr, type, dispose_device(ipAddr, type,
areaCode, name, manufacturer, areaCode, name, manufacturer,
model, version, readme, status) model, version, readme, status)

View File

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