| | |
| | | // return map; |
| | | // } |
| | | |
| | | //跨工序次破 |
| | | public Map<String, Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize, |
| | | List<String> selectDate, |
| | | CrossProcessBreakingDTO crossProcessBreakingDTO) { |
| | |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.getProcessBreakingTotal(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO)); |
| | | |
| | | // 等待两个任务执行完毕 |
| | | CompletableFuture.allOf(dataFuture, totalFuture).join(); |
| | | |
| | | try { |
| | | result.put("data", dataFuture.get()); |
| | | result.put("total", totalFuture.get()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("并行查询异常:" + e.getMessage(), e); |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(startDate); |
| | | list.add(endDate); |
| | | result.put("selectDate", list); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | //非跨工序次破 |
| | | public Map<String, Object> notCrossProcessBreakingSv(Integer pageNum, Integer pageSize, |
| | | List<String> selectDate, |
| | | CrossProcessBreakingDTO crossProcessBreakingDTO) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | |
| | | // 默认时间范围:过去 15 天 |
| | | String endDate = LocalDate.now().toString(); |
| | | String startDate = LocalDate.now().minusDays(15).toString(); |
| | | |
| | | if (selectDate != null && selectDate.size() == 2) { |
| | | if (!selectDate.get(0).isEmpty()) { |
| | | startDate = selectDate.get(0); |
| | | } |
| | | if (!selectDate.get(1).isEmpty()) { |
| | | endDate = selectDate.get(1); |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | // 使用异步线程池 |
| | | String finalEndDate = endDate; |
| | | String finalStartDate = startDate; |
| | | CompletableFuture<List<CrossProcessBreakingDTO>> dataFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.getNotProcessBreaking(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO)); |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.getNotProcessBreakingTotal(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO)); |
| | | |
| | | // 等待两个任务执行完毕 |
| | | CompletableFuture.allOf(dataFuture, totalFuture).join(); |
| | |
| | | return reportMapper.exportCrossProcessBreakingMp(dates); |
| | | } |
| | | |
| | | public List exportNotCrossProcessBreakingSv(List<LocalDate> dates) { |
| | | return reportMapper.exportNotCrossProcessBreakingMp(dates); |
| | | } |
| | | |
| | | // public List exportTeamOutputSv(Map<String, Object> dates) { |
| | | // List<LocalDate> date= (List<LocalDate>) dates.get("date"); |
| | | // String process= (String) dates.get("processes"); |