Browse Source

优化进度查询

tags/24080901
WendyYang 7 months ago
parent
commit
89206c73bf
20 changed files with 191 additions and 162 deletions
  1. +7
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java
  2. +1
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  3. +7
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  4. +4
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java
  5. +24
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessHandle.java
  6. +0
    -49
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessProgressContext.java
  7. +64
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessProgressHelper.java
  8. +5
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ApprovalAmountHandle.java
  9. +6
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/FinalInspectionHandle.java
  10. +6
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/FirstInspectedHandle.java
  11. +6
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/PilotRunningHandle.java
  12. +9
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectAdaptionHandle.java
  13. +5
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java
  14. +5
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java
  15. +5
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java
  16. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java
  17. +9
    -11
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectSelfTestHandle.java
  18. +9
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectTestValidHandle.java
  19. +5
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/XcfhxReviewHandle.java
  20. +9
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java

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

@@ -191,7 +191,6 @@ public class ProjectFileManage {
}
return vo;
}).collect(Collectors.toList());

return PageVo.of(vos, page.getTotal());
}

@@ -225,17 +224,17 @@ public class ProjectFileManage {
}
ProjectFileVO projectFileVo = new ProjectFileVO();
String projectCode = project.getProjectCode();
ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId);
List<ProcessDetailVO> processDetailVos = projectLibManage.processScheduleDetail(projectId);
ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode);
ProjectDetailVO projectDetail = projectLibManage.getProjectDetail(project);
List<ProcessDetailVO> processDetail = projectLibManage.processScheduleDetail(project);
ProjectReviewDetailVO projectReviewDetail = expertReviewManage.projectExpertReviewDetail(projectCode);
List<PurchaseVO> purchaseVos = purchaseManage.detailByProjectId(projectId);
List<ContractVO> contractVos = constructionManage.detailContractByProjectId(projectId);
List<PreInsVO> preInsVo = constructionManage.detailPreInsByProjectId(projectId);
FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId);
FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProject(project);

projectFileVo.setProjectDetailVo(projectDetailVo);
projectFileVo.setProcessDetailVos(processDetailVos);
projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo);
projectFileVo.setProjectDetailVo(projectDetail);
projectFileVo.setProcessDetailVos(processDetail);
projectFileVo.setProjectReviewDetailVo(projectReviewDetail);
projectFileVo.setPurchaseVos(purchaseVos);
projectFileVo.setContractVos(contractVos);
projectFileVo.setPreInsVo(preInsVo);


+ 1
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -263,13 +263,8 @@ public class ConstructionManage {
* @return \
*/
public List<ContractVO> detailContractByProjectId(Long projectId) {
Project project = projectService.getNewProject(projectId);
if (Objects.isNull(project)) {
return Collections.emptyList();
}
List<Contract> contracts = contractService.list(Wrappers.lambdaQuery(Contract.class)
.eq(Contract::getProjectCode, project.getProjectCode()));

.eq(Contract::getProjectId, projectId));
return BeanUtil.copyToList(contracts, ContractVO.class);
}



+ 7
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -223,15 +223,20 @@ public class FinalAcceptanceManage {

public FinalAcceptanceVO detailByProjectId(Long projectId) {
FinalAcceptanceVO vo = new FinalAcceptanceVO();

Project project = projectService.getById(projectId);
vo.setProjectId(projectId);
if (Objects.nonNull(project)) {
vo.setFinalAcceptanceMaterials(project.getFinalAcceptanceMaterials());
// TODO IRS接口获取 应用信息
vo.setApps(Collections.emptyList());
}
return vo;
}

public FinalAcceptanceVO detailByProject(Project project) {
FinalAcceptanceVO vo = new FinalAcceptanceVO();
vo.setProjectId(project.getId());
vo.setFinalAcceptanceMaterials(project.getFinalAcceptanceMaterials());
vo.setApps(Collections.emptyList());
return vo;
}



+ 4
- 14
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java View File

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

import com.google.common.collect.Maps;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.bean.vo.ProcessInfoVO;
import com.wflow.workflow.enums.ProcessStatusEnum;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -19,7 +17,7 @@ import java.util.stream.Collectors;
* @since 2023/02/24 14:22
*/

public abstract class AbstractProcessHandle implements Ordered {
public abstract class AbstractProcessHandle implements Ordered, ProcessHandle {
/**
* 构造,子类必须实现
*/
@@ -27,15 +25,6 @@ public abstract class AbstractProcessHandle implements Ordered {

}

/**
* 抽象的,所有具体处理者应该实现的处理逻辑
*
* @param ctx ctx
*/
abstract void handle(HandleParamContext ctx);

abstract ProcessNode getProcessNode();

@Getter
@AllArgsConstructor
public enum ProcessNode {
@@ -63,15 +52,16 @@ public abstract class AbstractProcessHandle implements Ordered {

}

private static final Map<ProcessStatusEnum, Integer> PROCESS_STATUS_PRIORITY_MAP = new HashMap<>();
private static final Map<ProcessStatusEnum, Integer> PROCESS_STATUS_PRIORITY_MAP;

static {
PROCESS_STATUS_PRIORITY_MAP = new EnumMap<>(ProcessStatusEnum.class);
PROCESS_STATUS_PRIORITY_MAP.put(ProcessStatusEnum.APPROVED, 3);
PROCESS_STATUS_PRIORITY_MAP.put(ProcessStatusEnum.UNDER_REVIEW, 1);
PROCESS_STATUS_PRIORITY_MAP.put(ProcessStatusEnum.BE_REJECTED, 2);
}

static StepStatusEnum getPurchaseStatus(List<ProcessInfoVO> processes) {
protected static StepStatusEnum getPurchaseStatus(List<ProcessInfoVO> processes) {
Optional<Integer> min = processes.stream().map(w -> {
ProcessStatusEnum status = Arrays.stream(ProcessStatusEnum.values())
.filter(s -> s.getDesc().equals(w.getProcessProgressVo().getStatus()))


+ 24
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessHandle.java View File

@@ -0,0 +1,24 @@
package com.hz.pm.api.projectlib.handle;

import static com.hz.pm.api.projectlib.handle.AbstractProcessHandle.ProcessNode;

/**
* <p>
* ProcessHandle
* </p>
*
* @author WendyYang
* @since 16:01 2024/4/11
*/
public interface ProcessHandle {

/**
* 抽象的,所有具体处理者应该实现的处理逻辑
*
* @param ctx ctx
*/
void handle(HandleParamContext ctx);

ProcessNode getProcessNode();

}

+ 0
- 49
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessProgressContext.java View File

@@ -1,49 +0,0 @@
package com.hz.pm.api.projectlib.handle;

import com.hz.pm.api.projectlib.model.entity.Project;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
* 流程执行链
*
* @author CMM
* @since 2023/02/26 21:36
*/
@Component
@RequiredArgsConstructor
public class ProcessProgressContext {

/**
* 具体处理者的集合
*/
private final List<AbstractProcessHandle> processBusinessHandles;

public List<ProcessDetailVO> handle(Project project, List<ProcessDetailVO> processSchedule) {
HandleParamContext handleParamContext = new HandleParamContext();
handleParamContext.setProject(project);
handleParamContext.setProcessDetails(processSchedule);
if (!processBusinessHandles.isEmpty()) {
processBusinessHandles.sort(Comparator.comparing(AbstractProcessHandle::getOrder));
for (AbstractProcessHandle processBusinessHandle : processBusinessHandles) {
processBusinessHandle.handle(handleParamContext);
}
/*for (int i = processSchedule.size() - 1; i >= 1; i--) {
ProcessDetailVO curr = processSchedule.get(i);
if (curr.getStepStatus() == null ||
curr.getStepStatus().equals(StepStatusEnum.NOT_START)) {
continue;
}
ProcessDetailVO pre = processSchedule.get(i - 1);
pre.setStepStatus(StepStatusEnum.COMPLETED);
}*/
return processSchedule;
}
return Collections.emptyList();
}
}

+ 64
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessProgressHelper.java View File

@@ -0,0 +1,64 @@
package com.hz.pm.api.projectlib.handle;

import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.bean.vo.ProcessInfoVO;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.enums.StepStatusEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.Collectors;

/**
* 流程执行链
*
* @author CMM
* @since 2023/02/26 21:36
*/
@Component
@RequiredArgsConstructor
public class ProcessProgressHelper {

/**
* 具体处理者的集合
*/
private final List<AbstractProcessHandle> processHandles;
private final BuildUserUtils buildUserUtils;

public List<ProcessDetailVO> handle(Project project) {
HandleParamContext handleParamContext = new HandleParamContext();
handleParamContext.setProject(project);
handleParamContext.setProcessDetails(new ArrayList<>());
if (!processHandles.isEmpty()) {
processHandles.sort(Comparator.comparing(AbstractProcessHandle::getOrder));
for (AbstractProcessHandle processBusinessHandle : processHandles) {
processBusinessHandle.handle(handleParamContext);
}
List<ProcessDetailVO> details = handleParamContext.getProcessDetails();
List<ProgressNode> prgressList = details.stream()
.filter(w -> !w.getStepStatus().equals(StepStatusEnum.NOT_START))
.map(w -> {
List<ProgressNode> progresses = new ArrayList<>();
ProcessProgressVo progress = w.getProcessProgressVo();
if (progress != null) {
progresses.addAll(progress.getProgressInfo());
} else if (w.getProcessInfoList() != null) {
for (ProcessInfoVO processInfo : w.getProcessInfoList()) {
progresses.addAll(processInfo.getProcessProgressVo().getProgressInfo());
}
}
return progresses;
}).flatMap(Collection::stream).collect(Collectors.toList());
if (!prgressList.isEmpty()) {
buildUserUtils.buildUserByProcessInfo(prgressList);
}
return details;
}
return Collections.emptyList();
}

}

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ApprovalAmountHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ApprovalAmountHandle.java View File

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

import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -19,7 +21,7 @@ import java.util.List;
public class ApprovalAmountHandle extends AbstractProcessHandle {

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
Project project = ctx.getProject();
List<ProcessDetailVO> processDetails = ctx.getProcessDetails();
ProcessDetailVO detail = new ProcessDetailVO();
@@ -29,7 +31,7 @@ public class ApprovalAmountHandle extends AbstractProcessHandle {
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.APPROVAL_AMOUNT;
}


hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/FinalInspectionHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/FinalInspectionHandle.java View File

@@ -1,9 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
@@ -34,17 +35,16 @@ import java.util.stream.Collectors;
public class FinalInspectionHandle extends AbstractProcessHandle {

private final IPurchaseInstService purchaseInstService;
private final IPurchaseService purchaseService;
private final ProcessInstanceService processInstanceService;
private final BuildUserUtils buildUserUtils;

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.FINAL_INSPECTED;
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
ProcessDetailVO detail = new ProcessDetailVO();
ctx.getProcessDetails().add(detail);
detail.setProcessName(getProcessNode().getName());
@@ -63,21 +63,18 @@ public class FinalInspectionHandle extends AbstractProcessHandle {
} else {
List<ProcessInfoVO> processes = new ArrayList<>();
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode());
List<ProgressNode> progressNodes = new ArrayList<>();
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());
}
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
progressNodes.addAll(instanceDetail.getProgressInfo());
ProcessInfoVO tenderProgress = new ProcessInfoVO();
tenderProgress.setProcessName(purchaseMap.get(bidId).getBidName());
tenderProgress.setProcessProgressVo(instanceDetail);
processes.add(tenderProgress);
});
stepStatus = getPurchaseStatus(detail.getProcessInfoList());
stepStatus = getPurchaseStatus(processes);
if (stepStatus != StepStatusEnum.NOT_START) {
buildUserUtils.buildUserByProcessInfo(progressNodes);
detail.setProcessInfoList(processes);
}
}

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/FirstInspectedHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/FirstInspectedHandle.java View File

@@ -1,9 +1,11 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -24,7 +26,7 @@ public class FirstInspectedHandle extends AbstractProcessHandle {
private final IProjectStatusChangeService projectStatusChangeService;

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.FIRST_INSPECTED;
}

@@ -34,7 +36,7 @@ public class FirstInspectedHandle extends AbstractProcessHandle {
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
ctx.getProcessDetails().add(detail);
@@ -49,6 +51,7 @@ public class FirstInspectedHandle extends AbstractProcessHandle {
ProjectStatusChange change = projectStatusChangeService.getOne(query);
if (change != null) {
detail.setFinishTime(change.getCreateOn());
detail.setStepStatus(StepStatusEnum.COMPLETED);
ctx.setPreStepStatus(StepStatusEnum.COMPLETED);
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PilotRunningHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/PilotRunningHandle.java View File

@@ -1,9 +1,11 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
@@ -26,7 +28,7 @@ public class PilotRunningHandle extends AbstractProcessHandle {
private final IProjectStatusChangeService projectStatusChangeService;

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
ctx.getProcessDetails().add(detail);
@@ -41,6 +43,7 @@ public class PilotRunningHandle extends AbstractProcessHandle {
ProjectStatusChange change = projectStatusChangeService.getOne(query);
if (change != null) {
detail.setFinishTime(change.getCreateOn());
detail.setStepStatus(StepStatusEnum.COMPLETED);
ctx.setPreStepStatus(StepStatusEnum.COMPLETED);
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);
@@ -51,7 +54,7 @@ public class PilotRunningHandle extends AbstractProcessHandle {
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PILOT_RUNNING;
}


hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectAdaptionHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectAdaptionHandle.java View File

@@ -1,8 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
@@ -38,7 +40,7 @@ public class ProjectAdaptionHandle extends AbstractProcessHandle {
private final ProcessInstanceService processInstanceService;

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) {
return;
}
@@ -54,28 +56,26 @@ public class ProjectAdaptionHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
ctx.getProcessDetails().add(detail);
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.ADAPTION.getCode());
List<ProgressNode> progressNodes = new ArrayList<>();
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());
}
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
progressNodes.addAll(instanceDetail.getProgressInfo());
ProcessInfoVO tenderProgress = new ProcessInfoVO();
tenderProgress.setProcessName(purchaseMap.get(bidId).getBidName());
tenderProgress.setProcessProgressVo(instanceDetail);
detail.getProcessInfoList().add(tenderProgress);
});
buildUserUtils.buildUserByProcessInfo(progressNodes);
StepStatusEnum stepStatus = getPurchaseStatus(detail.getProcessInfoList());
detail.setStepStatus(stepStatus);
ctx.setPreStepStatus(stepStatus);
if (!StepStatusEnum.ON_GOING.equals(stepStatus)) {
detail.setStepStatus(stepStatus);
ctx.getProcessDetails().add(detail);
}
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PROJECT_ADAPTION;
}


hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java View File

@@ -1,8 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
@@ -40,12 +42,12 @@ public class ProjectApprovalHandle extends AbstractProcessHandle {
private final BuildUserUtils buildUserUtils;

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PROJECT_APPROVAL;
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
ctx.getProcessDetails().add(detail);
@@ -92,7 +94,6 @@ public class ProjectApprovalHandle extends AbstractProcessHandle {
if (inst != null) {
ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
detail.setProcessProgressVo(instDetail);
buildUserUtils.buildUserByProcessInfo(instDetail.getProgressInfo());
}
}
}

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectDeclareHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java View File

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

import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -7,7 +9,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

/**
* 项目申报处理
@@ -20,12 +21,12 @@ import java.util.List;
public class ProjectDeclareHandle extends AbstractProcessHandle {

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PROJECT_DECLARED;
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成
ProcessDetailVO processDetailVO = new ProcessDetailVO();
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPurchaseHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java View File

@@ -1,13 +1,14 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -38,12 +39,12 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle {
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PROJECT_PURCHASE;
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
ctx.getProcessDetails().add(detail);

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectReviewHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java View File

@@ -1,12 +1,12 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

/**
* 项目申报处理
@@ -19,7 +19,7 @@ import java.util.List;
public class ProjectReviewHandle extends AbstractProcessHandle {

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.PROJECT_REVIEW;
}

@@ -29,7 +29,7 @@ public class ProjectReviewHandle extends AbstractProcessHandle {
}

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成
ProcessDetailVO processDetailVO = new ProcessDetailVO();
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);

hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectSelfTestHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectSelfTestHandle.java View File

@@ -1,9 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
@@ -35,13 +36,12 @@ import static com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnu
@RequiredArgsConstructor
public class ProjectSelfTestHandle extends AbstractProcessHandle {

private final IPurchaseService purchaseService;
private final IPurchaseInstService purchaseInstService;
private final BuildUserUtils buildUserUtils;
private final ProcessInstanceService processInstanceService;

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) {
return;
}
@@ -57,28 +57,26 @@ public class ProjectSelfTestHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
ctx.getProcessDetails().add(detail);
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.SELF_TEST.getCode());
List<ProgressNode> progressNodes = new ArrayList<>();
for (Map.Entry<Long, PurchaseInst> entry : instMap.entrySet()) {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(entry.getValue().getCreateOn())) {
detail.setFinishTime(entry.getValue().getCreateOn());
}
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, entry.getValue().getInstCode());
progressNodes.addAll(instanceDetail.getProgressInfo());
ProcessInfoVO tenderProgress = new ProcessInfoVO();
tenderProgress.setProcessName(purchaseMap.get(entry.getKey()).getBidName());
tenderProgress.setProcessProgressVo(instanceDetail);
detail.getProcessInfoList().add(tenderProgress);
}
buildUserUtils.buildUserByProcessInfo(progressNodes);
StepStatusEnum stepStatus = getPurchaseStatus(detail.getProcessInfoList());
detail.setStepStatus(stepStatus);
ctx.setPreStepStatus(stepStatus);
if (!StepStatusEnum.ON_GOING.equals(stepStatus)) {
detail.setStepStatus(stepStatus);
ctx.getProcessDetails().add(detail);
}
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.SYSTEM_SELF_TEST;
}


hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectTestValidHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectTestValidHandle.java View File

@@ -1,8 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
@@ -39,11 +41,10 @@ public class ProjectTestValidHandle extends AbstractProcessHandle {
private final ProcessInstanceService processInstanceService;

@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) {
return;
}
List<ProcessDetailVO> processDetails = ctx.getProcessDetails();
List<Purchase> purchases = ctx.getPurchases();
Map<Long, Purchase> purchaseMap = purchases.stream()
.filter(w -> TEST_VALID_INFO_PASSED.eq(w.getTestValidStatus())
@@ -56,28 +57,26 @@ public class ProjectTestValidHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
processDetails.add(detail);
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.TEST_VALID.getCode());
List<ProgressNode> progressNodes = new ArrayList<>();
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());
}
ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
progressNodes.addAll(instDetail.getProgressInfo());
ProcessInfoVO tenderProgress = new ProcessInfoVO();
tenderProgress.setProcessName(purchaseMap.get(bidId).getBidName());
tenderProgress.setProcessProgressVo(instDetail);
detail.getProcessInfoList().add(tenderProgress);
});
buildUserUtils.buildUserByProcessInfo(progressNodes);
StepStatusEnum stepStatus = getPurchaseStatus(detail.getProcessInfoList());
detail.setStepStatus(stepStatus);
ctx.setPreStepStatus(stepStatus);
if (!StepStatusEnum.ON_GOING.equals(stepStatus)) {
detail.setStepStatus(stepStatus);
ctx.getProcessDetails().add(detail);
}
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.SYSTEM_TEST_VALID;
}


hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/XcfhxReviewHandle.java → hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/XcfhxReviewHandle.java View File

@@ -1,8 +1,10 @@
package com.hz.pm.api.projectlib.handle;
package com.hz.pm.api.projectlib.handle.stage;

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle;
import com.hz.pm.api.projectlib.handle.HandleParamContext;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.todocenter.utils.BuildUserUtils;
import com.wflow.workflow.bean.process.ProgressNode;
@@ -40,7 +42,7 @@ public class XcfhxReviewHandle extends AbstractProcessHandle {


@Override
void handle(HandleParamContext ctx) {
public void handle(HandleParamContext ctx) {
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) {
return;
}
@@ -58,26 +60,23 @@ public class XcfhxReviewHandle extends AbstractProcessHandle {
detail.setProcessInfoList(new ArrayList<>());
ctx.getProcessDetails().add(detail);
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.XCFHX_APPLY.getCode());
List<ProgressNode> progressNodes = new ArrayList<>();
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());
}
ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
progressNodes.addAll(instDetail.getProgressInfo());
ProcessInfoVO tenderProgress = new ProcessInfoVO();
tenderProgress.setProcessName(purchaseMap.get(bidId).getBidName());
tenderProgress.setProcessProgressVo(instDetail);
detail.getProcessInfoList().add(tenderProgress);
});
buildUserUtils.buildUserByProcessInfo(progressNodes);
StepStatusEnum stepStatus = getPurchaseStatus(detail.getProcessInfoList());
detail.setStepStatus(stepStatus);
ctx.setPreStepStatus(stepStatus);
}

@Override
ProcessNode getProcessNode() {
public ProcessNode getProcessNode() {
return ProcessNode.XCFHX_REVIEW;
}


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

@@ -53,7 +53,7 @@ import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil;
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos;
import com.hz.pm.api.projectlib.handle.ProcessProgressContext;
import com.hz.pm.api.projectlib.handle.ProcessProgressHelper;
import com.hz.pm.api.projectlib.helper.ProjectHelper;
import com.hz.pm.api.projectlib.model.constant.ProjectConstant;
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO;
@@ -122,7 +122,7 @@ public class ProjectLibManage {
private final IProjectService projectService;
private final IProjectApplicationService applicationService;
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService;
private final ProcessProgressContext processExecuteHandle;
private final ProcessProgressHelper processExecuteHandle;
private final FileService fileService;
private final IProjectApplicationService projectApplicationService;
private final ProjectCodeGenUtil projectCodeGenUtil;
@@ -650,6 +650,10 @@ public class ProjectLibManage {
return getProjectDetailLogic(projectInfo);
}

public ProjectDetailVO getProjectDetail(Project project) {
return getProjectDetailLogic(project);
}

public ProjectDetailVO detailProjectCode(String projectCode) {
// 查询最新的项目申报信息
Project project = projectService.getProjectByCode(projectCode);
@@ -1267,19 +1271,12 @@ public class ProjectLibManage {
}

public List<ProcessDetailVO> processScheduleDetail(Long projectId) {
List<ProcessDetailVO> processDetailVOS = new ArrayList<>();
Project project = projectService.getById(projectId);
return processExecuteHandle.handle(project, processDetailVOS);
return processExecuteHandle.handle(project);
}

private boolean checkCanRead(Set<String> subOrgSet, Project project) {
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目
LambdaQueryWrapper<ProjectApplyBorrow> query = Wrappers.lambdaQuery(ProjectApplyBorrow.class)
.select(ProjectApplyBorrow::getProjectId)
.in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet)
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE);
List<Long> applyBorrowProjectIdList = CollUtils.fieldList(projectApplyBorrowService.list(query), ProjectApplyBorrow::getProjectId);
return applyBorrowProjectIdList.contains(project.getId());
public List<ProcessDetailVO> processScheduleDetail(Project project) {
return processExecuteHandle.handle(project);
}

public void exportList(ProjectListReq param, HttpServletResponse response) {


Loading…
Cancel
Save