From 4eccf92d11bf7942b319131a8d26d9a825947b45 Mon Sep 17 00:00:00 2001 From: tianxinlei Date: Fri, 22 May 2026 10:20:06 +0800 Subject: [PATCH] =?UTF-8?q?5-22=20-=20=E6=A3=80=E6=9F=A5=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E5=A2=9E=E5=8A=A0=E4=B8=BB=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=88=A0=E9=99=A4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...afetyEnvironmentalInspectionRemoveExe.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web-app/src/main/java/com/zcloud/key/project/command/inspection/SafetyEnvironmentalInspectionRemoveExe.java b/web-app/src/main/java/com/zcloud/key/project/command/inspection/SafetyEnvironmentalInspectionRemoveExe.java index 369c1b4..89c6274 100644 --- a/web-app/src/main/java/com/zcloud/key/project/command/inspection/SafetyEnvironmentalInspectionRemoveExe.java +++ b/web-app/src/main/java/com/zcloud/key/project/command/inspection/SafetyEnvironmentalInspectionRemoveExe.java @@ -1,7 +1,12 @@ package com.zcloud.key.project.command.inspection; import com.alibaba.cola.exception.BizException; +import com.jjb.saas.framework.auth.model.SSOUser; +import com.jjb.saas.framework.auth.utils.AuthContext; import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade; +import com.zcloud.gbscommon.zcloudsystem.user.SystemUserUtils; +import com.zcloud.gbscommon.zclouduser.facade.ZcloudUserFacade; +import com.zcloud.gbscommon.zclouduser.response.ZcloudUserCo; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway; import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionContentDO; @@ -13,6 +18,7 @@ import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmen import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import lombok.AllArgsConstructor; import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -37,11 +43,25 @@ public class SafetyEnvironmentalInspectionRemoveExe { private final SafetyEnvironmentalInspectionContentRepository safetyEnvironmentalInspectionContentRepository; private final HiddenRepository hiddenRepository; private final HiddenFindUserRepository hiddenFindUserRepository; + private final UserDetailsService userDetailsService; + private final SystemUserUtils systemUserUtils; @DubboReference private ZcloudImgFilesFacade zcloudImgFilesFacade; + @Transactional(rollbackFor = Exception.class) public boolean execute(Long id) { + + //只有主账号才有删除权限 + SSOUser ssoUser = AuthContext.getCurrentUser(); + ZcloudUserCo zcloudUserCo = systemUserUtils.getZcloudUserInfoById(ssoUser.getUserId()); + if (zcloudUserCo == null) { + throw new BizException("删除权限校验失败"); + } + if (zcloudUserCo.getMainCorpFlag() != 1) { + throw new BizException("您没有删除权限"); + } + SafetyEnvironmentalInspectionDO inspectionDO = safetyEnvironmentalInspectionRepository.getById(id); boolean res = safetyEnvironmentalInspectionGateway.deletedSafetyEnvironmentalInspectionById(id); // 删除检查核实人数据