2 Révisions

Auteur SHA1 Message Date
  胡北宽 4a1e50a5b7 1 il y a 3 mois
  胡北宽 93d9b04520 1 il y a 3 mois

+ 13
- 0
src/main/java/com/example/backend/entity/common/CustCtrl.java Voir le fichier

@@ -488,6 +488,19 @@ public class CustCtrl {
488 488
     @TableField(exist = false)
489 489
     private String allocationCategory;
490 490
 
491
+    //国家
492
+    @TableField(exist = false)
493
+    private String countryCnNm;
494
+
495
+    //签约地
496
+    @TableField(exist = false)
497
+    private String signLoc;
498
+
499
+    //签约地
500
+    @TableField(exist = false)
501
+    private String cpal;
502
+
503
+
491 504
 
492 505
 
493 506
 

+ 27
- 0
src/main/java/com/example/backend/entity/common/SysUser.java Voir le fichier

@@ -270,11 +270,38 @@ public class SysUser {
270 270
     @TableField(exist = false)
271 271
     private BigDecimal rateUs;
272 272
 
273
+    @TableField(exist = false)
274
+    private BigDecimal rateUsd;
275
+
273 276
     //制单人部门编码
277
+
274 278
     @TableField(exist = false)
275 279
     private String deptCode;
276 280
 
277 281
 
282
+    @TableField(exist = false)
283
+    private String cpny;
284
+
285
+    @TableField(exist = false)
286
+    private String fourscode;
287
+
288
+//    @TableField(value="deptcode",exist = false)
289
+//    private String deptcode;
290
+
291
+    @TableField(exist = false)
292
+    private String fours;
293
+
294
+    @TableField(exist = false)
295
+    private String deptname;
296
+
297
+    @TableField(exist = false)
298
+    private String ctrylmbAddr;
299
+
300
+
301
+
302
+
303
+
304
+
278 305
 
279 306
 
280 307
 

+ 1
- 1
src/main/java/com/example/backend/excel/SalesCollectExcelDTO.java Voir le fichier

@@ -23,7 +23,7 @@ public class SalesCollectExcelDTO {
23 23
     @ExcelProperty("账期(天)")
24 24
     private Integer payDays;
25 25
 
26
-    @ExcelProperty("款方式")
26
+    @ExcelProperty("款方式")
27 27
     private String payMode;
28 28
 
29 29
 

+ 2
- 2
src/main/java/com/example/backend/excel/SalesContractExcelDTO.java Voir le fichier

@@ -50,7 +50,7 @@ public class SalesContractExcelDTO {
50 50
     @ExcelProperty("币别")
51 51
     private String curcy;
52 52
 
53
-    @ExcelProperty("最迟装运日期")
53
+    @ExcelProperty("最迟装运时间")
54 54
     private Date estLoadDt;
55 55
 
56 56
     @ExcelProperty("价格条款")
@@ -59,7 +59,7 @@ public class SalesContractExcelDTO {
59 59
     @ExcelProperty("运输方式")
60 60
     private String tranWay;
61 61
 
62
-    @ExcelProperty("预计客商占天数")
62
+    @ExcelProperty("预计客商占天数")
63 63
     private Integer outstandingDay;
64 64
 
65 65
 

+ 5
- 5
src/main/java/com/example/backend/mapper/contract/SysUserMapper.java Voir le fichier

@@ -14,11 +14,11 @@ import java.util.List;
14 14
 @Mapper
15 15
 public interface SysUserMapper extends BaseMapper<SysUser> {
16 16
     @Select("select\n" +
17
-            "       b.user_code,b.user_name,b.user_desc\n" +
18
-            "from SGGMIIP.View_Dept_Code a\n" +
19
-            "         left join SGGMIIP.View_User_Code b on a.deptid = b.dept_id\n" +
20
-            "         left join SGGMIIP.addrctrl c on a.fourscode = c.hrDeptCode\n" +
21
-            "where b.user_code =#{userCode}")
17
+            "    b.user_auto_id as id ,\n" +
18
+            "    c.fno,c.cpny,a.deptcode as deptCode,a.*,b.* from SGGMIIP.View_Dept_Code a\n" +
19
+            "    left join SGGMIIP.View_User_Code b on a.deptid=b.dept_id\n" +
20
+            "     left join SGGMIIP.addrctrl  c on a.fourscode=c.hrDeptCode\n" +
21
+            "where b.user_code = #{userCode}")
22 22
     List<SysUser> selectContractByNo(@Param("userCode") String userCode);
23 23
 
24 24
 

+ 126
- 67
src/main/java/com/example/backend/service/contract/impl/SalesContractServiceImpl.java Voir le fichier

@@ -167,10 +167,37 @@ public class SalesContractServiceImpl implements SalesContractService {
167 167
                         currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:合同执行人代码有误!");
168 168
                         currentContractValid = false;
169 169
                     }
170
+
170 171
                     if (contractUserList != null && !contractUserList.isEmpty() && !contractUserList.get(0).getUserDesc().isEmpty()) {
171 172
                         entity.setContrExecNm(contractUserList.get(0).getUserDesc());
172 173
                     }
173 174
 
175
+                    if (contractUserList != null && !contractUserList.isEmpty() && !contractUserList.get(0).getDeptId().isEmpty()) {
176
+                        entity.setDeptId(contractUserList.get(0).getDeptId());
177
+                    }
178
+
179
+
180
+
181
+                    if (contractUserList != null && !contractUserList.isEmpty() && !contractUserList.get(0).getFno().isEmpty()) {
182
+                        entity.setFno(contractUserList.get(0).getFno());
183
+                    }
184
+
185
+                    if (contractUserList != null && !contractUserList.isEmpty() && !contractUserList.get(0).getFourscode().isEmpty()) {
186
+                        entity.setContrExecCdInstitutionId(contractUserList.get(0).getFourscode());
187
+                    }
188
+
189
+                    if (contractUserList != null && !contractUserList.isEmpty() && !contractUserList.get(0).getCpny().isEmpty()) {
190
+                        entity.setContrExecCdInstitutionNm(contractUserList.get(0).getCpny());
191
+                    }
192
+
193
+                    if (contractUserList != null && !contractUserList.isEmpty() && !StringUtils.isEmpty(contractUserList.get(0).getDeptCode())) {
194
+                        entity.setContrExecCdDeptId(contractUserList.get(0).getDeptCode());
195
+                    }
196
+
197
+                    if (contractUserList != null && !contractUserList.isEmpty() && !StringUtils.isEmpty(contractUserList.get(0).getDeptName())) {
198
+                        entity.setContrExecCdDeptNm(contractUserList.get(0).getDeptName());
199
+                    }
200
+
174 201
                     if (StringUtils.isEmpty(entity.getCtName())) {
175 202
                         currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:客户名称不能为空!");
176 203
                         currentContractValid = false;
@@ -202,10 +229,20 @@ public class SalesContractServiceImpl implements SalesContractService {
202 229
                         currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:客户代码不能为空!");
203 230
                         currentContractValid = false;
204 231
                     }
232
+
233
+
234
+
235
+
236
+
205 237
                     if (ctNameList != null && !ctNameList.isEmpty() && !ctNameList.get(0).getFno().isEmpty()) {
206 238
                         entity.setCtNo(ctNameList.get(0).getFno());
207 239
                     }
208 240
 
241
+
242
+                    if (ctNameList != null && !ctNameList.isEmpty() && !ctNameList.get(0).getCtrylmbAddr().isEmpty()) {
243
+                        entity.setTrdCtry(ctNameList.get(0).getCtrylmbAddr());
244
+                    }
245
+
209 246
                     if (ctNameList != null && !ctNameList.isEmpty() && !ctNameList.get(0).getCtContNm().isEmpty()) {
210 247
                         entity.setCtContNm(ctNameList.get(0).getCtContNm());
211 248
                     }
@@ -217,10 +254,14 @@ public class SalesContractServiceImpl implements SalesContractService {
217 254
                         entity.setCtBankAcct(ctNameList.get(0).getCtBankAcct());
218 255
                     }
219 256
 
257
+
220 258
                     if (StringUtils.isEmpty(entity.getCurcy())) {
221 259
                         currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:币别不能为空!");
222 260
                         currentContractValid = false;
223 261
                     }
262
+                    if (!StringUtils.isEmpty(entity.getCurcy())) {
263
+                        entity.setCurcy(entity.getCurcy().split("-")[0]);
264
+                    }
224 265
 
225 266
                     List<SysUser> curcyList = sysUserMapper.selectByCurcy(entity.getCurcy());
226 267
                     if (curcyList == null || curcyList.isEmpty()) {
@@ -243,6 +284,10 @@ public class SalesContractServiceImpl implements SalesContractService {
243 284
                         entity.setRateUs(curcyList.get(0).getRateUs());
244 285
                     }
245 286
 
287
+                    if (curcyList != null && !curcyList.isEmpty() && !Objects.isNull(curcyList.get(0).getRateUsd())) {
288
+                        entity.setRateUsd(curcyList.get(0).getRateUsd());
289
+                    }
290
+
246 291
                     if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
247 292
                         if (entity.getEstLoadDt() == null) {
248 293
                             currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:合同类型为出口销售或转口销售时,最迟装运日期不能为空!");
@@ -279,13 +324,44 @@ public class SalesContractServiceImpl implements SalesContractService {
279 324
                         entity.setOurBankNm(foursnameList.get(0).getOurBankNm());
280 325
                     }
281 326
 
327
+                    if (foursnameList != null && !foursnameList.isEmpty() && !foursnameList.get(0).getOurBankNm().isEmpty()) {
328
+                        entity.setOurBankNm(foursnameList.get(0).getOurBankNm());
329
+                    }
330
+
282 331
                     if (foursnameList != null && !foursnameList.isEmpty() && !foursnameList.get(0).getOurBankAcct().isEmpty()) {
283 332
                         entity.setOurBankAcct(foursnameList.get(0).getOurBankAcct());
284 333
                     }
285 334
 
335
+                    if (foursnameList != null && !foursnameList.isEmpty() && !foursnameList.get(0).getSignLoc().isEmpty()) {
336
+                        entity.setSignLoc(foursnameList.get(0).getSignLoc());
337
+                    }
338
+
339
+
340
+
341
+                    if (StringUtils.isEmpty(entity.getIfClearBottom())) {
342
+                        entity.setIfClearBottom("否");
343
+                    }
344
+
345
+
346
+                    // 设置默认值
347
+                    if (StringUtils.isEmpty(entity.getWhetherChartering())) {
348
+                        entity.setWhetherChartering("否");
349
+                    }
350
+                    if (StringUtils.isEmpty(entity.getIfLongTerm())) {
351
+                        entity.setIfLongTerm("否");
352
+                    }
286 353
                     if (StringUtils.isEmpty(entity.getIfClearBottom())) {
287 354
                         entity.setIfClearBottom("否");
288 355
                     }
356
+                    if (StringUtils.isEmpty(entity.getIfLegalCheck())) {
357
+                        entity.setIfLegalCheck("是");
358
+                    }
359
+                    if (StringUtils.isEmpty(entity.getIfPayMultiple())) {
360
+                        entity.setIfPayMultiple("是");
361
+                    }
362
+                    if (StringUtils.isEmpty(entity.getIfBidding())) {
363
+                        entity.setIfBidding("是");
364
+                    }
289 365
 
290 366
                     if ("铁矿石".equals(entity.getBizProductType()) || "煤炭".equals(entity.getBizProductType())) {
291 367
                         if (StringUtils.isEmpty(entity.getIfLongTerm())) {
@@ -332,12 +408,12 @@ public class SalesContractServiceImpl implements SalesContractService {
332 408
                         if (lPortList != null && !lPortList.isEmpty() && !lPortList.get(0).getFno().isEmpty()) {
333 409
                             entity.setLpno(lPortList.get(0).getFno());
334 410
                         }
335
-                        if (lPortList != null && !lPortList.isEmpty() && lPortList.get(0).getCountryName().isEmpty()) {
411
+                        if (lPortList != null && !lPortList.isEmpty() && lPortList.get(0).getCountryCnNm().isEmpty()) {
336 412
                             currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:装运国不能为空!");
337 413
                             currentContractValid = false;
338 414
                         }
339
-                        if (lPortList != null && !lPortList.isEmpty() && !lPortList.get(0).getCountryName().isEmpty()) {
340
-                            entity.setLPortCtry(lPortList.get(0).getCountryName());
415
+                        if (lPortList != null && !lPortList.isEmpty() && !lPortList.get(0).getCountryCnNm().isEmpty()) {
416
+                            entity.setLPortCtry(lPortList.get(0).getCountryCnNm());
341 417
                         }
342 418
 
343 419
                         if (StringUtils.isEmpty(entity.getDPort())) {
@@ -352,12 +428,12 @@ public class SalesContractServiceImpl implements SalesContractService {
352 428
                         if (dPortList != null && !dPortList.isEmpty() && !dPortList.get(0).getFno().isEmpty()) {
353 429
                             entity.setDpno(dPortList.get(0).getFno());
354 430
                         }
355
-                        if (dPortList != null && !dPortList.isEmpty() && dPortList.get(0).getCountryName().isEmpty()) {
431
+                        if (dPortList != null && !dPortList.isEmpty() && dPortList.get(0).getCountryCnNm().isEmpty()) {
356 432
                             currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:目的国不能为空!");
357 433
                             currentContractValid = false;
358 434
                         }
359
-                        if (dPortList != null && !dPortList.isEmpty() && !dPortList.get(0).getCountryName().isEmpty()) {
360
-                            entity.setDPortCtry(dPortList.get(0).getCountryName());
435
+                        if (dPortList != null && !dPortList.isEmpty() && !dPortList.get(0).getCountryCnNm().isEmpty()) {
436
+                            entity.setDPortCtry(dPortList.get(0).getCountryCnNm());
361 437
                         }
362 438
                     }
363 439
 
@@ -371,25 +447,7 @@ public class SalesContractServiceImpl implements SalesContractService {
371 447
                         currentContractValid = false;
372 448
                     }
373 449
 
374
-                    // 设置默认值
375
-                    if (StringUtils.isEmpty(entity.getWhetherChartering())) {
376
-                        entity.setWhetherChartering("否");
377
-                    }
378
-                    if (StringUtils.isEmpty(entity.getIfLongTerm())) {
379
-                        entity.setIfLongTerm("否");
380
-                    }
381
-                    if (StringUtils.isEmpty(entity.getIfClearBottom())) {
382
-                        entity.setIfClearBottom("否");
383
-                    }
384
-                    if (StringUtils.isEmpty(entity.getIfLegalCheck())) {
385
-                        entity.setIfLegalCheck("是");
386
-                    }
387
-                    if (StringUtils.isEmpty(entity.getIfPayMultiple())) {
388
-                        entity.setIfPayMultiple("是");
389
-                    }
390
-                    if (StringUtils.isEmpty(entity.getIfBidding())) {
391
-                        entity.setIfBidding("是");
392
-                    }
450
+
393 451
 
394 452
                     // 额外校验逻辑
395 453
                     boolean needValidate = false;
@@ -411,29 +469,30 @@ public class SalesContractServiceImpl implements SalesContractService {
411 469
                             currentContractValid = false;
412 470
                         }
413 471
 
414
-                        if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
415
-                            if (StringUtils.isEmpty(entity.getTerms())) {
416
-                                currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:合同类型为出口销售或转口销售时,价格条款不能为空");
472
+
473
+                    }
474
+                    if ("出口销售".equals(entity.getBizType()) || "转口销售".equals(entity.getBizType())) {
475
+                        if (StringUtils.isEmpty(entity.getTerms())) {
476
+                            currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:合同类型为出口销售或转口销售时,价格条款不能为空");
477
+                            currentContractValid = false;
478
+                        }
479
+                        if (!StringUtils.isEmpty(entity.getTerms())) {
480
+                            List<DataDic> termsList = dicMapper.selectDicByTerms(entity.getTerms());
481
+                            if (termsList == null || termsList.isEmpty()) {
482
+                                currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:没有在数据字典中匹配到的该价格条款的类型");
417 483
                                 currentContractValid = false;
418 484
                             }
419
-                            if (!StringUtils.isEmpty(entity.getTerms())) {
420
-                                List<DataDic> termsList = dicMapper.selectDicByTerms(entity.getTerms());
421
-                                if (termsList == null || termsList.isEmpty()) {
422
-                                    currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:没有在数据字典中匹配到的该价格条款的类型");
423
-                                    currentContractValid = false;
424
-                                }
425
-                            }
426 485
                         }
486
+                    }
427 487
 
428
-                        if ("是".equals(entity.getWhetherChartering())) {
429
-                            if (StringUtils.isEmpty(entity.getChnShipName())) {
430
-                                currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:是否租船为是时,中文船名不能为空");
431
-                                currentContractValid = false;
432
-                            }
433
-                            if (StringUtils.isEmpty(entity.getEngShipName())) {
434
-                                currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:是否租船为是时,英文船名不能为空");
435
-                                currentContractValid = false;
436
-                            }
488
+                    if ("是".equals(entity.getWhetherChartering())) {
489
+                        if (StringUtils.isEmpty(entity.getChnShipName())) {
490
+                            currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:是否租船为是时,中文船名不能为空");
491
+                            currentContractValid = false;
492
+                        }
493
+                        if (StringUtils.isEmpty(entity.getEngShipName())) {
494
+                            currentContractErrors.add("主表(Sheet1) 第 " + currentRow + " 行:是否租船为是时,英文船名不能为空");
495
+                            currentContractValid = false;
437 496
                         }
438 497
                     }
439 498
 
@@ -459,12 +518,12 @@ public class SalesContractServiceImpl implements SalesContractService {
459 518
                                 currentContractValid = false;
460 519
                             }
461 520
 
462
-                            if ("出口销售".equals(bizType) || "转口销售".equals(bizType)) {
463
-                                if (StringUtils.isEmpty(entity1.getBatchNo())) {
464
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:合同类型为出口销售或转口销售时,批次号不能为空!");
465
-                                    currentContractValid = false;
466
-                                }
467
-                            }
521
+//                            if ("出口销售".equals(bizType) || "转口销售".equals(bizType)) {
522
+//                                if (StringUtils.isEmpty(entity1.getBatchNo())) {
523
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:合同类型为出口销售或转口销售时,批次号不能为空!");
524
+//                                    currentContractValid = false;
525
+//                                }
526
+//                            }
468 527
 
469 528
                             if (StringUtils.isEmpty(entity1.getItemno())) {
470 529
                                 currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:商品编号不能为空!");
@@ -540,23 +599,23 @@ public class SalesContractServiceImpl implements SalesContractService {
540 599
                                 }
541 600
                             }
542 601
 
543
-                            if (StringUtils.isEmpty(entity1.getCurcyPo())) {
544
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购币种不能为空!");
545
-                                currentContractValid = false;
546
-                            }
547
-
548
-                            List<CustCtrl> curcyList1 = custCtrlMapper.selectByCurcyPo(entity1.getCurcyPo());
549
-                            if (curcyList1 == null || curcyList1.isEmpty()) {
550
-                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购币种有误!");
551
-                                currentContractValid = false;
552
-                            }
553
-
554
-                            if (curcyList1 != null && !curcyList1.isEmpty() && !Objects.isNull(curcyList1.get(0).getRate()) && !Objects.isNull(entity1.getRatePo())) {
555
-                                if (entity1.getRatePo().compareTo(curcyList1.get(0).getRate()) != 0) {
556
-                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购汇率和匹配到的采购汇率不符!");
557
-                                    currentContractValid = false;
558
-                                }
559
-                            }
602
+//                            if (StringUtils.isEmpty(entity1.getCurcyPo())) {
603
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购币种不能为空!");
604
+//                                currentContractValid = false;
605
+//                            }
606
+
607
+//                            List<CustCtrl> curcyList1 = custCtrlMapper.selectByCurcyPo(entity1.getCurcyPo());
608
+//                            if (curcyList1 == null || curcyList1.isEmpty()) {
609
+//                                currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购币种有误!");
610
+//                                currentContractValid = false;
611
+//                            }
612
+//
613
+//                            if (curcyList1 != null && !curcyList1.isEmpty() && !Objects.isNull(curcyList1.get(0).getRate()) && !Objects.isNull(entity1.getRatePo())) {
614
+//                                if (entity1.getRatePo().compareTo(curcyList1.get(0).getRate()) != 0) {
615
+//                                    currentContractErrors.add("产品明细(Sheet2) 合同号 " + currentSono + " 第 " + (i + 1) + " 行:采购汇率和匹配到的采购汇率不符!");
616
+//                                    currentContractValid = false;
617
+//                                }
618
+//                            }
560 619
 
561 620
                             // 产品类型特定校验
562 621
                             if ("铁矿石".equals(bizProductType)) {

+ 73
- 83
src/main/java/com/example/backend/util/ExcelUtil.java Voir le fichier

@@ -3,15 +3,12 @@ package com.example.backend.util;
3 3
 import com.alibaba.excel.EasyExcel;
4 4
 import com.alibaba.excel.context.AnalysisContext;
5 5
 import com.alibaba.excel.event.AnalysisEventListener;
6
-import com.alibaba.excel.metadata.data.ReadCellData;
7 6
 import com.example.backend.excel.*;
8 7
 import org.springframework.web.multipart.MultipartFile;
9 8
 
10 9
 import java.io.IOException;
11 10
 import java.util.ArrayList;
12
-import java.util.HashMap;
13 11
 import java.util.List;
14
-import java.util.Map;
15 12
 
16 13
 /**
17 14
  * Excel解析工具类 - 销售合同专用
@@ -25,12 +22,13 @@ public class ExcelUtil {
25 22
         SimpleDataListener<SalesContractExcelDTO> listener = new SimpleDataListener<>();
26 23
         EasyExcel.read(file.getInputStream(), SalesContractExcelDTO.class, listener)
27 24
                 .sheet() // 不指定sheet名称,读取第一个sheet
28
-                .headRowNumber(2) // 跳过前2行,从第3行开始读取(索引从0开始)
25
+                .headRowNumber(2) // 跳过前1行,从第2行开始读取(索引从0开始)
29 26
                 .doRead();
30 27
 
31 28
         List<SalesContractExcelDTO> dataList = listener.getDataList();
32 29
         System.out.println("主表读取到 " + dataList.size() + " 条数据");
33 30
 
31
+        // 跳过前两条数据
34 32
         return dataList;
35 33
     }
36 34
 
@@ -41,10 +39,13 @@ public class ExcelUtil {
41 39
         SimpleDataListener<SalesDtlExcelDTO> listener = new SimpleDataListener<>();
42 40
         EasyExcel.read(file.getInputStream(), SalesDtlExcelDTO.class, listener)
43 41
                 .sheet(1) // 第二个sheet(索引从0开始)
44
-                .headRowNumber(2) // 跳过前2
42
+                .headRowNumber(1) // 跳过前0
45 43
                 .doRead();
46
-        System.out.println("产品明细读取到 " + listener.getDataList().size() + " 条数据");
47
-        return listener.getDataList();
44
+        List<SalesDtlExcelDTO> dataList = listener.getDataList();
45
+        System.out.println("产品明细读取到 " + dataList.size() + " 条数据");
46
+
47
+        // 跳过前两条数据
48
+        return dataList;
48 49
     }
49 50
 
50 51
     /**
@@ -54,10 +55,13 @@ public class ExcelUtil {
54 55
         SimpleDataListener<SalesCollectExcelDTO> listener = new SimpleDataListener<>();
55 56
         EasyExcel.read(file.getInputStream(), SalesCollectExcelDTO.class, listener)
56 57
                 .sheet(2) // 第三个sheet
57
-                .headRowNumber(2) // 跳过前2
58
+                .headRowNumber(1) // 跳过前0
58 59
                 .doRead();
59
-        System.out.println("收款计划读取到 " + listener.getDataList().size() + " 条数据");
60
-        return listener.getDataList();
60
+        List<SalesCollectExcelDTO> dataList = listener.getDataList();
61
+        System.out.println("收款计划读取到 " + dataList.size() + " 条数据");
62
+
63
+        // 跳过前两条数据
64
+        return dataList;
61 65
     }
62 66
 
63 67
     /**
@@ -67,102 +71,88 @@ public class ExcelUtil {
67 71
         SimpleDataListener<RCenterDtlExcelDTO> listener = new SimpleDataListener<>();
68 72
         EasyExcel.read(file.getInputStream(), RCenterDtlExcelDTO.class, listener)
69 73
                 .sheet(3) // 第四个sheet
70
-                .headRowNumber(2) // 跳过前2
74
+                .headRowNumber(1) // 跳过前0
71 75
                 .doRead();
72
-        System.out.println("责任中心读取到 " + listener.getDataList().size() + " 条数据");
73
-        return listener.getDataList();
76
+        List<RCenterDtlExcelDTO> dataList = listener.getDataList();
77
+        System.out.println("责任中心读取到 " + dataList.size() + " 条数据");
78
+
79
+        // 跳过前两条数据
80
+        return dataList;
74 81
     }
75 82
 
76 83
     /**
77
-     * 读取费用明细sheet - Sheet5
84
+     * 读取服务费率sheet - Sheet5
78 85
      */
79
-    public static List<FeeDtlExcelDTO> readFeelDtlSheet(MultipartFile file) throws IOException {
80
-        SimpleDataListener<FeeDtlExcelDTO> listener = new SimpleDataListener<>();
81
-        EasyExcel.read(file.getInputStream(), FeeDtlExcelDTO.class, listener)
86
+    public static List<ExpSvcRateExcelDTO> readExpSvcRateSheet(MultipartFile file) throws IOException {
87
+        SimpleDataListener<ExpSvcRateExcelDTO> listener = new SimpleDataListener<>();
88
+        EasyExcel.read(file.getInputStream(), ExpSvcRateExcelDTO.class, listener)
82 89
                 .sheet(4) // 第五个sheet
83
-                .headRowNumber(2) // 跳过前2
90
+                .headRowNumber(1) // 跳过前0
84 91
                 .doRead();
85
-        System.out.println("费用明细读取到 " + listener.getDataList().size() + " 条数据");
86
-        return listener.getDataList();
92
+        List<ExpSvcRateExcelDTO> dataList = listener.getDataList();
93
+        System.out.println("服务费率读取到 " + dataList.size() + " 条数据");
94
+
95
+        // 跳过前两条数据
96
+        return dataList;
87 97
     }
88 98
 
89 99
     /**
90
-     * 读取服务费率sheet - Sheet6
100
+     * 跳过列表的前两条数据
101
+     * 如果数据不足2条,返回空列表
91 102
      */
92
-    public static List<ExpSvcRateExcelDTO> readExpSvcRateSheet(MultipartFile file) throws IOException {
93
-        SimpleDataListener<ExpSvcRateExcelDTO> listener = new SimpleDataListener<>();
94
-        EasyExcel.read(file.getInputStream(), ExpSvcRateExcelDTO.class, listener)
95
-                .sheet(5) // 第六个sheet
96
-                .headRowNumber(2) // 跳过前2行
97
-                .doRead();
98
-        System.out.println("服务费率读取到 " + listener.getDataList().size() + " 条数据");
99
-        return listener.getDataList();
103
+    private static <T> List<T> skipFirstTwoRows(List<T> dataList) {
104
+        if (dataList == null || dataList.size() <= 2) {
105
+            System.out.println("数据不足2条,跳过后返回空列表");
106
+            return new ArrayList<>();
107
+        }
108
+
109
+        List<T> filteredList = new ArrayList<>(dataList.subList(2, dataList.size()));
110
+        System.out.println("跳过前2条数据后剩余: " + filteredList.size() + " 条");
111
+
112
+        // 打印跳过后的第一行数据用于调试
113
+        if (!filteredList.isEmpty()) {
114
+            System.out.println("跳过前2条后的第一行数据: " + filteredList.get(0));
115
+        }
116
+
117
+        return filteredList;
100 118
     }
101 119
 
102 120
     /**
103
-     * 调试方法:打印所有sheet的结构信息
121
+     * 读取Excel主表数据 - Sheet1(可配置跳过行数)
122
+     * @param skipRowsAfterHeader 跳过标题行后的行数
104 123
      */
105
-    public static void debugExcelStructure(MultipartFile file) throws IOException {
106
-        System.out.println("=== Excel结构调试信息 ===");
107
-
108
-        EasyExcel.read(file.getInputStream(), new AnalysisEventListener<Object>() {
109
-            private int rowCount = 0;
110
-
111
-            @Override
112
-            public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
113
-                String sheetName = context.readSheetHolder().getSheetName();
114
-                int sheetNo = context.readSheetHolder().getSheetNo();
115
-                System.out.println("Sheet" + sheetNo + " [" + sheetName + "] - 表头信息:");
116
-                headMap.forEach((index, name) -> {
117
-                    System.out.println("  列" + index + ": " + name);
118
-                });
119
-            }
124
+    public static List<SalesContractExcelDTO> readMainSheet(MultipartFile file, int skipRowsAfterHeader) throws IOException {
125
+        SimpleDataListener<SalesContractExcelDTO> listener = new SimpleDataListener<>();
126
+        EasyExcel.read(file.getInputStream(), SalesContractExcelDTO.class, listener)
127
+                .sheet()
128
+                .headRowNumber(1) // 标题行在第2行
129
+                .doRead();
120 130
 
121
-            @Override
122
-            public void invoke(Object data, AnalysisContext context) {
123
-                rowCount++;
124
-                if (rowCount <= 3) { // 只打印前3行数据
125
-                    System.out.println("Sheet: " + context.readSheetHolder().getSheetName() +
126
-                            " - 第" + rowCount + "行: " + data);
127
-                }
128
-            }
131
+        List<SalesContractExcelDTO> dataList = listener.getDataList();
132
+        System.out.println("主表读取到 " + dataList.size() + " 条数据");
129 133
 
130
-            @Override
131
-            public void doAfterAllAnalysed(AnalysisContext context) {
132
-                System.out.println("Sheet: " + context.readSheetHolder().getSheetName() +
133
-                        " 总行数: " + rowCount);
134
-                rowCount = 0; // 重置行计数
135
-            }
136
-        }).doReadAll();
134
+        // 跳过指定行数
135
+        return skipRows(dataList, skipRowsAfterHeader);
137 136
     }
138 137
 
139 138
     /**
140
-     * 获取Excel中所有Sheet的名称(用于调试)
139
+     * 通用跳过行数方法
140
+     * @param skipCount 要跳过的行数
141 141
      */
142
-    public static List<String> getSheetNames(MultipartFile file) throws IOException {
143
-        List<String> sheetNames = new ArrayList<>();
144
-        EasyExcel.read(file.getInputStream(), new AnalysisEventListener<Object>() {
145
-            @Override
146
-            public void invoke(Object data, AnalysisContext context) {
147
-                // 不处理数据,只获取sheet名称
148
-            }
142
+    private static <T> List<T> skipRows(List<T> dataList, int skipCount) {
143
+        if (dataList == null || dataList.size() <= skipCount) {
144
+            System.out.println("数据不足" + skipCount + "条,跳过后返回空列表");
145
+            return new ArrayList<>();
146
+        }
149 147
 
150
-            @Override
151
-            public void doAfterAllAnalysed(AnalysisContext context) {
152
-                // 完成分析
153
-            }
148
+        List<T> filteredList = new ArrayList<>(dataList.subList(skipCount, dataList.size()));
149
+        System.out.println("跳过前" + skipCount + "条数据后剩余: " + filteredList.size() + " 条");
154 150
 
155
-            @Override
156
-            public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
157
-                String sheetName = context.readSheetHolder().getSheetName();
158
-                if (!sheetNames.contains(sheetName)) {
159
-                    sheetNames.add(sheetName);
160
-                    System.out.println("发现Sheet: " + sheetName);
161
-                }
162
-            }
163
-        }).doReadAll();
151
+        if (!filteredList.isEmpty()) {
152
+            System.out.println("跳过前" + skipCount + "条后的第一行数据: " + filteredList.get(0));
153
+        }
164 154
 
165
-        return sheetNames;
155
+        return filteredList;
166 156
     }
167 157
 
168 158
     /**
@@ -176,7 +166,7 @@ public class ExcelUtil {
176 166
             dataList.add(data);
177 167
             // 打印第一行数据用于调试
178 168
             if (dataList.size() == 1) {
179
-                System.out.println("第一行数据示例: " + data.toString());
169
+                System.out.println("原始第一行数据: " + data.toString());
180 170
             }
181 171
         }
182 172
 

+ 1
- 1
src/main/resources/mapper/CustCtrlMapper.xml Voir le fichier

@@ -18,7 +18,7 @@
18 18
         order by a.fno desc
19 19
     </select>
20 20
     <select id="selectLPortByLportName" resultType="com.example.backend.entity.common.CustCtrl">
21
-        select fno,portName,portCd,portNm,country,countryName
21
+        select fno,portName,portCd,portNm,country,countryCnNm
22 22
         from SGGMIIP.portCtrl
23 23
         where nvl(del_flag, 0) !=1
24 24
         and isnull(country,'')!=''

+ 1
- 1
src/main/resources/mapper/SysUserMapper.xml Voir le fichier

@@ -36,7 +36,7 @@
36 36
 
37 37
     </select>
38 38
     <select id="selectByCreateBy" resultType="com.example.backend.entity.common.SysUser">
39
-        select a.id,a.dept_code, a.DEPT_NAME,c.user_desc,c.USER_CODE
39
+        select a.id,a.dept_code as deptCode, a.DEPT_NAME,c.user_desc,c.USER_CODE
40 40
         from SGGMIIP.SYS_DEPARTMENT a
41 41
                  join SGGMIIP.SYS_USER_DEPARTMENT b on a.id = b.DEPT_ID
42 42
                  join SGGMIIP.SYS_USER c on b.USER_ID = c.id

Loading…
Annuler
Enregistrer