{"id":15728601,"url":"https://github.com/lexinda/veryrule","last_synced_at":"2025-10-05T21:32:24.490Z","repository":{"id":56349822,"uuid":"466902229","full_name":"lexinda/veryrule","owner":"lexinda","description":"具有简单、灵活、可复用、可编排、可配置特定场景等特性的规则引擎","archived":false,"fork":false,"pushed_at":"2023-08-24T03:27:32.000Z","size":410,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-03T06:18:33.765Z","etag":null,"topics":["java","rule","spring","spring-boot","veryrule","vue3"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lexinda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-07T01:24:06.000Z","updated_at":"2023-07-23T11:39:22.000Z","dependencies_parsed_at":"2024-10-03T23:05:01.289Z","dependency_job_id":"6d099d1d-85fb-46fc-81b9-7e0c0fa8fa12","html_url":"https://github.com/lexinda/veryrule","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexinda%2Fveryrule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexinda%2Fveryrule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexinda%2Fveryrule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexinda%2Fveryrule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lexinda","download_url":"https://codeload.github.com/lexinda/veryrule/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253924893,"owners_count":21985197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","rule","spring","spring-boot","veryrule","vue3"],"created_at":"2024-10-03T23:04:31.274Z","updated_at":"2025-10-05T21:32:24.423Z","avatar_url":"https://github.com/lexinda.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# veryrule ![image](https://portrait.gitee.com/uploads/avatars/user/40/122663_lexindasoft_1647328799.png!avatar30)\n## 特性\n- 可设置单个规则或配置规则包路径\n\n\n- 可单行代码调用\n\n\n- 可自定义监听器\n\n\n- 可测试规则是否触达\n\n\n- 可注解调用（结合spring开启切面）\n\n\n- 可自定义注解配置和取值\n\n- 可使用线程池处理带返回值的条件(异步)规则\n\n- 可使用内置规则流工具创建场景及规则流\n\n- 可使用内置规则流工具编辑条件规则执行顺序(无返回值规则、带返回值(同步)规则)\n\n## 规则管理工具(veryrule-platform)\n\n- 规则流管理：新增、编辑、删除、禁用、复制、\n\t\t\t查看规则模板、编辑规则模板、删除规则模板、\n\t\t\t测试、场景、接口文档\n\t\t\t\n- 规则场景：新增、编辑、删除。\t\t\n\t\t\t\n- 规则管理：新增、编辑、删除。\n\n\n\n\t\t\t\n\t\t\t\n- 规则工具：检测创建未使用的规则\n\n## 使用\n\n```\n\t//定义不带返回值条件\n\t@Rule(code = RuleCode.NOTNULL,name = \"指定key不可为空\", desc = \"指定key不可为空\", type = RuleType.CONDATION)\n\tpublic class NotNullRuleCondation implements IRuleCondation {\n\t\n\t\t@Override\n\t\tpublic \u003cR extends RuleBo\u003e void contation(Map\u003cString, Object\u003e param, R rule) throws Exception {\n\t\t\tString ruleKey = rule.getRuleKey();\n\t\t\tString[] keys = null;\n\t\t\tif(ruleKey.indexOf(\",\")\u003e0) {\n\t\t\t\tkeys = ruleKey.split(\",\");\n\t\t\t}else {\n\t\t\t\tkeys = new String[] {ruleKey};\n\t\t\t}\n\t\t\tfor(String key :keys) {\n\t\t\t\tObject data = param.get(key);\n\t\t\t\tif(data==null) {\n\t\t\t\t\tthrow new Exception(key+rule.getRuleErrMsg());\n\t\t\t\t}else {\n\t\t\t\t\tif(\"\".equals(data.toString().trim())) {\n\t\t\t\t\t\tthrow new Exception(key+rule.getRuleErrMsg());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t//可覆盖，自定义\n\t\t//@Override\n\t\t//public \u003cR extends RuleBo\u003e Map\u003cString, Object\u003e ruleTest(R rule) {\n\t\t//\tMap\u003cString,Object\u003e result = new HashMap\u003cString,Object\u003e();\n\t\t//\tRule ruleAnnotation = this.getClass().getAnnotation(Rule.class);\n\t\t//\tif(rule!=null\u0026\u0026rule.getRuleCode().equals(ruleAnnotation.code())) {\n\t\t//\t\tresult.put(rule.getRuleCode(), ruleAnnotation.name());\n\t\t//\t}\n\t\t//\treturn result;\n\t\t//}\n\t\n\t}\n\t//初始化\n\t//可指定规则类\n\tVeryRule veryRule = VeryRule.builder().condation(NotNullRuleAction.class).resultCondation(...).action(...).listener(...);\n\t//可指定规则包路径\n\tVeryRule veryRule = VeryRule.builder().rulePackage(\"com.lexinda.veryrule.base\").listener(TestRuleListener.class)\n\t//单独使用\n\tMap\u003cString, Object\u003e param = new HashMap\u003c\u003e();\n\tparam.put(\"a\", \"123a\");\n\tRuleBo nn = new RuleBo(\"notNull\", \"a,c\", \"\", \"不可为空\",RuleType.CONDATION);\n\tveryRule.fire(param, nn);\n\t\n\t//匹配spring\n\t\u003cbean class=\"com.lexinda.veryrule.spring.VeryRuleScanConfigurer\"\u003e\n\t\t\u003cproperty name=\"rulePackage\"\n\t\t\tvalue=\"com.lexinda.veryrule.base\" /\u003e\n\t\t\u003cproperty name=\"loadDefaultRule\"\n\t\t\tvalue=\"true\" /\u003e\n\t\t\u003cproperty name=\"useAspect\"\n           \tvalue=\"true\" /\u003e\n\t\t\u003cproperty name=\"aspectBean\"\n           \tvalue=\"com.lexinda.veryrule.aspect.VeryRuleAspect\" /\u003e\n           \u003cproperty name=\"listenerBean\"\n           \tvalue=\"com.lexinda.veryrule.platform.listener.VeryRuleListener\" /\u003e\n\t\t\t\n\t\u003c/bean\u003e\n\t//匹配spring-boot\n\t//veryrule包路径\n\tveryrule.rulePackage=com.lexinda.veryrule.base\n\t//读取集成规则\n\tveryrule.loadDefaultRule=true\n\t//开启注解\n\tveryrule.useAspect=true\n\t//自定义切面(取值，校验...)\n\tveryrule.aspectBean=com.lexinda.veryrule.aspect.VeryRuleAspect\n\t//自定义监听器\n\tveryrule.listenerBean=com.lexinda.veryrule.platform.listener.VeryRuleListener\n\t\n\t//springAOP-单个规则，规则类型缺省为不带返回值的条件\n\t@VeryRuleSingle(ruleCode = RuleCode.NOTNULL, ruleKey = \"currentPage,ruleType\", ruleErrMsg = \"不能为空\")\n\t//springAOP-编排规则流\n\t@VeryRuleFlow(ruleFlowCode = \"test\")\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexinda%2Fveryrule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexinda%2Fveryrule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexinda%2Fveryrule/lists"}