| | |
| | | throw exception(SAFETY_HAZARD_ASSIGNEE_REQUIRED); |
| | | } |
| | | var assignee = refResolver.requireEmployee(reqVO.getAssigneeId(), SAFETY_HAZARD_ASSIGNEE_REQUIRED); |
| | | if (assignee.getUserId() == null) throw exception(SAFETY_HAZARD_ASSIGNEE_NO_ACCOUNT); |
| | | adminUserService.validateUserList(List.of(assignee.getUserId())); |
| | | Long notifyUserId = assignee.getUserId() != null ? assignee.getUserId() : reqVO.getNotifyUserId(); |
| | | if (notifyUserId == null) throw exception(SAFETY_HAZARD_ASSIGNEE_NO_ACCOUNT); |
| | | if (assignee.getUserId() != null && reqVO.getNotifyUserId() != null && !assignee.getUserId().equals(reqVO.getNotifyUserId())) { |
| | | throw cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException("责任人已绑定账号,通知接收账号必须与其一致"); |
| | | } |
| | | adminUserService.validateUserList(List.of(notifyUserId)); |
| | | SafetyHazardDO update = new SafetyHazardDO(); |
| | | update.setId(hazard.getId()); |
| | | update.setAssigneeId(assignee.getId()); |
| | |
| | | } |
| | | hazardMapper.updateById(update); |
| | | NotifySendSingleToUserReqDTO notice = new NotifySendSingleToUserReqDTO(); |
| | | notice.setUserId(assignee.getUserId()); |
| | | notice.setUserId(notifyUserId); |
| | | notice.setTemplateCode("safety_hazard_assigned"); |
| | | notice.setTemplateParams(Map.of("code", hazard.getCode(), "title", hazard.getTitle(), |
| | | "deadline", reqVO.getRectifyDeadline() == null ? "未设置" : reqVO.getRectifyDeadline().toString())); |