From f8abb9eddc1f80c1ebf3cd5fd6b3b4b7795dfdb9 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 25 Dec 2020 09:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/services/training/GenerateTask.java | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/training/GenerateTask.java b/src/main/java/club/joylink/rtss/services/training/GenerateTask.java index e8aaf89fe..cc479f8ce 100644 --- a/src/main/java/club/joylink/rtss/services/training/GenerateTask.java +++ b/src/main/java/club/joylink/rtss/services/training/GenerateTask.java @@ -124,37 +124,37 @@ public class GenerateTask { @Transactional public String generateNewTrainings(Long mapId, MapVO mapVO) { log.warn("generate training start...[{}]", LocalTime.now()); - // 查询通用运行图 - RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId()); - this.delete(mapId); - GenerateConfig config = new GenerateConfig(); - config.setMapId(mapId); - List results = new ArrayList<>(); - List commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode()); - Map> groupByPrdType = commandDefinitions.stream() - .collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType)); - groupByPrdType.forEach((r, cdr) -> { - config.setPrdType(r); - SimulationBuildParams params = SimulationBuildParams.builder() - .createTime(LocalDateTime.now()) - .map(mapVO) - .prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType())) - .runPlan(planVO) - .build(); - Simulation simulation = SimulationBuilder.build(params); - Map> groupByOperationObject = cdr.stream() - .collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject)); - groupByOperationObject.forEach((o, cdo) -> { - config.setTrainingType(o); - config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList())); - List list = this.generateNew(config, mapVO, simulation); - if (!CollectionUtils.isEmpty(list)) { - results.addAll(list); - } - }); + // 查询通用运行图 + RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId()); + this.delete(mapId); + GenerateConfig config = new GenerateConfig(); + config.setMapId(mapId); + List results = new ArrayList<>(); + List commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode()); + Map> groupByPrdType = commandDefinitions.stream() + .collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType)); + groupByPrdType.forEach((r, cdr) -> { + config.setPrdType(r); + SimulationBuildParams params = SimulationBuildParams.builder() + .createTime(LocalDateTime.now()) + .map(mapVO) + .prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType())) + .runPlan(planVO) + .build(); + Simulation simulation = SimulationBuilder.build(params); + Map> groupByOperationObject = cdr.stream() + .collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject)); + groupByOperationObject.forEach((o, cdo) -> { + config.setTrainingType(o); + config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList())); + List list = this.generateNew(config, mapVO, simulation); + if (!CollectionUtils.isEmpty(list)) { + results.addAll(list); + } }); - log.warn("generate training end...[{}]", LocalTime.now()); - return CollectionUtils.isEmpty(results) ? "成功" : String.join(",", results); + }); + log.warn("generate training end...[{}]", LocalTime.now()); + return CollectionUtils.isEmpty(results) ? "成功" : String.join(",", results); } @Async