|
|
@@ -106,20 +106,18 @@ public class DeclaredRecordManage { |
|
|
|
private LambdaQueryWrapper<Project> buildQuery(DeclaredProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
|
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit()); |
|
|
|
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit()) |
|
|
|
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()); |
|
|
|
if (req.getCreateDateMin() != null) { |
|
|
|
query.ge(Project::getCreateOn, req.getCreateDateMin()); |
|
|
|
} |
|
|
|
if (req.getCreateDateMax() != null) { |
|
|
|
query.lt(Project::getCreateOn, req.getCreateDateMax().minusDays(1)); |
|
|
|
} |
|
|
|
if (req.getUnitStrip() != null) { |
|
|
|
query.eq(Project::getUnitStrip, req.getUnitStrip()); |
|
|
|
} |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean buildMhProjectLibPermission(LambdaQueryWrapper<MhProject> query, UserFullInfoDTO user, Long declaredUnitId) { |
|
|
|
private boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user, Long declaredUnitId) { |
|
|
|
boolean queryState = true; |
|
|
|
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
|
if (!currentUserDataScope.isPresent()) { |
|
|
@@ -158,42 +156,7 @@ public class DeclaredRecordManage { |
|
|
|
break; |
|
|
|
} |
|
|
|
if (queryState && !viewUnitIds.isEmpty()) { |
|
|
|
query.in(MhProject::getUnitId, viewUnitIds); |
|
|
|
} |
|
|
|
} |
|
|
|
return queryState; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { |
|
|
|
boolean queryState = true; |
|
|
|
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
|
if (!currentUserDataScope.isPresent()) { |
|
|
|
log.warn("没有取到权限信息 当前查询 没有权限条件"); |
|
|
|
queryState = false; |
|
|
|
} else { |
|
|
|
switch (currentUserDataScope.get().getRole()) { |
|
|
|
case NORMAL_MEMBER: |
|
|
|
//普通用户 只能看到自己单位去申报的 |
|
|
|
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); |
|
|
|
break; |
|
|
|
case COMPANY_MANAGER: |
|
|
|
List<Long> childUnitIds = mhUnitCache.getViewChildIdsRecursion(user.getMhUnitId()); |
|
|
|
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); |
|
|
|
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 |
|
|
|
query.in(Project::getBuildOrgCode, viewUnitIdList); |
|
|
|
break; |
|
|
|
case SUPER_ADMIN: |
|
|
|
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 |
|
|
|
break; |
|
|
|
case VISITOR: |
|
|
|
//访客可以看全市的 |
|
|
|
break; |
|
|
|
case DASHBOARD: |
|
|
|
break; |
|
|
|
default: |
|
|
|
//没有权限的话 就让它查不到 |
|
|
|
queryState = false; |
|
|
|
break; |
|
|
|
query.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); |
|
|
|
} |
|
|
|
} |
|
|
|
return queryState; |
|
|
@@ -203,7 +166,7 @@ public class DeclaredRecordManage { |
|
|
|
LambdaQueryWrapper<Project> query = buildQuery(req); |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
// 查询审核中、失败、待立项备案的项目信息 |
|
|
|
if (!buildProjectLibPermission(query, user)) { |
|
|
|
if (!buildProjectLibPermission(query, user, req.getDeclaredUnitId())) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
query.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), |
|
|
|