ソースを参照

Merge remote-tracking branch 'origin/master_rule_engine' into master_rule_engine

yumeng 4 年 前
コミット
ef8f5272f7
14 ファイル変更436 行追加8 行削除
  1. 79 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java
  2. 13 4
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataAccount.java
  3. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java
  4. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  5. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  6. 6 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCheckAccountLandingPageJob.java
  7. 118 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCheckAccountMonitoringLinkJob.java
  8. 49 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/RuleDataAccountCleanJob.java
  9. 7 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IRuleByteDanceAccountService.java
  10. 4 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java
  11. 45 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/RuleByteDanceAccountServiceImpl.java
  12. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/constants/QueryToolUrlConstant.java
  13. 23 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/service/IByteDanceGetAccountFundService.java
  14. 60 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/service/impl/ByteDanceGetAccountFundServiceImpl.java

+ 79 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java

@@ -0,0 +1,79 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/rule/switch/")
+public class RuleSwitchController {
+
+    @Autowired
+    IUserAllocationService userAllocationService;
+
+    /**
+     *  账户添加内广监测链接预警
+     */
+    @PostMapping(value = "/onOrOffMonitoringLink")
+    public Result<Object> onOrOffMonitoringLink(@RequestParam Long accountId, @RequestParam String switchType){
+        Result<Object> result=new Result<>();
+        UserAllocation userAllocation=new UserAllocation();
+        userAllocation.setAccountId(accountId);
+        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        //开启预警
+        if(switchType.equals("on")){
+            wrapper.set("landing_page",0);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("监测链接预警开启成功");
+            }
+        }else if(switchType.equals("off")){
+            wrapper.set("landing_page",1);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("监测链接预警关闭成功");
+            }
+        }else {
+            result.error500("未知操作");
+        }
+        return result;
+    }
+
+    /**
+     *  账户添加落地页链接预警
+     */
+    @PostMapping(value = "/onOrOffLandingPage")
+    public Result<Object> onOrOffLandingPage(@RequestParam Long accountId, @RequestParam String switchType){
+        Result<Object> result=new Result<>();
+        UserAllocation userAllocation=new UserAllocation();
+        userAllocation.setAccountId(accountId);
+        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        //开启预警
+        if(switchType.equals("on")){
+            wrapper.set("landing_page",0);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("落地页链接预警开启成功");
+            }
+        }else if(switchType.equals("off")){
+            wrapper.set("landing_page",1);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("落地页链接预警关闭成功");
+            }
+        }else {
+            result.error500("未知操作");
+        }
+        return result;
+    }
+}

+ 13 - 4
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataAccount.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -22,11 +23,19 @@ import java.util.Date;
 @TableName("ctop_rule_data_account")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
+@ApiModel(value="ctop_rule_data_account对象", description="规则账户清洗数据")
 public class RuleDataAccount {
 
-	@TableId(type = IdType.AUTO)
+	/**id*/
+    @ApiModelProperty(value = "id")
 	private Long id;
+	/**账户id*/
+	@Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
 	private Long accountId;
+	/**账户name*/
+	@Excel(name = "账户id", width = 15)
+	@ApiModelProperty(value = "账户id")
 	private String accountName;
 	/**消耗*/
 	@Excel(name = "消耗", width = 15)
@@ -52,6 +61,9 @@ public class RuleDataAccount {
 	@Excel(name = "nextDayOpenCost", width = 15)
     @ApiModelProperty(value = "nextDayOpenCost")
 	private BigDecimal nextDayOpenCost;
+
+	private BigDecimal nextDayOpenRate;
+
 	/**status*/
 	@Excel(name = "status", width = 15)
     @ApiModelProperty(value = "status")
@@ -62,7 +74,4 @@ public class RuleDataAccount {
 	/**updateTime*/
     @ApiModelProperty(value = "updateTime")
 	private Date updateTime;
-
-	public RuleDataAccount() {
-	}
 }

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -112,6 +112,20 @@ public class UserAllocation implements Serializable {
     private Integer accountStatus;
 
     /**
+     * 检测链接预警
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer monitoringLink;
+
+    /**
+     * 检测链接预警
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer landingPage;
+
+    /**
      * 修改时间
      */
     @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

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

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

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

@@ -119,4 +119,14 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public List<JSONObject> getAccountIdListByUserId(Long userId) {
         return userAllocationMapper.getAccountIdListByUserId(userId);
     }
+
+    @Override
+    public List<UserAllocation> getUserAllocations(String mediaId, int switchType) {
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", mediaId);
+        queryWrapper.eq("account_status", 0);
+        queryWrapper.eq("monitoring_link", 0);
+        queryWrapper.orderByDesc("create_time");
+        return this.list(queryWrapper);
+    }
 }

+ 6 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCheckAccountLandingPageJob.java

@@ -0,0 +1,6 @@
+package cn.com.ctop.job.bytedance.handler;
+
+public class ByteDanceCheckAccountLandingPageJob {
+
+
+}

+ 118 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCheckAccountMonitoringLinkJob.java

@@ -0,0 +1,118 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class ByteDanceCheckAccountMonitoringLinkJob {
+
+    @Autowired
+    private IUserAllocationService allocationService;
+    @Autowired
+    private IByteDanceAdvertisePlanService advertisePlanService;
+    @Autowired
+    private IByteDanceCreativeService creativeService;
+    @Autowired
+    private ISendMessageService sendMessageService;
+
+    @XxlJob("byteDanceCheckAccountMonitoringLinkJob")
+    public ReturnT<String> execute(String param) throws Exception{
+
+        //查询开启监测链接预警的账户
+        //Todo 暂时单线程
+        List<UserAllocation> userAllocations=allocationService.getUserAllocations("1",0);
+        userAllocations.forEach(userAllocation->{
+            List<ByteDanceAdvertisePlan> plans = advertisePlanService.getAllPlans(userAllocation.getAccountId(), DateUtils.formatDate(new Date()));
+            if(null!=plans&&!plans.isEmpty()){
+                for (ByteDanceAdvertisePlan plan:plans) {
+                    Map<String, Object> creativeDetail = creativeService.getCreativeDetail(userAllocation.getAccountId(), plan.getId());
+                    if(null!=creativeDetail.get("data")){
+                        JSONObject data = (JSONObject) creativeDetail.get("data");
+                        checkMonitorLink(data,plan,userAllocation);
+                    }
+                }
+            }
+        });
+        XxlJobLogger.log("监测链接检查完成");
+        return ReturnT.SUCCESS;
+    }
+
+    private void checkMonitorLink(JSONObject data, ByteDanceAdvertisePlan plan, UserAllocation allocation) {
+        String downloadUrl = plan.getDownloadUrl();
+        boolean errorflag = false;
+        String errorMsg = "";
+        String token = plan.getName().split("-")[0];
+        if(null!=token&& "衍生计划".equals(token)){
+            token = plan.getName().split("-")[1];
+        }
+        String tokenInfo = "surl_token="+token;
+        String appType = plan.getAppType();
+
+        if(null!=downloadUrl){
+            if(null!=appType&& "APP_IOS".equals(appType)){
+//                if(!downloadUrl.equals("https://apps.apple.com/cn/app/id1468454200")){
+                if(!downloadUrl.contains("https://apps.apple.com/cn/app")){
+                    errorMsg+= "应用下载链接填写异常;";
+                    errorflag = true;
+                }
+            }
+            if(null!=appType&& "APP_ANDROID".equals(appType)){
+                if(!downloadUrl.contains(token)){
+                    errorMsg+= "应用下载链接填写异常;";
+                    errorflag = true;
+                }
+            }
+        }
+        //展示监测链接
+        String trackUrl = data.getString("trackUrl");
+        if(null!=trackUrl&&!"".equals(trackUrl.trim())){
+            if(!trackUrl.contains(tokenInfo)){
+                errorMsg+= "展示监测链接填写异常;";
+                errorflag = true;
+            }
+        }
+        //点击监测链接
+        String actionTrackUrl = data.getString("actionTrackUrl");
+        if(null!=actionTrackUrl&&!"".equals(actionTrackUrl.trim())){
+            if(null!=appType&& "APP_IOS".equals(appType)){
+                if(!actionTrackUrl.contains(tokenInfo)||!actionTrackUrl.contains("app_platform=ios")){
+                    errorMsg+= "点击监测链接填写异常;";
+                    errorflag = true;
+                }
+            }
+            if(null!=appType&& "APP_ANDROID".equals(appType)){
+                if(!actionTrackUrl.contains(tokenInfo)||!actionTrackUrl.contains("tt/")){
+                    errorMsg+= "点击监测链接填写异常;";
+                    errorflag = true;
+                }
+            }
+        }
+        //视频有效播放监测链接
+        String videoPlayEffectiveTrackUrl = data.getString("videoPlayEffectiveTrackUrl");
+        if(null!=videoPlayEffectiveTrackUrl&&!"".equals(videoPlayEffectiveTrackUrl.trim())){
+            if(!videoPlayEffectiveTrackUrl.contains(tokenInfo)){
+                errorMsg+= "视频有效播放监测链接填写异常;";
+                errorflag = true;
+            }
+        }
+        if(errorflag){
+            sendMessage(allocation,"警告:账户:"+allocation.getAuthName()+"(id:"+allocation.getAccountId()+")下的广告计划:"+plan.getName()+"(id:"+plan.getId()+")"+"监测链接异常>>"+errorMsg);
+        }
+    }
+    private void sendMessage(UserAllocation allocation, String errorMsg) {
+        sendMessageService.sendMessage(allocation.getUserId(),errorMsg);
+    }
+}

+ 49 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/RuleDataAccountCleanJob.java

@@ -0,0 +1,49 @@
+package cn.com.ctop.job.bytedance.handler;
+
+/**
+ *  Created by JQ.bi on 2020.11.16
+ */
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IRuleByteDanceAccountService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class RuleDataAccountCleanJob {
+
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+    @Autowired
+    private IRuleByteDanceAccountService ruleByteDanceAccountService;
+
+    private ExecutorService executorPool = Executors.newFixedThreadPool(6);
+
+    @XxlJob("ruleDataAccountCleanJob")
+    public ReturnT<String> execute(String param) throws Exception {
+        XxlJobLogger.log("规则预警账户维度数据开始清洗");
+        //查询所有头条账户
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        if (null == tokens || tokens.isEmpty()) {
+            XxlJobLogger.log("未获取到可用的token");
+            return ReturnT.FAIL;
+        }
+        tokens.forEach(token->executorPool.submit(() -> {
+            ruleByteDanceAccountService.cleanRuleDataAccount(token.getAccountId());
+        }));
+        if(!executorPool.isShutdown()){
+            executorPool.shutdown();
+        }
+        XxlJobLogger.log("规则预警账户维度数据清洗结束");
+        return ReturnT.SUCCESS;
+    }
+}

+ 7 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IRuleByteDanceAccountService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.toutiao.modules.report.service;
+
+public interface IRuleByteDanceAccountService {
+
+    void cleanRuleDataAccount(Long accountId);
+
+}

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

@@ -99,13 +99,13 @@ public class ReportServiceImpl implements IReportService {
             return;
         }
 
-        for (var i = 0; i < dataArray.size(); i++) {
-            var data = dataArray.getJSONObject(i);
+        for (int i = 0; i < dataArray.size(); i++) {
+            JSONObject data = dataArray.getJSONObject(i);
             if (null != conditions.getTimeGranularity() && conditions.getTimeGranularity().equals(CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY)) {
-                var hourlyReport = new BytedanceAdvertiserHourlyReport(data);
+                BytedanceAdvertiserHourlyReport hourlyReport = new BytedanceAdvertiserHourlyReport(data);
                 advertiserHourlyReportService.saveOrUpdate(hourlyReport);
             } else {
-                var dailyReport = new BytedanceAdvertiserDailyReport(data);
+                BytedanceAdvertiserDailyReport dailyReport = new BytedanceAdvertiserDailyReport(data);
                 advertiserDailyReportService.saveOrUpdate(dailyReport);
             }
         }

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

@@ -0,0 +1,45 @@
+package cn.com.ctop.toutiao.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.RuleDataAccount;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IRuleDataAccountService;
+import cn.com.ctop.toutiao.modules.report.service.IRuleByteDanceAccountService;
+import cn.com.ctop.toutiao.modules.tool.service.IByteDanceGetAccountFundService;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RuleByteDanceAccountServiceImpl implements IRuleByteDanceAccountService {
+
+    @Autowired
+    IByteDanceGetAccountFundService byteDanceGetAccountFundService;
+    @Autowired
+    ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    IRuleDataAccountService ruleDataAccountService;
+
+    @Override
+    public void cleanRuleDataAccount(Long accountId) {
+        CtopOauthToken oauthToken=oauthTokenService.getTokenByAccountId(accountId);
+        //查询账户实时数据
+        JSONObject dataAccount=byteDanceGetAccountFundService.getAccountReportBy(oauthToken,accountId);
+        if(!dataAccount.isEmpty()){
+            JSONObject fundData=byteDanceGetAccountFundService.getAccountFundBy(oauthToken,accountId);
+            RuleDataAccount ruleDataAccount=new RuleDataAccount();
+            ruleDataAccount.setId(accountId);
+            ruleDataAccount.setAccountId(accountId);
+            ruleDataAccount.setAccountName(fundData.getString("name"));
+            ruleDataAccount.setCost(dataAccount.getBigDecimal("cost"));
+            ruleDataAccount.setValidBalance(fundData.getBigDecimal("valid_balance"));
+            ruleDataAccount.setConvertNum(dataAccount.getLong("convert"));
+            ruleDataAccount.setConvertCost(dataAccount.getBigDecimal("convert_cost"));
+            ruleDataAccount.setNextDayOpenNum(dataAccount.getLong("next_day_open"));
+            ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_cost"));
+            ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_rate"));
+
+            ruleDataAccountService.saveOrUpdate(ruleDataAccount);
+        }
+    }
+}

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/constants/QueryToolUrlConstant.java

@@ -44,4 +44,10 @@ public class QueryToolUrlConstant {
     //获取图片素材
     public static final String FILE_IMAGE_GET="https://ad.oceanengine.com/open_api/2/file/image/get/";
 
+    //查询账户余额
+    public static final String GET_ADVERTISER_FUND="https://ad.oceanengine.com/open_api/2/advertiser/fund/get/";
+
+    //查询账户当日实时数据
+    public static final String GET_ADVERTISER_REPORT="https://ad.oceanengine.com/open_api/2/report/advertiser/get/";
+
 }

+ 23 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/service/IByteDanceGetAccountFundService.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.toutiao.modules.tool.service;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ *  Created by JQ.bi on 2020.11.15
+ *
+ *  拉取账户余额
+ */
+public interface IByteDanceGetAccountFundService {
+
+    /**
+     * 获取账号余额信息
+     */
+    JSONObject getAccountFundBy(CtopOauthToken token, Long advertiserId);
+
+    /**
+     * 获取账号余额信息
+     */
+    JSONObject getAccountReportBy(CtopOauthToken token, Long advertiserId);
+
+}

+ 60 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/service/impl/ByteDanceGetAccountFundServiceImpl.java

@@ -0,0 +1,60 @@
+package cn.com.ctop.toutiao.modules.tool.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.toutiao.modules.tool.constants.QueryToolUrlConstant;
+import cn.com.ctop.toutiao.modules.tool.service.IByteDanceGetAccountFundService;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.log.XxlJobLogger;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.SystemDateConstant;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class ByteDanceGetAccountFundServiceImpl implements IByteDanceGetAccountFundService {
+
+    @Override
+    public JSONObject getAccountFundBy(CtopOauthToken token, Long advertiserId) {
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+
+        JSONObject params=new JSONObject();
+        params.put("advertiser_id",advertiserId);
+
+        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpGetRequest(QueryToolUrlConstant.GET_ADVERTISER_FUND, headers,params));
+        if(jsonObject.getInteger("code")!=0){
+            XxlJobLogger.log("查询账户余额失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return null;
+        }
+        return jsonObject.getJSONObject("data");
+    }
+
+    @Override
+    public JSONObject getAccountReportBy(CtopOauthToken token, Long advertiserId) {
+
+        JSONObject result= new JSONObject();
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+
+        String now = DateUtils.getNowDate(SystemDateConstant.yyyy_MM_dd);
+        JSONObject params=new JSONObject();
+        params.put("advertiser_id",advertiserId);
+        params.put("start_date",now);
+        params.put("end_date",now);
+        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpGetRequest(QueryToolUrlConstant.GET_ADVERTISER_REPORT, headers,params));
+        if(jsonObject.getInteger("code")!=0){
+            XxlJobLogger.log("账户{}获取实时数据失败---{}",advertiserId,jsonObject.getString("message"));
+        }else {
+            result= (JSONObject) jsonObject.getJSONObject("data").getJSONArray("list").get(0);
+        }
+        return result;
+    }
+}