批量操作+导入数据时添加权限

This commit is contained in:
CD
2022-11-14 16:32:24 +08:00
parent 52e94f2d6a
commit 819fe5ed08
2 changed files with 62 additions and 2 deletions
@@ -3184,6 +3184,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<ProjectLawsInventoryEO> infoList = list(queryWrapper.in("id", idList)); List<ProjectLawsInventoryEO> infoList = list(queryWrapper.in("id", idList));
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = new ArrayList<>(); List<ProjectLawsInventoryEO> projectLawsInventoryEOList = new ArrayList<>();
List<ProjectUserPermission> adds = new ArrayList<>();
Date now = new Date();
for (String id : projectLawsInventoryEO.getIds().split(",")) { for (String id : projectLawsInventoryEO.getIds().split(",")) {
ProjectLawsInventoryEO projectLawsInventoryEOTemp = new ProjectLawsInventoryEO(); ProjectLawsInventoryEO projectLawsInventoryEOTemp = new ProjectLawsInventoryEO();
projectLawsInventoryEOTemp.setId(id); projectLawsInventoryEOTemp.setId(id);
@@ -3227,46 +3230,57 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDueDate())){ if(ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDueDate())){
projectLawsInventoryEOTemp.setVerifyDueDate(projectLawsInventoryEO.getVerifyDueDate()); projectLawsInventoryEOTemp.setVerifyDueDate(projectLawsInventoryEO.getVerifyDueDate());
} }
//================================批量设置人员=================================================== //================================批量设置人员===================================================
//法规工程师id //法规工程师id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())){
projectLawsInventoryEOTemp.setRegulationOwnerId(projectLawsInventoryEO.getRegulationOwnerId()); projectLawsInventoryEOTemp.setRegulationOwnerId(projectLawsInventoryEO.getRegulationOwnerId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getRegulationOwnerId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_REGULATION.getValue());
} }
//认证工程师id //认证工程师id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())){
projectLawsInventoryEOTemp.setHomologationEngineerId(projectLawsInventoryEO.getHomologationEngineerId()); projectLawsInventoryEOTemp.setHomologationEngineerId(projectLawsInventoryEO.getHomologationEngineerId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getHomologationEngineerId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue());
} }
//工程接口人id //工程接口人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())){
projectLawsInventoryEOTemp.setEngineeringInterfacePerson(projectLawsInventoryEO.getEngineeringInterfacePerson()); projectLawsInventoryEOTemp.setEngineeringInterfacePerson(projectLawsInventoryEO.getEngineeringInterfacePerson());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getEngineeringInterfacePerson(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_INTERFACE.getValue());
} }
//设计符合性流程发起人id //设计符合性流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())){
projectLawsInventoryEOTemp.setDesignInitiatorId(projectLawsInventoryEO.getDesignInitiatorId()); projectLawsInventoryEOTemp.setDesignInitiatorId(projectLawsInventoryEO.getDesignInitiatorId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignInitiatorId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue());
} }
//设计符合性流程责任人id //设计符合性流程责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
projectLawsInventoryEOTemp.setDesignDutyId(projectLawsInventoryEO.getDesignDutyId()); projectLawsInventoryEOTemp.setDesignDutyId(projectLawsInventoryEO.getDesignDutyId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignDutyId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue());
} }
//Pre-homo确认流程发起人id //Pre-homo确认流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
projectLawsInventoryEOTemp.setPrehomoInitiatorId(projectLawsInventoryEO.getPrehomoInitiatorId()); projectLawsInventoryEOTemp.setPrehomoInitiatorId(projectLawsInventoryEO.getPrehomoInitiatorId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoInitiatorId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue());
} }
//Pre-homo确认责任人id //Pre-homo确认责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
projectLawsInventoryEOTemp.setPrehomoDutyId(projectLawsInventoryEO.getPrehomoDutyId()); projectLawsInventoryEOTemp.setPrehomoDutyId(projectLawsInventoryEO.getPrehomoDutyId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoDutyId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue());
} }
//验证符合性流程发起人id //验证符合性流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
projectLawsInventoryEOTemp.setVerifyInitiatorId(projectLawsInventoryEO.getVerifyInitiatorId()); projectLawsInventoryEOTemp.setVerifyInitiatorId(projectLawsInventoryEO.getVerifyInitiatorId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyInitiatorId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue());
} }
//验证符合性流程责任人id //验证符合性流程责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
projectLawsInventoryEOTemp.setVerifyDutyId(projectLawsInventoryEO.getVerifyDutyId()); projectLawsInventoryEOTemp.setVerifyDutyId(projectLawsInventoryEO.getVerifyDutyId());
setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyDutyId(),projectLibraryId, id, now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue());
} }
projectLawsInventoryEOList.add(projectLawsInventoryEOTemp); projectLawsInventoryEOList.add(projectLawsInventoryEOTemp);
} }
if (ObjectUtils.isNotEmpty(adds)) {
projectUserPermissionService.saveBatch(adds);
}
this.updateBatchById(projectLawsInventoryEOList); this.updateBatchById(projectLawsInventoryEOList);
@@ -5510,6 +5524,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.saveBatch(dataList); this.saveBatch(dataList);
//项目任务清单数据初始化。 //项目任务清单数据初始化。
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = new ArrayList<>(); List<ProjectTaskInventoryEO> projectTaskInventoryEOList = new ArrayList<>();
//权限添加
List<ProjectUserPermission> adds = new ArrayList<>();
Date now = new Date();
for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) {
ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO();
String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", "");
@@ -5517,6 +5534,37 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId());
projectLawsInventoryEO.setStandId(projectLawsInventoryEO.getStandId()); projectLawsInventoryEO.setStandId(projectLawsInventoryEO.getStandId());
projectTaskInventoryEOList.add(projectTaskInventoryEO); projectTaskInventoryEOList.add(projectTaskInventoryEO);
//设置权限
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getRegulationOwnerId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_REGULATION.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getHomologationEngineerId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getEngineeringInterfacePerson(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_INTERFACE.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignInitiatorId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignDutyId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoInitiatorId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoDutyId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyInitiatorId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue());
}
if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())) {
setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyDutyId(),projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue());
}
}
if (ObjectUtils.isNotEmpty(adds)) {
projectUserPermissionService.saveBatch(adds);
} }
this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList);
//初始化项目状态评估 //初始化项目状态评估
@@ -1070,6 +1070,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
*/ */
@Override @Override
public Result<?> oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) { public Result<?> oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
ProjectLibraryBase projectLibraryBase = projectLibraryBaseMapper.selectById(projectId);
//查询所有的用户 //查询所有的用户
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
wrapper.select(SysUser::getUsername,SysUser::getId); wrapper.select(SysUser::getUsername,SysUser::getId);
@@ -1342,7 +1343,6 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
//用于权限对比 //用于权限对比
ProjectRelatedPersonnel original = baseMapper.selectById(projectRelatedPersonnel.getId()); ProjectRelatedPersonnel original = baseMapper.selectById(projectRelatedPersonnel.getId());
ProjectLibraryBase projectLibraryBase = projectLibraryBaseMapper.selectById(projectId);
setLawsInventoryPermission(projectId, belongs, projectRelatedPersonnel, original, projectLibraryBase); setLawsInventoryPermission(projectId, belongs, projectRelatedPersonnel, original, projectLibraryBase);
@@ -1620,6 +1620,15 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
if (ObjectUtils.isNotEmpty(personnel)) { if (ObjectUtils.isNotEmpty(personnel)) {
projectId = personnel.getProjectId(); projectId = personnel.getProjectId();
} }
ProjectLibraryBase projectLibraryBase = projectLibraryBaseMapper.selectById(projectId);
//修改当前属于当前责任领域的法规清单的人员权限
List<String> belongs = new ArrayList<>();
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue());
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue());
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue());
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue());
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue());
belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue());
Date now = new Date(); Date now = new Date();
for (String id : projectRelatedPersonnel.getIds().split(",")) { for (String id : projectRelatedPersonnel.getIds().split(",")) {
@@ -1675,6 +1684,9 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
projectUserPermissionService.remove(delPermissionQueryWrapper); projectUserPermissionService.remove(delPermissionQueryWrapper);
} }
projectRelatedPersonnelList.add(projectRelatedPersonnelTemp); projectRelatedPersonnelList.add(projectRelatedPersonnelTemp);
//修改当前属于当前责任领域的法规清单的人员权限
ProjectRelatedPersonnel original = baseMapper.selectById(projectRelatedPersonnel.getId());
setLawsInventoryPermission(projectRelatedPersonnel.getProjectId(), belongs, projectRelatedPersonnel, original, projectLibraryBase);
} }
this.updateBatchById(projectRelatedPersonnelList); this.updateBatchById(projectRelatedPersonnelList);