|
@@ -123,13 +123,13 @@ public class ProjectFileManage { |
|
|
String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); |
|
|
String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); |
|
|
|
|
|
|
|
|
Page<Project> page = param.page(); |
|
|
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()) |
|
|
|
|
|
|
|
|
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.ACCEPTED.getCode()) |
|
|
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) |
|
|
.orderByDesc(Project::getUpdateOn)); |
|
|
.orderByDesc(Project::getUpdateOn)); |
|
|
|
|
|
|
|
|
if(0L == page.getTotal()){ |
|
|
|
|
|
|
|
|
if (0L == page.getTotal()) { |
|
|
return PageVo.empty(); |
|
|
return PageVo.empty(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -140,7 +140,7 @@ public class ProjectFileManage { |
|
|
ProjectFileListVO vo = new ProjectFileListVO(); |
|
|
ProjectFileListVO vo = new ProjectFileListVO(); |
|
|
vo.setId(p.getId()); |
|
|
vo.setId(p.getId()); |
|
|
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 |
|
|
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 |
|
|
if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet,p)) { |
|
|
|
|
|
|
|
|
if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet, p)) { |
|
|
vo.setCanRead(Boolean.TRUE); |
|
|
vo.setCanRead(Boolean.TRUE); |
|
|
} |
|
|
} |
|
|
vo.setBuildOrgName(p.getBuildOrgName()); |
|
|
vo.setBuildOrgName(p.getBuildOrgName()); |
|
@@ -148,7 +148,7 @@ public class ProjectFileManage { |
|
|
vo.setProjectName(p.getProjectName()); |
|
|
vo.setProjectName(p.getProjectName()); |
|
|
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 |
|
|
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 |
|
|
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) |
|
|
.eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode,employeeCode) |
|
|
|
|
|
|
|
|
.eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) |
|
|
.eq(ProjectApplyBorrow::getProjectId, p.getId()) |
|
|
.eq(ProjectApplyBorrow::getProjectId, p.getId()) |
|
|
.orderByDesc(ProjectApplyBorrow::getCreateOn) |
|
|
.orderByDesc(ProjectApplyBorrow::getCreateOn) |
|
|
.last("limit 1")); |
|
|
.last("limit 1")); |
|
@@ -200,8 +200,8 @@ public class ProjectFileManage { |
|
|
// 先将自己加入子集 |
|
|
// 先将自己加入子集 |
|
|
orgSet.add(empPosUnitCode); |
|
|
orgSet.add(empPosUnitCode); |
|
|
Set<String> subOrgList = dingOrganizationService |
|
|
Set<String> subOrgList = dingOrganizationService |
|
|
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) |
|
|
|
|
|
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) |
|
|
|
|
|
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); |
|
|
// 遍历子集 |
|
|
// 遍历子集 |
|
|
for (String orgCode : subOrgList) { |
|
|
for (String orgCode : subOrgList) { |
|
|
orgSet.addAll(getSubOrgList(orgCode)); |
|
|
orgSet.addAll(getSubOrgList(orgCode)); |
|
@@ -218,7 +218,7 @@ public class ProjectFileManage { |
|
|
Project project = projectService.getById(projectId); |
|
|
Project project = projectService.getById(projectId); |
|
|
Set<String> subOrgList = getSubOrgList(empPosUnitCode); |
|
|
Set<String> subOrgList = getSubOrgList(empPosUnitCode); |
|
|
|
|
|
|
|
|
if (!checkCanRead(subOrgList,project)){ |
|
|
|
|
|
|
|
|
if (!checkCanRead(subOrgList, project)) { |
|
|
throw new BizException("您没有权限查看此项目档案!"); |
|
|
throw new BizException("您没有权限查看此项目档案!"); |
|
|
} |
|
|
} |
|
|
ProjectFileVO projectFileVo = new ProjectFileVO(); |
|
|
ProjectFileVO projectFileVo = new ProjectFileVO(); |
|
@@ -260,8 +260,8 @@ public class ProjectFileManage { |
|
|
String regionCode = user.getRegionCode(); |
|
|
String regionCode = user.getRegionCode(); |
|
|
|
|
|
|
|
|
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) |
|
|
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)) { |
|
|
if (Objects.isNull(model)) { |
|
|
log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); |
|
|
log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); |
|
@@ -277,7 +277,7 @@ public class ProjectFileManage { |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); |
|
|
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(project); |
|
|
String instanceId = |
|
|
String instanceId = |
|
|
processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); |
|
|
|
|
|
|
|
|
processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); |
|
|
log.info("申请借阅申报成功 【{}】", instanceId); |
|
|
log.info("申请借阅申报成功 【{}】", instanceId); |
|
|
|
|
|
|
|
|
// 保存项目借阅实例相关 |
|
|
// 保存项目借阅实例相关 |
|
@@ -285,7 +285,7 @@ public class ProjectFileManage { |
|
|
|
|
|
|
|
|
// 发送给第一个审批人消息 |
|
|
// 发送给第一个审批人消息 |
|
|
noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, |
|
|
noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, |
|
|
MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
|
|
|
MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
|
|
|
return instanceId; |
|
|
return instanceId; |
|
|
} |
|
|
} |
|
@@ -295,48 +295,43 @@ public class ProjectFileManage { |
|
|
// 获取项目各阶段上传文件ID |
|
|
// 获取项目各阶段上传文件ID |
|
|
List<Long> fileIdList = Lists.newArrayList(); |
|
|
List<Long> fileIdList = Lists.newArrayList(); |
|
|
getProjectAppendix(project, fileIdList); |
|
|
getProjectAppendix(project, fileIdList); |
|
|
|
|
|
|
|
|
|
|
|
if (fileIdList.isEmpty()) { |
|
|
|
|
|
throw BizException.wrap("暂无档案可供下载"); |
|
|
|
|
|
} |
|
|
|
|
|
List<File> files = fileService.listByIds(fileIdList); |
|
|
|
|
|
if (files.isEmpty()) { |
|
|
|
|
|
throw BizException.wrap("暂无档案可供下载"); |
|
|
|
|
|
} |
|
|
String zipFileName = "项目档案"; |
|
|
String zipFileName = "项目档案"; |
|
|
|
|
|
|
|
|
// 设置response的header |
|
|
// 设置response的header |
|
|
response.setContentType("application/zip"); |
|
|
response.setContentType("application/zip"); |
|
|
response.setHeader("Content-disposition", |
|
|
|
|
|
"attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); |
|
|
|
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + ExcelDownUtil.encodeName(zipFileName) + ".zip"); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 创建ZipOutputStream |
|
|
// 创建ZipOutputStream |
|
|
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); |
|
|
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); |
|
|
if (CollUtil.isNotEmpty(fileIdList)) { |
|
|
|
|
|
// 对文件ID进行去重 |
|
|
|
|
|
HashSet<Long> hashSet = new HashSet<>(); |
|
|
|
|
|
List<Long> fidList = fileIdList.stream().filter(hashSet::add).collect(Collectors.toList()); |
|
|
|
|
|
// 获取文件输入流 |
|
|
|
|
|
for (Long fileId : fidList) { |
|
|
|
|
|
File file = fileService.getById(fileId); |
|
|
|
|
|
// 文件不存在,跳过 |
|
|
|
|
|
if (Objects.isNull(file)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
String originalFileName = file.getOriginalFileName(); |
|
|
|
|
|
String name = originalFileName.substring(0, originalFileName.indexOf(StrPool.DOT)); |
|
|
|
|
|
String fileName = name + StrPool.UNDERSCORE + fileId |
|
|
|
|
|
|
|
|
// 获取文件输入流 |
|
|
|
|
|
for (File file : files) { |
|
|
|
|
|
String originalFileName = file.getOriginalFileName(); |
|
|
|
|
|
String name = originalFileName.substring(0, originalFileName.indexOf(StrPool.DOT)); |
|
|
|
|
|
String fileName = name + StrPool.UNDERSCORE + file.getId() |
|
|
+ originalFileName.substring(originalFileName.indexOf(StrPool.DOT)); |
|
|
+ originalFileName.substring(originalFileName.indexOf(StrPool.DOT)); |
|
|
InputStream fileInputStream = fileService.getFileInputStream(file); |
|
|
|
|
|
// 文件 |
|
|
|
|
|
ZipEntry zipEntry = new ZipEntry(fileName); |
|
|
|
|
|
zos.putNextEntry(zipEntry); |
|
|
|
|
|
byte[] bytes = new byte[1024]; |
|
|
|
|
|
int length; |
|
|
|
|
|
while ((length = fileInputStream.read(bytes)) >= 0) { |
|
|
|
|
|
zos.write(bytes, 0, length); |
|
|
|
|
|
} |
|
|
|
|
|
fileInputStream.close(); |
|
|
|
|
|
zos.closeEntry(); |
|
|
|
|
|
|
|
|
InputStream fileInputStream = fileService.getFileInputStream(file); |
|
|
|
|
|
// 文件 |
|
|
|
|
|
ZipEntry zipEntry = new ZipEntry(fileName); |
|
|
|
|
|
zos.putNextEntry(zipEntry); |
|
|
|
|
|
byte[] bytes = new byte[1024]; |
|
|
|
|
|
int length; |
|
|
|
|
|
while ((length = fileInputStream.read(bytes)) >= 0) { |
|
|
|
|
|
zos.write(bytes, 0, length); |
|
|
} |
|
|
} |
|
|
zos.close(); |
|
|
|
|
|
|
|
|
fileInputStream.close(); |
|
|
|
|
|
zos.closeEntry(); |
|
|
} |
|
|
} |
|
|
|
|
|
zos.close(); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new BizException(e.getMessage()); |
|
|
|
|
|
|
|
|
log.error("项目档案下载失败:", e); |
|
|
|
|
|
throw BizException.wrap("项目档案下载失败"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -373,7 +368,7 @@ public class ProjectFileManage { |
|
|
fileIdList.addAll(projectAppFormFileIdList); |
|
|
fileIdList.addAll(projectAppFormFileIdList); |
|
|
// 获取项目应用信息中的文件 |
|
|
// 获取项目应用信息中的文件 |
|
|
List<ProjectApplication> applicationList = projectApplicationService |
|
|
List<ProjectApplication> applicationList = projectApplicationService |
|
|
.list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId)); |
|
|
|
|
|
|
|
|
.list(Wrappers.lambdaQuery(ProjectApplication.class).eq(ProjectApplication::getProjectId, projectId)); |
|
|
for (ProjectApplication projectApplication : applicationList) { |
|
|
for (ProjectApplication projectApplication : applicationList) { |
|
|
// 获取试点文件 |
|
|
// 获取试点文件 |
|
|
String experimentsFile = projectApplication.getExperimentsFile(); |
|
|
String experimentsFile = projectApplication.getExperimentsFile(); |
|
@@ -387,7 +382,7 @@ public class ProjectFileManage { |
|
|
// 流程审核意见文件 |
|
|
// 流程审核意见文件 |
|
|
// 获取项目关联的流程实例 |
|
|
// 获取项目关联的流程实例 |
|
|
List<ProjectInst> projectInstList = |
|
|
List<ProjectInst> projectInstList = |
|
|
projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId)); |
|
|
|
|
|
|
|
|
projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, projectId)); |
|
|
// 从历史评论表中获取对应流程实例的评论附件信息 |
|
|
// 从历史评论表中获取对应流程实例的评论附件信息 |
|
|
for (ProjectInst projectInst : projectInstList) { |
|
|
for (ProjectInst projectInst : projectInstList) { |
|
|
String instanceId = projectInst.getInstCode(); |
|
|
String instanceId = projectInst.getInstCode(); |
|
@@ -434,7 +429,7 @@ public class ProjectFileManage { |
|
|
|
|
|
|
|
|
// 采购结果备案阶段 |
|
|
// 采购结果备案阶段 |
|
|
Purchase purchase = purchaseService |
|
|
Purchase purchase = purchaseService |
|
|
.getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
|
.getOne(Wrappers.lambdaQuery(Purchase.class).eq(Purchase::getProjectId, projectId).last(BizConst.LIMIT_1)); |
|
|
// 获取投标文件 |
|
|
// 获取投标文件 |
|
|
if (Objects.nonNull(purchase)) { |
|
|
if (Objects.nonNull(purchase)) { |
|
|
String biddingDoc = purchase.getBiddingDoc(); |
|
|
String biddingDoc = purchase.getBiddingDoc(); |
|
@@ -452,7 +447,7 @@ public class ProjectFileManage { |
|
|
|
|
|
|
|
|
// 合同备案阶段 |
|
|
// 合同备案阶段 |
|
|
Contract contract = contractService |
|
|
Contract contract = contractService |
|
|
.getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
|
.getOne(Wrappers.lambdaQuery(Contract.class).eq(Contract::getProjectId, projectId).last(BizConst.LIMIT_1)); |
|
|
// 获取合同附件 |
|
|
// 获取合同附件 |
|
|
if (Objects.nonNull(contract)) { |
|
|
if (Objects.nonNull(contract)) { |
|
|
String attachment = contract.getAttachment(); |
|
|
String attachment = contract.getAttachment(); |
|
@@ -528,6 +523,7 @@ public class ProjectFileManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查看 借阅的详情 |
|
|
* 查看 借阅的详情 |
|
|
|
|
|
* |
|
|
* @param instanceId |
|
|
* @param instanceId |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
@@ -536,28 +532,28 @@ public class ProjectFileManage { |
|
|
.eq(ProjectApplyBorrow::getInstanceId, instanceId) |
|
|
.eq(ProjectApplyBorrow::getInstanceId, instanceId) |
|
|
.last(BizConst.LIMIT_1)); |
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
|
if(Objects.isNull(apply)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(apply)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply,ProjectApplyBorrowVO.class); |
|
|
|
|
|
if(StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())){ |
|
|
|
|
|
|
|
|
ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply, ProjectApplyBorrowVO.class); |
|
|
|
|
|
if (StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())) { |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); |
|
|
if(Objects.nonNull(user)){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(user)) { |
|
|
vo.setApplyBorrowEmployeeName(user.getUsername()); |
|
|
vo.setApplyBorrowEmployeeName(user.getUsername()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())){ |
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())) { |
|
|
DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
.eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) |
|
|
.eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) |
|
|
.last(BizConst.LIMIT_1)); |
|
|
.last(BizConst.LIMIT_1)); |
|
|
if(Objects.nonNull(organization)){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(organization)) { |
|
|
vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); |
|
|
vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(Objects.nonNull(vo.getProjectId())){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(vo.getProjectId())) { |
|
|
Project project = projectService.getById(vo.getProjectId()); |
|
|
Project project = projectService.getById(vo.getProjectId()); |
|
|
if(Objects.nonNull(project)){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(project)) { |
|
|
vo.setProjectName(project.getProjectName()); |
|
|
vo.setProjectName(project.getProjectName()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|