From 21b9f3bf3502d9f49d096fbdd7a580251acdfea2 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 10:48:17 +0800 Subject: [PATCH 1/7] =?UTF-8?q?bugfix=20orderSplitRecords=E4=B8=AD?= =?UTF-8?q?=E7=94=B5=E8=B4=B9=E5=88=86=E8=B4=A6=E9=87=91=E9=A2=9D=E4=B8=8E?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=B4=B9=E5=88=86=E8=B4=A6=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E4=B8=BAnull,=20=E8=AE=BE=E7=BD=AE0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OrderSplitRecordServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java index a6863443e..936fb5b82 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java @@ -158,7 +158,17 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService { return Lists.newArrayList(); } // 根据入参拉出时间段内所有订单的分账记录 - return orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime); + List orderSplitRecords = orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime); + // orderSplitRecords中电费分账金额与服务费分账金额为null, 设置0 + for (OrderSplitRecord orderSplitRecord : orderSplitRecords) { + if (orderSplitRecord.getElectricitySplitAmount() == null) { + orderSplitRecord.setElectricitySplitAmount(BigDecimal.ZERO); + } + if (orderSplitRecord.getServiceSplitAmount() == null) { + orderSplitRecord.setServiceSplitAmount(BigDecimal.ZERO); + } + } + return orderSplitRecords; } /** From 7c51106b17f5ef3165545d7e231b353f6ecced7d Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 13:54:05 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 36c635a465c9e2dacce755e6a3519be6c1d03158) --- .../impl/SettleOrderReportServiceImpl.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java index b4a624bd8..c50463cc4 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java @@ -19,6 +19,7 @@ import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.id.IdUtils; +import com.jsowell.pile.domain.OrderSplitRecord; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.domain.SettleOrderReport; import com.jsowell.pile.dto.GetClearingBillDTO; @@ -680,8 +681,15 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService { dto.setMerchantId(stationInfo.getMerchantId()); // 查询结算完成的订单 List orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto); + // 收集订单编号 List collect = orderListVOS.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList()); log.info("站点:{}, 在{}-{}查询到订单数据{}条,订单编号:{}", stationInfo.getStationName(), startTime, endTime, orderListVOS.size(), collect); + + // 根据入参拉出时间段内所有订单的分账记录 + List orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, startTime, endTime); + // orderSplitRecords转为map, key为订单编号, value为分账记录 + Map splitRecordMap = orderSplitRecords.stream().collect(Collectors.toMap(OrderSplitRecord::getOrderCode, v -> v)); + // 统计出日报信息 BigDecimal useElectricity = BigDecimal.ZERO; // 总电量使用量 int chargeNum = 0; // 总充电次数 @@ -737,12 +745,19 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService { chargeTime += l; } - // 电费金额 - BigDecimal e = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; - totalElectricityAmount = totalElectricityAmount.add(e); + // 电费金额, 如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount() + OrderSplitRecord record = splitRecordMap.get(vo.getOrderCode()); + BigDecimal electricityAmount = record != null + ? record.getElectricitySplitAmount() + : vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; + // BigDecimal e = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; + totalElectricityAmount = totalElectricityAmount.add(electricityAmount); - // 服务费金额 - BigDecimal serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; + // 服务费金额,如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount() + BigDecimal serviceAmount = record != null + ? record.getServiceSplitAmount() + : vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; + // BigDecimal serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; totalServiceAmount = totalServiceAmount.add(serviceAmount); // 订单金额 From 4efb428e5f8d63e69da43c6d36f0813a2a9cb0bf Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 14:15:41 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SettleOrderReportServiceImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java index c50463cc4..43101321f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java @@ -747,16 +747,21 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService { // 电费金额, 如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount() OrderSplitRecord record = splitRecordMap.get(vo.getOrderCode()); - BigDecimal electricityAmount = record != null - ? record.getElectricitySplitAmount() - : vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; + BigDecimal electricityAmount; + BigDecimal serviceAmount; // BigDecimal e = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; + if (record != null) { + electricityAmount = record.getElectricitySplitAmount() != null ? record.getElectricitySplitAmount() : BigDecimal.ZERO; + serviceAmount = record.getServiceSplitAmount() != null ? record.getServiceSplitAmount() : BigDecimal.ZERO; + log.info("record订单编号:{}, 订单金额:{}, 电费金额:{}, 服务费金额:{}", vo.getOrderCode(), orderAmount, electricityAmount, serviceAmount); + } else { + electricityAmount = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO; + serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; + log.info("vo订单编号:{}, 订单金额:{}, 电费金额:{}, 服务费金额:{}", vo.getOrderCode(), orderAmount, electricityAmount, serviceAmount); + } totalElectricityAmount = totalElectricityAmount.add(electricityAmount); // 服务费金额,如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount() - BigDecimal serviceAmount = record != null - ? record.getServiceSplitAmount() - : vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; // BigDecimal serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO; totalServiceAmount = totalServiceAmount.add(serviceAmount); From 6a3c262e7c6eeef2885135b3569798ed5d14b2a8 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 14:21:48 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/pile/service/impl/SettleOrderReportServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java index 43101321f..62e2854e1 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java @@ -687,6 +687,7 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService { // 根据入参拉出时间段内所有订单的分账记录 List orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, startTime, endTime); + log.info("查分账记录,站点:{}, 在{}-{}查询到分账数据{}条", stationInfo.getStationName(), startTime, endTime, orderSplitRecords.size()); // orderSplitRecords转为map, key为订单编号, value为分账记录 Map splitRecordMap = orderSplitRecords.stream().collect(Collectors.toMap(OrderSplitRecord::getOrderCode, v -> v)); From 61590a6d18d0ecbb35a0f6da4bb7f0293c1ca412 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 14:33:58 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java index 936fb5b82..9ba93c49b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java @@ -33,6 +33,7 @@ import com.jsowell.pile.service.OrderSplitRecordService; import com.jsowell.pile.service.PileMerchantInfoService; import com.jsowell.pile.vo.OrderInfoDetailVO; import com.jsowell.pile.vo.web.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,6 +43,7 @@ import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +@Slf4j @Service public class OrderSplitRecordServiceImpl implements OrderSplitRecordService { @@ -159,6 +161,7 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService { } // 根据入参拉出时间段内所有订单的分账记录 List orderSplitRecords = orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime); + log.info("根据入参拉出时间段内所有订单的分账记录, 订单数量:{}", orderSplitRecords.size()); // orderSplitRecords中电费分账金额与服务费分账金额为null, 设置0 for (OrderSplitRecord orderSplitRecord : orderSplitRecords) { if (orderSplitRecord.getElectricitySplitAmount() == null) { From 4043933276110292536fc6997ab8b009148220b6 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 14:39:25 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java index 9ba93c49b..f95557e2a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java @@ -161,7 +161,8 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService { } // 根据入参拉出时间段内所有订单的分账记录 List orderSplitRecords = orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime); - log.info("根据入参拉出时间段内所有订单的分账记录, 订单数量:{}", orderSplitRecords.size()); + log.info("根据入参拉出时间段内所有订单的分账记录, merchantId:{}, stationId:{}, startTime:{}, endTime:{}", + merchantId, stationId, startTime, endTime); // orderSplitRecords中电费分账金额与服务费分账金额为null, 设置0 for (OrderSplitRecord orderSplitRecord : orderSplitRecords) { if (orderSplitRecord.getElectricitySplitAmount() == null) { From 786dbcf43123137172411014170c086c24e90ab5 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Mon, 29 Sep 2025 14:45:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=86=E8=B4=A6=E8=AE=B0=E5=BD=95=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/pile/service/impl/SettleOrderReportServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java index 62e2854e1..1eac02b16 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java @@ -686,7 +686,7 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService { log.info("站点:{}, 在{}-{}查询到订单数据{}条,订单编号:{}", stationInfo.getStationName(), startTime, endTime, orderListVOS.size(), collect); // 根据入参拉出时间段内所有订单的分账记录 - List orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, startTime, endTime); + List orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, tradeDate, tradeDate); log.info("查分账记录,站点:{}, 在{}-{}查询到分账数据{}条", stationInfo.getStationName(), startTime, endTime, orderSplitRecords.size()); // orderSplitRecords转为map, key为订单编号, value为分账记录 Map splitRecordMap = orderSplitRecords.stream().collect(Collectors.toMap(OrderSplitRecord::getOrderCode, v -> v));