Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

syh 4 lat temu
rodzic
commit
651feb7d03
16 zmienionych plików z 279 dodań i 85 usunięć
  1. 40 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java
  2. 12 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java
  3. 74 36
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java
  4. 19 2
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java
  5. 4 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleIndicator.java
  6. 4 1
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleAccountTemplateServiceImpl.java
  7. 98 27
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java
  8. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTarget.java
  9. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  10. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  11. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  12. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  13. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  14. 2 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java
  15. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java
  16. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/RuleByteDanceAccountServiceImpl.java

+ 40 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.wps.controller;
 package org.jeecg.modules.wps.controller;
 
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -59,7 +60,7 @@ public class WpsFileController {
 		}
 		}
 	}
 	}
 	/**
 	/**
-	  * 分页列表查询
+	 * 分页列表查询
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @param pageNo
 	 * @param pageNo
 	 * @param pageSize
 	 * @param pageSize
@@ -77,9 +78,16 @@ public class WpsFileController {
 		wpsFile.setName(null);
 		wpsFile.setName(null);
 		Result<IPage<WpsFile>> result = new Result<>();
 		Result<IPage<WpsFile>> result = new Result<>();
 		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
 		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
-		if(null!=name&&!"".equals(name.trim())){
+		if(null!=name&&!name.trim().equals("")){
 			queryWrapper.like("name",name);
 			queryWrapper.like("name",name);
 		}
 		}
+		//只查询题库的文件
+		queryWrapper.eq("is_script",0);
+		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+		if(null==roleCode||!roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
+			queryWrapper.eq("creator",sysUser.getId());
+		}
 		Page<WpsFile> page = new Page<>(pageNo, pageSize);
 		Page<WpsFile> page = new Page<>(pageNo, pageSize);
 		IPage<WpsFile> pageList = wpsFileService.page(page, queryWrapper);
 		IPage<WpsFile> pageList = wpsFileService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setSuccess(true);
@@ -88,7 +96,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *   添加
+	 *   添加
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @return
 	 * @return
 	 */
 	 */
@@ -108,7 +116,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *  编辑
+	 *  编辑
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @return
 	 * @return
 	 */
 	 */
@@ -131,7 +139,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *   通过id删除
+	 *   通过id删除
 	 * @param id
 	 * @param id
 	 * @return
 	 * @return
 	 */
 	 */
@@ -149,7 +157,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *  批量删除
+	 *  批量删除
 	 * @param ids
 	 * @param ids
 	 * @return
 	 * @return
 	 */
 	 */
@@ -168,7 +176,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  * 通过id查询
+	 * 通过id查询
 	 * @param id
 	 * @param id
 	 * @return
 	 * @return
 	 */
 	 */
@@ -196,4 +204,29 @@ public class WpsFileController {
 		String newUrl = wpsFileService.createTemplateFile(template);
 		String newUrl = wpsFileService.createTemplateFile(template);
 		return Response.success(newUrl);
 		return Response.success(newUrl);
 	}
 	}
+
+	/**
+	 *  查询题库文件
+	 */
+	@GetMapping(value = "/queryQuestionBank")
+	public Result<IPage<WpsFile>> queryQuestionBank(WpsFile wpsFile,
+													@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													HttpServletRequest req) {
+		String name = wpsFile.getName();
+		wpsFile.setName(null);
+		Result<IPage<WpsFile>> result = new Result<>();
+		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
+		if(null!=name&&!"".equals(name.trim())){
+			queryWrapper.like("name",name);
+		}
+		//只查询题库的文件
+		queryWrapper.eq("is_script",1);
+		Page<WpsFile> page = new Page<>(pageNo, pageSize);
+		IPage<WpsFile> pageList = wpsFileService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
 }
 }

+ 12 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java

@@ -26,38 +26,38 @@ public class WpsFile {
 
 
 	/**id*/
 	/**id*/
 	@TableId(type = IdType.UUID)
 	@TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
+	@ApiModelProperty(value = "id")
 	private String id;
 	private String id;
 	/**name*/
 	/**name*/
 	@Excel(name = "name", width = 15)
 	@Excel(name = "name", width = 15)
-    @ApiModelProperty(value = "name")
+	@ApiModelProperty(value = "name")
 	private String name;
 	private String name;
 	/**version*/
 	/**version*/
 	@Excel(name = "version", width = 15)
 	@Excel(name = "version", width = 15)
-    @ApiModelProperty(value = "version")
+	@ApiModelProperty(value = "version")
 	private Integer version;
 	private Integer version;
 	/**size*/
 	/**size*/
 	@Excel(name = "size", width = 15)
 	@Excel(name = "size", width = 15)
-    @ApiModelProperty(value = "size")
+	@ApiModelProperty(value = "size")
 	private Integer size;
 	private Integer size;
 	/**creator*/
 	/**creator*/
 	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
-    private String creator;
+	private String creator;
 	/**createTime*/
 	/**createTime*/
 	@Excel(name = "createTime", width = 15)
 	@Excel(name = "createTime", width = 15)
-    @ApiModelProperty(value = "createTime")
+	@ApiModelProperty(value = "createTime")
 	private Long createTime;
 	private Long createTime;
 	/**modifier*/
 	/**modifier*/
 	@Excel(name = "modifier", width = 15)
 	@Excel(name = "modifier", width = 15)
-    @ApiModelProperty(value = "modifier")
+	@ApiModelProperty(value = "modifier")
 	private String modifier;
 	private String modifier;
 	/**modifyTime*/
 	/**modifyTime*/
 	@Excel(name = "modifyTime", width = 15)
 	@Excel(name = "modifyTime", width = 15)
-    @ApiModelProperty(value = "modifyTime")
+	@ApiModelProperty(value = "modifyTime")
 	private Long modifyTime;
 	private Long modifyTime;
 	/**downloadUrl*/
 	/**downloadUrl*/
 	@Excel(name = "downloadUrl", width = 15)
 	@Excel(name = "downloadUrl", width = 15)
-    @ApiModelProperty(value = "downloadUrl")
+	@ApiModelProperty(value = "downloadUrl")
 	private String downloadUrl;
 	private String downloadUrl;
 	/**deleted*/
 	/**deleted*/
 	private String deleted;
 	private String deleted;
@@ -68,10 +68,12 @@ public class WpsFile {
 
 
 	private String code;
 	private String code;
 
 
+	private Integer isScript;
+
 	public WpsFile(){super();}
 	public WpsFile(){super();}
 
 
 	public WpsFile(String name, int version, int size, String creator,
 	public WpsFile(String name, int version, int size, String creator,
-					  String modifier, long create_time, long modify_time, String download_url) {
+				   String modifier, long create_time, long modify_time, String download_url) {
 		this.name = name;
 		this.name = name;
 		this.version = version;
 		this.version = version;
 		this.size = size;
 		this.size = size;

+ 74 - 36
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -4,6 +4,7 @@ import cn.com.ctop.alarm.modules.entity.RuleGroup;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.enums.NoEn;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
@@ -29,14 +30,17 @@ public class MatchLogic {
      * @throws
      * @throws
      * @author ZHAOXA
      * @author ZHAOXA
      */
      */
-    public static boolean matchCondition(String type, String condition, String threshold, String value, JSONObject obj) {
+    public static boolean matchCondition(JSONObject indicator, String condition, String threshold, String value, JSONObject obj) {
+        //阈值数据类型类型
+        String type = indicator.getString("dataType");
         try {
         try {
-            if (Check.isNull(threshold)) {
+            if (Check.isNull(threshold) || "[]".equals(threshold)) {
                 return false;
                 return false;
             }
             }
-            if (Check.isNull(value)) {
-                obj.put("isNull", true);
-                return true;
+            if (Check.isNull(value) || "[]".equals(value)) {
+                //洗出的数据为空的时候不报警,若想报警则改成true
+                obj.put("isNull", false);
+                return false;
             }
             }
             obj.put("isNull", false);
             obj.put("isNull", false);
             if ("number".equals(type)) {
             if ("number".equals(type)) {
@@ -56,52 +60,90 @@ public class MatchLogic {
                     case "less_equal":
                     case "less_equal":
                         return bigVal.compareTo(bigThr) <= 0;
                         return bigVal.compareTo(bigThr) <= 0;
                     default:
                     default:
-                        log.warn("关系不匹配");
+                        log.warn("关系不匹配 type={},condition={},threshold={},value={},", type, condition, threshold, value);
                         break;
                         break;
                 }
                 }
             } else if ("string".equals(type)) {
             } else if ("string".equals(type)) {
-                switch (condition) {
-                    case "equal":
-                        return value.equals(threshold);
-                    case "not_equal":
-                        return !value.equals(threshold);
-                    case "contain":
-                        return !value.contains(threshold);
-                    case "no_contain":
-                        return !value.contains(threshold);
-                    default:
-                        log.warn("关系不匹配");
-                        break;
+                if (threshold.contains("[")) {
+                    boolean flag = false;
+                    List<String> thresholds = strToList(threshold);
+                    if ("equal".equals(condition)) {
+                        return value.equals(thresholds.get(0));
+                    } else if ("not_equal".equals(condition)) {
+                        return !value.equals(thresholds.get(0));
+                    }
+                    for (String thro : thresholds) {
+                        if ("contain".equals(condition)) {
+                            if (value.contains(thro)) {
+                                return true;
+                            }
+                        } else if ("no_contain".equals(condition)) {
+                            if (!value.contains(thro)) {
+                                return true;
+                            }
+                        }
+                    }
+                    return flag;
+                } else {
+                    switch (condition) {
+                        case "equal":
+                            return value.equals(threshold);
+                        case "not_equal":
+                            return !value.equals(threshold);
+                        case "contain":
+                            return value.contains(threshold);
+                        case "no_contain":
+                            return !value.contains(threshold);
+                        default:
+                            log.warn("关系不匹配 type={},condition={},threshold={},value={},", type, condition, threshold, value);
+                            break;
+                    }
                 }
                 }
             } else {
             } else {
-                if (value.contains("[") && threshold.contains("[")) {
-                    List<String> values = strToList(value);
-                    if ("contain".equals(condition)) {
+                String logicalType = indicator.getString("logicalType");
+                if (NoEn.NO1.valueStr().equals(logicalType)) {
+                    if (value.contains("[") && threshold.contains("[")) {
+                        List<String> values = strToList(value);
+                        List<String> thresholds = strToList(threshold);
+                        if (values.size() != thresholds.size()) {
+                            return true;
+                        }
                         for (String v : values) {
                         for (String v : values) {
                             if (!threshold.contains(v)) {
                             if (!threshold.contains(v)) {
                                 return true;
                                 return true;
                             }
                             }
                         }
                         }
                     } else {
                     } else {
-                        for (String v : values) {
-                            if (threshold.contains(v)) {
-                                return true;
-                            }
+                        if ("contain".equals(condition)) {
+                            return threshold.contains(value);
+                        } else {
+                            return !threshold.contains(value);
                         }
                         }
                     }
                     }
                 } else {
                 } else {
-                    List<String> thresholdArr = strToList(threshold);
-                    if ("contain".equals(condition)) {
-                        for (String t : thresholdArr) {
-                            if (t.contains(value)) {
-                                return true;
+                    if (value.contains("[") && threshold.contains("[")) {
+                        List<String> values = strToList(value);
+                        if ("contain".equals(condition)) {
+                            for (String v : values) {
+                                if (!threshold.contains(v)) {
+                                    return true;
+                                }
+                            }
+                        } else {
+                            for (String v : values) {
+                                if (threshold.contains(v)) {
+                                    return true;
+                                }
                             }
                             }
                         }
                         }
                     } else {
                     } else {
-                        return !threshold.contains(value);
+                        if ("contain".equals(condition)) {
+                            return threshold.contains(value);
+                        } else {
+                            return !threshold.contains(value);
+                        }
                     }
                     }
                 }
                 }
-
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("条件匹配异常,入参为:type={},condition={},threshold={},value={},", type, condition, threshold, value, e);
             log.error("条件匹配异常,入参为:type={},condition={},threshold={},value={},", type, condition, threshold, value, e);
@@ -233,9 +275,5 @@ public class MatchLogic {
             }
             }
         }
         }
         return sendData;
         return sendData;
-
-
     }
     }
-
-
 }
 }

+ 19 - 2
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java

@@ -2,6 +2,7 @@ package cn.com.ctop.alarm.modules.controller;
 
 
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,14 +29,14 @@ public class RuleSwitchController {
         UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
         UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
         //开启预警
         //开启预警
         if(switchType.equals("on")){
         if(switchType.equals("on")){
-            wrapper.set("landing_page",0);
+            wrapper.set("monitoring_link",0);
             wrapper.setEntity(userAllocation);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
             boolean update = userAllocationService.update(wrapper);
             if(update){
             if(update){
                 result.success("监测链接预警开启成功");
                 result.success("监测链接预警开启成功");
             }
             }
         }else if(switchType.equals("off")){
         }else if(switchType.equals("off")){
-            wrapper.set("landing_page",1);
+            wrapper.set("monitoring_link",1);
             wrapper.setEntity(userAllocation);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
             boolean update = userAllocationService.update(wrapper);
             if(update){
             if(update){
@@ -76,4 +77,20 @@ public class RuleSwitchController {
         }
         }
         return result;
         return result;
     }
     }
+
+    /**
+     *  开关预警配置回显
+     */
+    @PostMapping(value = "/echoSwitchStatus")
+    public Result<JSONObject> echoSwitchStatus(Long accountId){
+        Result<JSONObject> result =new Result<>();
+        JSONObject switchStatus= userAllocationService.getSwitchStatusByAccount(accountId);
+        if(switchStatus.isEmpty()){
+            result.error500("未找到该账户");
+        }else {
+            result.setResult(switchStatus);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 }
 }

+ 4 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleIndicator.java

@@ -80,6 +80,10 @@ public class RuleIndicator {
      */
      */
     @Excel(name = "对应数据表名称", width = 15)
     @Excel(name = "对应数据表名称", width = 15)
     @ApiModelProperty(value = "对应数据表名称")
     @ApiModelProperty(value = "对应数据表名称")
+    /**
+     * 逻辑类型,针对流量排除包、排除人群包标识
+     */
+    private Integer logicalType;
     private String tableName;
     private String tableName;
     private Integer status;
     private Integer status;
     private Integer sort;
     private Integer sort;

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

@@ -37,7 +37,7 @@ public class RuleAccountTemplateServiceImpl extends ServiceImpl<RuleAccountTempl
     private IRuleAccountThresholdService ruleAccountThresholdService;
     private IRuleAccountThresholdService ruleAccountThresholdService;
 
 
     /**
     /**
-     * 推送模板到账
+     * 推送模板到账
      *
      *
      * @param accountId
      * @param accountId
      * @param templateId
      * @param templateId
@@ -95,6 +95,9 @@ public class RuleAccountTemplateServiceImpl extends ServiceImpl<RuleAccountTempl
                 threshold.setAccountId(accountId);
                 threshold.setAccountId(accountId);
                 threshold.setGroupId(groupId);
                 threshold.setGroupId(groupId);
                 threshold.setRuleId(ruleBase.getId());
                 threshold.setRuleId(ruleBase.getId());
+                if (ruleBase.getVariableType() == 0) {
+                    threshold.setThreshold(ruleBase.getThreshold());
+                }
                 if (isCopy == 1) {
                 if (isCopy == 1) {
                     threshold.setBatchNo(batchId);
                     threshold.setBatchNo(batchId);
                 }
                 }

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

@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -195,17 +196,20 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                 for (Map.Entry<String, Object> entry : batchNo.entrySet()) {
                 for (Map.Entry<String, Object> entry : batchNo.entrySet()) {
                     JSONObject thresholdJn = (JSONObject) entry.getValue();
                     JSONObject thresholdJn = (JSONObject) entry.getValue();
                     if (!Check.isNull(thresholdJn)) {
                     if (!Check.isNull(thresholdJn)) {
-                        CombinationRule(ruleGroup, ruleBaseList, thresholdJn, indicators, matchData, complianceList);
+                        CombinationRule(ruleBaseList, thresholdJn, indicators, matchData, complianceList);
                     }
                     }
                 }
                 }
             } else {
             } else {
                 boolean isGroup = "group".equals(ruleGroup.getRuleType());
                 boolean isGroup = "group".equals(ruleGroup.getRuleType());
                 //匹配组合规则
                 //匹配组合规则
                 if (isGroup) {
                 if (isGroup) {
-                    CombinationRule(ruleGroup, ruleBaseList, thresholdObj, indicators, matchData, complianceList);
+                    CombinationRule(ruleBaseList, thresholdObj, indicators, matchData, complianceList);
                     //匹配单规则
                     //匹配单规则
                 } else {
                 } else {
                     RuleBase ruleBase = ruleBaseList.get(0);
                     RuleBase ruleBase = ruleBaseList.get(0);
+                    if (Check.isNull(ruleBase)) {
+                        continue;
+                    }
                     //指标对象
                     //指标对象
                     JSONObject indicator = indicators.getJSONObject(ruleBase.getIndicatorCode());
                     JSONObject indicator = indicators.getJSONObject(ruleBase.getIndicatorCode());
                     //指标阈值
                     //指标阈值
@@ -220,9 +224,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                         for (int i = 0; i < dimensionData.size(); i++) {
                         for (int i = 0; i < dimensionData.size(); i++) {
                             JSONObject obj = dimensionData.getJSONObject(i);
                             JSONObject obj = dimensionData.getJSONObject(i);
                             String value = obj.getString(ruleBase.getIndicatorCode());
                             String value = obj.getString(ruleBase.getIndicatorCode());
-                            if (MatchLogic.matchCondition(indicator.getString("dataType"), ruleBase.getRuleCondition(), threshold, value, obj)) {
+                            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, obj)) {
                                 complianceList.add(obj);
                                 complianceList.add(obj);
-//                                sendMsg(ruleGroup, obj, type, accountName);
                             }
                             }
                         }
                         }
                     }
                     }
@@ -248,7 +251,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @throws
      * @throws
      * @author ZHAOXA
      * @author ZHAOXA
      */
      */
-    private void CombinationRule(RuleGroup ruleGroup, List<RuleBase> ruleBaseList, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList) {
+    private void CombinationRule(List<RuleBase> ruleBaseList, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList) {
         //符合规则的数据集
         //符合规则的数据集
         JSONArray targetDatas = new JSONArray();
         JSONArray targetDatas = new JSONArray();
         JSONArray planDatas = new JSONArray();
         JSONArray planDatas = new JSONArray();
@@ -257,47 +260,114 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
         for (RuleBase ruleBase : ruleBaseList) {
         for (RuleBase ruleBase : ruleBaseList) {
             //指标对象
             //指标对象
             JSONObject indicator = indicators.getJSONObject(ruleBase.getIndicatorCode());
             JSONObject indicator = indicators.getJSONObject(ruleBase.getIndicatorCode());
-            //阈值类型
-            String dataType = indicator.getString("dataType");
             //指标阈值
             //指标阈值
             String threshold = thresholdObj.getString(ruleBase.getId().toString());
             String threshold = thresholdObj.getString(ruleBase.getId().toString());
             //阈值为空时,或者阈值为“unlimited”(不限),不执行该规则
             //阈值为空时,或者阈值为“unlimited”(不限),不执行该规则
             if (Check.isNull(threshold) || "unlimited".equals(threshold)) {
             if (Check.isNull(threshold) || "unlimited".equals(threshold)) {
-                continue;
+                if (!Check.isNull(accountDatas)) {
+                    accountDatas = null;
+                }
+                if (!Check.isNull(planDatas)) {
+                    planDatas = null;
+                }
+                if (!Check.isNull(creativeDatas)) {
+                    creativeDatas = null;
+                }
+                if (!Check.isNull(targetDatas)) {
+                    targetDatas = null;
+                }
+                break;
             }
             }
             JSONArray dimensionData = matchData.getJSONArray(ruleBase.getRuleDimension());
             JSONArray dimensionData = matchData.getJSONArray(ruleBase.getRuleDimension());
             if (Check.isNull(dimensionData)) {
             if (Check.isNull(dimensionData)) {
+                if (!Check.isNull(accountDatas)) {
+                    accountDatas = null;
+                }
+                if (!Check.isNull(planDatas)) {
+                    planDatas = null;
+                }
+                if (!Check.isNull(creativeDatas)) {
+                    creativeDatas = null;
+                }
+                if (!Check.isNull(targetDatas)) {
+                    targetDatas = null;
+                }
                 break;
                 break;
             }
             }
             //账户维度数据
             //账户维度数据
             if (ACCOUNT.equals(ruleBase.getRuleDimension())) {
             if (ACCOUNT.equals(ruleBase.getRuleDimension())) {
                 JSONObject accountEntity = dimensionData.getJSONObject(0);
                 JSONObject accountEntity = dimensionData.getJSONObject(0);
-                if (MatchLogic.matchCondition(dataType, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity)) {
-                    accountDatas.add(accountEntity);
+                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity)) {
+                    if (Check.isNull(accountDatas)) {
+                        accountDatas.add(accountEntity);
+                    }
                 } else {
                 } else {
-                    log.warn("匹配规则组({}),账户维度数据不符合直接跳过", ruleGroup.getId());
-                    break;
-                }
-                if (Check.isNull(accountDatas)) {
+                    if (!Check.isNull(accountDatas)) {
+                        accountDatas = null;
+                    }
+                    if (!Check.isNull(planDatas)) {
+                        planDatas = null;
+                    }
+                    if (!Check.isNull(creativeDatas)) {
+                        creativeDatas = null;
+                    }
+                    if (!Check.isNull(targetDatas)) {
+                        targetDatas = null;
+                    }
                     break;
                     break;
                 }
                 }
             } else if (PLAN.equals(ruleBase.getRuleDimension())) {
             } else if (PLAN.equals(ruleBase.getRuleDimension())) {
-                planDatas = getOKData(planDatas, dimensionData, ruleBase, dataType, threshold);
+                planDatas = getOKData(planDatas, dimensionData, ruleBase, indicator, threshold);
                 if (Check.isNull(planDatas)) {
                 if (Check.isNull(planDatas)) {
+                    if (!Check.isNull(accountDatas)) {
+                        accountDatas = null;
+                    }
+                    if (!Check.isNull(planDatas)) {
+                        planDatas = null;
+                    }
+                    if (!Check.isNull(creativeDatas)) {
+                        creativeDatas = null;
+                    }
+                    if (!Check.isNull(targetDatas)) {
+                        targetDatas = null;
+                    }
                     break;
                     break;
                 }
                 }
             } else if (CREATIVE.equals(ruleBase.getRuleDimension())) {
             } else if (CREATIVE.equals(ruleBase.getRuleDimension())) {
-                creativeDatas = getOKData(creativeDatas, dimensionData, ruleBase, dataType, threshold);
+                creativeDatas = getOKData(creativeDatas, dimensionData, ruleBase, indicator, threshold);
                 if (Check.isNull(creativeDatas)) {
                 if (Check.isNull(creativeDatas)) {
+                    if (!Check.isNull(accountDatas)) {
+                        accountDatas = null;
+                    }
+                    if (!Check.isNull(planDatas)) {
+                        planDatas = null;
+                    }
+                    if (!Check.isNull(creativeDatas)) {
+                        creativeDatas = null;
+                    }
+                    if (!Check.isNull(targetDatas)) {
+                        targetDatas = null;
+                    }
                     break;
                     break;
                 }
                 }
             } else if ("target".equals(ruleBase.getRuleDimension())) {
             } else if ("target".equals(ruleBase.getRuleDimension())) {
-                targetDatas = getOKData(targetDatas, dimensionData, ruleBase, dataType, threshold);
+                targetDatas = getOKData(targetDatas, dimensionData, ruleBase, indicator, threshold);
                 if (Check.isNull(targetDatas)) {
                 if (Check.isNull(targetDatas)) {
+                    if (!Check.isNull(accountDatas)) {
+                        accountDatas = null;
+                    }
+                    if (!Check.isNull(planDatas)) {
+                        planDatas = null;
+                    }
+                    if (!Check.isNull(creativeDatas)) {
+                        creativeDatas = null;
+                    }
+                    if (!Check.isNull(targetDatas)) {
+                        targetDatas = null;
+                    }
                     break;
                     break;
                 }
                 }
             }
             }
-
         }
         }
         //获取达标可发送的数据
         //获取达标可发送的数据
         JSONArray sendData = MatchLogic.getSendData(accountDatas, planDatas, creativeDatas, targetDatas);
         JSONArray sendData = MatchLogic.getSendData(accountDatas, planDatas, creativeDatas, targetDatas);
@@ -316,13 +386,13 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @throws
      * @throws
      * @author ZHAOXA
      * @author ZHAOXA
      */
      */
-    private JSONArray getOKData(JSONArray ruleDatas, JSONArray dimensionData, RuleBase ruleBase, String type, String threshold) {
+    private JSONArray getOKData(JSONArray ruleDatas, JSONArray dimensionData, RuleBase ruleBase, JSONObject indicator, String threshold) {
         if (!Check.isNull(ruleDatas)) {
         if (!Check.isNull(ruleDatas)) {
             JSONArray okData = new JSONArray();
             JSONArray okData = new JSONArray();
             for (int i = 0; i < ruleDatas.size(); i++) {
             for (int i = 0; i < ruleDatas.size(); i++) {
-                JSONObject targetEntity = dimensionData.getJSONObject(i);
+                JSONObject targetEntity = ruleDatas.getJSONObject(i);
                 String value = targetEntity.getString(ruleBase.getIndicatorCode());
                 String value = targetEntity.getString(ruleBase.getIndicatorCode());
-                if (MatchLogic.matchCondition(type, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
+                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
                     okData.add(targetEntity);
                     okData.add(targetEntity);
                 }
                 }
             }
             }
@@ -331,7 +401,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
         for (int i = 0; i < dimensionData.size(); i++) {
         for (int i = 0; i < dimensionData.size(); i++) {
             JSONObject targetEntity = dimensionData.getJSONObject(i);
             JSONObject targetEntity = dimensionData.getJSONObject(i);
             String value = targetEntity.getString(ruleBase.getIndicatorCode());
             String value = targetEntity.getString(ruleBase.getIndicatorCode());
-            if (MatchLogic.matchCondition(type, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
+            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
                 ruleDatas.add(targetEntity);
                 ruleDatas.add(targetEntity);
             }
             }
         }
         }
@@ -457,17 +527,14 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             } else if ("TEL".equals(sendType)) {
             } else if ("TEL".equals(sendType)) {
 
 
             } else {
             } else {
-//                for (int i = 0; i < 10000000; i++) {
-//                    sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg + i);
-//                    Thread.sleep(2000);
-//                }
+//                sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
                 sendMessageService.sendMessage(user.getString("id"), msg);
                 sendMessageService.sendMessage(user.getString("id"), msg);
                 Thread.sleep(200);
                 Thread.sleep(200);
             }
             }
             if (!Check.isNull(msg)) {
             if (!Check.isNull(msg)) {
                 AlarmEventSend send = new AlarmEventSend();
                 AlarmEventSend send = new AlarmEventSend();
                 send.setUserId(user.getString("id"));
                 send.setUserId(user.getString("id"));
-                send.setAlarmDetail(msg.replace("<br/>", ""));
+                send.setAlarmDetail(msg.replace("<br/>", ""));
                 send.setAlarmStatus(NoEn.NO1.valueStr());
                 send.setAlarmStatus(NoEn.NO1.valueStr());
                 send.setGroupId(ruleGroup.getId());
                 send.setGroupId(ruleGroup.getId());
                 send.setGroupName(ruleGroup.getGroupName());
                 send.setGroupName(ruleGroup.getGroupName());
@@ -478,6 +545,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                 } else {
                 } else {
                     send.setRuleDimension(ACCOUNT);
                     send.setRuleDimension(ACCOUNT);
                 }
                 }
+                send.setCreateTime(new Date());
                 alarmEventSendMapper.insert(send);
                 alarmEventSendMapper.insert(send);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
@@ -722,6 +790,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                                     continue;
                                     continue;
                                 }
                                 }
                                 RuleAccountThreshold threshold = new RuleAccountThreshold();
                                 RuleAccountThreshold threshold = new RuleAccountThreshold();
+                                if (ruleBase.getVariableType() == 0) {
+                                    threshold.setThreshold(ruleBase.getThreshold());
+                                }
                                 threshold.setAccountId(accountId);
                                 threshold.setAccountId(accountId);
                                 if (isCopy == 1) {
                                 if (isCopy == 1) {
                                     threshold.setBatchNo(batchId);
                                     threshold.setBatchNo(batchId);

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTarget.java

@@ -30,9 +30,11 @@ public class RuleDataTarget {
 	private String accountName;
 	private String accountName;
 	private Long planId;
 	private Long planId;
 	private String planName;
 	private String planName;
+
 	/**retargetingTagsExclude*/
 	/**retargetingTagsExclude*/
 	private String retargetingTagsExclude;
 	private String retargetingTagsExclude;
 	private String retargetingTagsInclude;
 	private String retargetingTagsInclude;
+
 	/**hideIfExists*/
 	/**hideIfExists*/
 	@Excel(name = "hideIfExists", width = 15)
 	@Excel(name = "hideIfExists", width = 15)
     @ApiModelProperty(value = "hideIfExists")
     @ApiModelProperty(value = "hideIfExists")

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -29,4 +29,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
 
 
     UserAllocation getUserAllocation(@Param("accountId") Long accountId);
     UserAllocation getUserAllocation(@Param("accountId") Long accountId);
+
+    JSONObject getSwitchStatusByAccount(@Param("accountId") Long accountId);
 }
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -75,5 +75,15 @@
     limit 1
     limit 1
     </select>
     </select>
 
 
+    <select id="getSwitchStatusByAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            monitoring_link,
+            landing_page
+        FROM
+            ctop_user_allocation
+        WHERE
+            account_id = #{accountId}
+    </select>
+
 
 
 </mapper>
 </mapper>

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -34,4 +34,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     List<JSONObject> getAccountIdListByUserId(Long userId);
     List<JSONObject> getAccountIdListByUserId(Long userId);
 
 
     List<UserAllocation> getUserAllocations(String mediaId ,int switchType);
     List<UserAllocation> getUserAllocations(String mediaId ,int switchType);
+
+    JSONObject getSwitchStatusByAccount(Long accountId);
 }
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -129,4 +129,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         queryWrapper.orderByDesc("create_time");
         queryWrapper.orderByDesc("create_time");
         return this.list(queryWrapper);
         return this.list(queryWrapper);
     }
     }
+
+    @Override
+    public JSONObject getSwitchStatusByAccount(Long accountId) {
+        return userAllocationMapper.getSwitchStatusByAccount(accountId);
+    }
 }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -127,7 +127,7 @@ public class KuaishouInterfaceConstant {
     /**
     /**
      * 获取人群包接口
      * 获取人群包接口
      */
      */
-    public static final String POPULATION_LIST = "/rest/openapi/v1/dmp/population/list";
+    public static final String POPULATION_LIST = "/rest/openapi/v2/dmp/population/list";
 
 
     /**
     /**
      * 删除人群包接口
      * 删除人群包接口

+ 2 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadJob.java

@@ -32,6 +32,7 @@ public class KuaishouDailyAccountReportLoadJob {
     public ReturnT<String> execute(String param) throws Exception {
     public ReturnT<String> execute(String param) throws Exception {
         Date getDate = DateUtils.addDay(new Date(), -1);
         Date getDate = DateUtils.addDay(new Date(), -1);
         Date getDate2 = DateUtils.addDay(new Date(), -2);
         Date getDate2 = DateUtils.addDay(new Date(), -2);
+        Date getDate3 = DateUtils.addDay(new Date(), -3);
         //1:查询当日数据
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.isEmpty()) {
         if (null == tokens || tokens.isEmpty()) {
@@ -41,6 +42,7 @@ public class KuaishouDailyAccountReportLoadJob {
         tokens.forEach(token -> executorService.submit(() ->{
         tokens.forEach(token -> executorService.submit(() ->{
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate2);
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate2);
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate3, getDate3);
         }));
         }));
         return ReturnT.SUCCESS;
         return ReturnT.SUCCESS;
     }
     }

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -218,6 +218,9 @@ public class ReportServiceImpl implements IReportService {
                     target.setRetargetingTagsExclude(audienceObject.getString("retargeting_tags_exclude"));
                     target.setRetargetingTagsExclude(audienceObject.getString("retargeting_tags_exclude"));
                 }
                 }
                 if(null!=audienceObject.getString("retargeting_tags_include")){
                 if(null!=audienceObject.getString("retargeting_tags_include")){
+                    target.setRetargetingTagsExclude(audienceObject.getString("retargeting_tags_include"));
+                }
+                if(null!=audienceObject.getString("retargeting_tags_include")){
                     target.setRetargetingTagsInclude(audienceObject.getString("retargeting_tags_include"));
                     target.setRetargetingTagsInclude(audienceObject.getString("retargeting_tags_include"));
                 }
                 }
                 target.setHideIfConverted(plan.getHideIfConverted());
                 target.setHideIfConverted(plan.getHideIfConverted());

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/RuleByteDanceAccountServiceImpl.java

@@ -37,7 +37,7 @@ public class RuleByteDanceAccountServiceImpl implements IRuleByteDanceAccountSer
             ruleDataAccount.setConvertCost(dataAccount.getBigDecimal("convert_cost"));
             ruleDataAccount.setConvertCost(dataAccount.getBigDecimal("convert_cost"));
             ruleDataAccount.setNextDayOpenNum(dataAccount.getLong("next_day_open"));
             ruleDataAccount.setNextDayOpenNum(dataAccount.getLong("next_day_open"));
             ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_cost"));
             ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_cost"));
-            ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_rate"));
+            ruleDataAccount.setNextDayOpenRate(dataAccount.getBigDecimal("next_day_open_rate"));
 
 
             ruleDataAccountService.saveOrUpdate(ruleDataAccount);
             ruleDataAccountService.saveOrUpdate(ruleDataAccount);
         }
         }