Parcourir la source

保存微信查询记录

bess-WeiganCai il y a 3 ans
Parent
commit
e6d10c2eff

+ 1 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/wx/WxFlowQueryController.java

@@ -41,7 +41,7 @@ public class WxFlowQueryController {
     @ApiOperation("隐形码模糊查询")
     @GetMapping("/invisibleCode/like")
     public BaseResponse<WxGetInvisibleCodeRes> invisibleCode (@Validated WxGetInvisibleCodeReq req) {
-        WxGetInvisibleCodeRes res = flowQueryService.WxInvisibleCode(req);
+        WxGetInvisibleCodeRes res = flowQueryService.wxInvisibleCode(req);
         return BaseResponse.create(res);
     }
 

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

@@ -0,0 +1,23 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 保存流向查询记录
+ * @author WeiganCai
+ * @date: 2021-08-24
+ */
+@Data
+@Accessors(chain = true)
+public class SaveFlowQueryRecordReq {
+	@Schema(name = "查询类型")
+	private Integer queryType;
+
+	@Schema(name = "查询平台")
+	private Integer queryPlatform;
+
+	@Schema(name = "查询地址")
+	private String queryAddress;
+}

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

@@ -46,7 +46,7 @@ public interface FlowQueryService {
     /**
      * 微信隐形码查询
      */
-    WxGetInvisibleCodeRes WxInvisibleCode(WxGetInvisibleCodeReq req);
+    WxGetInvisibleCodeRes wxInvisibleCode(WxGetInvisibleCodeReq req);
 
     /**
      * 微信垛码查询

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

@@ -231,7 +231,12 @@ public class FlowQueryServiceImpl implements FlowQueryService {
         }
         AssertUtil.isNull(res, "未查询到流向信息!");
         //保存查询记录
-        this.saveQueryRecord(res, req);
+        SaveFlowQueryRecordReq saveFlowQueryRecordReq = new SaveFlowQueryRecordReq()
+                .setQueryType(queryType)
+                .setQueryPlatform(ReqChannelTypeEnum.BACKSTAGE.getCode())
+                .setQueryAddress("");
+
+        this.saveQueryRecord(res, saveFlowQueryRecordReq);
         return res;
     }
 
@@ -381,8 +386,13 @@ public class FlowQueryServiceImpl implements FlowQueryService {
     @Override
     public WxGetBoxCodeRes wxBoxCode(WxGetBoxCodeReq req) {
         // TODO 处理逻辑同console端,待流向查询接口完成后修改
-        GetFlowInfoRes flowInfoByBoxCode = this.getFlowInfoByBoxCode(req.getBoxCode());
-        return PojoConverterUtils.copy(flowInfoByBoxCode, WxGetBoxCodeRes.class);
+        GetFlowInfoRes res = this.getFlowInfoByBoxCode(req.getBoxCode());
+        SaveFlowQueryRecordReq saveFlowQueryRecordReq = new SaveFlowQueryRecordReq()
+                .setQueryType(req.getQueryType())
+                .setQueryPlatform(ReqChannelTypeEnum.WECHAT.getCode())
+                .setQueryAddress("");
+        this.saveQueryRecord(res, saveFlowQueryRecordReq);
+        return PojoConverterUtils.copy(res, WxGetBoxCodeRes.class);
     }
 
 
@@ -390,10 +400,10 @@ public class FlowQueryServiceImpl implements FlowQueryService {
      * 微信隐形码查询
      */
     @Override
-    public WxGetInvisibleCodeRes WxInvisibleCode(WxGetInvisibleCodeReq req) {
+    public WxGetInvisibleCodeRes wxInvisibleCode(WxGetInvisibleCodeReq req) {
         // TODO 处理逻辑同console端,待流向查询接口完成后修改
-        GetFlowInfoRes flowInfoByInvisibleCode = this.getFlowInfoByInvisibleCode(req.getInvisibleCode());
-        return PojoConverterUtils.copy(flowInfoByInvisibleCode, WxGetInvisibleCodeRes.class);
+        GetFlowInfoRes res = this.getFlowInfoByInvisibleCode(req.getInvisibleCode());
+        return PojoConverterUtils.copy(res, WxGetInvisibleCodeRes.class);
     }
 
     /**
@@ -402,8 +412,13 @@ public class FlowQueryServiceImpl implements FlowQueryService {
     @Override
     public WxGetStackCodeRes wxStackCode(WxGetStackCodeReq req) {
         // TODO 处理逻辑同console端,待流向查询接口完成后修改
-        GetFlowInfoRes stackCodeRes = this.getFlowInfoByStackCode(req.getStackCode());
-        return PojoConverterUtils.copy(stackCodeRes, WxGetStackCodeRes.class);
+        GetFlowInfoRes res = this.getFlowInfoByStackCode(req.getStackCode());
+        SaveFlowQueryRecordReq saveFlowQueryRecordReq = new SaveFlowQueryRecordReq()
+                .setQueryType(FlowQueryTypeEnum.TRAY_CODE.getCode())
+                .setQueryPlatform(ReqChannelTypeEnum.WECHAT.getCode())
+                .setQueryAddress("");
+        this.saveQueryRecord(res, saveFlowQueryRecordReq);
+        return PojoConverterUtils.copy(res, WxGetStackCodeRes.class);
     }
 
 
@@ -413,13 +428,13 @@ public class FlowQueryServiceImpl implements FlowQueryService {
      * @param res 查询结果
      * @param req 查询请求
      */
-    private void saveQueryRecord(GetFlowInfoRes res, GetBoxCodeReq req) {
+    private void saveQueryRecord(GetFlowInfoRes res, SaveFlowQueryRecordReq req) {
         try {
             //查询类型
             Integer queryType = req.getQueryType();
             //判断流向状态
             Map<Integer, GetFlowInfoRes.FlowBean> abnormalNodeMap = new HashMap<>();
-            if (!FlowQueryTypeEnum.TRAY_CODE.is(req.getQueryType())) {
+            if (!FlowQueryTypeEnum.TRAY_CODE.is(queryType)) {
                 abnormalNodeMap = res.getFlowList()
                         .stream()
                         .filter(s -> !(s.getNodeStatus().equals(1)))
@@ -434,7 +449,7 @@ public class FlowQueryServiceImpl implements FlowQueryService {
 
 
             //  箱码 查询类型为箱码时必传
-            if (FlowQueryTypeEnum.TRAY_CODE.is(req.getQueryType())) {
+            if (FlowQueryTypeEnum.TRAY_CODE.is(queryType)) {
                 addReq.setTrayCode(res.getStack().getStackCode());
             } else {
                 addReq.setBoxCode(res.getBoxStack().getBoxCode());
@@ -452,11 +467,11 @@ public class FlowQueryServiceImpl implements FlowQueryService {
             addReq.setProductionTime(sku.getProductionTime());
 
 
-            //后台查询
-            addReq.setQueryPlatform(ReqChannelTypeEnum.BACKSTAGE.getCode());
+            //设置查询平台
+            addReq.setQueryPlatform(req.getQueryPlatform());
 
-            //后台查询没有地址
-            addReq.setQueryAddress("");
+            //设置查询地址
+            addReq.setQueryAddress(req.getQueryAddress());
 
             //abnormalNodeIn
             GetFlowInfoRes.FlowBean abnormalNodeIn = abnormalNodeMap.get(1);