From 761bdc5b3f17df62aae1b424f2d2dabc11e844bc Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: Fri, 23 May 2025 09:33:44 +0800
Subject: [PATCH] 变动大幅度版本
---
src/main/java/com/gkhy/labRiskManage/application/riskReport/service/impl/RiskAccessAppServiceImpl.java | 83 +++++++++++++++++++++++++++++------------
1 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/gkhy/labRiskManage/application/riskReport/service/impl/RiskAccessAppServiceImpl.java b/src/main/java/com/gkhy/labRiskManage/application/riskReport/service/impl/RiskAccessAppServiceImpl.java
index 80506bf..f8867a6 100644
--- a/src/main/java/com/gkhy/labRiskManage/application/riskReport/service/impl/RiskAccessAppServiceImpl.java
+++ b/src/main/java/com/gkhy/labRiskManage/application/riskReport/service/impl/RiskAccessAppServiceImpl.java
@@ -184,6 +184,11 @@
if (currentUserId < 0){
throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登录");
}
+ UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
+ if (userInfoById == null){
+ throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登录");
+ }
+ String realName = userInfoById.getRealName();
RiskAssessPlanAppIdentificationBO identificationParam = BeanCopyUtils.copyBean(identificationReqBO, RiskAssessPlanAppIdentificationBO.class);
int tag = 1;
@@ -198,6 +203,8 @@
if (identificationParam.getIdentificationMethod() == 1){
RiskAssessPlanIdentificationPha pha = BeanCopyUtils.copyBean(identificationParam, RiskAssessPlanIdentificationPha.class);
pha.setAssessPlanId(identificationParam.getId());
+ pha.setCreateByUser(realName);
+ pha.setCreateByUserId(currentUserId.intValue());
phaInsertDTO = phaService.insertPha(currentUserId, pha);
if (ObjectUtils.isEmpty(phaInsertDTO)){
tag = 0;
@@ -208,6 +215,8 @@
}else if (identificationParam.getIdentificationMethod() == 2){
RiskAssessPlanIdentificationJha jha = BeanCopyUtils.copyBean(identificationParam, RiskAssessPlanIdentificationJha.class);
jha.setAssessPlanId(identificationParam.getId());
+ jha.setCreateByUser(realName);
+ jha.setCreateByUserId(currentUserId.intValue());
jhaInsertDTO = jhaService.insertJha(currentUserId, jha);
if (ObjectUtils.isEmpty(jhaInsertDTO)){
tag = 0;
@@ -218,6 +227,8 @@
}else if (identificationParam.getIdentificationMethod() == 3){
RiskAssessPlanIdentificationScl scl = BeanCopyUtils.copyBean(identificationParam, RiskAssessPlanIdentificationScl.class);
scl.setAssessPlanId(identificationParam.getId());
+ scl.setCreateByUser(realName);
+ scl.setCreateByUserId(currentUserId.intValue());
sclInsertDTO = sclService.insertScl(currentUserId, scl);
if (ObjectUtils.isEmpty(sclInsertDTO)){
tag = 0;
@@ -228,6 +239,9 @@
}else if (identificationParam.getIdentificationMethod() == 4){
RiskAssessPlanIdentificationHazop hazop = BeanCopyUtils.copyBean(identificationParam, RiskAssessPlanIdentificationHazop.class);
hazop.setAssessPlanId(identificationParam.getId());
+ hazop.setCreateByUser(realName);
+ hazop.setCreateByUserId(currentUserId.intValue());
+
hazopInsertDTO = hazopService.insertHazop(currentUserId, hazop);
if (ObjectUtils.isEmpty(hazopInsertDTO)){
tag = 0;
@@ -238,6 +252,8 @@
}else if (identificationParam.getIdentificationMethod() == 5){
RiskAssessPlanIdentificationAnalogy analogy = BeanCopyUtils.copyBean(identificationParam, RiskAssessPlanIdentificationAnalogy.class);
analogy.setAssessPlanId(identificationParam.getId());
+ analogy.setCreateByUser(realName);
+ analogy.setCreateByUserId(currentUserId.intValue());
analogyInsertDTO = analogyService.insertAnalogy(currentUserId, analogy);
if (ObjectUtils.isEmpty(analogyInsertDTO)){
tag = 0;
@@ -267,7 +283,11 @@
if (currentUserId < 0){
throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登录");
}
-
+ UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
+ if (userInfoById == null){
+ throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登录");
+ }
+ String realName = userInfoById.getRealName();
RiskAssessPlanIdentificationAppUpdateBO updateParam = BeanCopyUtils.copyBean(updateReqBO, RiskAssessPlanIdentificationAppUpdateBO.class);
int tag = 1;
FactorQueryDTO factorQueryDTO = new FactorQueryDTO();
@@ -277,6 +297,8 @@
RiskAssessPlanIdentificationPha pha = BeanCopyUtils.copyBean(updateParam, RiskAssessPlanIdentificationPha.class);
pha.setAssessPlanId(updateParam.getId());
pha.setId(updateParam.getPhaId());
+ pha.setUpdateByUser(realName);
+ pha.setUpdateByUserId(currentUserId.intValue());
PhaInsertDTO phaInsertDTO = phaService.updatePha(currentUserId, pha);
if (ObjectUtils.isEmpty(phaInsertDTO)){
tag = 0;
@@ -288,6 +310,8 @@
RiskAssessPlanIdentificationJha jha = BeanCopyUtils.copyBean(updateParam, RiskAssessPlanIdentificationJha.class);
jha.setAssessPlanId(updateParam.getId());
jha.setId(updateParam.getJhaId());
+ jha.setUpdateByUser(realName);
+ jha.setUpdateByUserId(currentUserId.intValue());
JhaInsertDTO jhaInsertDTO = jhaService.updateJha(currentUserId, jha);
if (ObjectUtils.isEmpty(jhaInsertDTO)){
tag = 0;
@@ -299,6 +323,8 @@
RiskAssessPlanIdentificationScl scl = BeanCopyUtils.copyBean(updateParam, RiskAssessPlanIdentificationScl.class);
scl.setAssessPlanId(updateParam.getId());
scl.setId(updateParam.getSclId());
+ scl.setUpdateByUser(realName);
+ scl.setUpdateByUserId(currentUserId.intValue());
SclInsertDTO sclInsertDTO = sclService.updateScl(currentUserId, scl);
if (ObjectUtils.isEmpty(sclInsertDTO)){
tag = 0;
@@ -310,6 +336,8 @@
RiskAssessPlanIdentificationHazop hazop = BeanCopyUtils.copyBean(updateParam, RiskAssessPlanIdentificationHazop.class);
hazop.setAssessPlanId(updateParam.getId());
hazop.setId(updateParam.getHazopId());
+ hazop.setUpdateByUser(realName);
+ hazop.setUpdateByUserId(currentUserId.intValue());
HazopInsertDTO hazopInsertDTO = hazopService.updateHazop(currentUserId, hazop);
if (ObjectUtils.isEmpty(hazopInsertDTO)){
tag = 0;
@@ -321,6 +349,8 @@
RiskAssessPlanIdentificationAnalogy analogy = BeanCopyUtils.copyBean(updateParam, RiskAssessPlanIdentificationAnalogy.class);
analogy.setAssessPlanId(updateParam.getId());
analogy.setId(updateParam.getAnalogyId());
+ analogy.setUpdateByUser(realName);
+ analogy.setUpdateByUserId(currentUserId.intValue());
AnalogyInsertDTO analogyInsertDTO = analogyService.updateAnalogy(currentUserId, analogy);
if (ObjectUtils.isEmpty(analogyInsertDTO)){
tag = 0;
@@ -607,14 +637,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 != 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(), "所选实验不能为空");
}
@@ -715,14 +746,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 != 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(), "所选实验不能为空,或实验已被删除");
}
@@ -764,14 +796,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 != 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)){
--
Gitblit v1.9.2