Ver Fonte

预警规则匹配逻辑

zhaoxian há 4 anos atrás
pai
commit
638fb6bc41

+ 8 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleGroup.java

@@ -52,6 +52,14 @@ public class RuleGroup {
     @Excel(name = "规则关系 当rule_type 为group时必填 and同时命中  or 命中一条", width = 15)
     @ApiModelProperty(value = "规则关系 当rule_type 为group时必填 and同时命中  or 命中一条")
     private String ruleRelationship;
+    /**
+     * 操作内容:SEND发送,PAUSE关停并发送
+     */
+    private String operate;
+    /**
+     * 预警发送方式: SMS:短信,WeChat:企业微信,EMAIL:电子邮件,TEL:电话
+     */
+    private String sendType;
 
     /**
      * 规则解释

+ 5 - 4
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleAccountThresholdMapper.java

@@ -1,17 +1,18 @@
 package cn.com.ctop.alarm.modules.mapper;
 
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
 import cn.com.ctop.alarm.modules.entity.RuleAccountThreshold;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 规则关联账户 阈值
+ *
  * @author: jeecg-boot
- * @date:   2020-11-15
+ * @date: 2020-11-15
  * @cersion: V1.0
  */
 public interface RuleAccountThresholdMapper extends BaseMapper<RuleAccountThreshold> {
 
+    List<RuleAccountThreshold> selectByAccountId(Long accountId);
 }

+ 4 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleAccountThresholdMapper.xml

@@ -2,4 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.alarm.modules.mapper.RuleAccountThresholdMapper">
 
+    <select id="selectByAccountId" resultType="cn.com.ctop.alarm.modules.entity.RuleAccountThreshold">
+       SELECT * FROM ctop_rule_account_threshold
+       WHERE account_id = #{accountId}
+    </select>
 </mapper>

+ 2 - 1
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.alarm.modules.service.impl;
 
 import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
+import cn.com.ctop.alarm.modules.entity.RuleAccountThreshold;
 import cn.com.ctop.alarm.modules.entity.RuleGroup;
 import cn.com.ctop.alarm.modules.entity.RuleTemplate;
 import cn.com.ctop.alarm.modules.mapper.RuleAccountTemplateMapper;
@@ -56,7 +57,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             for (JSONObject data : dataList) {
                 if (templates.getAccountId() == data.getLong("accountId")) {
                     List<RuleGroup> ruleGroups = ruleGroupMap.get(templates.getTemplateId());
-                    //TODO
+                    List<RuleAccountThreshold> list = ruleAccountThresholdMapper.selectByAccountId(templates.getAccountId());
 
                 }
             }