|
@@ -10,6 +10,7 @@ import com.ruoyi.common.constant.Constants;
|
|
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
|
import com.ruoyi.common.core.page.PagePlus;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
|
import com.ruoyi.common.utils.RedisUtils;
|
|
|
import com.ruoyi.zhdd.domain.IncidentTask;
|
|
@@ -72,35 +73,29 @@ public class IncidentTaskServiceImpl extends ServicePlusImpl<IncidentTaskMapper,
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean insertByBo(IncidentTasksBo bo) {
|
|
|
- // 新增之前删除之前的内容
|
|
|
-// String insertOrUpdateFlag = "新增";
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
if (StrUtil.isNotBlank(bo.getId())) {
|
|
|
- removeById(bo.getId());
|
|
|
-// incidentTaskPersonService.remove(Wrappers.<IncidentTaskPerson>lambdaQuery().eq(IncidentTaskPerson::getIncidentTaskId, bo.getId()));
|
|
|
-// incidentTaskCommandService.remove(Wrappers.<IncidentTaskCommand>lambdaQuery().eq(IncidentTaskCommand::getIncidentTaskId, bo.getId()));
|
|
|
-// insertOrUpdateFlag = "编辑";
|
|
|
+ // 更新操作
|
|
|
+ // 先查询是否已经发送过
|
|
|
+ IncidentTaskVo incidentTaskVo = this.queryById(bo.getId());
|
|
|
+ if (incidentTaskVo != null && "1".equals(incidentTaskVo.getTaskSend())) {
|
|
|
+ throw new ServiceException("该消息已发送,不能再次编辑!");
|
|
|
+ }
|
|
|
+ IncidentTask update = BeanUtil.toBean(bo, IncidentTask.class);
|
|
|
+ update.setExprJson(JSONUtil.toJsonStr(bo.getMessagePushUsers()));
|
|
|
+ updateById(update);
|
|
|
+ jsonObject.set("des", "更新处置方案:" + bo.getTaskName());
|
|
|
+ } else {
|
|
|
+ IncidentTask add = BeanUtil.toBean(bo, IncidentTask.class);
|
|
|
+ add.setId(null);
|
|
|
+ add.setExprJson(JSONUtil.toJsonStr(bo.getMessagePushUsers()));
|
|
|
+ save(add);
|
|
|
+ jsonObject.set("des", "新增处置方案:" + bo.getTaskName());
|
|
|
}
|
|
|
- IncidentTask add = BeanUtil.toBean(bo, IncidentTask.class);
|
|
|
- add.setId(null);
|
|
|
- add.setExprJson(JSONUtil.toJsonStr(bo.getMessagePushUsers()));
|
|
|
- save(add);
|
|
|
// 发送消息(1-应急处置消息、2-应急处置待办、3-资源管理待办)
|
|
|
-// if (bo.isSendFlag()) {
|
|
|
- // A:事件接报。B:处置方案
|
|
|
- /*if (false) {
|
|
|
- RedisUtils.publish(Constants.NOTICE_PUSH, bo.getSendFlag() + "B" + add.getId(), msg -> {
|
|
|
- log.info("发布应急方案消息 => " + msg);
|
|
|
- });
|
|
|
- }*/
|
|
|
-// }
|
|
|
- /*else {}*/
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.set("des", "新增处置方案:" + bo.getTaskName());
|
|
|
jsonObject.set("incidentId", bo.getIncidentId());
|
|
|
jsonObject.set("incidentStatus", 3);
|
|
|
- RedisUtils.publish(Constants.PROCESS_RECORD, jsonObject, msg -> {
|
|
|
- log.info("事件处置方案新增消息 => " + msg);
|
|
|
- });
|
|
|
+ RedisUtils.publish(Constants.PROCESS_RECORD, jsonObject);
|
|
|
|
|
|
//对处置反馈的人员保存事件人员关系
|
|
|
if (bo.getMessagePushUsers() != null && bo.getMessagePushUsers().size() > 0) {
|
|
@@ -155,13 +150,14 @@ public class IncidentTaskServiceImpl extends ServicePlusImpl<IncidentTaskMapper,
|
|
|
@Override
|
|
|
public List<IncidentTaskVo> listTaskInfo(String id) {
|
|
|
List<IncidentTaskVo> incidentTaskVo = listVo(Wrappers.<IncidentTask>lambdaQuery().eq(IncidentTask::getIncidentId, id).orderByAsc(IncidentTask::getCreateTime));
|
|
|
-// if (incidentTaskVo != null) {
|
|
|
-// // 查询指令和人员
|
|
|
-// for (IncidentTaskVo taskVo : incidentTaskVo) {
|
|
|
-// taskVo.setTaskCommandVos(incidentTaskCommandService.listVo(Wrappers.<IncidentTaskCommand>lambdaQuery().eq(IncidentTaskCommand::getIncidentTaskId, taskVo.getId())));
|
|
|
-// taskVo.setTaskPersonVos(incidentTaskPersonService.listVo(Wrappers.<IncidentTaskPerson>lambdaQuery().eq(IncidentTaskPerson::getIncidentTaskId, taskVo.getId())));
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (incidentTaskVo != null) {
|
|
|
+ // 查询指令和人员
|
|
|
+ for (IncidentTaskVo taskVo : incidentTaskVo) {
|
|
|
+ if (StrUtil.isNotBlank(taskVo.getExprJson())) {
|
|
|
+ taskVo.setMessagePushUsers(JSONUtil.toList(taskVo.getExprJson(), MessagePushUser.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return incidentTaskVo;
|
|
|
}
|
|
|
|
|
@@ -208,6 +204,9 @@ public class IncidentTaskServiceImpl extends ServicePlusImpl<IncidentTaskMapper,
|
|
|
String id = ids.iterator().next();
|
|
|
IncidentTaskVo incidentTaskVo = queryById(id);
|
|
|
if (incidentTaskVo != null) {
|
|
|
+ if ("1".equals(incidentTaskVo.getTaskSend())) {
|
|
|
+ throw new ServiceException("该消息已发送,不能删除!");
|
|
|
+ }
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.set("des", "处置方案:" + incidentTaskVo.getTaskName() + "删除");
|
|
|
jsonObject.set("incidentId", incidentTaskVo.getIncidentId());
|
|
@@ -218,4 +217,5 @@ public class IncidentTaskServiceImpl extends ServicePlusImpl<IncidentTaskMapper,
|
|
|
}
|
|
|
return removeByIds(ids);
|
|
|
}
|
|
|
+
|
|
|
}
|