parent
8fb5fc6a43
commit
8e11ed64dc
|
@ -459,9 +459,6 @@ public class DisposeNodeInfoController {
|
|||
public ProtocolRespDTO getDisposeNodeList(@RequestBody ProtocolReqDTO mr,
|
||||
@RequestHeader HttpHeaders headers)
|
||||
throws JsonProcessingException {
|
||||
boolean isGetAllNode = false;
|
||||
IDArrayReq reqInfo = null;
|
||||
|
||||
ErrorCode err = mr.verifyRequest(headers);
|
||||
|
||||
if (err != ErrorCode.ERR_OK) {
|
||||
|
@ -469,20 +466,23 @@ public class DisposeNodeInfoController {
|
|||
return ProtocolRespDTO.result(err);
|
||||
}
|
||||
|
||||
if (mr.getMsgContent() == null || mr.getMsgContent()
|
||||
.length() == 0) {
|
||||
isGetAllNode = true;
|
||||
} else {
|
||||
reqInfo = mr.getRequestObject(IDArrayReq.class);
|
||||
if (reqInfo == null || reqInfo.getId() == null || reqInfo.getId().length == 0) {
|
||||
isGetAllNode = true;
|
||||
}
|
||||
if (mr.getMsgContent() == null || mr.getMsgContent().length() == 0) {
|
||||
log.error("ProtocolReqDTO msgContent error");
|
||||
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
|
||||
}
|
||||
|
||||
IDArrayReq reqInfo = mr.getRequestObject(IDArrayReq.class);
|
||||
DisposeNodeListRsp rspInfo = new DisposeNodeListRsp();
|
||||
rspInfo.setItems(new ArrayList<>());
|
||||
|
||||
if (isGetAllNode) {
|
||||
for (String deviceId : reqInfo.getId()
|
||||
) {
|
||||
if (deviceId == null || deviceId.length() == 0) {
|
||||
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
|
||||
}
|
||||
}
|
||||
|
||||
if (reqInfo.getId().length == 0) {
|
||||
List<DisposeDevice> devList = disposeNodeManager.getAllDisposeDevice();
|
||||
|
||||
if (devList != null && devList.size() > 0) {
|
||||
|
|
|
@ -158,20 +158,20 @@ public class DisposeTaskController {
|
|||
rspInfo.getItems().add(taskData);
|
||||
} else {
|
||||
ret.forEach(k -> {
|
||||
if(k.getFirstParam() == ErrorCode.ERR_OK){
|
||||
if (k.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
ErrorCode retError = k.getFirstParam();
|
||||
TaskInfoDetail taskInfo = k.getSecondParam();
|
||||
taskData.setId(String.valueOf(taskInfo.getDeviceId()));
|
||||
taskData.setTaskId(String.valueOf(taskInfo.getId()));
|
||||
taskData.setType(taskInfo.getType());
|
||||
taskData.setDisposeIp(taskInfo.getDisposeIp());
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime()))/ 60);
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime())) / 60);
|
||||
|
||||
taskData.setStatus(retError.getCode());
|
||||
taskData.setMessage(retError.getMsg());
|
||||
|
||||
rspInfo.getItems().add(taskData);
|
||||
}else{
|
||||
} else {
|
||||
log.error("Stop task: taskId:{}, error:{}", v, k.getFirstParam().getMsg());
|
||||
taskData.setStatus(k.getFirstParam().getCode());
|
||||
taskData.setMessage(k.getFirstParam().getMsg());
|
||||
|
@ -227,7 +227,7 @@ public class DisposeTaskController {
|
|||
taskData.setTaskId(String.valueOf(taskInfo.getId()));
|
||||
taskData.setType(taskInfo.getType());
|
||||
taskData.setDisposeIp(taskInfo.getDisposeIp());
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime()))/ 60);
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime())) / 60);
|
||||
|
||||
taskData.setStatus(retError.getCode());
|
||||
taskData.setMessage(retError.getMsg());
|
||||
|
@ -289,13 +289,13 @@ public class DisposeTaskController {
|
|||
taskData.setTaskId(String.valueOf(taskInfo.getId()));
|
||||
taskData.setType(taskInfo.getType());
|
||||
taskData.setDisposeIp(taskInfo.getDisposeIp());
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime()))/ 60);
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime())) / 60);
|
||||
|
||||
taskData.setStatus(retError.getCode());
|
||||
taskData.setMessage(retError.getMsg());
|
||||
|
||||
rspInfo.getItems().add(taskData);
|
||||
}else{
|
||||
} else {
|
||||
log.error("Stop task: deviceId:{}, type:{}, error:{}", v.getId(),
|
||||
v.getType(), k.getFirstParam().getMsg());
|
||||
TaskInfoData taskData = TaskInfoData.builder().type(v.getType()).build();
|
||||
|
@ -344,7 +344,7 @@ public class DisposeTaskController {
|
|||
rspInfo.getItems().add(taskData);
|
||||
} else {
|
||||
ret.forEach(k -> {
|
||||
if(k.getFirstParam() == ErrorCode.ERR_OK){
|
||||
if (k.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
TaskInfoData taskData = TaskInfoData.builder().type(reqInfo.getType()).build();
|
||||
ErrorCode retError = k.getFirstParam();
|
||||
TaskInfoDetail taskInfo = k.getSecondParam();
|
||||
|
@ -352,13 +352,13 @@ public class DisposeTaskController {
|
|||
taskData.setTaskId(String.valueOf(taskInfo.getId()));
|
||||
taskData.setType(taskInfo.getType());
|
||||
taskData.setDisposeIp(taskInfo.getDisposeIp());
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime()))/ 60);
|
||||
taskData.setLeftTime(Math.abs(Helper.getTimestampDiffNow(taskInfo.getPlanEndTime())) / 60);
|
||||
|
||||
taskData.setStatus(retError.getCode());
|
||||
taskData.setMessage(retError.getMsg());
|
||||
|
||||
rspInfo.getItems().add(taskData);
|
||||
}else{
|
||||
} else {
|
||||
log.error("No task to stop: error:{}", k.getFirstParam().getMsg());
|
||||
TaskInfoData taskData = TaskInfoData.builder().type(reqInfo.getType()).build();
|
||||
taskData.setStatus(k.getFirstParam().getCode());
|
||||
|
@ -394,6 +394,17 @@ public class DisposeTaskController {
|
|||
GetTaskReq reqInfo = mr.getRequestObject(GetTaskReq.class);
|
||||
NodeTaskRsp rspInfo = new NodeTaskRsp();
|
||||
|
||||
if (reqInfo.getId().length == 0 || reqInfo.getId() == null || reqInfo.getType() == null) {
|
||||
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
|
||||
}
|
||||
|
||||
for (String deviceId : reqInfo.getId()
|
||||
) {
|
||||
if (deviceId.length() == 0) {
|
||||
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
|
||||
}
|
||||
}
|
||||
|
||||
List<DisposeDevice> valuableData = disposeNodeManager.getAllDisposeDevice()
|
||||
.stream()
|
||||
.filter(v -> reqInfo.getId().length == 0
|
||||
|
|
Loading…
Reference in New Issue