| | |
| | | } |
| | | 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 != 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | } |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | //20241107修改注释权限 |
| | | // if (roleTag != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(riskUnitInsertReqBO.getExperimentId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选实验不能为空"); |
| | | } |
| | |
| | | } |
| | | 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 != 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限修改"); |
| | | } |
| | | // for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | // if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | // roleTag = 1; |
| | | // } |
| | | // } |
| | | //20241107修改注释权限 |
| | | // if (roleTag != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限修改"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(updateReqBO.getExperimentId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选实验不能为空,或实验已被删除"); |
| | | } |
| | |
| | | } |
| | | 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 != 1){ |
| | | 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 != 1){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不是管理人员,无权限添加"); |
| | | // } |
| | | RiskUnitDeleteDTO deleteResult = riskUnitService.deleteRiskUnit(currentUserId, id); |
| | | |
| | | if (ObjectUtils.isEmpty(deleteResult)){ |
| | |
| | | /** |
| | | * 实验风险单元 - 查询 by code |
| | | */ |
| | | @Query(value = "select t from RiskUnit t where t.riskCode = :riskCode and t.deleteStatus = 0") |
| | | RiskUnit getUnitByCode(String riskCode); |
| | | @Query(value = "select t from RiskUnit t where t.riskCode = :riskCode and t.experimentId = :experimentId and t.deleteStatus = 0") |
| | | RiskUnit getUnitByCode(String riskCode,Long experimentId); |
| | | /** |
| | | * 风险单元 - 查询 by id |
| | | */ |
| | |
| | | // 检查是否是实验管理者 |
| | | 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() ,"当前用户不存在或已被删除"); |
| | | } |
| | |
| | | // 检查是否是实验管理者 |
| | | 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(), "要求改的参数为空"); |
| | |
| | | // 检查是否是实验管理者 |
| | | 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() ,"当前用户不存在或已被删除"); |
| | |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskCode())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元编号不能为空"); |
| | | } |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(insertParam.getRiskCode()); |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(insertParam.getRiskCode(), insertParam.getExperimentId()); |
| | | if (!ObjectUtils.isEmpty(unitByCode)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "编号已被使用"); |
| | | } |
| | |
| | | if (ObjectUtils.isEmpty(updateParam.getRiskCode())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元编号不能为空"); |
| | | } |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(updateParam.getRiskCode()); |
| | | RiskUnit unitByCode = riskUnitRepository.getUnitByCode(updateParam.getRiskCode(),updateParam.getExperimentId()); |
| | | if (!ObjectUtils.isEmpty(unitByCode) && !updateParam.getId().equals(unitByCode.getId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "编号已被使用"); |
| | | } |