Browse Source

系统自测、测试验证、审批通过处理

tags/24080901
WendyYang 7 months ago
parent
commit
a45fa5329d
3 changed files with 74 additions and 13 deletions
  1. +15
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  2. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidListReq.java
  3. +57
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java

+ 15
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -34,6 +34,7 @@ import com.hz.pm.api.projectdeclared.model.entity.Contract;
import com.hz.pm.api.projectdeclared.model.entity.Operation;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.model.enumerization.BidTypeEnum;
import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseScopeEnum;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq;
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO;
@@ -428,7 +429,8 @@ public class PurchaseManage {
}

private PageVo<TestValidListVO> queryData(TestValidListReq req,
SFunction<Purchase, Integer> function) {
SFunction<Purchase, Integer> function,
String actualTimeColumn) {
LambdaQueryWrapper<Purchase> query = Wrappers.lambdaQuery(Purchase.class)
.like(StrUtil.isNotBlank(req.getBidName()), Purchase::getBidName, req.getBidName())
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax())
@@ -436,6 +438,15 @@ public class PurchaseManage {
.eq(req.getStatus() != null, function, req.getStatus())
.isNotNull(function)
.orderByDesc(Purchase::getCreateOn);
if (!Boolean.FALSE.equals(req.getDisplay())) {
query.and(q1 -> q1.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode())
.or(q2 -> q2.exists(String.format("select 1 from nd_operation no" +
" where no.bid_id = nd_purchase.id and no.%s is not null", actualTimeColumn))));
} else {
query.and(q1 -> q1.ne(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode())
.or(q2 -> q2.exists(String.format("select 1 from nd_operation no" +
" where no.bid_id = nd_purchase.id and no.%s is null", actualTimeColumn))));
}
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
if (!buildPurchaseQueryPermission(query, user)) {
return PageVo.empty();
@@ -463,15 +474,15 @@ public class PurchaseManage {
}

public PageVo<TestValidListVO> testValidList(TestValidListReq req) {
return queryData(req, Purchase::getTestValidStatus);
return queryData(req, Purchase::getTestValidStatus, "actual_test_valid_time");
}

public PageVo<TestValidListVO> adaptList(TestValidListReq req) {
return queryData(req, Purchase::getAdaptStatus);
return queryData(req, Purchase::getAdaptStatus, "actual_adaption_time");
}

public PageVo<TestValidListVO> selfTestList(TestValidListReq req) {
return queryData(req, Purchase::getSelfTestStatus);
return queryData(req, Purchase::getSelfTestStatus, "actual_self_test_time");
}

@Transactional(rollbackFor = Exception.class)


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidListReq.java View File

@@ -26,4 +26,6 @@ public class TestValidListReq extends PagePo {

private LocalDateTime createOnMax;

private Boolean display;

}

+ 57
- 9
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java View File

@@ -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;


Loading…
Cancel
Save