From 1167ff4a569fa05d557bb8cdeb00db13f68950a6 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 05 十一月 2024 19:05:40 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 31 ++++++++++++++++++++++++------- 1 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java index 670b61d..9a4ec48 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java @@ -10,6 +10,7 @@ import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; +import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; import com.ruoyi.order.api.model.TChargingOrder; @@ -40,6 +41,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -286,7 +288,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); + commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) + .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -335,6 +338,8 @@ // 充电时间秒 chargingBillListVO.setChargingSecond(chargingSecond); } + BigDecimal bigDecimal = new BigDecimal("0"); + for (ChargingBillListVO chargingBillListVO : list1) { if (chargingBillListVO.getType()==2){ continue; @@ -389,6 +394,11 @@ .eq(TChargingOrderRefund::getRefundStatus, 2).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { refundAmountTotal =refundAmountTotal.add(tChargingOrderRefund.getRefundAmount()); + tChargingOrder.setRefundAmount(tChargingOrderRefund.getRefundAmount()); + tChargingOrder.setRefundContent(tChargingOrderRefund.getRefundReason()); + tChargingOrder.setRefundCode(tChargingOrderRefund.getRefundCode()); + tChargingOrder.setRefundTime1(DateUtils.localDateTimeToString(tChargingOrderRefund.getRefundTime())); + bigDecimal = bigDecimal.add(tChargingOrderRefund.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -396,7 +406,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) + .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -426,7 +437,11 @@ chargingBillVO.setSharingAmount(sharingAmountTotal); chargingBillVO.setDiscount(discountTotal); chargingBillVO.setRefundAmount(refundAmountTotal); - chargingBillVO.setExportList(tChargingOrders1); + List<TChargingOrder> collect = tChargingOrders1.stream().distinct().collect(Collectors.toList()); + if (!collect.isEmpty()){ + collect.get(0).setRefundAmount1(bigDecimal); + } + chargingBillVO.setExportList(collect); pageInfo.setRecords(list); chargingBillVO.setList(pageInfo); return chargingBillVO; @@ -641,7 +656,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); + commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) + .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -684,7 +700,7 @@ chargingBillListVO.setChargingSecond(chargingSecond); } for (ChargingBillListVO chargingBillListVO : list1) { - if (chargingBillListVO.getType() ==1){ + if (chargingBillListVO.getType() ==2){ continue; } LocalDateTime billTime = chargingBillListVO.getBillTime(); @@ -752,8 +768,9 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); + commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN)); + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) + .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ -- Gitblit v1.7.1