Procházet zdrojové kódy

结算报表-导出结算记录,导出的Excel表无数据且提示程序异常(私有和平台都是)

lipf před 4 měsíci
rodič
revize
bfa11e1bff

+ 7 - 2
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -1357,11 +1357,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
     public void exportSuperviseSettlementExcel(Page page, SettlementQueryVo settlementQueryVo) {
         Page<ExportSuperviseSettlementExcelDto> exportSuperviseSettlementExcelDtos = baseMapper.superviseSettlementExcelDtos(page, settlementQueryVo);
         exportSuperviseSettlementExcelDtos.getRecords().forEach(dto -> {
-            if (dto.getInvoiceParty().equals("1")) {
+            if ("1".equals(dto.getInvoiceParty())) {
                 dto.setInvoiceParty("我方开票");
-            } else if (dto.getInvoiceParty().equals("2")) {
+            } else if ("2".equals(dto.getInvoiceParty())) {
                 dto.setInvoiceParty("保司开票");
             }
+            dto.setInvoiceType(Objects.toString(dto.getInvoiceType(),""));
             switch (dto.getInvoiceType()) {
                 case "1" -> dto.setInvoiceType("手续费");
                 case "2" -> dto.setInvoiceType("跟单费");
@@ -1639,11 +1640,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         // 1. 预加载手续费应开票金额(全局唯一一次查询)
         List<InvoiceAmountDto> commissionInvoicingAmount = baseMapper.getSuperviseAmount();
         Map<String, BigDecimal> invoicingAmountMap = commissionInvoicingAmount.stream()
+                .filter(action-> BigDecimal.ZERO.compareTo(action.getSuperviseAmount()) != 0)
                 .collect(Collectors.toMap(
                         InvoiceAmountDto::getCompanyId,
                         dto -> dto.getSuperviseAmount() != null ? dto.getSuperviseAmount() : BigDecimal.ZERO,
                         (existing, replacement) -> existing
                 ));
+        // 有结算数据的保险公司的id集
+        Set<String> companyIds = invoicingAmountMap.keySet();
 
         // 2. 固定开票类型,只初始化一次
         List<String> invoiceTypes = java.util.Arrays.asList("1", "3");
@@ -1651,6 +1655,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
 
         // 3. 一次性查询所有公司数据
         List<CompanySuperviseSettlementReportDto> allCompanies = baseMapper.selectAllCompanies(settlementReportQueryVo);
+        allCompanies = allCompanies.stream().filter(action-> companyIds.contains(action.getCompanyId())).toList();
         if (allCompanies == null || allCompanies.isEmpty()) {
             return java.util.Collections.emptyList();
         }