hotfix - 不再通过后端的 validTask 进行节点类型校验

This commit is contained in:
wangli 2024-06-27 18:40:16 +08:00
parent 75e1e313d3
commit b80137164b
3 changed files with 25 additions and 3 deletions

View File

@ -5,15 +5,20 @@ import cn.axzo.workflow.core.repository.entity.ExtAxApiLog;
import cn.axzo.workflow.core.service.ExtAxApiLogService;
import cn.hutool.json.JSONUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@ -45,6 +50,9 @@ public class ApiLogListener implements ApplicationListener<ApiLogEvent> {
if (!refreshProperties.getApiLogEnable() || EXCLUDE_URLS.contains(event.getApiUrl())) {
return;
}
if (!supportApiType(event)) {
return;
}
rebuildTraceId(event);
ExtAxApiLog apiLog = new ExtAxApiLog();
@ -65,4 +73,12 @@ public class ApiLogListener implements ApplicationListener<ApiLogEvent> {
event.setTraceId(traceId);
}
}
private boolean supportApiType(ApiLogEvent event) {
if (!StringUtils.hasText(refreshProperties.getFilterApiType())) {
return true;
}
List<String> list = Arrays.asList(refreshProperties.getFilterApiType().split(","));
return list.contains(event.getType());
}
}

View File

@ -1,10 +1,14 @@
package cn.axzo.workflow.core.conf;
import com.google.common.collect.Lists;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* 支持动态刷新配置属性
*
@ -19,6 +23,9 @@ public class SupportRefreshProperties {
@Value("${workflow.apiLog.enable: false}")
private Boolean apiLogEnable;
@Value("${workflow.mqLog.enable: true}")
@Value("${workflow.mqLog.enable: false}")
private Boolean mqLogEnable;
@Value("${workflow.apiLog.filterApiType:}")
private String filterApiType;
}

View File

@ -1,6 +1,7 @@
package cn.axzo.workflow.server.common.aspectj;
import cn.axzo.workflow.core.common.event.ApiLogEvent;
import cn.axzo.workflow.core.conf.SupportRefreshProperties;
import cn.axzo.workflow.server.common.annotation.EnvConfig;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.axzo.workflow.server.common.config.property.WorkflowProperties;
@ -41,8 +42,6 @@ public class ErrorReportAspect implements Ordered {
private String profile;
@Value("${workflow.sendDingTalk:true}")
private Boolean sendDingTalk;
@Value("${workflow.api.timeout:10}")
private Long apiTimeout;
@Resource
private ApplicationEventPublisher applicationEventPublisher;
@Resource