feat(REQ-2924) - 添加一些新的日志处理逻辑
This commit is contained in:
parent
10701800b5
commit
8ec054f6be
@ -17,6 +17,7 @@ import org.flowable.common.engine.api.delegate.event.AbstractFlowableEventListen
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEntityEvent;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior;
|
||||
@ -31,15 +32,16 @@ import java.util.Set;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.AND_SIGN_EXPRESSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.HIDDEN_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_INITIATOR;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.OLD_INTERNAL_INITIATOR;
|
||||
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.bizSpecify;
|
||||
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.nobody;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AND;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.GENERAL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.OR;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_STARTER;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.PROCESSING;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApprovalMethod;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getNodeType;
|
||||
@ -108,6 +110,18 @@ public class EngineEntityEventListener extends AbstractFlowableEventListener {
|
||||
|
||||
private void onDeleted(TaskEntity taskEntity) {
|
||||
log.error("onDeleted");
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
queryLog.setTaskId(taskEntity.getId());
|
||||
ExtAxProcessLog update = new ExtAxProcessLog();
|
||||
if (Objects.equals(taskEntity.getTaskDefinitionKey(), NODE_STARTER.getType())) {
|
||||
update.setStatus(APPROVED.getStatus());
|
||||
} else {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
HistoryService historyService = processEngineConfiguration.getHistoryService();
|
||||
|
||||
}
|
||||
processLogService.update(queryLog, update);
|
||||
}
|
||||
|
||||
private void onUpdated(TaskEntity taskEntity) {
|
||||
@ -120,7 +134,8 @@ public class EngineEntityEventListener extends AbstractFlowableEventListener {
|
||||
} else {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
List<BpmnTaskDelegateAssigner> assigneeList = runtimeService.getVariable(taskEntity.getProcessInstanceId(), "[_ACTIVITY_INFO_SNAPSHOT_]" + taskEntity.getTaskDefinitionKey(), List.class);
|
||||
List<BpmnTaskDelegateAssigner> assigneeList = runtimeService.getVariable(taskEntity.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + taskEntity.getTaskDefinitionKey(), List.class);
|
||||
ListUtils.emptyIfNull(assigneeList).stream().filter(e -> Objects.equals(e.buildAssigneeId(), taskEntity.getAssignee())).findAny()
|
||||
.ifPresent(assignee -> {
|
||||
log.error("审批人: {}", JSON.toJSONString(assignee));
|
||||
@ -165,16 +180,11 @@ public class EngineEntityEventListener extends AbstractFlowableEventListener {
|
||||
log.setActivityId(taskEntity.getTaskDefinitionKey());
|
||||
log.setActivityName(taskEntity.getName());
|
||||
log.setApprovalMethod((isNodeStarter ? nobody : getApprovalMethod(flowElement).orElse(nobody)).getType());
|
||||
if (Objects.equals(log.getApprovalMethod(), nobody.getType()) || Objects.equals(log.getApprovalMethod(), bizSpecify.getType())) {
|
||||
log.setOperationDesc("待处理");
|
||||
}
|
||||
log.setNodeType((getNodeType(flowElement).orElse(BpmnFlowNodeType.NODE_EMPTY)).getType());
|
||||
log.setNodeMode((isNodeStarter ? BpmnFlowNodeMode.GENERAL : getNodeMode(flowElement)).getType());
|
||||
log.setTaskId(taskEntity.getId());
|
||||
log.setOperationDesc("待处理");
|
||||
if (Objects.nonNull(assignee)) {
|
||||
// FIXME 应该还有逻辑来拼接
|
||||
log.setOperationDesc(isNodeStarter ? assignee.getAssignerName() : null);
|
||||
|
||||
log.setAssigneeFull(assignee);
|
||||
log.setAssigneeId(Long.valueOf(assignee.getPersonId()));
|
||||
log.setAssigneeTenantId(assignee.getTenantId());
|
||||
@ -183,6 +193,7 @@ public class EngineEntityEventListener extends AbstractFlowableEventListener {
|
||||
}
|
||||
log.setStartTime(taskEntity.getCreateTime());
|
||||
log.setStatus(PROCESSING.getStatus());
|
||||
|
||||
processLogService.insert(log);
|
||||
}
|
||||
|
||||
@ -199,6 +210,7 @@ public class EngineEntityEventListener extends AbstractFlowableEventListener {
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return true;
|
||||
|
||||
@ -25,6 +25,21 @@ public interface ExtAxProcessLogService {
|
||||
*/
|
||||
void delete(ExtAxProcessLog deleteLog);
|
||||
|
||||
/**
|
||||
* 根据有 ID 的实体直接更新
|
||||
*
|
||||
* @param updateLog
|
||||
*/
|
||||
void updateById(ExtAxProcessLog updateLog);
|
||||
|
||||
/**
|
||||
* 根据条件更新指定对象的列
|
||||
*
|
||||
* @param query
|
||||
* @param update
|
||||
*/
|
||||
void update(ExtAxProcessLog query, ExtAxProcessLog update);
|
||||
|
||||
/**
|
||||
* 更新指定任务的审批人
|
||||
*
|
||||
|
||||
@ -42,9 +42,18 @@ public class ExtAxProcessLogServiceImpl implements ExtAxProcessLogService {
|
||||
extAxProcessLogMapper.delete(buildQueryWrapper(deleteLog));
|
||||
}
|
||||
|
||||
public void updateById(ExtAxProcessLog updateLog) {
|
||||
extAxProcessLogMapper.updateById(updateLog);
|
||||
}
|
||||
|
||||
public void update(ExtAxProcessLog query, ExtAxProcessLog update) {
|
||||
extAxProcessLogMapper.update(update, buildQueryWrapper(query));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAssignee(ExtAxProcessLog queryLog, BpmnTaskDelegateAssigner assignee) {
|
||||
updateAssignee(queryLog, assignee, assignee.getAssignerName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user