diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java index 3f35b46..7e1ff0c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java @@ -39,6 +39,7 @@ import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.*; +import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -65,6 +66,8 @@ public class MaintenanceTaskCreateTask { private final DataSourceTransactionManager dataSourceTransactionManager; + private final ThreadPoolExecutor threadPoolExecutor; + private final MaintenanceService maintenanceService; @@ -111,18 +114,20 @@ public class MaintenanceTaskCreateTask { * @return */ public void generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) { - OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class); - //拆分设备 每个设备生成一条任务 - if(StringUtil.isNotBlank(planEntity.getEmCode())){ - List emCodeList = Arrays.asList(planEntity.getEmCode().split(",")); - for(String emCode : emCodeList){ - taskEntity.setEmCode(emCode); + threadPoolExecutor.execute(() -> { + OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class); + //拆分设备 每个设备生成一条任务 + if(StringUtil.isNotBlank(planEntity.getEmCode())){ + List emCodeList = Arrays.asList(planEntity.getEmCode().split(",")); + for(String emCode : emCodeList){ + taskEntity.setEmCode(emCode); + maintenanceService.fillTask(taskEntity,planEntity,flag); + } + } + else { maintenanceService.fillTask(taskEntity,planEntity,flag); } - } - else { - maintenanceService.fillTask(taskEntity,planEntity,flag); - } + }); } /** diff --git a/hzims-service/operational/src/main/resources/db/1.0.1.sql b/hzims-service/operational/src/main/resources/db/1.0.1.sql index 657046f..f382c22 100644 --- a/hzims-service/operational/src/main/resources/db/1.0.1.sql +++ b/hzims-service/operational/src/main/resources/db/1.0.1.sql @@ -1 +1 @@ -alter table hzims_oper_maintenance_plan add station_code varchar(60) comment '站点编码' \ No newline at end of file +alter table hzims_oper_maintenance_plan add column station_code varchar(60) comment '站点编码' \ No newline at end of file