|
|
@@ -80,81 +80,37 @@ public class ProjectFileManage { |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
|
|
|
|
// Page<Project> page = param.page(); |
|
|
|
//projectService.page(page,Wrappers.lambdaQuery(Project.class) |
|
|
|
// .like(StringUtils.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) |
|
|
|
// .like(StringUtils.isNotBlank(param.getBuildOrgName()),Project::getBuildOrgName,param.getBuildOrgName()) |
|
|
|
// .eq(Project::getStatus,ProjectStatusEnum.ARCHIVED.getCode()) |
|
|
|
// .orderByDesc(Project::getUpdateOn)); |
|
|
|
//if(0L == page.getTotal()){ |
|
|
|
// return PageVo.empty(); |
|
|
|
//} |
|
|
|
//List<ProjectFileListVO> vos = page.getRecords().stream().map(p -> { |
|
|
|
// ProjectFileListVO vo = new ProjectFileListVO(); |
|
|
|
// vo.setId(p.getId()); |
|
|
|
// // 判断该项目是否可以查阅(用户只可查阅自己及下属单位的项目档案) |
|
|
|
// List<String> ordCodeList = Lists.newArrayList(); |
|
|
|
// String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); |
|
|
|
// ordCodeList.add(empPosUnitCode); |
|
|
|
// List<DingOrganization> subOrgList = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
// .eq(DingOrganization::getParentCode, empPosUnitCode)); |
|
|
|
// if (CollUtil.isNotEmpty(subOrgList)){ |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// vo.setCanRead(Boolean.TRUE); |
|
|
|
// vo.setBuildOrgName(p.getBuildOrgName()); |
|
|
|
// vo.setPojectCode(p.getProjectCode()); |
|
|
|
// vo.setProjectName(p.getProjectName()); |
|
|
|
// // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 |
|
|
|
// String instCode = p.getInstCode(); |
|
|
|
// // 获取流程通过后的流程实例 |
|
|
|
// HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
// .processInstanceId(instCode) |
|
|
|
// .singleResult(); |
|
|
|
// ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
// .eq(ProjectInst::getInstCode, instCode)); |
|
|
|
// Integer instType = projectInst.getInstType(); |
|
|
|
// // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 |
|
|
|
// ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
|
// .eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) |
|
|
|
// .eq(ProjectApplyBorrow::getProjectId, p.getId()) |
|
|
|
// .eq(ProjectApplyBorrow::getInstanceId, instCode)); |
|
|
|
// if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && |
|
|
|
// !HisProInsEndActId.END.equals(newInstance.getEndActivityId())){ |
|
|
|
// vo.setCanApplyBorrow(Boolean.FALSE); |
|
|
|
// } |
|
|
|
// return vo; |
|
|
|
//}).collect(Collectors.toList()); |
|
|
|
//return PageVo.of(vos,page.getTotal()); |
|
|
|
|
|
|
|
Set<String> subOrgSet = getSubOrgList(empPosUnitCode); |
|
|
|
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
.like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) |
|
|
|
.like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) |
|
|
|
.eq(Project::getStatus, ProjectStatusEnum.ARCHIVED.getCode()) |
|
|
|
.orderByDesc(Project::getUpdateOn)); |
|
|
|
.like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) |
|
|
|
.like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) |
|
|
|
.eq(Project::getStatus, ProjectStatusEnum.ARCHIVED.getCode()).orderByDesc(Project::getUpdateOn)); |
|
|
|
|
|
|
|
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目添加到列表中 |
|
|
|
HashSet<Long> borrowProjectIdSet = new HashSet<>(); |
|
|
|
List<ProjectApplyBorrow> applyBorrowList = projectApplyBorrowService.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
|
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode,subOrgSet) |
|
|
|
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)).stream() |
|
|
|
.filter(a -> borrowProjectIdSet.add(a.getProjectId())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
List<ProjectApplyBorrow> applyBorrowList = projectApplyBorrowService |
|
|
|
.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
|
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) |
|
|
|
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) |
|
|
|
.stream().filter(a -> borrowProjectIdSet.add(a.getProjectId())).collect(Collectors.toList()); |
|
|
|
for (ProjectApplyBorrow applyBorrow : applyBorrowList) { |
|
|
|
Long projectId = applyBorrow.getProjectId(); |
|
|
|
if (Objects.nonNull(projectId)){ |
|
|
|
if (Objects.nonNull(projectId)) { |
|
|
|
Project project = projectService.getById(projectId); |
|
|
|
projectList.add(project); |
|
|
|
} |
|
|
|
} |
|
|
|
// 对整合后的档案列表去重 |
|
|
|
HashSet<Long> projectIdSet = new HashSet<>(); |
|
|
|
List<Project> projects = |
|
|
|
projectList.stream().filter(p -> projectIdSet.add(p.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(projectList)){ |
|
|
|
if (CollUtil.isEmpty(projects)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<Project> records = projectList.stream().skip((long) (pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
|
|
|
List<Project> records = |
|
|
|
projects.stream().skip((long)(pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ProjectFileListVO> vos = records.stream().map(p -> { |
|
|
|
ProjectFileListVO vo = new ProjectFileListVO(); |
|
|
@@ -169,35 +125,32 @@ public class ProjectFileManage { |
|
|
|
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 |
|
|
|
String instCode = p.getInstCode(); |
|
|
|
// 获取流程实例 |
|
|
|
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(instCode) |
|
|
|
.singleResult(); |
|
|
|
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
.eq(ProjectInst::getInstCode, instCode)); |
|
|
|
HistoricProcessInstance newInstance = |
|
|
|
historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); |
|
|
|
ProjectInst projectInst = projectInstService |
|
|
|
.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); |
|
|
|
Integer instType = projectInst.getInstType(); |
|
|
|
// 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 |
|
|
|
ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
|
.eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) |
|
|
|
.eq(ProjectApplyBorrow::getProjectId, p.getId()) |
|
|
|
.eq(ProjectApplyBorrow::getInstanceId, instCode)); |
|
|
|
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && |
|
|
|
!HisProInsEndActId.END.equals(newInstance.getEndActivityId())){ |
|
|
|
ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers |
|
|
|
.lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) |
|
|
|
.eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); |
|
|
|
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) |
|
|
|
&& !HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { |
|
|
|
vo.setCanApplyBorrow(Boolean.FALSE); |
|
|
|
} |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return PageVo.of(vos,projectList.size()); |
|
|
|
return PageVo.of(vos, projectList.size()); |
|
|
|
} |
|
|
|
|
|
|
|
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()); |
|
|
|
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)); |
|
|
@@ -208,7 +161,6 @@ public class ProjectFileManage { |
|
|
|
public ProjectFileVO file(Long projectId) { |
|
|
|
ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId); |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
@@ -224,16 +176,14 @@ public class ProjectFileManage { |
|
|
|
Project project = projectService.getNewProject(projectId); |
|
|
|
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); |
|
|
|
|
|
|
|
//首先要判断 项目当前状态 是不是 已归档 |
|
|
|
VUtils.isTrue(!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStatus())) |
|
|
|
.throwMessage("提交失败 该项目不是 已归档"); |
|
|
|
// 首先要判断 项目当前状态 是不是 已归档 |
|
|
|
VUtils.isTrue(!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); |
|
|
|
|
|
|
|
String regionCode = user.getRegionCode(); |
|
|
|
|
|
|
|
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) |
|
|
|
.eq(WflowModels::getRegionCode, regionCode) |
|
|
|
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()) |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
.eq(WflowModels::getRegionCode, regionCode) |
|
|
|
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
if (Objects.isNull(model)) { |
|
|
|
log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); |
|
|
@@ -243,20 +193,21 @@ public class ProjectFileManage { |
|
|
|
ProcessStartParamsVo params = new ProcessStartParamsVo(); |
|
|
|
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); |
|
|
|
params.setProcessUsers(Collections.emptyMap()); |
|
|
|
//放入条件判断的项目字段 |
|
|
|
//把条件值给放入工作流 |
|
|
|
// 放入条件判断的项目字段 |
|
|
|
// 把条件值给放入工作流 |
|
|
|
defaultDeclaredProjectManage.buildCondition(params, project); |
|
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
|
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); |
|
|
|
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); |
|
|
|
String instanceId = |
|
|
|
processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); |
|
|
|
log.info("申请借阅申报成功 【{}】", instanceId); |
|
|
|
|
|
|
|
// 保存项目借阅实例相关 |
|
|
|
projectLibManage.saveProjectByApplyBorrow(project, user, instanceId); |
|
|
|
|
|
|
|
//发送给第一个审批人消息 |
|
|
|
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, |
|
|
|
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
// 发送给第一个审批人消息 |
|
|
|
noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeContant.PASS_MSG_TEMPLATE, |
|
|
|
MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
|