浏览代码

监测链接预警

yumeng 3 年之前
父节点
当前提交
3e69d7416d

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

@@ -60,4 +60,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     int updateProjectStrategyStatus(@Param("accountId") Long accountId,@Param("projectStrategy") Integer projectStrategy);
     int updateProjectStrategyStatus(@Param("accountId") Long accountId,@Param("projectStrategy") Integer projectStrategy);
 
 
     List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);
     List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);
+
+    List<Long> getIdList();
 }
 }

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

@@ -238,5 +238,10 @@
         where project_id = #{projectId}
         where project_id = #{projectId}
         AND auto_delivery = 1
         AND auto_delivery = 1
     </select>
     </select>
+    <select id="getIdList" resultType="java.lang.Long">
+        SELECT  account_id  FROM ctop_track_monitor_configure
+        where status = 0
+
+    </select>
 
 
 </mapper>
 </mapper>

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

@@ -67,4 +67,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     boolean updateProjectStrategyStatus(Long accountId, Integer projectStrategy);
     boolean updateProjectStrategyStatus(Long accountId, Integer projectStrategy);
 
 
     List<Long> queryAutomaticAccounts(Long projectId);
     List<Long> queryAutomaticAccounts(Long projectId);
+
+    List<Long> getIdList();
 }
 }

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

@@ -220,4 +220,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public List<Long> queryAutomaticAccounts(Long projectId) {
     public List<Long> queryAutomaticAccounts(Long projectId) {
         return userAllocationMapper.queryAutomaticAccounts(projectId);
         return userAllocationMapper.queryAutomaticAccounts(projectId);
     }
     }
+
+    @Override
+    public List<Long> getIdList() {
+        return userAllocationMapper.getIdList();
+    }
 }
 }

+ 70 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/TrackWarningJob.java

@@ -0,0 +1,70 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class TrackWarningJob {
+
+
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
+    /**
+     * 自定义创建监测链接预警
+     */
+    @XxlJob("monitorCreative")
+    public void monitorCreative() {
+        String url = jobUrl + "/jeecg-boot/monitor/trackMonitorLogs/monitorCreative";
+        System.err.println("请求地址为:" + url);
+        List<Long> idList = userAllocationService.getIdList();
+        if (Check.isNull(idList)) {
+            XxlJobHelper.log("自定义创意监测链接预警");
+            return;
+        }
+        for (int i = 0; i < idList.size(); i++) {
+            Long id = idList.get(i);
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("accountId", id);
+            HttpUtils2.httpGet(url, requestMap, null);
+        }
+
+
+    }
+
+    /**
+     * 程序化监测链接预警
+     */
+    @XxlJob("monitorProgramCreative")
+    public void monitorProgramCreative() {
+        String url = jobUrl + "/jeecg-boot/monitor/trackMonitorLogs/monitorProgramCreative";
+        System.err.println("请求地址为:" + url);
+        List<Long> idList = userAllocationService.getIdList();
+        if (Check.isNull(idList)) {
+            XxlJobHelper.log("自定义创意监测链接预警");
+            return;
+        }
+        for (int i = 0; i < idList.size(); i++) {
+            Long id = idList.get(i);
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("accountId", id);
+            HttpUtils2.httpGet(url, requestMap, null);
+        }
+
+
+    }
+
+}