|
@@ -13,8 +13,8 @@ import com.abi.qms.platform.dto.res.*;
|
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.UserUtil;
|
|
|
import com.abi.qms.platform.service.FlowQueryService;
|
|
|
-import com.abi.qms.platform.service.IFlowQueryRecordService;
|
|
|
-import com.abi.qms.platform.service.IInspectionCaseService;
|
|
|
+import com.abi.qms.platform.service.FlowQueryRecordService;
|
|
|
+import com.abi.qms.platform.service.InspectionCaseService;
|
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,10 +36,10 @@ public class FlowQueryServiceImpl implements FlowQueryService {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
- private IFlowQueryRecordService flowQueryRecordService;
|
|
|
+ private FlowQueryRecordService flowQueryRecordService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IInspectionCaseService caseService;
|
|
|
+ private InspectionCaseService caseService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserUtil userUtil;
|
|
@@ -225,13 +225,18 @@ public class FlowQueryServiceImpl implements FlowQueryService {
|
|
|
} else if (FlowQueryTypeEnum.INVISIBLE_CODE.is(queryType)) {
|
|
|
// 箱码(隐形码)查询
|
|
|
res = this.getFlowInfoByInvisibleCode(inquireCode);
|
|
|
- } else if (FlowQueryTypeEnum.TRAY_CODE.is(queryType)) {
|
|
|
+ } else if (FlowQueryTypeEnum.STACK_CODE.is(queryType)) {
|
|
|
// 剁码查询
|
|
|
res = this.getFlowInfoByStackCode(inquireCode);
|
|
|
}
|
|
|
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.STACK_CODE.getCode())
|
|
|
+ .setQueryPlatform(ReqChannelTypeEnum.WECHAT.getCode())
|
|
|
+ .setQueryAddress("");
|
|
|
+ this.saveQueryRecord(res, saveFlowQueryRecordReq);
|
|
|
+ return PojoConverterUtils.copy(res, WxGetStackCodeRes.class);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -413,16 +428,18 @@ public class FlowQueryServiceImpl implements FlowQueryService {
|
|
|
* @param res 查询结果
|
|
|
* @param req 查询请求
|
|
|
*/
|
|
|
- private void saveQueryRecord(GetFlowInfoRes res, GetFlowInfoReq req) {
|
|
|
+ private void saveQueryRecord(GetFlowInfoRes res, SaveFlowQueryRecordReq req) {
|
|
|
try {
|
|
|
//查询类型
|
|
|
Integer queryType = req.getQueryType();
|
|
|
//判断流向状态
|
|
|
Map<Integer, GetFlowInfoRes.FlowBean> abnormalNodeMap = new HashMap<>();
|
|
|
- abnormalNodeMap = res.getFlowList()
|
|
|
- .stream()
|
|
|
- .filter(s -> !(Objects.equals(s.getNodeStatus(), 1)))
|
|
|
- .collect(Collectors.toMap(GetFlowInfoRes.FlowBean::getAbnormalType, flowBean -> flowBean));
|
|
|
+ if (!FlowQueryTypeEnum.STACK_CODE.is(queryType)) {
|
|
|
+ abnormalNodeMap = res.getFlowList()
|
|
|
+ .stream()
|
|
|
+ .filter(s -> !(s.getNodeStatus().equals(1)))
|
|
|
+ .collect(Collectors.toMap(GetFlowInfoRes.FlowBean::getAbnormalType, flowBean -> flowBean));
|
|
|
+ }
|
|
|
|
|
|
FlowStatusEnum flowStatus = MapUtil.isEmpty(abnormalNodeMap) ? FlowStatusEnum.NORMAL : FlowStatusEnum.ABNORMAL;
|
|
|
|
|
@@ -432,8 +449,8 @@ public class FlowQueryServiceImpl implements FlowQueryService {
|
|
|
|
|
|
|
|
|
// 箱码 查询类型为箱码时必传
|
|
|
- if (FlowQueryTypeEnum.TRAY_CODE.is(req.getQueryType())) {
|
|
|
- addReq.setTrayCode(res.getStack().getStackCode());
|
|
|
+ if (FlowQueryTypeEnum.STACK_CODE.is(queryType)) {
|
|
|
+ addReq.setStackCode(res.getStack().getStackCode());
|
|
|
} else {
|
|
|
addReq.setBoxCode(res.getBoxStack().getBoxCode());
|
|
|
}
|
|
@@ -450,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);
|