Selaa lähdekoodia

数据权限 审查清单

tags/24080901
PoffyZhang 1 vuosi sitten
vanhempi
commit
125f74c7b1
2 muutettua tiedostoa jossa 97 lisäystä ja 32 poistoa
  1. +34
    -20
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java
  2. +63
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java

+ 34
- 20
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java Näytä tiedosto

@@ -71,9 +71,10 @@ public class ReviewChecklistManage {
query.eq(Project::getNewest, Boolean.TRUE);
//建设方案提交后的状态
query.ge(Project::getStatus,ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode())
.ne(Project::getStatus,ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
.ne(Project::getStatus,ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode())
.eq(Project::getAreaCode,RegionConst.RC_LS);
UserInfoDetails user = LoginUserUtil.loginUserDetail();
buildProjectLibPermission(query, user);
buildReviewCheckPermission(query, user);

Page<Project> page = projectService.page(req.page(), query);
long total;
@@ -170,40 +171,53 @@ public class ReviewChecklistManage {
.map(s -> userMap.get(s)).collect(Collectors.joining(StrPool.COMMA));
}

public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserInfoDetails user) {
public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper<Project> query, UserInfoDetails user) {
UserFullInfoDTO userDto = BeanUtil.copyProperties(user,UserFullInfoDTO.class);
//1.只有 市本级能看到
String regionCode = user.getRegionCode();
String employeeCode = user.getEmployeeCode();
//如果是七大审查之一 就可以看
List<String> reviewHumans = Lists.newArrayList();;
if(BizConst.DEV.equals(active)){
reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD;
}else{
reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD;
}
if(reviewHumans.contains(employeeCode)){
log.warn("为七大审查人之一 可以查看");
return userDto;
}

if(!regionCode.equals(RegionConst.RC_LS) || StringUtils.isBlank(employeeCode)){
log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}",user.getUsername(),
user.getRegionCode(),user.getEmployeeCode());
query.eq(Project::getId, 0L);
return userDto;
}

Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto);
if (!currentUserDataScope.isPresent()) {
log.warn("没有取到权限信息 当前查询 没有权限条件");
query.eq(Project::getId, 0L);
return userDto;
}

switch (currentUserDataScope.get().getRole()) {
case NORMAL_MEMBER:
//普通用户 只能看到自己单位去申报的
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode());
//普通用户 看不了
query.eq(Project::getId, 0L);
break;
case COMPANY_MANAGER:
case VISITOR:
case DASHBOARD:
//单位管理员 看
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode());
query.eq(Project::getId, 0L);
break;
case SUPER_ADMIN:
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
//超级管理员 可以
break;
case REGION_MANAGER:
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的
if (RegionConst.RC_LS.equals(user.getRegionCode())) {
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(),
RegionConst.RL_CITY);
query.in(Project::getAreaCode, regionCodes);
} else {
query.eq(Project::getAreaCode, user.getRegionCode());
}
break;
case VISITOR:
//访客可以看全市的
break;
case DASHBOARD:
//区域管理员 可以看
break;
default:
//没有权限的话 就让它查不到


+ 63
- 12
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java Näytä tiedosto

@@ -29,8 +29,11 @@ import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService;
import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
@@ -38,6 +41,8 @@ import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.history.HistoricActivityInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
@@ -77,6 +82,9 @@ public class CockpitStatsStatisticsTask {
private IProjectService projectService;

@Autowired
private IProjectInstService projectInstService;

@Autowired
private IExpertUserFullInfoService expertUserFullInfoService;

@Autowired
@@ -88,6 +96,9 @@ public class CockpitStatsStatisticsTask {
private IGovBizProjectApplyService applyService;

@Autowired
private HistoryService historyService;

@Autowired
private IGovBizProjectApproveService approveService;

@Autowired
@@ -325,14 +336,14 @@ public class CockpitStatsStatisticsTask {
cockpitStats.setExpertTechnicalFeasibilityAssessmentNum(0);

//3.顶部数据
//3.1 计划项目数(通过单位内部审核的项目)
//3.1 计划项目数(建设方案待申报和申报了未开始审核的项目)
Integer planProjectNum = projects.stream().filter(p -> {
if(Objects.nonNull(p.getStatus()) &&
p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList()).size();
if(Objects.nonNull(p.getStatus()) &&
p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList()).size();
cockpitStats.setTopPlanProjectsNum(planProjectNum);
//3.2 批复项目数(可以用批复金额来判断)
Integer approvalNumDeclared = projects.stream().filter(p -> {
@@ -400,21 +411,23 @@ public class CockpitStatsStatisticsTask {
cockpitStats.setProjectsTotal(projects.size() + baseProjCount);

//5.下面项目状态数
//5.1 处于计划 (单位内部)
//5.1 计划
Integer inPlanNum = projects.stream().filter(p -> {
if(Objects.nonNull(p.getStatus()) &&
p.getStatus().equals(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode())){
p.getStatus().compareTo(ProjectStatusEnum.PRE_APPLYING.getCode()) > 0 &&
p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0){
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList()).size();
cockpitStats.setProjectsTotalPlan(inPlanNum);

//5.2 处于申报 (预审)
//5.2 处于申报
Integer inApplyNum = projects.stream().filter(p -> {
if(Objects.nonNull(p.getStatus()) &&
p.getStatus().compareTo(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()) > 0
&& p.getStatus().compareTo(ProjectStatusEnum.TO_BE_APPROVED.getCode()) <= 0){
(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) ||
(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) &&
searchSechmeReviewFlow(p.getProjectCode())))){
return Boolean.TRUE;
}
return Boolean.FALSE;
@@ -582,6 +595,44 @@ public class CockpitStatsStatisticsTask {
}

/**
* 建设方案申报了 但未开始审核的项目
* @param projectCode
* @return
*/
private boolean searchSechmeReviewFlow(String projectCode) {
Project project = projectService.getProjectByCode(projectCode);
if(Objects.isNull(project)){
return Boolean.FALSE;
}
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(project);
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectId)
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())
.last(BizConst.LIMIT_1));
if(Objects.isNull(pi)){
return Boolean.FALSE;
}
String instCode = pi.getInstCode();
List<HistoricActivityInstance> finished = historyService.createHistoricActivityInstanceQuery()
.finished()
.processInstanceId(instCode)
.orderByHistoricActivityInstanceEndTime()
.asc()
.list();
List<HistoricActivityInstance> unfinished = historyService.createHistoricActivityInstanceQuery()
.unfinished()
.processInstanceId(instCode)
.orderByHistoricActivityInstanceStartTime()
.asc()
.list();
//已经完成的没有 未完成的有 则可计算
if(CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)){
return Boolean.TRUE;
}
return Boolean.FALSE;
}

/**
* 计算环节滞后项目
* @param projects
* @return


Loading…
Peruuta
Tallenna