| | |
| | | public ProductionTurnoverDto workInProcessTurnover() { |
| | | ProductionTurnoverDto productionTurnoverDto = new ProductionTurnoverDto(); |
| | | ProductWorkOrderDto workOrder = new ProductWorkOrderDto(); |
| | | workOrder.setPlanStartTime(LocalDate.now().minusMonths(1)); |
| | | workOrder.setPlanEndTime(LocalDate.now()); |
| | | workOrder.setPlanStartTime(LocalDateTime.now()); |
| | | workOrder.setPlanEndTime(LocalDateTime.now()); |
| | | List<ProductWorkOrderDto> productWorkOrders = productWorkOrderMapper |
| | | .pageProductWorkOrder(new Page<>(1, -1), workOrder).getRecords(); |
| | | long sum = productWorkOrders.stream() |
| | |
| | | |
| | | @Override |
| | | public List<MapDto> processOutputAnalysis(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate; |
| | | LocalDate endDate = today; |
| | | // 获取当前时间点 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startDateTime; |
| | | LocalDateTime endDateTime = now.with(LocalTime.MAX); |
| | | |
| | | switch (type) { |
| | | case 1: // 周 |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDateTime = now.with(DayOfWeek.MONDAY).with(LocalTime.MIN); |
| | | break; |
| | | case 2: // 月 |
| | | startDate = today.withDayOfMonth(1); |
| | | startDateTime = now.withDayOfMonth(1).with(LocalTime.MIN); |
| | | break; |
| | | case 3: // 季度 |
| | | int currentMonth = today.getMonthValue(); |
| | | int currentMonth = now.getMonthValue(); |
| | | int startMonth = ((currentMonth - 1) / 3) * 3 + 1; |
| | | startDate = LocalDate.of(today.getYear(), startMonth, 1); |
| | | startDateTime = LocalDateTime.of(now.getYear(), startMonth, 1, 0, 0, 0); |
| | | break; |
| | | default: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDateTime = now.with(DayOfWeek.MONDAY).with(LocalTime.MIN); |
| | | break; |
| | | } |
| | | |
| | | ProductWorkOrderDto queryDto = new ProductWorkOrderDto(); |
| | | queryDto.setPlanStartTime(startDate); |
| | | queryDto.setPlanEndTime(endDate); |
| | | queryDto.setPlanStartTime(startDateTime); |
| | | queryDto.setPlanEndTime(endDateTime); |
| | | |
| | | List<ProductWorkOrderDto> list = productWorkOrderMapper.pageProductWorkOrder(new Page<>(1, -1), queryDto) |
| | | .getRecords(); |
| | |
| | | BigDecimal total = processOutputMap.values().stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | if (BigDecimal.ZERO.compareTo(total) == 0) { |
| | | if (total.compareTo(BigDecimal.ZERO) == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |