Browse Source

模拟流向查询接口更改

张昭 3 years ago
parent
commit
7c3d5c4eee

+ 3 - 6
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/FlowQueryController.java

@@ -1,13 +1,10 @@
 package com.abi.qms.platform.controller.console;
 
 import com.abi.platform.Base.BaseResponse;
-import com.abi.qms.platform.dto.req.GetBoxCodeReq;
+import com.abi.qms.platform.dto.req.GetFlowInfoReq;
 import com.abi.qms.platform.dto.req.GetInvisibleCodeReq;
-import com.abi.qms.platform.dto.req.GetStackCodeReq;
-import com.abi.qms.platform.dto.res.GetBoxCodeRes;
 import com.abi.qms.platform.dto.res.GetFlowInfoRes;
 import com.abi.qms.platform.dto.res.GetInvisibleCodeRes;
-import com.abi.qms.platform.dto.res.GetStackCodeRes;
 import com.abi.qms.platform.service.FlowQueryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -34,8 +31,8 @@ public class FlowQueryController {
 
     @ApiOperation("箱码垛码查询")
     @GetMapping()
-    public BaseResponse<GetFlowInfoRes> boxCode (@Validated GetBoxCodeReq getBoxCodeReq) {
-        GetFlowInfoRes res = flowQueryService.queryFlow(getBoxCodeReq);
+    public BaseResponse<GetFlowInfoRes> flowQuery (@Validated GetFlowInfoReq getFlowInfoReq) {
+        GetFlowInfoRes res = flowQueryService.queryFlow(getFlowInfoReq);
         return BaseResponse.create(res);
     }
 

+ 2 - 2
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/GetBoxCodeReq.java

@@ -20,14 +20,14 @@ import java.io.Serializable;
 @Schema
 @AllArgsConstructor
 @NoArgsConstructor
-public class GetBoxCodeReq implements Serializable {
+public class GetFlowInfoReq implements Serializable {
 
     @Schema(name = "查询类型")
     @NotNull(message = "查询类型为空")
     private Integer queryType;
 
     @Schema(name = "查询内容 -对应查询类型")
-    @NotNull(message = "码为空")
+    @NotNull(message = "查询码为空")
     private String inquireCode;
 
 

+ 1 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/FlowQueryService.java

@@ -15,7 +15,7 @@ public interface FlowQueryService {
     /**
      * 流向查询
      */
-    GetFlowInfoRes queryFlow(GetBoxCodeReq getBoxCodeReq);
+    GetFlowInfoRes queryFlow(GetFlowInfoReq getFlowInfoReq);
     /**
      * 箱码查询
      * @param boxCode 箱码

+ 6 - 8
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/FlowQueryServiceImpl.java

@@ -213,7 +213,7 @@ public class FlowQueryServiceImpl implements FlowQueryService {
      * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
      */
     @Override
-    public GetFlowInfoRes queryFlow(GetBoxCodeReq req) {
+    public GetFlowInfoRes queryFlow(GetFlowInfoReq req) {
         Integer queryType = req.getQueryType();
         GetFlowInfoRes res = null;
         //查询内容
@@ -413,18 +413,16 @@ public class FlowQueryServiceImpl implements FlowQueryService {
      * @param res 查询结果
      * @param req 查询请求
      */
-    private void saveQueryRecord(GetFlowInfoRes res, GetBoxCodeReq req) {
+    private void saveQueryRecord(GetFlowInfoRes res, GetFlowInfoReq req) {
         try {
             //查询类型
             Integer queryType = req.getQueryType();
             //判断流向状态
             Map<Integer, GetFlowInfoRes.FlowBean> abnormalNodeMap = new HashMap<>();
-            if (!FlowQueryTypeEnum.TRAY_CODE.is(req.getQueryType())) {
-                abnormalNodeMap = res.getFlowList()
-                        .stream()
-                        .filter(s -> !(s.getNodeStatus().equals(1)))
-                        .collect(Collectors.toMap(GetFlowInfoRes.FlowBean::getAbnormalType, flowBean -> flowBean));
-            }
+            abnormalNodeMap = res.getFlowList()
+                    .stream()
+                    .filter(s -> !(Objects.equals(s.getNodeStatus(), 1)))
+                    .collect(Collectors.toMap(GetFlowInfoRes.FlowBean::getAbnormalType, flowBean -> flowBean));
 
             FlowStatusEnum flowStatus = MapUtil.isEmpty(abnormalNodeMap) ? FlowStatusEnum.NORMAL : FlowStatusEnum.ABNORMAL;