npe的处理

This commit is contained in:
wangliwen 2022-11-30 18:31:09 +08:00
parent e96b6f864c
commit 091e18e6c4
2 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,7 @@ public class TRemindersController {
public Result save(@RequestBody TRemindersDTO dto) { public Result save(@RequestBody TRemindersDTO dto) {
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
SysUserDTO userDTO = sysUserService.get(user.getId()); SysUserDTO userDTO = sysUserService.get(user.getId());
dto.setRecipient(userDTO); dto.setSponsor(userDTO);
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tRemindersService.save(dto); tRemindersService.save(dto);

View File

@ -83,6 +83,7 @@ public class TRemindersServiceImpl extends CrudServiceImpl<TRemindersDao, TRemin
dto.setProcessType(processInstanceDTO.getProcessVariables().getOrDefault("flowType", "未知流程").toString()); dto.setProcessType(processInstanceDTO.getProcessVariables().getOrDefault("flowType", "未知流程").toString());
} }
Task task = taskService.createTaskQuery().taskId(dto.getProcessTaskId().toString()).includeProcessVariables().singleResult(); Task task = taskService.createTaskQuery().taskId(dto.getProcessTaskId().toString()).includeProcessVariables().singleResult();
logger.info("该任务对应审核人:" + task.getAssignee());
if (StringUtils.isNumeric(task.getAssignee())) { // 对审核人发消息 if (StringUtils.isNumeric(task.getAssignee())) { // 对审核人发消息
Optional<SysUserDTO> assignee = Optional.ofNullable(sysUserService.get(Long.parseLong(task.getAssignee()))); // 获取审批人 Optional<SysUserDTO> assignee = Optional.ofNullable(sysUserService.get(Long.parseLong(task.getAssignee()))); // 获取审批人
dto.setRecipient(assignee.get()); dto.setRecipient(assignee.get());