禅道bug修改。

This commit is contained in:
wangzhijiang
2022-11-04 18:30:11 +08:00
parent 37be68ce2c
commit 824ce72e2a
6 changed files with 115 additions and 29 deletions
@@ -684,7 +684,7 @@ public class SysPermissionController {
//项目参数任务 //项目参数任务
if(StringUtils.equals(permission.getId(), SysPermissionEnum.PROJECT_PARAMETER_TASKS.getId())){ if(StringUtils.equals(permission.getId(), SysPermissionEnum.PROJECT_PARAMETER_TASKS.getId())){
boolean existTaskFlag = false; boolean existTaskFlag = false;
existTaskFlag = sysPermissionService.judgeToDo(); // existTaskFlag = sysPermissionService.judgeToDo();
meta.put("existTask",existTaskFlag); meta.put("existTask",existTaskFlag);
} }
json.put("meta", meta); json.put("meta", meta);
@@ -6,6 +6,8 @@ public enum RoleEnum {
COUNTRU_CARD_MANAGE("countryCard管理员","countryCardManage","countryCardManage","1564916346120916993",4), COUNTRU_CARD_MANAGE("countryCard管理员","countryCardManage","countryCardManage","1564916346120916993",4),
ENGINEERING_INTERFACE_PERSON("工程接口人","engineeringInterfacePerson","engineeringInterfacePerson","1534020084667674626",5), ENGINEERING_INTERFACE_PERSON("工程接口人","engineeringInterfacePerson","engineeringInterfacePerson","1534020084667674626",5),
ENGINEER("工程师","engineer","engineer","1534020318437208065",6), ENGINEER("工程师","engineer","engineer","1534020318437208065",6),
HOMOLOGATION_ENGINEER("认证工程师","homologationEngineer","homologationEngineer","1534019729326239745",8),
REGULATION_OWNER("法规工程师","regulationOwner","regulationOwner","1534021004067500034",7),
; ;
String name; String name;
@@ -289,4 +289,16 @@ public interface ISysUserService extends IService<SysUser> {
* @return * @return
*/ */
boolean isEngineer(LoginUser currentUser); boolean isEngineer(LoginUser currentUser);
/**
* 验证当前登录用户是否是认证工程师角色
* @return
*/
boolean isHomologationEngineer(LoginUser currentUser);
/**
* 验证当前登录用户是否是法规工程师角色
* @return
*/
boolean isRegulationOwner(LoginUser currentUser);
} }
@@ -656,4 +656,46 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
} }
return result; return result;
} }
@Override
public boolean isHomologationEngineer(LoginUser currentUser) {
boolean result = false;
RoleEnum engineer = RoleEnum.HOMOLOGATION_ENGINEER;
List<SysUserRole> userRoleList = this.sysUserRoleMapper.selectList(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, currentUser.getId()));
if(CollectionUtils.isNotEmpty(userRoleList)){
List<SysUserRole> userRoles = userRoleList.stream().filter(userRole -> {
boolean flag = false;
if(StringUtils.equals(userRole.getRoleId(),engineer.getId())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(userRoles)){
result = true;
}
}
return result;
}
@Override
public boolean isRegulationOwner(LoginUser currentUser) {
boolean result = false;
RoleEnum engineer = RoleEnum.REGULATION_OWNER;
List<SysUserRole> userRoleList = this.sysUserRoleMapper.selectList(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, currentUser.getId()));
if(CollectionUtils.isNotEmpty(userRoleList)){
List<SysUserRole> userRoles = userRoleList.stream().filter(userRole -> {
boolean flag = false;
if(StringUtils.equals(userRole.getRoleId(),engineer.getId())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(userRoles)){
result = true;
}
}
return result;
}
} }
@@ -87,11 +87,15 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
/** /**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。 * 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
* 2022-11-04 增加法规、认证工程师与上方权限一致。
*/ */
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isAdministrator = this.sysUserService.isAdministrator();
boolean isEngineer = this.sysUserService.isEngineer(currentUser); boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser); boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){ boolean isHomologationEngineer = this.sysUserService.isHomologationEngineer(currentUser);
boolean isRegulationOwner = this.sysUserService.isRegulationOwner(currentUser);
if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner) && !isAdministrator){
params.put("currentUserId",currentUser.getId()); params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true); params.put("isEngineerOrEngineeringInterfacePerson",true);
} }
@@ -159,11 +163,15 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
public JSONObject queryComplianceResultList(Map<String, Object> params) { public JSONObject queryComplianceResultList(Map<String, Object> params) {
/** /**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。 * 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
* 2022-11-04 增加法规、认证工程师与上方权限一致。
*/ */
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isAdministrator = this.sysUserService.isAdministrator();
boolean isEngineer = this.sysUserService.isEngineer(currentUser); boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser); boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){ boolean isHomologationEngineer = this.sysUserService.isHomologationEngineer(currentUser);
boolean isRegulationOwner = this.sysUserService.isRegulationOwner(currentUser);
if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner) && !isAdministrator){
params.put("currentUserId",currentUser.getId()); params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true); params.put("isEngineerOrEngineeringInterfacePerson",true);
} }
@@ -177,8 +185,8 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
QueryWrapper<ProjectTaskInventoryDetailEO> taskDetailQueryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectTaskInventoryDetailEO> taskDetailQueryWrapper = new QueryWrapper<>();
taskDetailQueryWrapper.lambda().in(ProjectTaskInventoryDetailEO::getProjectTaskInventoryId,projectLawsInventoryIdList); taskDetailQueryWrapper.lambda().in(ProjectTaskInventoryDetailEO::getProjectTaskInventoryId,projectLawsInventoryIdList);
List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList = this.projectTaskInventoryDetailEOMapper.selectList(taskDetailQueryWrapper); List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList = this.projectTaskInventoryDetailEOMapper.selectList(taskDetailQueryWrapper);
this.createTaskInventoryEOList(complianceResultList,projectTaskInventoryDetailEOList,currentUser,isEngineer,isEngineeringInterfacePerson); this.createTaskInventoryEOList(complianceResultList,projectTaskInventoryDetailEOList,currentUser,isEngineer,isEngineeringInterfacePerson,isHomologationEngineer,isRegulationOwner);
this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson); this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson,isHomologationEngineer,isRegulationOwner,isAdministrator);
} }
result.put("complianceResultList",complianceResultList); result.put("complianceResultList",complianceResultList);
@@ -187,18 +195,19 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getStandId,id); opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getStandId,id);
opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getGatherResult,GatherResultEnum.COMPLETED.getValue()); opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getGatherResult,GatherResultEnum.COMPLETED.getValue());
//如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规意见收集数据。 //如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规意见收集数据。
if(isEngineer || isEngineeringInterfacePerson){ if(!isAdministrator){
opinionGatherEOQueryWrapper.lambda().like(LawsOpinionGatherEO::getEvaluatorIds,currentUser.getId()); opinionGatherEOQueryWrapper.lambda().like(LawsOpinionGatherEO::getEvaluatorIds,currentUser.getId());
} }
int opinionGatherCount = this.lawsOpinionGatherEOService.count(opinionGatherEOQueryWrapper); int opinionGatherCount = this.lawsOpinionGatherEOService.count(opinionGatherEOQueryWrapper);
result.put("opinionGather",opinionGatherCount); result.put("opinionGather",opinionGatherCount);
//如果登录人不是超级管理员,则只能看到跟自己相关的数据
//查询当前数据是否有法规技术评估流程数据 //查询当前数据是否有法规技术评估流程数据
QueryWrapper<LawsTechnologyEvaluationEO> evaluationEOQueryWrapper = new QueryWrapper<>(); QueryWrapper<LawsTechnologyEvaluationEO> evaluationEOQueryWrapper = new QueryWrapper<>();
evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getStandId,id); evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getStandId,id);
evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus,GatherResultEnum.COMPLETED.getValue()); evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus,GatherResultEnum.COMPLETED.getValue());
//如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规技术评估数据。 //如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规技术评估数据。
if(isEngineer || isEngineeringInterfacePerson){ if(!isAdministrator){
this.lawsTechnologyEvaluationEOService.createQueryPermission(evaluationEOQueryWrapper,null,false); this.lawsTechnologyEvaluationEOService.createQueryPermission(evaluationEOQueryWrapper,null,false);
} }
int evaluationCount = this.lawsTechnologyEvaluationEOService.count(evaluationEOQueryWrapper); int evaluationCount = this.lawsTechnologyEvaluationEOService.count(evaluationEOQueryWrapper);
@@ -218,7 +227,9 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList, List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList,
LoginUser currentUser, LoginUser currentUser,
boolean isEngineer, boolean isEngineer,
boolean isEngineeringInterfacePerson) { boolean isEngineeringInterfacePerson,
boolean isHomologationEngineer,
boolean isRegulationOwner) {
if(CollectionUtils.isNotEmpty(complianceResultList) && CollectionUtils.isNotEmpty(projectTaskInventoryDetailEOList)){ if(CollectionUtils.isNotEmpty(complianceResultList) && CollectionUtils.isNotEmpty(projectTaskInventoryDetailEOList)){
for (Map<String, Object> complianceResult : complianceResultList) { for (Map<String, Object> complianceResult : complianceResultList) {
String designPid = ""; String designPid = "";
@@ -239,7 +250,8 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String verifyTaskDefinitionKey = ""; String verifyTaskDefinitionKey = "";
String verifyTaskDetailId = ""; String verifyTaskDetailId = "";
//2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。 //2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
if((isEngineer || isEngineeringInterfacePerson)){ //2022-11-04 增加法规、认证工程师与上方权限一致。
if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner)){
for (ProjectTaskInventoryDetailEO projectTaskInventoryDetail : projectTaskInventoryDetailEOList) { for (ProjectTaskInventoryDetailEO projectTaskInventoryDetail : projectTaskInventoryDetailEOList) {
if(StringUtils.equals(complianceResult.get("id").toString(),projectTaskInventoryDetail.getProjectTaskInventoryId())){ if(StringUtils.equals(complianceResult.get("id").toString(),projectTaskInventoryDetail.getProjectTaskInventoryId())){
/** /**
@@ -359,14 +371,20 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
} }
} }
public void disposeComplianceResult(List<Map<String,Object>> complianceResultList,String cut,boolean isEngineer,boolean isEngineeringInterfacePerson){ public void disposeComplianceResult(List<Map<String,Object>> complianceResultList,
String cut,
boolean isEngineer,
boolean isEngineeringInterfacePerson,
boolean isHomologationEngineer,
boolean isRegulationOwner,
boolean isAdministrator){
if(CollectionUtils.isNotEmpty(complianceResultList)){ if(CollectionUtils.isNotEmpty(complianceResultList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory"); List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory");
for (Map<String, Object> complianceResult : complianceResultList) { for (Map<String, Object> complianceResult : complianceResultList) {
if(isEngineer || isEngineeringInterfacePerson){ if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner) && !isAdministrator){
if(!StringUtils.equals(complianceResult.get("designInitiatorId").toString(),currentUser.getId()) if(!StringUtils.equals(complianceResult.get("designInitiatorId").toString(),currentUser.getId())
|| !StringUtils.equals(complianceResult.get("designDutyId").toString(),currentUser.getId())){ && !StringUtils.equals(complianceResult.get("designDutyId").toString(),currentUser.getId())){
complianceResult.put("designStatus",""); complianceResult.put("designStatus","");
complianceResult.put("designFlowTaskStatus",""); complianceResult.put("designFlowTaskStatus","");
complianceResult.put("designPId",""); complianceResult.put("designPId","");
@@ -461,9 +479,12 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
List<Map<String,Object>> exportData = new ArrayList<>(); List<Map<String,Object>> exportData = new ArrayList<>();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isAdministrator = this.sysUserService.isAdministrator();
boolean isEngineer = this.sysUserService.isEngineer(currentUser); boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser); boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){ boolean isHomologationEngineer = this.sysUserService.isHomologationEngineer(currentUser);
boolean isRegulationOwner = this.sysUserService.isRegulationOwner(currentUser);
if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner) && !isAdministrator){
params.put("currentUserId",currentUser.getId()); params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true); params.put("isEngineerOrEngineeringInterfacePerson",true);
} }
@@ -484,7 +505,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
List<Map<String,Object>> complianceResultList = new ArrayList<>(); List<Map<String,Object>> complianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(idList)){ if(CollectionUtils.isNotEmpty(idList)){
complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params); complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson); this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson,isHomologationEngineer,isRegulationOwner,isAdministrator);
} }
String title = ""; String title = "";
@@ -596,16 +617,20 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String cut = (String) params.get("cut"); String cut = (String) params.get("cut");
/** /**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。 * 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
* 2022-11-04 增加法规、认证工程师与上方权限一致。
*/ */
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isAdministrator = this.sysUserService.isAdministrator();
boolean isEngineer = this.sysUserService.isEngineer(currentUser); boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser); boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){ boolean isHomologationEngineer = this.sysUserService.isHomologationEngineer(currentUser);
boolean isRegulationOwner = this.sysUserService.isRegulationOwner(currentUser);
if((isEngineer || isEngineeringInterfacePerson || isHomologationEngineer || isRegulationOwner) && !isAdministrator){
params.put("currentUserId",currentUser.getId()); params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true); params.put("isEngineerOrEngineeringInterfacePerson",true);
} }
List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params); List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(exportData,cut,isEngineer,isEngineeringInterfacePerson); this.disposeComplianceResult(exportData,cut,isEngineer,isEngineeringInterfacePerson,isHomologationEngineer,isRegulationOwner,isAdministrator);
String title = ""; String title = "";
String fileName = ""; String fileName = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){ if(StringUtils.equals(cut, CutEnum.CN.getValue())){
@@ -88,7 +88,8 @@
LEFT JOIN sys_user createBy on createBy.id = pi.create_by LEFT JOIN sys_user createBy on createBy.id = pi.create_by
LEFT JOIN buss_document_library bdl ON pi.buss_document_library_id = bdl.id LEFT JOIN buss_document_library bdl ON pi.buss_document_library_id = bdl.id
<where> <where>
and pi.id IN ( <if test="params.queryType != 'issuedProcess'">
and pi.id IN (
SELECT SELECT
pid.process_info_id pid.process_info_id
FROM FROM
@@ -99,7 +100,9 @@
and pid.status = #{params.taskStatus} and pid.status = #{params.taskStatus}
</if> </if>
</where> </where>
) )
</if>
<if test="params.flowTypeList != null"> <if test="params.flowTypeList != null">
and pi.flow_type in and pi.flow_type in
<foreach collection="params.flowTypeList" index="index" item="item" open="(" separator="," close=")"> <foreach collection="params.flowTypeList" index="index" item="item" open="(" separator="," close=")">
@@ -287,18 +290,20 @@
<foreach collection="params.flowTypeList" index="index" item="item" open="(" separator="," close=")"> <foreach collection="params.flowTypeList" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
and ( <if test="params.queryType != 'issuedProcess'">
pi.id IN ( and (
SELECT pi.id IN (
pid.process_info_id SELECT
FROM pid.process_info_id
process_info_detail pid FROM
where pid.user_id = #{params.currentUserId} process_info_detail pid
<if test="params.taskStatus != null and params.taskStatus != ''"> where pid.user_id = #{params.currentUserId}
and pid.status = #{params.taskStatus} <if test="params.taskStatus != null and params.taskStatus != ''">
</if> and pid.status = #{params.taskStatus}
</if>
)
) )
) </if>
<if test="params.queryType == 'issuedProcess'"> <if test="params.queryType == 'issuedProcess'">
and pi.create_by = #{params.createBy} and pi.create_by = #{params.createBy}
</if> </if>