修改:工作流引擎执行器优化

This commit is contained in:
yangyang01000846
2025-12-03 10:33:24 +08:00
parent 19983da10e
commit 4105f06d1a
12 changed files with 39 additions and 17 deletions

View File

@@ -1,4 +1,7 @@
package com.sdm.common.entity.flowable.executeConfig;
import lombok.Data;
@Data
public class CloudAppExecuteConfig extends BaseExecuteConfig {
}

View File

@@ -1,4 +1,7 @@
package com.sdm.common.entity.flowable.executeConfig;
import lombok.Data;
@Data
public class ExportWordScriptExecuteConfig extends BaseExecuteConfig {
}

View File

@@ -1,4 +1,10 @@
package com.sdm.common.entity.flowable.executeConfig;
import lombok.Data;
@Data
public class HPCExecuteConfig extends BaseExecuteConfig {
private String beforeNodeId;
}

View File

@@ -1,4 +1,7 @@
package com.sdm.common.entity.flowable.executeConfig;
import lombok.Data;
@Data
public class LocalAppExecuteConfig extends BaseExecuteConfig {
}

View File

@@ -20,7 +20,8 @@
"executeConfig": {
"executeType": "HPC",
"asyncCallback": true,
"waitUser":true
"waitUser":true,
"beforeNodeId": false
}
}
},

View File

@@ -1,6 +1,6 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.entity.flowable.executeConfig.BaseExecuteConfig;
import com.sdm.common.entity.flowable.executeConfig.CloudAppExecuteConfig;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
@@ -8,9 +8,9 @@ import java.util.Map;
// 云应用处理器executeType=cloudApp
@Component("cloudApp")
public class CloudAppHandler implements ExecutionHandler {
public class CloudAppHandler implements ExecutionHandler<CloudAppExecuteConfig> {
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, CloudAppExecuteConfig config) {
// 实现云应用处理逻辑...
}
}

View File

@@ -1,6 +1,7 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.entity.flowable.executeConfig.BaseExecuteConfig;
import com.sdm.common.entity.flowable.executeConfig.DataProcessExecuteConfig;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
@@ -8,9 +9,9 @@ import java.util.Map;
// 数据处理执行器executeType=data_process
@Component("dataProcess")
public class DataProcessHandler implements ExecutionHandler {
public class DataProcessHandler implements ExecutionHandler<DataProcessExecuteConfig> {
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, DataProcessExecuteConfig config) {
// 实现数据处理逻辑...
}
}

View File

@@ -5,6 +5,6 @@ import org.flowable.engine.delegate.DelegateExecution;
import java.util.Map;
public interface ExecutionHandler {
void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config);
public interface ExecutionHandler<T extends BaseExecuteConfig> {
void execute(DelegateExecution execution, Map<String, Object> params, T config);
}

View File

@@ -1,5 +1,6 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.entity.flowable.executeConfig.ExportWordScriptExecuteConfig;
import com.sdm.common.entity.req.data.UploadFilesReq;
import com.sdm.common.feign.inter.data.IDataFeignClient;
import com.sdm.common.utils.RandomUtil;
@@ -24,7 +25,7 @@ import java.util.Map;
*/
@Slf4j
@Component("exportWordScript")
public class ExportWordScriptHandler implements ExecutionHandler {
public class ExportWordScriptHandler implements ExecutionHandler<ExportWordScriptExecuteConfig> {
@Autowired
private IDataFeignClient dataFeignClient;
@@ -36,7 +37,7 @@ public class ExportWordScriptHandler implements ExecutionHandler {
// 文件imageFileIdList: 用户选择指定图片文件id列表用于生成报告时插入到报告中
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, ExportWordScriptExecuteConfig config) {
List<Long> imageFileIdList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(imageFileIdList)) {
String randomId = RandomUtil.generateString(16);

View File

@@ -1,6 +1,7 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.flowable.executeConfig.HPCExecuteConfig;
import com.sdm.common.entity.req.pbs.SubmitHpcTaskRemoteReq;
import com.sdm.common.feign.inter.pbs.ITaskFeignClient;
import com.sdm.common.entity.flowable.executeConfig.BaseExecuteConfig;
@@ -20,7 +21,7 @@ import java.util.Map;
// HPC(executeType=HPC)
@Slf4j
@Component("HPC")
public class HpcHandler implements ExecutionHandler {
public class HpcHandler implements ExecutionHandler<HPCExecuteConfig> {
@Autowired
private IAsyncTaskRecordService asyncTaskRecordService;
@@ -29,7 +30,8 @@ public class HpcHandler implements ExecutionHandler {
private ITaskFeignClient taskFeignClient;
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, HPCExecuteConfig config) {
// 实现HPC处理逻辑...
// INIT(初始化)/RUNNING(执行中)/SUCCESS(执行成功)/FAIL(执行失败)
String status = "INIT";
@@ -88,4 +90,5 @@ public class HpcHandler implements ExecutionHandler {
return req;
}
}

View File

@@ -1,6 +1,7 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.entity.flowable.executeConfig.BaseExecuteConfig;
import com.sdm.common.entity.flowable.executeConfig.HttpExecuteConfig;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
@@ -8,10 +9,10 @@ import java.util.Map;
// HTTP请求执行器executeType=HTTP
@Component("http")
public class HttpHandler implements ExecutionHandler {
public class HttpHandler implements ExecutionHandler<HttpExecuteConfig> {
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, HttpExecuteConfig config) {
// 实现HTTP请求逻辑...
}
}

View File

@@ -1,6 +1,6 @@
package com.sdm.flowable.delegate.handler;
import com.sdm.common.entity.flowable.executeConfig.BaseExecuteConfig;
import com.sdm.common.entity.flowable.executeConfig.LocalAppExecuteConfig;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
@@ -8,9 +8,9 @@ import java.util.Map;
// 本地应用处理器executeType=localApp
@Component("localApp")
public class LocalAppHandler implements ExecutionHandler {
public class LocalAppHandler implements ExecutionHandler<LocalAppExecuteConfig> {
@Override
public void execute(DelegateExecution execution, Map<String, Object> params, BaseExecuteConfig config) {
public void execute(DelegateExecution execution, Map<String, Object> params, LocalAppExecuteConfig config) {
// 实现本地应用处理逻辑...
}
}