Forráskód Böngészése

箱码查询模拟接口

caiweigan 3 éve
szülő
commit
3862994636

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

@@ -0,0 +1,37 @@
+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.res.GetBoxCodeRes;
+import com.abi.qms.platform.service.FlowQueryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 箱码垛码查询 Controller
+ *
+ * @author WeiganCai
+ * @date 2021-08-02
+ */
+@Slf4j
+@RestController
+@Api(tags = "箱码垛码查询")
+@RequestMapping("/flowQuery")
+public class FlowQueryController {
+    @Autowired
+    private FlowQueryService flowQueryService;
+
+    @ApiOperation("箱码查询")
+    @GetMapping("/boxCode")
+    public BaseResponse<GetBoxCodeRes> boxCode (@Validated GetBoxCodeReq getBoxCodeReq) {
+        GetBoxCodeRes res = flowQueryService.boxCode(getBoxCodeReq);
+        return BaseResponse.create(res);
+    }
+
+}

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

@@ -0,0 +1,22 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 箱码查询入参
+ *
+ * @author WeiganCai
+ * @date: 2021-08-02
+ */
+@Data
+@Schema
+public class GetBoxCodeReq implements Serializable {
+
+    @Schema(name = "箱码")
+    @NotNull(message = "箱码为空")
+    private String boxCode;
+}

+ 124 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/GetBoxCodeRes.java

@@ -0,0 +1,124 @@
+package com.abi.qms.platform.dto.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 箱码查询出参
+ * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
+ * @author WeiganCai
+ * @date: 2021-08-02
+ */
+@Data
+@ApiModel
+public class GetBoxCodeRes implements Serializable {
+    @Schema(name = "SKU信息")
+    private SkuBean sku;
+
+    @Schema(name = "案件信息")
+    private InspectionCaseBean inspectionCase;
+
+    @Schema(name = "流向信息")
+    private List<FlowBean> flowList;
+
+    @Schema(name = "箱垛信息")
+    private BoxStackBean boxStack;
+
+
+    /**
+     * SKU信息
+     */
+    @Data
+    @Accessors(chain = true)
+    public static class SkuBean implements Serializable {
+        @Schema(name = "品牌名称")
+        private String brandName;
+
+        @Schema(name = "SKUId")
+        private Long skuId;
+
+        @Schema(name = "SKU名称")
+        private String skuName;
+
+        @Schema(name = "生产批次")
+        private String productionBatch;
+
+        @Schema(name = "生产日期")
+        @JsonFormat(pattern = "yyyy-MM-dd")
+        private LocalDateTime productionTime;
+    }
+
+    /**
+     * 案件信息
+     */
+    @Data
+    @Accessors(chain = true)
+    public static class InspectionCaseBean implements Serializable {
+        @Schema(name = "案件编号")
+        private String caseNumber;
+
+        @Schema(name = "案件名称")
+        private String caseName;
+    }
+
+    /**
+     * 流向信息
+     */
+    @Data
+    @Accessors(chain = true)
+    public static class FlowBean implements Serializable {
+        @Schema(name = "节点名称")
+        private String nodeName;
+
+        @Schema(name = "节点状态")
+        private Integer nodeStatus;
+
+        @Schema(name = "是否拆垛")
+        private Integer isSplit;
+
+        @Schema(name = "拆垛托盘码")
+        private String splitStackCode;
+
+        @Schema(name = "入库时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime inStorageTime;
+
+        @Schema(name = "出库时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime outStorageTime;
+    }
+
+    /**
+     * 箱垛信息
+     */
+    @Data
+    @Accessors(chain = true)
+    public static class BoxStackBean implements Serializable {
+        @Schema(name = "箱码")
+        private String boxCode;
+
+        @Schema(name = "隐形码")
+        private String invisibleCode;
+
+        @Schema(name = "原始托盘码")
+        private String originalStackCode;
+
+        @Schema(name = "原始堆垛时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime originalStackTime;
+
+        @Schema(name = "最新托盘码")
+        private String newestStackCode;
+
+        @Schema(name = "最新堆垛时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime newestStackTime;
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.abi.qms.platform.service;
+
+import com.abi.qms.platform.dto.req.GetBoxCodeReq;
+import com.abi.qms.platform.dto.res.GetBoxCodeRes;
+
+/**
+ * 箱码垛码查询 Service接口
+ *
+ * @author WeiganCai
+ * @date 2021-08-02
+ */
+public interface FlowQueryService {
+    /**
+     * 箱码查询
+     */
+    GetBoxCodeRes boxCode(GetBoxCodeReq getBoxCodeReq);
+}

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

@@ -0,0 +1,102 @@
+package com.abi.qms.platform.service.impl;
+
+import com.abi.qms.platform.dto.req.GetBoxCodeReq;
+import com.abi.qms.platform.dto.res.GetBoxCodeRes;
+import com.abi.qms.platform.service.FlowQueryService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 箱码垛码查询 Service业务层处理
+ *
+ * @author WeiganCai
+ * @date 2021-08-02
+ */
+@Service
+@Slf4j
+public class FlowQueryServiceImpl implements FlowQueryService {
+    /**
+     * 箱码查询
+     * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
+     */
+    @Override
+    public GetBoxCodeRes boxCode(GetBoxCodeReq getBoxCodeReq) {
+        GetBoxCodeRes res = new GetBoxCodeRes();
+
+        GetBoxCodeRes.SkuBean sku = new GetBoxCodeRes.SkuBean()
+                .setBrandName("百威")
+                .setSkuId(30859L)
+                .setSkuName("百威9.7度500ML1X18纸箱听装-温州版")
+                .setProductionBatch("20210512CB0631HN-30")
+                .setProductionTime(LocalDateTime.of(2021, 5, 21, 13, 0, 0));
+
+        GetBoxCodeRes.InspectionCaseBean inspectionCase = new GetBoxCodeRes.InspectionCaseBean()
+                .setCaseNumber("江苏省南京市#1")
+                .setCaseName("模拟接口稽查案件");
+
+        List flowList = new LinkedList();
+        GetBoxCodeRes.FlowBean flow = new GetBoxCodeRes.FlowBean()
+                .setNodeName("CNA9-百威英博大富豪(盐城)啤酒有限公司")
+                .setNodeStatus(1)
+                .setIsSplit(0)
+                .setOutStorageTime(LocalDateTime.of(2020, 12, 20, 9, 31, 33));
+        flowList.add(flow);
+
+        flow = new GetBoxCodeRes.FlowBean()
+                .setNodeName("上海吴泾DC")
+                .setNodeStatus(1)
+                .setIsSplit(1)
+                .setSplitStackCode("275612348457ADB2")
+                .setInStorageTime(LocalDateTime.of(2020, 12, 24, 11, 12, 38))
+                .setOutStorageTime(LocalDateTime.of(2020, 12, 24, 15, 12, 33));
+        flowList.add(flow);
+
+        flow = new GetBoxCodeRes.FlowBean()
+                .setNodeName("一级经销商")
+                .setNodeStatus(1)
+                .setIsSplit(0)
+                .setInStorageTime(LocalDateTime.of(2020, 12, 25, 11, 12, 38))
+                .setOutStorageTime(LocalDateTime.of(2020, 12, 25, 15, 12, 33));
+        flowList.add(flow);
+
+        flow = new GetBoxCodeRes.FlowBean()
+                .setNodeName("二级经销商")
+                .setNodeStatus(0)
+                .setIsSplit(1)
+                .setSplitStackCode("200712348457ADB2")
+                .setInStorageTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
+                .setOutStorageTime(LocalDateTime.of(2020, 12, 26, 15, 12, 33));
+        flowList.add(flow);
+
+        flow = new GetBoxCodeRes.FlowBean()
+                .setNodeName("杭州市延海百利超市(新华小区店)")
+                .setNodeStatus(0)
+                .setIsSplit(0)
+                .setInStorageTime(LocalDateTime.of(2020, 12, 27, 11, 12, 38));
+        flowList.add(flow);
+        Collections.reverse(flowList);
+
+        GetBoxCodeRes.BoxStackBean boxStack = new GetBoxCodeRes.BoxStackBean()
+                .setBoxCode("abikcsy6fp47p10")
+                .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);
+
+
+        return res;
+    }
+}