heheng
2024-11-07 3ca43826a747fda1447b2501901f84fc1a9019dd
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanServiceImpl.java
@@ -100,14 +100,15 @@
        // 检查是否是实验管理者
        int roleTag = 0;
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
                roleTag = 1;
            }
        }
        if (roleTag ==0 ){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划");
        }
        //20241107修改注释
//        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
//            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
//                roleTag = 1;
//            }
//        }
//        if (roleTag ==0 ){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划");
//        }
        if (ObjectUtils.isEmpty(user)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        }
@@ -364,14 +365,15 @@
        // 检查是否是实验管理者
        int roleTag = 0;
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
                roleTag = 1;
            }
        }
        if (roleTag ==0 ){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划");
        }
        //20241107修改注释
//        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
//            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
//                roleTag = 1;
//            }
//        }
//        if (roleTag ==0 ){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划");
//        }
        //参数校验
        if (ObjectUtils.isEmpty(updateParam)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要求改的参数为空");
@@ -473,14 +475,15 @@
        // 检查是否是实验管理者
        int roleTag = 0;
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
                roleTag = 1;
            }
        }
        if (roleTag ==0 ){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划");
        }
        //20241107注释
//        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
//            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
//                roleTag = 1;
//            }
//        }
//        if (roleTag ==0 ){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划");
//        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");