|
|
|
@ -14,6 +14,7 @@ import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
|
|
|
|
|
import com.hnac.hzims.operational.maintenance.mapper.OperMaintenancePlanMapper; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.scheduled.MaintenancePlanCreateTask; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskSchedule; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.template.service.TemplateService; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.vo.OperMaintenancePlanVO; |
|
|
|
@ -54,7 +55,6 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl<OperMaintena
|
|
|
|
|
|
|
|
|
|
private final IDangerSourceClient dangerSourceClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final List<TemplateService> templateService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -95,34 +95,33 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl<OperMaintena
|
|
|
|
|
//获取日常维护计划
|
|
|
|
|
List<OperMaintenancePlanEntity> planEntities = list(new LambdaQueryWrapper<OperMaintenancePlanEntity>(){{ |
|
|
|
|
in(OperMaintenancePlanEntity::getId,idList); |
|
|
|
|
isNotNull(OperMaintenancePlanEntity::getCreateTaskTime); |
|
|
|
|
}}); |
|
|
|
|
//筛选当月没生成任务的计划
|
|
|
|
|
List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().filter(planEntity -> { |
|
|
|
|
Date createTaskTime = planEntity.getCreateTaskTime(); |
|
|
|
|
return ObjectUtil.isEmpty(createTaskTime) |
|
|
|
|
|| !DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(createTaskTime), LocalDate.now()); |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(finalPlanEntities)) { |
|
|
|
|
return R.success("所选计划当天已生成任务"); |
|
|
|
|
} |
|
|
|
|
MaintenanceTaskCreateTask schedule = SpringUtil.getBean(MaintenanceTaskCreateTask.class); |
|
|
|
|
finalPlanEntities.forEach(planEntity -> { |
|
|
|
|
try{ |
|
|
|
|
schedule.generateTaskByPlan(planEntity,false); |
|
|
|
|
//更新任务派发时间
|
|
|
|
|
this.update(new LambdaUpdateWrapper<OperMaintenancePlanEntity>().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date()) |
|
|
|
|
.eq(OperMaintenancePlanEntity::getId,planEntity.getId())); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
catch(Exception e) { |
|
|
|
|
BladeLogger logger = SpringUtil.getBean(BladeLogger.class); |
|
|
|
|
logger.error("maintenance:generateTask",e.getMessage()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MaintenanceTaskSchedule maintenanceTaskSchedule = SpringUtil.getBean(MaintenanceTaskSchedule.class); |
|
|
|
|
planEntities.forEach(plan -> maintenanceTaskSchedule.generateTaskByPlan(plan)); |
|
|
|
|
// //筛选当月没生成任务的计划
|
|
|
|
|
// List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().filter(planEntity -> {
|
|
|
|
|
// Date createTaskTime = planEntity.getCreateTaskTime();
|
|
|
|
|
// return ObjectUtil.isEmpty(createTaskTime)
|
|
|
|
|
// || !DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(createTaskTime), LocalDate.now());
|
|
|
|
|
// }).collect(Collectors.toList());
|
|
|
|
|
// if(CollectionUtil.isEmpty(finalPlanEntities)) {
|
|
|
|
|
// return R.success("所选计划当天已生成任务");
|
|
|
|
|
// }
|
|
|
|
|
// MaintenanceTaskCreateTask schedule = SpringUtil.getBean(MaintenanceTaskCreateTask.class);
|
|
|
|
|
// finalPlanEntities.forEach(planEntity -> {
|
|
|
|
|
// try{
|
|
|
|
|
// schedule.generateTaskByPlan(planEntity,false);
|
|
|
|
|
// //更新任务派发时间
|
|
|
|
|
// this.update(new LambdaUpdateWrapper<OperMaintenancePlanEntity>().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date())
|
|
|
|
|
// .eq(OperMaintenancePlanEntity::getId,planEntity.getId()));
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// catch(Exception e) {
|
|
|
|
|
// BladeLogger logger = SpringUtil.getBean(BladeLogger.class);
|
|
|
|
|
// logger.error("maintenance:generateTask",e.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|