Browse Source

提交应急事件忽略代码

develop
wanjing 7 months ago
parent
commit
d59a801e2d
1 changed files with 13 additions and 14 deletions
  1. +13
    -14
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java

+ 13
- 14
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java View File

private AccidentMapper accidentMapper; private AccidentMapper accidentMapper;


public JsonResult ignore(List<String> idList) { public JsonResult ignore(List<String> idList) {
// log.info("进入忽略事故业务, id={}", id);
// log.info("进入忽略事故业务, idList={}", idList);
User user = CurrentUserUtil.getUserInfo(); User user = CurrentUserUtil.getUserInfo();
String userId = user.getId(); String userId = user.getId();
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
log.info("忽略事故业务:校验失败:{}", result.getMsg()); log.info("忽略事故业务:校验失败:{}", result.getMsg());
return result; return result;
} }
Accident accident = (Accident) result.getData();
List<Accident> accidentList = (List<Accident>) result.getData();


this.updateAccident(userId, accident);
this.updateAccident(userId, accidentList);


return JsonResult.success(); return JsonResult.success();
} }
if (CollectionUtil.isEmpty(accidentList)) { if (CollectionUtil.isEmpty(accidentList)) {
throw new ServiceException("应急事件不存在"); throw new ServiceException("应急事件不存在");
} }

for (Accident accident : accidentList) { for (Accident accident : accidentList) {
if (AccidentStatusEnum.UNTREATED.getCode() != accident.getStatus()) { if (AccidentStatusEnum.UNTREATED.getCode() != accident.getStatus()) {
log.info("未处理的应急事件才能忽略, accidentId={}", accident.getId()); log.info("未处理的应急事件才能忽略, accidentId={}", accident.getId());
* @param userId * @param userId
* @param userId * @param userId
*/ */
private void updateAccident(String userId, Accident accident) {
Accident accidentUpdate = new Accident();
accidentUpdate.setId(accident.getId());
accidentUpdate.setStatus(AccidentStatusEnum.IGNORED.getCode());
accidentUpdate.setUpdateUser(userId);
accidentUpdate.setUpdateTime(DateUtils.now());
accidentUpdate.setIgnoreTime(DateUtils.now());
Integer count = accidentMapper.updateById(accidentUpdate);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败");
private void updateAccident(String userId, List<Accident> accidentList) {
for (Accident accident : accidentList) {
accident.setStatus(AccidentStatusEnum.IGNORED.getCode());
accident.setUpdateUser(userId);
accident.setUpdateTime(DateUtils.now());
accident.setIgnoreTime(DateUtils.now());
Integer count = accidentMapper.updateById(accident);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败, accidentId={}", accident.getId());
}
} }
} }
} }

Loading…
Cancel
Save