Procházet zdrojové kódy

swagger 内容修改

zhangzhao před 3 roky
rodič
revize
4d09bf5d5b

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

@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
 
 import javax.validation.constraints.*;
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -23,8 +24,8 @@ import io.swagger.annotations.ApiOperation;
  * @author ZhangZhao
  * @date 2021-07-21
  */
+@Slf4j
 @Api(value = "流向查询记录 控制器", tags = {"流向查询记录 管理"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
 @RequestMapping("/flow/record")
 public class FlowQueryRecordController {

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

@@ -10,8 +10,10 @@ import com.abi.qms.platform.service.IInspectionCaseService;
 import com.abi.task.common.api.base.BaseResponse;
 import lombok.RequiredArgsConstructor;
 
+import javax.validation.Valid;
 import javax.validation.constraints.*;
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -25,8 +27,8 @@ import io.swagger.annotations.ApiOperation;
  * @author: ZhangZhao
  * @date: 2021-07-19
  */
+@Slf4j
 @Api(value = "稽查案件 控制器", tags = {"稽查案件 管理"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
 @RequestMapping("/inspectionCase")
 public class InspectionCaseController {

+ 9 - 8
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/AddInspectionCaseReq.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.ToString;
 
+import javax.validation.Valid;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
@@ -30,40 +31,40 @@ public class AddInspectionCaseReq implements Serializable {
      * 案件编号生成策略 1-自动生成 2-自定义
      */
     @NotNull(message = "案件编号生成策略不能为空")
-    @ApiModelProperty(name = "案件编号生成策略 1-自动生成 2-自定义", required = true)
+    @ApiModelProperty(value = "案件编号生成策略 1-自动生成 2-自定义", required = true)
     private Integer caseNumberGenerateStrategy;
 
     /**
      * 省份id
      */
-    @ApiModelProperty(name = "省份ID")
+    @ApiModelProperty(value = "省份ID")
     private Long provinceId;
 
 
     /**
      * 城市id
      */
-    @ApiModelProperty(name = "城市ID")
+    @ApiModelProperty(value = "城市ID")
     private Long cityId;
 
     /**
      * 案件编号
      */
-    @ApiModelProperty(name = "自定义-案件编号(自定义编号时必传)")
+    @ApiModelProperty(value = "自定义-案件编号(自定义编号时必传)")
     private String caseNumber;
 
     /**
      * 案件名称
      */
     @NotBlank(message = "案件名称不能为空")
-    @ApiModelProperty(name = "案件名称", required = true)
+    @ApiModelProperty(value = "案件名称", required = true)
     private String caseName;
 
     /**
      * sku_id
      */
     @NotNull(message = "sku_code不能为空")
-    @ApiModelProperty(name = "sku_code", required = true)
+    @ApiModelProperty(value = "sku_code", required = true)
     private Long skuCode;
 
 
@@ -71,14 +72,14 @@ public class AddInspectionCaseReq implements Serializable {
      * 案件备注
      */
     @Size(max = 150)
-    @ApiModelProperty(name = "案件备注")
+    @ApiModelProperty(value = "案件备注")
     private String caseRemark;
 
     /**
      * 案件涉及箱码列表
      */
     @Size(min = 1, message = "案件涉及箱码不能为空")
-    @ApiModelProperty(name = "案件涉及箱码列表", required = true)
+    @ApiModelProperty(value = "案件涉及箱码列表", required = true)
     private List<BoxCode> involvedBoxCodes;
 
 

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

@@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
@@ -27,6 +29,7 @@ public class PageListInspectionCaseReq extends PageReq implements Serializable {
      * 案件编号/名称
      */
     @ApiModelProperty(value = "案件编号/名称")
+    @NotBlank(message = "不能为空!")
     private String caseNameOrNumber;
 
 

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

@@ -1,5 +1,9 @@
 package com.abi.qms.platform.service;
 
+import com.abi.qms.platform.dao.entity.InspectionCaseFlow;
+
+import java.util.List;
+
 /**
  * 稽查案件-流向关联 Service接口
  *
@@ -8,4 +12,11 @@ package com.abi.qms.platform.service;
  */
 public interface InspectionCaseFlowService {
 
+    /**
+     * 保存【稽查案件-流向】关联关系
+     * @param caseId 案件ID
+     * @param flowList 流向节点列表
+     */
+    void saveInspectionCaseFlow(Long caseId, List<InspectionCaseFlow> flowList);
+
 }

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

@@ -1,9 +1,12 @@
 package com.abi.qms.platform.service.impl;
 
+import com.abi.qms.platform.dao.entity.InspectionCaseFlow;
 import com.abi.qms.platform.service.InspectionCaseFlowService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 稽查案件-流向关联 Service业务层处理
  *
@@ -14,4 +17,13 @@ import org.springframework.stereotype.Service;
 @Slf4j
 public class InspectionCaseFlowServiceImpl implements InspectionCaseFlowService {
 
+    /**
+     * 保存【稽查案件-流向】关联关系
+     * @param caseId 案件ID
+     * @param flowList 流向节点列表
+     */
+    @Override
+    public void saveInspectionCaseFlow(Long caseId, List<InspectionCaseFlow> flowList) {
+
+    }
 }

+ 24 - 10
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/InspectionCaseServiceImpl.java

@@ -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();
     }