parent
e10168956c
commit
cf5183d1e3
|
@ -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,39 +65,44 @@ public class DPTechImpl implements DisposeEntryManager {
|
|||
public List<DisposeDeviceCapacity> getDeviceCapacity() {
|
||||
List<DisposeDeviceCapacity> capList = new ArrayList<>();
|
||||
|
||||
String devs = cleanTypePort.getAllDetectDevices();
|
||||
try {
|
||||
String devs = cleanTypePort.getAllDetectDevices();
|
||||
|
||||
if (devs != null && devs.length() > 0) {
|
||||
capList.add(DisposeDeviceCapacity.builder()
|
||||
.capacity(ConstValue.DeviceCapacity.DETECIVE.getCode())
|
||||
.tolFlowCapacity(0)
|
||||
.build());
|
||||
}
|
||||
if (devs != null && devs.length() > 0) {
|
||||
capList.add(DisposeDeviceCapacity.builder()
|
||||
.capacity(ConstValue.DeviceCapacity.DETECIVE.getCode())
|
||||
.tolFlowCapacity(0)
|
||||
.build());
|
||||
}
|
||||
|
||||
devs = cleanTypePort.getAllProtectDevices();
|
||||
devs = cleanTypePort.getAllProtectDevices();
|
||||
|
||||
if (devs != null && devs.length() > 0) {
|
||||
List<String> proIPv4 = new ArrayList<>();
|
||||
List<String> proIPv6 = new ArrayList<>();
|
||||
if (devs != null && devs.length() > 0) {
|
||||
List<String> proIPv4 = new ArrayList<>();
|
||||
List<String> proIPv6 = new ArrayList<>();
|
||||
|
||||
ArrayOfProtectionObjectDataForService objs = cleanTypePort.getAllProtectionObjectFromUMC();
|
||||
objs.getProtectionObjectDataForService().forEach(v -> {
|
||||
String ipSeg = v.getIpSegment().getValue();
|
||||
if (v.getIpType() == 0 && ipSeg.length() > 0) {
|
||||
proIPv4.addAll(Arrays.asList(ipSeg.replaceAll("\\d{1,}_", "")
|
||||
.split(",")));
|
||||
} else if (v.getIpType() == 1 && ipSeg.length() > 0) {
|
||||
proIPv6.addAll(Arrays.asList(ipSeg.replaceAll("\\d{1,}_", "")
|
||||
.split(",")));
|
||||
}
|
||||
});
|
||||
ArrayOfProtectionObjectDataForService objs = cleanTypePort.getAllProtectionObjectFromUMC();
|
||||
objs.getProtectionObjectDataForService().forEach(v -> {
|
||||
String ipSeg = v.getIpSegment().getValue();
|
||||
if (v.getIpType() == 0 && ipSeg.length() > 0) {
|
||||
proIPv4.addAll(Arrays.asList(ipSeg.replaceAll("\\d{1,}_", "")
|
||||
.split(",")));
|
||||
} else if (v.getIpType() == 1 && ipSeg.length() > 0) {
|
||||
proIPv6.addAll(Arrays.asList(ipSeg.replaceAll("\\d{1,}_", "")
|
||||
.split(",")));
|
||||
}
|
||||
});
|
||||
|
||||
capList.add(DisposeDeviceCapacity.builder()
|
||||
.capacity(ConstValue.DeviceCapacity.CLEANUP.getCode())
|
||||
.tolFlowCapacity(0)
|
||||
.protectIpV4(proIPv4.toArray(new String[0]))
|
||||
.protectIpV6(proIPv6.toArray(new String[0]))
|
||||
.build());
|
||||
capList.add(DisposeDeviceCapacity.builder()
|
||||
.capacity(ConstValue.DeviceCapacity.CLEANUP.getCode())
|
||||
.tolFlowCapacity(0)
|
||||
.protectIpV4(proIPv4.toArray(new String[0]))
|
||||
.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() {
|
||||
List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject();
|
||||
try {
|
||||
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
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getAllDetectionObject() {
|
||||
return (T) cleanTypePort.getAllDetectionObjectFromUMC().getDetectionObjectDataForService();
|
||||
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() {
|
||||
return (T) cleanTypePort.getAllProtectionObjectFromUMC().getProtectionObjectDataForService();
|
||||
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 {
|
||||
ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(typePort);
|
||||
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() {
|
||||
return cleanTypePort.getAllProtectDevices();
|
||||
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() {
|
||||
return cleanTypePort.getAllDetectDevices();
|
||||
try {
|
||||
return cleanTypePort.getAllDetectDevices();
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue