11816 1 day ago
parent
commit
0a9f88b853
1 changed files with 56 additions and 56 deletions
  1. 56
    56
      src/main/java/com/example/backend/pAndSExe/util/PsExeExcelUtil.java

+ 56
- 56
src/main/java/com/example/backend/pAndSExe/util/PsExeExcelUtil.java View File

@@ -218,7 +218,7 @@ public class PsExeExcelUtil {
218 218
         List<String> errorLogList = new ArrayList<>();
219 219
 
220 220
         // 1. 校验采购合同号
221
-        if (dto.getPfno() == null || dto.getPfno().trim().isEmpty()) {
221
+        if (dto.getPfno() == null || dto.getPfno().isEmpty()) {
222 222
             errorLogList.add("采购合同号为空");
223 223
         } else {
224 224
             String pfno = dto.getPfno().trim();
@@ -245,7 +245,7 @@ public class PsExeExcelUtil {
245 245
         }else errorLogList.add("商品信息为空");
246 246
 
247 247
         // 2. 校验其他字段
248
-        if (dto.getStockname() == null || dto.getStockname().trim().isEmpty()) {
248
+        if (dto.getStockname() == null || dto.getStockname().isEmpty()) {
249 249
             errorLogList.add("仓库名称为空");
250 250
         }else {
251 251
             String s = trimField(dto.getStockname());
@@ -265,10 +265,10 @@ public class PsExeExcelUtil {
265 265
             }
266 266
         }
267 267
 
268
-        if (dto.getCreateBy() == null || dto.getCreateBy().trim().isEmpty()) {
268
+        if (dto.getCreateBy() == null || dto.getCreateBy().isEmpty()) {
269 269
             errorLogList.add("制单人为空");
270 270
         }
271
-        if (dto.getUt() == null || dto.getUt().trim().isEmpty()) {
271
+        if (dto.getUt() == null || dto.getUt().isEmpty()) {
272 272
             errorLogList.add("单位为空");
273 273
         }
274 274
 
@@ -276,18 +276,18 @@ public class PsExeExcelUtil {
276 276
             errorLogList.add("单位不在下拉框中");
277 277
         }
278 278
         String bizProductType=infExe1Mapper.selectBizProductTypeByPfno(dto.getPfno());
279
-        if (bizProductType == null || bizProductType.trim().isEmpty()) {
279
+        if (bizProductType == null || bizProductType.isEmpty()) {
280 280
             errorLogList.add("合同业务产品类型为空");
281 281
         }else if (bizProductType.equals("钢产品")){
282
-            if (dto.getFtype3() == null || dto.getFtype3().trim().isEmpty()) {
282
+            if (dto.getFtype3() == null || dto.getFtype3().isEmpty()) {
283 283
                 errorLogList.add("钢产品规格为空");
284 284
             }
285
-            if (dto.getFtype4() == null || dto.getFtype4().trim().isEmpty()) {
285
+            if (dto.getFtype4() == null || dto.getFtype4().isEmpty()) {
286 286
                 errorLogList.add("钢产品计重方式为空");
287 287
             }else if (!Shujvzidian.jizhongfangshi.contains(dto.getFtype4().trim())){
288 288
                 errorLogList.add("钢产品计重方式不在下拉框中");
289 289
             }
290
-            /*if (dto.getSMRNo()==null || dto.getSMRNo().trim().isEmpty()) {
290
+            /*if (dto.getSMRNo()==null || dto.getSMRNo().isEmpty()) {
291 291
                 errorLogList.add("钢产品钢厂资源号为空");
292 292
             }*/
293 293
         }else if(bizProductType.equals("铁矿石")){
@@ -414,7 +414,7 @@ public class PsExeExcelUtil {
414 414
         List<String> errorLogList = new ArrayList<>();
415 415
 
416 416
         // 1. 校验销售合同号(替换原采购合同号校验)
417
-        if (dto.getSfno() == null || dto.getSfno().trim().isEmpty()) {
417
+        if (dto.getSfno() == null || dto.getSfno().isEmpty()) {
418 418
             errorLogList.add("销售合同号为空");
419 419
         } else {
420 420
             String sfno = dto.getSfno().trim();
@@ -441,7 +441,7 @@ public class PsExeExcelUtil {
441 441
         }else errorLogList.add("商品信息为空");
442 442
 
443 443
         // 2. 其他基础字段非空校验(与InfExe1一致)
444
-        if (dto.getStockname() == null || dto.getStockname().trim().isEmpty()) {
444
+        if (dto.getStockname() == null || dto.getStockname().isEmpty()) {
445 445
             errorLogList.add("仓库名称为空");
446 446
         }
447 447
         else {
@@ -461,28 +461,28 @@ public class PsExeExcelUtil {
461 461
                 }*/
462 462
             }
463 463
         }
464
-        if (dto.getUt() == null || dto.getUt().trim().isEmpty()) {
464
+        if (dto.getUt() == null || dto.getUt().isEmpty()) {
465 465
             errorLogList.add("单位为空");
466 466
         }
467 467
         else if (!Shujvzidian.danwei.contains(dto.getUt().trim())){
468 468
             errorLogList.add("单位不在下拉框中");
469 469
         }
470
-        if (dto.getCreateBy() == null || dto.getCreateBy().trim().isEmpty()) {
470
+        if (dto.getCreateBy() == null || dto.getCreateBy().isEmpty()) {
471 471
             errorLogList.add("制单人为空");
472 472
         }
473 473
         String bizProductType=infExe1Mapper.selectBizProductTypeBySfno(dto.getSfno());
474
-        if (bizProductType == null || bizProductType.trim().isEmpty()) {
474
+        if (bizProductType == null || bizProductType.isEmpty()) {
475 475
             errorLogList.add("合同业务产品类型为空");
476 476
         }else if (bizProductType.equals("钢产品")){
477
-            if (dto.getFtype3() == null || dto.getFtype3().trim().isEmpty()) {
477
+            if (dto.getFtype3() == null || dto.getFtype3().isEmpty()) {
478 478
                 errorLogList.add("钢产品规格为空");
479 479
             }
480
-            if (dto.getFtype4() == null || dto.getFtype4().trim().isEmpty()) {
480
+            if (dto.getFtype4() == null || dto.getFtype4().isEmpty()) {
481 481
                 errorLogList.add("钢产品计重方式为空");
482 482
             }else if (!Shujvzidian.jizhongfangshi.contains(dto.getFtype4().trim())){
483 483
                 errorLogList.add("钢产品计重方式不在下拉框中");
484 484
             }
485
-            /*if (dto.getSMRNo()==null || dto.getSMRNo().trim().isEmpty()) {
485
+            /*if (dto.getSMRNo()==null || dto.getSMRNo().isEmpty()) {
486 486
                 errorLogList.add("钢产品钢厂资源号为空");
487 487
             }*/
488 488
         }else if(bizProductType.equals("铁矿石")){
@@ -610,7 +610,7 @@ public class PsExeExcelUtil {
610 610
 
611 611
         // 2. 逐字段非空校验(仿照Sheet1的校验逻辑)
612 612
         // 采购合同号:非空 + 合同存在校验
613
-        if (dto.getPfno() == null || dto.getPfno().trim().isEmpty()) {
613
+        if (dto.getPfno() == null || dto.getPfno().isEmpty()) {
614 614
             errorLogList.add("采购合同号为空");
615 615
         } else {
616 616
             String pfno = dto.getPfno().trim();
@@ -622,7 +622,7 @@ public class PsExeExcelUtil {
622 622
         }
623 623
 
624 624
         // 收款/受益人信息:非空校验
625
-        if (dto.getCombinedPaymentInfo() == null || dto.getCombinedPaymentInfo().trim().isEmpty()) {
625
+        if (dto.getCombinedPaymentInfo() == null || dto.getCombinedPaymentInfo().isEmpty()) {
626 626
             errorLogList.add("收款/受益人名称+银行名称+银行账号为空");
627 627
         }else {
628 628
             String[] strings = splitCombinedField(dto.getCombinedPaymentInfo());
@@ -643,14 +643,14 @@ public class PsExeExcelUtil {
643 643
 
644 644
 
645 645
         // 付款类型:非空校验
646
-        if (dto.getPayType() == null || dto.getPayType().trim().isEmpty()) {
646
+        if (dto.getPayType() == null || dto.getPayType().isEmpty()) {
647 647
             errorLogList.add("付款类型为空");
648 648
         }else if (!Shujvzidian.fukuanleixing.contains(dto.getPayType().trim())){
649 649
             errorLogList.add("付款类型不在下拉框中");
650 650
         }
651 651
 
652 652
         // 付款方式:非空校验
653
-        if (dto.getPayment() == null || dto.getPayment().trim().isEmpty()) {
653
+        if (dto.getPayment() == null || dto.getPayment().isEmpty()) {
654 654
             errorLogList.add("付款方式为空");
655 655
         }else if (!Shujvzidian.fukuanfangshi.contains(dto.getPayment().trim())){
656 656
             errorLogList.add("付款方式不在下拉框中");
@@ -662,12 +662,12 @@ public class PsExeExcelUtil {
662 662
         }
663 663
 
664 664
         // 币别:非空校验
665
-        if (dto.getCurcy() == null || dto.getCurcy().trim().isEmpty()) {
665
+        if (dto.getCurcy() == null || dto.getCurcy().isEmpty()) {
666 666
             errorLogList.add("币别为空");
667 667
         }else if (!Shujvzidian.bibie.contains(dto.getCurcy().trim())){
668 668
             errorLogList.add("币别不在下拉框中");
669 669
         }
670
-        if (dto.getCreateBy() == null || dto.getCreateBy().trim().isEmpty()) {
670
+        if (dto.getCreateBy() == null || dto.getCreateBy().isEmpty()) {
671 671
             errorLogList.add("制单人为空");
672 672
         }
673 673
 
@@ -725,12 +725,12 @@ public class PsExeExcelUtil {
725 725
 
726 726
         // 2. 逐字段非空+业务规则校验(核心:仿照Exe3的校验逻辑,适配Exe4字段)
727 727
         // 付款类型:非空校验
728
-        if (dto.getPayType() == null || dto.getPayType().trim().isEmpty()) {
728
+        if (dto.getPayType() == null || dto.getPayType().isEmpty()) {
729 729
             errorLogList.add("付款类型为空");
730 730
         }
731 731
 
732 732
         // 业务类别:非空校验
733
-        if (dto.getExpNode() == null || dto.getExpNode().trim().isEmpty()) {
733
+        if (dto.getExpNode() == null || dto.getExpNode().isEmpty()) {
734 734
             errorLogList.add("业务类别为空");
735 735
         }else if (!Shujvzidian.yewuleibie.contains(dto.getExpNode().trim())) {
736 736
             errorLogList.add("业务类别不在下拉框中");
@@ -760,7 +760,7 @@ public class PsExeExcelUtil {
760 760
         }
761 761
 
762 762
         // 收款人组合信息:非空校验(Exe3的combinedPaymentInfo逻辑复用)
763
-        if (dto.getCombinedSuppInfo() == null || dto.getCombinedSuppInfo().trim().isEmpty()) {
763
+        if (dto.getCombinedSuppInfo() == null || dto.getCombinedSuppInfo().isEmpty()) {
764 764
             errorLogList.add("收款人名称+收款人银行+银行账号为空");
765 765
         }
766 766
         else {
@@ -781,17 +781,17 @@ public class PsExeExcelUtil {
781 781
         }
782 782
 
783 783
         // 付款方式:非空校验(和Exe3一致)
784
-        if (dto.getPayment() == null || dto.getPayment().trim().isEmpty()) {
784
+        if (dto.getPayment() == null || dto.getPayment().isEmpty()) {
785 785
             errorLogList.add("付款方式为空");
786 786
         }else if (!Shujvzidian.fukuanfangshi.contains(dto.getPayment().trim())) {
787 787
             errorLogList.add("付款方式不在下拉框中");
788 788
         }
789
-        if (dto.getCreateBy() == null || dto.getCreateBy().trim().isEmpty()) {
789
+        if (dto.getCreateBy() == null || dto.getCreateBy().isEmpty()) {
790 790
             errorLogList.add("制单人为空");
791 791
         }
792 792
 
793 793
         // 费用名称:非空校验(Exe4特有字段)
794
-        if (dto.getFeeNm() == null || dto.getFeeNm().trim().isEmpty()) {
794
+        if (dto.getFeeNm() == null || dto.getFeeNm().isEmpty()) {
795 795
             errorLogList.add("费用名称为空");
796 796
         }else if (!Shujvzidian.feiyongmingcheng.contains(dto.getFeeNm().trim())) {
797 797
             errorLogList.add("费用名称不在下拉框中");
@@ -803,7 +803,7 @@ public class PsExeExcelUtil {
803 803
         }
804 804
 
805 805
         // 币别:非空校验(和Exe3一致)
806
-        if (dto.getCurcy() == null || dto.getCurcy().trim().isEmpty()) {
806
+        if (dto.getCurcy() == null || dto.getCurcy().isEmpty()) {
807 807
             errorLogList.add("币别为空");
808 808
         }else if (!Shujvzidian.bibie.contains(dto.getCurcy().trim())) {
809 809
             errorLogList.add("币别不在下拉框中");
@@ -891,34 +891,34 @@ public class PsExeExcelUtil {
891 891
         }
892 892
 
893 893
         // 基础字段非空校验
894
-        if (dto.getTaxInvType() == null || dto.getTaxInvType().trim().isEmpty()) {
894
+        if (dto.getTaxInvType() == null || dto.getTaxInvType().isEmpty()) {
895 895
             errorLogList.add("发票类型为空");
896 896
         }else if(!Shujvzidian.fapiaozhonglei.contains(dto.getTaxInvType().trim())){
897 897
             errorLogList.add("发票种类不在选项中");
898 898
         }else if(dto.getTaxInvType().trim().contains("海关")){
899 899
             errorLogList.add("海关发票需要联系管理员");
900 900
         }
901
-        if (dto.getTaxInvNo() == null || dto.getTaxInvNo().trim().isEmpty()) {
901
+        if (dto.getTaxInvNo() == null || dto.getTaxInvNo().isEmpty()) {
902 902
             errorLogList.add("发票号码为空");
903 903
         }
904
-        if (dto.getExpNode() == null || dto.getExpNode().trim().isEmpty()) {
904
+        if (dto.getExpNode() == null || dto.getExpNode().isEmpty()) {
905 905
             errorLogList.add("业务类别为空");
906 906
         }else if (!Shujvzidian.yewuleibie.contains(dto.getExpNode().trim())) {
907 907
             errorLogList.add("业务类别不在下拉框中");
908 908
         }
909
-        if (dto.getCateName() == null || dto.getCateName().trim().isEmpty()) {
909
+        if (dto.getCateName() == null || dto.getCateName().isEmpty()) {
910 910
             errorLogList.add("类别名称为空");
911 911
         }
912
-        if (dto.getUt() == null || dto.getUt().trim().isEmpty()) {
912
+        if (dto.getUt() == null || dto.getUt().isEmpty()) {
913 913
             errorLogList.add("单位为空");
914 914
         }
915 915
         else if (!Shujvzidian.danwei.contains(dto.getUt().trim())){
916 916
             errorLogList.add("单位不在下拉框中");
917 917
         }
918
-        if (dto.getFeeNm() == null || dto.getFeeNm().trim().isEmpty()) {
918
+        if (dto.getFeeNm() == null || dto.getFeeNm().isEmpty()) {
919 919
             errorLogList.add("费用名称为空");
920 920
         }
921
-        if (dto.getCurcypo() == null || dto.getCurcypo().trim().isEmpty()) {
921
+        if (dto.getCurcypo() == null || dto.getCurcypo().isEmpty()) {
922 922
             errorLogList.add("币别为空");
923 923
         }
924 924
 
@@ -1018,12 +1018,12 @@ public class PsExeExcelUtil {
1018 1018
             }
1019 1019
         }
1020 1020
 
1021
-        if (dto.getTaxInvNo()==null || dto.getTaxInvNo().trim().isEmpty()) {
1021
+        if (dto.getTaxInvNo()==null || dto.getTaxInvNo().isEmpty()) {
1022 1022
             errorLogList.add("税票号码为空");
1023 1023
         }
1024 1024
 
1025 1025
         // 基础字段非空校验
1026
-        if (dto.getTaxInvType() == null || dto.getTaxInvType().trim().isEmpty()) {
1026
+        if (dto.getTaxInvType() == null || dto.getTaxInvType().isEmpty()) {
1027 1027
             errorLogList.add("发票类型为空");
1028 1028
         }
1029 1029
         else if(!Shujvzidian.fapiaozhonglei.contains(dto.getTaxInvType().trim())){
@@ -1038,7 +1038,7 @@ public class PsExeExcelUtil {
1038 1038
         if (dto.getPoamt() == null) {
1039 1039
             errorLogList.add("含税金额为空");
1040 1040
         }
1041
-        if (dto.getTaxInvNo() == null || dto.getTaxInvNo().trim().isEmpty()) {
1041
+        if (dto.getTaxInvNo() == null || dto.getTaxInvNo().isEmpty()) {
1042 1042
             errorLogList.add("发票号码为空");
1043 1043
         }
1044 1044
 
@@ -1057,13 +1057,13 @@ public class PsExeExcelUtil {
1057 1057
                 }
1058 1058
             }
1059 1059
         }else errorLogList.add("商品编码+中文品名+牌号为空");
1060
-        if (dto.getUt() == null || dto.getUt().trim().isEmpty()) {
1060
+        if (dto.getUt() == null || dto.getUt().isEmpty()) {
1061 1061
             errorLogList.add("单位为空");
1062 1062
         }
1063 1063
         else if (!Shujvzidian.danwei.contains(dto.getUt().trim())){
1064 1064
             errorLogList.add("单位不在下拉框中");
1065 1065
         }
1066
-        if (dto.getCurcypo() == null || dto.getCurcypo().trim().isEmpty()) {
1066
+        if (dto.getCurcypo() == null || dto.getCurcypo().isEmpty()) {
1067 1067
             errorLogList.add("币别为空");
1068 1068
         }
1069 1069
 
@@ -1171,28 +1171,28 @@ public class PsExeExcelUtil {
1171 1171
         }
1172 1172
 
1173 1173
         // 信用证号:非空校验
1174
-        if (dto.getLcno() == null || dto.getLcno().trim().isEmpty()) {
1174
+        if (dto.getLcno() == null || dto.getLcno().isEmpty()) {
1175 1175
             errorLogList.add("信用证号为空");
1176 1176
         }
1177 1177
 
1178 1178
         // 币别:非空校验
1179
-        if (dto.getCurcy() == null || dto.getCurcy().trim().isEmpty()) {
1179
+        if (dto.getCurcy() == null || dto.getCurcy().isEmpty()) {
1180 1180
             errorLogList.add("币别为空");
1181 1181
         }
1182 1182
 
1183 1183
         //
1184
-        if (dto.getFdate() == null || dto.getCurcy().trim().isEmpty()) {
1184
+        if (dto.getFdate() == null || dto.getCurcy().isEmpty()) {
1185 1185
             errorLogList.add("到单日期为空");
1186 1186
         }
1187 1187
         //
1188
-        if (dto.getFkdate() == null || dto.getCurcy().trim().isEmpty()) {
1188
+        if (dto.getFkdate() == null || dto.getCurcy().isEmpty()) {
1189 1189
             errorLogList.add("承兑日期为空");
1190 1190
         }
1191 1191
         //
1192
-        if (dto.getYjfkdate() == null || dto.getCurcy().trim().isEmpty()) {
1192
+        if (dto.getYjfkdate() == null || dto.getCurcy().isEmpty()) {
1193 1193
             errorLogList.add("付款日期为空");
1194 1194
         }
1195
-        if (dto.getIssuingBankName() == null || dto.getCurcy().trim().isEmpty()) {
1195
+        if (dto.getIssuingBankName() == null || dto.getCurcy().isEmpty()) {
1196 1196
             errorLogList.add("开证银行名称为空");
1197 1197
         }
1198 1198
 
@@ -1712,7 +1712,7 @@ public class PsExeExcelUtil {
1712 1712
             errorLogList.add("客户信息(名称+银行+账号+合同名)为空");
1713 1713
         } else {
1714 1714
             // 拆分规则:按【|】分隔(优先),无则按【;】,最后按【,】/空格,最多拆4段
1715
-            String[] ctArr = ctInfo.split("[|;,\\s]+", 4);
1715
+            String[] ctArr = ctInfo.split("[|;,\\s,]+", 4);
1716 1716
             if (ctArr.length >= 1) ctName = ctArr[0];
1717 1717
             if (ctArr.length >= 2) ctInvoiceBankName = ctArr[1];
1718 1718
             if (ctArr.length >= 3) ctInvoiceBankAcct = ctArr[2];
@@ -1761,7 +1761,7 @@ public class PsExeExcelUtil {
1761 1761
             errorLogList.add("物料信息(编码+描述+品牌)为空");
1762 1762
         } else {
1763 1763
             // 拆分规则:按【|】分隔(优先),无则按【-】,最后按空格/逗号,最多拆3段
1764
-            String[] itemArr = itemInfo.split("[|\\-,\\s]+", 3);
1764
+            String[] itemArr = itemInfo.split("[|\\-,,\\s]+", 3);
1765 1765
             if (itemArr.length >= 1) itemno = itemArr[0];
1766 1766
             if (itemArr.length >= 2) sdesc = itemArr[1];
1767 1767
             if (itemArr.length >= 3) brand = itemArr[2];
@@ -1871,7 +1871,7 @@ public class PsExeExcelUtil {
1871 1871
         return entity;
1872 1872
     }
1873 1873
     /*private   InfExe3 convertToInfExe4(InfExe3ExcelDTO dto) {
1874
-        if (dto.getPfno() == null || dto.getPfno().trim().isEmpty()) {
1874
+        if (dto.getPfno() == null || dto.getPfno().isEmpty()) {
1875 1875
             System.err.println("InfExe3:采购合同号为空,过滤该条数据:" + dto);
1876 1876
             return null;
1877 1877
         }
@@ -1901,8 +1901,8 @@ public class PsExeExcelUtil {
1901 1901
     }
1902 1902
 
1903 1903
     private   InfExe5 convertToInfExe5(InfExe5ExcelDTO dto) {
1904
-        if ((dto.getPayType() == null || dto.getPayType().trim().isEmpty())
1905
-                && (dto.getYewuleibie() == null || dto.getYewuleibie().trim().isEmpty())) {
1904
+        if ((dto.getPayType() == null || dto.getPayType().isEmpty())
1905
+                && (dto.getYewuleibie() == null || dto.getYewuleibie().isEmpty())) {
1906 1906
             System.err.println("InfExe5:付款类型和业务类别均为空,过滤该条数据:" + dto);
1907 1907
             return null;
1908 1908
         }
@@ -1942,7 +1942,7 @@ public class PsExeExcelUtil {
1942 1942
      * 【修正3】删除ctNo字段赋值(DTO中无该字段)
1943 1943
      *//*
1944 1944
     private   InfExe6 convertToInfExe6(InfExe6ExcelDTO dto) {
1945
-        if (dto.getSfno() == null || dto.getSfno().trim().isEmpty()) {
1945
+        if (dto.getSfno() == null || dto.getSfno().isEmpty()) {
1946 1946
             System.err.println("InfExe6:销售合同号为空,过滤该条数据:" + dto);
1947 1947
             return null;
1948 1948
         }
@@ -1974,7 +1974,7 @@ public class PsExeExcelUtil {
1974 1974
     }
1975 1975
 
1976 1976
     private   InfExe7 convertToInfExe7(InfExe7ExcelDTO dto) {
1977
-        if (dto.getSfno() == null || dto.getSfno().trim().isEmpty()) {
1977
+        if (dto.getSfno() == null || dto.getSfno().isEmpty()) {
1978 1978
             System.err.println("InfExe7:销售合同号为空,过滤该条数据:" + dto);
1979 1979
             return null;
1980 1980
         }
@@ -2012,7 +2012,7 @@ public class PsExeExcelUtil {
2012 2012
      * 多值列拆分(支持多种分隔符)
2013 2013
      */
2014 2014
     private   String[] splitCombinedField(String combinedField) {
2015
-        if (combinedField == null || combinedField.trim().isEmpty()) {
2015
+        if (combinedField == null || combinedField.isEmpty()) {
2016 2016
             return new String[0];
2017 2017
         }
2018 2018
         return combinedField.trim().split("[,,、;;]");
@@ -2044,7 +2044,7 @@ public class PsExeExcelUtil {
2044 2044
      * 字符串转Date(支持多格式,适配JDK8)
2045 2045
      */
2046 2046
     private   Date parseDate(String dateStr) {
2047
-        if (dateStr == null || dateStr.trim().isEmpty()) {
2047
+        if (dateStr == null || dateStr.isEmpty()) {
2048 2048
             return null;
2049 2049
         }
2050 2050
         String trimDate = dateStr.trim();

Loading…
Cancel
Save