|
|
|
@ -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<String> 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<String> 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); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|