Browse Source

修改项目审批

tags/24080901
WendyYang 8 months ago
parent
commit
e9498fa4e0
3 changed files with 31 additions and 14 deletions
  1. +19
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  2. +12
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java
  3. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java

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

@@ -37,6 +37,7 @@ import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.todocenter.manage.HandlerManage;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -86,6 +87,7 @@ public class FinalAcceptanceManage {
private final StateMachineUtil stateMachineUtil;
private final TenderStateMachineUtil tenderStateMachineUtil;
private final IProjectInstService projectInstService;
private final HandlerManage handlerManage;


/**
@@ -234,8 +236,9 @@ public class FinalAcceptanceManage {
*/
@Transactional(rollbackFor = Exception.class)
public String startProcess(SubmitFinallyInspectedReq req) {
Integer instTypeCode = ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode();
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode())
.eq(WflowModels::getProcessType, instTypeCode)
.last(BizConst.LIMIT_1));
if (Objects.isNull(model)) {
throw new BusinessException("找不到验收申报流程配置");
@@ -268,17 +271,26 @@ public class FinalAcceptanceManage {
purchaseInst.setBidId(req.getBidId());
purchaseInst.setInstCode(instanceId);
purchaseInst.setProjectId(req.getProjectId());
purchaseInst.setInstType(ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode());
purchaseInst.setInstType(instTypeCode);
purchaseInstService.save(purchaseInst);
boolean allFinalInspected = purchases.stream().noneMatch(w -> StrUtils.isBlank(w.getFinalInspectionMaterials()));
ProjectInst projectInst = new ProjectInst();
projectInst.setInstType(ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode());
projectInst.setInstType(instTypeCode);
projectInst.setInstCode(instanceId);
projectInst.setProjectId(req.getProjectId());
projectInstService.save(projectInst);
if (allFinalInspected) {
stateMachineUtil.pass(project);
projectService.updateById(project);

if (ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.eq(project.getStatus())) {
// 判断是否所有标段已经进行过终验申报 无论是否通过
LambdaQueryWrapper<PurchaseInst> purchaseInstQuery = Wrappers.lambdaQuery(PurchaseInst.class)
.select(PurchaseInst::getBidId)
.eq(PurchaseInst::getInstType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode())
.in(PurchaseInst::getBidId, purchaseMap.keySet());
List<PurchaseInst> currPurchaseInstList = purchaseInstService.list(purchaseInstQuery);
Set<Long> finalInspectedBidIds = CollUtils.fieldSet(currPurchaseInstList, PurchaseInst::getBidId);
if (finalInspectedBidIds.size() == purchases.size()) {
stateMachineUtil.pass(project);
projectService.updateById(project);
}
}
//发送给第一个审批人消息
return instanceId;


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

@@ -246,12 +246,19 @@ public class HandlerManage {
if (instCodes.size() != purchases.size()) {
return;
}
if (allInstancesFinished(instCodes)) {
stateMachineUtil.pass(project);
projectService.updateById(project);
}
}

public boolean allInstancesFinished(Set<String> instCodes) {
long finishedCount = historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(instCodes)
.finished()
.count();
if (finishedCount != instCodes.size()) {
return;
return Boolean.FALSE;
}
for (String instCode : instCodes) {
HistoricActivityInstance task = historyService.createHistoricActivityInstanceQuery()
@@ -261,18 +268,17 @@ public class HandlerManage {
.desc()
.singleResult();
if (task == null) {
return;
return Boolean.FALSE;
}
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(instCode)
.variableName("approve_" + task.getTaskId())
.singleResult();
if (variableInstance == null || !"PASS".equals(variableInstance.getValue())) {
return;
return Boolean.FALSE;
}
}
stateMachineUtil.pass(project);
projectService.updateById(project);
return Boolean.TRUE;
}

private void purchaseRejectedCallback(Project project, String instanceId) {
@@ -354,7 +360,7 @@ public class HandlerManage {
public void afterRejectTodo(Project project, HistoricProcessInstance hiInst) {
Long userId = LoginUserUtil.getUserId();
// 获取当前流程实例类型
String instanceId = project.getInstCode();
String instanceId = hiInst.getId();
ProjectInst projectInst = projectInstService.getByInstCode(instanceId);
Integer instType = projectInst.getInstType();
// 审批流程不是申请延期和申请借阅,需调用状态机


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java View File

@@ -357,7 +357,6 @@ public class TodoCenterManage {
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();

//提前判断下 是不是 已经被退回了
checkIsBack(instance);



Loading…
Cancel
Save