2 İşlemeler f9b20f317e ... dc38e4f8a2

Yazar SHA1 Mesaj Tarih
  张昭 dc38e4f8a2 Merge remote-tracking branch 'origin/feature/1.0.0' into feature/1.0.0 3 yıl önce
  张昭 d6d8ffddcb 关联案件调整 3 yıl önce

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

@@ -10,7 +10,9 @@ import com.abi.qms.platform.feign.SkuFeign;
 import com.abi.qms.platform.service.IInspectionCaseService;
 import com.abi.task.common.api.base.BaseResponse;
 import com.abi.task.common.excel.ExcelInputFactory;
+import com.abi.task.common.excel.ExcelOutputFactory;
 import com.abi.task.common.excel.preperties.MaterialProperty;
+import com.abi.task.common.excel.preperties.QrBoxExportProperty;
 import lombok.RequiredArgsConstructor;
 
 import javax.servlet.http.HttpServletResponse;
@@ -139,7 +141,7 @@ public class InspectionCaseController {
     @GetMapping("/export")
     public void export(@Validated ExportInspectionCaseReq req, HttpServletResponse response) {
         List<ExportInspectionCaseRes> resList = inspectionCaseService.export(req);
-        ExcelInputFactory.downloadExcelData("稽查案件", response, resList, ExportInspectionCaseRes.class);
+        ExcelOutputFactory.outputStreamExcel("稽查案件", response, resList, ExportInspectionCaseRes.class);
     }
 
 

+ 4 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ExportFlowQueryRecordReq.java

@@ -17,6 +17,9 @@ import java.time.LocalDateTime;
 @Data
 public class ExportFlowQueryRecordReq implements Serializable {
 
+    @ApiModelProperty(value = "编号")
+    private Long id;
+
     /**
      * 箱码
      */
@@ -45,7 +48,7 @@ public class ExportFlowQueryRecordReq implements Serializable {
      * 查询用户ID
      */
     @ApiModelProperty(value = "查询用户ID")
-    private Long queryUserId;
+    private Long queryUserName;
 
     /**
      * 查询时间-开始

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

@@ -23,6 +23,12 @@ public interface FlowQueryService {
      */
     GetBoxCodeRes getFlowInfoByBoxCode(String boxCode);
 
+    /**
+     * 隐形码
+     * @param invisibleCode 隐形码
+     * @return
+     */
+    GetBoxCodeRes getFlowInfoByInvisibleCode(String invisibleCode);
 
     /**
      * 隐形码查询

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

@@ -1,6 +1,7 @@
 package com.abi.qms.platform.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.json.JSONUtil;
 import com.abi.qms.platform.dao.entity.UserInfo;
@@ -39,54 +40,81 @@ public class FlowQueryServiceImpl implements FlowQueryService {
     @Autowired
     private UserUtil userUtil;
 
-    /**
-     * 箱码查询
-     * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
-     */
-    @Override
-    public GetBoxCodeRes boxCode(GetBoxCodeReq req) {
-        Integer queryType = req.getQueryType();
-        GetBoxCodeRes res = null;
 
-        if (FlowQueryTypeEnum.BOX_CODE.is(queryType)) {
-            // 箱码(明码)查询
-            String boxCode = req.getBoxCode();
-            res = this.getFlowInfoByBoxCode(boxCode);
-        } else if (FlowQueryTypeEnum.INVISIBLE_CODE.is(queryType)) {
-            // 箱码(隐形码)查询
-            String boxCode = req.getBoxCode();
-            res = this.getFlowInfoByBoxCode(boxCode);
-        }
+    private  static  List<GetBoxCodeRes> boxCodeResList=new ArrayList<>();
 
-        AssertUtil.isNull(res, "未查询到流向信息!");
-        //保存查询记录
-        this.saveQueryRecord(res, req);
-        return res;
-    }
+    static {
+        GetBoxCodeRes res1 = new GetBoxCodeRes();
+        GetBoxCodeRes.SkuBean sku1 = new GetBoxCodeRes.SkuBean()
+                .setBrandCode("01AAAC")
+                .setBrandName("贝克")
+                .setSkuId("000000000000005957")
+                .setSkuName("贝克11.2度275ML 4X6 纸箱OW瓶")
+                .setProductionBatch("20210512CB0631HN-30")
+                .setProductionTime(LocalDateTime.of(2021, 5, 21, 13, 0, 0));
 
-    /**
-     * 查询流向信息
-     *
-     * @param boxCode 箱码
-     * @return
-     */
-    @Override
-    public GetBoxCodeRes getFlowInfoByBoxCode(String boxCode) {
-        GetBoxCodeRes res = new GetBoxCodeRes();
+        GetBoxCodeRes.BoxStackBean boxStack1 = new GetBoxCodeRes.BoxStackBean()
+                .setBoxCode("aoi78amsnzlkyyhbjA")
+                .setInvisibleCode("11111111111111111111")
+                .setOriginalStackCode("200700048457ADB2")
+                .setOriginalStackTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
+                .setNewestStackCode("100733348457ADB2")
+                .setNewestStackTime(LocalDateTime.of(2021, 1, 1, 11, 12, 38));
+        List<GetBoxCodeRes.FlowBean> flowList1 = getflowList();
+        res1.setSku(sku1);
+        res1.setFlowList(flowList1);
+        res1.setBoxStack(boxStack1);
+        boxCodeResList.add(res1);
+
+
+        GetBoxCodeRes res2 = new GetBoxCodeRes();
+        GetBoxCodeRes.SkuBean sku2 = new GetBoxCodeRes.SkuBean()
+                .setBrandCode("01ABZY")
+                .setBrandName("哈尔滨")
+                .setSkuId("000000000000025112")
+                .setSkuName("哈尔滨特制8度500ML1X24塑箱回瓶装")
+                .setProductionBatch("20210512CB0631HN-30")
+                .setProductionTime(LocalDateTime.of(2021, 5, 21, 13, 0, 0));
+
+        GetBoxCodeRes.BoxStackBean boxStack2 = new GetBoxCodeRes.BoxStackBean()
+                .setBoxCode("aoi78amsnzlkyyhbjB")
+                .setInvisibleCode("22222222222222222222")
+                .setOriginalStackCode("200700048457ADB2")
+                .setOriginalStackTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
+                .setNewestStackCode("100733348457ADB2")
+                .setNewestStackTime(LocalDateTime.of(2021, 1, 1, 11, 12, 38));
+        List<GetBoxCodeRes.FlowBean> flowList2 = getflowList();
+        res2.setSku(sku2);
+        res2.setFlowList(flowList2);
+        res2.setBoxStack(boxStack2);
+        boxCodeResList.add(res2);
 
-        GetBoxCodeRes.SkuBean sku = new GetBoxCodeRes.SkuBean()
+
+        GetBoxCodeRes res3 = new GetBoxCodeRes();
+        GetBoxCodeRes.SkuBean sku3 = new GetBoxCodeRes.SkuBean()
                 .setBrandCode("01AAHF")
                 .setBrandName("百威")
-                .setSkuId("000000000000025000")
-                .setSkuName("百威9.7度500ML1X18纸箱听装-温州版")
+                .setSkuId("000000000000025141")
+                .setSkuName("百威9.7度330ML1X24纸箱OW瓶装")
                 .setProductionBatch("20210512CB0631HN-30")
                 .setProductionTime(LocalDateTime.of(2021, 5, 21, 13, 0, 0));
 
-        GetBoxCodeRes.InspectionCaseBean inspectionCase = new GetBoxCodeRes.InspectionCaseBean()
-                .setCaseNumber("江苏省南京市#1")
-                .setCaseName("模拟接口稽查案件");
+        GetBoxCodeRes.BoxStackBean boxStack3 = new GetBoxCodeRes.BoxStackBean()
+                .setBoxCode("aoi78amsnzlkyyhbjC")
+                .setInvisibleCode("33333333333333333333")
+                .setOriginalStackCode("200700048457ADB2")
+                .setOriginalStackTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
+                .setNewestStackCode("100733348457ADB2")
+                .setNewestStackTime(LocalDateTime.of(2021, 1, 1, 11, 12, 38));
+        List<GetBoxCodeRes.FlowBean> flowList3 = getflowList();
+        res3.setSku(sku3);
+        res3.setFlowList(flowList3);
+        res3.setBoxStack(boxStack3);
+        boxCodeResList.add(res3);
+    }
 
-        List flowList = new LinkedList();
+    private static List<GetBoxCodeRes.FlowBean> getflowList() {
+        List<GetBoxCodeRes.FlowBean> flowList = new LinkedList();
         GetBoxCodeRes.FlowBean flow = new GetBoxCodeRes.FlowBean()
                 .setNodeId(8902L)
                 .setNodeName("CNA9-百威英博大富豪(盐城)啤酒有限公司")
@@ -133,24 +161,72 @@ public class FlowQueryServiceImpl implements FlowQueryService {
                 .setIsSplit(0)
                 .setInStorageTime(LocalDateTime.of(2020, 12, 27, 11, 12, 38));
         flowList.add(flow);
-        Collections.reverse(flowList);
+        //Collections.reverse(flowList);
+        return flowList;
+    }
 
-        GetBoxCodeRes.BoxStackBean boxStack = new GetBoxCodeRes.BoxStackBean()
-                .setBoxCode(boxCode)
-                .setInvisibleCode("adb25416313")
-                .setOriginalStackCode("200700048457ADB2")
-                .setOriginalStackTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
-                .setNewestStackCode("100733348457ADB2")
-                .setNewestStackTime(LocalDateTime.of(2021, 1, 1, 11, 12, 38));
 
 
-        res.setSku(sku);
-        res.setInspectionCase(inspectionCase);
-        res.setFlowList(flowList);
-        res.setBoxStack(boxStack);
+
+    /**
+     * 箱码查询
+     * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
+     */
+    @Override
+    public GetBoxCodeRes boxCode(GetBoxCodeReq req) {
+        Integer queryType = req.getQueryType();
+        GetBoxCodeRes res = null;
+
+        if (FlowQueryTypeEnum.BOX_CODE.is(queryType)) {
+            // 箱码(明码)查询
+            String boxCode = req.getBoxCode();
+            res = this.getFlowInfoByBoxCode(boxCode);
+        } else if (FlowQueryTypeEnum.INVISIBLE_CODE.is(queryType)) {
+            // 箱码(隐形码)查询
+            String boxCode = req.getBoxCode();
+            res = this.getFlowInfoByInvisibleCode(boxCode);
+        }
+
+        AssertUtil.isNull(res, "未查询到流向信息!");
+        //保存查询记录
+        this.saveQueryRecord(res, req);
         return res;
     }
 
+    /**
+     * 查询流向信息
+     *
+     * @param boxCode 箱码
+     * @return
+     */
+    @Override
+    public GetBoxCodeRes getFlowInfoByBoxCode(String boxCode) {
+        GetBoxCodeRes getBoxCodeRes=null;
+        List<GetBoxCodeRes> collect = boxCodeResList.stream().filter(s -> s.getBoxStack().getBoxCode().equals(boxCode)).collect(Collectors.toList());
+        if(CollectionUtil.isNotEmpty(collect)){
+             getBoxCodeRes = collect.get(0);
+        }
+        return getBoxCodeRes;
+    }
+
+
+    /**
+     * 查询流向信息
+     *
+     * @param invisibleCode 箱码
+     * @return
+     */
+    @Override
+    public GetBoxCodeRes getFlowInfoByInvisibleCode(String invisibleCode) {
+        GetBoxCodeRes getBoxCodeRes=null;
+        List<GetBoxCodeRes> collect = boxCodeResList.stream().filter(s -> s.getBoxStack().getInvisibleCode().equals(invisibleCode)).collect(Collectors.toList());
+        if(CollectionUtil.isNotEmpty(collect)){
+            getBoxCodeRes = collect.get(0);
+        }
+        return getBoxCodeRes;
+    }
+
+
 
 
     /**