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