fix: 修复第一个节点不自动跳转的Bug2
This commit is contained in:
+7
-2
@@ -11,18 +11,20 @@ public enum ProcessType {
|
|||||||
/**
|
/**
|
||||||
* 企标立项变更
|
* 企标立项变更
|
||||||
*/
|
*/
|
||||||
ES_INIT_CHANGE("企标立项/变更计划", "1", "es-init-change"),
|
ES_INIT_CHANGE("企标立项/变更计划", "1", "es-init-change", "processEsInitChangeServiceImpl"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String value;
|
private final String value;
|
||||||
private final String processKey;
|
private final String processKey;
|
||||||
|
private final String serviceClassName;
|
||||||
|
|
||||||
ProcessType(String name, String value, String processKey) {
|
ProcessType(String name, String value, String processKey, String serviceClassName) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.processKey = processKey;
|
this.processKey = processKey;
|
||||||
|
this.serviceClassName = serviceClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProcessTypeNameByProcessKey(String processKey) {
|
public String getProcessTypeNameByProcessKey(String processKey) {
|
||||||
@@ -45,6 +47,9 @@ public enum ProcessType {
|
|||||||
public String getProcessKey() {
|
public String getProcessKey() {
|
||||||
return processKey;
|
return processKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getServiceClassName() {
|
||||||
|
return serviceClassName;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-1
@@ -57,7 +57,6 @@ public class ActFlowCommonService {
|
|||||||
Map<String, Object> variables = customService.setVariables(businessId);
|
Map<String, Object> variables = customService.setVariables(businessId);
|
||||||
// 第一个节点默认通过
|
// 第一个节点默认通过
|
||||||
variables.put("pass", true);
|
variables.put("pass", true);
|
||||||
variables.put("createUser", UserUtils.getUserId());
|
|
||||||
// 启动流程
|
// 启动流程
|
||||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(latestProcessDefinition.getId(), variables);
|
ProcessInstance processInstance = runtimeService.startProcessInstanceById(latestProcessDefinition.getId(), variables);
|
||||||
// 流程实例ID
|
// 流程实例ID
|
||||||
|
|||||||
+4
-4
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
|
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
|
||||||
|
import com.jero.modules.activiti.process.common.enums.ProcessType;
|
||||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||||
import com.jero.modules.activiti.process.common.service.IActFlowCustomService;
|
import com.jero.modules.activiti.process.common.service.IActFlowCustomService;
|
||||||
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
|
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
|
||||||
@@ -54,6 +55,7 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
|||||||
private Map<String, Object> setVariables(ProcessEsInitChange initChange) {
|
private Map<String, Object> setVariables(ProcessEsInitChange initChange) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
// 设置流程中各个节点的人
|
// 设置流程中各个节点的人
|
||||||
|
map.put("draftUser", UserUtils.getUserIdByUserName(initChange.getCreateBy()));
|
||||||
map.put("contactUser", initChange.getContactUser());
|
map.put("contactUser", initChange.getContactUser());
|
||||||
map.put("standardExpertList", Optional.ofNullable(initChange.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
map.put("standardExpertList", Optional.ofNullable(initChange.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
||||||
map.put("mainDraftUserLeader", initChange.getMainDraftUserLeader());
|
map.put("mainDraftUserLeader", initChange.getMainDraftUserLeader());
|
||||||
@@ -86,14 +88,14 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
|||||||
throw new JeroBootException("企标编号冲突");
|
throw new JeroBootException("企标编号冲突");
|
||||||
}
|
}
|
||||||
|
|
||||||
String processDefinitionKey = "es-init-change";
|
String processDefinitionKey = ProcessType.ES_INIT_CHANGE.getProcessKey();
|
||||||
String userId = UserUtils.getUserId();
|
String userId = UserUtils.getUserId();
|
||||||
// 保存到业务流程表
|
// 保存到业务流程表
|
||||||
saveBatch(esInitChangeList);
|
saveBatch(esInitChangeList);
|
||||||
ProcessEsInitChange initChange = esInitChangeList.get(0);
|
ProcessEsInitChange initChange = esInitChangeList.get(0);
|
||||||
|
|
||||||
// 对数据进行其他操作
|
// 对数据进行其他操作
|
||||||
String beanName = "processEsInitChangeServiceImpl";
|
String beanName = ProcessType.ES_INIT_CHANGE.getServiceClassName();
|
||||||
|
|
||||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, beanName, initChange.getId());
|
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, beanName, initChange.getId());
|
||||||
|
|
||||||
@@ -106,10 +108,8 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
|||||||
for (Map<String, Object> map : taskList) {
|
for (Map<String, Object> map : taskList) {
|
||||||
if (map.get("assignee").toString().equals(userId) &&
|
if (map.get("assignee").toString().equals(userId) &&
|
||||||
map.get("processDefinitionId").toString().equals(processDefinitionId)) {
|
map.get("processDefinitionId").toString().equals(processDefinitionId)) {
|
||||||
|
|
||||||
log.info("当前用户ID:{},相关联的流程定义ID:{}", userId, map.get("processDefinitionId").toString());
|
log.info("当前用户ID:{},相关联的流程定义ID:{}", userId, map.get("processDefinitionId").toString());
|
||||||
log.info("匹配到的任务ID:{}", map.get("taskId").toString());
|
log.info("匹配到的任务ID:{}", map.get("taskId").toString());
|
||||||
|
|
||||||
actFlowCommonService.completeTask("同意", map.get("taskId").toString(), userId, map);
|
actFlowCommonService.completeTask("同意", map.get("taskId").toString(), userId, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,9 @@ public class UserUtils {
|
|||||||
public static LoginUser getCurrentUser() {
|
public static LoginUser getCurrentUser() {
|
||||||
return (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
return (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUserIdByUserName(String createBy) {
|
||||||
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
return sysUser.getUsername();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user