胡北宽 3 days ago
parent
commit
d9811c988e

+ 62
- 0
src/main/java/com/example/backend/controller/contract/SalesContractController1.java View File

1
+package com.example.backend.controller.contract;
2
+
3
+import com.example.backend.service.contract.SalesContractService;
4
+import com.example.backend.service.contract.SalesContractService1;
5
+import com.example.backend.util.ExcelImportResult;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.http.ResponseEntity;
8
+import org.springframework.web.bind.annotation.*;
9
+import org.springframework.web.multipart.MultipartFile;
10
+
11
+import java.util.HashMap;
12
+import java.util.Map;
13
+
14
+/**
15
+ * 销售合同控制器
16
+ */
17
+@RestController
18
+@RequestMapping("/salesContract1")
19
+@CrossOrigin(origins = "*") // 添加这个注解
20
+public class SalesContractController1 {
21
+
22
+    @Autowired
23
+    private SalesContractService1 salesContractService;
24
+
25
+    /**
26
+     * 导入Excel文件
27
+     */
28
+    @PostMapping("/import")
29
+    public ResponseEntity<Map<String, Object>> importExcel(@RequestParam("file") MultipartFile file) {
30
+        Map<String, Object> result = new HashMap<>();
31
+        try {
32
+            ExcelImportResult<Void> importResult = salesContractService.importExcelSales(file);
33
+
34
+            if (importResult.isSuccess()) {
35
+                result.put("code", 200);
36
+                result.put("success", true);
37
+                result.put("message", importResult.getMessage());
38
+                // 添加统计信息
39
+                if (importResult.getTotalCount() != null) {
40
+                    result.put("totalCount", importResult.getTotalCount());
41
+                    result.put("successCount", importResult.getSuccessCount());
42
+                    result.put("errorCount", importResult.getErrorCount());
43
+                }
44
+            } else {
45
+                result.put("code", 500);
46
+                result.put("success", false);
47
+                result.put("message", importResult.getMessage());
48
+                // 添加详细的错误信息
49
+                if (importResult.getErrors() != null && !importResult.getErrors().isEmpty()) {
50
+                    result.put("errors", importResult.getErrors());
51
+                    result.put("errorCount", importResult.getErrors().size());
52
+                }
53
+            }
54
+        } catch (Exception e) {
55
+            result.put("code", 500);
56
+            result.put("success", false);
57
+            result.put("message", "系统处理异常:" + e.getMessage());
58
+            e.printStackTrace();
59
+        }
60
+        return ResponseEntity.ok(result);
61
+    }
62
+}

+ 2
- 1
src/main/java/com/example/backend/entity/contract/ExpSvcRateEntity.java View File

122
     private Integer curChangeVer;
122
     private Integer curChangeVer;
123
 
123
 
124
     //销售合同号
124
     //销售合同号
125
-    @TableField("fno")
125
+    @TableField(exist = false)
126
+
126
     private String fno;
127
     private String fno;
127
 }
128
 }

+ 4
- 1
src/main/java/com/example/backend/entity/contract/SalesContractEntity.java View File

457
     private String createByName;
457
     private String createByName;
458
 
458
 
459
     // 更新账号
459
     // 更新账号
460
-    @TableField("update_by")
460
+        @TableField("update_by")
461
     private String updateBy;
461
     private String updateBy;
462
 
462
 
463
     // 更新时间
463
     // 更新时间
860
     @TableField("edesc")
860
     @TableField("edesc")
861
     private String edesc;
861
     private String edesc;
862
 
862
 
863
+    @TableField("isinitDate")
864
+    private String isinitDate;
865
+
863
     // 附件列表
866
     // 附件列表
864
 //    @TableField(exist = false)
867
 //    @TableField(exist = false)
865
 //    private List<ConFilAffEntity> attachList;
868
 //    private List<ConFilAffEntity> attachList;

+ 1
- 1
src/main/java/com/example/backend/excel/SalesDtlExcelDTO.java View File

22
     private String itemno;
22
     private String itemno;
23
 
23
 
24
     @ExcelProperty("规格描述")
24
     @ExcelProperty("规格描述")
25
-    private String spec;
25
+    private String ftype3;
26
 
26
 
27
     @ExcelProperty("长")
27
     @ExcelProperty("长")
28
     private BigDecimal fnum3;
28
     private BigDecimal fnum3;

+ 14
- 0
src/main/java/com/example/backend/service/contract/SalesContractService1.java View File

1
+package com.example.backend.service.contract;
2
+
3
+import com.example.backend.util.ExcelImportResult;
4
+import org.springframework.web.multipart.MultipartFile;
5
+
6
+/**
7
+ * 销售合同服务接口
8
+ */
9
+
10
+public interface SalesContractService1 {
11
+    ExcelImportResult<Void> importExcelSales(MultipartFile file);
12
+
13
+
14
+}

+ 91
- 90
src/main/java/com/example/backend/service/contract/impl/SalesContractServiceImpl.java View File

83
                 List<String> currentContractErrors = new ArrayList<>();
83
                 List<String> currentContractErrors = new ArrayList<>();
84
                 boolean currentContractValid = true;
84
                 boolean currentContractValid = true;
85
 
85
 
86
-                if (StringUtils.isEmpty(currentSono)) {
87
-                    errors.add("主表(Sheet1) 销售合同号不能为空!");
88
-                    continue;
89
-                }
86
+//                if (StringUtils.isEmpty(currentSono)) {
87
+//                    errors.add("主表(Sheet1) 销售合同号不能为空!");
88
+//                    continue;
89
+//                }
90
 
90
 
91
                 try {
91
                 try {
92
                     // ================= 1. 校验并收集主表数据 =================
92
                     // ================= 1. 校验并收集主表数据 =================
99
 
99
 
100
                     // 基础校验
100
                     // 基础校验
101
                     if (StringUtils.isEmpty(entity.getSono())) {
101
                     if (StringUtils.isEmpty(entity.getSono())) {
102
-                        currentContractErrors.add("主表(Sheet1)合同号: " + currentSono +  " :销售合同号不能为空!");
102
+//                        currentContractErrors.add("主表(Sheet1)合同号: " + currentSono +  " :销售合同号不能为空!");
103
                         currentContractValid = false;
103
                         currentContractValid = false;
104
                     }
104
                     }
105
                     if(!StringUtils.isEmpty(entity.getSono())){
105
                     if(!StringUtils.isEmpty(entity.getSono())){
219
                         entity.setCtName(ctName);
219
                         entity.setCtName(ctName);
220
                     }
220
                     }
221
 
221
 
222
-                    if (ctNameList == null || ctNameList.isEmpty()) {
223
-                        currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":客户名称有误,未匹配到相关信息!");
224
-                        currentContractValid = false;
225
-                    }
222
+//                    if (ctNameList == null || ctNameList.isEmpty()) {
223
+//                        currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":客户名称有误,未匹配到相关信息!");
224
+//                        currentContractValid = false;
225
+//                    }
226
 
226
 
227
 //                    if (ctNameList != null && !ctNameList.isEmpty() && !"2".equals(ctNameList.get(0).getPlaced())) {
227
 //                    if (ctNameList != null && !ctNameList.isEmpty() && !"2".equals(ctNameList.get(0).getPlaced())) {
228
 //                        currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":客户名称没有审批通过!");
228
 //                        currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":客户名称没有审批通过!");
295
                     }
295
                     }
296
 
296
 
297
                     if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
297
                     if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
298
-                        if (entity.getEstLoadDt() == null) {
299
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售时,最迟装运日期不能为空!");
300
-                            currentContractValid = false;
301
-                        }
298
+                            if (entity.getEstLoadDt() == null) {
299
+//                                currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售时,最迟装运日期不能为空!");
300
+//                                currentContractValid = false;
301
+                            }
302
                     }
302
                     }
303
 
303
 
304
                     if (entity.getServiceType().contains("代理进口") || entity.getServiceType().contains("代理内贸")) {
304
                     if (entity.getServiceType().contains("代理进口") || entity.getServiceType().contains("代理内贸")) {
305
                         if (Objects.isNull(entity.getOutstandingDay())) {
305
                         if (Objects.isNull(entity.getOutstandingDay())) {
306
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":业务类型为代理进口或代理内贸时,预计客商占款天数不能为空!");
307
-                            currentContractValid = false;
306
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":业务类型为代理进口或代理内贸时,预计客商占款天数不能为空!");
307
+//                            currentContractValid = false;
308
                         }
308
                         }
309
                     }
309
                     }
310
 
310
 
368
                     if (StringUtils.isEmpty(entity.getIfBidding())) {
368
                     if (StringUtils.isEmpty(entity.getIfBidding())) {
369
                         entity.setIfBidding("是");
369
                         entity.setIfBidding("是");
370
                     }
370
                     }
371
+                    entity.setIsinitDate("是");
371
 //                    if(StringUtils.isEmpty(entity.getIfBatch())){
372
 //                    if(StringUtils.isEmpty(entity.getIfBatch())){
372
 //                        entity.setIfBatch("否");
373
 //                        entity.setIfBatch("否");
373
 //                    }
374
 //                    }
398
                                 .collect(Collectors.toList());
399
                                 .collect(Collectors.toList());
399
 
400
 
400
                         if (currentSalesDtlList != null && !currentSalesDtlList.isEmpty()) {
401
                         if (currentSalesDtlList != null && !currentSalesDtlList.isEmpty()) {
401
-//                            if (StringUtils.isEmpty(currentSalesDtlList.get(0).getLPort())) {
402
+                            if (StringUtils.isEmpty(currentSalesDtlList.get(0).getLPort())) {
402
 //                                currentContractErrors.add("主表(Sheet2)合同号:" + currentSono + "的合同产品 装运港不能为空!");
403
 //                                currentContractErrors.add("主表(Sheet2)合同号:" + currentSono + "的合同产品 装运港不能为空!");
403
 //                                currentContractValid = false;
404
 //                                currentContractValid = false;
404
-//                            }
405
-//                            if (StringUtils.isEmpty(currentSalesDtlList.get(0).getDPort())) {
405
+                            }
406
+                            if (StringUtils.isEmpty(currentSalesDtlList.get(0).getDPort())) {
406
 //                                currentContractErrors.add("主表(Sheet2)合同号:" + currentSono + "的合同产品 目的港不能为空!");
407
 //                                currentContractErrors.add("主表(Sheet2)合同号:" + currentSono + "的合同产品 目的港不能为空!");
407
 //                                currentContractValid = false;
408
 //                                currentContractValid = false;
408
-//                            }
409
+                            }
409
                             entity.setLPort(currentSalesDtlList.get(0).getLPort());
410
                             entity.setLPort(currentSalesDtlList.get(0).getLPort());
410
                             entity.setDPort(currentSalesDtlList.get(0).getDPort());
411
                             entity.setDPort(currentSalesDtlList.get(0).getDPort());
411
                         }
412
                         }
412
 
413
 
413
                         if (StringUtils.isEmpty(entity.getLPort())) {
414
                         if (StringUtils.isEmpty(entity.getLPort())) {
414
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,装运港不能为空");
415
-                            currentContractValid = false;
415
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,装运港不能为空");
416
+//                            currentContractValid = false;
416
                         }
417
                         }
417
                         List<CustCtrl> lPortList = custCtrlMapper.selectLPortByLportName(entity.getLPort());
418
                         List<CustCtrl> lPortList = custCtrlMapper.selectLPortByLportName(entity.getLPort());
418
                         if (lPortList == null || lPortList.isEmpty()) {
419
                         if (lPortList == null || lPortList.isEmpty()) {
419
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":装运港有误!");
420
-                            currentContractValid = false;
420
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":装运港有误!");
421
+//                            currentContractValid = false;
421
                         }
422
                         }
422
                         if (lPortList != null && !lPortList.isEmpty() && !StringUtils.isEmpty(lPortList.get(0).getFno())) {
423
                         if (lPortList != null && !lPortList.isEmpty() && !StringUtils.isEmpty(lPortList.get(0).getFno())) {
423
                             entity.setLpno(lPortList.get(0).getFno());
424
                             entity.setLpno(lPortList.get(0).getFno());
431
                         }
432
                         }
432
 
433
 
433
                         if (StringUtils.isEmpty(entity.getDPort())) {
434
                         if (StringUtils.isEmpty(entity.getDPort())) {
434
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,目的港不能为空");
435
-                            currentContractValid = false;
435
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,目的港不能为空");
436
+//                            currentContractValid = false;
436
                         }
437
                         }
437
                         List<CustCtrl> dPortList = custCtrlMapper.selectLPortByLportName(entity.getDPort());
438
                         List<CustCtrl> dPortList = custCtrlMapper.selectLPortByLportName(entity.getDPort());
438
                         if (dPortList == null || dPortList.isEmpty()) {
439
                         if (dPortList == null || dPortList.isEmpty()) {
439
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":目的港有误!");
440
-                            currentContractValid = false;
440
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":目的港有误!");
441
+//                            currentContractValid = false;
441
                         }
442
                         }
442
                         if (dPortList != null && !dPortList.isEmpty() && !StringUtils.isEmpty(dPortList.get(0).getFno())) {
443
                         if (dPortList != null && !dPortList.isEmpty() && !StringUtils.isEmpty(dPortList.get(0).getFno())) {
443
                             entity.setDpno(dPortList.get(0).getFno());
444
                             entity.setDpno(dPortList.get(0).getFno());
487
                     }
488
                     }
488
                     if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
489
                     if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
489
                         if (StringUtils.isEmpty(entity.getTerms())) {
490
                         if (StringUtils.isEmpty(entity.getTerms())) {
490
-                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售时,价格条款不能为空");
491
-                            currentContractValid = false;
491
+//                            currentContractErrors.add("主表(Sheet1) 合同号: " + currentSono + ":合同类型为出口销售或转口销售时,价格条款不能为空");
492
+//                            currentContractValid = false;
492
                         }
493
                         }
493
 //                        if (!StringUtils.isEmpty(entity.getTerms())) {
494
 //                        if (!StringUtils.isEmpty(entity.getTerms())) {
494
 //                            List<DataDic> termsList = dicMapper.selectDicByTerms(entity.getTerms());
495
 //                            List<DataDic> termsList = dicMapper.selectDicByTerms(entity.getTerms());
520
                             .filter(dto -> currentSono.equals(dto.getFno()))
521
                             .filter(dto -> currentSono.equals(dto.getFno()))
521
                             .collect(Collectors.toList());
522
                             .collect(Collectors.toList());
522
                     if(currentSalesDtlList==null||currentSalesDtlList.isEmpty()){
523
                     if(currentSalesDtlList==null||currentSalesDtlList.isEmpty()){
523
-                        currentContractErrors.add(" 合同号 " + currentSono + " 的销售产品信息不能为空!");
524
+//                        currentContractErrors.add(" 合同号 " + currentSono + " 的销售产品信息不能为空!");
524
 
525
 
525
                     }
526
                     }
526
 
527
 
555
                             }
556
                             }
556
 
557
 
557
                             if (Objects.isNull(entity1.getInTaxRate())) {
558
                             if (Objects.isNull(entity1.getInTaxRate())) {
558
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :增值税率不能为空");
559
-                                currentContractValid = false;
559
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :增值税率不能为空");
560
+//                                currentContractValid = false;
560
                             }
561
                             }
561
 
562
 
562
                             if (StringUtils.isEmpty(entity1.getUt())) {
563
                             if (StringUtils.isEmpty(entity1.getUt())) {
563
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  "单位不能为空");
564
-                                currentContractValid = false;
564
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  "单位不能为空");
565
+//                                currentContractValid = false;
565
                             }
566
                             }
566
 
567
 
567
                             // 商品信息校验
568
                             // 商品信息校验
568
                             if (!StringUtils.isEmpty(itemno) && bizProductType != null) {
569
                             if (!StringUtils.isEmpty(itemno) && bizProductType != null) {
569
                                 List<CustCtrl> itemnoList = custCtrlMapper.selectByItemno(itemno, bizProductType);
570
                                 List<CustCtrl> itemnoList = custCtrlMapper.selectByItemno(itemno, bizProductType);
570
                                 if (itemnoList == null || itemnoList.isEmpty()) {
571
                                 if (itemnoList == null || itemnoList.isEmpty()) {
571
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :商品编号有误!");
572
-                                    currentContractValid = false;
572
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :商品编号有误!");
573
+//                                    currentContractValid = false;
573
                                 }
574
                                 }
574
 
575
 
575
                                 if (itemnoList != null && !itemnoList.isEmpty()) {
576
                                 if (itemnoList != null && !itemnoList.isEmpty()) {
622
                             // 产品类型特定校验
623
                             // 产品类型特定校验
623
                             if ("铁矿石".equals(bizProductType)) {
624
                             if ("铁矿石".equals(bizProductType)) {
624
                                 if (Objects.isNull(entity1.getIronCont())) {
625
                                 if (Objects.isNull(entity1.getIronCont())) {
625
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " :合同产品类型为铁矿石时,含铁量%不能为空!");
626
-                                    currentContractValid = false;
626
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " :合同产品类型为铁矿石时,含铁量%不能为空!");
627
+//                                    currentContractValid = false;
627
                                 }
628
                                 }
628
                             }
629
                             }
629
 
630
 
630
                             if ("铁矿石".equals(bizProductType) || "煤炭".equals(bizProductType)) {
631
                             if ("铁矿石".equals(bizProductType) || "煤炭".equals(bizProductType)) {
631
                                 if (Objects.isNull(entity1.getMoisture())) {
632
                                 if (Objects.isNull(entity1.getMoisture())) {
632
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :合同产品类型为铁矿石或煤炭时,水分%不能为空!");
633
-                                    currentContractValid = false;
633
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :合同产品类型为铁矿石或煤炭时,水分%不能为空!");
634
+//                                    currentContractValid = false;
634
                                 }
635
                                 }
635
 
636
 
636
                                 if (StringUtils.isEmpty(entity1.getPriceMtd())) {
637
                                 if (StringUtils.isEmpty(entity1.getPriceMtd())) {
637
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :合同产品类型为铁矿石或煤炭时,计价方式不能为空!");
638
-                                    currentContractValid = false;
638
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :合同产品类型为铁矿石或煤炭时,计价方式不能为空!");
639
+//                                    currentContractValid = false;
639
                                 }
640
                                 }
640
 
641
 
641
                                 List<DataDic> priceMtdList = dicMapper.selectByPriceMtd(entity1.getPriceMtd());
642
                                 List<DataDic> priceMtdList = dicMapper.selectByPriceMtd(entity1.getPriceMtd());
642
                                 if (priceMtdList == null || priceMtdList.isEmpty()) {
643
                                 if (priceMtdList == null || priceMtdList.isEmpty()) {
643
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :输入的计价方式在数据字典中不存在!");
644
-                                    currentContractValid = false;
644
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  " :输入的计价方式在数据字典中不存在!");
645
+//                                    currentContractValid = false;
645
                                 }
646
                                 }
646
 
647
 
647
                                 if (!StringUtils.isEmpty(entity1.getResourceNo())) {
648
                                 if (!StringUtils.isEmpty(entity1.getResourceNo())) {
664
                                     }
665
                                     }
665
                                 }
666
                                 }
666
 
667
 
667
-                                if (StringUtils.isEmpty(entity1.getFtype3())) {
668
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  ":合同产品类型为钢产品时,规格描述不能为空!");
669
-                                    currentContractValid = false;
670
-                                }
668
+//                                if (StringUtils.isEmpty(entity1.getFtype3())) {
669
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +  ":合同产品类型为钢产品时,规格描述不能为空!");
670
+//                                    currentContractValid = false;
671
+//                                }
671
 
672
 
672
                                 List<CustCtrl> ftype3List = custCtrlMapper.selectByFtype3(entity1.getFtype3());
673
                                 List<CustCtrl> ftype3List = custCtrlMapper.selectByFtype3(entity1.getFtype3());
673
                                 if (ftype3List == null || ftype3List.isEmpty()) {
674
                                 if (ftype3List == null || ftype3List.isEmpty()) {
674
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " :输入的规格描述有误!");
675
-                                    currentContractValid = false;
675
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " :输入的规格描述有误!");
676
+//                                    currentContractValid = false;
676
                                 }
677
                                 }
677
 
678
 
678
                                 if (ftype3List != null && !ftype3List.isEmpty() && !Objects.isNull(ftype3List.get(0).getFnum4())
679
                                 if (ftype3List != null && !ftype3List.isEmpty() && !Objects.isNull(ftype3List.get(0).getFnum4())
684
                                 }
685
                                 }
685
 
686
 
686
                                 if (StringUtils.isEmpty(entity1.getFtype4())) {
687
                                 if (StringUtils.isEmpty(entity1.getFtype4())) {
687
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +   " :合同产品类型为钢产品时,计重方式不能为空!");
688
-                                    currentContractValid = false;
688
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono +   " :合同产品类型为钢产品时,计重方式不能为空!");
689
+//                                    currentContractValid = false;
689
                                 }
690
                                 }
690
 
691
 
691
                                 List<DataDic> ftype4List = dicMapper.selectByFtyped(entity1.getFtype4());
692
                                 List<DataDic> ftype4List = dicMapper.selectByFtyped(entity1.getFtype4());
692
                                 if (ftype4List == null || ftype4List.isEmpty()) {
693
                                 if (ftype4List == null || ftype4List.isEmpty()) {
693
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":输入的计重方式在数据字典中不存在");
694
-                                    currentContractValid = false;
694
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":输入的计重方式在数据字典中不存在");
695
+//                                    currentContractValid = false;
695
                                 }
696
                                 }
696
 
697
 
697
 //                                if (Objects.isNull(entity1.getQua())) {
698
 //                                if (Objects.isNull(entity1.getQua())) {
706
                             }
707
                             }
707
 
708
 
708
                             if (Objects.isNull(entity1.getQty())) {
709
                             if (Objects.isNull(entity1.getQty())) {
709
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":数量不能为空!");
710
-                                currentContractValid = false;
710
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":数量不能为空!");
711
+//                                currentContractValid = false;
711
                             }
712
                             }
712
 
713
 
713
                             if (Objects.isNull(entity1.getSoPrice())) {
714
                             if (Objects.isNull(entity1.getSoPrice())) {
714
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":销售单价不能为空!");
715
-                                currentContractValid = false;
715
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":销售单价不能为空!");
716
+//                                currentContractValid = false;
716
                             }
717
                             }
717
 
718
 
718
                             // 钢材特定校验
719
                             // 钢材特定校验
751
 //                                currentContractValid = false;
752
 //                                currentContractValid = false;
752
 //                            }
753
 //                            }
753
 
754
 
754
-                            if (StringUtils.isEmpty(entity1.getPono())) {
755
-                                entity1.setCurcyPo(entity.getCurcy());
756
-                                entity1.setPoprice(entity1.getSoPrice());
757
-                                entity1.setRatePo(entity.getRate());
758
-                                entity1.setPoamt(entity1.getSoAmt());
759
-                            }
755
+//                            if (StringUtils.isEmpty(entity1.getPono())) {
756
+//                                entity1.setCurcyPo(entity.getCurcy());
757
+//                                entity1.setPoprice(entity1.getSoPrice());
758
+//                                entity1.setRatePo(entity.getRate());
759
+//                                entity1.setPoamt(entity1.getSoAmt());
760
+//                            }
760
 
761
 
761
                             if (StringUtils.isEmpty(entity1.getItemno())) {
762
                             if (StringUtils.isEmpty(entity1.getItemno())) {
762
                                 entity1.setCurcyPo(entity.getCurcy());
763
                                 entity1.setCurcyPo(entity.getCurcy());
802
                             // 港口信息校验
803
                             // 港口信息校验
803
                             if ("出口销售".equals(bizType) || "转口销售".equals(bizType) || (serviceType != null && serviceType.contains("主业"))) {
804
                             if ("出口销售".equals(bizType) || "转口销售".equals(bizType) || (serviceType != null && serviceType.contains("主业"))) {
804
                                 if (StringUtils.isEmpty(entity1.getLPort())) {
805
                                 if (StringUtils.isEmpty(entity1.getLPort())) {
805
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,装运港不能为空");
806
-                                    currentContractValid = false;
806
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,装运港不能为空");
807
+//                                    currentContractValid = false;
807
                                 }
808
                                 }
808
 
809
 
809
                                 List<CustCtrl> lPortList = custCtrlMapper.selectLPortByLportName(entity1.getLPort());
810
                                 List<CustCtrl> lPortList = custCtrlMapper.selectLPortByLportName(entity1.getLPort());
810
                                 if (lPortList == null || lPortList.isEmpty()) {
811
                                 if (lPortList == null || lPortList.isEmpty()) {
811
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":装运港有误!");
812
-                                    currentContractValid = false;
812
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":装运港有误!");
813
+//                                    currentContractValid = false;
813
                                 }
814
                                 }
814
                                 if (lPortList != null && !lPortList.isEmpty() && !StringUtils.isEmpty(lPortList.get(0).getFno())) {
815
                                 if (lPortList != null && !lPortList.isEmpty() && !StringUtils.isEmpty(lPortList.get(0).getFno())) {
815
                                     entity1.setLpno(lPortList.get(0).getFno());
816
                                     entity1.setLpno(lPortList.get(0).getFno());
816
                                 }
817
                                 }
817
 
818
 
818
                                 if (StringUtils.isEmpty(entity1.getDPort())) {
819
                                 if (StringUtils.isEmpty(entity1.getDPort())) {
819
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,目的港不能为空");
820
-                                    currentContractValid = false;
820
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":合同类型为出口销售或转口销售或业务类型包含主业时,目的港不能为空");
821
+//                                    currentContractValid = false;
821
                                 }
822
                                 }
822
 
823
 
823
                                 List<CustCtrl> dPortList = custCtrlMapper.selectLPortByLportName(entity1.getDPort());
824
                                 List<CustCtrl> dPortList = custCtrlMapper.selectLPortByLportName(entity1.getDPort());
824
                                 if (dPortList == null || dPortList.isEmpty()) {
825
                                 if (dPortList == null || dPortList.isEmpty()) {
825
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":目的港有误!");
826
-                                    currentContractValid = false;
826
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + ":目的港有误!");
827
+//                                    currentContractValid = false;
827
                                 }
828
                                 }
828
                                 if (dPortList != null && !dPortList.isEmpty() && !StringUtils.isEmpty(dPortList.get(0).getFno())) {
829
                                 if (dPortList != null && !dPortList.isEmpty() && !StringUtils.isEmpty(dPortList.get(0).getFno())) {
829
                                     entity1.setDpno(dPortList.get(0).getFno());
830
                                     entity1.setDpno(dPortList.get(0).getFno());
854
                                 .reduce(BigDecimal.ZERO, BigDecimal::add);
855
                                 .reduce(BigDecimal.ZERO, BigDecimal::add);
855
 
856
 
856
                         if (totalRatio.compareTo(new BigDecimal("100")) != 0) {
857
                         if (totalRatio.compareTo(new BigDecimal("100")) != 0) {
857
-                            currentContractErrors.add("收款计划(Sheet3) 合同号: " + currentSono + " 的收款比例总和必须为100%,当前总和为:" + totalRatio + "%");
858
-                            currentContractValid = false;
858
+//                            currentContractErrors.add("收款计划(Sheet3) 合同号: " + currentSono + " 的收款比例总和必须为100%,当前总和为:" + totalRatio + "%");
859
+//                            currentContractValid = false;
859
                         }
860
                         }
860
 
861
 
861
                         for (int i = 0; i < currentSalesCollectList.size(); i++) {
862
                         for (int i = 0; i < currentSalesCollectList.size(); i++) {
873
                                 currentContractValid = false;
874
                                 currentContractValid = false;
874
                             }
875
                             }
875
 
876
 
876
-                            if ("预付款-发货后".equals(entity2.getPaymentType()) || "发票后结算款".equals(entity2.getPaymentType())) {
877
-                                if (Objects.isNull(entity2.getPayDays())) {
878
-                                    currentContractErrors.add("收款计划(Sheet3) 合同号 :" + currentSono +" 的款项类别为'预付款-发货后'或'发票后结算款',账期不能为空!");
879
-                                    currentContractValid = false;
880
-                                }
881
-                            }
877
+//                            if ("预付款-发货后".equals(entity2.getPaymentType()) || "发票后结算款".equals(entity2.getPaymentType())) {
878
+//                                if (Objects.isNull(entity2.getPayDays())) {
879
+//                                    currentContractErrors.add("收款计划(Sheet3) 合同号 :" + currentSono +" 的款项类别为'预付款-发货后'或'发票后结算款',账期不能为空!");
880
+//                                    currentContractValid = false;
881
+//                                }
882
+//                            }
882
 
883
 
883
                             if (StringUtils.isEmpty(entity2.getPayMode())) {
884
                             if (StringUtils.isEmpty(entity2.getPayMode())) {
884
                                 currentContractErrors.add("收款计划(Sheet3) 合同号 :" + currentSono +" 的收款方式不能为空!");
885
                                 currentContractErrors.add("收款计划(Sheet3) 合同号 :" + currentSono +" 的收款方式不能为空!");
914
                                 .reduce(BigDecimal.ZERO, BigDecimal::add);
915
                                 .reduce(BigDecimal.ZERO, BigDecimal::add);
915
 
916
 
916
                         if (totalAssessQtyRate.compareTo(new BigDecimal("100")) != 0) {
917
                         if (totalAssessQtyRate.compareTo(new BigDecimal("100")) != 0) {
917
-                            currentContractErrors.add("责任中心(Sheet4) 合同号 " + currentSono + " 的利润考核占比总和必须为100%,当前总和为:" + totalAssessQtyRate + "%");
918
-                            currentContractValid = false;
918
+//                            currentContractErrors.add("责任中心(Sheet4) 合同号 " + currentSono + " 的利润考核占比总和必须为100%,当前总和为:" + totalAssessQtyRate + "%");
919
+//                            currentContractValid = false;
919
                         }
920
                         }
920
 
921
 
921
                         if (totalAssessRatio.compareTo(new BigDecimal("100")) != 0) {
922
                         if (totalAssessRatio.compareTo(new BigDecimal("100")) != 0) {
922
-                            currentContractErrors.add("责任中心(Sheet4) 合同号 " + currentSono + " 的金额考核占比总和必须为100%,当前总和为:" + totalAssessRatio + "%");
923
-                            currentContractValid = false;
923
+//                            currentContractErrors.add("责任中心(Sheet4) 合同号 " + currentSono + " 的金额考核占比总和必须为100%,当前总和为:" + totalAssessRatio + "%");
924
+//                            currentContractValid = false;
924
                         }
925
                         }
925
 
926
 
926
                         for (int i = 0; i < currentRCenterDtlList.size(); i++) {
927
                         for (int i = 0; i < currentRCenterDtlList.size(); i++) {
1078
                                     currentContractValid = false;
1079
                                     currentContractValid = false;
1079
                                 }
1080
                                 }
1080
 
1081
 
1081
-                                if (Objects.isNull(entity4.getMinDays())) {
1082
-                                    currentContractErrors.add("服务费率(Sheet5) 合同号:" + currentSono + " 起步天数不能为空!");
1083
-                                    currentContractValid = false;
1084
-                                }
1082
+//                                if (Objects.isNull(entity4.getMinDays())) {
1083
+//                                    currentContractErrors.add("服务费率(Sheet5) 合同号:" + currentSono + " 起步天数不能为空!");
1084
+//                                    currentContractValid = false;
1085
+//                                }
1085
 
1086
 
1086
                                 entity4.setLine(i+1);
1087
                                 entity4.setLine(i+1);
1087
 
1088
 
1122
                         currentMainEntity.setCreateTime(new Date());
1123
                         currentMainEntity.setCreateTime(new Date());
1123
                         currentMainEntity.setFmodalid(6L);
1124
                         currentMainEntity.setFmodalid(6L);
1124
                         currentMainEntity.setPlaced("0");
1125
                         currentMainEntity.setPlaced("0");
1125
-                        currentMainEntity.setRemark("期初2");
1126
+                        currentMainEntity.setRemark("期初");
1126
 
1127
 
1127
                         salesContractMapper.insert(currentMainEntity);
1128
                         salesContractMapper.insert(currentMainEntity);
1128
                         Long mainId = currentMainEntity.getId();
1129
                         Long mainId = currentMainEntity.getId();
1215
                 ContractErrorLogEntity log = new ContractErrorLogEntity();
1216
                 ContractErrorLogEntity log = new ContractErrorLogEntity();
1216
                 log.setErrorLog(String.join("\n", errors));
1217
                 log.setErrorLog(String.join("\n", errors));
1217
                 log.setCreateDate(new Date());
1218
                 log.setCreateDate(new Date());
1218
-                contractErrorLogMapper.insert(log);
1219
+//                contractErrorLogMapper.insert(log);
1219
             } catch (Exception logException) {
1220
             } catch (Exception logException) {
1220
                 System.err.println("保存错误日志失败: " + logException.getMessage());
1221
                 System.err.println("保存错误日志失败: " + logException.getMessage());
1221
             }
1222
             }

+ 1203
- 1904
src/main/java/com/example/backend/service/contract/impl/SalesContractServiceImpl1.java
File diff suppressed because it is too large
View File


+ 1
- 1
src/main/java/com/example/backend/util/ExcelUtil.java View File

87
         SimpleDataListener<ExpSvcRateExcelDTO> listener = new SimpleDataListener<>();
87
         SimpleDataListener<ExpSvcRateExcelDTO> listener = new SimpleDataListener<>();
88
         EasyExcel.read(file.getInputStream(), ExpSvcRateExcelDTO.class, listener)
88
         EasyExcel.read(file.getInputStream(), ExpSvcRateExcelDTO.class, listener)
89
                 .sheet(4) // 第五个sheet
89
                 .sheet(4) // 第五个sheet
90
-                .headRowNumber(3) // 跳过前0行
90
+                .headRowNumber(1) // 跳过前0行
91
                 .doRead();
91
                 .doRead();
92
         List<ExpSvcRateExcelDTO> dataList = listener.getDataList();
92
         List<ExpSvcRateExcelDTO> dataList = listener.getDataList();
93
         System.out.println("服务费率读取到 " + dataList.size() + " 条数据");
93
         System.out.println("服务费率读取到 " + dataList.size() + " 条数据");

+ 1
- 1
src/main/resources/application.yml View File

11
       max-request-size: 10MB
11
       max-request-size: 10MB
12
   datasource:
12
   datasource:
13
     driver-class-name: dm.jdbc.driver.DmDriver
13
     driver-class-name: dm.jdbc.driver.DmDriver
14
-    url: jdbc:dm://10.19.13.211:5236
14
+    url: jdbc:dm://10.19.14.22:5236
15
     username: SGGMIIP
15
     username: SGGMIIP
16
     password: SXxxjsgs2025
16
     password: SXxxjsgs2025
17
     druid:
17
     druid:

Loading…
Cancel
Save