From a85b63f3e4d933df586714ea91c69a3fd5d16b99 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 06 十二月 2024 11:56:07 +0800 Subject: [PATCH] 合作商权限 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 39 insertions(+), 9 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 4085b34..28352ad 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 @@ -4,6 +4,7 @@ import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserCar; +import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; import com.ruoyi.chargingPile.api.feignClient.SiteClient; @@ -11,6 +12,7 @@ import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; import com.ruoyi.order.api.model.TChargingOrder; @@ -88,6 +90,20 @@ startTime1 = split[0]; startTime2 = split[1]; } + Long userId = SecurityUtils.getUserId(); + //如果没传siteId,获取当前登陆人所有的siteIds + List<Integer> siteIds = new ArrayList<>(); + if (dto.getSiteId()==null){ + if (userId != null){ + List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); + for (GetSiteListDTO datum : data) { + siteIds.add(datum.getId()); + } + } + }else { + siteIds.add(dto.getSiteId()); + } + dto.setSiteIds(siteIds); PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); List<ChargingBillListVO> list = this.baseMapper.chargingBillList1(pageInfo,dto,startTime1,startTime2); @@ -266,7 +282,7 @@ if (data3!=null)tChargingOrder.setUserName(data3.getName()); // 累加实收金额 支付结算金额 if (tChargingOrder.getChargeAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); + paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); } // 总金额 if (tChargingOrder.getOrderAmount()!=null){ @@ -383,7 +399,7 @@ chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { if (tChargingOrder.getOrderAmount()!=null){ - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); + paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getRechargeAmount()); } // 累加订单金额 @@ -469,6 +485,19 @@ } PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); + Long userId = SecurityUtils.getUserId(); + //如果没传siteId,获取当前登陆人所有的siteIds + List<Integer> siteIds = new ArrayList<>(); + if (dto.getSiteId()==null){ + if (userId != null){ + List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); + for (GetSiteListDTO datum : data) { + siteIds.add(datum.getId()); + } + } + }else { + siteIds.add(dto.getSiteId()); + } List<ChargingBillListVO> list = this.baseMapper.chargingBillList(pageInfo,dto,startTime1,startTime2); List<ChargingBillListVO> list1 = this.baseMapper.chargingBillList(pageInfo1,dto,startTime1,startTime2); BigDecimal paymentAmountTotal = new BigDecimal("0"); @@ -479,7 +508,7 @@ BigDecimal sharingAmountTotal = new BigDecimal("0"); BigDecimal chargingCapacityTotal = new BigDecimal("0"); BigDecimal discountTotal = new BigDecimal("0"); - BigDecimal refundAmount = new BigDecimal("0"); + BigDecimal refundAmountTotal = new BigDecimal("0"); int orderCount = 0; for (ChargingBillListVO chargingBillListVO : list) { String temp = ""; @@ -538,6 +567,7 @@ BigDecimal commissionAmount = new BigDecimal("0"); BigDecimal sharingAmount = new BigDecimal("0"); BigDecimal chargingCapacity = new BigDecimal("0"); + BigDecimal refundAmount = new BigDecimal("0"); chargingBillVO.setCategory(""); chargingBillListVO.setOrderCount(tChargingOrders.size()); chargingBillVO.setExportList(tChargingOrders); @@ -753,9 +783,9 @@ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); } // 累加订单金额 - if (tChargingOrder.getOrderAmount()!=null){ - orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); - orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount()); + if (tChargingOrder.getRechargeAmount()!=null){ + orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); + orderAmountTotal = orderAmountTotal.add(tChargingOrder.getRechargeAmount()); } // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ @@ -763,7 +793,7 @@ electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); } if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus() !=null && tChargingOrder.getRefundStatus() == 2){ - refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); + refundAmountTotal = refundAmountTotal.add(tChargingOrder.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -796,8 +826,8 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(orderAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); - chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); + chargingBillVO.setPaymentAmount(paymentAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); + chargingBillVO.setOrderAmount(orderAmountTotal.subtract(refundAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setOrderCount(orderCount); -- Gitblit v1.7.1