|
|
@@ -15,7 +15,6 @@ import com.google.common.collect.Maps; |
|
|
|
import com.hz.pm.api.common.compare.CompareUtils; |
|
|
|
import com.hz.pm.api.common.enumeration.CommonEnum; |
|
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.hz.pm.api.common.helper.RegionCacheHelper; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.constant.CommonConst; |
|
|
@@ -33,7 +32,6 @@ import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; |
|
|
|
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; |
|
|
|
import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; |
|
|
|
import com.hz.pm.api.gov.utils.ProjectConvertUtil; |
|
|
|
import com.hz.pm.api.organization.service.IDingOrganizationService; |
|
|
|
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; |
|
|
|
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; |
|
|
|
import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; |
|
|
@@ -115,7 +113,6 @@ public class ProjectLibManage { |
|
|
|
private final IProjectApplicationService applicationService; |
|
|
|
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; |
|
|
|
private final ProcessExecuteChainHandle processExecuteHandle; |
|
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
|
private final FileService fileService; |
|
|
|
private final IProjectApplicationService projectApplicationService; |
|
|
|
private final GenerateProjectCodeUtil generateProjectCodeUtil; |
|
|
@@ -123,7 +120,6 @@ public class ProjectLibManage { |
|
|
|
private final StateMachineUtil stateMachineUtil; |
|
|
|
private final INdProjectDelayApplyService projectDelayApplyService; |
|
|
|
private final INdProjectApplyBorrowService projectApplyBorrowService; |
|
|
|
private final IDingOrganizationService dingOrganizationService; |
|
|
|
private final IContractService contractService; |
|
|
|
private final IPurchaseService purchaseService; |
|
|
|
private final IPreInsAcceptancePersonService acceptancePersonService; |
|
|
@@ -159,18 +155,8 @@ public class ProjectLibManage { |
|
|
|
|
|
|
|
List<String> projectCodes = page.getRecords().stream() |
|
|
|
.map(Project::getProjectCode).collect(Collectors.toList()); |
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes); |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(projectCodes)) { |
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) |
|
|
|
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); |
|
|
|
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
@@ -189,10 +175,10 @@ public class ProjectLibManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if (finalRenewalMap.containsKey(item.getId())) { |
|
|
|
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); |
|
|
|
List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); |
|
|
|
if (fundDeclarations != null) { |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); |
|
|
|
} else { |
|
|
|
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); |
|
|
@@ -216,34 +202,9 @@ public class ProjectLibManage { |
|
|
|
|
|
|
|
Set<String> projectCodes = page.getRecords().stream() |
|
|
|
.map(Project::getProjectCode).collect(Collectors.toSet()); |
|
|
|
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) |
|
|
|
.in(ProjectTag::getProjectCode, projectCodes)); |
|
|
|
Map<String, List<ProjectTag>> tagMap = Maps.newHashMap(); |
|
|
|
Map<Long, String> tagNameMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(pts)) { |
|
|
|
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); |
|
|
|
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); |
|
|
|
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) |
|
|
|
.in(Tag::getId, tagIds)); |
|
|
|
if (CollUtil.isNotEmpty(tags)) { |
|
|
|
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
Map<Long, String> finalTagNameMap = tagNameMap; |
|
|
|
Map<String, List<TagVO>> projectTagMap = getProjectTags(projectCodes); |
|
|
|
|
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(projectCodes)) { |
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) |
|
|
|
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); |
|
|
|
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes); |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
@@ -262,8 +223,7 @@ public class ProjectLibManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if (finalUser.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) |
|
|
|
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
@@ -271,11 +231,11 @@ public class ProjectLibManage { |
|
|
|
item.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setPrePlanProjectId(w.getPrePlanProjectId()); |
|
|
|
setTag(item, finalTagMap, finalTagNameMap); |
|
|
|
if (finalRenewalMap.containsKey(item.getId())) { |
|
|
|
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); |
|
|
|
item.setTags(projectTagMap.get(w.getProjectCode())); |
|
|
|
List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); |
|
|
|
if (fundDeclarations != null) { |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); |
|
|
|
} else { |
|
|
|
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); |
|
|
@@ -304,8 +264,8 @@ public class ProjectLibManage { |
|
|
|
UserFullInfoDTO finalUser = user; |
|
|
|
|
|
|
|
Set<String> instCodes = page.getRecords().stream() |
|
|
|
.filter(p -> StringUtils.isNotBlank(p.getInstCode())) |
|
|
|
.map(Project::getInstCode).collect(Collectors.toSet()); |
|
|
|
.map(Project::getInstCode) |
|
|
|
.filter(StringUtils::isNotBlank).collect(Collectors.toSet()); |
|
|
|
List<Task> tasks = taskService.createTaskQuery() |
|
|
|
.processInstanceIdIn(instCodes) |
|
|
|
.orderByTaskCreateTime() |
|
|
@@ -314,8 +274,7 @@ public class ProjectLibManage { |
|
|
|
Map<String, List<Task>> map = Maps.newHashMap(); |
|
|
|
Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(tasks)) { |
|
|
|
map = tasks.stream() |
|
|
|
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); |
|
|
|
map = tasks.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId)); |
|
|
|
userMap = searchUser(tasks, userInfoHelper); |
|
|
|
} |
|
|
|
|
|
|
@@ -339,8 +298,7 @@ public class ProjectLibManage { |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); |
|
|
|
if (finalUser.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) |
|
|
|
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
@@ -380,6 +338,30 @@ public class ProjectLibManage { |
|
|
|
return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, List<TagVO>> getProjectTags(Collection<String> projectCodes) { |
|
|
|
Map<String, List<ProjectTag>> projectTagMap = projectTagService.listByProjectCodes(projectCodes); |
|
|
|
if (CollUtil.isNotEmpty(projectTagMap)) { |
|
|
|
Set<Long> tagIds = projectTagMap.values().stream() |
|
|
|
.flatMap(Collection::stream) |
|
|
|
.map(ProjectTag::getTagId) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
List<Tag> tags = tagService.listByIds(tagIds); |
|
|
|
Map<Long, Tag> tagMap = CollUtils.listToMap(tags, Tag::getId); |
|
|
|
return projectTagMap.entrySet().stream() |
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, w -> w.getValue().stream().map(tg -> { |
|
|
|
Tag tag = tagMap.get(tg.getTagId()); |
|
|
|
if (tag == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
TagVO tagVO = new TagVO(); |
|
|
|
tagVO.setId(tag.getId()); |
|
|
|
tagVO.setName(tag.getName()); |
|
|
|
return tagVO; |
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList()))); |
|
|
|
} |
|
|
|
return Collections.emptyMap(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 项目申报和项目归集的并集 |
|
|
|
* |
|
|
@@ -388,44 +370,17 @@ public class ProjectLibManage { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { |
|
|
|
req = buildProjectLibPermission(req, user); |
|
|
|
if (!buildProjectLibPermission(req, user)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Page<ProjectPO> page = projectService.pageAllWithPermission(req.page(), req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(page.getRecords())) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Set<String> projectCodes = CollUtils.fieldSet(page.getRecords(), ProjectPO::getProjectCode); |
|
|
|
Map<String, List<TagVO>> projectTagsMap = getProjectTags(projectCodes); |
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes); |
|
|
|
|
|
|
|
Set<String> projectCodes = page.getRecords().stream() |
|
|
|
.map(ProjectPO::getProjectCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) |
|
|
|
.in(ProjectTag::getProjectCode, projectCodes)); |
|
|
|
|
|
|
|
Map<String, List<ProjectTag>> tagMap = Maps.newHashMap(); |
|
|
|
Map<Long, String> tagNameMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(pts)) { |
|
|
|
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); |
|
|
|
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); |
|
|
|
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) |
|
|
|
.in(Tag::getId, tagIds)); |
|
|
|
if (CollUtil.isNotEmpty(tags)) { |
|
|
|
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
Map<Long, String> finalTagNameMap = tagNameMap; |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(projectCodes)) { |
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) |
|
|
|
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); |
|
|
|
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
@@ -445,8 +400,7 @@ public class ProjectLibManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if (user.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) |
|
|
|
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
@@ -454,14 +408,14 @@ public class ProjectLibManage { |
|
|
|
item.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setPrePlanProjectId(w.getPrePlanProjectId()); |
|
|
|
setTag(item, finalTagMap, finalTagNameMap); |
|
|
|
if (finalRenewalMap.containsKey(item.getId())) { |
|
|
|
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); |
|
|
|
item.setTags(projectTagsMap.get(w.getProjectCode())); |
|
|
|
List<ProjectRenewalFundDeclaration> currRenewDeclarations = renewalMap.get(item.getId()); |
|
|
|
if (currRenewDeclarations != null) { |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), currRenewDeclarations)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccumulate(w, currRenewDeclarations)); |
|
|
|
} else { |
|
|
|
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccumulate(w, Collections.emptyList())); |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
@@ -469,44 +423,19 @@ public class ProjectLibManage { |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { |
|
|
|
req = buildProjectLibPermission(req, user); |
|
|
|
Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req); |
|
|
|
if (!buildProjectLibPermission(req, user)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Page<ProjectPO> page = projectService.pageLibWithPermission(req.page(), req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(page.getRecords())) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
Set<String> projectCodes = page.getRecords().stream() |
|
|
|
.map(ProjectPO::getProjectCode).collect(Collectors.toSet()); |
|
|
|
Map<String, List<TagVO>> projectTagsMap = getProjectTags(projectCodes); |
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes); |
|
|
|
|
|
|
|
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) |
|
|
|
.in(ProjectTag::getProjectCode, projectCodes)); |
|
|
|
|
|
|
|
Map<String, List<ProjectTag>> tagMap = Maps.newHashMap(); |
|
|
|
Map<Long, String> tagNameMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(pts)) { |
|
|
|
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); |
|
|
|
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); |
|
|
|
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) |
|
|
|
.in(Tag::getId, tagIds)); |
|
|
|
if (CollUtil.isNotEmpty(tags)) { |
|
|
|
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
Map<Long, String> finalTagNameMap = tagNameMap; |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(projectCodes)) { |
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) |
|
|
|
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); |
|
|
|
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap; |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
@@ -526,8 +455,7 @@ public class ProjectLibManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if (user.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) |
|
|
|
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
@@ -535,24 +463,41 @@ public class ProjectLibManage { |
|
|
|
item.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setPrePlanProjectId(w.getPrePlanProjectId()); |
|
|
|
setTag(item, finalTagMap, finalTagNameMap); |
|
|
|
if (finalRenewalMap.containsKey(item.getId())) { |
|
|
|
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); |
|
|
|
item.setTags(projectTagsMap.get(w.getProjectCode())); |
|
|
|
List<ProjectRenewalFundDeclaration> currRenewDeclarations = renewalMap.get(item.getId()); |
|
|
|
if (currRenewDeclarations != null) { |
|
|
|
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), currRenewDeclarations)); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccumulate(w, currRenewDeclarations)); |
|
|
|
} else { |
|
|
|
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); |
|
|
|
item.setAnnualAccumulateAmountList(convertAccumulate(w, Collections.emptyList())); |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> listWithPermissionWorkbentch(ProjectListReq req, |
|
|
|
UserFullInfoDTO user) { |
|
|
|
req = buildProjectLibPermission(req, user); |
|
|
|
Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req); |
|
|
|
private Map<Long, List<ProjectRenewalFundDeclaration>> listRenewDeclarations(Collection<String> projectCodes) { |
|
|
|
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap; |
|
|
|
if (CollUtil.isNotEmpty(projectCodes)) { |
|
|
|
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
|
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
|
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) |
|
|
|
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); |
|
|
|
renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId); |
|
|
|
} else { |
|
|
|
renewalMap = Collections.emptyMap(); |
|
|
|
} |
|
|
|
return renewalMap; |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> listWithPermissionWorkBench(ProjectListReq req, |
|
|
|
UserFullInfoDTO user) { |
|
|
|
if (!buildProjectLibPermission(req, user)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Page<ProjectPO> page = projectService.pageLibWithPermission(req.page(), req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(page.getRecords())) { |
|
|
|
return PageVo.empty(); |
|
|
@@ -560,7 +505,8 @@ public class ProjectLibManage { |
|
|
|
|
|
|
|
Set<String> instCodes = page.getRecords().stream() |
|
|
|
.map(ProjectPO::getInstCode) |
|
|
|
.filter(StringUtils::isNotBlank).collect(Collectors.toSet()); |
|
|
|
.filter(StringUtils::isNotBlank) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
List<Task> tasks = taskService.createTaskQuery() |
|
|
|
.processInstanceIdIn(instCodes) |
|
|
|
.orderByTaskCreateTime() |
|
|
@@ -594,8 +540,7 @@ public class ProjectLibManage { |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); |
|
|
|
if (user.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) |
|
|
|
&& w.getSuperOrgCode().equals(user.getMhUserId())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
@@ -608,15 +553,15 @@ public class ProjectLibManage { |
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
public static BigDecimal computeAmount(BigDecimal cuurentAmount, List<ProjectRenewalFundDeclaration> prfs) { |
|
|
|
BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; |
|
|
|
public static BigDecimal computeAmount(BigDecimal currentAmount, List<ProjectRenewalFundDeclaration> prfs) { |
|
|
|
BigDecimal res = Objects.isNull(currentAmount) ? BigDecimal.ZERO : currentAmount; |
|
|
|
for (ProjectRenewalFundDeclaration prf : prfs) { |
|
|
|
res = res.add(prf.getAnnualPaymentAmount()); |
|
|
|
} |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
public static List<AnnualAmountVO> convertAccmulate(ProjectPO project, List<ProjectRenewalFundDeclaration> prfs) { |
|
|
|
public static List<AnnualAmountVO> convertAccumulate(ProjectPO project, List<ProjectRenewalFundDeclaration> prfs) { |
|
|
|
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); |
|
|
|
annualAmounts.add(AnnualAmountVO.builder() |
|
|
|
.projectId(project.getId()) |
|
|
@@ -650,22 +595,6 @@ public class ProjectLibManage { |
|
|
|
return annualAmounts; |
|
|
|
} |
|
|
|
|
|
|
|
private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) { |
|
|
|
if (finalTagMap.containsKey(item.getProjectCode())) { |
|
|
|
List<TagVO> tags = Lists.newArrayList(); |
|
|
|
List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode()); |
|
|
|
for (ProjectTag pt : projectTags) { |
|
|
|
if (finalTagNameMap.containsKey(pt.getTagId())) { |
|
|
|
TagVO vo = new TagVO(); |
|
|
|
vo.setId(pt.getTagId()); |
|
|
|
vo.setName(finalTagNameMap.get(pt.getTagId())); |
|
|
|
tags.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
item.setTags(tags); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public List<Project> projectList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
return projectService.list(query); |
|
|
@@ -1322,38 +1251,39 @@ public class ProjectLibManage { |
|
|
|
return user; |
|
|
|
} |
|
|
|
|
|
|
|
public ProjectListReq buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { |
|
|
|
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
|
if (!currentUserDataScope.isPresent()) { |
|
|
|
public boolean buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { |
|
|
|
boolean queryState = true; |
|
|
|
Optional<DataScopeDTO> dataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
|
if (!dataScope.isPresent()) { |
|
|
|
log.warn("没有取到权限信息 当前查询 没有权限条件"); |
|
|
|
return req; |
|
|
|
} |
|
|
|
|
|
|
|
switch (currentUserDataScope.get().getRole()) { |
|
|
|
case NORMAL_MEMBER: |
|
|
|
//普通用户 只能看到自己单位去申报的 |
|
|
|
req.setUserType("normal"); |
|
|
|
req.setUserValue(user.getMhUnitIdStr()); |
|
|
|
break; |
|
|
|
case COMPANY_MANAGER: |
|
|
|
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 |
|
|
|
req.setUserType("org"); |
|
|
|
req.setUserValue(user.getMhUnitIdStr()); |
|
|
|
break; |
|
|
|
case SUPER_ADMIN: |
|
|
|
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 |
|
|
|
break; |
|
|
|
case VISITOR: |
|
|
|
//访客可以看全市的 |
|
|
|
break; |
|
|
|
case DASHBOARD: |
|
|
|
break; |
|
|
|
default: |
|
|
|
//没有权限的话 就让它查不到 |
|
|
|
req.setId(0L); |
|
|
|
break; |
|
|
|
queryState = Boolean.FALSE; |
|
|
|
} else { |
|
|
|
switch (dataScope.get().getRole()) { |
|
|
|
case NORMAL_MEMBER: |
|
|
|
//普通用户 只能看到自己单位去申报的 |
|
|
|
req.setUserType("normal"); |
|
|
|
req.setUserValue(user.getMhUnitIdStr()); |
|
|
|
break; |
|
|
|
case COMPANY_MANAGER: |
|
|
|
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 |
|
|
|
req.setUserType("org"); |
|
|
|
req.setUserValue(user.getMhUnitIdStr()); |
|
|
|
break; |
|
|
|
case SUPER_ADMIN: |
|
|
|
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 |
|
|
|
break; |
|
|
|
case VISITOR: |
|
|
|
//访客可以看全市的 |
|
|
|
break; |
|
|
|
case DASHBOARD: |
|
|
|
break; |
|
|
|
default: |
|
|
|
//没有权限的话 就让它查不到 |
|
|
|
queryState = Boolean.FALSE; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return req; |
|
|
|
return queryState; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { |
|
|
|