| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 
 | 
 
 
 
 
 
 
 @Override
 public List<InspectItem> getHourlyInspectRecords(String lineId, String procedureCode, String date) {
 
 List<InspectItem> inspectItems = hbl4Service.selectInspectItemList(lineId, procedureCode);
 if (inspectItems.isEmpty()) {
 throw new IllegalArgumentException("管控线Id和工序编码传入有误");
 }
 
 List<InspectItem> resultList = new ArrayList<>();
 List<Future<InspectItem>> futures = new ArrayList<>();
 ExecutorService executorService = Executors.newCachedThreadPool();
 System.out.println("已经提交资源申请");
 for (InspectItem inspectItem : inspectItems) {
 futures.add(executorService.submit(() -> getHourlyDataTask(inspectItem, LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))));
 }
 futures.stream().forEach(f -> {
 if (!f.isDone()) {
 System.out.printf("资源还没有准备好");
 }
 try {
 resultList.add(f.get());
 } catch (InterruptedException e) {
 e.printStackTrace();
 } catch (ExecutionException e) {
 e.printStackTrace();
 }
 });
 executorService.shutdown();
 return resultList;
 }
 
 |