REM:
1. Fix Some CheckStyle Warnings
This commit is contained in:
HuangXin 2020-04-28 14:38:33 +08:00
parent df3e6dde4e
commit 456a4e8fbb
1 changed files with 274 additions and 176 deletions

View File

@ -83,7 +83,7 @@ public class DisposeNodeInfoController {
@ApiOperation("链接状态")
public ProtocolRespDTO getLinkStatus(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -98,8 +98,11 @@ public class DisposeNodeInfoController {
if (devs != null && devs.size() > 0) {
devs.forEach(v -> {
LinkStatusRsp linkStat = LinkStatusRsp.builder().online(v.getLinkStatus()).build();
linkStat.setId(v.getId().toString());
LinkStatusRsp linkStat = LinkStatusRsp.builder()
.online(v.getLinkStatus())
.build();
linkStat.setId(v.getId()
.toString());
linkStat.setStatus(ErrorCode.ERR_OK.getCode());
linkStat.setMessage(ErrorCode.ERR_OK.getMsg());
@ -110,12 +113,18 @@ public class DisposeNodeInfoController {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
LinkStatusRsp linkStat;
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
linkStat = LinkStatusRsp.builder().online(dev.getLinkStatus()).build();
linkStat.setId(dev.getId().toString());
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
linkStat = LinkStatusRsp.builder()
.online(dev.getLinkStatus())
.build();
linkStat.setId(dev.getId()
.toString());
err = ErrorCode.ERR_OK;
} else {
linkStat = LinkStatusRsp.builder().online(0).build();
linkStat = LinkStatusRsp.builder()
.online(0)
.build();
linkStat.setId(v);
err = ErrorCode.ERR_NOSUCHDEVICE;
}
@ -143,7 +152,7 @@ public class DisposeNodeInfoController {
@ApiOperation("处置设备版本")
public ProtocolRespDTO getVersion(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -159,9 +168,11 @@ public class DisposeNodeInfoController {
if (devList != null && devList.size() > 0) {
devList.forEach(v -> {
VersionRsp ver = VersionRsp.builder()
.version(v.getVersion()).build();
.version(v.getVersion())
.build();
ver.setId(v.getId().toString());
ver.setId(v.getId()
.toString());
ver.setStatus(ErrorCode.ERR_OK.getCode());
ver.setMessage(ErrorCode.ERR_OK.getMsg());
@ -173,13 +184,17 @@ public class DisposeNodeInfoController {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
VersionRsp ver;
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
ver = VersionRsp.builder()
.version(dev.getVersion()).build();
ver.setId(dev.getId().toString());
.version(dev.getVersion())
.build();
ver.setId(dev.getId()
.toString());
err = ErrorCode.ERR_OK;
} else {
ver = VersionRsp.builder().build();
ver = VersionRsp.builder()
.build();
ver.setId(v);
err = ErrorCode.ERR_NOSUCHDEVICE;
}
@ -207,7 +222,7 @@ public class DisposeNodeInfoController {
@ApiOperation("处置设备信息")
public ProtocolRespDTO getDeviceInfo(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -223,44 +238,68 @@ public class DisposeNodeInfoController {
List<DisposeDevice> devList = disposeNodeManager.getAllDisposeDevice();
if (devList != null && devList.size() > 0) {
devList.forEach(v -> rspInfo.getItems().add(new DeviceInfoData(
v.getId().toString(),
v.getDevInfo().getVendor(),
v.getDevInfo().getModel(),
v.getDevInfo().getFirmware(),
v.getDevInfo().getOs(),
v.getDevInfo().getKernel(),
v.getDevInfo().getArch(),
v.getDevInfo().getMemory(),
v.getDevInfo().getFreeMemory(),
v.getDevInfo().getCpuUsed(),
ErrorCode.ERR_OK
)));
devList.forEach(v -> rspInfo.getItems()
.add(new DeviceInfoData(
v.getId()
.toString(),
v.getDevInfo()
.getVendor(),
v.getDevInfo()
.getModel(),
v.getDevInfo()
.getFirmware(),
v.getDevInfo()
.getOs(),
v.getDevInfo()
.getKernel(),
v.getDevInfo()
.getArch(),
v.getDevInfo()
.getMemory(),
v.getDevInfo()
.getFreeMemory(),
v.getDevInfo()
.getCpuUsed(),
ErrorCode.ERR_OK
)));
}
} else {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
if (dev != null
&& dev.getId().equals(Long.valueOf(v))
&& dev.getDevInfo() != null) {
rspInfo.getItems().add(new DeviceInfoData(
dev.getId().toString(),
dev.getDevInfo().getVendor(),
dev.getDevInfo().getModel(),
dev.getDevInfo().getFirmware(),
dev.getDevInfo().getOs(),
dev.getDevInfo().getKernel(),
dev.getDevInfo().getArch(),
dev.getDevInfo().getMemory(),
dev.getDevInfo().getFreeMemory(),
dev.getDevInfo().getCpuUsed(),
ErrorCode.ERR_OK
));
&& dev.getId()
.equals(Long.valueOf(v))
&& dev.getDevInfo() != null) {
rspInfo.getItems()
.add(new DeviceInfoData(
dev.getId()
.toString(),
dev.getDevInfo()
.getVendor(),
dev.getDevInfo()
.getModel(),
dev.getDevInfo()
.getFirmware(),
dev.getDevInfo()
.getOs(),
dev.getDevInfo()
.getKernel(),
dev.getDevInfo()
.getArch(),
dev.getDevInfo()
.getMemory(),
dev.getDevInfo()
.getFreeMemory(),
dev.getDevInfo()
.getCpuUsed(),
ErrorCode.ERR_OK
));
} else {
rspInfo.getItems().add(new DeviceInfoData(
v,
ErrorCode.ERR_NOSUCHDEVICE
));
rspInfo.getItems()
.add(new DeviceInfoData(
v,
ErrorCode.ERR_NOSUCHDEVICE
));
}
}
}
@ -282,7 +321,7 @@ public class DisposeNodeInfoController {
//@JsonView(DisposeCapacity.CapacityView.class)
public ProtocolRespDTO getCapacity(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -300,33 +339,40 @@ public class DisposeNodeInfoController {
if (devList != null && devList.size() > 0) {
devList.forEach(v -> {
DeviceCapacityData cpData = new DeviceCapacityData(v.getDevCaps());
cpData.setId(v.getId().toString());
cpData.setId(v.getId()
.toString());
cpData.setStatus(ErrorCode.ERR_OK.getCode());
cpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
});
}
} else {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
DeviceCapacityData cpData = new DeviceCapacityData(dev.getDevCaps());
cpData.setId(dev.getId().toString());
cpData.setId(dev.getId()
.toString());
cpData.setStatus(ErrorCode.ERR_OK.getCode());
cpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
} else {
DeviceCapacityData cpData = new DeviceCapacityData();
cpData.setId(v);
cpData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
cpData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
}
}
}
String rspMessage =
new ObjectMapper().writerWithView(DisposeCapacity.CapacityView.class).writeValueAsString(rspInfo);
new ObjectMapper().writerWithView(DisposeCapacity.CapacityView.class)
.writeValueAsString(rspInfo);
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE);
}
@ -345,7 +391,7 @@ public class DisposeNodeInfoController {
//@JsonView(DisposeCapacity.CapacityView.class)
public ProtocolRespDTO getProtectedIp(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -363,33 +409,40 @@ public class DisposeNodeInfoController {
if (devList != null && devList.size() > 0) {
devList.forEach(v -> {
DeviceCapacityData cpData = new DeviceCapacityData(v.getDevCaps());
cpData.setId(v.getId().toString());
cpData.setId(v.getId()
.toString());
cpData.setStatus(ErrorCode.ERR_OK.getCode());
cpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
});
}
} else {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
DeviceCapacityData cpData = new DeviceCapacityData(dev.getDevCaps());
cpData.setId(dev.getId().toString());
cpData.setId(dev.getId()
.toString());
cpData.setStatus(ErrorCode.ERR_OK.getCode());
cpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
} else {
DeviceCapacityData cpData = new DeviceCapacityData();
cpData.setId(v);
cpData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
cpData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
rspInfo.getItems().add(cpData);
rspInfo.getItems()
.add(cpData);
}
}
}
String rspMessage =
new ObjectMapper().writerWithView(DisposeCapacity.DependIpView.class).writeValueAsString(rspInfo);
new ObjectMapper().writerWithView(DisposeCapacity.DependIpView.class)
.writeValueAsString(rspInfo);
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE);
}
@ -408,7 +461,7 @@ public class DisposeNodeInfoController {
//@JsonView(DisposeCapacity.CapacityView.class)
public ProtocolRespDTO getDisposeNodeList(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
boolean isGetAllNode = false;
IDArrayReq reqInfo = null;
@ -418,7 +471,8 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(err);
}
if (mr.getMsgContent() == null || mr.getMsgContent().length() == 0) {
if (mr.getMsgContent() == null || mr.getMsgContent()
.length() == 0) {
isGetAllNode = true;
} else {
reqInfo = mr.getRequestObject(IDArrayReq.class);
@ -436,36 +490,42 @@ public class DisposeNodeInfoController {
if (devList != null && devList.size() > 0) {
devList.forEach(v -> {
DisposeNodeData dpData = DisposeNodeData.builder()
.type(v.getType())
.name(v.getName())
.ip(v.getIpAddr())
.build();
.type(v.getType())
.name(v.getName())
.ip(v.getIpAddr())
.build();
dpData.setId(v.getId().toString());
dpData.setId(v.getId()
.toString());
dpData.setStatus(ErrorCode.ERR_OK.getCode());
dpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
});
}
} else {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
DisposeNodeData dpData = DisposeNodeData.builder()
.type(dev.getType())
.name(dev.getName())
.ip(dev.getIpAddr())
.build();
dpData.setId(dev.getId().toString());
.type(dev.getType())
.name(dev.getName())
.ip(dev.getIpAddr())
.build();
dpData.setId(dev.getId()
.toString());
dpData.setStatus(ErrorCode.ERR_OK.getCode());
dpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
} else {
DisposeNodeData dpData = new DisposeNodeData();
dpData.setId(v);
dpData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
dpData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
}
}
}
@ -485,7 +545,7 @@ public class DisposeNodeInfoController {
@ApiOperation("处置节点详细信息")
public ProtocolRespDTO getDisposeNodeDetails(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -503,47 +563,53 @@ public class DisposeNodeInfoController {
if (devList != null && devList.size() > 0) {
devList.forEach(v -> {
DisposeNodeData dpData = new DisposeNodeData(
v.getType(),
v.getName(),
v.getIpAddr(),
v.getAreaCode(),
v.getManufacturer(),
v.getModel(),
v.getVersion(),
v.getReadme(),
v.getDevCaps()
v.getType(),
v.getName(),
v.getIpAddr(),
v.getAreaCode(),
v.getManufacturer(),
v.getModel(),
v.getVersion(),
v.getReadme(),
v.getDevCaps()
);
dpData.setId(v.getId().toString());
dpData.setId(v.getId()
.toString());
dpData.setStatus(ErrorCode.ERR_OK.getCode());
dpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
});
}
} else {
for (String v : reqInfo.getId()) {
DisposeDevice dev = disposeNodeManager.getDisposeDeviceById(Long.valueOf(v));
if (dev != null && dev.getId().equals(Long.valueOf(v))) {
if (dev != null && dev.getId()
.equals(Long.valueOf(v))) {
DisposeNodeData dpData = new DisposeNodeData(
dev.getType(),
dev.getName(),
dev.getIpAddr(),
dev.getAreaCode(),
dev.getManufacturer(),
dev.getModel(),
dev.getVersion(),
dev.getReadme(),
dev.getDevCaps()
dev.getType(),
dev.getName(),
dev.getIpAddr(),
dev.getAreaCode(),
dev.getManufacturer(),
dev.getModel(),
dev.getVersion(),
dev.getReadme(),
dev.getDevCaps()
);
dpData.setId(dev.getId().toString());
dpData.setId(dev.getId()
.toString());
dpData.setStatus(ErrorCode.ERR_OK.getCode());
dpData.setMessage(ErrorCode.ERR_OK.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
} else {
DisposeNodeData dpData = new DisposeNodeData();
dpData.setId(v);
dpData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
dpData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
rspInfo.getItems().add(dpData);
rspInfo.getItems()
.add(dpData);
}
}
}
@ -563,7 +629,7 @@ public class DisposeNodeInfoController {
@ApiOperation("获取正在进行的处置任务")
public ProtocolRespDTO getRunningDisposeTaskList(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -574,49 +640,65 @@ public class DisposeNodeInfoController {
NodeTaskRsp rspInfo = new NodeTaskRsp();
List<DisposeDevice> valuableData = disposeNodeManager.getAllDisposeDevice()
.parallelStream()
.filter(v -> reqInfo.getId().length == 0
|| Arrays.stream(reqInfo.getId()).anyMatch(s -> s.equals(v.getId().toString())))
.collect(Collectors.toList());
.parallelStream()
.filter(v -> reqInfo.getId().length == 0
|| Arrays.stream(reqInfo.getId())
.anyMatch(s -> s.equals(v.getId()
.toString())))
.collect(Collectors.toList());
valuableData.parallelStream().forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems().add(taskData);
taskData.setId(v.getId().toString());
taskData.setStatus(ErrorCode.ERR_OK.getCode());
taskData.setMessage(ErrorCode.ERR_OK.getMsg());
valuableData.parallelStream()
.forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems()
.add(taskData);
taskData.setId(v.getId()
.toString());
taskData.setStatus(ErrorCode.ERR_OK.getCode());
taskData.setMessage(ErrorCode.ERR_OK.getMsg());
taskService.getNodeAllRunningTask(v.getId()).parallelStream().forEach(k -> {
Long tmLong = Timestamp.valueOf(k.getBeginTime()).toInstant().toEpochMilli() / 1000;
Long endTm = Timestamp.valueOf(k.getPlanEndTime()).toInstant().toEpochMilli() / 1000;
Long diff = endTm - tmLong;
taskService.getNodeAllRunningTask(v.getId())
.parallelStream()
.forEach(k -> {
Long tmLong = Timestamp.valueOf(k.getBeginTime())
.toInstant()
.toEpochMilli() / 1000;
Long endTm = Timestamp.valueOf(k.getPlanEndTime())
.toInstant()
.toEpochMilli() / 1000;
Long diff = endTm - tmLong;
TaskInfoData taskInfoData = TaskInfoData.builder()
.taskId(k.getId().toString())
.type(k.getType())
.startTime(tmLong.intValue())
.disposeTime(diff.intValue())
.disposeIp(k.getDisposeIp())
.flowAttack(0)
.flowClean(0)
.build();
TaskInfoData taskInfoData = TaskInfoData.builder()
.taskId(k.getId()
.toString())
.type(k.getType())
.startTime(tmLong.intValue())
.disposeTime(diff.intValue())
.disposeIp(k.getDisposeIp())
.flowAttack(0)
.flowClean(0)
.build();
taskData.getTaskArray().add(taskInfoData);
});
});
taskData.getTaskArray()
.add(taskInfoData);
});
});
if (reqInfo.getId().length != 0) {
List<String> unExists = Arrays.stream(reqInfo.getId())
.filter(v -> valuableData.parallelStream().noneMatch(k -> k.getId() == Long.parseLong(v)))
.collect(Collectors.toList());
.filter(v -> valuableData.parallelStream()
.noneMatch(k -> k.getId() == Long.parseLong(v)))
.collect(Collectors.toList());
unExists.parallelStream().forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems().add(taskData);
taskData.setId(v);
taskData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
taskData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
});
unExists.parallelStream()
.forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems()
.add(taskData);
taskData.setId(v);
taskData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
taskData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
});
}
return ProtocolRespDTO.result(err, rspInfo);
@ -635,7 +717,7 @@ public class DisposeNodeInfoController {
@ApiOperation("获取所有处置任务")
public ProtocolRespDTO getAllDisposeTaskList(@RequestBody ProtocolReqDTO mr,
@RequestHeader HttpHeaders headers)
throws JsonProcessingException {
throws JsonProcessingException {
ErrorCode err = mr.verifyRequest(headers);
if (err != ErrorCode.ERR_OK) {
@ -646,49 +728,65 @@ public class DisposeNodeInfoController {
NodeTaskRsp rspInfo = new NodeTaskRsp();
List<DisposeDevice> valuableData = disposeNodeManager.getAllDisposeDevice()
.parallelStream()
.filter(v -> reqInfo.getId().length == 0
|| Arrays.stream(reqInfo.getId()).anyMatch(s -> s.equals(v.getId().toString())))
.collect(Collectors.toList());
.parallelStream()
.filter(v -> reqInfo.getId().length == 0
|| Arrays.stream(reqInfo.getId())
.anyMatch(s -> s.equals(v.getId()
.toString())))
.collect(Collectors.toList());
valuableData.parallelStream().forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems().add(taskData);
taskData.setId(v.getId().toString());
taskData.setStatus(ErrorCode.ERR_OK.getCode());
taskData.setMessage(ErrorCode.ERR_OK.getMsg());
valuableData.parallelStream()
.forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems()
.add(taskData);
taskData.setId(v.getId()
.toString());
taskData.setStatus(ErrorCode.ERR_OK.getCode());
taskData.setMessage(ErrorCode.ERR_OK.getMsg());
taskService.getNodeAllRunningTask(v.getId()).parallelStream().forEach(k -> {
Long tmLong = Timestamp.valueOf(k.getBeginTime()).toInstant().toEpochMilli() / 1000;
Long endTm = Timestamp.valueOf(k.getPlanEndTime()).toInstant().toEpochMilli() / 1000;
Long diff = endTm - tmLong;
taskService.getNodeAllRunningTask(v.getId())
.parallelStream()
.forEach(k -> {
Long tmLong = Timestamp.valueOf(k.getBeginTime())
.toInstant()
.toEpochMilli() / 1000;
Long endTm = Timestamp.valueOf(k.getPlanEndTime())
.toInstant()
.toEpochMilli() / 1000;
Long diff = endTm - tmLong;
TaskInfoData taskInfoData = TaskInfoData.builder()
.taskId(k.getId().toString())
.type(k.getType())
.startTime(tmLong.intValue())
.disposeTime(diff.intValue())
.disposeIp(k.getDisposeIp())
.flowAttack(0)
.flowClean(0)
.build();
TaskInfoData taskInfoData = TaskInfoData.builder()
.taskId(k.getId()
.toString())
.type(k.getType())
.startTime(tmLong.intValue())
.disposeTime(diff.intValue())
.disposeIp(k.getDisposeIp())
.flowAttack(0)
.flowClean(0)
.build();
taskData.getTaskArray().add(taskInfoData);
});
});
taskData.getTaskArray()
.add(taskInfoData);
});
});
if (reqInfo.getId().length != 0) {
List<String> unExists = Arrays.stream(reqInfo.getId())
.filter(v -> valuableData.parallelStream().noneMatch(k -> k.getId() == Long.parseLong(v)))
.collect(Collectors.toList());
.filter(v -> valuableData.parallelStream()
.noneMatch(k -> k.getId() == Long.parseLong(v)))
.collect(Collectors.toList());
unExists.parallelStream().forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems().add(taskData);
taskData.setId(v);
taskData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
taskData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
});
unExists.parallelStream()
.forEach(v -> {
NodeTaskData taskData = new NodeTaskData();
rspInfo.getItems()
.add(taskData);
taskData.setId(v);
taskData.setStatus(ErrorCode.ERR_NOSUCHDEVICE.getCode());
taskData.setMessage(ErrorCode.ERR_NOSUCHDEVICE.getMsg());
});
}
return ProtocolRespDTO.result(err, rspInfo);