From bc044659ae5fde6c1ab32e416db77d81ca2952d6 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 20 三月 2025 10:01:51 +0800
Subject: [PATCH] 修改报表bug

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |  124 +++++++++++++---------------------------
 1 files changed, 41 insertions(+), 83 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 39274ab..f41a782 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
@@ -1287,7 +1287,6 @@
 			endTime2 = split[1];
 		}
 		PageInfo<ChargingOrderVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize());
-		PageInfo<ChargingOrderVO> pageInfo1 = new PageInfo<>(1,999999999);
 
 		if (StringUtils.hasLength(dto.getPhone())){
 			List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData();
@@ -1333,7 +1332,14 @@
 		if (siteIds.isEmpty())siteIds.add(-1);
 		dto.setSiteIds(siteIds);
 		List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2);
-		List<ChargingOrderVO> list1 = this.baseMapper.chargingOrder(pageInfo1,dto,startTime1,startTime2,endTime1,endTime2);
+		List<ChargingOrderVO> list1 = this.baseMapper.chargingOrderNolimit(dto,startTime1,startTime2,endTime1,endTime2);
+		 BigDecimal total = new BigDecimal("0");
+		 long time = 0L;
+		 BigDecimal electronicMoney = new BigDecimal("0");
+		 BigDecimal serviceMoney = new BigDecimal("0");
+		 BigDecimal commissionMoney = new BigDecimal("0");
+		 BigDecimal refundMoney = new BigDecimal("0");
+		 BigDecimal paymentMoney = new BigDecimal("0");
 		List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list();
 
 		for (ChargingOrderVO chargingOrderVO : list) {
@@ -1402,13 +1408,13 @@
 
 		List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery()
 				.eq(TChargingOrderRefund::getRefundStatus,2).list();
-	
-	    BigDecimal total = new BigDecimal("0");
-	    long time = 0L;
-	    BigDecimal electronicMoney = new BigDecimal("0");
-	    BigDecimal serviceMoney = new BigDecimal("0");
-	    BigDecimal refundMoney = new BigDecimal("0");
-	    BigDecimal paymentMoney = new BigDecimal("0");
+
+//	    BigDecimal total = new BigDecimal("0");
+//	    long time = 0L;
+//	    BigDecimal electronicMoney = new BigDecimal("0");
+//	    BigDecimal serviceMoney = new BigDecimal("0");
+//	    BigDecimal refundMoney = new BigDecimal("0");
+//	    BigDecimal paymentMoney = new BigDecimal("0");
 		for (ChargingOrderVO chargingOrderVO : list1) {
 			if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){
 				continue;
@@ -1813,48 +1819,24 @@
 				for (TChargingOrderAccountingStrategy temp : list2) {
 					switch (temp.getType()){
 						case 1:
-							if (temp.getChargingCapacity()!=null){
-								jian = jian.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								jianElectronic = jianElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								jianService = jianService.add(temp.getServiceCharge());
-							}
+							jian = jian.add(temp.getChargingCapacity());
+							jianElectronic = jianElectronic.add(temp.getPeriodElectricPrice()).add(temp.getPeriodServicePrice());
+							jianService = jianService.add(temp.getPeriodServicePrice());
 							break;
 						case 2:
-							if (temp.getChargingCapacity()!=null){
-								feng = feng.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								fengElectronic = fengElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								fengService = fengService.add(temp.getServiceCharge());
-							}
+							feng = feng.add(temp.getChargingCapacity());
+							fengElectronic = fengElectronic.add(temp.getPeriodElectricPrice()).add(temp.getPeriodServicePrice());
+							fengService = fengService.add(temp.getPeriodServicePrice());
 							break;
 						case 3:
-							if (temp.getChargingCapacity()!=null){
-								ping = ping.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								pingElectronic = pingElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								pingService = pingService.add(temp.getServiceCharge());
-							}
+							ping = ping.add(temp.getChargingCapacity());
+							pingElectronic = pingElectronic.add(temp.getPeriodElectricPrice()).add(temp.getPeriodServicePrice());
+							pingService = pingService.add(temp.getPeriodServicePrice());
 							break;
 						case 4:
-							if (temp.getChargingCapacity()!=null){
-								gu = gu.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								guElectronic = guElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								guService = guService.add(temp.getServiceCharge());
-							}
+							gu = gu.add(temp.getChargingCapacity());
+							guElectronic = guElectronic.add(temp.getPeriodElectricPrice()).add(temp.getPeriodServicePrice());
+							guService = guService.add(temp.getPeriodServicePrice());
 							break;
 					}
 				}
@@ -1862,50 +1844,27 @@
 				List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategies.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderListVO.getId()))
 						.collect(Collectors.toList());
 				for (TChargingOrderAccountingStrategy temp : list2) {
+					BigDecimal multiply = temp.getPeriodServicePrice().multiply(new BigDecimal("0.8"));
 					switch (temp.getType()){
 						case 1:
-							if (temp.getChargingCapacity()!=null){
-								jian = jian.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								jianElectronic = jianElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								jianService = jianService.add(temp.getServiceCharge().multiply(new BigDecimal("0.2").setScale(2,BigDecimal.ROUND_HALF_UP)));
-							}
+							jian = jian.add(temp.getChargingCapacity());
+							jianElectronic = jianElectronic.add(temp.getPeriodElectricPrice()).add(multiply);
+							jianService = jianService.add(multiply);
 							break;
 						case 2:
-							if (temp.getChargingCapacity()!=null){
-								feng = feng.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								fengElectronic = fengElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								fengService = fengService.add(temp.getServiceCharge().multiply(new BigDecimal("0.2").setScale(2,BigDecimal.ROUND_HALF_UP)));
-							}
+							feng = feng.add(temp.getChargingCapacity());
+							fengElectronic = fengElectronic.add(temp.getPeriodElectricPrice()).add(multiply);
+							fengService = fengService.add(multiply);
 							break;
 						case 3:
-							if (temp.getChargingCapacity()!=null){
-								ping = ping.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								pingElectronic = pingElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								pingService = pingService.add(temp.getServiceCharge().multiply(new BigDecimal("0.2").setScale(2,BigDecimal.ROUND_HALF_UP)));
-							}
+							ping = ping.add(temp.getChargingCapacity());
+							pingElectronic = pingElectronic.add(temp.getPeriodElectricPrice()).add(multiply);
+							pingService = pingService.add(multiply);
 							break;
 						case 4:
-							if (temp.getChargingCapacity()!=null){
-								gu = gu.add(temp.getChargingCapacity());
-							}
-							if (temp.getElectrovalence()!=null){
-								guElectronic = guElectronic.add(temp.getElectrovalence());
-							}
-							if (temp.getServiceCharge()!=null){
-								guService = guService.add(temp.getServiceCharge().multiply(new BigDecimal("0.2").setScale(2,BigDecimal.ROUND_HALF_UP)));
-							}
+							gu = gu.add(temp.getChargingCapacity());
+							guElectronic = guElectronic.add(temp.getPeriodElectricPrice()).add(multiply);
+							guService = guService.add(multiply);
 							break;
 					}
 				}
@@ -1917,7 +1876,6 @@
 		chargingOrderTimeVO.setElectrovalence(electrovalence.setScale(2, BigDecimal.ROUND_HALF_EVEN));
 		chargingOrderTimeVO.setServiceCharge(serviceCharge.setScale(2, BigDecimal.ROUND_HALF_EVEN));
 		// 计算尖峰平谷充电到账占比
-
 		BigDecimal add = jianElectronic.add(fengElectronic).add(pingElectronic).add(guElectronic);
 		// 计算尖峰平谷服务费占比
 		BigDecimal add1 = jianService.add(fengService).add(pingService).add(guService);
@@ -2612,7 +2570,7 @@
 		return this.baseMapper.queryPowerLevel(siteIds,statisticsQueryDto);
 	}
 
-	
+
 
 	@Override
 	public List<Map<String, Object>> usersDay(ChargingStatisticsQueryDto statisticsQueryDto) {

--
Gitblit v1.7.1