diff --git a/src/main/java/com/biutag/supervision/flow/FlowService.java b/src/main/java/com/biutag/supervision/flow/FlowService.java index 1343a0d..efa9c64 100644 --- a/src/main/java/com/biutag/supervision/flow/FlowService.java +++ b/src/main/java/com/biutag/supervision/flow/FlowService.java @@ -3,7 +3,6 @@ package com.biutag.supervision.flow; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.flow.action.Action; @@ -58,18 +57,23 @@ public class FlowService { ); } } - NegativeWork work = workService.getById(actionDto.getWorkId()); - UserAuth user = UserContextHolder.getCurrentUser(); + NegativeHistory history = new NegativeHistory().setHistoryId(IdUtil.fastSimpleUUID()) .setNegativeId(actionDto.getNegativeId()) .setActionName(actionDto.getActionName()) .setDepartName(departService.getById(work.getDepartId()).getShortName()) - .setCrtUser(user.getUserId()) - .setCrtUserName(user.getUserName()) - .setCrtName(user.getNickName()) + .setCrtTime(LocalDateTime.now()) .setDataJson(JSON.toJSONString(actionDto)); + try { + UserAuth user = UserContextHolder.getCurrentUser(); + history.setCrtUser(user.getUserId()) + .setCrtUserName(user.getUserName()) + .setCrtName(user.getNickName()); + } catch (RuntimeException e) { + history.setCrtName("模型超市"); + } return negativeHistoryService.save(history); } diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index 88ccc8a..9499eb2 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -205,8 +205,13 @@ public class NegativeService extends ServiceImpl { throw new RuntimeException("涉及单位请选择二级或三级单位"); } LocalDateTime now = LocalDateTime.now(); - UserAuth user = UserContextHolder.getCurrentUser(); - boolean secondFlag = user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()); + boolean secondFlag = false; + try { + UserAuth user = UserContextHolder.getCurrentUser(); + secondFlag = user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()); + } catch (RuntimeException e) { + // 模型自动下发无法获取用户信息 + } negative.setId(IdUtil.getSnowflakeNextIdStr()) // negative唯一标识 雪花 .setProcessingStatus(ProcessingStatusEnum.signing.name()) .setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey()) // 市局下发