From 35601b1455ec05ece1414bd288fa38944c03bfdd Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 26 九月 2024 20:15:17 +0800
Subject: [PATCH] 修改bug
---
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
index 1918cc5..496022c 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
@@ -186,10 +186,10 @@
GunStatusStatisticsVO gunStatusStatisticsVO = new GunStatusStatisticsVO();
if(CollectionUtils.isEmpty(siteIds)){
- Map<Integer, Integer> modeStatisticsNull = new HashMap<>();
- modeStatisticsNull.put(1, 0);
- modeStatisticsNull.put(2, 0);
- modeStatisticsNull.put(3, 0);
+ List<Map<Integer, Integer>> modeStatisticsNull = new ArrayList<>();
+ modeStatisticsNull.add(new HashMap<>(1,0));
+ modeStatisticsNull.add(new HashMap<>(2,0));
+ modeStatisticsNull.add(new HashMap<>(3,0));
gunStatusStatisticsVO.setModeStatistics(modeStatisticsNull);
Map<Integer, Integer> statusStatisticsNull = new HashMap<>();
statusStatisticsNull.put(1, 0);
@@ -209,22 +209,34 @@
gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatistics);
}
- Map<Integer, Integer> modeStatistics = this.baseMapper.getModeStatistics(siteIds);
+ List<Map<Integer, Integer>> modeStatistics = this.baseMapper.getModeStatistics(siteIds);
+ if(CollectionUtils.isEmpty(modeStatistics)){
+ Map<Integer, Integer> modeStatistics1 = new HashMap<>(3,0);
+ modeStatistics1.put(1, 0);
+ modeStatistics1.put(2, 0);
+ modeStatistics1.put(3, 0);
+ modeStatistics.add(modeStatistics1);
+ }
gunStatusStatisticsVO.setModeStatistics(modeStatistics);
- Map<Integer, Integer> statusStatistics = new HashMap<>();
+ List<Map<Integer, Integer>> statusStatistics = new ArrayList<>();
// 离线
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class)
.eq(TChargingGun::getStatus, 1));
- statusStatistics.put(1, count.intValue());
+ statusStatistics.add(new HashMap<>(1,count.intValue()));
+// statusStatistics.put(1, count.intValue());
// 故障
count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class)
.eq(TChargingGun::getStatus, 7));
- statusStatistics.put(2, count.intValue());
+ statusStatistics.add(new HashMap<>(2,count.intValue()));
+
+// statusStatistics.put(2, count.intValue());
// 充电中
count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class)
.in(TChargingGun::getStatus, Arrays.asList(3,4,5,6)));
- statusStatistics.put(3, count.intValue());
+ statusStatistics.add(new HashMap<>(3,count.intValue()));
+
+// statusStatistics.put(3, count.intValue());
gunStatusStatisticsVO.setModeStatistics(statusStatistics);
List<StatusModeStatisticsVO> statusModeStatisticsVOS = new ArrayList<>();
--
Gitblit v1.7.1