|
@@ -3,15 +3,22 @@ package com.platform.rest.task;
|
|
|
import com.platform.common.cache.ConfigCache;
|
|
|
import com.platform.common.constant.RedisKeyConstants;
|
|
|
import com.platform.common.util.*;
|
|
|
-import com.platform.dao.entity.fill.FillGather;
|
|
|
+import com.platform.dao.entity.fill.FillGatherInfo;
|
|
|
import com.platform.dao.entity.fill.FillGatherTask;
|
|
|
+import com.platform.dao.entity.fill.FillGatherTaskDetail;
|
|
|
+import com.platform.dao.entity.fill.FillInfo;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
import com.platform.dao.enums.FillGatherTaskStatusEnum;
|
|
|
import com.platform.dao.enums.SysConfigEnum;
|
|
|
import com.platform.dao.enums.WorkplaceBacklogDetailTypeEnum;
|
|
|
import com.platform.dao.enums.WorkplaceBacklogTypeEnum;
|
|
|
+import com.platform.dao.mapper.fill.FillGatherInfoMapper;
|
|
|
+import com.platform.dao.mapper.fill.FillGatherTaskDetailMapper;
|
|
|
+import com.platform.dao.mapper.fill.FillInfoMapper;
|
|
|
import com.platform.dao.mapper.upms.SysUserMapper;
|
|
|
import com.platform.dao.util.MessageTemplateUtil;
|
|
|
+import com.platform.dao.vo.query.fill.FillGatherTaskDetailVO;
|
|
|
+import com.platform.dao.vo.query.fill.FillInfoVO;
|
|
|
import com.platform.service.event.WorkplaceBacklogEvent;
|
|
|
import com.platform.service.fill.FillGatherTaskService;
|
|
|
import com.platform.service.util.SendMessageUtils;
|
|
@@ -19,7 +26,6 @@ import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -37,6 +43,9 @@ import java.util.concurrent.TimeUnit;
|
|
|
public class FillGatherTaskTask {
|
|
|
private FillGatherTaskService fillGatherTaskService;
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
+ private FillGatherInfoMapper fillGatherInfoMapper;
|
|
|
+ private FillInfoMapper fillInfoMapper;
|
|
|
+ private FillGatherTaskDetailMapper fillGatherTaskDetailMapper;
|
|
|
|
|
|
/**
|
|
|
* 定时生成巡检任务
|
|
@@ -57,6 +66,10 @@ public class FillGatherTaskTask {
|
|
|
newTask.setName(task.getName() + "_" + nowDateStr);
|
|
|
newTask.setLateHistoryHours(0);
|
|
|
fillGatherTaskService.saveModelNoId(newTask);
|
|
|
+ // 1、获取巡检内容
|
|
|
+ String content = getContentByGatherId(task.getGatherId());
|
|
|
+ // 2、根据设备IDs,生成内容列表并保存
|
|
|
+ saveDetails(content,newTask.getId(),task.getId());
|
|
|
// 3、通知相关人员(巡检人和主管)
|
|
|
sendMessageToChecker(newTask,1);
|
|
|
sendMessageToChecker(newTask,2);
|
|
@@ -67,6 +80,45 @@ public class FillGatherTaskTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void saveDetails(String content,String newTaskId,String taskId){
|
|
|
+ List<FillGatherTaskDetail> details = new ArrayList<>();
|
|
|
+ List<FillGatherTaskDetailVO> detailVOs = fillGatherTaskDetailMapper.selectVOByTaskId(taskId);
|
|
|
+ for(FillGatherTaskDetailVO vo : detailVOs){
|
|
|
+ FillGatherTaskDetail detail = new FillGatherTaskDetail();
|
|
|
+ detail.setContent(content);
|
|
|
+ detail.setCreatedTime(LocalDateTime.now());
|
|
|
+ detail.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ detail.setCreatedUserName(SecurityUtils.getUserInfo().getUsername());
|
|
|
+ detail.setSbId(vo.getSbId());
|
|
|
+ detail.setTaskId(newTaskId);
|
|
|
+ detail.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ detail.setStatus(0);
|
|
|
+ details.add(detail);
|
|
|
+ }
|
|
|
+ fillGatherTaskDetailMapper.insertListforComplex(details);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取巡检标准json
|
|
|
+ * @param gatherId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getContentByGatherId(String gatherId){
|
|
|
+ List<FillInfoVO> contents = new ArrayList<>();
|
|
|
+ List<FillGatherInfo> infos = fillGatherInfoMapper.select(new FillGatherInfo().setGatherId(gatherId));
|
|
|
+ for(FillGatherInfo info : infos){
|
|
|
+ FillInfo fillInfo = fillInfoMapper.selectByPrimaryKey(info.getInfoId());
|
|
|
+ FillInfoVO vo = new FillInfoVO();
|
|
|
+ vo.setName(fillInfo.getName());
|
|
|
+ vo.setRemark(fillInfo.getRemark());
|
|
|
+ vo.setSelectValue(fillInfo.getSelectValue());
|
|
|
+ vo.setType(fillInfo.getType());
|
|
|
+ contents.add(vo);
|
|
|
+ }
|
|
|
+ return JsonUtils.objectToJson(contents);
|
|
|
+ }
|
|
|
+
|
|
|
private List<FillGatherTask> validateList(List<FillGatherTask> list,String nowDateStr){
|
|
|
List<FillGatherTask> retList = new ArrayList<>();
|
|
|
for(FillGatherTask task : list){
|