From 3aab2ba53d5132263f07b0666dffc7888bd46701 Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期三, 05 八月 2026 14:49:03 +0800
Subject: [PATCH] fix: fill missing platform income months
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 44 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index bf9d7c5..616a935 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/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);
--
Gitblit v1.7.1