| | |
| | | } |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | //通过siteIds进行sql查询统计 |
| | | List<SixChargingDto> sixChargingDtos = generateLastSixMonths(); |
| | | List<SixChargingDto> chargingDtos = chargingOrderService.charge(sixBefore, siteIds); |
| | | for (SixChargingDto sixChargingDto : sixChargingDtos) { |
| | | for (SixChargingDto chargingDto : chargingDtos) { |
| | | if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){ |
| | | BeanUtils.copyProperties(chargingDto,sixChargingDto); |
| | | } |
| | | } |
| | | |
| | | return R.ok(chargingDtos); |
| | | } |
| | | |
| | | return R.ok(sixChargingDtos); |
| | | |
| | | } |
| | | |
| | | |
| | | public static List<SixChargingDto> generateLastSixMonths() { |
| | | LocalDate today = LocalDate.now(); |
| | | List<SixChargingDto> months = new ArrayList<>(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); |
| | | |
| | | for (int i = 5; i >= 0; i--) { |
| | | LocalDate date = today.minusMonths(i); |
| | | String month = date.format(formatter); |
| | | SixChargingDto sixChargingDto = new SixChargingDto(); |
| | | sixChargingDto.setMonth(month); |
| | | months.add(sixChargingDto); |
| | | } |
| | | |
| | | return months; |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | //count近6个月的数据 |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | List<SixShopDto> sixShopDtos = shoppingOrderService.sixBefore(sixBefore,status); |
| | | return R.ok(sixShopDtos); |
| | | List<SixShopDto> sixChargingDtos = generateLastSixMonths1(); |
| | | for (SixShopDto sixChargingDto : sixChargingDtos) { |
| | | for (SixShopDto chargingDto : sixShopDtos) { |
| | | if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){ |
| | | BeanUtils.copyProperties(chargingDto,sixChargingDto); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return R.ok(sixChargingDtos); |
| | | } |
| | | |
| | | public static List<SixShopDto> generateLastSixMonths1() { |
| | | LocalDate today = LocalDate.now(); |
| | | List<SixShopDto> months = new ArrayList<>(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); |
| | | |
| | | for (int i = 5; i >= 0; i--) { |
| | | LocalDate date = today.minusMonths(i); |
| | | String month = date.format(formatter); |
| | | SixShopDto sixChargingDto = new SixShopDto(); |
| | | sixChargingDto.setMonth(month); |
| | | months.add(sixChargingDto); |
| | | } |
| | | |
| | | return months; |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | |
| | | // 获取本周一的日期 |
| | | LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); |
| | | |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | System.out.println("本周一是: " + mondayThisWeek); |
| | | } |
| | | else if (statisticsQueryDto.getDayType()==3){ |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | // 获取本月1号的日期 |
| | | YearMonth yearMonth = YearMonth.from(today); |
| | | // start = yearMonth.atDay(1); |