|
|
@@ -15,10 +15,13 @@ import org.springframework.stereotype.Service;
|
|
15
|
15
|
import org.springframework.transaction.annotation.Transactional;
|
|
16
|
16
|
import org.springframework.web.multipart.MultipartFile;
|
|
17
|
17
|
|
|
|
18
|
+import java.math.BigDecimal;
|
|
18
|
19
|
import java.time.LocalDateTime;
|
|
19
|
20
|
import java.util.ArrayList;
|
|
20
|
21
|
import java.util.List;
|
|
|
22
|
+import java.util.Map;
|
|
21
|
23
|
import java.util.Objects;
|
|
|
24
|
+import java.util.stream.Collectors;
|
|
22
|
25
|
|
|
23
|
26
|
|
|
24
|
27
|
@Service
|
|
|
@@ -107,6 +110,9 @@ public class SalesContractServiceImpl implements SalesContractService {
|
|
107
|
110
|
if (bizTypeList == null || bizTypeList.isEmpty()) {
|
|
108
|
111
|
errors.add("输入的合同类型在数据字典中不存在!");
|
|
109
|
112
|
}
|
|
|
113
|
+
|
|
|
114
|
+ bizType = bizTypeList.get(0).getItemValue();
|
|
|
115
|
+
|
|
110
|
116
|
if (StringUtils.isEmpty(entity.getServiceType())) {
|
|
111
|
117
|
errors.add("业务类型不能为空!");
|
|
112
|
118
|
}
|
|
|
@@ -435,57 +441,120 @@ public class SalesContractServiceImpl implements SalesContractService {
|
|
435
|
441
|
}
|
|
436
|
442
|
|
|
437
|
443
|
List<CustCtrl> curcyList = custCtrlMapper.selectByCurcyPo(entity.getCurcyPo());
|
|
438
|
|
- if(curcyList ==null||curcyList.isEmpty()){
|
|
|
444
|
+ if (curcyList == null || curcyList.isEmpty()) {
|
|
439
|
445
|
errors.add("采购币种有误!");
|
|
440
|
446
|
}
|
|
441
|
447
|
|
|
442
|
|
- if(curcyList !=null&&!curcyList.isEmpty()&&!Objects.isNull(curcyList.get(0).getRate())&&!Objects.isNull(entity.getRatePo())){
|
|
443
|
|
- if(Objects.equals(entity.getRatePo(), curcyList.get(0).getRate())){
|
|
|
448
|
+ if (curcyList != null && !curcyList.isEmpty() && !Objects.isNull(curcyList.get(0).getRate()) && !Objects.isNull(entity.getRatePo())) {
|
|
|
449
|
+ if (Objects.equals(entity.getRatePo(), curcyList.get(0).getRate())) {
|
|
444
|
450
|
errors.add("采购汇率和匹配到的采购汇率不符!");
|
|
445
|
451
|
}
|
|
446
|
452
|
}
|
|
447
|
453
|
|
|
448
|
454
|
|
|
449
|
|
-
|
|
450
|
|
- if("铁矿石".equals(bizProductType)){
|
|
451
|
|
- if(Objects.isNull(entity.getIronCont())){
|
|
|
455
|
+ if ("铁矿石".equals(bizProductType)) {
|
|
|
456
|
+ if (Objects.isNull(entity.getIronCont())) {
|
|
452
|
457
|
errors.add("合同产品类型为铁矿石时,含铁量%不能为空!");
|
|
453
|
458
|
}
|
|
454
|
459
|
}
|
|
455
|
460
|
|
|
456
|
|
- if("铁矿石".equals(bizProductType)||"煤炭".equals(bizProductType)){
|
|
457
|
|
- if(Objects.isNull(entity.getMoisture())){
|
|
|
461
|
+ if ("铁矿石".equals(bizProductType) || "煤炭".equals(bizProductType)) {
|
|
|
462
|
+ if (Objects.isNull(entity.getMoisture())) {
|
|
458
|
463
|
errors.add("合同产品类型为铁矿石或煤炭时,水分%不能为空!");
|
|
459
|
464
|
}
|
|
460
|
465
|
|
|
461
|
|
- if(StringUtils.isEmpty(entity.getPriceMtd())){
|
|
|
466
|
+ if (StringUtils.isEmpty(entity.getPriceMtd())) {
|
|
462
|
467
|
errors.add("合同产品类型为铁矿石或煤炭时,计价方式不能为空!");
|
|
463
|
468
|
}
|
|
464
|
469
|
|
|
465
|
|
- List<DataDic> priceMtdList = dicMapper.selectByPriceMtd(entity.getPriceMtd());
|
|
466
|
|
- if(priceMtdList==null || priceMtdList.isEmpty()){
|
|
|
470
|
+ List<DataDic> priceMtdList = dicMapper.selectByPriceMtd(entity.getPriceMtd());
|
|
|
471
|
+ if (priceMtdList == null || priceMtdList.isEmpty()) {
|
|
467
|
472
|
errors.add("输入的计价方式在数据字典中不存在!");
|
|
468
|
473
|
}
|
|
469
|
|
- if(!StringUtils.isEmpty(entity.getResourceNo())){
|
|
470
|
|
- List<CustCtrl> resourceNoList = custCtrlMapper.selectByResourceNo(entity.getResourceNo(),bizProductType);
|
|
471
|
|
- if(resourceNoList==null || resourceNoList.isEmpty()){
|
|
472
|
|
- errors.add("资源号有误!");
|
|
473
|
|
- }
|
|
|
474
|
+ if (!StringUtils.isEmpty(entity.getResourceNo())) {
|
|
|
475
|
+ List<CustCtrl> resourceNoList = custCtrlMapper.selectByResourceNo(entity.getResourceNo(), bizProductType);
|
|
|
476
|
+ if (resourceNoList == null || resourceNoList.isEmpty()) {
|
|
|
477
|
+ errors.add("资源号有误!");
|
|
|
478
|
+ }
|
|
474
|
479
|
}
|
|
475
|
480
|
|
|
476
|
481
|
}
|
|
477
|
482
|
|
|
478
|
|
- if(Objects.isNull(entity.getPoprice())){
|
|
|
483
|
+ if (Objects.isNull(entity.getPoprice())) {
|
|
479
|
484
|
errors.add("采购单价不能为空!");
|
|
480
|
485
|
}
|
|
481
|
|
- if(Objects.isNull(entity.getQty())){
|
|
|
486
|
+ if (Objects.isNull(entity.getQty())) {
|
|
482
|
487
|
errors.add("数量不能为空!");
|
|
483
|
488
|
}
|
|
484
|
489
|
|
|
|
490
|
+ if ("出口销售".equals(bizType) || "转口销售".equals(bizType)) {
|
|
|
491
|
+ if (StringUtils.isEmpty(entity.getBatchNo())) {
|
|
|
492
|
+ errors.add("合同类型为出口销售或转口销售时,批次号不能为空!");
|
|
|
493
|
+ }
|
|
|
494
|
+ }
|
|
485
|
495
|
|
|
|
496
|
+ if ("钢产品".equals(bizProductType)) {
|
|
|
497
|
+ if (StringUtils.isEmpty(entity.getBrand())) {
|
|
|
498
|
+ errors.add("合同产品类型为钢产品时,牌号不能为空!");
|
|
|
499
|
+ }
|
|
|
500
|
+ List<CustCtrl> itemnoList1 = custCtrlMapper.selectByItemno(entity.getItemno(), bizProductType);
|
|
|
501
|
+ if (itemnoList1 != null && !itemnoList1.isEmpty() && !itemnoList1.get(0).getBrand().isEmpty()) {
|
|
486
|
502
|
|
|
|
503
|
+ if (!entity.getBrand().equals(itemnoList1.get(0).getBrand())) {
|
|
|
504
|
+ errors.add("输入的牌号与匹配到的牌号不一致!");
|
|
|
505
|
+ }
|
|
|
506
|
+ }
|
|
487
|
507
|
|
|
|
508
|
+ if (StringUtils.isEmpty(entity.getFtype3())) {
|
|
|
509
|
+ errors.add("合同产品类型为钢产品时,规格描述不能为空!");
|
|
|
510
|
+ }
|
|
488
|
511
|
|
|
|
512
|
+ List<CustCtrl> ftype3List = custCtrlMapper.selectByFtype3(entity.getFtype3());
|
|
|
513
|
+ if (ftype3List == null || ftype3List.isEmpty()) {
|
|
|
514
|
+ errors.add("输入的规格描述有误!");
|
|
|
515
|
+
|
|
|
516
|
+ }
|
|
|
517
|
+ if (ftype3List != null && !ftype3List.isEmpty() && !Objects.isNull(ftype3List.get(0).getFnum4())
|
|
|
518
|
+ && !Objects.isNull(entity.getFnum4())) {
|
|
|
519
|
+ if (!Objects.equals(entity.getFnum4(), ftype3List.get(0).getFnum4())) {
|
|
|
520
|
+ errors.add("输入的米重与匹配到的米重不一致!");
|
|
|
521
|
+ }
|
|
|
522
|
+
|
|
|
523
|
+ }
|
|
|
524
|
+
|
|
|
525
|
+
|
|
|
526
|
+ }
|
|
|
527
|
+
|
|
|
528
|
+
|
|
|
529
|
+ if (Objects.isNull(entity.getSoPrice())) {
|
|
|
530
|
+ errors.add("销售单价不能为空!");
|
|
|
531
|
+ }
|
|
|
532
|
+
|
|
|
533
|
+ if (StringUtils.isEmpty(entity.getItemno()) && (entity.getItemno().contains("0111") ||
|
|
|
534
|
+ entity.getItemno().contains("0113") || entity.getItemno().contains("0116") || entity.getItemno().contains("0117"))) {
|
|
|
535
|
+ if (Objects.isNull(entity.getFnum7())) {
|
|
|
536
|
+ errors.add("商品编号包含0111或0113或0116或0117,长不能为空!");
|
|
|
537
|
+ }
|
|
|
538
|
+ }
|
|
|
539
|
+
|
|
|
540
|
+ if (StringUtils.isEmpty(entity.getItemno()) && (
|
|
|
541
|
+ entity.getItemno().contains("0113") || entity.getItemno().contains("0116"))) {
|
|
|
542
|
+ if (Objects.isNull(entity.getFnum4())) {
|
|
|
543
|
+ errors.add("商品编号包含0113或0116,米重不能为空!");
|
|
|
544
|
+ }
|
|
|
545
|
+ }
|
|
|
546
|
+
|
|
|
547
|
+ if ("钢产品".equals(bizProductType)) {
|
|
|
548
|
+ if (StringUtils.isEmpty(entity.getFtype4())) {
|
|
|
549
|
+ errors.add("合同产品类型为钢产品时,计重方式不能为空!");
|
|
|
550
|
+ }
|
|
|
551
|
+
|
|
|
552
|
+ List<DataDic> ftype4List = dicMapper.selectByFtyped(entity.getFtype4());
|
|
|
553
|
+
|
|
|
554
|
+ if (ftype4List == null || ftype4List.isEmpty()) {
|
|
|
555
|
+ errors.add("输入的计重方式在数据字典中不存在");
|
|
|
556
|
+ }
|
|
|
557
|
+ }
|
|
489
|
558
|
|
|
490
|
559
|
|
|
491
|
560
|
salesDtlMapper.insert(entity);
|
|
|
@@ -499,11 +568,74 @@ public class SalesContractServiceImpl implements SalesContractService {
|
|
499
|
568
|
try {
|
|
500
|
569
|
List<SalesCollectExcelDTO> list = ExcelUtils.readSalesCollectSheet(file);
|
|
501
|
570
|
if (!list.isEmpty() && cid != null) {
|
|
502
|
|
- SalesCollectExcelDTO dto = list.size() >= 3 ? list.get(2) : list.get(0);
|
|
503
|
|
- SalesCollectMethodEntity entity = new SalesCollectMethodEntity();
|
|
504
|
|
- BeanUtils.copyProperties(dto, entity);
|
|
505
|
|
-// entity.setContractId(cid);
|
|
506
|
|
- salesCollectMethodMapper.insert(entity);
|
|
|
571
|
+ // 先进行所有校验
|
|
|
572
|
+ Map<String, List<SalesCollectExcelDTO>> groupedByFno = list.stream()
|
|
|
573
|
+ .filter(dto -> !StringUtils.isEmpty(dto.getFno()))
|
|
|
574
|
+ .collect(Collectors.groupingBy(SalesCollectExcelDTO::getFno));
|
|
|
575
|
+
|
|
|
576
|
+ // 校验比例总和
|
|
|
577
|
+ for (Map.Entry<String, List<SalesCollectExcelDTO>> entry : groupedByFno.entrySet()) {
|
|
|
578
|
+ String fno = entry.getKey();
|
|
|
579
|
+ List<SalesCollectExcelDTO> sameContractList = entry.getValue();
|
|
|
580
|
+
|
|
|
581
|
+ BigDecimal totalRatio = sameContractList.stream()
|
|
|
582
|
+ .map(dto -> dto.getPaymentRatio() != null ? dto.getPaymentRatio() : BigDecimal.ZERO)
|
|
|
583
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
584
|
+
|
|
|
585
|
+ if (totalRatio.compareTo(new BigDecimal("100")) != 0) {
|
|
|
586
|
+ errors.add("合同号 " + fno + " 的收款比例总和必须为100%,当前总和为:" + totalRatio + "%");
|
|
|
587
|
+ }
|
|
|
588
|
+ }
|
|
|
589
|
+
|
|
|
590
|
+ // 校验单个记录
|
|
|
591
|
+ for (SalesCollectExcelDTO entity : list) {
|
|
|
592
|
+ if (StringUtils.isEmpty(entity.getFno())) {
|
|
|
593
|
+ errors.add("销售合同号不能为空!");
|
|
|
594
|
+ }
|
|
|
595
|
+
|
|
|
596
|
+ if (StringUtils.isEmpty(entity.getPaymentType())) {
|
|
|
597
|
+ errors.add("款项类别不能为空!");
|
|
|
598
|
+ }
|
|
|
599
|
+
|
|
|
600
|
+ if ("预付款-发货后".equals(entity.getPaymentType()) || "发票后结算款".equals(entity.getPaymentType())) {
|
|
|
601
|
+ if (Objects.isNull(entity.getPayDays())) {
|
|
|
602
|
+ errors.add("合同号 " + entity.getFno() + " 的款项类别为'预付款-发货后'或'发票后结算款',账期不能为空!");
|
|
|
603
|
+ }
|
|
|
604
|
+ }
|
|
|
605
|
+
|
|
|
606
|
+ if (StringUtils.isEmpty(entity.getPayMode())) {
|
|
|
607
|
+ errors.add("合同号 " + entity.getFno() + " 的收款方式不能为空!");
|
|
|
608
|
+ }
|
|
|
609
|
+
|
|
|
610
|
+ if (!StringUtils.isEmpty(entity.getPayMode()) && entity.getPayMode().contains("信用证")) {
|
|
|
611
|
+ if (!"发票后结算款".equals(entity.getPaymentType())) {
|
|
|
612
|
+ errors.add("合同号 " + entity.getFno() + " 的收款方式是信用证类型的,款项类别必须是发票后结算款!");
|
|
|
613
|
+ }
|
|
|
614
|
+ }
|
|
|
615
|
+
|
|
|
616
|
+ if (!StringUtils.isEmpty(entity.getOurBankNm())) {
|
|
|
617
|
+ List<CustCtrl> ourBankNmList = custCtrlMapper.selectByOurBankNm(entity.getOurBankNm());
|
|
|
618
|
+ if (ourBankNmList == null || ourBankNmList.isEmpty()) {
|
|
|
619
|
+ errors.add("收款收证银行名称有误!");
|
|
|
620
|
+ }
|
|
|
621
|
+ }
|
|
|
622
|
+ if (!StringUtils.isEmpty(entity.getOurBankAcct())) {
|
|
|
623
|
+ List<CustCtrl> ourBankAcctList = custCtrlMapper.selectByOurBankAcct(entity.getOurBankAcct());
|
|
|
624
|
+ if (ourBankAcctList == null || ourBankAcctList.isEmpty()) {
|
|
|
625
|
+ errors.add("收款收证银行账户有误!");
|
|
|
626
|
+ }
|
|
|
627
|
+ }
|
|
|
628
|
+
|
|
|
629
|
+ }
|
|
|
630
|
+
|
|
|
631
|
+ // 只有所有校验都通过时才插入所有记录
|
|
|
632
|
+ if (errors.isEmpty()) {
|
|
|
633
|
+ for (SalesCollectExcelDTO dto : list) {
|
|
|
634
|
+ SalesCollectMethodEntity entity = new SalesCollectMethodEntity();
|
|
|
635
|
+ BeanUtils.copyProperties(dto, entity);
|
|
|
636
|
+ salesCollectMethodMapper.insert(entity);
|
|
|
637
|
+ }
|
|
|
638
|
+ }
|
|
507
|
639
|
}
|
|
508
|
640
|
} catch (Exception e) {
|
|
509
|
641
|
errors.add("收款计划(Sheet3) 导入失败:" + e.getMessage());
|
|
|
@@ -514,11 +646,124 @@ public class SalesContractServiceImpl implements SalesContractService {
|
|
514
|
646
|
try {
|
|
515
|
647
|
List<RCenterDtlExcelDTO> list = ExcelUtils.readRCenterDtlSheet(file);
|
|
516
|
648
|
if (!list.isEmpty() && cid != null) {
|
|
517
|
|
- RCenterDtlExcelDTO dto = list.size() >= 3 ? list.get(2) : list.get(0);
|
|
518
|
|
- RCenterDtlEntity entity = new RCenterDtlEntity();
|
|
519
|
|
- BeanUtils.copyProperties(dto, entity);
|
|
520
|
|
-// entity.setContractId(cid);
|
|
521
|
|
- rCenterDtlMapper.insert(entity);
|
|
|
649
|
+ // 按合同号分组
|
|
|
650
|
+ Map<String, List<RCenterDtlExcelDTO>> groupedByContract = list.stream()
|
|
|
651
|
+ .filter(dto -> !StringUtils.isEmpty(dto.getFno()))
|
|
|
652
|
+ .collect(Collectors.groupingBy(RCenterDtlExcelDTO::getFno));
|
|
|
653
|
+
|
|
|
654
|
+ // 对每个合同号进行校验
|
|
|
655
|
+ for (Map.Entry<String, List<RCenterDtlExcelDTO>> entry : groupedByContract.entrySet()) {
|
|
|
656
|
+ String contractNo = entry.getKey();
|
|
|
657
|
+ List<RCenterDtlExcelDTO> contractList = entry.getValue();
|
|
|
658
|
+
|
|
|
659
|
+ // 计算该合同号的利润考核占比总和
|
|
|
660
|
+ BigDecimal totalAssessQtyRate = contractList.stream()
|
|
|
661
|
+ .map(dto -> dto.getAssessQtyRate() != null ? dto.getAssessQtyRate() : BigDecimal.ZERO)
|
|
|
662
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
663
|
+
|
|
|
664
|
+ // 计算该合同号的金额考核占比总和
|
|
|
665
|
+ BigDecimal totalAssessRatio = contractList.stream()
|
|
|
666
|
+ .map(dto -> dto.getAssessRatio() != null ? dto.getAssessRatio() : BigDecimal.ZERO)
|
|
|
667
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
668
|
+
|
|
|
669
|
+ // 校验利润考核占比总和是否为100%
|
|
|
670
|
+ if (totalAssessQtyRate.compareTo(new BigDecimal("100")) != 0) {
|
|
|
671
|
+ errors.add("合同号 " + contractNo + " 的利润考核占比总和必须为100%,当前总和为:" + totalAssessQtyRate + "%");
|
|
|
672
|
+ }
|
|
|
673
|
+
|
|
|
674
|
+ // 校验金额考核占比总和是否为100%
|
|
|
675
|
+ if (totalAssessRatio.compareTo(new BigDecimal("100")) != 0) {
|
|
|
676
|
+ errors.add("合同号 " + contractNo + " 的金额考核占比总和必须为100%,当前总和为:" + totalAssessRatio + "%");
|
|
|
677
|
+ }
|
|
|
678
|
+ }
|
|
|
679
|
+
|
|
|
680
|
+ for (RCenterDtlExcelDTO dto : list) {
|
|
|
681
|
+ if (StringUtils.isEmpty(dto.getFno())){
|
|
|
682
|
+ errors.add("销售合同号不能为空!");
|
|
|
683
|
+ }
|
|
|
684
|
+ if(StringUtils.isEmpty(dto.getPersonDeptNm())){
|
|
|
685
|
+ errors.add("部门名称不能为空!");
|
|
|
686
|
+ }
|
|
|
687
|
+ List<CustCtrl> personDeptNmList = custCtrlMapper.selectByPersonDeptNm(dto.getPersonDeptNm());
|
|
|
688
|
+ if(personDeptNmList == null || personDeptNmList.isEmpty()){
|
|
|
689
|
+ errors.add("部门名称有误!");
|
|
|
690
|
+ }
|
|
|
691
|
+
|
|
|
692
|
+ if(personDeptNmList!=null&&!personDeptNmList.isEmpty()&& personDeptNmList.get(0).getDeptCdoe().isEmpty()){
|
|
|
693
|
+ errors.add("匹配到的部门编码为空");
|
|
|
694
|
+ }
|
|
|
695
|
+
|
|
|
696
|
+ if(personDeptNmList!=null&&!personDeptNmList.isEmpty()&& !personDeptNmList.get(0).getDeptCdoe().isEmpty()){
|
|
|
697
|
+ dto.setPersonDeptId(personDeptNmList.get(0).getDeptCdoe());
|
|
|
698
|
+ }
|
|
|
699
|
+
|
|
|
700
|
+ if(personDeptNmList!=null&&!personDeptNmList.isEmpty()&&StringUtils.isEmpty(dto.getInstitutionNm())
|
|
|
701
|
+ && !personDeptNmList.get(0).getCpny().isEmpty()){
|
|
|
702
|
+ if(dto.getInstitutionNm().equals(personDeptNmList.get(0).getCpny())){
|
|
|
703
|
+ errors.add("公司名称与匹配到的公司名称不一致!");
|
|
|
704
|
+ }
|
|
|
705
|
+ }
|
|
|
706
|
+
|
|
|
707
|
+ if(personDeptNmList!=null&&!personDeptNmList.isEmpty()&&StringUtils.isEmpty(dto.getInstitutionId())
|
|
|
708
|
+ && !personDeptNmList.get(0).getFno().isEmpty()){
|
|
|
709
|
+ if(dto.getInstitutionId().equals(personDeptNmList.get(0).getFno())){
|
|
|
710
|
+ errors.add("公司代码与匹配到的公司代码不一致!");
|
|
|
711
|
+ }
|
|
|
712
|
+ }
|
|
|
713
|
+
|
|
|
714
|
+ if(!StringUtils.isEmpty(dto.getCreateBy())){
|
|
|
715
|
+ List<SysUser> createByList = sysUserMapper.selectByCreateBy(dto.getCreateBy());
|
|
|
716
|
+ if(createByList==null || createByList.isEmpty()){
|
|
|
717
|
+ errors.add("制单人代码有误!");
|
|
|
718
|
+ }
|
|
|
719
|
+
|
|
|
720
|
+ if(createByList!=null && !createByList.isEmpty()&&createByList.get(0).getDeptCode().isEmpty()){
|
|
|
721
|
+ errors.add("制单人代码查到的制单人部门编码为空!");
|
|
|
722
|
+ }
|
|
|
723
|
+
|
|
|
724
|
+ if(createByList!=null && !createByList.isEmpty()&&!createByList.get(0).getDeptCode().isEmpty()){
|
|
|
725
|
+ dto.setDeptId(createByList.get(0).getDeptCode());
|
|
|
726
|
+ }
|
|
|
727
|
+
|
|
|
728
|
+ if(createByList!=null && !createByList.isEmpty()&&createByList.get(0).getDeptName().isEmpty()){
|
|
|
729
|
+ errors.add("制单人代码查到的制单人部门名称为空!");
|
|
|
730
|
+ }
|
|
|
731
|
+ if(createByList!=null && !createByList.isEmpty()&&!createByList.get(0).getDeptName().isEmpty()){
|
|
|
732
|
+ dto.setDeptName(createByList.get(0).getDeptName());
|
|
|
733
|
+
|
|
|
734
|
+ }
|
|
|
735
|
+ if(createByList!=null && !createByList.isEmpty()&&!createByList.get(0).getUserDesc().isEmpty()){
|
|
|
736
|
+ dto.setCreateByName(createByList.get(0).getUserDesc());
|
|
|
737
|
+
|
|
|
738
|
+ }
|
|
|
739
|
+
|
|
|
740
|
+
|
|
|
741
|
+ }
|
|
|
742
|
+
|
|
|
743
|
+
|
|
|
744
|
+
|
|
|
745
|
+ }
|
|
|
746
|
+
|
|
|
747
|
+ // 只有所有校验都通过时才插入所有记录
|
|
|
748
|
+ if (errors.isEmpty()) {
|
|
|
749
|
+ for (RCenterDtlExcelDTO dto : list) {
|
|
|
750
|
+ RCenterDtlEntity entity = new RCenterDtlEntity();
|
|
|
751
|
+ BeanUtils.copyProperties(dto, entity);
|
|
|
752
|
+ rCenterDtlMapper.insert(entity);
|
|
|
753
|
+ }
|
|
|
754
|
+ }
|
|
|
755
|
+
|
|
|
756
|
+
|
|
|
757
|
+ // 如果有错误,不执行插入操作
|
|
|
758
|
+ if (errors.isEmpty()) {
|
|
|
759
|
+ // 循环插入所有记录
|
|
|
760
|
+ for (RCenterDtlExcelDTO dto : list) {
|
|
|
761
|
+ RCenterDtlEntity entity = new RCenterDtlEntity();
|
|
|
762
|
+ BeanUtils.copyProperties(dto, entity);
|
|
|
763
|
+ // entity.setContractId(cid);
|
|
|
764
|
+ rCenterDtlMapper.insert(entity);
|
|
|
765
|
+ }
|
|
|
766
|
+ }
|
|
522
|
767
|
}
|
|
523
|
768
|
} catch (Exception e) {
|
|
524
|
769
|
errors.add("责任中心(Sheet4) 导入失败:" + e.getMessage());
|