代码格式化

This commit is contained in:
joylink_zhangsai 2020-12-25 09:01:43 +08:00
parent db657689bf
commit f8abb9eddc

View File

@ -124,37 +124,37 @@ public class GenerateTask {
@Transactional @Transactional
public String generateNewTrainings(Long mapId, MapVO mapVO) { public String generateNewTrainings(Long mapId, MapVO mapVO) {
log.warn("generate training start...[{}]", LocalTime.now()); log.warn("generate training start...[{}]", LocalTime.now());
// 查询通用运行图 // 查询通用运行图
RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId()); RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId());
this.delete(mapId); this.delete(mapId);
GenerateConfig config = new GenerateConfig(); GenerateConfig config = new GenerateConfig();
config.setMapId(mapId); config.setMapId(mapId);
List<String> results = new ArrayList<>(); List<String> results = new ArrayList<>();
List<CommandDefinitionVO> commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode()); List<CommandDefinitionVO> commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode());
Map<String, List<CommandDefinitionVO>> groupByPrdType = commandDefinitions.stream() Map<String, List<CommandDefinitionVO>> groupByPrdType = commandDefinitions.stream()
.collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType)); .collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType));
groupByPrdType.forEach((r, cdr) -> { groupByPrdType.forEach((r, cdr) -> {
config.setPrdType(r); config.setPrdType(r);
SimulationBuildParams params = SimulationBuildParams.builder() SimulationBuildParams params = SimulationBuildParams.builder()
.createTime(LocalDateTime.now()) .createTime(LocalDateTime.now())
.map(mapVO) .map(mapVO)
.prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType())) .prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))
.runPlan(planVO) .runPlan(planVO)
.build(); .build();
Simulation simulation = SimulationBuilder.build(params); Simulation simulation = SimulationBuilder.build(params);
Map<String, List<CommandDefinitionVO>> groupByOperationObject = cdr.stream() Map<String, List<CommandDefinitionVO>> groupByOperationObject = cdr.stream()
.collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject)); .collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject));
groupByOperationObject.forEach((o, cdo) -> { groupByOperationObject.forEach((o, cdo) -> {
config.setTrainingType(o); config.setTrainingType(o);
config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList())); config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList()));
List<String> list = this.generateNew(config, mapVO, simulation); List<String> list = this.generateNew(config, mapVO, simulation);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
results.addAll(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 @Async