Browse Source

是否是最新项目修改

tags/24080901
WendyYang 10 months ago
parent
commit
b126b9c987
5 changed files with 144 additions and 180 deletions
  1. +2
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  2. +127
    -151
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java
  4. +12
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java
  5. +2
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java

+ 2
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java View File

@@ -10,7 +10,6 @@ import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.model.constant.CommonConst;
@@ -165,7 +164,7 @@ public class AnnualPlanLibManage {
project.setApprovedFile(String.valueOf(req.getApprovedFileId())); project.setApprovedFile(String.valueOf(req.getApprovedFileId()));
project.setBuildCycle(String.valueOf(req.getBuildCycle())); project.setBuildCycle(String.valueOf(req.getBuildCycle()));
project.setOriginBuildCycle(req.getBuildCycle()); project.setOriginBuildCycle(req.getBuildCycle());
BizUtils.notNull(req.getBuildPlanFileId(),w -> project.setApprovedConstructionPlanFile(String.valueOf(w)));
BizUtils.notNull(req.getBuildPlanFileId(), w -> project.setApprovedConstructionPlanFile(String.valueOf(w)));
project.setApprovalDate(req.getApprovedDate()); project.setApprovalDate(req.getApprovedDate());
project.setPlanAcceptanceTime(planAcceptanceTime); project.setPlanAcceptanceTime(planAcceptanceTime);
project.setOriginPlanAcceptanceTime(planAcceptanceTime); project.setOriginPlanAcceptanceTime(planAcceptanceTime);
@@ -177,10 +176,7 @@ public class AnnualPlanLibManage {
if (projectService.save(project)) { if (projectService.save(project)) {
applicationService.saveApplication(project, oldProject, Boolean.TRUE); applicationService.saveApplication(project, oldProject, Boolean.TRUE);
// 将旧的项目版本置为不是最新 // 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());
} }
} }




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

@@ -160,12 +160,12 @@ public class ProjectLibManage {
List<String> projectCodes = page.getRecords().stream() List<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toList()); .map(Project::getProjectCode).collect(Collectors.toList());


Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(projectCodes)){
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(projectCodes)) {
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
} }
@@ -189,13 +189,13 @@ public class ProjectLibManage {
item.setProcessStatus(w.getProcessStatus()); item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode()); item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
if(finalRenewalMap.containsKey(item.getId())){
if (finalRenewalMap.containsKey(item.getId())) {
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId());
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs));
}else{
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList()));
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
} }
return item; return item;
}); });
@@ -218,27 +218,27 @@ public class ProjectLibManage {
.map(Project::getProjectCode).collect(Collectors.toSet()); .map(Project::getProjectCode).collect(Collectors.toSet());
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class)
.in(ProjectTag::getProjectCode, projectCodes)); .in(ProjectTag::getProjectCode, projectCodes));
Map<String,List<ProjectTag>> tagMap = Maps.newHashMap();
Map<Long,String> tagNameMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(pts)){
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)); tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode));
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet());
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class)
.in(Tag::getId, tagIds)); .in(Tag::getId, tagIds));
if(CollUtil.isNotEmpty(tags)){
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName));
if (CollUtil.isNotEmpty(tags)) {
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName));
} }
} }
Map<String, List<ProjectTag>> finalTagMap = tagMap; Map<String, List<ProjectTag>> finalTagMap = tagMap;
Map<Long,String> finalTagNameMap = tagNameMap;
Map<Long, String> finalTagNameMap = tagNameMap;




Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(projectCodes)){
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(projectCodes)) {
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
} }
@@ -271,14 +271,14 @@ public class ProjectLibManage {
item.setApprovedAmount(w.getApprovalAmount()); item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId()); item.setPrePlanProjectId(w.getPrePlanProjectId());
setTag(item,finalTagMap,finalTagNameMap);
if(finalRenewalMap.containsKey(item.getId())){
setTag(item, finalTagMap, finalTagNameMap);
if (finalRenewalMap.containsKey(item.getId())) {
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId());
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs));
}else{
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList()));
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
} }
return item; return item;
}); });
@@ -287,6 +287,7 @@ public class ProjectLibManage {


/** /**
* 项目列表带当前审批人(工作流的) * 项目列表带当前审批人(工作流的)
*
* @param req * @param req
* @param user * @param user
* @return * @return
@@ -311,15 +312,15 @@ public class ProjectLibManage {
.asc() .asc()
.list(); .list();
Map<String, List<Task>> map = Maps.newHashMap(); Map<String, List<Task>> map = Maps.newHashMap();
Map<String,UserFullInfoDTO> userMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(tasks)){
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(tasks)) {
map = tasks.stream() map = tasks.stream()
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); .collect(Collectors.groupingBy(Task::getProcessInstanceId));
userMap = searchUser(tasks,userInfoHelper);
userMap = searchUser(tasks, userInfoHelper);
} }


List<ProjectLibListItemVO> records = Lists.newArrayList(); List<ProjectLibListItemVO> records = Lists.newArrayList();
for(Project w : page.getRecords()){
for (Project w : page.getRecords()) {
ProjectLibListItemVO item = new ProjectLibListItemVO(); ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId()); item.setId(w.getId());
item.setProjectName(w.getProjectName()); item.setProjectName(w.getProjectName());
@@ -337,7 +338,7 @@ public class ProjectLibManage {
item.setProcessStatus(w.getProcessStatus()); item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode()); item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap));
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap));
if (finalUser.getIsOrgAdmin() && if (finalUser.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus())
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode())
@@ -354,7 +355,7 @@ public class ProjectLibManage {


private List<UserFullInfoDTO> buildApproveUsers(String instCode, Map<String, List<Task>> map, private List<UserFullInfoDTO> buildApproveUsers(String instCode, Map<String, List<Task>> map,
Map<String, UserFullInfoDTO> userMap) { Map<String, UserFullInfoDTO> userMap) {
if(map.containsKey(instCode)){
if (map.containsKey(instCode)) {
List<Task> tasks = map.get(instCode); List<Task> tasks = map.get(instCode);
return tasks.stream().map(task -> userMap.get(task.getAssignee())) return tasks.stream().map(task -> userMap.get(task.getAssignee()))
.filter(Objects::nonNull).collect(Collectors.toList()); .filter(Objects::nonNull).collect(Collectors.toList());
@@ -363,27 +364,28 @@ public class ProjectLibManage {
} }


private Map<String, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) { private Map<String, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) {
if(CollUtil.isEmpty(tasks)){
if (CollUtil.isEmpty(tasks)) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes( List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(
tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); tasks.stream().map(Task::getAssignee).collect(Collectors.toSet()));
if(CollUtil.isNotEmpty(users)){
if (CollUtil.isNotEmpty(users)) {
Set<String> employeeSet = Sets.newHashSet(); Set<String> employeeSet = Sets.newHashSet();
return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors
.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
.toMap(UserFullInfoDTO::getEmployeeCode, u -> u));
} }
return Collections.emptyMap(); return Collections.emptyMap();
} }


/** /**
* 项目申报和项目归集的并集 * 项目申报和项目归集的并集
*
* @param req * @param req
* @param user * @param user
* @return * @return
*/ */
public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) {
req = buildProjectLibPermission(req,user);
req = buildProjectLibPermission(req, user);
Page<ProjectPO> page = projectService.pageAllWithPermission(req.page(), req); Page<ProjectPO> page = projectService.pageAllWithPermission(req.page(), req);
long total; long total;
if (CollUtil.isEmpty(page.getRecords())) { if (CollUtil.isEmpty(page.getRecords())) {
@@ -397,26 +399,26 @@ public class ProjectLibManage {
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class)
.in(ProjectTag::getProjectCode, projectCodes)); .in(ProjectTag::getProjectCode, projectCodes));


Map<String,List<ProjectTag>> tagMap = Maps.newHashMap();
Map<Long,String> tagNameMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(pts)){
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)); tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode));
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet());
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class)
.in(Tag::getId, tagIds)); .in(Tag::getId, tagIds));
if(CollUtil.isNotEmpty(tags)){
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName));
if (CollUtil.isNotEmpty(tags)) {
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName));
} }
} }
Map<String, List<ProjectTag>> finalTagMap = tagMap; Map<String, List<ProjectTag>> finalTagMap = tagMap;
Map<Long,String> finalTagNameMap = tagNameMap;
Map<Long, String> finalTagNameMap = tagNameMap;


Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(projectCodes)){
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(projectCodes)) {
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
} }
@@ -450,14 +452,14 @@ public class ProjectLibManage {
item.setApprovedAmount(w.getApprovalAmount()); item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId()); item.setPrePlanProjectId(w.getPrePlanProjectId());
setTag(item,finalTagMap,finalTagNameMap);
if(finalRenewalMap.containsKey(item.getId())){
setTag(item, finalTagMap, finalTagNameMap);
if (finalRenewalMap.containsKey(item.getId())) {
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId());
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs));
}else{
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList()));
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
} }
return item; return item;
}); });
@@ -465,7 +467,7 @@ public class ProjectLibManage {
} }


public PageVo<ProjectLibListItemVO> libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { public PageVo<ProjectLibListItemVO> libListWithPermission(ProjectListReq req, UserFullInfoDTO user) {
req = buildProjectLibPermission(req,user);
req = buildProjectLibPermission(req, user);
Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req); Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req);
long total; long total;
if (CollUtil.isEmpty(page.getRecords())) { if (CollUtil.isEmpty(page.getRecords())) {
@@ -479,26 +481,26 @@ public class ProjectLibManage {
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class)
.in(ProjectTag::getProjectCode, projectCodes)); .in(ProjectTag::getProjectCode, projectCodes));


Map<String,List<ProjectTag>> tagMap = Maps.newHashMap();
Map<Long,String> tagNameMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(pts)){
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)); tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode));
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet());
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class)
.in(Tag::getId, tagIds)); .in(Tag::getId, tagIds));
if(CollUtil.isNotEmpty(tags)){
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName));
if (CollUtil.isNotEmpty(tags)) {
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName));
} }
} }
Map<String, List<ProjectTag>> finalTagMap = tagMap; Map<String, List<ProjectTag>> finalTagMap = tagMap;
Map<Long,String> finalTagNameMap = tagNameMap;
Map<Long, String> finalTagNameMap = tagNameMap;


Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(projectCodes)){
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(projectCodes)) {
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
} }
@@ -532,14 +534,14 @@ public class ProjectLibManage {
item.setApprovedAmount(w.getApprovalAmount()); item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId()); item.setPrePlanProjectId(w.getPrePlanProjectId());
setTag(item,finalTagMap,finalTagNameMap);
if(finalRenewalMap.containsKey(item.getId())){
setTag(item, finalTagMap, finalTagNameMap);
if (finalRenewalMap.containsKey(item.getId())) {
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId());
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs));
}else{
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs));
item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList()));
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
} }
return item; return item;
}); });
@@ -548,7 +550,7 @@ public class ProjectLibManage {


public PageVo<ProjectLibListItemVO> listWithPermissionWorkbentch(ProjectListReq req, public PageVo<ProjectLibListItemVO> listWithPermissionWorkbentch(ProjectListReq req,
UserFullInfoDTO user) { UserFullInfoDTO user) {
req = buildProjectLibPermission(req,user);
req = buildProjectLibPermission(req, user);
Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req); Page<ProjectPO> page = projectService.pagelibWithPermission(req.page(), req);
long total; long total;
if (CollUtil.isEmpty(page.getRecords())) { if (CollUtil.isEmpty(page.getRecords())) {
@@ -565,15 +567,15 @@ public class ProjectLibManage {
.asc() .asc()
.list(); .list();
Map<String, List<Task>> map = Maps.newHashMap(); Map<String, List<Task>> map = Maps.newHashMap();
Map<String,UserFullInfoDTO> userMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(tasks)){
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap();
if (CollUtil.isNotEmpty(tasks)) {
map = tasks.stream() map = tasks.stream()
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); .collect(Collectors.groupingBy(Task::getProcessInstanceId));
userMap = searchUser(tasks,userInfoHelper);
userMap = searchUser(tasks, userInfoHelper);
} }


List<ProjectLibListItemVO> records = Lists.newArrayList(); List<ProjectLibListItemVO> records = Lists.newArrayList();
for(ProjectPO w : page.getRecords()){
for (ProjectPO w : page.getRecords()) {
ProjectLibListItemVO item = new ProjectLibListItemVO(); ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId()); item.setId(w.getId());
item.setProjectName(w.getProjectName()); item.setProjectName(w.getProjectName());
@@ -591,7 +593,7 @@ public class ProjectLibManage {
item.setProcessStatus(w.getProcessStatus()); item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode()); item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap));
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap));
if (finalUser.getIsOrgAdmin() && if (finalUser.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus())
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode())
@@ -606,22 +608,22 @@ public class ProjectLibManage {
return PageVo.of(records, page.getTotal()); return PageVo.of(records, page.getTotal());
} }


public static BigDecimal computeAmount(BigDecimal cuurentAmount,List<ProjectRenewalFundDeclaration> prfs) {
public static BigDecimal computeAmount(BigDecimal cuurentAmount, List<ProjectRenewalFundDeclaration> prfs) {
BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount;
for(ProjectRenewalFundDeclaration prf : prfs){
for (ProjectRenewalFundDeclaration prf : prfs) {
res = res.add(prf.getAnnualPaymentAmount()); res = res.add(prf.getAnnualPaymentAmount());
} }
return res; return res;
} }


public static List<AnnualAmountVO> convertAccmulate(ProjectPO project,List<ProjectRenewalFundDeclaration> prfs) {
public static List<AnnualAmountVO> convertAccmulate(ProjectPO project, List<ProjectRenewalFundDeclaration> prfs) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder() annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId()) .projectId(project.getId())
.projectYear(project.getProjectYear()) .projectYear(project.getProjectYear())
.annualAmount(project.getAnnualPlanAmount()) .annualAmount(project.getAnnualPlanAmount())
.build()); .build());
for(ProjectRenewalFundDeclaration prf : prfs){
for (ProjectRenewalFundDeclaration prf : prfs) {
annualAmounts.add(AnnualAmountVO.builder() annualAmounts.add(AnnualAmountVO.builder()
.projectId(prf.getProjectId()) .projectId(prf.getProjectId())
.projectYear(prf.getProjectYear()) .projectYear(prf.getProjectYear())
@@ -631,14 +633,14 @@ public class ProjectLibManage {
return annualAmounts; return annualAmounts;
} }


public static List<AnnualAmountVO> convertAccmulate(Project project,List<ProjectRenewalFundDeclaration> prfs) {
public static List<AnnualAmountVO> convertAccmulate(Project project, List<ProjectRenewalFundDeclaration> prfs) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder() annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId()) .projectId(project.getId())
.projectYear(project.getProjectYear()) .projectYear(project.getProjectYear())
.annualAmount(project.getAnnualPlanAmount()) .annualAmount(project.getAnnualPlanAmount())
.build()); .build());
for(ProjectRenewalFundDeclaration prf : prfs){
for (ProjectRenewalFundDeclaration prf : prfs) {
annualAmounts.add(AnnualAmountVO.builder() annualAmounts.add(AnnualAmountVO.builder()
.projectId(prf.getProjectId()) .projectId(prf.getProjectId())
.projectYear(prf.getProjectYear()) .projectYear(prf.getProjectYear())
@@ -649,11 +651,11 @@ public class ProjectLibManage {
} }


private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) { private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) {
if(finalTagMap.containsKey(item.getProjectCode())){
if (finalTagMap.containsKey(item.getProjectCode())) {
List<TagVO> tags = Lists.newArrayList(); List<TagVO> tags = Lists.newArrayList();
List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode()); List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode());
for(ProjectTag pt :projectTags){
if(finalTagNameMap.containsKey(pt.getTagId())){
for (ProjectTag pt : projectTags) {
if (finalTagNameMap.containsKey(pt.getTagId())) {
TagVO vo = new TagVO(); TagVO vo = new TagVO();
vo.setId(pt.getTagId()); vo.setId(pt.getTagId());
vo.setName(finalTagNameMap.get(pt.getTagId())); vo.setName(finalTagNameMap.get(pt.getTagId()));
@@ -721,14 +723,14 @@ public class ProjectLibManage {
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList());


//核心业务 //核心业务
if(CollUtil.isNotEmpty(applicationIds)){
if (CollUtil.isNotEmpty(applicationIds)) {
List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
Map<Long,List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId));
Map<Long, List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId));


Optional.ofNullable(applications).ifPresent(apps -> Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps, vo.setProjectApplications(CollUtils.convert(apps,
app -> ProjectHelper.convertVOWithMap(app,coreBizMap))
app -> ProjectHelper.convertVOWithMap(app, coreBizMap))
)); ));
} }


@@ -769,7 +771,7 @@ public class ProjectLibManage {
//查询风险监测 //查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode())); .eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
if (CollUtil.isNotEmpty(ssq)) {
safetyVo.setSupplierSafetyQualification(ssq.stream() safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) .map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList())); .collect(Collectors.toList()));
@@ -777,8 +779,8 @@ public class ProjectLibManage {
vo.setSafetyInfo(safetyVo); vo.setSafetyInfo(safetyVo);


List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if (CollUtil.isNotEmpty(psi)) {
safetyVo.setPersonSafetyInfo(psi.stream() safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) .map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList())); .collect(Collectors.toList()));
@@ -804,7 +806,7 @@ public class ProjectLibManage {
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> Optional.ofNullable(renewalDeclarations).ifPresent(declarations ->
declarations.forEach(declaration -> { declarations.forEach(declaration -> {
@@ -831,7 +833,7 @@ public class ProjectLibManage {
ExpertReview finalReview = expertReviewService.getFinalReview(projectInfo.getProjectCode(), ExpertReview finalReview = expertReviewService.getFinalReview(projectInfo.getProjectCode(),
ReviewTemplateTypeEnum.CONSTRUCTION_SCHEME_REVIEW.getCode()); ReviewTemplateTypeEnum.CONSTRUCTION_SCHEME_REVIEW.getCode());


if(Objects.nonNull(finalReview)){
if (Objects.nonNull(finalReview)) {
vo.setProposeAttach(finalReview.getOtherAdvice()); vo.setProposeAttach(finalReview.getOtherAdvice());
vo.setBaseReviewResults(finalReview.getReviewResult()); vo.setBaseReviewResults(finalReview.getReviewResult());
} }
@@ -849,7 +851,7 @@ public class ProjectLibManage {
*/ */
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId,
String employeeCode) { String employeeCode) {
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE);
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode, Boolean.FALSE);
//保存项目和实例的关系 //保存项目和实例的关系
ProjectInst projectInst = new ProjectInst(); ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId()); projectInst.setProjectId(project.getId());
@@ -901,7 +903,7 @@ public class ProjectLibManage {
* @return * @return
*/ */
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId,
String employeeCode,Boolean isContruct) {
String employeeCode, Boolean isContruct) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 //流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try { try {
Project project = new Project(); Project project = new Project();
@@ -916,12 +918,12 @@ public class ProjectLibManage {
project.setSponsor(employeeCode); project.setSponsor(employeeCode);
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode); project.setProjectCode(projectCode);
if(projectService.save(project)){
saveApplication(projectDto,project,null);
if (projectService.save(project)) {
saveApplication(projectDto, project, null);
} }
} else { } else {
//否则是重新提交的 新生成一个新版本的项目 //否则是重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto,isContruct);
project = newProjectWithVersion(projectDto, isContruct);
if (Objects.nonNull(project)) { if (Objects.nonNull(project)) {
project.setInstCode(instanceId); project.setInstCode(instanceId);
project.setSponsor(employeeCode); project.setSponsor(employeeCode);
@@ -973,19 +975,15 @@ public class ProjectLibManage {
} else { } else {
project.setPrePlanProjectId(oldProject.getId()); project.setPrePlanProjectId(oldProject.getId());
} }
if(projectService.save(project)){
saveApplication(projectDto,project,Boolean.TRUE);

if (projectService.save(project)) {
saveApplication(projectDto, project, Boolean.TRUE);
// 将旧的项目版本置为不是最新 // 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());
} }


} else { } else {
//否则是被驳回,重新提交的 新生成一个新版本的项目 //否则是被驳回,重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto,Boolean.TRUE);
project = newProjectWithVersion(projectDto, Boolean.TRUE);
if (Objects.nonNull(project)) { if (Objects.nonNull(project)) {
project.setInstCode(instanceId); project.setInstCode(instanceId);
project.setSponsor(employeeCode); project.setSponsor(employeeCode);
@@ -1006,10 +1004,10 @@ public class ProjectLibManage {
* @param projectDto * @param projectDto
* @return * @return
*/ */
public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) {
public Project reSaveProjectNewVersion(ProjectDTO projectDto, Boolean isContruct) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 //流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try { try {
return newProjectWithVersion(projectDto,isContruct);
return newProjectWithVersion(projectDto, isContruct);
} catch (Exception e) { } catch (Exception e) {
log.error("项目信息入库错误 " + e); log.error("项目信息入库错误 " + e);
throw new BusinessException("项目信息入库错误 :" + e); throw new BusinessException("项目信息入库错误 :" + e);
@@ -1020,7 +1018,7 @@ public class ProjectLibManage {
* 重新提交工作流时 舍弃在原有项目修改 * 重新提交工作流时 舍弃在原有项目修改
* 新增一个新的项目 新的版本号 * 新增一个新的项目 新的版本号
*/ */
public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) {
public Project newProjectWithVersion(ProjectDTO projecDto, Boolean isContruct) {
Project oldProject = projectService.getById(projecDto.getId()); Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project(); Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject)) VUtils.isTrue(Objects.isNull(oldProject))
@@ -1039,13 +1037,8 @@ public class ProjectLibManage {


oldProject.setIsBackReject(Boolean.TRUE); oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject); projectService.updateById(oldProject);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

saveApplication(projecDto,project,isContruct);
projectService.reverseNewest(project.getProjectCode(), project.getId());
saveApplication(projecDto, project, isContruct);


return project; return project;
} }
@@ -1076,19 +1069,14 @@ public class ProjectLibManage {
projectService.updateById(oldProject); projectService.updateById(oldProject);


if (projectService.save(project)) { if (projectService.save(project)) {
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//app
saveApplication(projecDto,project,isConstruct);
projectService.reverseNewest(project.getProjectCode(), project.getId());
saveApplication(projecDto, project, isConstruct);
} }


return project; return project;
} }


public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) {
public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType, Boolean isConstruct) {
Project oldProject = projectService.getById(projecDto.getId()); Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project(); Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject)) VUtils.isTrue(Objects.isNull(oldProject))
@@ -1113,13 +1101,10 @@ public class ProjectLibManage {
projectInst.setInstType(instType); projectInst.setInstType(instType);
projectInstService.save(projectInst); projectInstService.save(projectInst);


projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());


//app //app
saveApplication(projecDto,project,isConstruct);
saveApplication(projecDto, project, isConstruct);
} }


return project; return project;
@@ -1147,18 +1132,15 @@ public class ProjectLibManage {
projectInst.setInstType(instType); projectInst.setInstType(instType);
projectInstService.save(projectInst); projectInstService.save(projectInst);


projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());


saveApplication(project,oldProject,null);
saveApplication(project, oldProject, null);
} }


return project; return project;
} }


public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) {
public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, ProjectDTO dto, Integer instType, Boolean isBackReject) {
Project project = new Project(); Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject)) VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!"); .throwMessage("项目不存在!");
@@ -1189,13 +1171,10 @@ public class ProjectLibManage {
projectInst.setInstType(instType); projectInst.setInstType(instType);
projectInstService.save(projectInst); projectInstService.save(projectInst);


projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());


//APP //APP
saveApplication(project,oldProject,Boolean.TRUE);
saveApplication(project, oldProject, Boolean.TRUE);
} }


return project; return project;
@@ -1229,14 +1208,10 @@ public class ProjectLibManage {
projectInst.setInstType(instType); projectInst.setInstType(instType);
projectInstService.save(projectInst); projectInstService.save(projectInst);


projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());


saveApplication(project,oldProject,Boolean.TRUE);
saveApplication(project, oldProject, Boolean.TRUE);
} }

return project; return project;
} }


@@ -1379,7 +1354,7 @@ public class ProjectLibManage {
return user; return user;
} }


public ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) {
public ProjectListReq buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) {
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user);
if (!currentUserDataScope.isPresent()) { if (!currentUserDataScope.isPresent()) {
log.warn("没有取到权限信息 当前查询 没有权限条件"); log.warn("没有取到权限信息 当前查询 没有权限条件");
@@ -1553,8 +1528,8 @@ public class ProjectLibManage {
//只查 当前版本 和历史被驳回|退回的版本 //只查 当前版本 和历史被驳回|退回的版本
List<Project> historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) List<Project> historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode()) .eq(Project::getProjectCode, project.getProjectCode())
.and(q1->q1.eq(Project::getNewest, Boolean.TRUE)
.or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE)))
.and(q1 -> q1.eq(Project::getNewest, Boolean.TRUE)
.or(q2 -> q2.eq(Project::getIsBackReject, Boolean.TRUE)))
.orderByDesc(Project::getCreateOn)); .orderByDesc(Project::getCreateOn));


if (CollUtil.isEmpty(historyProjects)) { if (CollUtil.isEmpty(historyProjects)) {
@@ -1616,17 +1591,17 @@ public class ProjectLibManage {
return res; return res;
} }


public void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
public void saveApplication(Project project, Project oldProject, Boolean isConstruct) {
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) .eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); .eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));
if(CollUtil.isNotEmpty(apps)){
if (CollUtil.isNotEmpty(apps)) {
apps.forEach(app -> { apps.forEach(app -> {
Long oldAppId = app.getId(); Long oldAppId = app.getId();
app.setProjectVersion(project.getVersion()); app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId()); app.setProjectId(project.getId());
app.setId(null); app.setId(null);
if(Objects.nonNull(isConstruct)){
if (Objects.nonNull(isConstruct)) {
app.setIsConstruct(isConstruct); app.setIsConstruct(isConstruct);
} }
projectApplicationService.save(app); projectApplicationService.save(app);
@@ -1634,7 +1609,7 @@ public class ProjectLibManage {
//核心业务 //核心业务
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); .eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId));
if(CollUtil.isNotEmpty(cores)){
if (CollUtil.isNotEmpty(cores)) {
cores.forEach(c -> { cores.forEach(c -> {
c.setId(null); c.setId(null);
c.setApplicationId(app.getId()); c.setApplicationId(app.getId());
@@ -1645,7 +1620,7 @@ public class ProjectLibManage {
} }
} }


private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) {
private void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) {
UserInfoDetails user = LoginUserUtil.loginUserDetail(); UserInfoDetails user = LoginUserUtil.loginUserDetail();
//保存项目应用 //保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
@@ -1672,7 +1647,7 @@ public class ProjectLibManage {
projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version); projectApplication.setProjectVersion(version);
projectApplication.setIsConstruct(isConstruct); projectApplication.setIsConstruct(isConstruct);
if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){
if (StringUtils.isNotBlank(application.getRelatedExistsApplication())) {
projectApplication.setApplicationName(null); projectApplication.setApplicationName(null);
} }


@@ -1680,7 +1655,7 @@ public class ProjectLibManage {
// 保存应用关联的核心业务 // 保存应用关联的核心业务
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList(); List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList();
Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE;
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){
if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)) {
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
@@ -1697,11 +1672,12 @@ public class ProjectLibManage {


/** /**
* 申报项目转化为 项目归集 * 申报项目转化为 项目归集
*
* @param projectCode * @param projectCode
* @return * @return
*/ */
public GovBizProjectDetailVO convertToCollection(String projectCode) { public GovBizProjectDetailVO convertToCollection(String projectCode) {
ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode); ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode);
return ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService);
return ProjectConvertUtil.declaredToCollection(projectDetailVO, fileService);
} }
} }

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java View File

@@ -25,7 +25,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("nd_project_status_change") @TableName("nd_project_status_change")
@ApiModel(value = "NdProjectStatusChange对象", description = "")
@ApiModel(value = "NdProjectStatusChange对象")
public class ProjectStatusChange implements Serializable { public class ProjectStatusChange implements Serializable {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


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

@@ -1,5 +1,7 @@
package com.hz.pm.api.projectlib.service; package com.hz.pm.api.projectlib.service;


import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.Project;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@@ -10,7 +12,7 @@ import java.util.List;


/** /**
* <p> * <p>
* 服务类
* 服务类
* </p> * </p>
* *
* @author WendyYang * @author WendyYang
@@ -32,4 +34,13 @@ public interface IProjectService extends IService<Project> {


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)
.set(Project::getNewest, Boolean.FALSE)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectCode, projectCode)
.ne(Project::getId, projectId);
update(wrapper);
}

} }

+ 2
- 21
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java View File

@@ -726,7 +726,6 @@ public class TodoCenterManage {
* *
* @param response 返回数据流 * @param response 返回数据流
* @param param 请求参数 * @param param 请求参数
* @return void
* @author CMM * @author CMM
* @since 2023/02/06 * @since 2023/02/06
*/ */
@@ -1174,13 +1173,10 @@ public class TodoCenterManage {
newPi.setUpdateOn(LocalDateTime.now()); newPi.setUpdateOn(LocalDateTime.now());
projectInstService.save(newPi); projectInstService.save(newPi);


projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
projectService.reverseNewest(project.getProjectCode(), project.getId());


//再修改应用信息 //再修改应用信息
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication()
boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication()
? Boolean.TRUE : Boolean.FALSE; ? Boolean.TRUE : Boolean.FALSE;
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode));
Integer instType = projectInst.getInstType(); Integer instType = projectInst.getInstType();
@@ -1192,9 +1188,6 @@ public class TodoCenterManage {
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); .eq(ProjectApplication::getIsConstruct, Boolean.TRUE));
if (CollUtil.isNotEmpty(applicationList)) { if (CollUtil.isNotEmpty(applicationList)) {
projectApplicationService.removeBatchByIds(applicationList); projectApplicationService.removeBatchByIds(applicationList);
List<Long> applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList());
// projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
// .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds));
} }


List<ProjectApplicationDTO> applications = projectDto.getApplicationList(); List<ProjectApplicationDTO> applications = projectDto.getApplicationList();
@@ -1213,18 +1206,6 @@ public class TodoCenterManage {
projectApplication.setIsConstruct(Boolean.TRUE); projectApplication.setIsConstruct(Boolean.TRUE);
} }
projectApplication.setProjectVersion(project.getVersion()); projectApplication.setProjectVersion(project.getVersion());
boolean result = projectApplicationService.save(projectApplication);
// // 保存应用关联的核心业务
// List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList();
// Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE;
// if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){
// for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) {
// ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators();
// BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators);
// projectCoreBusinessIndicators.setApplicationId(application.getId());
// projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators);
// }
// }
} }
} }
return Boolean.TRUE; return Boolean.TRUE;


Loading…
Cancel
Save