From a17c5897749fdb05d85e5d52ebc8bb3f86831b0f Mon Sep 17 00:00:00 2001 From: HuangXin Date: Thu, 10 Sep 2020 20:58:49 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=AD=A3=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E5=8D=8F=E8=AE=AE=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=8C=BF=E5=90=8D=E7=9A=84JSON=E6=95=B0=E7=BB=84,=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E4=BD=BF=E7=94=A8=E6=B3=9B=E5=9E=8B=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DisposeDeviceManagerController.java | 16 +++---- .../controller/DisposeTaskController.java | 8 ++-- .../manager/CommDeviceListRsp.java} | 10 ++--- .../device/manager/DeviceInfoRsp.java | 3 +- .../pojo/dto/protocol/task/TaskStopItem.java | 42 +++++++++++++++++++ .../pojo/dto/protocol/task/TaskStopRsp.java | 29 ++++--------- 6 files changed, 68 insertions(+), 40 deletions(-) rename src/main/java/com/dispose/pojo/dto/protocol/{base/BaseListResp.java => device/manager/CommDeviceListRsp.java} (70%) create mode 100644 src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopItem.java diff --git a/src/main/java/com/dispose/controller/DisposeDeviceManagerController.java b/src/main/java/com/dispose/controller/DisposeDeviceManagerController.java index c792fea0..63ac5a2d 100644 --- a/src/main/java/com/dispose/controller/DisposeDeviceManagerController.java +++ b/src/main/java/com/dispose/controller/DisposeDeviceManagerController.java @@ -10,7 +10,6 @@ import com.dispose.common.Helper; import com.dispose.common.HttpType; import com.dispose.common.IpAddrType; import com.dispose.common.PrivacyHelper; -import com.dispose.pojo.dto.protocol.base.BaseListResp; import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.dispose.pojo.dto.protocol.base.IdArraysReq; import com.dispose.pojo.dto.protocol.base.ProtocolReqDTO; @@ -20,6 +19,7 @@ import com.dispose.pojo.dto.protocol.device.manager.AddDeviceReq; import com.dispose.pojo.dto.protocol.device.manager.AddDeviceRet; import com.dispose.pojo.dto.protocol.device.manager.AddDeviceRsp; import com.dispose.pojo.dto.protocol.device.manager.BasePagesGetReq; +import com.dispose.pojo.dto.protocol.device.manager.CommDeviceListRsp; import com.dispose.pojo.dto.protocol.device.manager.DeviceInfoRsp; import com.dispose.pojo.dto.protocol.device.manager.GetDeviceDetail; import com.dispose.pojo.dto.protocol.device.manager.GetDeviceRsp; @@ -129,7 +129,7 @@ public class DisposeDeviceManagerController { @PutMapping("/device") @ResponseBody @ApiOperation("添加处置能力节点") - public ProtocolRespDTO addDisposeDevice( + public ProtocolRespDTO addDisposeDevice( @Validated(ValidGroups.AddDeviceValid.class) @RequestBody ProtocolReqDTO mr) { @@ -172,7 +172,7 @@ public class DisposeDeviceManagerController { @DeleteMapping("/device") @ResponseBody @ApiOperation("删除处置能力节点") - public ProtocolRespDTO> removeDisposeDevice( + public ProtocolRespDTO removeDisposeDevice( @Validated(ValidGroups.ExplicitIdArrayValid.class) @RequestBody ProtocolReqDTO mr) { @@ -186,7 +186,7 @@ public class DisposeDeviceManagerController { List> ret = disposeDeviceManagerService.removeDisposeDevice(idList); - BaseListResp rspInfo = new BaseListResp<>(); + CommDeviceListRsp rspInfo = new CommDeviceListRsp(); rspInfo.setItems(new ArrayList<>()); ret.forEach(v -> { @@ -194,7 +194,7 @@ public class DisposeDeviceManagerController { DisposeDevice dev = v.getSecondParam(); rsp.setId(String.valueOf(dev.getId())); - rsp.setDevStatus(dev.getStatus()); + rsp.setDevStatus(dev.getStatus().getValue()); rsp.setStatus(v.getFirstParam().getCode()); rsp.setMessage(new String[]{v.getFirstParam().getMsg()}); @@ -213,7 +213,7 @@ public class DisposeDeviceManagerController { @PostMapping("/upgrade") @ResponseBody @ApiOperation("更新处置能力节点") - public ProtocolRespDTO> upgradeDisposeDevice( + public ProtocolRespDTO upgradeDisposeDevice( @Validated(ValidGroups.UpgradeDeviceValid.class) @RequestBody ProtocolReqDTO mr) { @@ -223,7 +223,7 @@ public class DisposeDeviceManagerController { // 更新设备信息 List> ret = disposeDeviceManagerService.upgradeDisposeDevice(devs); - BaseListResp rspInfo = new BaseListResp<>(); + CommDeviceListRsp rspInfo = new CommDeviceListRsp(); rspInfo.setItems(new ArrayList<>()); ret.forEach(v -> { @@ -232,7 +232,7 @@ public class DisposeDeviceManagerController { disposeDeviceManagerService.getAllDisposeDevice().parallelStream() .filter(k -> k.getId().equals(dev.getId())) - .findAny().ifPresent(device -> rsp.setDevStatus(device.getStatus())); + .findAny().ifPresent(device -> rsp.setDevStatus(device.getStatus().getValue())); rsp.setId(String.valueOf(dev.getId())); rsp.setStatus(v.getFirstParam().getCode()); diff --git a/src/main/java/com/dispose/controller/DisposeTaskController.java b/src/main/java/com/dispose/controller/DisposeTaskController.java index 1f1fc894..fca1f464 100644 --- a/src/main/java/com/dispose/controller/DisposeTaskController.java +++ b/src/main/java/com/dispose/controller/DisposeTaskController.java @@ -7,7 +7,6 @@ import com.dispose.common.DisposeConfigValue; import com.dispose.common.ErrorCode; import com.dispose.common.Helper; import com.dispose.common.NetflowDirection; -import com.dispose.pojo.dto.protocol.base.BaseListResp; import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.dispose.pojo.dto.protocol.base.IdArraysReq; import com.dispose.pojo.dto.protocol.base.ProtocolReqDTO; @@ -19,6 +18,7 @@ import com.dispose.pojo.dto.protocol.task.GetTaskRsp; import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.TaskStartReq; import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.TaskStopItem; import com.dispose.pojo.dto.protocol.task.TaskStopRsp; import com.dispose.pojo.entity.DeviceTask; import com.dispose.pojo.entity.DisposeTask; @@ -210,11 +210,11 @@ public class DisposeTaskController { @PostMapping("/stop") @ResponseBody @ApiOperation("停止处置任务") - public ProtocolRespDTO stopTask(@Validated(ValidGroups.TaskStopReqValid.class) + public ProtocolRespDTO stopTask(@Validated(ValidGroups.TaskStopReqValid.class) @RequestBody ProtocolReqDTO mr) { // 记录多个任务停止信息 - BaseListResp rspList = new BaseListResp<>(); + TaskStopRsp rspList = new TaskStopRsp(); rspList.setItems(new ArrayList<>()); @@ -223,7 +223,7 @@ public class DisposeTaskController { // 停止处置任务 MulReturnType ret = disposeTaskService.stopTask(Long.parseLong(tId)); - TaskStopRsp rspInfo = TaskStopRsp.builder().build(); + TaskStopItem rspInfo = TaskStopItem.builder().build(); // 停止成功 if (ret.getFirstParam() == ErrorCode.ERR_OK) { diff --git a/src/main/java/com/dispose/pojo/dto/protocol/base/BaseListResp.java b/src/main/java/com/dispose/pojo/dto/protocol/device/manager/CommDeviceListRsp.java similarity index 70% rename from src/main/java/com/dispose/pojo/dto/protocol/base/BaseListResp.java rename to src/main/java/com/dispose/pojo/dto/protocol/device/manager/CommDeviceListRsp.java index f17548ad..ce685df5 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/base/BaseListResp.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/device/manager/CommDeviceListRsp.java @@ -1,5 +1,6 @@ -package com.dispose.pojo.dto.protocol.base; +package com.dispose.pojo.dto.protocol.device.manager; +import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.AllArgsConstructor; @@ -11,9 +12,8 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * The type Base list resp. + * The type Del device rsp. * - * @param the type parameter * @author */ @EqualsAndHashCode(callSuper = true) @@ -23,9 +23,9 @@ import java.util.List; @AllArgsConstructor @JsonPropertyOrder({"items", "status", "message"}) @JsonInclude(JsonInclude.Include.NON_NULL) -public class BaseListResp extends BaseRespStatus { +public class CommDeviceListRsp extends BaseRespStatus { /** * The Items. */ - private List items; + private List items; } diff --git a/src/main/java/com/dispose/pojo/dto/protocol/device/manager/DeviceInfoRsp.java b/src/main/java/com/dispose/pojo/dto/protocol/device/manager/DeviceInfoRsp.java index de0b0651..a092219e 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/device/manager/DeviceInfoRsp.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/device/manager/DeviceInfoRsp.java @@ -1,6 +1,5 @@ package com.dispose.pojo.dto.protocol.device.manager; -import com.dispose.common.ObjectStatus; import com.dispose.pojo.dto.protocol.base.BaseIdResp; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -26,5 +25,5 @@ public class DeviceInfoRsp extends BaseIdResp { /** * The Dev status. */ - private ObjectStatus devStatus; + private Integer devStatus; } diff --git a/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopItem.java b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopItem.java new file mode 100644 index 00000000..dc4b834d --- /dev/null +++ b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopItem.java @@ -0,0 +1,42 @@ +package com.dispose.pojo.dto.protocol.task; + +import com.dispose.pojo.dto.protocol.base.BaseIdResp; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * The type Task stop item. + * + * @author + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonPropertyOrder({"taskId", "disposeDevice", "type", "disposeIp", "leftTime", "status", "message"}) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TaskStopItem extends BaseIdResp { + + /** + * The Dispose device. + */ + private String[] disposeDevice; + /** + * The Type. + */ + private Integer type; + /** + * The Dispose ip. + */ + private String disposeIp; + /** + * The Left time. + */ + private String leftTime; +} diff --git a/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopRsp.java b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopRsp.java index c4c90582..47c865f7 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopRsp.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStopRsp.java @@ -1,7 +1,6 @@ package com.dispose.pojo.dto.protocol.task; -import com.dispose.pojo.dto.protocol.base.BaseIdResp; -import com.fasterxml.jackson.annotation.JsonInclude; +import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.AllArgsConstructor; import lombok.Builder; @@ -9,8 +8,10 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import java.util.List; + /** - * The type Task stop resp. + * The type Task stop rsp. * * @author */ @@ -19,24 +20,10 @@ import lombok.NoArgsConstructor; @Builder @NoArgsConstructor @AllArgsConstructor -@JsonPropertyOrder({"taskId", "disposeDevice", "type", "disposeIp", "leftTime", "status", "message"}) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class TaskStopRsp extends BaseIdResp { - +@JsonPropertyOrder({"items", "status", "message"}) +public class TaskStopRsp extends BaseRespStatus { /** - * The Dispose device. + * The Items. */ - private String[] disposeDevice; - /** - * The Type. - */ - private Integer type; - /** - * The Dispose ip. - */ - private String disposeIp; - /** - * The Left time. - */ - private String leftTime; + private List items; }