Преглед на файлове

1 修改客商判断逻辑

11816 преди 17 часа
родител
ревизия
b986e25f84

+ 153
- 22
src/main/java/com/example/backend/pAndSExe/controller/PsExeController.java Целия файл

@@ -16,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
16 16
 @RestController
17 17
 @RequestMapping("/pAndSExe")
18 18
 @CrossOrigin(
19
-        originPatterns = "*",  // 替换 origins → originPatterns
19
+        originPatterns = "*",
20 20
         allowCredentials = "true",
21 21
         maxAge = 3600
22 22
 )
@@ -46,8 +46,8 @@ public class PsExeController {
46 46
     private DaodandengjiSettleService daodandengjiSettleService;
47 47
 
48 48
     @Autowired
49
-
50 49
     private ShoukuanrenlingSettleService shoukuanrenlingSettleService;
50
+
51 51
     @Autowired
52 52
     private XiaoshoujiesuankaipiaoSettleService xiaoshoujiesuankaipiaoSettleService;
53 53
 
@@ -55,40 +55,171 @@ public class PsExeController {
55 55
     private DailijiesuanSettleService dailijiesuanSettleService;
56 56
 
57 57
     /**
58
-     * 导入采、销执行表Excel文件
58
+     * 1. 导入采、销执行表Excel文件(单独)
59 59
      */
60
-    @PostMapping("/import")
61
-    public ResponseEntity<ExcelImportResult<Void>> importExcel(@RequestParam("file") MultipartFile file) {
60
+    @PostMapping("/importPsExe")
61
+    public ResponseEntity<ExcelImportResult<Void>> importPsExeExcel(@RequestParam("file") MultipartFile file) {
62 62
         logger.info("收到采、销执行表导入请求,文件名: {}", file.getOriginalFilename());
63 63
         return psExeService.importExcel(file);
64 64
     }
65 65
 
66 66
     /**
67
-     * :导入库存业务Excel文件
67
+     * 2. 导入所有业务(批量)
68
+     */
69
+    @PostMapping("/importAll")
70
+    public Result<String> importAllBusinessExcel(@RequestParam("file") MultipartFile file) {
71
+        logger.info("收到所有业务批量导入请求,文件名: {}", file.getOriginalFilename());
72
+        StringBuilder resultMsg = new StringBuilder();
73
+        try {
74
+            // 依次调用所有业务导入方法,汇总结果
75
+            resultMsg.append("库存业务:").append(stockService.importInfExe1ToMdkc()).append(";");
76
+            resultMsg.append("货款付款业务:").append(payService.importInfExe3ToPay()).append(";");
77
+            resultMsg.append("费用付款业务:").append(feePayService.importInfFeiyongfukuanToPay()).append(";");
78
+            resultMsg.append("费用发票结算业务:").append(feeInvoiceSettleService.importInfToSettle()).append(";");
79
+            resultMsg.append("进项发票结算业务:").append(jinxiangInvoiceSettleService.importJinxiangInfToSettle()).append(";");
80
+            resultMsg.append("到单登记:").append(daodandengjiSettleService.importDaodandengjiInfToSettle()).append(";");
81
+            resultMsg.append("收款认领结算业务:").append(shoukuanrenlingSettleService.importShoukuanrenlingInfToSettle()).append(";");
82
+            resultMsg.append("销售结算开票业务:").append(xiaoshoujiesuankaipiaoSettleService.importXiaoshoujiesuankaipiaoInfToSettle()).append(";");
83
+            resultMsg.append("代理结算业务:").append(dailijiesuanSettleService.importDailijiesuanInfToSettle()).append(";");
84
+            return Result.success(resultMsg.toString(), "所有业务批量导入成功");
85
+        } catch (Exception e) {
86
+            logger.error("所有业务批量导入失败", e);
87
+            return Result.fail("所有业务批量导入失败:" + e.getMessage() + ",已执行部分:" + resultMsg);
88
+        }
89
+    }
90
+
91
+    /**
92
+     * 3. 导入库存业务(单独)
68 93
      */
69 94
     @PostMapping("/importStock")
70
-    // 返回Result<String> 而非String
71 95
     public Result<String> importStockExcel(@RequestParam("file") MultipartFile file) {
72 96
         logger.info("收到库存业务导入请求,文件名: {}", file.getOriginalFilename());
73 97
         try {
74
-            // 调用服务方法,获取导入结果
75
-           String resultMsg = stockService.importInfExe1ToMdkc();
76
-           String s = payService.importInfExe3ToPay();
77
-           String s1 = feePayService.importInfFeiyongfukuanToPay();
78
-           String s2 = feeInvoiceSettleService.importInfToSettle();
79
-            String s3 = jinxiangInvoiceSettleService.importJinxiangInfToSettle();
80
-           // String s4 = daodandengjiSettleService.importDaodandengjiInfToSettle();
81
-           // String s5 = shoukuanrenlingSettleService.importShoukuanrenlingInfToSettle();
82
-           // String s6 = xiaoshoujiesuankaipiaoSettleService.importXiaoshoujiesuankaipiaoInfToSettle();
83
-           // String s7 = dailijiesuanSettleService.importDailijiesuanInfToSettle();
84
-
85
-
86
-            // 返回成功JSON
87
-            return Result.success(resultMsg+s+s1+s2+s3/*+s4+s5+s6+s7*/, "所有业务导入");
98
+            String resultMsg = stockService.importInfExe1ToMdkc();
99
+            return Result.success(resultMsg, "库存业务导入成功");
88 100
         } catch (Exception e) {
89 101
             logger.error("库存业务导入失败", e);
90
-            // 返回失败JSON
91 102
             return Result.fail("库存业务导入失败:" + e.getMessage());
92 103
         }
93 104
     }
105
+
106
+    /**
107
+     * 4. 导入货款付款业务(单独)
108
+     */
109
+    @PostMapping("/importPay")
110
+    public Result<String> importPayExcel(@RequestParam("file") MultipartFile file) {
111
+        logger.info("收到货款付款业务导入请求,文件名: {}", file.getOriginalFilename());
112
+        try {
113
+            String resultMsg = payService.importInfExe3ToPay();
114
+            return Result.success(resultMsg, "货款付款业务导入成功");
115
+        } catch (Exception e) {
116
+            logger.error("货款付款业务导入失败", e);
117
+            return Result.fail("货款付款业务导入失败:" + e.getMessage());
118
+        }
119
+    }
120
+
121
+    /**
122
+     * 5. 导入费用付款业务(单独)
123
+     */
124
+    @PostMapping("/importFeePay")
125
+    public Result<String> importFeePayExcel(@RequestParam("file") MultipartFile file) {
126
+        logger.info("收到费用付款业务导入请求,文件名: {}", file.getOriginalFilename());
127
+        try {
128
+            String resultMsg = feePayService.importInfFeiyongfukuanToPay();
129
+            return Result.success(resultMsg, "费用付款业务导入成功");
130
+        } catch (Exception e) {
131
+            logger.error("费用付款业务导入失败", e);
132
+            return Result.fail("费用付款业务导入失败:" + e.getMessage());
133
+        }
134
+    }
135
+
136
+    /**
137
+     * 6. 导入费用发票结算业务(单独)
138
+     */
139
+    @PostMapping("/importFeeInvoice")
140
+    public Result<String> importFeeInvoiceExcel(@RequestParam("file") MultipartFile file) {
141
+        logger.info("收到费用发票结算业务导入请求,文件名: {}", file.getOriginalFilename());
142
+        try {
143
+            String resultMsg = feeInvoiceSettleService.importInfToSettle();
144
+            return Result.success(resultMsg, "费用发票结算业务导入成功");
145
+        } catch (Exception e) {
146
+            logger.error("费用发票结算业务导入失败", e);
147
+            return Result.fail("费用发票结算业务导入失败:" + e.getMessage());
148
+        }
149
+    }
150
+
151
+    /**
152
+     * 7. 导入进项发票结算业务(单独)
153
+     */
154
+    @PostMapping("/importJinxiangInvoice")
155
+    public Result<String> importJinxiangInvoiceExcel(@RequestParam("file") MultipartFile file) {
156
+        logger.info("收到进项发票结算业务导入请求,文件名: {}", file.getOriginalFilename());
157
+        try {
158
+            String resultMsg = jinxiangInvoiceSettleService.importJinxiangInfToSettle();
159
+            return Result.success(resultMsg, "进项发票结算业务导入成功");
160
+        } catch (Exception e) {
161
+            logger.error("进项发票结算业务导入失败", e);
162
+            return Result.fail("进项发票结算业务导入失败:" + e.getMessage());
163
+        }
164
+    }
165
+
166
+    /**
167
+     * 8. 导入到单登记(单独)
168
+     */
169
+    @PostMapping("/importDaodandengji")
170
+    public Result<String> importDaodandengjiExcel(@RequestParam("file") MultipartFile file) {
171
+        logger.info("收到到单登记导入请求,文件名: {}", file.getOriginalFilename());
172
+        try {
173
+            String resultMsg = daodandengjiSettleService.importDaodandengjiInfToSettle();
174
+            return Result.success(resultMsg, "到单登记导入成功");
175
+        } catch (Exception e) {
176
+            logger.error("到单登记导入失败", e);
177
+            return Result.fail("到单登记导入失败:" + e.getMessage());
178
+        }
179
+    }
180
+
181
+    /**
182
+     * 9. 导入收款认领结算业务(单独)
183
+     */
184
+    @PostMapping("/importShoukuanrenling")
185
+    public Result<String> importShoukuanrenlingExcel(@RequestParam("file") MultipartFile file) {
186
+        logger.info("收到收款认领结算业务导入请求,文件名: {}", file.getOriginalFilename());
187
+        try {
188
+            String resultMsg = shoukuanrenlingSettleService.importShoukuanrenlingInfToSettle();
189
+            return Result.success(resultMsg, "收款认领结算业务导入成功");
190
+        } catch (Exception e) {
191
+            logger.error("收款认领结算业务导入失败", e);
192
+            return Result.fail("收款认领结算业务导入失败:" + e.getMessage());
193
+        }
194
+    }
195
+
196
+    /**
197
+     * 10. 导入销售结算开票业务(单独)
198
+     */
199
+    @PostMapping("/importXiaoshoujiesuan")
200
+    public Result<String> importXiaoshoujiesuanExcel(@RequestParam("file") MultipartFile file) {
201
+        logger.info("收到销售结算开票业务导入请求,文件名: {}", file.getOriginalFilename());
202
+        try {
203
+            String resultMsg = xiaoshoujiesuankaipiaoSettleService.importXiaoshoujiesuankaipiaoInfToSettle();
204
+            return Result.success(resultMsg, "销售结算开票业务导入成功");
205
+        } catch (Exception e) {
206
+            logger.error("销售结算开票业务导入失败", e);
207
+            return Result.fail("销售结算开票业务导入失败:" + e.getMessage());
208
+        }
209
+    }
210
+
211
+    /**
212
+     * 11. 导入代理结算业务(单独)
213
+     */
214
+    @PostMapping("/importDailijiesuan")
215
+    public Result<String> importDailijiesuanExcel(@RequestParam("file") MultipartFile file) {
216
+        logger.info("收到代理结算业务导入请求,文件名: {}", file.getOriginalFilename());
217
+        try {
218
+            String resultMsg = dailijiesuanSettleService.importDailijiesuanInfToSettle();
219
+            return Result.success(resultMsg, "代理结算业务导入成功");
220
+        } catch (Exception e) {
221
+            logger.error("代理结算业务导入失败", e);
222
+            return Result.fail("代理结算业务导入失败:" + e.getMessage());
223
+        }
224
+    }
94 225
 }

+ 0
- 2
src/main/java/com/example/backend/pAndSExe/mapper/GongyingshangMapper.java Целия файл

@@ -32,7 +32,6 @@ public interface GongyingshangMapper  extends BaseMapper<Gongyingshang> {
32 32
             "        ) b ON a.id = b.rid AND b.row_num = 1\n" +
33 33
             "        left join SGGMIIP.custattn c on a.id = c.rid\n" +
34 34
             "        where ifnull(a.del_flag, 0) != 1\n" +
35
-            "        and INSTR(ctNature, '供应商') > 0\n" +
36 35
             "        and nvl(ctStatus,'')='已准入'\n" +
37 36
             "        and a.ctCnNm = #{ctName}\n" +
38 37
             "        order by a.fno\n" +
@@ -63,7 +62,6 @@ public interface GongyingshangMapper  extends BaseMapper<Gongyingshang> {
63 62
             "        ) b ON a.id = b.rid AND b.row_num = 1\n" +
64 63
             "        left join SGGMIIP.custattn c on a.id = c.rid\n" +
65 64
             "        where ifnull(a.del_flag, 0) != 1\n" +
66
-            "        and INSTR(ctNature, '供应商') > 0\n" +
67 65
             "        and nvl(ctStatus,'')='已准入'\n" +
68 66
             "        and a.fno=#{fno}\n" +
69 67
             "        order by a.fno\n" +

Loading…
Отказ
Запис