Showing
2 changed files
with
22 additions
and
5 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ledger/FundCoordinationController.java
| @@ -561,7 +561,9 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -561,7 +561,9 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 561 | 561 | ||
| 562 | @ApiOperation("资金协调手续打印") | 562 | @ApiOperation("资金协调手续打印") |
| 563 | @GetMapping("/printFundCoordination") | 563 | @GetMapping("/printFundCoordination") |
| 564 | - public void printFundCoordination(@NotBlank(message = "id不能为空") String id, HttpServletResponse response) throws IOException { | 564 | + public void printFundCoordination(@NotBlank(message = "id不能为空") String id, |
| 565 | + @NotBlank(message = "type不能为空") String type, | ||
| 566 | + HttpServletResponse response) throws IOException { | ||
| 565 | FundCoordination fundCoordination = fundCoordinationService.findById(id); | 567 | FundCoordination fundCoordination = fundCoordinationService.findById(id); |
| 566 | 568 | ||
| 567 | GetFundCoordinationBo data = packFundCoordinationData(fundCoordination); | 569 | GetFundCoordinationBo data = packFundCoordinationData(fundCoordination); |
| @@ -576,7 +578,7 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -576,7 +578,7 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 576 | Workbook workbook = new XSSFWorkbook(inputStream)) { | 578 | Workbook workbook = new XSSFWorkbook(inputStream)) { |
| 577 | try { | 579 | try { |
| 578 | Sheet sheet = workbook.getSheetAt(0); | 580 | Sheet sheet = workbook.getSheetAt(0); |
| 579 | - processOrderingUnits(workbook,sheet, data.getFundOrderingUnitList()); | 581 | + processOrderingUnits(workbook,sheet, data.getFundOrderingUnitList(),type); |
| 580 | 582 | ||
| 581 | DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | 583 | DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| 582 | 584 | ||
| @@ -715,7 +717,7 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -715,7 +717,7 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 715 | /** | 717 | /** |
| 716 | * 处理订货单位及其应收款明细的动态插入 | 718 | * 处理订货单位及其应收款明细的动态插入 |
| 717 | */ | 719 | */ |
| 718 | - private void processOrderingUnits(Workbook workbook, Sheet sheet, List<FundOrderingUnit> unitList) { | 720 | + private void processOrderingUnits(Workbook workbook, Sheet sheet, List<FundOrderingUnit> unitList, String type) { |
| 719 | if (CollectionUtils.isEmpty(unitList)) { | 721 | if (CollectionUtils.isEmpty(unitList)) { |
| 720 | return; | 722 | return; |
| 721 | } | 723 | } |
| @@ -742,6 +744,21 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -742,6 +744,21 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 742 | continue; | 744 | continue; |
| 743 | } | 745 | } |
| 744 | if (j == 0) { | 746 | if (j == 0) { |
| 747 | + // 清空第九行单元格的值(列范围可根据需要调整,B列的值) | ||
| 748 | + Row targetRow3 = sheet.getRow(8); | ||
| 749 | + if (targetRow3 != null) { | ||
| 750 | + // 假设你只关心 B 列(1) | ||
| 751 | + Cell cell = targetRow3.getCell(1); | ||
| 752 | + if (cell != null) { | ||
| 753 | + cell.setCellValue((String) null); // 清空内容,保留样式 | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + //填充值 | ||
| 757 | + if ("INSIDE".equals(type)) { | ||
| 758 | + setCellValue(sheet, 8, 1, "应收款(元)"); | ||
| 759 | + } else if ("OUTSIDE".equals(type)) { | ||
| 760 | + setCellValue(sheet, 8, 1, "应收款(美元)"); | ||
| 761 | + } | ||
| 745 | // === 3. 明细数据行 === | 762 | // === 3. 明细数据行 === |
| 746 | for (int i = startRow + 1; i < startRow + unit.getFundOrderingUnitDetailList().size(); i++) { | 763 | for (int i = startRow + 1; i < startRow + unit.getFundOrderingUnitDetailList().size(); i++) { |
| 747 | copyRow(workbook, sheet, startRow, i); | 764 | copyRow(workbook, sheet, startRow, i); |
| @@ -763,6 +780,8 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -763,6 +780,8 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 763 | copyRow(workbook, sheet, 9, startRow); | 780 | copyRow(workbook, sheet, 9, startRow); |
| 764 | // 合并 A-H 列 | 781 | // 合并 A-H 列 |
| 765 | CellRangeAddress mergeRegion = new CellRangeAddress(startRow, startRow, 1, 7); | 782 | CellRangeAddress mergeRegion = new CellRangeAddress(startRow, startRow, 1, 7); |
| 783 | + removeMergedRegionIfExists(sheet, mergeRegion); | ||
| 784 | + sheet.addMergedRegion(mergeRegion); | ||
| 766 | // 清空该行所有单元格的值(列范围可根据需要调整,比如 A~H 或整行) | 785 | // 清空该行所有单元格的值(列范围可根据需要调整,比如 A~H 或整行) |
| 767 | Row targetRow1 = sheet.getRow(startRow); | 786 | Row targetRow1 = sheet.getRow(startRow); |
| 768 | if (targetRow1 != null) { | 787 | if (targetRow1 != null) { |
| @@ -774,8 +793,6 @@ public class FundCoordinationController extends DefaultBaseController { | @@ -774,8 +793,6 @@ public class FundCoordinationController extends DefaultBaseController { | ||
| 774 | } | 793 | } |
| 775 | } | 794 | } |
| 776 | } | 795 | } |
| 777 | - removeMergedRegionIfExists(sheet, mergeRegion); | ||
| 778 | - sheet.addMergedRegion(mergeRegion); | ||
| 779 | //填充值 | 796 | //填充值 |
| 780 | setCellValue(sheet, startRow, 0, "备注说明"); | 797 | setCellValue(sheet, startRow, 0, "备注说明"); |
| 781 | setCellValue(sheet, startRow, 1, unit.getRemark()); | 798 | setCellValue(sheet, startRow, 1, unit.getRemark()); |
No preview for this file type