|
|
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Assert; |
|
|
@@ -14,8 +13,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.hz.pm.api.common.helper.WflowHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.constant.TypeReferenceConst; |
|
|
|
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; |
|
|
|
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; |
|
|
|
import com.hz.pm.api.common.statemachine.util.*; |
|
|
|
import com.hz.pm.api.common.util.BizUtils; |
|
|
|
import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; |
|
|
|
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; |
|
|
@@ -57,15 +55,10 @@ import com.wflow.workflow.service.ProcessInstanceService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.flowable.bpmn.model.BpmnModel; |
|
|
|
import org.flowable.bpmn.model.UserTask; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.engine.RepositoryService; |
|
|
|
import org.flowable.engine.RuntimeService; |
|
|
|
import org.flowable.engine.TaskService; |
|
|
|
import org.flowable.engine.history.HistoricActivityInstance; |
|
|
|
import org.flowable.engine.history.HistoricProcessInstance; |
|
|
|
import org.flowable.engine.repository.ProcessDefinition; |
|
|
|
import org.flowable.engine.task.Comment; |
|
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
@@ -107,6 +100,9 @@ public class HandlerManage { |
|
|
|
private final IPurchaseService purchaseService; |
|
|
|
private final IPurchaseInstService purchaseInstService; |
|
|
|
private final TenderStateMachineUtil tenderStateMachineUtil; |
|
|
|
private final SelfTestStateMachineUtil selfTestStateMachineUtil; |
|
|
|
private final AdaptStateMachineUtil adaptStateMachineUtil; |
|
|
|
private final TestValidStateMachineUtil testValidStateMachineUtil; |
|
|
|
private final WflowHelper wflowHelper; |
|
|
|
|
|
|
|
@Value("${spring.profiles.active}") |
|
|
@@ -166,7 +162,11 @@ public class HandlerManage { |
|
|
|
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 |
|
|
|
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { |
|
|
|
// 如果是申请延期和申请借阅审批流程,不走状态机 |
|
|
|
if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) { |
|
|
|
if (InstTypeEnum.APPLY_DELAY.eq(instType) |
|
|
|
|| InstTypeEnum.APPLY_BORROW.eq(instType) |
|
|
|
|| InstTypeEnum.TEST_VALID.eq(instType) |
|
|
|
|| InstTypeEnum.SELF_TEST.eq(instType) |
|
|
|
|| InstTypeEnum.ADAPTION.eq(instType)) { |
|
|
|
switch (instTypeEnum) { |
|
|
|
case APPLY_DELAY: |
|
|
|
// 保存延期申请记录,更新项目建设周期和计划验收时间 |
|
|
@@ -176,6 +176,11 @@ public class HandlerManage { |
|
|
|
// 更新申请借阅状态为成功 |
|
|
|
updateProjectApplyBorrowInfo(project, instanceId); |
|
|
|
break; |
|
|
|
case ADAPTION: |
|
|
|
case SELF_TEST: |
|
|
|
case TEST_VALID: |
|
|
|
purchaseOperationPassedCallback(project.getId(), instanceId, instTypeEnum); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw BizException.wrap("传入实例类型错误: %s", instTypeEnum); |
|
|
|
} |
|
|
@@ -235,6 +240,44 @@ public class HandlerManage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void purchaseOperationPassedCallback(Long projectId, String instanceId, InstTypeEnum instType) { |
|
|
|
PurchaseInst purchaseInst = purchaseInstService.getByProjectIdAndInstCode(projectId, instanceId); |
|
|
|
Purchase purchase = purchaseService.getById(purchaseInst.getBidId()); |
|
|
|
switch (instType) { |
|
|
|
case ADAPTION: |
|
|
|
adaptStateMachineUtil.pass(purchase); |
|
|
|
break; |
|
|
|
case SELF_TEST: |
|
|
|
selfTestStateMachineUtil.pass(purchase); |
|
|
|
break; |
|
|
|
case TEST_VALID: |
|
|
|
testValidStateMachineUtil.pass(purchase); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw BizException.wrap("无效的流程类型"); |
|
|
|
} |
|
|
|
purchaseService.updateById(purchase); |
|
|
|
} |
|
|
|
|
|
|
|
private void purchaseOperationRejectedCallback(Long projectId, String instanceId, InstTypeEnum instType) { |
|
|
|
PurchaseInst purchaseInst = purchaseInstService.getByProjectIdAndInstCode(projectId, instanceId); |
|
|
|
Purchase purchase = purchaseService.getById(purchaseInst.getBidId()); |
|
|
|
switch (instType) { |
|
|
|
case ADAPTION: |
|
|
|
adaptStateMachineUtil.reject(purchase); |
|
|
|
break; |
|
|
|
case SELF_TEST: |
|
|
|
selfTestStateMachineUtil.reject(purchase); |
|
|
|
break; |
|
|
|
case TEST_VALID: |
|
|
|
testValidStateMachineUtil.reject(purchase); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw BizException.wrap("无效的流程类型"); |
|
|
|
} |
|
|
|
purchaseService.updateById(purchase); |
|
|
|
} |
|
|
|
|
|
|
|
private void purchasePassedCallback(Project project, String instanceId, ProjectProcessStageEnum processStage) { |
|
|
|
// 查询所有的标段 |
|
|
|
List<Purchase> purchases = purchaseService.listByProjectId(project.getId()); |
|
|
@@ -358,6 +401,11 @@ public class HandlerManage { |
|
|
|
case PROJECT_FINAL_INSPECTION: |
|
|
|
purchaseRejectedCallback(project, instanceId); |
|
|
|
break; |
|
|
|
case TEST_VALID: |
|
|
|
case SELF_TEST: |
|
|
|
case ADAPTION: |
|
|
|
purchaseOperationRejectedCallback(project.getId(), instanceId, instTypeEnum); |
|
|
|
break; |
|
|
|
default: |
|
|
|
updateRejectProjectStatus(userId, project, instType); |
|
|
|
break; |
|
|
|