|
@@ -3,6 +3,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 com.abi.qms.platform.dao.entity.InspectionCase;
|
|
|
import com.abi.qms.platform.dao.entity.InspectionCaseBoxCode;
|
|
|
import com.abi.qms.platform.dao.enums.CaseNumberGenerateStrategyEnum;
|
|
@@ -21,6 +22,7 @@ import com.abi.qms.platform.dto.res.PageListInspectionCaseRes;
|
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
|
import com.abi.qms.platform.service.IInspectionCaseService;
|
|
|
+import com.abi.qms.platform.service.InspectionCaseNumberService;
|
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -33,6 +35,7 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.function.Consumer;
|
|
|
import java.util.function.Predicate;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -54,6 +57,9 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
@Autowired
|
|
|
private InspectionCaseBoxCodeMapper inspectionCaseBoxCodeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InspectionCaseNumberService caseNumberService;
|
|
|
+
|
|
|
/**
|
|
|
* 新增案件
|
|
|
*
|
|
@@ -66,7 +72,8 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
//============先校验箱码============
|
|
|
List<AddInspectionCaseReq.BoxCode> involvedBoxCodes = addReq.getInvolvedBoxCodes();
|
|
|
List<String> boxCodeStrList = involvedBoxCodes.stream().map(AddInspectionCaseReq.BoxCode::getBoxCode).collect(Collectors.toList());
|
|
|
- this.validatedBoxCode(boxCodeStrList);
|
|
|
+ //校验箱码信息 校验通过返回箱码对应流向信息
|
|
|
+ Map flowInfo = this.validatedBoxCode(boxCodeStrList);
|
|
|
|
|
|
//============案件编号============
|
|
|
String caseNumber = addReq.getCaseNumber();
|
|
@@ -84,10 +91,9 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
AssertUtil.isEmpty(inspectionCaseList, "当前编号已存在!");
|
|
|
|
|
|
//============保存案件============
|
|
|
- //TODO 查询流向信息
|
|
|
|
|
|
InspectionCase inspectionCase = new InspectionCase();
|
|
|
- //TODO 设置流入 流出经销商
|
|
|
+ //TODO 设置流入 流出经销商 从 flowInfo 中取出
|
|
|
inspectionCase.setOutAgencyCode("T0001");
|
|
|
inspectionCase.setOutAgencyName("T_京城XXX超市");
|
|
|
inspectionCase.setInAgencyCode("T0002");
|
|
@@ -110,6 +116,9 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
return inspectionCaseBoxCode;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
+ //============保存【案件-流向】关联============
|
|
|
+
|
|
|
+
|
|
|
//批量保存
|
|
|
inspectionCaseBoxCodeMapper.insertBatch(inspectionCaseBoxCodeList);
|
|
|
|
|
@@ -164,11 +173,12 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
//涉案箱码
|
|
|
List<EditInspectionCaseReq.BoxCode> involvedBoxCodes = editReq.getInvolvedBoxCodes();
|
|
|
List<String> boxCodeStrList = involvedBoxCodes.stream().map(EditInspectionCaseReq.BoxCode::getBoxCode).collect(Collectors.toList());
|
|
|
- this.validatedBoxCode(boxCodeStrList);
|
|
|
+ //校验箱码信息 返回箱码对应流向信息
|
|
|
+ Map map = this.validatedBoxCode(boxCodeStrList);
|
|
|
|
|
|
|
|
|
//============修改案件信息============
|
|
|
- //TODO 查询流向信息
|
|
|
+
|
|
|
|
|
|
InspectionCase inspectionCase = new InspectionCase();
|
|
|
//TODO 设置流入 流出经销商
|
|
@@ -226,7 +236,7 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
@Override
|
|
|
public GetInspectionCaseInfoRes getInspectionCaseInfo(final Long id) {
|
|
|
InspectionCaseDetailVO caseDetailVO = inspectionCaseMapper.selectInspectionCaseDetailById(id);
|
|
|
- AssertUtil.isNull(caseDetailVO, "此案件为查询到!");
|
|
|
+ AssertUtil.isNull(caseDetailVO, "此案件未查询到!");
|
|
|
|
|
|
GetInspectionCaseInfoRes getInspectionCaseInfoRes = new GetInspectionCaseInfoRes();
|
|
|
BeanUtil.copyProperties(caseDetailVO, getInspectionCaseInfoRes);
|
|
@@ -244,12 +254,18 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
* 2、提交箱码的流向信息是否一致
|
|
|
*
|
|
|
* @param boxCodeList 提交箱码列表
|
|
|
+ * @return 流向信息
|
|
|
*/
|
|
|
- private void validatedBoxCode(List<String> boxCodeList) {
|
|
|
+ private Map validatedBoxCode(List<String> boxCodeList) {
|
|
|
+
|
|
|
+ //TODO 查询流向信息
|
|
|
//TODO 校验提交箱码所对应的SKU信息是否正确;、校验提交箱码的流向信息是否相同
|
|
|
//List<String> errorBoxCodeList=new ArrayList<>();
|
|
|
//校验失败 抛出异常 说明错误箱码;并列出错误原因
|
|
|
//AssertUtil.isEmpty(errorBoxCodeList,"案件新增失败!箱码:XXXX;XXXXX,失败原因:SKU信息不一致/流向信息不一致");
|
|
|
+
|
|
|
+
|
|
|
+ return MapUtil.empty();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -262,9 +278,7 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
|
|
|
private String autoGenerateCaseNumber(Long provinceId, Long cityId) {
|
|
|
AssertUtil.isNull(provinceId, "省份ID不能为空");
|
|
|
AssertUtil.isNull(cityId, "城市ID不能为空");
|
|
|
-
|
|
|
- //TODO 调用自动生成案件编号 接口 测试使用静态值替换
|
|
|
- return "AUTO_" + System.currentTimeMillis();
|
|
|
+ return caseNumberService.getCaseNumber(cityId).toString();
|
|
|
}
|
|
|
|
|
|
|