fix(bpm):优化PortalRequest可用性检查逻辑- 将null判断改为available()方法调用,确保sysCode、domain和protocol均非空- 在PortalRequest类中新增available()方法,用于检查实例是否可用
- 统一代码风格,优化条件判断和字符串判空逻辑 - 调整方法参数格式,增强代码可读性 - 修复潜在的空指针异常问题,提高系统稳定性
This commit is contained in:
@@ -89,7 +89,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
||||
protected void processCancelled(FlowableCancelledEvent event) {
|
||||
// 流程取消事件,这里对应调用流程删除接口
|
||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||
if (Objects.isNull(portalRequest)) {
|
||||
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||
return;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
||||
protected void processCompleted(FlowableEngineEntityEvent event) {
|
||||
// 流程完成事件,对应流程办结
|
||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||
if (portalRequest == null) {
|
||||
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||
return;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
||||
protected void taskAssigned(FlowableEngineEntityEvent event) {
|
||||
// 任务分配事件,对应待办
|
||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||
if (portalRequest == null) {
|
||||
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||
return;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
||||
protected void taskCompleted(FlowableEngineEntityEvent event) {
|
||||
// 任务完成事件,这里处理任务已办
|
||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||
if (portalRequest == null) {
|
||||
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jeelowcode.service.bpm.config.framework.portal.core;
|
||||
|
||||
import cn.hutool.http.Header;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
|
||||
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.*;
|
||||
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -159,4 +160,13 @@ public class PortalRequest {
|
||||
return JsonUtils.parseObject(httpRequest.execute().body(), PortalTodoResponseDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前PortalRequest实例是否可用
|
||||
*
|
||||
* @return 当sysCode、domain和protocol都不为空时返回true,否则返回false
|
||||
*/
|
||||
public boolean available() {
|
||||
return !StringUtils.isBlank(sysCode) && !StringUtils.isBlank(domain) && !StringUtils.isBlank(protocol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class BpmProcessInstanceCopyServiceImpl implements IBpmProcessInstanceCop
|
||||
// 3.推送给待办系统
|
||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||
// 3.1 如果没有配置待办平台,则结束这个监听任务的执行
|
||||
if (ObjectUtil.isNull(portalRequest)) return;
|
||||
if (!Objects.requireNonNull(portalRequest).available()) return;
|
||||
// 3.2 调用待办系统,发送待办消息
|
||||
try {
|
||||
copyList.stream().map(copy -> {
|
||||
|
||||
Reference in New Issue
Block a user