Compare commits

..

30 Commits

Author SHA1 Message Date
a7dc35862a Merge remote-tracking branch 'origin/master' into feature/REQ-5965
# Conflicts:
#	workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/bpmn/BpmnProcessActivityController.java
2025-12-22 10:17:24 +08:00
836a95cef8 feat(REQ-5865) - 调整实例完成的相关日志 2025-12-10 12:34:39 +08:00
6d597ca377 Merge branch 'feature/REQ-5865' 2025-12-10 11:21:04 +08:00
a6df8008a0 Merge branch 'feature/REQ-5250' 2025-12-10 11:20:52 +08:00
ab895b15de Merge branch 'master' into feature/REQ-5250 2025-12-10 11:18:54 +08:00
5b625bbd83 Merge branch 'master' into feature/REQ-5865 2025-12-10 11:17:19 +08:00
a49f9bad15 feat(REQ-5865) - 解决 triggerAsync 后,业务节点文案消失的问题 2025-12-08 10:20:01 +08:00
9a0945fac1 feat(REQ-5865) - 解决 triggerAsync 后,业务节点文案消失的问题 2025-12-04 17:25:30 +08:00
65540e1685 feat(REQ-5865) - 添加执行过程日志 2025-12-04 17:25:28 +08:00
ce8b67ed15 feat(REQ-5865) - 添加执行过程日志 2025-12-04 17:25:25 +08:00
00ecd83eb2 feat(REQ-5865) - 添加执行过程日志 2025-12-04 16:08:31 +08:00
fbe3bfd836 feat(REQ-5865) - 测试 trigger 问题 2025-11-28 15:41:55 +08:00
d452465750 feat(REQ-5865) - 测试 trigger 问题 2025-11-28 15:12:26 +08:00
415b18f5f1 feat(REQ-5865) - 测试 trigger 问题 2025-11-28 14:42:43 +08:00
a603654dcc feat(REQ-5865) - 细化日志内容 2025-11-28 11:56:37 +08:00
wangli
4ec43e1f9c feat(REQ-5865) - 测试 trigger 问题 2025-11-28 11:10:41 +08:00
5197a49637 feat(REQ-5865) - 测试 trigger 问题 2025-11-27 18:52:14 +08:00
b68a6bec15 feat(REQ-5865) - 测试 trigger 问题 2025-11-27 18:49:54 +08:00
0d77c05b53 feat(REQ-5865) - 测试 trigger 问题 2025-11-27 18:13:07 +08:00
952fe67590 feat(REQ-5865) - 测试 trigger 问题 2025-11-27 16:41:49 +08:00
7c4434c3a4 feat(REQ-5965) - 调整 trigger 日志,记录请求方服务 2025-11-27 15:06:46 +08:00
039e2f27e8 feat(REQ-5965) - 调整 trigger 日志,记录请求方服务 2025-11-27 15:06:39 +08:00
ccda358a99 feat(REQ-5965) - 测试异步触发的处理 2025-11-27 15:06:34 +08:00
c7edc54720 feat(REQ-5965) - feignAPI 接口实现,获取客户端服务名称信息 2025-11-27 15:06:23 +08:00
8716ea808f feat(REQ-6570) - 调整八大按钮操作逻辑中的附件处理逻辑,增加 fileKey 存储 2025-11-26 14:49:01 +08:00
84e2e890de fix - 调整转交时的任务判断 2025-11-25 14:46:21 +08:00
167298881b feat(REQ-5865) - 调整 MQ 事件实现算 boolean 的逻辑 2025-11-25 10:10:01 +08:00
a9a90ab46d feat(REQ-5865) - 调整审批日志接口入参,控制是否增加查询未来节点 2025-11-20 15:52:17 +08:00
8259f31173 feat(REQ-5865) - 调整系统回退的 API 调用权限 2025-11-20 11:40:26 +08:00
2fa4680bac feat(REQ-5250) - 修复 checkInstanceApprover 函数onlyPersonId 的异常 2025-10-24 18:36:21 +08:00
14 changed files with 112 additions and 57 deletions

View File

@ -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);
/**

View File

@ -47,6 +47,13 @@ public class BpmnProcessInstanceLogQueryDTO {
@Builder.Default
private Boolean hasButton = false;
/**
* 是否包含未来的节点默认包含
*/
@ApiModelProperty(value = "是否包含未来的节点,默认包含")
@Builder.Default
private Boolean includeFutureTasks = true;
/**
* 是否需要加密同一个实例的日志在不同端[cms/oms]审批人的信息需要按一定规则进行隐藏控制
*/

View File

@ -52,9 +52,11 @@ public class AttachmentDTO implements Serializable {
/**
* 文件描述
* 该数据无实际作用
*/
@ApiModelProperty(value = "文件描述")
@IndexField(exist = false)
@Deprecated
private String description;
/**

View File

@ -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();

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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());

View File

@ -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 =

View File

@ -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));

View File

@ -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());

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;