|
|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
@@ -17,6 +18,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
@@ -25,6 +27,8 @@ import com.ningdatech.pmapi.datascope.model.DataScopeDTO; |
|
|
|
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; |
|
|
|
import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow; |
|
|
|
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
@@ -81,6 +85,8 @@ public class ProjectLibManage { |
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
private final INdProjectDelayApplyService projectDelayApplyService; |
|
|
|
private final INdProjectApplyBorrowService projectApplyBorrowService; |
|
|
|
private final IDingOrganizationService dingOrganizationService; |
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
@@ -545,10 +551,47 @@ public class ProjectLibManage { |
|
|
|
} |
|
|
|
|
|
|
|
public List<ProcessDetailVO> processScheduleDetail(Long projectId) { |
|
|
|
|
|
|
|
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); |
|
|
|
|
|
|
|
List<ProcessDetailVO> processDetailVOS = new ArrayList<>(); |
|
|
|
// 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 |
|
|
|
Project project = projectService.getById(projectId); |
|
|
|
Set<String> subOrgList = getSubOrgList(empPosUnitCode); |
|
|
|
|
|
|
|
if (!checkCanRead(subOrgList,project)){ |
|
|
|
throw new BizException("您没有权限查看此项目档案!"); |
|
|
|
} |
|
|
|
return processExecuteHandle.handle(projectId, processDetailVOS); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean checkCanRead(Set<String> subOrgSet, Project project) { |
|
|
|
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目 |
|
|
|
HashSet<Long> borrowProjectIdSet = new HashSet<>(); |
|
|
|
List<Long> applyBorrowProjectIdList = projectApplyBorrowService |
|
|
|
.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
|
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) |
|
|
|
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) |
|
|
|
.stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); |
|
|
|
return applyBorrowProjectIdList.contains(project.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
private Set<String> getSubOrgList(String empPosUnitCode) { |
|
|
|
HashSet<String> orgSet = new HashSet<>(); |
|
|
|
// 先将自己加入子集 |
|
|
|
orgSet.add(empPosUnitCode); |
|
|
|
Set<String> subOrgList = dingOrganizationService |
|
|
|
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) |
|
|
|
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); |
|
|
|
// 遍历子集 |
|
|
|
for (String orgCode : subOrgList) { |
|
|
|
orgSet.addAll(getSubOrgList(orgCode)); |
|
|
|
} |
|
|
|
return orgSet; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void exportList(ProjectListReq param, HttpServletResponse response) { |
|
|
|
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); |
|
|
|
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); |
|
|
|