From 2c304a0ca353bd718aacda5b24bdcce201d4768f Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 24 十月 2024 17:46:26 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 16 ++++---- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 63 ++++++++++++++++++------------- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java | 2 + 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java index c97801a..8fabc3d 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java @@ -14,6 +14,8 @@ public class ChargingBillListVO extends TChargingBill { @ApiModelProperty(value = "账单周期") private String billWeek; + @ApiModelProperty(value = "账户类型名称") + private String payTypeName; @ApiModelProperty(value = "充电时间 秒") private Integer chargingSecond; 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 aba5d81..732262c 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 @@ -263,8 +263,8 @@ serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(BigDecimal.valueOf(0.006)) + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006)) .setScale(2,RoundingMode.HALF_DOWN)); } // 累加平台分佣 @@ -296,7 +296,7 @@ chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:orderAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); - chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount); + chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount()) @@ -352,8 +352,6 @@ chargingBillVO.setCategory(""); chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { - - // 累加实收金额 支付金额减去退款金额 if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); @@ -376,8 +374,8 @@ serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006"))); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -398,13 +396,13 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(paymentAmountTotal); - chargingBillVO.setOrderAmount(orderAmountTotal); - chargingBillVO.setElectrovalence(electrovalenceTotal); - chargingBillVO.setServiceCharge(serviceChargeTotal); + chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); - chargingBillVO.setCommissionAmount(commissionAmountTotal); - chargingBillVO.setSharingAmount(sharingAmountTotal); + chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setDiscount(discountTotal); @@ -503,7 +501,18 @@ orderCount+=tChargingOrders.size(); chargingBillVO.setCategory(""); chargingBillVO.setExportList(tChargingOrders); + for (TChargingOrder tChargingOrder : tChargingOrders) { + if (tChargingOrder.getRechargePaymentType()!=null && tChargingOrder.getRechargePaymentType()==1){ + chargingBillListVO.setPayTypeName("微信商户"); + } + if (tChargingOrder.getRechargePaymentType()!=null && tChargingOrder.getRechargePaymentType()==2){ + if (StringUtils.hasLength(chargingBillListVO.getPayTypeName())){ + chargingBillListVO.setPayTypeName("微信商户+支付宝商户"); + }else{ + chargingBillListVO.setPayTypeName("支付宝商户"); + } + } List<Site> data = siteClient.getSiteByIds(Arrays.asList(tChargingOrder.getSiteId())).getData(); if (!data.isEmpty()){ chargingBillVO.setSiteName(data.get(0).getName()); @@ -614,8 +623,8 @@ serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(BigDecimal.valueOf(0.006)).setScale(2,RoundingMode.HALF_DOWN)); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -638,8 +647,8 @@ chargingBillListVO.setOrderAmount(orderAmount); chargingBillListVO.setElectrovalence(electrovalence); chargingBillListVO.setServiceCharge(serviceCharge.setScale(2,RoundingMode.HALF_DOWN)); - chargingBillListVO.setCommissionAmount(commissionAmount); - chargingBillListVO.setSharingAmount(sharingAmount); + chargingBillListVO.setCommissionAmount(commissionAmount.setScale(2,RoundingMode.HALF_DOWN)); + chargingBillListVO.setSharingAmount(sharingAmount.setScale(2,RoundingMode.HALF_DOWN)); chargingBillListVO.setChargingCapacity(chargingCapacity); switch (chargingBillListVO.getType()){ case 1: @@ -729,9 +738,9 @@ serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006")).setScale(2, RoundingMode.HALF_DOWN)); - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006")).setScale(2, RoundingMode.HALF_DOWN)); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -753,14 +762,14 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(paymentAmountTotal); - chargingBillVO.setOrderAmount(orderAmountTotal); - chargingBillVO.setElectrovalence(electrovalenceTotal); - chargingBillVO.setServiceCharge(serviceChargeTotal); + chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); - chargingBillVO.setCommissionAmount(commissionAmountTotal); - chargingBillVO.setSharingAmount(sharingAmountTotal); - chargingBillVO.setDiscount(discountTotal); + chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setDiscount(discountTotal.setScale(2, RoundingMode.HALF_DOWN)); pageInfo.setRecords(list); chargingBillVO.setList(pageInfo); return chargingBillVO; 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 92be7ad..638f31c 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 @@ -1280,8 +1280,8 @@ chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); BigDecimal bigDecimal = new BigDecimal("0.006"); - if (chargingOrderListVO.getServiceCharge()!=null){ - chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getServiceCharge().multiply(bigDecimal)); + if (chargingOrderListVO.getOrderAmount()!=null){ + chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal)); } chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount()); chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); @@ -1497,8 +1497,8 @@ chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); - if (chargingOrder.getServiceCharge()!=null){ - chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getServiceCharge().multiply(bigDecimal)); + if (chargingOrder.getOrderAmount()!=null){ + chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getOrderAmount().multiply(bigDecimal)); } chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence()); chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge()); @@ -2285,10 +2285,10 @@ } if (tChargingOrder.getRefundStatus()!=null &&tChargingOrder.getRefundStatus() == 2){ // 如果成功退款 那么减去退款金额 - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount().subtract(tChargingOrder.getRefundAmount())); + paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); }else{ if (tChargingOrder.getPaymentAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); + paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); } } } @@ -2296,8 +2296,8 @@ commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); // 订单手续费 订单支付金额 - 退款金额*0.6% orderCommission = paymentAmount.multiply(new BigDecimal("0.006")); - tSettlementConfirm.setSharingAmount(sharingAmount); - tSettlementConfirm.setCommissionAmount(commissionAmount); + tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); + tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setElectrovalence(electrovalence); // 服务费=总服务费-三费收费-交易手续费-交易手续费-服务费会员抵扣-服务费优惠券抵扣 tSettlementConfirm.setServiceCharge(serviceCharge.subtract(commissionAmount).subtract(sharingAmount).subtract(orderCommission).subtract(vipDiscount).subtract(couponDiscount)); -- Gitblit v1.7.1