Commit c331a6ce by huangfusuper

工作流完结事件发布

parent 4b320574
...@@ -2,6 +2,7 @@ package com.byit.thread.helper; ...@@ -2,6 +2,7 @@ package com.byit.thread.helper;
import com.byit.enums.NodeRunStatusPropertyEnum; import com.byit.enums.NodeRunStatusPropertyEnum;
import com.byit.enums.RunRecordingEnum; import com.byit.enums.RunRecordingEnum;
import com.byit.event.EndFlowEvent;
import com.byit.job.enums.JobResultEnum; import com.byit.job.enums.JobResultEnum;
import com.byit.job.exceptions.BusinessException; import com.byit.job.exceptions.BusinessException;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
...@@ -11,6 +12,8 @@ import com.byit.service.RunRecordingService; ...@@ -11,6 +12,8 @@ import com.byit.service.RunRecordingService;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.sql.DataSource; import javax.sql.DataSource;
...@@ -23,12 +26,13 @@ import java.util.List; ...@@ -23,12 +26,13 @@ import java.util.List;
*/ */
@Component @Component
@Slf4j @Slf4j
public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper { public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper implements ApplicationEventPublisherAware {
private static final String LOCK_NAME = "judge_flow_end_lock"; private static final String LOCK_NAME = "judge_flow_end_lock";
private final DataSource dataSource; private final DataSource dataSource;
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
private final RunRecordingService runRecordingService; private final RunRecordingService runRecordingService;
private ApplicationEventPublisher applicationEventPublisher;
...@@ -64,6 +68,7 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper { ...@@ -64,6 +68,7 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper {
log.debug("----------------扫描到有完结的运行实例{},{}-------------",runCode, RunRecordingEnum.FLOW_STATUS_IS_END.getCode()); log.debug("----------------扫描到有完结的运行实例{},{}-------------",runCode, RunRecordingEnum.FLOW_STATUS_IS_END.getCode());
runRecording.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode()); runRecording.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode());
runRecordingService.updateRunRecordingById(runRecording); runRecordingService.updateRunRecordingById(runRecording);
applicationEventPublisher.publishEvent(new EndFlowEvent(this,flowId));
} }
}); });
return UNIVERSAL_WAIT_TIME; return UNIVERSAL_WAIT_TIME;
...@@ -113,4 +118,13 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper { ...@@ -113,4 +118,13 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper {
public String getLockName() { public String getLockName() {
return LOCK_NAME; return LOCK_NAME;
} }
/**
* 设置时间发布器
* @param applicationEventPublisher 事件发布器
*/
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment