👉 这是一个或许对你有用的社群
🐱 一对一交流/面试小册/简历优化/求职解惑,欢迎加入「芋道快速开发平台」知识星球。下面是星球提供的部分资料:
《项目实战(视频)》:从书中学,往事中“练”
《互联网高频面试题》:面朝简历学习,春暖花开
《架构 x 系统设计》:摧枯拉朽,掌控面试高频场景题
《精进 Java 学习指南》:系统学习,互联网主流技术栈
《必读 Java 源码专栏》:知其然,知其所以然
👉这是一个或许对你有用的开源项目
国产 Star 破 10w+ 的开源项目,前端包括管理后台 + 微信小程序,后端支持单体和微服务架构。
功能涵盖 RBAC 权限、SaaS 多租户、数据权限、商城、支付、工作流、大屏报表、微信公众号等等功能:
Boot 仓库:https://gitee.com/zhijiantianya/ruoyi-vue-pro
Cloud 仓库:https://gitee.com/zhijiantianya/yudao-cloud
视频教程:https://doc.iocoder.cn
【国内首批】支持 JDK 21 + SpringBoot 3.2.2、JDK 8 + Spring Boot 2.7.18 双版本
来源:gitee.com/aizuda/
rule-engine-front-open
简介
规则引擎开源版,RuleEngine 基于web可视化配置,简单高效快捷。业务逻辑实现不再依赖于代码开发,可零代码实现复杂业务逻辑!
基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 用户小程序,支持 RBAC 动态权限、多租户、数据权限、工作流、三方登录、支付、短信、商城等功能
项目地址:https://github.com/YunaiV/ruoyi-vue-pro
视频教程:https://doc.iocoder.cn/video/
技术栈/版本介绍:
SpringBoot 2.2.11
RabbitMQ
Redis、Redisson
MySQL 5.7.9
Mybatis-plus
Maven 3.3
Swagger
基于 Spring Cloud Alibaba + Gateway + Nacos + RocketMQ + Vue & Element 实现的后台管理系统 + 用户小程序,支持 RBAC 动态权限、多租户、数据权限、工作流、三方登录、支付、短信、商城等功能
项目地址:https://github.com/YunaiV/yudao-cloud
视频教程:https://doc.iocoder.cn/video/
用法
通过在 http://ruleengine.cn 配置规则,配置完成后我们就可以调用接口来执行引擎中的规则了
POST http://ruleserver.cn/ruleEngine/generalRule/execute
Content-Type: application/json
{
"code": "phoneRuletest",
"workspaceCode": "default",
"accessKeyId": "略",
"accessKeySecret": "略",
"param": {
"phone": "13400000000"
}
}
现在我们让此使用方式更加简单易用!调用规则方项目pom.xml文件引入以下依赖
<dependency>
<groupId>cn.ruleengine</groupId>
<artifactId>rule-engine-client</artifactId>
<version>2.0</version>
</dependency>
SpringBoot项目application.yml配置文件配置如下:
rule.engine:
baseUrl: http://ruleserver.cn
workspaceCode: default
accessKeyId: root
accessKeySecret: 123456
# 可选配置
feignConfig:
request:
connectTimeoutMillis: 3000
readTimeoutMillis: 3500
retryer:
period: 2000
maxPeriod: 2000
maxAttempts: 3
然后编写如下代码进行测试:
@EnableRuleEngine
@RunWith(SpringRunner.class)
@SpringBootTest
public class RuleTest {
@Resource
private RuleEngineClient ruleEngineClient;
@Test
public void test() {
// 构建规则请求参数
PhoneTestRule phoneTestRule = new PhoneTestRule();
phoneTestRule.setPhone("134000000000");
// 调用执行引擎中的规则
GeneralRule generalRule = this.ruleEngineClient.generalRule();
Output output = generalRule.execute(phoneTestRule);
System.out.println(output);
}
}
@Data
@Model(code = "phoneRuletest")
public class PhoneTestRule {
/**
* 可选,默认code为属性name
*/
@InputParameter(code = "phone")
private String phone;
}
我们默认使用Feign请求,当然你也可以自定义,只需要在项目中配置如下代码:
@Component
@Import({RestTemplate.class})
public class RuleEngineClientConfig {
@Resource
private RestTemplate restTemplate;
@Bean
public GeneralRuleInterface generalRuleInterface() {
return new GeneralRuleInterface() {
@Override
public ExecuteResult execute(ExecuteParam executeParam) {
return restTemplate.postForObject("http://ruleserver.cn/ruleEngine/generalRule/execute", executeParam, ExecuteResult.class);
}
@Override
public IsExistsResult isExists(IsExistsParam existsParam) {
// TODO: 2020/12/30
return null;
}
@Override
public BatchExecuteResult batchExecute(BatchParam batchParam) {
// TODO: 2020/12/30
return null;
}
};
}
}
界面截图
开源地址
https://gitee.com/aizuda/rule-engine-front-open
欢迎加入我的知识星球,全面提升技术能力。
👉 加入方式,“长按”或“扫描”下方二维码噢:
星球的内容包括:项目实战、面试招聘、源码解析、学习路线。
文章有帮助的话,在看,转发吧。
谢谢支持哟 (*^__^*)