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