From ba1c0ad6cffaa8a6288a4e66d0598d16f1cccc10 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 13 十月 2021 11:00:35 +0800
Subject: [PATCH] 优化代码
---
service-common/src/main/java/com/java110/common/smo/impl/ContractApplyUserInnerServiceSMOImpl.java | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/service-common/src/main/java/com/java110/common/smo/impl/ContractApplyUserInnerServiceSMOImpl.java b/service-common/src/main/java/com/java110/common/smo/impl/ContractApplyUserInnerServiceSMOImpl.java
index 4080f70..5c6edc0 100644
--- a/service-common/src/main/java/com/java110/common/smo/impl/ContractApplyUserInnerServiceSMOImpl.java
+++ b/service-common/src/main/java/com/java110/common/smo/impl/ContractApplyUserInnerServiceSMOImpl.java
@@ -4,6 +4,7 @@
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.PageDto;
import com.java110.dto.contract.ContractDto;
+import com.java110.dto.purchaseApply.PurchaseApplyDto;
import com.java110.dto.workflow.WorkflowDto;
import com.java110.entity.audit.AuditUser;
import com.java110.intf.common.IContractApplyUserInnerServiceSMO;
@@ -18,6 +19,7 @@
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.history.HistoricTaskInstanceQuery;
+import org.activiti.engine.impl.identity.Authentication;
import org.activiti.engine.query.Query;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
@@ -60,9 +62,10 @@
//灏嗕俊鎭姞鍏ap,浠ヤ究浼犲叆娴佺▼涓�
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("contractDto", contractDto);
-
+ variables.put("userId", contractDto.getCurrentUserId());
+ variables.put("startUserId", contractDto.getCurrentUserId());
//寮�鍚祦绋�
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(contractDto.getStoreId()), variables);
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(contractDto.getStoreId()),contractDto.getContractId(), variables);
//灏嗗緱鍒扮殑瀹炰緥娴佺▼id鍊艰祴缁欎箣鍓嶈缃殑鍙橀噺
String processInstanceId = processInstance.getId();
// System.out.println("娴佺▼寮�鍚垚鍔�.......瀹炰緥娴佺▼id:" + processInstanceId);
@@ -70,6 +73,7 @@
contractDto.setProcessInstanceId(processInstanceId);
return contractDto;
+
}
/**
@@ -172,7 +176,7 @@
workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_CONTRACT_APPLY);
workflowDto.setStoreId(storeId);
List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
- Assert.listOnlyOne(workflowDtos, "鏈壘鍒� 鎶曡瘔寤鸿娴佺▼鎴栨壘鍒板鏉★紝璇峰湪鐗╀笟璐﹀彿绯荤粺绠$悊涓嬫祦绋嬬鐞嗕腑閰嶇疆娴佺▼");
+ Assert.listOnlyOne(workflowDtos, "鏈壘鍒� 鍚堝悓璧疯崏缁娴佺▼鎴栨壘鍒板鏉★紝璇峰湪鐗╀笟璐﹀彿绯荤粺绠$悊涓嬫祦绋嬬鐞嗕腑閰嶇疆娴佺▼");
WorkflowDto tmpWorkflowDto = workflowDtos.get(0);
if (StringUtil.isEmpty(tmpWorkflowDto.getProcessDefinitionKey())) {
@@ -259,4 +263,25 @@
return tmpContractDtos;
}
+
+ public boolean completeTask(@RequestBody ContractDto contractDto) {
+ TaskService taskService = processEngine.getTaskService();
+ Task task = taskService.createTaskQuery().taskId(contractDto.getTaskId()).singleResult();
+ String processInstanceId = task.getProcessInstanceId();
+ Authentication.setAuthenticatedUserId(contractDto.getCurrentUserId());
+ taskService.addComment(contractDto.getTaskId(), processInstanceId, contractDto.getAuditMessage());
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("auditCode", contractDto.getAuditCode());
+ variables.put("currentUserId", contractDto.getCurrentUserId());
+ variables.put("flag", "1200".equals(contractDto.getAuditCode()) ? "false" : "true");
+ variables.put("startUserId", contractDto.getStartUserId());
+ taskService.complete(contractDto.getTaskId(), variables);
+
+ ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+ if (pi == null) {
+ return true;
+ }
+ return false;
+ }
+
}
--
Gitblit v1.8.0