Commit 3b785bc70d8d1925f887b93e79b4d50c82362997

Authored by yeqianyong
1 parent b2bff4f3

楚江erp:台账数据相关bug修复

@@ -65,27 +65,7 @@ public class LedgerReportExportHandler implements ExportHandler { @@ -65,27 +65,7 @@ public class LedgerReportExportHandler implements ExportHandler {
65 int startMergeIndex = rowIndex; 65 int startMergeIndex = rowIndex;
66 // 合并结束行 66 // 合并结束行
67 int endMergeIndex = rowIndex + detailList.size(); 67 int endMergeIndex = rowIndex + detailList.size();
68 - for (ReceiptLedgerReportDetail detail : detailList) {  
69 - ExcelUtil.setCellValue(sheet, rowIndex, 6, detail.getCustomerName()  
70 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
71 - ExcelUtil.setCellValue(sheet, rowIndex, 7, detail.getDebtTotal()  
72 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
73 - ExcelUtil.setCellValue(sheet, rowIndex, 8, detail.getAgreement()  
74 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
75 - ExcelUtil.setCellValue(sheet, rowIndex, 9, detail.getFirstCoordinate()  
76 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
77 - ExcelUtil.setCellValue(sheet, rowIndex, 10, detail.getSecondCoordinate()  
78 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
79 - ExcelUtil.setCellValue(sheet, rowIndex, 11, detail.getClearDebt()  
80 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
81 - ExcelUtil.setCellValue(sheet, rowIndex, 12, detail.getCreditStatus()  
82 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
83 - ExcelUtil.setCellValue(sheet, rowIndex, 13, detail.getTimingStatus()  
84 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
85 - ExcelUtil.setCellValue(sheet, rowIndex, 14, detail.getWaitDeliveredOrder()  
86 - , setCellStyle(workbook, VerticalAlignment.CENTER, false));  
87 - rowIndex++;  
88 - } 68 + rowIndex = setCellValue(workbook, sheet, rowIndex, detailList);
89 if (detailList.size() > 1) { 69 if (detailList.size() > 1) {
90 setSubtotalCell(workbook, sheet, rowIndex, model); 70 setSubtotalCell(workbook, sheet, rowIndex, model);
91 // 合并单位格 71 // 合并单位格
@@ -109,7 +89,11 @@ public class LedgerReportExportHandler implements ExportHandler { @@ -109,7 +89,11 @@ public class LedgerReportExportHandler implements ExportHandler {
109 sheet.addMergedRegion(cellRangeAddress6); 89 sheet.addMergedRegion(cellRangeAddress6);
110 } 90 }
111 } else if ("RECEIVABLE_LEDGER_REPORT_MERGE".equals(exportType)) { 91 } else if ("RECEIVABLE_LEDGER_REPORT_MERGE".equals(exportType)) {
112 - setSubtotalCell(workbook, sheet, rowIndex, model); 92 + if (detailList.size() > 1) {
  93 + setSubtotalCell(workbook, sheet, rowIndex, model);
  94 + } else {
  95 + rowIndex = setCellValue(workbook, sheet, rowIndex, detailList);
  96 + }
113 } 97 }
114 rowIndex++; 98 rowIndex++;
115 } 99 }
@@ -150,6 +134,34 @@ public class LedgerReportExportHandler implements ExportHandler { @@ -150,6 +134,34 @@ public class LedgerReportExportHandler implements ExportHandler {
150 } 134 }
151 } 135 }
152 136
  137 + private int setCellValue(Workbook workbook, Sheet sheet, int rowIndex, List<ReceiptLedgerReportDetail> detailList) {
  138 + if (CollectionUtils.isEmpty(detailList)) {
  139 + return rowIndex;
  140 + }
  141 + for (ReceiptLedgerReportDetail detail : detailList) {
  142 + ExcelUtil.setCellValue(sheet, rowIndex, 6, detail.getCustomerName()
  143 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  144 + ExcelUtil.setCellValue(sheet, rowIndex, 7, detail.getDebtTotal()
  145 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  146 + ExcelUtil.setCellValue(sheet, rowIndex, 8, detail.getAgreement()
  147 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  148 + ExcelUtil.setCellValue(sheet, rowIndex, 9, detail.getFirstCoordinate()
  149 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  150 + ExcelUtil.setCellValue(sheet, rowIndex, 10, detail.getSecondCoordinate()
  151 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  152 + ExcelUtil.setCellValue(sheet, rowIndex, 11, detail.getClearDebt()
  153 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  154 + ExcelUtil.setCellValue(sheet, rowIndex, 12, detail.getCreditStatus()
  155 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  156 + ExcelUtil.setCellValue(sheet, rowIndex, 13, detail.getTimingStatus()
  157 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  158 + ExcelUtil.setCellValue(sheet, rowIndex, 14, detail.getWaitDeliveredOrder()
  159 + , setCellStyle(workbook, VerticalAlignment.CENTER, false));
  160 + rowIndex++;
  161 + }
  162 + return rowIndex;
  163 + }
  164 +
153 /** 165 /**
154 * 设置“小计”单元格 166 * 设置“小计”单元格
155 * 167 *
@@ -407,7 +407,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge @@ -407,7 +407,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
407 } 407 }
408 // 订货单规格信息 408 // 订货单规格信息
409 Map<String, PurchaseOrderLine> orderSpecMap = new HashMap<>(); 409 Map<String, PurchaseOrderLine> orderSpecMap = new HashMap<>();
410 - List<PurchaseOrderLine> orderSpecList = purchaseOrderLineService.listByIds(orderIds); 410 + List<PurchaseOrderLine> orderSpecList = purchaseOrderLineService.listByIds(orderSpecIds);
411 if (CollectionUtils.isNotEmpty(orderSpecList)) { 411 if (CollectionUtils.isNotEmpty(orderSpecList)) {
412 orderSpecMap = orderSpecList.stream().collect(Collectors.toMap(PurchaseOrderLine::getId, Function.identity())); 412 orderSpecMap = orderSpecList.stream().collect(Collectors.toMap(PurchaseOrderLine::getId, Function.identity()));
413 } 413 }
@@ -501,14 +501,8 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge @@ -501,14 +501,8 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
501 // 根据简称获取台账明细数据 501 // 根据简称获取台账明细数据
502 Map<String, List<ReceiptLedgerInfo>> agreementDataMap = getLedgerInfoByShortName(shortNames, Boolean.FALSE); 502 Map<String, List<ReceiptLedgerInfo>> agreementDataMap = getLedgerInfoByShortName(shortNames, Boolean.FALSE);
503 Map<String, List<ReceiptLedgerInfo>> overdueDataMap = getLedgerInfoByShortName(shortNames, Boolean.TRUE); 503 Map<String, List<ReceiptLedgerInfo>> overdueDataMap = getLedgerInfoByShortName(shortNames, Boolean.TRUE);
504 - // 只统计约定内、一次、二次协调、清欠阶段  
505 - List<String> debtStatusList = new ArrayList<>();  
506 - debtStatusList.add("AGREEMENT");  
507 - debtStatusList.add("FIRST_COORDINATE");  
508 - debtStatusList.add("SECOND_COORDINATE");  
509 - debtStatusList.add("CLEAR_DEBTS");  
510 - debtStatusList.add("DEPOSIT");  
511 - List<Map<String, Object>> debtAmountList = getBaseMapper().statisticsDebtByShortName(shortNames, debtStatusList, "INSIDE"); 504 + // 统计各个阶段欠款金额数据
  505 + List<Map<String, Object>> debtAmountList = getBaseMapper().statisticsDebtByShortName(shortNames, null, "INSIDE");
512 if (CollectionUtils.isEmpty(debtAmountList)) { 506 if (CollectionUtils.isEmpty(debtAmountList)) {
513 return result; 507 return result;
514 } 508 }
@@ -556,16 +550,16 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge @@ -556,16 +550,16 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
556 agreement = agreement.add(debtAmount); 550 agreement = agreement.add(debtAmount);
557 } 551 }
558 reportDetail.setAgreement(valueConvert(agreement)); 552 reportDetail.setAgreement(valueConvert(agreement));
559 - reportDetail.setCreditStatus("约定内"); 553 + reportDetail.setTimingStatus("约定内");
560 } else if ("FIRST_COORDINATE".equals(debtStatus)) { 554 } else if ("FIRST_COORDINATE".equals(debtStatus)) {
561 reportDetail.setFirstCoordinate(valueConvert(debtAmount)); 555 reportDetail.setFirstCoordinate(valueConvert(debtAmount));
562 - reportDetail.setCreditStatus("超期1"); 556 + reportDetail.setTimingStatus("超期1");
563 } else if ("SECOND_COORDINATE".equals(debtStatus)) { 557 } else if ("SECOND_COORDINATE".equals(debtStatus)) {
564 reportDetail.setSecondCoordinate(valueConvert(debtAmount)); 558 reportDetail.setSecondCoordinate(valueConvert(debtAmount));
565 - reportDetail.setCreditStatus("超期2"); 559 + reportDetail.setTimingStatus("超期2");
566 } else if ("CLEAR_DEBTS".equals(debtStatus)) { 560 } else if ("CLEAR_DEBTS".equals(debtStatus)) {
567 reportDetail.setClearDebt(valueConvert(debtAmount)); 561 reportDetail.setClearDebt(valueConvert(debtAmount));
568 - reportDetail.setCreditStatus("超期3"); 562 + reportDetail.setTimingStatus("超期3");
569 } 563 }
570 // 计算超额数据(授信状态) 564 // 计算超额数据(授信状态)
571 String creditStatus = calculateExcess(debtAmount, report.getQuota()); 565 String creditStatus = calculateExcess(debtAmount, report.getQuota());
@@ -231,6 +231,7 @@ @@ -231,6 +231,7 @@
231 tb.region, 231 tb.region,
232 r.name as region_name, 232 r.name as region_name,
233 max(cc.company_credit_limit) as quota, 233 max(cc.company_credit_limit) as quota,
  234 + max(cc.company_settlement_period) as settle_term,
234 sum(rl.end_account_receivable) as debtTotal 235 sum(rl.end_account_receivable) as debtTotal
235 from base_data_customer_short tb 236 from base_data_customer_short tb
236 left join sys_dept d on tb.dept_id = d.id 237 left join sys_dept d on tb.dept_id = d.id
@@ -275,10 +276,12 @@ @@ -275,10 +276,12 @@
275 <foreach collection="shortNames" open="(" separator="," close=")" item="item"> 276 <foreach collection="shortNames" open="(" separator="," close=")" item="item">
276 #{item} 277 #{item}
277 </foreach> 278 </foreach>
278 - and tb.debt_status in  
279 - <foreach collection="debtStatusList" open="(" separator="," close=")" item="item">  
280 - #{item}  
281 - </foreach> 279 + <if test="debtStatusList != null and debtStatusList.size() > 0">
  280 + and tb.debt_status in
  281 + <foreach collection="debtStatusList" open="(" separator="," close=")" item="item">
  282 + #{item}
  283 + </foreach>
  284 + </if>
282 </where> 285 </where>
283 and tb.debt_status is not null 286 and tb.debt_status is not null
284 group by c.name,cs.short_name,tb.debt_status 287 group by c.name,cs.short_name,tb.debt_status