puzhibing
2024-09-24 34182c18b4bdd81ab7d59d4e8441cd9134477c15
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,27 @@
            gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatistics);
        }
        Map<Integer, Integer> modeStatistics = this.baseMapper.getModeStatistics(siteIds);
        List<Map<Integer, Integer>> modeStatistics = this.baseMapper.getModeStatistics(siteIds);
        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<>();