Browse Source

项目库修改

tags/24080901
WendyYang 1 year ago
parent
commit
6b55e103ff
8 changed files with 147 additions and 213 deletions
  1. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java
  2. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java
  3. +16
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java
  4. +125
    -195
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  5. +0
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java
  7. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java
  8. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java View File

@@ -140,7 +140,7 @@ public class ProjectFileManage {
ProjectFileListVO vo = new ProjectFileListVO();
vo.setId(p.getId());
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案
if (NumberUtil.isNumber(p.getBuildOrgCode())
if (!NumberUtil.isNumber(p.getBuildOrgCode())
|| subOrgSet.contains(Long.parseLong(p.getBuildOrgCode()))
|| checkCanRead(subOrgSet, p)) {
vo.setCanRead(Boolean.TRUE);


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java View File

@@ -3,6 +3,7 @@ package com.hz.pm.api.performance.model.req;
import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* <p>
@@ -13,6 +14,7 @@ import lombok.Data;
* @since 09:32 2023/06/13
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class PerformanceAppraisalListReq extends PagePo {

@ApiModelProperty("计划名称")


+ 16
- 2
hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java View File

@@ -1,10 +1,16 @@
package com.hz.pm.api.portrait.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.portrait.model.entity.ProjectTag;
import com.hz.pm.api.portrait.model.entity.Tag;
import com.ningdatech.basic.util.CollUtils;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* @Classname ITagService
@@ -15,8 +21,16 @@ import java.util.List;
public interface IProjectTagService extends IService<ProjectTag> {
/**
* 获取项目 标签
* @param projectCode
* @return
* @param projectCode \
* @return \
*/
List<Tag> getProjectTas(String projectCode);


default Map<String, List<ProjectTag>> listByProjectCodes(Collection<String> projectCodes){
LambdaQueryWrapper<ProjectTag> query = Wrappers.lambdaQuery(ProjectTag.class)
.in(ProjectTag::getProjectCode, projectCodes);
return CollUtils.group(list(query), ProjectTag::getProjectCode);
}

}

+ 125
- 195
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java View File

@@ -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) {


+ 0
- 12
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml View File

@@ -53,12 +53,6 @@
<if test="req.id != null">
and p.id = #{req.id}
</if>
<if test="req.regionCode != null and req.regionCode != ''">
and p.area_code = #{req.regionCode}
</if>
<if test="req.areaCode != null and req.areaCode != ''">
and p.area_code = #{req.areaCode}
</if>
<if test="req.projectName != null and req.projectName != ''">
and p.project_name like concat('%',#{req.projectName},'%')
</if>
@@ -144,12 +138,6 @@
<if test="req.id != null">
and b.id = #{req.id}
</if>
<if test="req.regionCode != null and req.regionCode != ''">
and b.base_area_code = concat(#{req.regionCode},'000')
</if>
<if test="req.areaCode != null and req.areaCode != ''">
and b.base_area_code = concat(#{req.regionCode},'000')
</if>
<if test="req.projectName != null and req.projectName != ''">
and b.base_proj_name like concat('%',#{req.projectName},'%')
</if>


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java View File

@@ -32,7 +32,7 @@ public interface IProjectService extends IService<Project> {

Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, ProjectListReq req);

Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, ProjectListReq req);
Page<ProjectPO> pageLibWithPermission(Page<ProjectPO> page, ProjectListReq req);

default void reverseNewest(String projectCode, Long projectId) {
LambdaUpdateWrapper<Project> wrapper = Wrappers.lambdaUpdate(Project.class)


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java View File

@@ -108,7 +108,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
}

@Override
public Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, ProjectListReq req) {
public Page<ProjectPO> pageLibWithPermission(Page<ProjectPO> page, ProjectListReq req) {
return projectMapper.pageLibWithPermission(page, req);
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -144,7 +144,7 @@ public class WorkbenchManage {
ProjectListReq projectListReq = new ProjectListReq();
projectListReq.page(1, 2000);
projectListReq.setProjectYear(year);
res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq, user).getRecords()));
res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkBench(projectListReq, user).getRecords()));
log.info("工作台 项目列表 耗时,{} s", stopWatch.getTotalTimeSeconds());
}, ForkJoinPool.commonPool())
).join();


Loading…
Cancel
Save