From 2e8e39e0d9d62b84385c8857d28a31f66834f678 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Tue, 18 Nov 2025 10:39:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=B6=85=E5=B8=82=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/biutag/supervision/flow/FlowService.java | 16 ++++++++++------ .../supervision/service/NegativeService.java | 9 +++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) 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()) // 市局下发