| | |
| | | //判断夹胶和夹胶后工序 |
| | | //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC") |
| | | if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){ |
| | | clos.put(uniqueList.get(i).get("process"), 14+i); |
| | | clos.put(uniqueList.get(i).get("process"), 15+i); |
| | | } |
| | | //判断中空和中空后工序 |
| | | //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD") |
| | |
| | | // } |
| | | |
| | | public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize, |
| | | String selectTime1, String selectTime2, |
| | | List<String> selectDate, |
| | | String reportTime, |
| | | String selectProcesses, TeamOutputDTO teamOutputDTO) { |
| | | if ("all".equals(selectProcesses)) { |
| | | selectProcesses = ""; |
| | | } |
| | | // 默认时间范围:过去 15 天(日期 + reportTime) |
| | | String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime); |
| | | String endDate = toReportTime(LocalDate.now().toString(), reportTime); |
| | | |
| | | // 如果前端传了时间,就用前端日期 + reportTime |
| | | if (selectDate != null && selectDate.size() == 2) { |
| | | if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) { |
| | | startDate = toReportTime(selectDate.get(0), reportTime); |
| | | } |
| | | if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) { |
| | | endDate = toReportTime(selectDate.get(1), reportTime); |
| | | } |
| | | } |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | String laminating = reportMapper.getLaminating(selectProcesses); |
| | | |
| | | String finalStartDate = startDate; |
| | | String finalEndDate = endDate; |
| | | String finalSelectProcesses = selectProcesses; |
| | | CompletableFuture<List<TeamOutputDTO>> dataFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputMp(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputMp(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | CompletableFuture<List<Map<String, String>>> processFuture = asyncExecutor.runAsync(() -> |
| | | productionSchedulingMapper.selectProcess()); |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputPageTotal(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | |
| | | CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputFootSum(selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputFootSum(finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | // 等待所有任务完成 |
| | | CompletableFuture.allOf(dataFuture, processFuture, totalFuture, footSumFuture).join(); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | String laminating = reportMapper.getLaminating(process); |
| | | List<TeamOutputDTO> list = reportMapper.exportTeamOutputMp(date, process, laminating); |
| | | |
| | | // 清洗每个 TeamOutputDTO 实例的 String 字段(去除前后空格) |
| | | for (TeamOutputDTO dto : list) { |
| | | for (Field field : dto.getClass().getDeclaredFields()) { |
| | | field.setAccessible(true); |
| | | try { |
| | | Object value = field.get(dto); |
| | | if (value instanceof String) { |
| | | String trimmed = ((String) value).trim(); |
| | | field.set(dto, trimmed); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | public List exportTeamOutputSummarySv(Map<String, Object> dates) { |
| | | List<LocalDate> date= (List<LocalDate>) dates.get("date"); |
| | | String process= (String) dates.get("processes"); |
| | | if (process.equals("all")){ |
| | | process=""; |
| | | } |
| | | String laminating = reportMapper.getLaminating(process); |
| | | List<TeamOutputDTO> list = reportMapper.exportTeamOutputSummaryMp(date, process, laminating); |
| | | |
| | | // 清洗每个 TeamOutputDTO 实例的 String 字段(去除前后空格) |
| | | for (TeamOutputDTO dto : list) { |
| | |
| | | } |
| | | |
| | | totalSumMap.put("stockNum", totalStockNum); |
| | | totalSumMap.put("stockArea", totalStockArea); |
| | | totalSumMap.put("stockArea", Double.valueOf(String.format("%.2f", totalStockArea))); |
| | | |
| | | map.put("data", resultList); |
| | | map.put("total", totalSumMap); |
| | |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> TeamOutputSummarySv(Integer pageNum, Integer pageSize, List<String> selectDate, |
| | | String reportTime, String selectProcesses, TeamOutputDTO teamOutputDTO) { |
| | | if ("all".equals(selectProcesses)) { |
| | | selectProcesses = ""; |
| | | } |
| | | |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | |
| | | // 默认时间范围:过去 15 天(日期 + reportTime) |
| | | String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime); |
| | | String endDate = toReportTime(LocalDate.now().toString(), reportTime); |
| | | |
| | | // 如果前端传了时间,就用前端日期 + reportTime |
| | | if (selectDate != null && selectDate.size() == 2) { |
| | | if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) { |
| | | startDate = toReportTime(selectDate.get(0), reportTime); |
| | | } |
| | | if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) { |
| | | endDate = toReportTime(selectDate.get(1), reportTime); |
| | | } |
| | | } |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | String laminating = reportMapper.getLaminating(selectProcesses); |
| | | |
| | | String finalSelectProcesses = selectProcesses; |
| | | String finalStartDate = startDate; |
| | | String finalEndDate = endDate; |
| | | CompletableFuture<List<TeamOutputDTO>> dataFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.TeamOutputSummaryMp(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | CompletableFuture<List<Map<String, String>>> processFuture = asyncExecutor.runAsync(() -> |
| | | productionSchedulingMapper.selectProcess()); |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputSummaryPageTotal(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | |
| | | |
| | | CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputFootSum(finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | // 等待所有任务完成 |
| | | CompletableFuture.allOf(dataFuture, processFuture, totalFuture, footSumFuture).join(); |
| | | |
| | | try { |
| | | result.put("data", dataFuture.get()); |
| | | result.put("process", processFuture.get()); |
| | | result.put("total", totalFuture.get()); |
| | | result.put("footSum", footSumFuture.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; |
| | | } |
| | | } |