Compare commits
30 Commits
05e7ad4563
...
a7dc35862a
| Author | SHA1 | Date | |
|---|---|---|---|
| a7dc35862a | |||
| 836a95cef8 | |||
| 6d597ca377 | |||
| a6df8008a0 | |||
| ab895b15de | |||
| 5b625bbd83 | |||
| a49f9bad15 | |||
| 9a0945fac1 | |||
| 65540e1685 | |||
| ce8b67ed15 | |||
| 00ecd83eb2 | |||
| fbe3bfd836 | |||
| d452465750 | |||
| 415b18f5f1 | |||
| a603654dcc | |||
|
|
4ec43e1f9c | ||
| 5197a49637 | |||
| b68a6bec15 | |||
| 0d77c05b53 | |||
| 952fe67590 | |||
| 7c4434c3a4 | |||
| 039e2f27e8 | |||
| ccda358a99 | |||
| c7edc54720 | |||
| 8716ea808f | |||
| 84e2e890de | |||
| 167298881b | |||
| a9a90ab46d | |||
| 8259f31173 | |||
| 2fa4680bac |
@ -120,7 +120,7 @@ public interface ProcessTaskApi {
|
||||
*/
|
||||
@Operation(summary = "系统操作回退任务到指定节点")
|
||||
@PostMapping("/api/process/task/system/back")
|
||||
@Manageable
|
||||
@InvokeMode(ASYNC)
|
||||
CommonResponse<Boolean> systemBackTask(@Validated @RequestBody BpmnNodeBackSystemOperateDTO dto);
|
||||
|
||||
/**
|
||||
|
||||
@ -47,6 +47,13 @@ public class BpmnProcessInstanceLogQueryDTO {
|
||||
@Builder.Default
|
||||
private Boolean hasButton = false;
|
||||
|
||||
/**
|
||||
* 是否包含未来的节点,默认包含
|
||||
*/
|
||||
@ApiModelProperty(value = "是否包含未来的节点,默认包含")
|
||||
@Builder.Default
|
||||
private Boolean includeFutureTasks = true;
|
||||
|
||||
/**
|
||||
* 是否需要加密(同一个实例的日志,在不同端[cms/oms]下,审批人的信息需要按一定规则进行隐藏控制)
|
||||
*/
|
||||
|
||||
@ -52,9 +52,11 @@ public class AttachmentDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 文件描述
|
||||
* 该数据无实际作用
|
||||
*/
|
||||
@ApiModelProperty(value = "文件描述")
|
||||
@IndexField(exist = false)
|
||||
@Deprecated
|
||||
private String description;
|
||||
|
||||
/**
|
||||
|
||||
@ -5,16 +5,17 @@ import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
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.TaskService;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.job.service.JobService;
|
||||
import org.flowable.job.service.impl.persistence.entity.JobEntity;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
@ -47,10 +48,12 @@ public class CustomActivityTriggerAsyncCmd extends AbstractCommand<String> imple
|
||||
public String execute(CommandContext commandContext) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId())
|
||||
.taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId())
|
||||
.singleResult();
|
||||
TaskQuery taskQuery = processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId());
|
||||
if (StringUtils.hasText(dto.getActivityId())) {
|
||||
taskQuery.taskDefinitionKey(dto.getActivityId());
|
||||
}
|
||||
TaskEntity task = (TaskEntity) taskQuery.singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId());
|
||||
}
|
||||
@ -59,7 +62,6 @@ public class CustomActivityTriggerAsyncCmd extends AbstractCommand<String> imple
|
||||
log.info("业务节点唤醒时,发现节点已经修改配置,无法继续唤醒,processInstanceId:{}, taskDefinitionKey={}", task.getProcessInstanceId(), task.getTaskDefinitionKey());
|
||||
return "";
|
||||
}
|
||||
|
||||
return startAsync(commandContext);
|
||||
}
|
||||
|
||||
@ -69,7 +71,7 @@ public class CustomActivityTriggerAsyncCmd extends AbstractCommand<String> imple
|
||||
TaskService taskService = processEngineConfiguration.getTaskService();
|
||||
TaskEntity task = (TaskEntity) taskService.createTaskQuery()
|
||||
.executionId(dto.getTriggerId())
|
||||
.taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId())
|
||||
.taskDefinitionKey(StringUtils.hasText(dto.getActivityId()) ? dto.getActivityId() : null)
|
||||
.singleResult();
|
||||
JobService jobService = processEngineConfiguration.getJobServiceConfiguration().getJobService();
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
@ -13,9 +12,11 @@ import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
@ -47,13 +48,16 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
|
||||
@Override
|
||||
public Void execute(CommandContext commandContext) {
|
||||
log.info("CustomActivityTriggerCmd execute start, dto: {}", JSON.toJSONString(dto));
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId())
|
||||
.taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId())
|
||||
.singleResult();
|
||||
TaskQuery taskQuery = processEngineConfiguration.getTaskService().createTaskQuery()
|
||||
.executionId(dto.getTriggerId());
|
||||
if (StringUtils.hasText(dto.getActivityId())) {
|
||||
taskQuery.taskDefinitionKey(dto.getActivityId());
|
||||
}
|
||||
TaskEntity task = (TaskEntity) taskQuery.singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId());
|
||||
}
|
||||
@ -63,9 +67,10 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
return null;
|
||||
}
|
||||
|
||||
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意");
|
||||
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意", true);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
runtimeService.trigger(dto.getTriggerId());
|
||||
log.info("CustomActivityTriggerCmd triggerAsync");
|
||||
runtimeService.triggerAsync(dto.getTriggerId());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -40,9 +40,9 @@ public class CustomCommandContext extends CommandContext {
|
||||
|
||||
} else if (exception instanceof FlowableException && ((FlowableException) exception).isReduceLogLevel()) {
|
||||
// reduce log level, because this may have been caused because of job deletion due to cancelActiviti="true"
|
||||
LOGGER.info("Error while closing command context", exception);
|
||||
LOGGER.info("Error while closing command context: {}", exception.getMessage(), exception);
|
||||
} else if (exception instanceof WorkflowEngineException) {
|
||||
LOGGER.warn("Workflow error while closing command context", exception);
|
||||
LOGGER.warn("Workflow error while closing command context: {}", exception.getMessage(), exception);
|
||||
} else if (exception instanceof PersistenceException) {
|
||||
Throwable rootCause = getRootCause(exception);
|
||||
if (rootCause instanceof MySQLTransactionRollbackException) {
|
||||
@ -53,7 +53,7 @@ public class CustomCommandContext extends CommandContext {
|
||||
LOGGER.warn("persistence error while closing command context:{}", exception.getMessage(), exception);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Error while closing command context", exception);
|
||||
LOGGER.error("Error while closing command context: {}", exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.TASK_HAS_BEEN_COMPLETE;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.TRANSFER_TO_SELF;
|
||||
import static cn.axzo.workflow.common.code.OtherRespCode.ASSIGNEE_NODE_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_ADVICE;
|
||||
@ -100,6 +101,9 @@ public class CustomTransferUserTaskCmd extends AbstractCommand<Void> implements
|
||||
|
||||
TaskService taskService = processEngineConfiguration.getTaskService();
|
||||
TaskEntity task = (TaskEntity) taskService.createTaskQuery().taskId(originTaskId).singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(TASK_HAS_BEEN_COMPLETE);
|
||||
}
|
||||
|
||||
validTargetAssigneeNodeId(task.getProcessDefinitionId());
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ public class CustomTaskHelper {
|
||||
Authentication.setAuthenticatedUserId(assigner.buildAssigneeId());
|
||||
attachmentList.forEach(dto -> {
|
||||
Attachment attachment = taskService.createAttachment(dto.getType().getType(), task.getId(), processInstanceId,
|
||||
dto.getName(), dto.getDescription(), dto.getUrl());
|
||||
dto.getName(), dto.getFileKey(), dto.getUrl());
|
||||
taskService.saveAttachment(attachment);
|
||||
});
|
||||
task.setTransientVariableLocal(TASK_ATTACHMENTS_VAR_NAME, attachmentList);
|
||||
@ -287,6 +287,10 @@ public class CustomTaskHelper {
|
||||
}
|
||||
|
||||
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message) {
|
||||
addComment(commandContext, task, type, message, false);
|
||||
}
|
||||
|
||||
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message, boolean withVariableLocal) {
|
||||
if (!StringUtils.hasText(type) || !StringUtils.hasText(message)) {
|
||||
return;
|
||||
}
|
||||
@ -311,8 +315,12 @@ public class CustomTaskHelper {
|
||||
comment.setFullMessage(message);
|
||||
|
||||
processEngineConfiguration.getCommentEntityManager().insert(comment);
|
||||
if (withVariableLocal) {
|
||||
task.setVariableLocal(type, message);
|
||||
} else {
|
||||
task.setTransientVariableLocal(type, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static Attachment addAttachment(CommandContext commandContext, Task task, AttachmentDTO attachmentDto) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutCallbackDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutTriggerDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAbortDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomActivityTriggerAsyncCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomActivityTriggerCmd;
|
||||
@ -47,6 +47,7 @@ public class BpmnProcessActivityServiceImpl implements BpmnProcessActivityServic
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void trigger(BpmnActivityTriggerDTO dto) {
|
||||
log.info("processActivityService trigger called");
|
||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||
if (Boolean.TRUE.equals(dto.getAsync())) {
|
||||
commandExecutor.execute(new CustomActivityTriggerAsyncCmd(dto));
|
||||
|
||||
@ -1237,7 +1237,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
}
|
||||
List<Task> list = taskService.createTaskQuery()
|
||||
.processInstanceId(dto.getProcessInstanceId())
|
||||
.taskAssigneeLikeIgnoreCase(dto.getApprover().buildAssigneeId())
|
||||
.taskAssigneeLikeIgnoreCase("%" + dto.getApprover().buildAssigneeId() + "%")
|
||||
.active()
|
||||
.list();
|
||||
return !CollectionUtils.isEmpty(list);
|
||||
@ -1260,7 +1260,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
|
||||
List<ProcessNodeDetailVO> forecasting = new ArrayList<>();
|
||||
// 只有还在运行中的实例才需要推测后续节点
|
||||
if (Objects.equals(historicProcessInstance.getBusinessStatus(), PROCESSING.getStatus())) {
|
||||
if (Objects.equals(historicProcessInstance.getBusinessStatus(), PROCESSING.getStatus()) && Objects.equals(Boolean.TRUE, dto.getIncludeFutureTasks())) {
|
||||
ProcessInstance instance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(dto.getProcessInstanceId())
|
||||
.includeProcessVariables()
|
||||
@ -1821,7 +1821,8 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.id(e.getId())
|
||||
.type(type)
|
||||
.name(e.getName())
|
||||
.description(e.getDescription())
|
||||
// .description(e.getDescription())
|
||||
.fileKey(e.getDescription())
|
||||
.url(e.getUrl())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -67,7 +67,7 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
|
||||
@Override
|
||||
public void onCreated(FlowableEngineEntityEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onCreated..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCreated..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId()).singleResult());
|
||||
Process mainProcess = getContext().getProcess(() -> repositoryService.getBpmnModel(event.getProcessDefinitionId()).getMainProcess());
|
||||
@ -92,13 +92,13 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
|
||||
setProcessInstanceVersion(event.getProcessInstanceId(), dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_CREATED);
|
||||
log.info("MessagePushProcessEventListener#onCreated...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCreated...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStarted(FlowableProcessStartedEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onStarted..., processInstanceId: {}", event.getNestedProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onStarted..., processInstanceId: {}", event.getNestedProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId())
|
||||
.singleResult());
|
||||
@ -127,12 +127,12 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
|
||||
setProcessInstanceVersion(((ExecutionEntityImpl) event.getEntity()).getProcessInstanceId(), dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_STARTED);
|
||||
log.info("MessagePushProcessEventListener#onStarted...end: {}", ((ExecutionEntityImpl) event.getEntity()).getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onStarted...end: {}", ((ExecutionEntityImpl) event.getEntity()).getProcessInstanceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FlowableCancelledEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onCancelled..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCancelled..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getDeploymentId())
|
||||
.singleResult());
|
||||
@ -163,7 +163,7 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
setProcessDeleteReason(event, dto);
|
||||
setProcessInstanceVersion(event.getProcessInstanceId(), dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_CANCELLED);
|
||||
log.info("MessagePushProcessEventListener#onCancelled...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCancelled...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +173,7 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
*/
|
||||
@Override
|
||||
public void onRejected(FlowableCancelledEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onRejected..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onRejected..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getDeploymentId())
|
||||
.singleResult());
|
||||
@ -204,12 +204,12 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
setProcessDeleteReason(event, dto);
|
||||
setProcessInstanceVersion(event.getProcessInstanceId(), dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_REJECTED);
|
||||
log.info("MessagePushProcessEventListener#onRejected...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onRejected...end, processInstanceId: {}", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted(FlowableCancelledEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onAborted..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onAborted..., processInstanceId: {}", event.getProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getDeploymentId())
|
||||
.singleResult());
|
||||
@ -240,12 +240,12 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
setProcessDeleteReason(event, dto);
|
||||
setProcessInstanceVersion(event.getProcessInstanceId(), dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_ABORTED);
|
||||
log.info("MessagePushProcessEventListener#onAborted...end, processInstanceId: {}.", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onAborted...end, processInstanceId: {}.", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(FlowableEngineEntityEvent event) {
|
||||
log.info("MessagePushProcessEventListener#onCompleted...,processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCompleted...,processInstanceId: {}", event.getProcessInstanceId());
|
||||
Deployment deployment = getContext().getDeployment(() -> repositoryService.createDeploymentQuery()
|
||||
.deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId())
|
||||
.singleResult());
|
||||
@ -279,7 +279,7 @@ public class RocketMqBpmnProcessEventListener extends AbstractBpmnEventListener<
|
||||
}
|
||||
dto.setWorkflowEngineVersion(version);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_COMPLETED);
|
||||
log.info("MessagePushProcessEventListener#onCompleted...end,processInstanceId: {}", event.getProcessInstanceId());
|
||||
log.info("RocketMqBpmnProcessEventListener#onCompleted...end,processInstanceId: {}", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
private void setProcessDeleteReason(FlowableCancelledEvent event, ProcessInstanceDTO dto) {
|
||||
|
||||
@ -81,6 +81,7 @@ public class BpmnProcessActivityController extends BasicPopulateAvatarController
|
||||
@Override
|
||||
@RepeatSubmit
|
||||
public CommonResponse<Boolean> trigger(@Validated @RequestBody BpmnActivityTriggerDTO dto) {
|
||||
log.info("businessNode trigger ===>>>参数:{}", JSON.toJSONString(dto));
|
||||
String header = request.getHeader(HEADER_SERVER_NAME);
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
log.info("业务节点唤醒 trigger ===>>>参数:{}, 请求来自微服务: {}, ip: {}", JSON.toJSONString(dto), header, remoteAddr);
|
||||
|
||||
@ -46,6 +46,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.AND_SIGN_EXPRESSION;
|
||||
@ -104,32 +105,35 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
|
||||
@Override
|
||||
public void onCreate(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onCreate processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
// 记录发起人
|
||||
boolean isNodeStarter = Objects.equals(taskEntity.getTaskDefinitionKey(), NODE_STARTER.getType());
|
||||
|
||||
BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(taskEntity.getProcessDefinitionId());
|
||||
FlowElement flowElement = bpmnModel.getFlowElement(taskEntity.getTaskDefinitionKey());
|
||||
|
||||
ExtAxProcessLog log = new ExtAxProcessLog();
|
||||
log.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
log.setTenantId(taskEntity.getTenantId());
|
||||
log.setActivityId(taskEntity.getTaskDefinitionKey());
|
||||
log.setActivityName(taskEntity.getName());
|
||||
log.setApprovalMethod((isNodeStarter ? nobody : getApprovalMethod(flowElement).orElse(nobody)).getType());
|
||||
log.setNodeType((getNodeType(flowElement).orElse(BpmnFlowNodeType.NODE_EMPTY)).getType());
|
||||
log.setNodeMode((isNodeStarter ? BpmnFlowNodeMode.GENERAL : getNodeMode(flowElement)).getType());
|
||||
log.setTaskId(taskEntity.getId());
|
||||
ExtAxProcessLog processLog = new ExtAxProcessLog();
|
||||
processLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
processLog.setTenantId(taskEntity.getTenantId());
|
||||
processLog.setActivityId(taskEntity.getTaskDefinitionKey());
|
||||
processLog.setActivityName(taskEntity.getName());
|
||||
processLog.setApprovalMethod((isNodeStarter ? nobody : getApprovalMethod(flowElement).orElse(nobody)).getType());
|
||||
processLog.setNodeType((getNodeType(flowElement).orElse(BpmnFlowNodeType.NODE_EMPTY)).getType());
|
||||
processLog.setNodeMode((isNodeStarter ? BpmnFlowNodeMode.GENERAL : getNodeMode(flowElement)).getType());
|
||||
processLog.setTaskId(taskEntity.getId());
|
||||
String operationDesc = taskEntity.getVariable(COMMENT_TYPE_OPERATION_DESC, String.class);
|
||||
log.setOperationDesc(StringUtils.hasText(operationDesc) ? operationDesc : HANDLING.getDesc());
|
||||
log.setStartTime(taskEntity.getCreateTime());
|
||||
log.setStatus(PROCESSING.getStatus());
|
||||
log.setSignature(getActivitySignature(flowElement));
|
||||
processLog.setOperationDesc(StringUtils.hasText(operationDesc) ? operationDesc : HANDLING.getDesc());
|
||||
processLog.setStartTime(taskEntity.getCreateTime());
|
||||
processLog.setStatus(PROCESSING.getStatus());
|
||||
processLog.setSignature(getActivitySignature(flowElement));
|
||||
|
||||
processLogService.insert(log);
|
||||
log.info("TaskEntityEventHandle#onCreate insert:{}", JSON.toJSONString(processLog));
|
||||
processLogService.insert(processLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialized(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onInitialized processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
Process process = ProcessDefinitionUtil.getProcess(taskEntity.getProcessDefinitionId());
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
@ -139,15 +143,18 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
.ifPresent(updateLog::setButtonConf);
|
||||
BpmnMetaParserHelper.getFormFieldPermissionConf(process.getFlowElement(taskEntity.getTaskDefinitionKey()))
|
||||
.ifPresent(updateLog::setFormFieldPermissionConf);
|
||||
log.info("TaskEntityEventHandle#onInitialized update, queryLog: {}, updateLog: {}", JSON.toJSONString(queryLog), JSON.toJSONString(updateLog));
|
||||
processLogService.update(queryLog, updateLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onUpdated processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
if (Objects.equals(HIDDEN_ASSIGNEE_ID, taskEntity.getAssignee())) {
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
queryLog.setTaskId(taskEntity.getId());
|
||||
log.info("TaskEntityEventHandle#onUpdated delete: {}", JSON.toJSONString(queryLog));
|
||||
processLogService.delete(queryLog);
|
||||
} else {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
@ -172,6 +179,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
// 快照审批人的组织架构信息
|
||||
OrgStructureSnapshotInfo snapshotInfo = buildApproverOrgStructureInfo(assignee, taskEntity);
|
||||
|
||||
log.info("TaskEntityEventHandle#onUpdated updateAssigneeAndSnapshot, queryLog: {}, assignee: {}, snapshotInfo: {}", JSON.toJSONString(queryLog), JSON.toJSONString(assignee), JSON.toJSONString(snapshotInfo));
|
||||
processLogService.updateAssigneeAndSnapshot(queryLog, assignee, snapshotInfo);
|
||||
});
|
||||
}
|
||||
@ -245,6 +253,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
|
||||
@Override
|
||||
public void onDeleted(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onDeleted processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
queryLog.setTaskId(taskEntity.getId());
|
||||
@ -272,7 +281,8 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
if (Objects.nonNull(advice) && StringUtils.hasText(advice.toString())) {
|
||||
update.setAdvice(advice.toString());
|
||||
}
|
||||
Object operationDesc = taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC);
|
||||
Object operationDesc = Optional.ofNullable(taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC)).orElse(taskEntity.getVariableLocal(COMMENT_TYPE_OPERATION_DESC));
|
||||
log.info("TaskEntityEventHandle#onDeleted processInstanceId: {}, operationDesc: {}", taskEntity.getProcessInstanceId(), operationDesc);
|
||||
if (Objects.nonNull(operationDesc) && StringUtils.hasText(operationDesc.toString())) {
|
||||
update.setOperationDesc(Objects.nonNull(assignee) ?
|
||||
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "") + operationDesc
|
||||
@ -282,6 +292,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "")
|
||||
: "");
|
||||
}
|
||||
taskEntity.removeVariableLocal(COMMENT_TYPE_OPERATION_DESC);
|
||||
|
||||
|
||||
String completionType = taskEntity.getVariable(TASK_COMPLETE_OPERATION_TYPE + taskEntity.getId(), String.class);
|
||||
@ -310,6 +321,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
update.setOperationDesc("抄送" + carbonCopies.size() + "人");
|
||||
}
|
||||
|
||||
log.info("TaskEntityEventHandle#onDeleted update, queryLog: {}, update: {}", JSON.toJSONString(queryLog), JSON.toJSONString(update));
|
||||
processLogService.update(queryLog, update);
|
||||
|
||||
if (needDelete) {
|
||||
@ -317,6 +329,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
ExtAxProcessLog deleteLog = new ExtAxProcessLog();
|
||||
deleteLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
deleteLog.setTaskId(taskEntity.getId());
|
||||
log.info("TaskEntityEventHandle#onDeleted delete, deleteLog: {}", JSON.toJSONString(deleteLog));
|
||||
processLogService.delete(deleteLog);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,19 +81,30 @@ public class ImplementationReadyChecker implements ApplicationListener<Applicati
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自适应转换:value ≤15 时返回 4 位数组,否则返回最小所需位数数组
|
||||
*/
|
||||
public static boolean[] toBooleansAdaptive(int value) {
|
||||
if (value < 0) throw new IllegalArgumentException("adaptive mode only for non-negative");
|
||||
if (value == 0) return new boolean[]{false};
|
||||
int bits = 32 - Integer.numberOfLeadingZeros(value);
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException("adaptive mode only for non-negative");
|
||||
}
|
||||
|
||||
// 核心修改:value ≤15 强制用 4 位,否则计算最小所需位数
|
||||
int bits = (value <= 15) ? 4 : (32 - Integer.numberOfLeadingZeros(value));
|
||||
return toBooleans(value, bits);
|
||||
}
|
||||
|
||||
// 高位在前:index=0 是最高位
|
||||
/**
|
||||
* 将 value 转换为指定位数的 boolean 数组(高位在前)
|
||||
*/
|
||||
public static boolean[] toBooleans(int value, int bits) {
|
||||
if (bits <= 0 || bits > 32) throw new IllegalArgumentException("bits must be 1~32");
|
||||
if (bits <= 0 || bits > 32) {
|
||||
throw new IllegalArgumentException("bits must be 1~32");
|
||||
}
|
||||
|
||||
boolean[] arr = new boolean[bits];
|
||||
for (int i = 0; i < bits; i++) {
|
||||
int shift = bits - 1 - i;
|
||||
int shift = bits - 1 - i; // 从高位到低位遍历
|
||||
arr[i] = ((value >>> shift) & 1) == 1;
|
||||
}
|
||||
return arr;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user