init: 导入RuoYi‑Vue‑Plus 6.X完整代码

This commit is contained in:
admin
2026-08-09 17:51:11 +08:00
commit 51cac459b3
914 changed files with 103833 additions and 0 deletions
@@ -0,0 +1,19 @@
package org.dromara.common.liteflow.component;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBooleanComponent;
/**
* LiteFlow 恒为 false 的条件节点。
*
* @author Lion Li
*/
@LiteflowComponent("alwaysFalse")
public class AlwaysFalseComponent extends NodeBooleanComponent {
@Override
public boolean processBoolean() {
return false;
}
}
@@ -0,0 +1,19 @@
package org.dromara.common.liteflow.component;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBooleanComponent;
/**
* LiteFlow 恒为 true 的条件节点。
*
* @author Lion Li
*/
@LiteflowComponent("alwaysTrue")
public class AlwaysTrueComponent extends NodeBooleanComponent {
@Override
public boolean processBoolean() {
return true;
}
}
@@ -0,0 +1,22 @@
package org.dromara.common.liteflow.component;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import org.dromara.common.core.exception.ServiceException;
/**
* LiteFlow 上下文必填校验节点。
*
* @author Lion Li
*/
@LiteflowComponent("contextRequired")
public class ContextRequiredComponent extends NodeComponent {
@Override
public void process() {
if (getFirstContextBean() == null) {
throw new ServiceException("LiteFlow 上下文不能为空");
}
}
}
@@ -0,0 +1,40 @@
package org.dromara.common.liteflow.component;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.liteflow.core.FailMessageProvider;
/**
* LiteFlow 失败节点,用于显式表达链路分支不可继续执行。
*
* @author Lion Li
*/
@LiteflowComponent("fail")
public class FailComponent extends NodeComponent {
private static final String DEFAULT_MESSAGE = "LiteFlow 链路执行失败";
@Override
public void process() {
throw new ServiceException(getFailMessage());
}
/**
* 优先从上下文读取业务失败提示,未提供时使用默认提示。
*
* @return 失败提示
*/
private String getFailMessage() {
Object context = getFirstContextBean();
if (context instanceof FailMessageProvider provider) {
String message = provider.getFailMessage();
if (StringUtils.isNotBlank(message)) {
return message;
}
}
return DEFAULT_MESSAGE;
}
}
@@ -0,0 +1,19 @@
package org.dromara.common.liteflow.component;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
/**
* LiteFlow 空节点,用于显式表达无需处理的分支。
*
* @author Lion Li
*/
@LiteflowComponent("noop")
public class NoopComponent extends NodeComponent {
@Override
public void process() {
// no-op
}
}
@@ -0,0 +1,67 @@
package org.dromara.common.liteflow.config;
import org.dromara.common.liteflow.component.*;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
/**
* LiteFlow 公共节点自动配置。
*
* @author Lion Li
*/
@AutoConfiguration
@ConditionalOnProperty(value = "liteflow.enable", havingValue = "true")
public class LiteFlowAutoConfiguration {
/**
* 空节点,用于显式表达无需处理的分支。
*
* @return 空节点
*/
@Bean("noop")
public NoopComponent noopComponent() {
return new NoopComponent();
}
/**
* 失败节点,用于显式抛出业务失败提示。
*
* @return 失败节点
*/
@Bean("fail")
public FailComponent failComponent() {
return new FailComponent();
}
/**
* 上下文必填校验节点。
*
* @return 上下文必填校验节点
*/
@Bean("contextRequired")
public ContextRequiredComponent contextRequiredComponent() {
return new ContextRequiredComponent();
}
/**
* 恒为 true 的条件节点。
*
* @return true 条件节点
*/
@Bean("alwaysTrue")
public AlwaysTrueComponent alwaysTrueComponent() {
return new AlwaysTrueComponent();
}
/**
* 恒为 false 的条件节点。
*
* @return false 条件节点
*/
@Bean("alwaysFalse")
public AlwaysFalseComponent alwaysFalseComponent() {
return new AlwaysFalseComponent();
}
}
@@ -0,0 +1,17 @@
package org.dromara.common.liteflow.core;
/**
* LiteFlow 失败提示提供者。
*
* @author Lion Li
*/
public interface FailMessageProvider {
/**
* 获取公共失败节点抛出的业务提示。
*
* @return 失败提示
*/
String getFailMessage();
}
@@ -0,0 +1,42 @@
package org.dromara.common.liteflow.utils;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.SpringUtils;
/**
* LiteFlow 执行工具。
*
* @author Lion Li
*/
@Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class LiteFlowUtils {
/**
* 执行 LiteFlow 链路,并按 contextBean 语义透传业务上下文和失败原因。
*
* @param chainId 链路标识
* @param context 链路上下文
*/
public static void execute(String chainId, Object context) {
if (context == null) {
throw new ServiceException("LiteFlow 上下文不能为空");
}
LiteflowResponse response = SpringUtils.getBean(FlowExecutor.class).execute2Resp(chainId, null, context);
if (!response.isSuccess()) {
Exception cause = response.getCause();
log.error("LiteFlow 链路执行失败 chainId={} requestId={} message={} steps={}",
chainId, response.getRequestId(), response.getMessage(), response.getExecuteStepStrWithTime(), cause);
if (cause instanceof RuntimeException runtimeException) {
throw runtimeException;
}
throw new ServiceException(cause != null ? cause.getMessage() : response.getMessage());
}
}
}
@@ -0,0 +1 @@
org.dromara.common.liteflow.config.LiteFlowAutoConfiguration