From 81975f6c4120d38829b660412ed60f6ebe6a7423 Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Mon, 10 Aug 2026 10:06:31 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=20=E9=A2=84=E8=AD=A6=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=8A=A0=E4=B8=8A=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WarningBusinessServiceImpl.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java b/src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java index e9124af..103acd6 100644 --- a/src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java @@ -118,6 +118,7 @@ public class WarningBusinessServiceImpl implements WarningBusinessService { @Transactional(rollbackFor = Exception.class) public void save(WarningSaveRequest request) { UserAuth user = UserContextHolder.getCurrentUser(); + validateWarningHandler(request.getReportId(), user); // 更新项目监督信息(由后端自动获取) ReportProject project = new ReportProject(); @@ -135,6 +136,7 @@ public class WarningBusinessServiceImpl implements WarningBusinessService { @Transactional(rollbackFor = Exception.class) public void submit(WarningSubmitRequest request) { UserAuth user = UserContextHolder.getCurrentUser(); + validateWarningHandler(request.getReportId(), user); // 1. 更新项目监督信息(由后端自动获取) ReportProject project = new ReportProject(); @@ -185,6 +187,7 @@ public class WarningBusinessServiceImpl implements WarningBusinessService { @Transactional(rollbackFor = Exception.class) public void end(WarningEndRequest request) { UserAuth user = UserContextHolder.getCurrentUser(); + validateWarningHandler(request.getReportId(), user); // 1. 更新项目状态(由后端自动获取预警监督人和时间) ReportProject project = new ReportProject(); @@ -594,6 +597,30 @@ public class WarningBusinessServiceImpl implements WarningBusinessService { return flows.isEmpty() ? null : flows.get(0).getId(); } + /** + * 校验当前用户是否为预警待办处理人。 + * 首次预警没有待处理流程时允许操作;存在待处理流程时,仅允许对应处理人操作。 + */ + private void validateWarningHandler(String reportId, UserAuth user) { + List pendingFlows = flowMapper.selectList( + new LambdaQueryWrapper() + .eq(ReportFlow::getReportId, reportId) + .eq(ReportFlow::getType, "warning") + .eq(ReportFlow::getApproverState, FlowStateEnum.Start.getLabel()) + .orderByDesc(ReportFlow::getAreportTime) + .last("LIMIT 1") + ); + if (pendingFlows.isEmpty()) { + return; + } + + ReportFlow pendingFlow = pendingFlows.get(0); + if (!StrUtil.equals(user.getUserName(), pendingFlow.getApproverId())) { + String handler = StrUtil.isBlank(pendingFlow.getApprover()) ? "其他人员" : pendingFlow.getApprover(); + throw new RuntimeException("该项目当前由" + handler + "处理,请勿重复操作"); + } + } + /** * 保存预警内容 */