Browse Source

修改大量

11816 3 months ago
parent
commit
6da1cc1d2e

+ 2
- 2
src/main/java/com/example/backend/pAndSExe/mapper/InfExe1Mapper.java View File

53
     @Select("SELECT * FROM SGGMINFT.INF_EXE1")
53
     @Select("SELECT * FROM SGGMINFT.INF_EXE1")
54
     List<InfExe1> selectAllData();
54
     List<InfExe1> selectAllData();
55
 
55
 
56
-    @Select("select create_by from SGGMIIP.purchaseContract where fno =#{pono} where del_flag !=1 limit 1")
56
+    @Select("select create_by from SGGMIIP.purchaseContract where fno =#{pono} and del_flag !=1 limit 1")
57
     String selectCreateByFromPono(String pono);
57
     String selectCreateByFromPono(String pono);
58
 
58
 
59
-    @Select("select create_by from SGGMIIP.salesContract where fno =#{sono} where del_flag !=1 limit 1")
59
+    @Select("select create_by from SGGMIIP.salesContract where fno =#{sono} and del_flag !=1 limit 1")
60
     String selectCreateByFromSono(String sono);
60
     String selectCreateByFromSono(String sono);
61
 }
61
 }

+ 1
- 1
src/main/java/com/example/backend/pAndSExe/mapper/InfExe3Mapper.java View File

24
     @Select("SELECT * FROM SGGMINFT.INF_EXE4 WHERE dataStatus = '0'")
24
     @Select("SELECT * FROM SGGMINFT.INF_EXE4 WHERE dataStatus = '0'")
25
     List<InfExe3> selectValidData();
25
     List<InfExe3> selectValidData();
26
 
26
 
27
-    @Update("UPDATE SGGMINFT.INF_EXE3 SET dataStatus = '1' WHERE ID = #{id}")
27
+    @Update("UPDATE SGGMINFT.INF_EXE4 SET dataStatus = '1' WHERE ID = #{id}")
28
     int updateStatusById(@Param("id") String id);
28
     int updateStatusById(@Param("id") String id);
29
     @Select("SELECT * FROM SGGMINFT.INF_EXE4")
29
     @Select("SELECT * FROM SGGMINFT.INF_EXE4")
30
     List<InfExe3> selectAllData();
30
     List<InfExe3> selectAllData();

src/main/java/com/example/backend/pAndSExe/mapper/SalesContractMapper.java → src/main/java/com/example/backend/pAndSExe/mapper/SalesContractExeMapper.java View File

1
 package com.example.backend.pAndSExe.mapper;
1
 package com.example.backend.pAndSExe.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.example.backend.pAndSExe.model.PurchaseOrder;
5
 import com.example.backend.pAndSExe.model.SalesContract;
4
 import com.example.backend.pAndSExe.model.SalesContract;
6
 import org.apache.ibatis.annotations.Select;
5
 import org.apache.ibatis.annotations.Select;
7
 
6
 
8
 /**
7
 /**
9
  * 采购订单 存储仓
8
  * 采购订单 存储仓
10
  */
9
  */
11
-public interface SalesContractMapper extends BaseMapper <SalesContract> {
10
+public interface SalesContractExeMapper extends BaseMapper <SalesContract> {
12
 
11
 
13
 
12
 
14
     @Select("select * from SGGMIIP.salesContract where fno=#{sono} and del_flag != 1 limit 1")
13
     @Select("select * from SGGMIIP.salesContract where fno=#{sono} and del_flag != 1 limit 1")

+ 1
- 1
src/main/java/com/example/backend/pAndSExe/model/SalesContract.java View File

14
  * 注:若数据库表指定了模式(如 SGGMIIP.salesContract),请补充到 @TableName 中,例:@TableName("SGGMIIP.salesContract")
14
  * 注:若数据库表指定了模式(如 SGGMIIP.salesContract),请补充到 @TableName 中,例:@TableName("SGGMIIP.salesContract")
15
  */
15
  */
16
 @Data
16
 @Data
17
-@TableName("salesContract") // 数据库表名,需根据实际调整模式前缀
17
+@TableName("SGGMIIP.salesContract") // 数据库表名,需根据实际调整模式前缀
18
 public class SalesContract {
18
 public class SalesContract {
19
     /** 主键ID(雪花ID,适配BIGINT类型) */
19
     /** 主键ID(雪花ID,适配BIGINT类型) */
20
     @TableId(type = IdType.ASSIGN_ID)
20
     @TableId(type = IdType.ASSIGN_ID)

+ 2
- 2
src/main/java/com/example/backend/pAndSExe/service/impl/DaodandengjiSettleServiceImpl.java View File

36
         // 1. 查询中间表有效数据(dataStatus=0)
36
         // 1. 查询中间表有效数据(dataStatus=0)
37
         List<InfDaodandengji> infList = infDaodandengjiMapper.selectValidData();
37
         List<InfDaodandengji> infList = infDaodandengjiMapper.selectValidData();
38
         //todo
38
         //todo
39
-        infList=infDaodandengjiMapper.selectAllData();
39
+        //infList=infDaodandengjiMapper.selectAllData();
40
         if (infList.isEmpty()) {
40
         if (infList.isEmpty()) {
41
             return "未查询到到货登记中间表中有效数据(dataStatus=0),无需导入";
41
             return "未查询到到货登记中间表中有效数据(dataStatus=0),无需导入";
42
         }
42
         }
69
 
69
 
70
                 // 更新中间表状态为已导入
70
                 // 更新中间表状态为已导入
71
                 //todo
71
                 //todo
72
-                //infDaodandengjiMapper.updateStatusById(inf.getId());
72
+                infDaodandengjiMapper.updateStatusById(inf.getId());
73
                 successCount++;
73
                 successCount++;
74
             } catch (Exception e) {
74
             } catch (Exception e) {
75
                 failCount++;
75
                 failCount++;

+ 2
- 2
src/main/java/com/example/backend/pAndSExe/service/impl/FeeInvoiceSettleServiceImpl.java View File

42
         // 1. 查询中间表中有效数据(dataStatus=0)
42
         // 1. 查询中间表中有效数据(dataStatus=0)
43
         List<InfFeiyongfapiaodengji> infList = infFeiyongfapiaodengjiMapper.selectValidData();
43
         List<InfFeiyongfapiaodengji> infList = infFeiyongfapiaodengjiMapper.selectValidData();
44
         //todo
44
         //todo
45
-        infList=infFeiyongfapiaodengjiMapper.selectAllData();
45
+        //infList=infFeiyongfapiaodengjiMapper.selectAllData();
46
         if (infList.isEmpty()) {
46
         if (infList.isEmpty()) {
47
             return "未查询到中间表中有效数据(dataStatus=0),无需导入";
47
             return "未查询到中间表中有效数据(dataStatus=0),无需导入";
48
         }
48
         }
109
 
109
 
110
                 // 更新中间表状态为已导入
110
                 // 更新中间表状态为已导入
111
                 //todo
111
                 //todo
112
-                // infFeiyongfapiaodengjiMapper.updateStatusById(inf.getId());
112
+                 infFeiyongfapiaodengjiMapper.updateStatusById(inf.getId());
113
                 successCount++;
113
                 successCount++;
114
             } catch (Exception e) {
114
             } catch (Exception e) {
115
                 failCount++;
115
                 failCount++;

+ 4
- 5
src/main/java/com/example/backend/pAndSExe/service/impl/FeePayServiceImpl.java View File

1
 package com.example.backend.pAndSExe.service.impl;
1
 package com.example.backend.pAndSExe.service.impl;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
3
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
4
-import com.example.backend.entity.contract.SalesContractEntity;
5
 import com.example.backend.pAndSExe.mapper.*;
4
 import com.example.backend.pAndSExe.mapper.*;
6
 import com.example.backend.pAndSExe.model.*;
5
 import com.example.backend.pAndSExe.model.*;
7
 import com.example.backend.pAndSExe.service.FeePayService;
6
 import com.example.backend.pAndSExe.service.FeePayService;
35
     private MdkcctrlMapper mdkcctrlMapper;
34
     private MdkcctrlMapper mdkcctrlMapper;
36
 
35
 
37
     @Autowired
36
     @Autowired
38
-    private SalesContractMapper salesContractMapper;
37
+    private SalesContractExeMapper salesContractExeMapper;
39
 
38
 
40
     /**
39
     /**
41
      * 批量导入费用付款数据到业务表(事务控制,保证主从表一致性)
40
      * 批量导入费用付款数据到业务表(事务控制,保证主从表一致性)
45
     public String importInfFeiyongfukuanToPay() {
44
     public String importInfFeiyongfukuanToPay() {
46
         // 1. 查询inf_feiyongfukuan中有效数据(dataStatus=0,校验通过的数据)
45
         // 1. 查询inf_feiyongfukuan中有效数据(dataStatus=0,校验通过的数据)
47
         List<InfFeiyongfukuan> feiyongList = infExe4Mapper.selectValidData(); // 同Exe3:查询dataStatus=0的有效数据
46
         List<InfFeiyongfukuan> feiyongList = infExe4Mapper.selectValidData(); // 同Exe3:查询dataStatus=0的有效数据
48
-        feiyongList=infExe4Mapper.selectAllData();
47
+        //feiyongList=infExe4Mapper.selectAllData();
49
         if (feiyongList.isEmpty()) {
48
         if (feiyongList.isEmpty()) {
50
             return "未查询到inf_feiyongfukuan中有效数据(dataStatus=0),无需导入";
49
             return "未查询到inf_feiyongfukuan中有效数据(dataStatus=0),无需导入";
51
         }
50
         }
98
                         ctrl.setFoursname(purchasecontract.getFoursname());
97
                         ctrl.setFoursname(purchasecontract.getFoursname());
99
                     }
98
                     }
100
                 } else if (fee.getSono() != null && !fee.getSono().isEmpty()){
99
                 } else if (fee.getSono() != null && !fee.getSono().isEmpty()){
101
-                    salesContract=salesContractMapper.selectByFno(fee.getSono());
100
+                    salesContract= salesContractExeMapper.selectByFno(fee.getSono());
102
                     if (salesContract!=null) {
101
                     if (salesContract!=null) {
103
                         ctrl.setFours(salesContract.getFours());
102
                         ctrl.setFours(salesContract.getFours());
104
                         ctrl.setFoursname(salesContract.getFoursname());
103
                         ctrl.setFoursname(salesContract.getFoursname());
111
                // paymgrctrlMapper.insertFeePaymgrctrl(ctrl);
110
                // paymgrctrlMapper.insertFeePaymgrctrl(ctrl);
112
                 // 同Exe3:更新inf_feiyongfukuan的状态(标记为已导入)
111
                 // 同Exe3:更新inf_feiyongfukuan的状态(标记为已导入)
113
                 // todo 先不改状态
112
                 // todo 先不改状态
114
-               // infExe4Mapper.updateStatusById(fee.getID());
113
+                infExe4Mapper.updateStatusById(fee.getID());
115
 
114
 
116
                 // ========== 第二步:插入子表paystockdtl(补充费用名称字段) ==========
115
                 // ========== 第二步:插入子表paystockdtl(补充费用名称字段) ==========
117
                 Paystockdtl dtl = new Paystockdtl();
116
                 Paystockdtl dtl = new Paystockdtl();

+ 3
- 3
src/main/java/com/example/backend/pAndSExe/service/impl/JinxiangInvoiceSettleServiceImpl.java View File

43
         // 1. 查询中间表中有效数据(dataStatus=0)
43
         // 1. 查询中间表中有效数据(dataStatus=0)
44
         List<InfJinxiangfapiao> infList = infJinxiangfapiaoMapper.selectValidData();
44
         List<InfJinxiangfapiao> infList = infJinxiangfapiaoMapper.selectValidData();
45
         //todo
45
         //todo
46
-        infList=infJinxiangfapiaoMapper.selectAllData();
46
+        //infList=infJinxiangfapiaoMapper.selectAllData();
47
 
47
 
48
         if (infList.isEmpty()) {
48
         if (infList.isEmpty()) {
49
             return "未查询到进项发票中间表中有效数据(dataStatus=0),无需导入";
49
             return "未查询到进项发票中间表中有效数据(dataStatus=0),无需导入";
55
         // 2. 遍历导入每条数据
55
         // 2. 遍历导入每条数据
56
         for (InfJinxiangfapiao inf : infList) {
56
         for (InfJinxiangfapiao inf : infList) {
57
             try {
57
             try {
58
-                PurchaseOrder purchaseOrder = purchaseorderMapper.selectByPurchaseContract(inf.getFno());
58
+                PurchaseOrder purchaseOrder = purchaseorderMapper.selectByPurchaseContract(inf.getPono());
59
                 Purchasecontract purchasecontract = purchasecontractMapper.selectByFno(inf.getFno());
59
                 Purchasecontract purchasecontract = purchasecontractMapper.selectByFno(inf.getFno());
60
 
60
 
61
 
61
 
136
 
136
 
137
                 // 更新中间表状态为已导入
137
                 // 更新中间表状态为已导入
138
                 //todo
138
                 //todo
139
-               // infJinxiangfapiaoMapper.updateStatusById(inf.getId());
139
+                infJinxiangfapiaoMapper.updateStatusById(inf.getId());
140
                 successCount++;
140
                 successCount++;
141
             } catch (Exception e) {
141
             } catch (Exception e) {
142
                 failCount++;
142
                 failCount++;

+ 2
- 2
src/main/java/com/example/backend/pAndSExe/service/impl/PayServiceImpl.java View File

47
         // 1. 查询inf_exe3中有效数据(dataStatus=0,校验通过的数据)
47
         // 1. 查询inf_exe3中有效数据(dataStatus=0,校验通过的数据)
48
         List<InfExe3> infExe3List = infExe3Mapper.selectValidData(); // 同Exe1:查询dataStatus=0的有效数据
48
         List<InfExe3> infExe3List = infExe3Mapper.selectValidData(); // 同Exe1:查询dataStatus=0的有效数据
49
         //todo
49
         //todo
50
-        infExe3List=infExe3Mapper.selectAllData();
50
+        //infExe3List=infExe3Mapper.selectAllData();
51
         if (infExe3List.isEmpty()) {
51
         if (infExe3List.isEmpty()) {
52
             return "未查询到inf_exe3中有效数据(dataStatus=0),无需导入";
52
             return "未查询到inf_exe3中有效数据(dataStatus=0),无需导入";
53
         }
53
         }
110
                 //paymgrctrlMapper.insertPaymgrctrl(ctrl);
110
                 //paymgrctrlMapper.insertPaymgrctrl(ctrl);
111
                 // 同Exe1:更新inf_exe3的状态(标记为已导入)
111
                 // 同Exe1:更新inf_exe3的状态(标记为已导入)
112
                 //todo 暂时取消状态修改
112
                 //todo 暂时取消状态修改
113
-                // infExe3Mapper.updateStatusById(exe3.getID());
113
+                 infExe3Mapper.updateStatusById(exe3.getID());
114
 
114
 
115
                 // ========== 第二步:插入子表paystockdtl ==========
115
                 // ========== 第二步:插入子表paystockdtl ==========
116
                 Paystockdtl dtl = new Paystockdtl();
116
                 Paystockdtl dtl = new Paystockdtl();

+ 5
- 5
src/main/java/com/example/backend/pAndSExe/service/impl/ShoukuanrenlingSettleServiceImpl.java View File

30
     private MdkcctrlMapper mdkcctrlMapper;
30
     private MdkcctrlMapper mdkcctrlMapper;
31
 
31
 
32
     @Autowired
32
     @Autowired
33
-    private SalesContractMapper salesContractMapper;
33
+    private SalesContractExeMapper salesContractExeMapper;
34
 
34
 
35
     @Autowired
35
     @Autowired
36
     private PaymgrctrlMapper paymgrctrlMapper;
36
     private PaymgrctrlMapper paymgrctrlMapper;
43
         // 1. 查询中间表有效数据(dataStatus=0)
43
         // 1. 查询中间表有效数据(dataStatus=0)
44
         List<InfShoukuanrenling> infList = infShoukuanrenlingMapper.selectValidData();
44
         List<InfShoukuanrenling> infList = infShoukuanrenlingMapper.selectValidData();
45
         //todo 临时替换为查询全部,后续可删除
45
         //todo 临时替换为查询全部,后续可删除
46
-        infList=infShoukuanrenlingMapper.selectAllData();
46
+        //infList=infShoukuanrenlingMapper.selectAllData();
47
         if (infList.isEmpty()) {
47
         if (infList.isEmpty()) {
48
             return "未查询到收款人认领中间表中有效数据(dataStatus=0),无需导入";
48
             return "未查询到收款人认领中间表中有效数据(dataStatus=0),无需导入";
49
         }
49
         }
54
         // 2. 遍历导入每条数据(主表+明细表联动插入)
54
         // 2. 遍历导入每条数据(主表+明细表联动插入)
55
         for (InfShoukuanrenling inf : infList) {
55
         for (InfShoukuanrenling inf : infList) {
56
             try {
56
             try {
57
-                SalesContract salesContract = salesContractMapper.selectByFno(inf.getSono());
57
+                SalesContract salesContract = salesContractExeMapper.selectByFno(inf.getSono());
58
 
58
 
59
 
59
 
60
                 // -------------------- 第一步:插入主表breceiptctrl --------------------
60
                 // -------------------- 第一步:插入主表breceiptctrl --------------------
82
                 breceiptctrl.setUpdateTime(new Date());
82
                 breceiptctrl.setUpdateTime(new Date());
83
                 breceiptctrl.setFours(salesContract.getFours());
83
                 breceiptctrl.setFours(salesContract.getFours());
84
                 breceiptctrl.setFoursname(salesContract.getFoursname());
84
                 breceiptctrl.setFoursname(salesContract.getFoursname());
85
-                String cpal=salesContractMapper.selectCpalByFours(salesContract.getFours());
85
+                String cpal= salesContractExeMapper.selectCpalByFours(salesContract.getFours());
86
                 breceiptctrl.setCpal(cpal);
86
                 breceiptctrl.setCpal(cpal);
87
                 breceiptctrl.setClaimerCd(inf.getCreateBy());
87
                 breceiptctrl.setClaimerCd(inf.getCreateBy());
88
                 breceiptctrl.setClaimerNm(s);
88
                 breceiptctrl.setClaimerNm(s);
121
 
121
 
122
                 // -------------------- 第三步:更新中间表状态为已导入 --------------------
122
                 // -------------------- 第三步:更新中间表状态为已导入 --------------------
123
                 //todo 后续启用:更新中间表状态
123
                 //todo 后续启用:更新中间表状态
124
-                //infShoukuanrenlingMapper.updateStatusById(inf.getId());
124
+                infShoukuanrenlingMapper.updateStatusById(inf.getId());
125
                 successCount++;
125
                 successCount++;
126
             } catch (Exception e) {
126
             } catch (Exception e) {
127
                 failCount++;
127
                 failCount++;

+ 3
- 2
src/main/java/com/example/backend/pAndSExe/service/impl/StockServiceImpl.java View File

45
         // 1. 查询inf_exe1中有效数据(dataStatus=0,校验通过的数据)
45
         // 1. 查询inf_exe1中有效数据(dataStatus=0,校验通过的数据)
46
         List<InfExe1> infExe1List = infExe1Mapper.selectValidData(); // 需补充该查询方法
46
         List<InfExe1> infExe1List = infExe1Mapper.selectValidData(); // 需补充该查询方法
47
         // todo 暂时发全部
47
         // todo 暂时发全部
48
-        infExe1List = infExe1Mapper.selectAllData(); // 需补充该查询方法
48
+        // infExe1List = infExe1Mapper.selectAllData(); // 需补充该查询方法
49
 
49
 
50
         if (infExe1List.isEmpty()) {
50
         if (infExe1List.isEmpty()) {
51
             return "未查询到inf_exe1中有效数据(dataStatus=0),无需导入";
51
             return "未查询到inf_exe1中有效数据(dataStatus=0),无需导入";
101
                         ctrl.setBizType(purchaseOrder.getBizType());
101
                         ctrl.setBizType(purchaseOrder.getBizType());
102
                         ctrl.setBizProductType(purchaseOrder.getBizProductType());
102
                         ctrl.setBizProductType(purchaseOrder.getBizProductType());
103
 
103
 
104
+
104
                     }
105
                     }
105
                 }else if (exe1.getFmodalid()==24){
106
                 }else if (exe1.getFmodalid()==24){
106
                      salesOrder = salesorderMapper.selectBySalesContract(exe1.getSfno());
107
                      salesOrder = salesorderMapper.selectBySalesContract(exe1.getSfno());
132
                 // 插入主表
133
                 // 插入主表
133
                 //mdkcctrlMapper.insertMdkcctrl(ctrl);
134
                 //mdkcctrlMapper.insertMdkcctrl(ctrl);
134
                 //todo 暂时不修改状态
135
                 //todo 暂时不修改状态
135
-                //infExe1Mapper.updateStatusById(exe1.getID());
136
+                infExe1Mapper.updateStatusById(exe1.getID());
136
 
137
 
137
                 // ========== 第二步:插入子表mdkcdtl ==========
138
                 // ========== 第二步:插入子表mdkcdtl ==========
138
                 Mdkcdtl dtl = new Mdkcdtl();
139
                 Mdkcdtl dtl = new Mdkcdtl();

+ 2
- 2
src/main/java/com/example/backend/pAndSExe/service/impl/XiaoshoujiesuankaipiaoSettleServiceImpl.java View File

45
         // 1. 查询中间表有效数据(dataStatus=0)
45
         // 1. 查询中间表有效数据(dataStatus=0)
46
         List<InfXiaoshoujiesuankaipiao> infList = infXiaoshoujiesuankaipiaoMapper.selectValidData();
46
         List<InfXiaoshoujiesuankaipiao> infList = infXiaoshoujiesuankaipiaoMapper.selectValidData();
47
         //todo
47
         //todo
48
-        infList=infXiaoshoujiesuankaipiaoMapper.selectAllData();
48
+        //infList=infXiaoshoujiesuankaipiaoMapper.selectAllData();
49
         if (infList.isEmpty()) {
49
         if (infList.isEmpty()) {
50
             return "未查询到销售结算开票中间表中有效数据(dataStatus=0),无需导入";
50
             return "未查询到销售结算开票中间表中有效数据(dataStatus=0),无需导入";
51
         }
51
         }
154
 
154
 
155
                 // -------------------- 第三步:更新中间表状态为已导入 --------------------
155
                 // -------------------- 第三步:更新中间表状态为已导入 --------------------
156
                 //todo
156
                 //todo
157
-                //infXiaoshoujiesuankaipiaoMapper.updateStatusById(inf.getId());
157
+                infXiaoshoujiesuankaipiaoMapper.updateStatusById(inf.getId());
158
                 successCount++;
158
                 successCount++;
159
             } catch (Exception e) {
159
             } catch (Exception e) {
160
                 failCount++;
160
                 failCount++;

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

275
 
275
 
276
         // 5. 业务字段赋值(适配新列)
276
         // 5. 业务字段赋值(适配新列)
277
         entity.setPfno(trimField(dto.getPfno()));
277
         entity.setPfno(trimField(dto.getPfno()));
278
+        if (dto.getStockname() != null&& !dto.getStockname().isEmpty()) {
278
         String s = trimField(dto.getStockname());
279
         String s = trimField(dto.getStockname());
279
-        String[] split = s.split("-");
280
+        if (s.contains("-")) {
280
 
281
 
281
-        entity.setStockname(split[1]);
282
-        entity.setStockcode(split[0]);
282
+            String[] split = s.split("-");
283
+
284
+            entity.setStockname(split[1]);
285
+            entity.setStockcode(split[0]);
286
+        }else entity.setStockname(s);
287
+        }
283
 
288
 
284
         if (dto.getCreateBy() ==null || dto.getCreateBy().isEmpty()){
289
         if (dto.getCreateBy() ==null || dto.getCreateBy().isEmpty()){
285
             String createBy=infExe1Mapper.selectCreateByFromPono(dto.getPfno());
290
             String createBy=infExe1Mapper.selectCreateByFromPono(dto.getPfno());
296
             SimpleDateFormat sdf = new SimpleDateFormat("yy");
301
             SimpleDateFormat sdf = new SimpleDateFormat("yy");
297
             String year = sdf.format(new Date());
302
             String year = sdf.format(new Date());
298
             StringBuilder sb = new StringBuilder();
303
             StringBuilder sb = new StringBuilder();
299
-            StringBuilder rukudanhao = sb.append("POIS").append(year).append(String.format(String.valueOf(id)));
304
+            StringBuilder rukudanhao = sb.append("POIS").append(year).append(String.format(String.valueOf(id))).append("QC");
300
             entity.setFno(rukudanhao.toString());
305
             entity.setFno(rukudanhao.toString());
301
             entity.setFphno(rukudanhao + "-01");
306
             entity.setFphno(rukudanhao + "-01");
302
         }else {
307
         }else {
309
         }
314
         }
310
         entity.setFmodalid(22);
315
         entity.setFmodalid(22);
311
         // 拆分itemno-sdesc-brand字段
316
         // 拆分itemno-sdesc-brand字段
312
-        String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
313
-        entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
314
-        entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
315
-        entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
317
+        if (dto.getItemnoSdescBrand() != null&& !dto.getItemnoSdescBrand().isEmpty()) {
318
+            String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
319
+            entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
320
+            entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
321
+            entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
322
+        }
316
 
323
 
317
         entity.setFtype3(trimField(dto.getFtype3()));
324
         entity.setFtype3(trimField(dto.getFtype3()));
318
         entity.setUt(trimField(dto.getUt()));
325
         entity.setUt(trimField(dto.getUt()));
417
 
424
 
418
         // 5. 业务字段赋值(替换pfno为sfno)
425
         // 5. 业务字段赋值(替换pfno为sfno)
419
         entity.setSfno(trimField(dto.getSfno())); // 销售合同号赋值
426
         entity.setSfno(trimField(dto.getSfno())); // 销售合同号赋值
427
+        if (dto.getStockname() != null&& !dto.getStockname().isEmpty()) {
420
         String s = trimField(dto.getStockname());
428
         String s = trimField(dto.getStockname());
421
-        String[] split = s.split("-");
429
+        if (s.contains("-")) {
430
+            String[] split = s.split("-");
422
 
431
 
423
-        entity.setStockname(split[1]);
424
-        entity.setStockcode(split[0]);
432
+            entity.setStockname(split[1]);
433
+            entity.setStockcode(split[0]);
434
+        }else entity.setStockname(s);
435
+        }
425
 
436
 
426
         // 6. 流水号生成逻辑
437
         // 6. 流水号生成逻辑
427
         int danhaochongfu = infExe1Mapper.selectFnoBySfnoCount(dto.getSfno());
438
         int danhaochongfu = infExe1Mapper.selectFnoBySfnoCount(dto.getSfno());
433
             SimpleDateFormat sdf = new SimpleDateFormat("yy");
444
             SimpleDateFormat sdf = new SimpleDateFormat("yy");
434
             String year = sdf.format(new Date());
445
             String year = sdf.format(new Date());
435
             StringBuilder sb = new StringBuilder();
446
             StringBuilder sb = new StringBuilder();
436
-            StringBuilder rukudanhao = sb.append("POIS").append(year).append(String.format(String.valueOf(id)));
447
+            StringBuilder rukudanhao = sb.append("SOOS").append(year).append(String.format(String.valueOf(id))).append("QC");
437
             entity.setFno(rukudanhao.toString());
448
             entity.setFno(rukudanhao.toString());
438
             entity.setFphno(rukudanhao + "-01");
449
             entity.setFphno(rukudanhao + "-01");
439
         } else {
450
         } else {
447
         entity.setFmodalid(24); //
458
         entity.setFmodalid(24); //
448
 
459
 
449
         // 7. 拆分itemno-sdesc-brand字段(与InfExe1一致)
460
         // 7. 拆分itemno-sdesc-brand字段(与InfExe1一致)
450
-        String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
451
-        entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
452
-        entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
453
-        entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
461
+        if (dto.getItemnoSdescBrand() != null&& !dto.getItemnoSdescBrand().isEmpty()) {
462
+            String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
463
+            entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
464
+            entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
465
+            entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
466
+        }
454
 
467
 
455
         // 8. 其余字段赋值(与InfExe1完全一致)
468
         // 8. 其余字段赋值(与InfExe1完全一致)
456
         entity.setFtype3(trimField(dto.getFtype3()));
469
         entity.setFtype3(trimField(dto.getFtype3()));
538
         // 5. 业务字段赋值(补充trim处理+数值转换,和Sheet1一致)
551
         // 5. 业务字段赋值(补充trim处理+数值转换,和Sheet1一致)
539
         entity.setPfno(trimField(dto.getPfno()));
552
         entity.setPfno(trimField(dto.getPfno()));
540
         // 拆分收款/受益人信息(复用Sheet1的拆分方法)
553
         // 拆分收款/受益人信息(复用Sheet1的拆分方法)
541
-        String[] payFields = splitCombinedField(dto.getCombinedPaymentInfo());
542
-        entity.setSupName(payFields.length >= 1 ? payFields[0].trim() : null);
543
-        entity.setSupBank(payFields.length >= 2 ? payFields[1].trim() : null);
544
-        entity.setIssuingBankAcc(payFields.length >= 3 ? payFields[2].trim() : null);
554
+        if (dto.getCombinedPaymentInfo() != null&& !dto.getCombinedPaymentInfo().isEmpty()) {
555
+            String[] payFields = splitCombinedField(dto.getCombinedPaymentInfo());
556
+            entity.setSupName(payFields.length >= 1 ? payFields[0].trim() : null);
557
+            entity.setSupBank(payFields.length >= 2 ? payFields[1].trim() : null);
558
+            entity.setIssuingBankAcc(payFields.length >= 3 ? payFields[2].trim() : null);
559
+        }
545
         entity.setPayType(trimField(dto.getPayType()));
560
         entity.setPayType(trimField(dto.getPayType()));
546
         entity.setPayment(trimField(dto.getPayment()));
561
         entity.setPayment(trimField(dto.getPayment()));
547
         // 申请金额:数值转换(保留2位小数,和Sheet1的金额字段一致)
562
         // 申请金额:数值转换(保留2位小数,和Sheet1的金额字段一致)
656
 
671
 
657
 
672
 
658
         // 拆分收款人组合信息(复用Sheet1/Exe3的拆分方法,按英文逗号","拆分)
673
         // 拆分收款人组合信息(复用Sheet1/Exe3的拆分方法,按英文逗号","拆分)
659
-        String[] suppFields = splitCombinedField(dto.getCombinedSuppInfo());
660
-        entity.setSuppName(suppFields.length >= 1 ? suppFields[0].trim() : null); // 收款人名称
661
-        entity.setSuppBank(suppFields.length >= 2 ? suppFields[1].trim() : null); // 收款人银行
662
-        entity.setSuppAcc(suppFields.length >= 3 ? suppFields[2].trim() : null);   // 银行账号
674
+        if (dto.getCombinedSuppInfo() != null&& !dto.getCombinedSuppInfo().isEmpty()) {
675
+            String[] suppFields = splitCombinedField(dto.getCombinedSuppInfo());
676
+            entity.setSuppName(suppFields.length >= 1 ? suppFields[0].trim() : null); // 收款人名称
677
+            entity.setSuppBank(suppFields.length >= 2 ? suppFields[1].trim() : null); // 收款人银行
678
+            entity.setSuppAcc(suppFields.length >= 3 ? suppFields[2].trim() : null);   // 银行账号
679
+        }
663
 
680
 
664
         entity.setPayment(trimField(dto.getPayment()));       // 付款方式
681
         entity.setPayment(trimField(dto.getPayment()));       // 付款方式
665
         entity.setFeeNm(trimField(dto.getFeeNm()));           // 费用名称
682
         entity.setFeeNm(trimField(dto.getFeeNm()));           // 费用名称
870
         }
887
         }
871
 
888
 
872
         // 3. 税额逻辑校验(税额=不含税金额*税率,误差校验)
889
         // 3. 税额逻辑校验(税额=不含税金额*税率,误差校验)
873
-        if (dto.getNtPoAmt() != null && dto.getInTaxRate() != null && dto.getTaxAmt() != null) {
890
+       /* if (dto.getNtPoAmt() != null && dto.getInTaxRate() != null && dto.getTaxAmt() != null) {
874
             BigDecimal calcTaxAmt = parseBigDecimal(dto.getNtPoAmt(), 6)
891
             BigDecimal calcTaxAmt = parseBigDecimal(dto.getNtPoAmt(), 6)
875
-                    .multiply(parseBigDecimal(dto.getInTaxRate(), 6))
892
+                    .multiply(parseBigDecimal(dto.getInTaxRate(), 6)).multiply(new BigDecimal("0.01"))
876
                     .setScale(6, RoundingMode.HALF_UP);
893
                     .setScale(6, RoundingMode.HALF_UP);
877
             BigDecimal inputTaxAmt = parseBigDecimal(dto.getTaxAmt(), 6);
894
             BigDecimal inputTaxAmt = parseBigDecimal(dto.getTaxAmt(), 6);
878
             if (calcTaxAmt.compareTo(inputTaxAmt) != 0) {
895
             if (calcTaxAmt.compareTo(inputTaxAmt) != 0) {
879
                 errorLogList.add("税额校验失败:不含税金额【" + dto.getNtPoAmt() + "】*税率【" + dto.getInTaxRate() + "】=" + calcTaxAmt + ",与录入税额【" + dto.getTaxAmt() + "】不一致");
896
                 errorLogList.add("税额校验失败:不含税金额【" + dto.getNtPoAmt() + "】*税率【" + dto.getInTaxRate() + "】=" + calcTaxAmt + ",与录入税额【" + dto.getTaxAmt() + "】不一致");
880
             }
897
             }
881
-        }
898
+        }*/
882
 
899
 
883
         // 4. 构建errorLog字符串(多错误用分号分隔)
900
         // 4. 构建errorLog字符串(多错误用分号分隔)
884
         String errorLog = errorLogList.isEmpty() ? "" : String.join(";", errorLogList);
901
         String errorLog = errorLogList.isEmpty() ? "" : String.join(";", errorLogList);
902
         entity.setTaxInvNo(trimField(dto.getTaxInvNo())); // 发票号码
919
         entity.setTaxInvNo(trimField(dto.getTaxInvNo())); // 发票号码
903
 
920
 
904
         // 拆分物料编码+物料描述+品牌组合字段
921
         // 拆分物料编码+物料描述+品牌组合字段
905
-        String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
906
-        entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
907
-        entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
908
-        entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
922
+        if (dto.getItemnoSdescBrand() != null&& !dto.getItemnoSdescBrand().isEmpty()) {
923
+            String[] itemFields = splitCombinedField(dto.getItemnoSdescBrand());
924
+            entity.setItemno(itemFields.length >= 1 ? itemFields[0].trim() : null);
925
+            entity.setSdesc(itemFields.length >= 2 ? itemFields[1].trim() : null);
926
+            entity.setBrand(itemFields.length >= 3 ? itemFields[2].trim() : null);
927
+        }
909
 
928
 
910
         // 数值字段转换(DECIMAL(18,6))
929
         // 数值字段转换(DECIMAL(18,6))
911
         entity.setQty(parseBigDecimal(dto.getQty(), 6)); // 数量
930
         entity.setQty(parseBigDecimal(dto.getQty(), 6)); // 数量
1008
         entity.setAmount(parseBigDecimal(dto.getAmount(), 6)); // 保留6位小数
1027
         entity.setAmount(parseBigDecimal(dto.getAmount(), 6)); // 保留6位小数
1009
 
1028
 
1010
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
1029
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
1011
-        Date fkdate = Date.from(LocalDate.parse(dto.getFkdate(), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1012
-        Date fdate = Date.from(LocalDate.parse(dto.getFdate(), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1013
-        Date yjfkdate = Date.from(LocalDate.parse(dto.getYjfkdate(), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1014
-        entity.setFkdate(fkdate);
1015
-        entity.setFdate(fdate);
1016
-        entity.setYjfkdate(yjfkdate);
1030
+// 替换分隔符后解析(-、空格 转 /)
1031
+        if (dto.getFkdate()!=null&&!dto.getFkdate().isEmpty()) {
1032
+            Date fkdate = Date.from(LocalDate.parse(dto.getFkdate().trim().replace("-", "/").replace(" ", "/"), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1033
+            entity.setFkdate(fkdate);
1034
+        }
1035
+        if (dto.getFdate()!=null&&!dto.getFdate().isEmpty()) {
1036
+            Date fdate = Date.from(LocalDate.parse(dto.getFdate().trim().replace("-", "/").replace(" ", "/"), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1037
+            entity.setFdate(fdate);
1038
+        }
1039
+        if (dto.getYjfkdate()!=null&&!dto.getYjfkdate().isEmpty()) {
1040
+            Date yjfkdate = Date.from(LocalDate.parse(dto.getYjfkdate().trim().replace("-", "/").replace(" ", "/"), formatter).atStartOfDay(ZoneId.systemDefault()).toInstant());
1041
+            entity.setYjfkdate(yjfkdate);
1042
+        }
1043
+
1017
 
1044
 
1018
         // 6. 生成流水号(前缀LC+年月+6位自增ID)
1045
         // 6. 生成流水号(前缀LC+年月+6位自增ID)
1019
         InfExe1Amount infExe1Amount = new InfExe1Amount();
1046
         InfExe1Amount infExe1Amount = new InfExe1Amount();
1055
             errorLogList.add("客户编号+名称为空");
1082
             errorLogList.add("客户编号+名称为空");
1056
         } else {
1083
         } else {
1057
             // 拆分规则:按第一个空格/逗号拆分,左侧为编号,右侧为名称
1084
             // 拆分规则:按第一个空格/逗号拆分,左侧为编号,右侧为名称
1085
+
1058
             String[] ctArr = ctNoCtName.split("[,\\s]+", 2);
1086
             String[] ctArr = ctNoCtName.split("[,\\s]+", 2);
1059
             if (ctArr.length >= 1) {
1087
             if (ctArr.length >= 1) {
1060
                 ctNo = ctArr[0];
1088
                 ctNo = ctArr[0];
1167
             errorLogList.add("客户信息(名称+银行+账号+合同名)为空");
1195
             errorLogList.add("客户信息(名称+银行+账号+合同名)为空");
1168
         } else {
1196
         } else {
1169
             // 拆分规则:按【|】分隔(优先),无则按【;】,最后按【,】/空格,最多拆4段
1197
             // 拆分规则:按【|】分隔(优先),无则按【;】,最后按【,】/空格,最多拆4段
1198
+
1170
             String[] ctArr = ctInfo.split("[,|;,\\s]+", 4);
1199
             String[] ctArr = ctInfo.split("[,|;,\\s]+", 4);
1171
             if (ctArr.length >= 1) ctName = ctArr[0];
1200
             if (ctArr.length >= 1) ctName = ctArr[0];
1172
             if (ctArr.length >= 2) ctInvoiceBankName = ctArr[1];
1201
             if (ctArr.length >= 2) ctInvoiceBankName = ctArr[1];

Loading…
Cancel
Save