当前位置: 首页 > news >正文

自制小程序3天网站seo优化成为超级品牌

自制小程序,3天网站seo优化成为超级品牌,保定疫情最新情况,房山营销型网站制作开发一、系统介绍 规则引擎是一个用于执行营销规则的模块,其包括营销规则配置、规则校验等功能。规则引擎可以根据预先设定的条件和逻辑,自动化地执行特点的营销策略,帮助企业更好地吸引客户,增加销售和提高客户满意度。 规则引擎功能…

一、系统介绍

        规则引擎是一个用于执行营销规则的模块,其包括营销规则配置、规则校验等功能。规则引擎可以根据预先设定的条件和逻辑,自动化地执行特点的营销策略,帮助企业更好地吸引客户,增加销售和提高客户满意度。

        规则引擎功能列表:

              1、规则装配 - 根据活动类型组装不同营销规则

              2、逻辑设计 - 支持与、或、非等复杂逻辑关系。

              3、配置校验 - 支持对活动规则进行自动化校验。

二、技术实现

1.UserCenterRegistryActivityRule - 个人中心注册活动规则

class UserCenterRegistryActivityRule extends ActivityRule{public UserCenterRegistryActivityRule(){super("region_rule&channel_rule&(user_group_rule|user_tag_rule)");}public String rootRulePath(){return "usercenter_registry_activity";}
}

2.ActivityRule - 活动规则抽象

public abstract class ActivityRule implements RuleItem{/*** 规则表达式*/private String ruleExpression;/*** 规则项配置校验*/@Autowiredprivate Map<String, RuleItem> ruleItemMap;public ActivityRule(String ruleExpression){this.ruleExpression = ruleExpression;}/*** 规则项校验*/public boolean apply(CalculateRequest request, PeContext peContext) {Stack<Character> opStack = new Stack<>();Stack<Boolean> resStack = new Stack<>();Set<Character> opChSet = Set.of('(', ')', '&', '|');int i = 0;// 处理右括号while (i < ruleExpression.length()) {char ch = ruleExpression.charAt(i);switch (ch) {case '(':opStack.push(ch);i++;break;case ')': while (opStack.peek() != '(') {Character opChar = opStack.peek();if (opChar == '&') {boolean right = resStack.pop();boolean left = resStack.pop();resStack.push(left && right);} else if (opChar == '|') {boolean right = resStack.pop();boolean left = resStack.pop();resStack.push(left || right);}opStack.pop();}break;case '&': // 操作符opStack.push('&');i++;break;case '|':opStack.push('|');i++;break;default: // 操作数int j = i;while (j < ruleExpression.length() && !opChSet.contains(ruleExpression.charAt(j))) {j++;}String rule = ruleExpression.substring(i, j);resStack.push(ruleItemMap.get(rule).apply(request, peContext));i = j;}}// 处理结果while (!opStack.isEmpty()) {Character opChar = opStack.peek();if (opChar == '&') {boolean right = resStack.pop();boolean left = resStack.pop();resStack.push(left && right);} else if (opChar == '|') {boolean right = resStack.pop();boolean left = resStack.pop();resStack.push(left || right);}opStack.pop();}return resStack.pop();}default String rootRulePath();/*** 规则配置校验*/public PathError validate(String rulePath) {if (rulePath == null){rulePath = rootRulePath();}PathError pathError = PathError.of(null, rulePath);for (Map.Entry<String, RuleItem> entry : ruleItemMap.entrySet()) {String ruleItemPath = entry.getKey();RuleItem ruleItem = entry.getValue();PathError ruleItemError = ruleItem.validate(ruleItemPath);if (ruleItemError != null) {return pathError.with(ruleItemError);}}return null;}
}

3.UserGroupRuleItem - 用户组规则项

class UserGroupRuleItem extends RuleItem{private List<String> groupsLimit;@Overridepublic PathError validate(String rulePath){PathError pathError = PathError.of(null, rulePath);if (groupsLimit == null || groupsLimit.size() == 0){return pathError.withPath("groupsLimit").withError("groupsLimit不能为空");}return null;}@Overriderpublic boolean apply(CalculateRequest req, PeContext context){UserService userService = SpringUtil.getBean(UserService.class);// 判断用户是否符合用户组规则List<String> userGroups = userService.getUserGroups(req.getUserId());if (groupsLimit.stream().anyMatch(userGroups::contains)){return true;}retrun false;}
}

4.RuleItem - 规则项定义

interface RuleItem {// 规则配置校验default PathError validate(String rulePath) {PathError pathError = new PathError(null, rulePath);// 校验规则字段Field[] fields = FieldUtils.getSpecFields(getClass(), RuleItem.class);if (fields.length == 0) {return null;}try {for (Field ruleField : fields) {RuleItem rule = (Rule) FieldUtils.getField(this, ruleField);if (rule == null){continue;}String fieldName = ruleField.getName();// 规则字段校验失败PathError fieldPathError = rule.validate(fieldName);// 返回字段校验失败结果if (fieldPathError != null) {return pathError.with(fieldPathError);}}} catch (Exception e) {throw new AppException(ErrorCode.SYSTEM_ERROR, String.format("校验Rule错误: %s", e.getMessage()));}return null;}// 规则应用default boolean apply(CalculateRequest request, PeContext peContext){return true;};@Data@NoArgsConstructor@AllArgsConstructorpublic static class PathError{private String error;private List<String> paths;public PathError with(PathError other){this.error = other.error;this.paths.addAll(other.paths);return this;}public PathError withError(String error){this.error = error;return this;}public PathError withPath(String path){this.paths.add(path);return this;}}
}

http://www.hengruixuexiao.com/news/28042.html

相关文章:

  • 如何向百度提交网站石家庄网站建设方案
  • php网站开发开发实例教程大数据查询个人信息
  • 政府网站建设经验典型材料杭州seo外包
  • 深圳电商网站设计公司网络推广应该怎么做啊
  • 网络科技公司起名免费湖南网站seo找行者seo
  • 如何做外贸营销型网站抖音权重查询工具
  • 盗图来做网站杭州seo网站推广排名
  • 宿州网站建设时间2023知名品牌营销案例100例
  • 免备案网站制作短视频推广渠道有哪些
  • 长沙哪家公司做网站好网络营销策划师
  • 中国设计网站排名百度排行榜风云
  • 遨游建设网站自己的网站怎么建立
  • 合肥企业建站系统关键词林俊杰mp3免费下载
  • 深圳最好的网站开发公司2345网址导航主页
  • 建筑行业数据共享平台网站推广渠道
  • 和平网站建设今日深圳新闻最新消息
  • 虚拟资源交易平台Wordpress源码石家庄高级seo经理
  • 做网站同行怎样推广公司的网站
  • 网站建设 网络推广希爱力双效片副作用
  • 品牌的网站建设手机建立一个免费网站
  • 做网站设计的价格seo快速排名软件网址
  • 如何管理好一个网站如何查询关键词的搜索量
  • 网站建设 图片压缩品牌宣传策略
  • 做网单哪个网站最好用网站维护费用
  • 地方同城网站开发百度点击软件
  • 微信公众号入口seo网站关键词优化费用
  • wordpress百度站长主动推送seo职位要求
  • 医院网站怎么做优化排名靠前seo网站建设
  • 旅游网站制作过程网站排名查询alexa
  • 中国医院建设协会网站首页广州网站开发多少钱