流程监听问题

Blade 未结 1 49
1018969681
1018969681 剑圣 2022-11-21 20:40

一、该问题的重现步骤是什么?

1. 原已在blade-starter-flowable工程下配置好了监听事件,但是无法调用BladeX-Boot工程下的业务逻辑,官方给出解释需要在BladeX-Boot工程下配置监听事件,但是试过之后,如果配置在BladeX-Boot工程下,会报错找不到类

2. 配置如下:

image.png

image.png

3.


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。

image.png

五、若有更多详细信息,请在下面提供。

1条回答
  • @Configuration
    @AllArgsConstructor
    WfGlobListenerConfig ApplicationListener<ContextRefreshedEvent> {
    
       GlobalListener globalListenerRuntimeService runtimeService@Override
       onApplicationEvent(ContextRefreshedEvent event) {
          runtimeService.addEventListener(globalListenerFlowableEngineEventType.TASK_CREATED)runtimeService.addEventListener(globalListenerFlowableEngineEventType.TASK_ASSIGNED)runtimeService.addEventListener(globalListenerFlowableEngineEventType.TASK_COMPLETED)runtimeService.addEventListener(globalListenerFlowableEngineEventType.PROCESS_COMPLETED)runtimeService.addEventListener(globalListenerFlowableEngineEventType.PROCESS_COMPLETED_WITH_TERMINATE_END_EVENT)}
    }
    @Slf4j
    @Component
    GlobalListener AbstractFlowableEngineEventListener {
    
       @Autowired
       TaskService taskService@Autowired
       RuntimeService runtimeService@Autowired
       RepositoryService repositoryService@Autowired
       ISafeInspectionLedgerService safeInspectionLedgerService@Autowired
       IQualityInspectionLedgerService qualityInspectionLedgerService@Autowired
       BladeLogger bladeLogger@Override
       taskCreated(FlowableEngineEntityEvent event) {
          .taskCreated(event)Thread(() -> {
             {
                Thread.sleep()} (InterruptedException e) {
                e.printStackTrace()}
             (event FlowableEntityEventImpl) {
                String processDefinitionId = event.getProcessDefinitionId()String processInstanceId = event.getProcessInstanceId()ProcessDefinition processDefinition = repositoryService
                   .createProcessDefinitionQuery()
                   .processDefinitionId(processDefinitionId)
                   .singleResult()ProcessInstance process = runtimeService
                   .createProcessInstanceQuery()
                   .includeProcessVariables()
                   .processInstanceId(processInstanceId)
                   .singleResult()TaskEntity entity = (TaskEntity) event.getEntity()Task task = taskService.createTaskQuery()
                   .taskId(entity.getId())
                   .includeIdentityLinks()
                   .singleResult()(task != ) {
                   (StringUtil.isBlank(task.getAssignee())) { System.err.println()List<String> roles = ArrayList<>()List<String> userIds = ArrayList<>()List<? IdentityLinkInfo> identityLinks = task.getIdentityLinks()identityLinks.forEach(link -> {
                         (StringUtil.isNotBlank(link.getGroupId())) {
                            roles.add(link.getGroupId())}
                         (StringUtil.isNotBlank(link.getUserId())) {
                            userIds.add(link.getUserId())}
                      })System.err.println()System.err.println(roles)System.err.println()System.err.println()System.err.println(userIds)System.err.println()} {
                      System.err.println(+ processDefinition.getName() + + entity.getName() + )}
                }
             }
          }).start()}
    
       @Override
       taskAssigned(FlowableEngineEntityEvent event) { .taskAssigned(event)(event org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl) {
             TaskEntity entity = (TaskEntity) event.getEntity()(StringUtil.isNotBlank(entity.getOwner())) { Thread(() -> {
                   {
                      Thread.sleep()} (InterruptedException e) {
                      e.printStackTrace()}
                   ProcessDefinition processDefinition = repositoryService
                      .createProcessDefinitionQuery()
                      .processDefinitionId(event.getProcessDefinitionId())
                      .singleResult()String owner = entity.getOwner()String assignee = entity.getAssignee()DelegationState delegationState = entity.getDelegationState()(ObjectUtil.isNotEmpty(delegationState)) { System.err.println(entity.getOwner() + + processDefinition.getName() + + entity.getName() + )} { System.err.println(entity.getOwner() + + processDefinition.getName() + + entity.getName() + )}
                }).start()}
          }
       }
    
       @Override
       taskCompleted(FlowableEngineEntityEvent event) {
          .taskCompleted(event)(event FlowableEntityWithVariablesEventImpl) {
             TaskEntity entity = (TaskEntity) event.getEntity()System.err.println(entity.getVariables())Thread(() -> {
                {
                   Thread.sleep()} (InterruptedException e) {
                   e.printStackTrace()}
                List<Comment> comment = taskService.getTaskComments(entity.getId())}).start()}
       }
    
       @Override
       processCompleted(FlowableEngineEntityEvent event) {
          .processCompleted(event)ExecutionEntityImpl executionEntity = (ExecutionEntityImpl) event.getEntity()}
    
       @Override
       processCompletedWithTerminateEnd(FlowableEngineEntityEvent event) {
          .processCompletedWithTerminateEnd(event)System.err.println()}
    }

    参考这个代码。

    0 讨论(0)
提交回复