From be1ab2eb2032a747a409fb765ec90f76c3116c51 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 01 十一月 2024 09:15:25 +0800
Subject: [PATCH] merge

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
index 171a350..06a4e3f 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -229,17 +229,22 @@
 		siteList.setPageSize(99999);
 		PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList);
 		for (GetSiteListDTO record : list.getRecords()) {
-			Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
+			List<Integer> c1 = new ArrayList<>();
+			c1.add(3);
+			c1.add(4);
+			c1.add(5);
+			c1.add(6);
+			Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
 			record.setC1(count);
-			Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
+			Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count();
 			record.setC2(count1);
-			Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
+			Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
 			record.setK1(count2);
-			Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
+			Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count();
 			record.setK2(count3);
-			Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
+			Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
 			record.setM1(count4);
-			Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
+			Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count();
 			record.setM2(count5);
 
 			//利用率
@@ -295,14 +300,7 @@
 	@ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"})
 	public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){
 
-		if (chargingPercentProvinceDto.getDate1()==null){
-			LocalDate today = LocalDate.now();
-			LocalDate lastMonth = today.minusMonths(1);
-			LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1);
-			LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
-			chargingPercentProvinceDto.setDate1(firstDayOfLastMonth);
-			chargingPercentProvinceDto.setDate2(lastDayOfLastMonth);
-		}
+
 
 
 
@@ -316,6 +314,9 @@
 		List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords();
 		List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList());
 		// 通过时间段获取和充电桩id获取各个充电站的充电订单
+		if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){
+			chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1));
+		}
 			List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData();
 		// 计算利用率展示
 		for (ChargingOrderGroup datum : data) {
@@ -325,7 +326,7 @@
 				bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower());
 			}
 
-			long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1;
+			long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2());
 			BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween));
 			//得到利用率
 			BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP);

--
Gitblit v1.7.1