| | |
| | | int points; |
| | | |
| | | if (type == null) type = 1; |
| | | if (type == 1) { // 日 |
| | | points = 1; |
| | | startDate = now; |
| | | formatter = DateTimeFormatter.ofPattern("MM-dd"); |
| | | } else if (type == 2) { // 周 |
| | | |
| | | if (type == 1) { // 周 |
| | | startDate = now.with(DayOfWeek.MONDAY); |
| | | points = (int) ChronoUnit.DAYS.between(startDate, now) + 1; |
| | | formatter = DateTimeFormatter.ofPattern("MM-dd"); |
| | | } else { // 月 |
| | | } else if (type == 2) { // 月 |
| | | startDate = now.with(TemporalAdjusters.firstDayOfMonth()); |
| | | points = now.getDayOfMonth(); |
| | | formatter = DateTimeFormatter.ofPattern("MM-dd"); |
| | | } else { // 年 |
| | | startDate = now.with(TemporalAdjusters.firstDayOfYear()); |
| | | points = now.getMonthValue(); |
| | | formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | } |
| | | |
| | | Map<String, PlanTrendsDto> resultMap = new LinkedHashMap<>(); |
| | | for (int i = 0; i < points; i++) { |
| | | String label = startDate.plusDays(i).format(formatter); |
| | | String label = (type == 3) |
| | | ? startDate.plusMonths(i).format(formatter) |
| | | : startDate.plusDays(i).format(formatter); |
| | | PlanTrendsDto dto = new PlanTrendsDto(); |
| | | dto.setDateStr(label); |
| | | dto.setPlannedVolume(BigDecimal.ZERO); |