| | |
| | | |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getDateData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(maps1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("paymentAmount", 0); |
| | | timeMap.put("paymoney", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | |
| | | charMap.add(timeMap); |
| | | } |
| | | } |
| | | |
| | | tCharingOrderMapVO.setMaps1(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | |
| | | |
| | | |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getYearData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==5){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getByDate(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | } |
| | | |
| | | |