Selaa lähdekoodia

验收单 单价调整 校验货物

zhangc 5 kuukautta sitten
vanhempi
commit
fb0e8ac577

+ 17 - 0
src/main/java/com/inkasso/factoring/acceptanceManagement/entity/request/AcceptanceImportGoodsRequest.java

@@ -0,0 +1,17 @@
+package com.inkasso.factoring.acceptanceManagement.entity.request;
+
+import lombok.Data;
+
+@Data
+public class AcceptanceImportGoodsRequest {
+
+  /**
+   * 单价调整时候 该字段不能为空
+   */
+  private Long  acceptanceBasicId;
+
+  /**
+   * 0 提交验收单 1 单价调整
+   */
+  private Integer flag;
+}

+ 3 - 1
src/main/java/com/inkasso/factoring/acceptanceManagement/service/ICAcceptanceBasicInfoService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.inkasso.factoring.acceptanceManagement.entity.AcceptanceSearch;
 import com.inkasso.factoring.acceptanceManagement.entity.CAcceptanceBasicInfo;
 import com.inkasso.factoring.acceptanceManagement.entity.CAcceptancePersonInfo;
+import com.inkasso.factoring.acceptanceManagement.entity.request.AcceptanceImportGoodsRequest;
 import com.inkasso.factoring.acceptanceManagement.entity.vo.AcceptanceListVo;
 import com.inkasso.factoring.acceptanceManagement.entity.vo.CAcceptanceGoodsExcelInfo;
 import com.inkasso.factoring.common.entity.GridPage;
@@ -95,7 +96,8 @@ public interface ICAcceptanceBasicInfoService extends IService<CAcceptanceBasicI
      * @param file
      * @return
      */
-    List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file);
+    List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file,
+        AcceptanceImportGoodsRequest acceptanceImportGoodsRequest);
 
 
     /**

+ 24 - 1
src/main/java/com/inkasso/factoring/acceptanceManagement/service/impl/CAcceptanceBasicInfoServiceImpl.java

@@ -21,6 +21,7 @@ import com.inkasso.adapter.web.LoginUserHolder;
 import com.inkasso.auth.exception.ValidatorException;
 import com.inkasso.factoring.acceptanceManagement.dao.CAcceptanceBasicInfoMapper;
 import com.inkasso.factoring.acceptanceManagement.entity.*;
+import com.inkasso.factoring.acceptanceManagement.entity.request.AcceptanceImportGoodsRequest;
 import com.inkasso.factoring.acceptanceManagement.entity.vo.AcceptanceListVo;
 import com.inkasso.factoring.acceptanceManagement.entity.vo.CAcceptanceGoodsExcelInfo;
 import com.inkasso.factoring.acceptanceManagement.service.ICAcceptanceBasicInfoService;
@@ -585,7 +586,8 @@ public class CAcceptanceBasicInfoServiceImpl extends ServiceImpl<CAcceptanceBasi
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file) {
+    public List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file,
+        AcceptanceImportGoodsRequest acceptanceImportGoodsRequest) {
         if (file.isEmpty()) {
             throw new BusinessException(CodeUtil.FAIL, "导入Excel文件不能为空");
         }
@@ -606,6 +608,27 @@ public class CAcceptanceBasicInfoServiceImpl extends ServiceImpl<CAcceptanceBasi
                     goodsInfo.setFloatingPrice(goodsInfo.getFloatingPrice().setScale(2, BigDecimal.ROUND_HALF_UP));
                 }
             }
+            if(acceptanceImportGoodsRequest.getFlag()!=null && acceptanceImportGoodsRequest.getFlag() ==1){
+                List<String> goodsIdList = Lists.newArrayList();
+                //过滤出货物id不是空的
+                acceptanceGoodsInfo = acceptanceGoodsInfo.stream().filter(x->x.getGoodsId()!=null).collect(Collectors.toList());
+                 //判断 这个验收单货物 是否存在防止用户 添加新的验收单货物
+                Iterator<CAcceptanceGoodsExcelInfo> it = acceptanceGoodsInfo.iterator();
+                while (it.hasNext()) {
+                    CAcceptanceGoodsExcelInfo excel = it.next();
+                    String goodsId = excel.getGoodsId();
+                    if(goodsIdList.indexOf(goodsId)>=0){
+                        it.remove();
+                    }
+                    CAcceptanceGoodsInfo one = acceptanceGoodsInfoService.lambdaQuery()
+                        .eq(CAcceptanceGoodsInfo::getcAcceptanceBasicInfoId,
+                            acceptanceImportGoodsRequest.getAcceptanceBasicId())
+                        .eq(CAcceptanceGoodsInfo::getId, goodsId).one();
+                    if(one==null){
+                        it.remove();
+                    }
+                }
+            }
             return (List<CAcceptanceGoodsExcelInfo>) acceptanceGoodsInfo;
         } catch (Exception e) {
             e.printStackTrace();

+ 5 - 3
src/main/java/com/inkasso/factoring/acceptanceManagement/web/CAcceptanceController.java

@@ -4,6 +4,7 @@ import com.inkasso.factoring.acceptanceManagement.entity.AcceptanceSearch;
 import com.inkasso.factoring.acceptanceManagement.entity.CAcceptanceBasicInfo;
 import com.inkasso.factoring.acceptanceManagement.entity.CAcceptancePersonInfo;
 import com.inkasso.factoring.acceptanceManagement.entity.CAcceptanceSignConfirmation;
+import com.inkasso.factoring.acceptanceManagement.entity.request.AcceptanceImportGoodsRequest;
 import com.inkasso.factoring.acceptanceManagement.service.ICAcceptanceBasicInfoService;
 import com.inkasso.factoring.acceptanceManagement.service.ICAcceptanceSignConfirmationService;
 import com.inkasso.factoring.common.entity.ResponseJson;
@@ -82,14 +83,15 @@ public class CAcceptanceController {
     /**
      * 上传货物信息Excel
      * 2.0
-     *
+     * flag 0 代表 提交验收单  1 单价调整
      * @param file
      * @return
      */
     @PostMapping("/doImportGoodsInfo")
     @ResponseBody
-    public ResponseJson doImportGoodsInfo(@RequestParam("file") MultipartFile file) {
-        return new ResponseJson(acceptanceBasicInfoService.importGoodsInfo(file));
+    public ResponseJson doImportGoodsInfo(@RequestParam("file") MultipartFile file,
+        AcceptanceImportGoodsRequest acceptanceImportGoodsRequest) {
+        return new ResponseJson(acceptanceBasicInfoService.importGoodsInfo(file,acceptanceImportGoodsRequest));
     }