feat(REQ-4418) - 处理必接事件告警

This commit is contained in:
wangli 2025-09-02 16:51:13 +08:00
parent 7fc56bf24a
commit 7250b02b26
2 changed files with 10 additions and 5 deletions

View File

@ -158,8 +158,9 @@ public class WorkflowEngineStarterAutoConfiguration {
}
@Bean
public ImplementationReadyChecker implementationReadyChecker(WorkflowCoreService workflowCoreService) {
return new ImplementationReadyChecker(workflowCoreService);
public ImplementationReadyChecker implementationReadyChecker(WorkflowCoreService workflowCoreService,
Environment environment) {
return new ImplementationReadyChecker(workflowCoreService, environment);
}
// @Bean

View File

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -34,9 +35,12 @@ public class ImplementationReadyChecker implements ApplicationListener<Applicati
);
private final WorkflowCoreService workflowCoreService;
private final Environment environment;
public ImplementationReadyChecker(WorkflowCoreService workflowCoreService) {
public ImplementationReadyChecker(WorkflowCoreService workflowCoreService,
Environment environment) {
this.workflowCoreService = workflowCoreService;
this.environment = environment;
}
@ -95,8 +99,8 @@ public class ImplementationReadyChecker implements ApplicationListener<Applicati
if (!unimplementedMethods.isEmpty()) {
log.error("以下方法未被任何实现类覆盖: {}。请确保至少有一个实现类覆盖这些方法以处理相应的事件。", String.join(", ", unimplementedMethods));
DingTalkStarterAlterDTO dto = new DingTalkStarterAlterDTO();
dto.setApplicationName(System.getProperty("spring.application.name"));
dto.setProfile(System.getProperty("spring.profiles.active"));
dto.setApplicationName(environment.getProperty("spring.application.name"));
dto.setProfile(environment.getProperty("spring.profiles.active"));
dto.setAlterContent("必接事件实现类检查未通过,未实现的方法: " + String.join(", ", unimplementedMethods) + "。请确保至少有一个实现类覆盖这些方法以处理相应的事件。");
workflowCoreService.sendDingtalk(dto);
} else {