|
|
@@ -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.projectlib.model.enumeration.status.TenderStatus; |
|
|
|
import com.hz.pm.api.todocenter.utils.BuildUserUtils; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessDetailVO; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessInfoVO; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessProgressVo; |
|
|
@@ -33,9 +30,7 @@ import java.util.stream.Collectors; |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class FinalInspectionHandle extends AbstractProcessHandle { |
|
|
|
|
|
|
|
private final IPurchaseInstService purchaseInstService; |
|
|
|
private final ProcessInstanceService processInstanceService; |
|
|
|
private final BuildUserUtils buildUserUtils; |
|
|
|
|
|
|
|
@Override |
|
|
|
public ProcessNode getProcessNode() { |
|
|
@@ -45,35 +40,37 @@ public class FinalInspectionHandle extends AbstractProcessHandle { |
|
|
|
@Override |
|
|
|
public void handle(HandleParamContext ctx) { |
|
|
|
ProcessDetailVO detail = new ProcessDetailVO(); |
|
|
|
ctx.getProcessDetails().add(detail); |
|
|
|
detail.setProcessName(getProcessNode().getName()); |
|
|
|
if (!ctx.getPreStepStatus().equals(StepStatusEnum.COMPLETED)) { |
|
|
|
detail.setStepStatus(StepStatusEnum.NOT_START); |
|
|
|
} else { |
|
|
|
List<Purchase> purchases = ctx.getPurchases(); |
|
|
|
Map<Long, Purchase> purchaseMap = purchases.stream() |
|
|
|
.filter(w -> TenderStatus.FINALLY_INSPECTED_FAILED.eq(w.getStatus()) |
|
|
|
|| TenderStatus.FINALLY_INSPECTED_PASSED.eq(w.getStatus()) |
|
|
|
|| TenderStatus.ON_FINALLY_INSPECTED_APPLY.eq(w.getStatus())) |
|
|
|
.collect(Collectors.toMap(Purchase::getId, Function.identity())); |
|
|
|
StepStatusEnum stepStatus; |
|
|
|
if (purchaseMap.isEmpty()) { |
|
|
|
stepStatus = StepStatusEnum.NOT_START; |
|
|
|
} else { |
|
|
|
List<ProcessInfoVO> processes = new ArrayList<>(); |
|
|
|
Map<Long, PurchaseInst> instMap = purchaseInstService.list(purchaseMap.keySet(), InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); |
|
|
|
Map<Long, PurchaseInst> instMap = getPurchaseInstMap(ctx.getPurchaseInstList(), |
|
|
|
purchaseMap.keySet(), InstTypeEnum.PROJECT_FINAL_INSPECTION); |
|
|
|
instMap.forEach((bidId, inst) -> { |
|
|
|
if (detail.getFinishTime() == null || detail.getFinishTime().isBefore(inst.getCreateOn())) { |
|
|
|
detail.setFinishTime(inst.getCreateOn()); |
|
|
|
} |
|
|
|
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); |
|
|
|
ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); |
|
|
|
ProcessInfoVO tenderProgress = new ProcessInfoVO(); |
|
|
|
tenderProgress.setProcessName(purchaseMap.get(bidId).getBidName()); |
|
|
|
tenderProgress.setProcessProgressVo(instanceDetail); |
|
|
|
tenderProgress.setProcessProgressVo(instDetail); |
|
|
|
processes.add(tenderProgress); |
|
|
|
}); |
|
|
|
stepStatus = getPurchaseStatus(processes); |
|
|
|
if (instMap.size() != purchases.size()) { |
|
|
|
stepStatus = StepStatusEnum.NOT_START; |
|
|
|
} else { |
|
|
|
stepStatus = getPurchaseStatus(processes); |
|
|
|
} |
|
|
|
if (stepStatus != StepStatusEnum.NOT_START) { |
|
|
|
ctx.getProcessDetails().add(detail); |
|
|
|
detail.setProcessInfoList(processes); |
|
|
|
} |
|
|
|
} |
|
|
|