|
@@ -35,10 +35,12 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -109,17 +111,12 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean insertByBo(IncidentBo bo) {
|
|
|
+ public String insertByBo(IncidentBo bo) {
|
|
|
Incident add = BeanUtil.toBean(bo, Incident.class);
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setExprJson(JSONUtil.toJsonStr(bo.getMessagePushUsers()));
|
|
|
boolean save = save(add);
|
|
|
- /*if (bo.isSendFlag()) {
|
|
|
- // A:事件接报。B:处置方案
|
|
|
- RedisUtils.publish(Constants.NOTICE_PUSH, "A" + add.getId(), msg -> {
|
|
|
- log.info("发布事件接报消息 => " + msg);
|
|
|
- });
|
|
|
- }*/
|
|
|
+
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.set("des", "事件接报");
|
|
|
jsonObject.set("incidentId", add.getId());
|
|
@@ -127,7 +124,7 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
RedisUtils.publish(Constants.PROCESS_RECORD, jsonObject, msg -> {
|
|
|
log.info("事件处置详情消息 => " + msg);
|
|
|
});
|
|
|
- return save;
|
|
|
+ return add.getId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -153,6 +150,9 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
if (StrUtil.isBlank(bo.getMadinDept())) {
|
|
|
throw new ServiceException("请选择主办单位!");
|
|
|
}
|
|
|
+ if (StrUtil.isBlank(bo.getCommander())) {
|
|
|
+ throw new ServiceException("请选择总指挥!");
|
|
|
+ }
|
|
|
jsonObject.set("des", "事件派发");
|
|
|
// 冗余总指挥、主办、协办部门数据
|
|
|
if (StrUtil.isNotBlank(bo.getCommander())) {
|
|
@@ -173,11 +173,27 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
update.setAssistDeptText(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(",")));
|
|
|
}
|
|
|
}
|
|
|
- } else if (flag && bo.getStatus() == 4) {
|
|
|
+
|
|
|
+ //保存派发的人员和事件关系数据
|
|
|
+ JSONObject incidentUser = new JSONObject();
|
|
|
+ // 组装人员数据
|
|
|
+ Set<MessagePushUser> messagePushUsers = CollUtil.unionDistinct(JSONUtil.toList(bo.getCommanderUser(), MessagePushUser.class), JSONUtil.toList(bo.getMadinDeptUser(), MessagePushUser.class),
|
|
|
+ StrUtil.isNotBlank(bo.getAssistDeptUser()) ? JSONUtil.toList(bo.getAssistDeptUser(), MessagePushUser.class) : new ArrayList<>());
|
|
|
+ String userId = messagePushUsers.stream().map(MessagePushUser::getUserId).collect(Collectors.joining(","));
|
|
|
+ incidentUser.set("incidentId", bo.getId());
|
|
|
+ incidentUser.set("userId", userId);
|
|
|
+ incidentUser.set("source", "2");
|
|
|
+ RedisUtils.publish(Constants.INCIDENT_USER, incidentUser, msg -> {
|
|
|
+ log.info("保存事件人员关系 => " + msg);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ /*else if (flag && bo.getStatus() == 4) {
|
|
|
if (StrUtil.isBlank(bo.getConclusion())) {
|
|
|
- throw new ServiceException("请填写归档总结!");
|
|
|
+ throw new ServiceException("请填写经验总结!");
|
|
|
}
|
|
|
- } else if (!flag && !StrUtil.equals(bo.getAssistDept(), beforeInfo.getAssistDept())) {
|
|
|
+ } */
|
|
|
+ else if (!flag && !StrUtil.equals(bo.getAssistDept(), beforeInfo.getAssistDept())) {
|
|
|
// 第二次对协办部门派发
|
|
|
// 重新冗余协办部门
|
|
|
if (StrUtil.isBlank(bo.getAssistDept())) {
|
|
@@ -199,6 +215,16 @@ public class IncidentServiceImpl extends ServicePlusImpl<IncidentMapper, Inciden
|
|
|
jsonObject.set("messagePushUsers", messagePushUsers);
|
|
|
|
|
|
RedisUtils.publish(Constants.NOTICE_PUSH_SINGLE, jsonObject);
|
|
|
+
|
|
|
+ //对第二次修改的人员再保存事件人员关系
|
|
|
+ String userId = messagePushUsers.stream().map(MessagePushUser::getUserId).collect(Collectors.joining(","));
|
|
|
+ JSONObject incidentUser = new JSONObject();
|
|
|
+ incidentUser.set("incidentId", bo.getId());
|
|
|
+ incidentUser.set("userId", userId);
|
|
|
+ incidentUser.set("source", "2");
|
|
|
+ RedisUtils.publish(Constants.INCIDENT_USER, incidentUser, msg -> {
|
|
|
+ log.info("保存事件人员关系 => " + msg);
|
|
|
+ });
|
|
|
}
|
|
|
// 更新事件信息
|
|
|
boolean b = updateById(update);
|