| | |
| | | BigDecimal::add)); |
| | | |
| | | |
| | | |
| | | Map<String, BigDecimal> expenseMap = expenseList.stream() |
| | | .collect(Collectors.toMap( |
| | | IncomeExpenseAnalysisDto::getDateStr, |
| | |
| | | LocalDate endDate = range[1]; |
| | | |
| | | String startStr = startDate.toString(); |
| | | String endStr = endDate.toString(); |
| | | String endStr = endDate.plusDays(1).toString(); |
| | | |
| | | List<QualityInspect> list = qualityInspectMapper.selectList( |
| | | new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getInspectType, inspectType) |
| | | .eq(QualityInspect::getInspectState, 1) |
| | | .ge(QualityInspect::getCheckTime, startStr) |
| | | .le(QualityInspect::getCheckTime, endStr)); |
| | | .lt(QualityInspect::getCheckTime, endStr)); |
| | | |
| | | return buildQualifiedAnalysis(list); |
| | | } |
| | | |
| | | private LocalDate[] calcDateRange(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | int rangeType = (type == null) ? 1 : type; |
| | | LocalDate anchor = LocalDate.now(); |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | |
| | | switch (type) { |
| | | case 1: // 周 |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | switch (rangeType) { |
| | | case 2: // 近一月 |
| | | startDate = anchor.minusMonths(1).plusDays(1); |
| | | break; |
| | | case 2: // 月 |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | case 3: // 近一季度 |
| | | startDate = anchor.minusMonths(3).plusDays(1); |
| | | break; |
| | | case 3: // 季度 |
| | | int currentMonth = today.getMonthValue(); |
| | | int startMonth = ((currentMonth - 1) / 3) * 3 + 1; |
| | | startDate = LocalDate.of(today.getYear(), startMonth, 1); |
| | | endDate = LocalDate.of(today.getYear(), startMonth + 2, 1) |
| | | .with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 1: // 近一周 |
| | | default: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | startDate = anchor.minusDays(6); |
| | | break; |
| | | } |
| | | |
| | | return new LocalDate[]{startDate, endDate}; |
| | | return new LocalDate[]{startDate, anchor}; |
| | | } |
| | | |
| | | private QualityQualifiedAnalysisDto buildQualifiedAnalysis(List<QualityInspect> list) { |