소스 검색

监测链接消息发送

yangzian 3 년 전
부모
커밋
fee63ca71e

+ 5 - 3
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/xml/MonitorBytedanceActionTrackUrlMapper.xml

@@ -30,11 +30,13 @@
     <select id="getBytedancPlanActionTrackUrl" resultType="org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo">
     <select id="getBytedancPlanActionTrackUrl" resultType="org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo">
         SELECT
         SELECT
             DISTINCT
             DISTINCT
-            action_track_url actionTrackUrl
+            action_track_url actionTrackUrl,
+            id as planId,
+            account_id
         FROM
         FROM
             ctop_bytedance_advertise_plan
             ctop_bytedance_advertise_plan
-        WHERE
-            account_id = #{accountId}
+        WHERE action_track_url is NOT NULL
+            and account_id = #{accountId}
           and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
           and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
     </select>
     </select>
 
 

+ 18 - 6
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/MonitorBytedanceServiceImpl.java

@@ -5,10 +5,13 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.bytedance.advertise.dockapi.MarketingService;
 import org.jeecg.modules.bytedance.advertise.mapper.MonitorBytedanceActionTrackUrlMapper;
 import org.jeecg.modules.bytedance.advertise.mapper.MonitorBytedanceActionTrackUrlMapper;
 import org.jeecg.modules.bytedance.advertise.service.IAiBytedanceAdvertiserStrategyService;
 import org.jeecg.modules.bytedance.advertise.service.IAiBytedanceAdvertiserStrategyService;
 import org.jeecg.modules.bytedance.advertise.service.IMonitorBytedanceService;
 import org.jeecg.modules.bytedance.advertise.service.IMonitorBytedanceService;
 import org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo;
 import org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo;
+import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
+import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
 import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
 import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
 import org.jeecg.modules.bytedance.common.utils.Check;
 import org.jeecg.modules.bytedance.common.utils.Check;
 import org.jeecg.modules.bytedance.common.utils.CorpWexinUtils;
 import org.jeecg.modules.bytedance.common.utils.CorpWexinUtils;
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.MessageFormat;
 import java.text.MessageFormat;
+import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Set;
 import java.util.Set;
 
 
@@ -37,6 +41,12 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
     @Resource
     @Resource
     private IUserAllocationService userAllocationService;
     private IUserAllocationService userAllocationService;
 
 
+    @Resource
+    private MarketingService marketingServiceImpl;
+
+    @Resource
+    private ICtopOauthTokenService tokenService;
+
 
 
 
 
     @Resource
     @Resource
@@ -157,7 +167,6 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
 
 
 
 
 
 
-
     /**
     /**
      * @description: 监测预警-点击监测链接
      * @description: 监测预警-点击监测链接
      * @param
      * @param
@@ -166,15 +175,18 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
      * @time: 2021/12/28
      * @time: 2021/12/28
      */
      */
     public Result monitorBytedanceActionTrackUrl(){
     public Result monitorBytedanceActionTrackUrl(){
-        //查询 头条自动投放配置账户 和 点击监测链接
-        List<MonitorBytedanceAdVo> accountList = monitorBytedanceActionTrackUrlMapper.getBytedancStrategyAcctionId(null);
+        //查询 配置的点击监测链接
+        List<MonitorBytedanceAdVo> accountList = monitorBytedanceActionTrackUrlMapper.getAccountActionTrackUrl(null,"1",null);
         accountList.forEach(accountInfo ->{
         accountList.forEach(accountInfo ->{
             //根据账户 查询头条计划中的 点击监测链接
             //根据账户 查询头条计划中的 点击监测链接
             List<MonitorBytedanceAdVo> actionTrackUrlList = monitorBytedanceActionTrackUrlMapper.getBytedancPlanActionTrackUrl(Long.valueOf(accountInfo.getAccountId()));
             List<MonitorBytedanceAdVo> actionTrackUrlList = monitorBytedanceActionTrackUrlMapper.getBytedancPlanActionTrackUrl(Long.valueOf(accountInfo.getAccountId()));
             if (!Check.isNull(actionTrackUrlList)){
             if (!Check.isNull(actionTrackUrlList)){
                 for (MonitorBytedanceAdVo actiontrackUrl : actionTrackUrlList) {
                 for (MonitorBytedanceAdVo actiontrackUrl : actionTrackUrlList) {
-                    //账户配置中的 点击监测链接 != 创建计划中的 点击监测链接
+                    //配置中的 点击监测链接 != 创建计划中的 点击监测链接
                     if (!StringUtils.equals(accountInfo.getActionTrackUrl(),actiontrackUrl.getActionTrackUrl())){
                     if (!StringUtils.equals(accountInfo.getActionTrackUrl(),actiontrackUrl.getActionTrackUrl())){
+                        //关停计划
+                        CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountInfo.getAccountId()));
+                        marketingServiceImpl.updPlanStatus(token, Arrays.asList(Long.valueOf(actiontrackUrl.getPlanId())),"disable");
                         //发送预警消息
                         //发送预警消息
                         sendEnterpriseWeiXinMessage(accountInfo);
                         sendEnterpriseWeiXinMessage(accountInfo);
                         break;
                         break;
@@ -190,10 +202,10 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
      * 发送 点击监测链接 预警消息
      * 发送 点击监测链接 预警消息
      */
      */
     public void sendEnterpriseWeiXinMessage(MonitorBytedanceAdVo accountInfo){
     public void sendEnterpriseWeiXinMessage(MonitorBytedanceAdVo accountInfo){
-        String message =  "{0},您好!您的账户:{1},账户ID:{2},点击监测链接配置有差异,请及时检查账户配置!";
+        String message =  "{0},您好!您所运营的账户:{1},点击监测链接配置有差异,已关停请及时修改!";
         //发送微信通知
         //发送微信通知
         JSONObject jsonObject =  monitorBytedanceActionTrackUrlMapper.getWChatIdByUserId("80e747cdea6f41dbbc8cde23046fd4e0");
         JSONObject jsonObject =  monitorBytedanceActionTrackUrlMapper.getWChatIdByUserId("80e747cdea6f41dbbc8cde23046fd4e0");
-        String msg = MessageFormat.format(message,accountInfo.getOperateUserName(),accountInfo.getAccountName(),String.valueOf(accountInfo.getAccountId()));
+        String msg = MessageFormat.format(message,accountInfo.getOperateUserName(),String.valueOf(accountInfo.getAccountId()));
         corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
         corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
     }
     }
 
 

+ 3 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/MonitorBytedanceAdVo.java

@@ -27,4 +27,7 @@ public class MonitorBytedanceAdVo implements Serializable {
     private String operateUserid;
     private String operateUserid;
     //运营人员名称
     //运营人员名称
     private String operateUserName;
     private String operateUserName;
+
+    //计划id
+    private String planId;
 }
 }