longz
2026-08-05 3aab2ba53d5132263f07b0666dffc7888bd46701
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -3532,9 +3532,8 @@
            }
        } else {
            List<SixChargingDto> settlementIncome = this.baseMapper.chargeSettlement(sixBeforeValue, siteIds);
            if (settlementIncome != null) {
                result.addAll(settlementIncome);
            }
            List<SixChargingDto> orderHistoryIncome = this.baseMapper.chargeOrderHistory(sixBeforeValue, siteIds);
            result.addAll(mergeMissingMonthlyIncome(settlementIncome, orderHistoryIncome));
            String siteIdsCsv = siteIds == null ? null : siteIds.stream()
                    .filter(Objects::nonNull)
                    .map(String::valueOf)
@@ -3569,6 +3568,45 @@
        return result;
    }
    static List<SixChargingDto> mergeMissingMonthlyIncome(List<SixChargingDto> settlementIncome,
                                                            List<SixChargingDto> orderHistoryIncome) {
        List<SixChargingDto> merged = new ArrayList<>();
        Set<Integer> settledMonths = new HashSet<>();
        if (settlementIncome != null) {
            for (SixChargingDto item : settlementIncome) {
                if (item == null) {
                    continue;
                }
                merged.add(item);
                Integer month = incomeMonth(item);
                if (month != null) {
                    settledMonths.add(month);
                }
            }
        }
        if (orderHistoryIncome != null) {
            for (SixChargingDto item : orderHistoryIncome) {
                Integer month = incomeMonth(item);
                if (item != null && month != null && settledMonths.add(month)) {
                    merged.add(item);
                }
            }
        }
        return merged;
    }
    private static Integer incomeMonth(SixChargingDto item) {
        if (item == null || item.getMonth() == null) {
            return null;
        }
        try {
            int month = Integer.parseInt(item.getMonth());
            return month >= 1 && month <= 12 ? month : null;
        } catch (NumberFormatException ignored) {
            return null;
        }
    }
    @Override
    public List<SixCircleDto> circle(List<Integer> siteIds, LocalDate sixBefore, Boolean partnerView) {
        List<SixCircleDto> result = this.baseMapper.circle(siteIds, sixBefore, partnerView);