|
|
|
@ -6,12 +6,22 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.*; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.*; |
|
|
|
import org.springblade.hzinfo_inspect.obj.services.*; |
|
|
|
import org.springblade.hzinfo_inspect.obj.services.*; |
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants.PlanCycleEnum; |
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants.PlanCycleEnum; |
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants.PlanTypeEnum; |
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants.PlanTypeEnum; |
|
|
|
import org.springblade.hzinfo_inspect.plan.entity.*; |
|
|
|
import org.springblade.hzinfo_inspect.plan.entity.*; |
|
|
|
import org.springblade.hzinfo_inspect.plan.service.*; |
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanObjectTemplateService; |
|
|
|
|
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanOrgService; |
|
|
|
|
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanPositionService; |
|
|
|
|
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanUserService; |
|
|
|
import org.springblade.hzinfo_inspect.task.TaskContants; |
|
|
|
import org.springblade.hzinfo_inspect.task.TaskContants; |
|
|
|
import org.springblade.hzinfo_inspect.task.TaskContants.ClaimStatusEnum; |
|
|
|
import org.springblade.hzinfo_inspect.task.TaskContants.ClaimStatusEnum; |
|
|
|
import org.springblade.hzinfo_inspect.task.entity.*; |
|
|
|
import org.springblade.hzinfo_inspect.task.entity.*; |
|
|
|
@ -19,13 +29,6 @@ import org.springblade.hzinfo_inspect.task.service.ITaskObjectProjectContentServ |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskObjectProjectService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskObjectProjectService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskObjectService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskObjectService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskService; |
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -42,6 +45,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 任务派发处理逻辑 |
|
|
|
* 任务派发处理逻辑 |
|
|
|
|
|
|
|
* |
|
|
|
* @author ninglong |
|
|
|
* @author ninglong |
|
|
|
* @create 2020-08-26 17:06 |
|
|
|
* @create 2020-08-26 17:06 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -89,6 +93,7 @@ public class TaskJobService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据计划用户获取接任务的人 |
|
|
|
* 根据计划用户获取接任务的人 |
|
|
|
|
|
|
|
* |
|
|
|
* @param planUserId |
|
|
|
* @param planUserId |
|
|
|
* @param taskId |
|
|
|
* @param taskId |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -103,6 +108,7 @@ public class TaskJobService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 从巡检计划和任务获取信息插入巡检任务对象表以及对应的历史数据表 |
|
|
|
* 从巡检计划和任务获取信息插入巡检任务对象表以及对应的历史数据表 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @param task 巡检任务实例 |
|
|
|
* @param task 巡检任务实例 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
@ -175,8 +181,10 @@ public class TaskJobService { |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 从巡检任务、巡检计划对象模板、巡检模板项目获取信息插入巡检任务项目表以及对应的历史数据表 |
|
|
|
* 从巡检任务、巡检计划对象模板、巡检模板项目获取信息插入巡检任务项目表以及对应的历史数据表 |
|
|
|
|
|
|
|
* |
|
|
|
* @param objectId 巡检计划对象模板实例 |
|
|
|
* @param objectId 巡检计划对象模板实例 |
|
|
|
* @param project 巡检模板项目实例 |
|
|
|
* @param project 巡检模板项目实例 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
@ -210,13 +218,16 @@ public class TaskJobService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 从巡检任务、巡检计划对象模板、巡检项目内容获取信息插入巡检任务内容表以及对应的历史数据表 |
|
|
|
* 从巡检任务、巡检计划对象模板、巡检项目内容获取信息插入巡检任务内容表以及对应的历史数据表 |
|
|
|
|
|
|
|
* |
|
|
|
* @param objectId 巡检计划对象模板实例 |
|
|
|
* @param objectId 巡检计划对象模板实例 |
|
|
|
* @param content 巡检项目内容实例 |
|
|
|
* @param content 巡检项目内容实例 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String distributeTaskContents(TaskEntity task, Long objectId, ProjectContentEntity content) { |
|
|
|
private String distributeTaskContents(TaskEntity task, Long objectId, ProjectContentEntity content) { |
|
|
|
ContentEntity ioc = contentService.getById(content.getContentId()); |
|
|
|
ContentEntity ioc = contentService.getById(content.getContentId()); |
|
|
|
if(ioc == null) {return "巡检内容id="+content.getContentId()+"找不到记录";} |
|
|
|
if (ioc == null) { |
|
|
|
|
|
|
|
return "巡检内容id=" + content.getContentId() + "找不到记录"; |
|
|
|
|
|
|
|
} |
|
|
|
TaskObjectProjectContentEntity itopc = new TaskObjectProjectContentEntity(); |
|
|
|
TaskObjectProjectContentEntity itopc = new TaskObjectProjectContentEntity(); |
|
|
|
itopc.setTaskId(task.getId()); |
|
|
|
itopc.setTaskId(task.getId()); |
|
|
|
itopc.setObjectId(objectId); |
|
|
|
itopc.setObjectId(objectId); |
|
|
|
@ -244,6 +255,7 @@ public class TaskJobService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据巡检计划返回与计划有关的所有用户 |
|
|
|
* 根据巡检计划返回与计划有关的所有用户 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @return 计划相关用户集合 |
|
|
|
* @return 计划相关用户集合 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -284,8 +296,7 @@ public class TaskJobService { |
|
|
|
if (Func.isNotEmpty(plan.getExecTimeJson())) { |
|
|
|
if (Func.isNotEmpty(plan.getExecTimeJson())) { |
|
|
|
/** 多次计划执行时间 **/ |
|
|
|
/** 多次计划执行时间 **/ |
|
|
|
timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); |
|
|
|
timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else{ |
|
|
|
|
|
|
|
throw new ServiceException("巡检计划未设置值班班次: plan = " + plan.toString()); |
|
|
|
throw new ServiceException("巡检计划未设置值班班次: plan = " + plan.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i = 0; i < plan.getTaskTimesADay(); i++) { |
|
|
|
for (int i = 0; i < plan.getTaskTimesADay(); i++) { |
|
|
|
@ -340,6 +351,7 @@ public class TaskJobService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据计划信息设置任务信息 |
|
|
|
* 根据计划信息设置任务信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @param plan 巡检计划实例 |
|
|
|
* @param totalTaskNum 任务数 并发任务有多少个人做任务就生成多少个任务,抢占任务只生成一个 |
|
|
|
* @param totalTaskNum 任务数 并发任务有多少个人做任务就生成多少个任务,抢占任务只生成一个 |
|
|
|
* @return 巡检任务实例 |
|
|
|
* @return 巡检任务实例 |
|
|
|
@ -401,7 +413,12 @@ public class TaskJobService { |
|
|
|
log.info("计划id={}本周期batchNumber={}的任务已生成", plan.getId(), task.getBatchNumber()); |
|
|
|
log.info("计划id={}本周期batchNumber={}的任务已生成", plan.getId(), task.getBatchNumber()); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 自动报备
|
|
|
|
|
|
|
|
task.setKeepOnRecord(TaskContants.keepOnRecordEnum.yes.getType()); |
|
|
|
|
|
|
|
task.setStartTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
task.setStatus(Integer.valueOf(TaskContants.TaskStatusEnum.UNDERWAY_STATUS.getStatus())); |
|
|
|
taskService.save(task); |
|
|
|
taskService.save(task); |
|
|
|
|
|
|
|
|
|
|
|
return task; |
|
|
|
return task; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|