|
@@ -3,6 +3,7 @@ package com.rongwei.sfcommon.sys.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.rongwe.scentity.domian.HiddenDangerTrackDo;
|
|
|
import com.rongwe.scentity.domian.ThemeCheckDo;
|
|
|
+import com.rongwe.scentity.domian.ThemeCheckItemDo;
|
|
|
import com.rongwe.scentity.domian.ThemeCheckWorkparkDo;
|
|
|
import com.rongwei.rwcommon.base.BaseDo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
@@ -10,6 +11,7 @@ import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.safecommon.utils.CXCommonUtils;
|
|
|
import com.rongwei.sfcommon.sys.dao.DangerousDao;
|
|
|
import com.rongwei.sfcommon.sys.service.SafeCheckSendNotifyService;
|
|
|
+import com.rongwei.sfcommon.sys.service.ThemeCheckItemService;
|
|
|
import com.rongwei.sfcommon.sys.service.ThemeCheckService;
|
|
|
import com.rongwei.sfcommon.sys.service.ThemeCheckWorkparkService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -81,36 +83,33 @@ public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyServic
|
|
|
|
|
|
@Autowired
|
|
|
private ThemeCheckWorkparkService themeCheckWorkparkService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ThemeCheckItemService themeCheckItemService;
|
|
|
+
|
|
|
@Override
|
|
|
public void inspectionTasks() {
|
|
|
- List<ThemeCheckDo> themeCheckList = themeCheckService.getListByCreateTask(0);
|
|
|
- List<String> themeCheckIdList = themeCheckList.stream().map(ThemeCheckDo::getId).collect(Collectors.toList());
|
|
|
- List<ThemeCheckWorkparkDo> themeCheckWorkparks = themeCheckWorkparkService.getListBytheneCheckIds(themeCheckIdList);
|
|
|
- if (themeCheckWorkparks.isEmpty()) {
|
|
|
- log.error("该检查计划没有检查小组");
|
|
|
+ // 获取所有待检查的检查任务
|
|
|
+ List<ThemeCheckItemDo> prepare = themeCheckItemService.list(new LambdaQueryWrapper<ThemeCheckItemDo>()
|
|
|
+ .eq(BaseDo::getDeleted, "0").eq(ThemeCheckItemDo::getCheckstatus, "prepare"));
|
|
|
+ if(prepare.isEmpty()){
|
|
|
+ log.debug("暂无待检测的任务");
|
|
|
return;
|
|
|
}
|
|
|
- // 当前检查小组的人员信息
|
|
|
- HashSet<String> currentCheckUserIds = new HashSet<>();
|
|
|
+ // 获取检查计划id
|
|
|
+ List<String> themeCheckId = prepare.stream().map(ThemeCheckItemDo::getThemecheckid).collect(Collectors.toList());
|
|
|
+ Collection<ThemeCheckDo> themeCheckDos = themeCheckService.listByIds(themeCheckId);
|
|
|
// 发送提醒的map
|
|
|
- Map<String, HashSet<String>> sendNotifyMap = new HashMap<>();
|
|
|
- themeCheckList.forEach(themeCheckDo -> {
|
|
|
- List<ThemeCheckWorkparkDo> checkWorkparkDos = themeCheckWorkparks.stream().filter(info -> Objects.equals(info.getThemecheckid(), themeCheckDo.getId())).collect(Collectors.toList());
|
|
|
- checkWorkparkDos.forEach(info->{
|
|
|
- String groupleader = info.getGroupleader();
|
|
|
- String groupusers = info.getGroupusers();
|
|
|
- currentCheckUserIds.clear();
|
|
|
- if (StringUtils.isNotBlank(groupleader)) {
|
|
|
- currentCheckUserIds.add(groupleader);
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(groupusers)) {
|
|
|
- currentCheckUserIds.addAll(new HashSet<>(Arrays.asList(groupusers.split(","))));
|
|
|
- }
|
|
|
- // 任务名称 计划检查时间 区域
|
|
|
- sendNotifyMap.put(String.format(INSPECTION_TASKS_CONTENT,themeCheckDo.getCheckname(),themeCheckDo.getPlanstarttime(),
|
|
|
- themeCheckDo.getPlanstarttime(),info.getChargeorgname(),themeCheckDo.getId()),
|
|
|
- currentCheckUserIds);
|
|
|
- });
|
|
|
+ Map<String, String> sendNotifyMap = new HashMap<>();
|
|
|
+ prepare.forEach(themeCheckItemDo -> {
|
|
|
+ ThemeCheckDo themeCheckDo = themeCheckDos.stream().filter(info -> info.getId().equals(themeCheckItemDo.getThemecheckid())).findFirst().orElse(null);
|
|
|
+ if(themeCheckDo==null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 任务名称 计划检查时间 区域
|
|
|
+ sendNotifyMap.put(String.format(INSPECTION_TASKS_CONTENT,themeCheckDo.getCheckname(),themeCheckDo.getPlanstarttime(),
|
|
|
+ themeCheckDo.getPlanstarttime(),themeCheckItemDo.getCheckworkspart(),themeCheckDo.getId()),
|
|
|
+ themeCheckItemDo.getCheckerid());
|
|
|
});
|
|
|
sendInspectionTasksNotify(sendNotifyMap);
|
|
|
}
|
|
@@ -162,9 +161,9 @@ public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyServic
|
|
|
/**
|
|
|
* 检查任务提醒
|
|
|
*/
|
|
|
- public void sendInspectionTasksNotify(Map<String, HashSet<String>> sendNotifyMap) {
|
|
|
+ public void sendInspectionTasksNotify(Map<String, String> sendNotifyMap) {
|
|
|
sendNotifyMap.forEach((k, v) -> CXCommonUtils.sendNotify(INSPECTION_TASKS_TITLE, k.split(DEFAULT_SEPARATOR)[0], "",
|
|
|
- new ArrayList<>(v), k.split(DEFAULT_SEPARATOR)[1], INSPECTIONTASKS));
|
|
|
+ Arrays.asList(v), k.split(DEFAULT_SEPARATOR)[1], INSPECTIONTASKS));
|
|
|
}
|
|
|
|
|
|
/**
|