|
@@ -1,6 +1,7 @@
|
|
|
package com.ruoyi.zhdd.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
@@ -21,6 +22,7 @@ import com.ruoyi.system.service.ISysDeptService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
import com.ruoyi.zhdd.domain.Incident;
|
|
|
import com.ruoyi.zhdd.domain.bo.IncidentBo;
|
|
|
+import com.ruoyi.zhdd.domain.bo.MessagePushUser;
|
|
|
import com.ruoyi.zhdd.domain.vo.IncidentVo;
|
|
|
import com.ruoyi.zhdd.mapper.IncidentMapper;
|
|
|
import com.ruoyi.zhdd.service.IIncidentProcessService;
|
|
@@ -140,6 +142,8 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
IncidentVo beforeInfo = getVoById(bo.getId());
|
|
|
if (beforeInfo != null) {
|
|
|
flag = !(beforeInfo.getStatus().equals(bo.getStatus()));
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("事件不存在!");
|
|
|
}
|
|
|
Incident update = BeanUtil.toBean(bo, Incident.class);
|
|
|
validEntityBeforeSave(update);
|
|
@@ -169,30 +173,36 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
update.setAssistDeptText(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(",")));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// // 查询初始设置的处置方案
|
|
|
-// List<PlanTask> planTask = planService.queryTask(bo.getMadinDept(), bo.getType(), bo.getLevel());
|
|
|
-// List<IncidentTask> incidentTasks = new ArrayList<>();
|
|
|
-// for (PlanTask task : planTask) {
|
|
|
-// IncidentTask incidentTask = new IncidentTask();
|
|
|
-// incidentTask.setIncidentId(update.getId());
|
|
|
-// incidentTask.setTaskName(task.getTaskName());
|
|
|
-// incidentTask.setTaskDes(task.getTaskDes());
|
|
|
-// incidentTask.setSource(1);
|
|
|
-// incidentTasks.add(incidentTask);
|
|
|
-// }
|
|
|
-// incidentTaskService.saveAll(incidentTasks);
|
|
|
} else if (flag && bo.getStatus() == 4) {
|
|
|
if (StrUtil.isBlank(bo.getConclusion())) {
|
|
|
throw new ServiceException("请填写归档总结!");
|
|
|
}
|
|
|
+ } else if (!flag && !StrUtil.equals(bo.getAssistDept(), beforeInfo.getAssistDept())) {
|
|
|
+ // 第二次对协办部门派发
|
|
|
+ // 重新冗余协办部门
|
|
|
+ if (StrUtil.isBlank(bo.getAssistDept())) {
|
|
|
+ update.setAssistDeptText("");
|
|
|
+ } else {
|
|
|
+ List<SysDept> sysDepts = sysDeptService.listByIds(Arrays.asList(bo.getAssistDept().split(",")));
|
|
|
+ if (sysDepts != null && sysDepts.size() > 0) {
|
|
|
+ update.setAssistDeptText(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询新增的部门数据。此处需要单独发送消息给相关的人
|
|
|
+ List<MessagePushUser> oldAssistDeptUser = JSONUtil.toList(beforeInfo.getAssistDeptUser(), MessagePushUser.class);
|
|
|
+ List<MessagePushUser> newAssistDeptUser = JSONUtil.toList(bo.getAssistDeptUser(), MessagePushUser.class);
|
|
|
+ List<MessagePushUser> messagePushUsers = CollUtil.subtractToList(newAssistDeptUser, oldAssistDeptUser);
|
|
|
+
|
|
|
+ jsonObject.set("des", "再次派发协办部门");
|
|
|
+ jsonObject.set("incidentStatus", bo.getStatus());
|
|
|
+ jsonObject.set("incidentId", bo.getId());
|
|
|
+ jsonObject.set("messagePushUsers", messagePushUsers);
|
|
|
+
|
|
|
+ RedisUtils.publish(Constants.NOTICE_PUSH_SINGLE, jsonObject);
|
|
|
}
|
|
|
+ // 更新事件信息
|
|
|
boolean b = updateById(update);
|
|
|
- /*if (bo.isSendFlag()) {
|
|
|
- RedisUtils.publish(Constants.NOTICE_PUSH, update.getId(), msg -> {
|
|
|
- log.info("发布事件接报消息 => " + msg);
|
|
|
- });
|
|
|
- }*/
|
|
|
+
|
|
|
if (flag) {
|
|
|
if (bo.getStatus() == 3) {
|
|
|
// 推送到派发的待办消息中
|