Browse Source

修复项目详情查询报错

tags/24080901
WendyYang 7 months ago
parent
commit
30ab7d7877
10 changed files with 57 additions and 34 deletions
  1. +25
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ApplicationHandler.java
  2. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java
  3. +12
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java
  4. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/HandleParamContext.java
  5. +1
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectAdaptionHandle.java
  6. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java
  7. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectSelfTestHandle.java
  8. +1
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectTestValidHandle.java
  9. +1
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/XcfhxReviewHandle.java
  10. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java

+ 25
- 14
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ApplicationHandler.java View File

@@ -1,8 +1,12 @@
package com.hz.pm.api.dashboard.handle;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hz.pm.api.App;
import com.hz.pm.api.dashboard.constant.DashboardConstant;
import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO;
import com.hz.pm.api.projectlib.model.entity.Project;
@@ -14,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -31,8 +36,11 @@ public class ApplicationHandler {
private final IProjectApplicationService applicationService;

private final IProjectService projectService;
private final App app;

/**
* 生成项目产出
*
* @param projectCode
* @return
*/
@@ -43,33 +51,36 @@ public class ApplicationHandler {
generateOutputEntity(DashboardConstant.Protrait.PROJECT_SIGNS));
//2.查询应用
Project project = projectService.getProjectByCode(projectCode);
if(Objects.nonNull(project)){
if (Objects.nonNull(project)) {
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getProjectCode, projectCode));
for(ProjectApplication app : apps){
for (ProjectApplication app : apps) {
String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication();
res.put(appName,generateOutputEntity(appName));
res.put(appName, generateOutputEntity(appName));
}
}
return res;
}

public List<ProtraitProjectOutputVO> generateIrsApp(String projectCode) {
List<ProtraitProjectOutputVO> res = Lists.newArrayList();
public List<ProtraitProjectOutputVO> generateIrsApp(String projectCode, Integer version) {
//.查询应用
Project project = projectService.getProjectByCode(projectCode);
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getProjectCode, projectCode));
for(ProjectApplication app : apps){
String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication();
res.add(generateOutputEntity(appName));
Wrapper<ProjectApplication> paQuery = Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectVersion, version)
.eq(ProjectApplication::getProjectCode, projectCode);
List<ProjectApplication> apps = applicationService.list(paQuery);
if (apps.isEmpty()) {
return Collections.emptyList();
}
return res;
List<ProtraitProjectOutputVO> retApps = Lists.newArrayList();
for (ProjectApplication app : apps) {
String appName = StrUtil.blankToDefault(app.getApplicationName(), app.getRelatedExistsApplication());
retApps.add(generateOutputEntity(appName));
}
return retApps;
}

private ProtraitProjectOutputVO generateOutputEntity(String name){
private ProtraitProjectOutputVO generateOutputEntity(String name) {
return ProtraitProjectOutputVO.builder()
.name(DashboardConstant.Protrait.PROJECT_SIGNS)
.generateData(new ProtraitProjectOutputVO.GenerateData())


+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java View File

@@ -35,6 +35,12 @@ public interface IPurchaseInstService extends IService<PurchaseInst> {
return list(query);
}

default List<PurchaseInst> listByProjectId(Long projectId) {
Wrapper<PurchaseInst> query = Wrappers.lambdaQuery(PurchaseInst.class)
.eq(PurchaseInst::getProjectId, projectId);
return list(query);
}

default Map<Long, PurchaseInst> list(Collection<Long> purchaseIds, Integer instType) {
List<PurchaseInst> instances = list(Wrappers.lambdaQuery(PurchaseInst.class)
.in(PurchaseInst::getBidId, purchaseIds)


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

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

import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.wflow.workflow.bean.vo.ProcessInfoVO;
import com.wflow.workflow.enums.ProcessStatusEnum;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -8,6 +10,7 @@ import lombok.Getter;
import org.springframework.core.Ordered;

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

/**
@@ -61,6 +64,15 @@ public abstract class AbstractProcessHandle implements Ordered, ProcessHandle {
PROCESS_STATUS_PRIORITY_MAP.put(ProcessStatusEnum.BE_REJECTED, 2);
}

protected Map<Long, PurchaseInst> getPurchaseInstMap(List<PurchaseInst> instList,
Collection<Long> bidIds,
InstTypeEnum instType) {
return instList.stream()
.filter(w -> instType.eq(w.getInstType()) && bidIds.contains(w.getBidId()))
.collect(Collectors.toMap(PurchaseInst::getBidId, Function.identity(),
(w1, w2) -> w1.getCreateOn().isAfter(w2.getCreateOn()) ? w1 : w2));
}

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


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

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

import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
@@ -25,6 +26,8 @@ public final class HandleParamContext {

private List<Purchase> purchases;

private List<PurchaseInst> purchaseInstList;

private StepStatusEnum preStepStatus;

}

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

@@ -2,13 +2,10 @@ 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;
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;
@@ -35,8 +32,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class ProjectAdaptionHandle extends AbstractProcessHandle {

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

@Override
@@ -56,7 +51,7 @@ public class ProjectAdaptionHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.ADAPTION.getCode());
Map<Long, PurchaseInst> instMap = getPurchaseInstMap(ctx.getPurchaseInstList(), purchaseMap.keySet(), InstTypeEnum.ADAPTION);
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());


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

@@ -4,6 +4,8 @@ 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.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;
@@ -32,6 +34,7 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle {

private final IProjectStatusChangeService projectStatusChangeService;
private final IPurchaseService purchaseService;
private final IPurchaseInstService purchaseInstService;

@Override
public int getOrder() {
@@ -69,6 +72,8 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle {
detail.setFinishTime(change.getCreateOn());
List<Purchase> purchases = purchaseService.listByProjectId(project.getId());
ctx.setPurchases(purchases);
List<PurchaseInst> purchaseInstList = purchaseInstService.listByProjectId(project.getId());
ctx.setPurchaseInstList(purchaseInstList);
}
}
ctx.setPreStepStatus(detail.getStepStatus());


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

@@ -36,8 +36,6 @@ import static com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnu
@RequiredArgsConstructor
public class ProjectSelfTestHandle extends AbstractProcessHandle {

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

@Override
@@ -57,7 +55,8 @@ public class ProjectSelfTestHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.SELF_TEST.getCode());

Map<Long, PurchaseInst> instMap = getPurchaseInstMap(ctx.getPurchaseInstList(), purchaseMap.keySet(), InstTypeEnum.SELF_TEST);
for (Map.Entry<Long, PurchaseInst> entry : instMap.entrySet()) {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(entry.getValue().getCreateOn())) {
detail.setFinishTime(entry.getValue().getCreateOn());


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

@@ -36,8 +36,6 @@ import static com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEn
@RequiredArgsConstructor
public class ProjectTestValidHandle extends AbstractProcessHandle {

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

@Override
@@ -57,7 +55,7 @@ public class ProjectTestValidHandle extends AbstractProcessHandle {
ProcessDetailVO detail = new ProcessDetailVO();
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.TEST_VALID.getCode());
Map<Long, PurchaseInst> instMap = getPurchaseInstMap(ctx.getPurchaseInstList(), purchaseMap.keySet(), InstTypeEnum.TEST_VALID);
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());


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

@@ -2,12 +2,9 @@ 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;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.bean.vo.ProcessInfoVO;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
@@ -36,11 +33,8 @@ import static com.hz.pm.api.projectlib.model.enumeration.TenderXcfhxApplyStatusE
@RequiredArgsConstructor
public class XcfhxReviewHandle extends AbstractProcessHandle {

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


@Override
public void handle(HandleParamContext ctx) {
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) {
@@ -59,7 +53,7 @@ public class XcfhxReviewHandle extends AbstractProcessHandle {
detail.setProcessName(getProcessNode().getName());
detail.setProcessInfoList(new ArrayList<>());
ctx.getProcessDetails().add(detail);
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.XCFHX_APPLY.getCode());
Map<Long, PurchaseInst> instMap = getPurchaseInstMap(ctx.getPurchaseInstList(), purchaseMap.keySet(), InstTypeEnum.XCFHX_APPLY);
instMap.forEach((bidId, inst) -> {
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) {
detail.setFinishTime(inst.getCreateOn());


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

@@ -788,7 +788,7 @@ public class ProjectLibManage {
}

// 查询终验信息
retProjectDetail.setFinalIrsApps(applicationHandler.generateIrsApp(projectCode));
retProjectDetail.setFinalIrsApps(applicationHandler.generateIrsApp(projectCode, project.getVersion()));

// 处理文件名
List<Long> fileIdList = new ArrayList<>();


Loading…
Cancel
Save