REQ-3023-触发业务节点增加activityId参数,避免连续业务节点触发,导致请求被验重切面拦截问题
This commit is contained in:
parent
727e485e17
commit
c03cfd87c5
@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 推动业务节点继续执行
|
||||
@ -20,7 +21,9 @@ import javax.validation.constraints.NotBlank;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class BpmnActivityTriggerDTO {
|
||||
public class BpmnActivityTriggerDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1759998765977414031L;
|
||||
|
||||
/**
|
||||
* 业务节点的触发 ID
|
||||
@ -34,4 +37,9 @@ public class BpmnActivityTriggerDTO {
|
||||
*/
|
||||
@ApiModelProperty(value = "是否异步", notes = "异步时,只接收请求便返回数据")
|
||||
private Boolean async = true;
|
||||
|
||||
/**
|
||||
* 流程定义节点id
|
||||
*/
|
||||
private String activityId;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.engine.job.AsyncActivityTriggerJobHandler;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
@ -46,9 +47,11 @@ public class CustomActivityTriggerAsyncCmd extends AbstractCommand<String> imple
|
||||
public String execute(CommandContext commandContext) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
Execution execution = runtimeService.createExecutionQuery().executionId(dto.getTriggerId()).singleResult();
|
||||
if (Objects.isNull(execution)) {
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId())
|
||||
.taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId())
|
||||
.singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId());
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package cn.axzo.workflow.core.engine.cmd;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
@ -14,8 +15,8 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.ACTIVITY_TRIGGER_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addComment;
|
||||
|
||||
/**
|
||||
@ -26,6 +27,7 @@ import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addCommen
|
||||
*/
|
||||
public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5806130509691903321L;
|
||||
private static final Logger log = LoggerFactory.getLogger(CustomActivityTriggerCmd.class);
|
||||
private final BpmnActivityTriggerDTO dto;
|
||||
|
||||
@ -41,10 +43,12 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
@Override
|
||||
public Void execute(CommandContext commandContext) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService()
|
||||
.createTaskQuery().executionId(dto.getTriggerId()).singleResult();
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId())
|
||||
.taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId())
|
||||
.singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId());
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class BpmnProcessActivityController extends BasicPopulateAvatarController
|
||||
@Deprecated
|
||||
public CommonResponse<Boolean> trigger(@NotBlank(message = "触发 ID 不能为空") @RequestParam String triggerId) {
|
||||
log.info("业务节点唤醒 trigger2 ===>>>参数:{}", triggerId);
|
||||
return trigger(new BpmnActivityTriggerDTO(triggerId, true));
|
||||
return trigger(new BpmnActivityTriggerDTO(triggerId, true, null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user