Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

yumeng 4 gadi atpakaļ
vecāks
revīzija
bef1ec6300

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/xml/ETLReportBytedanceVideoMapper.xml

@@ -298,7 +298,7 @@
             t2.signature AS md5,
             t2.video_url AS toutiaoUrl
         FROM
-            (SELECT * from base_report_bytedance_video_daily where stat_datetime=#{statDate}) t1
+            (SELECT * from ctop_bytedance_report_material_daily where stat_datetime=#{statDate}) t1
                 LEFT JOIN (select material_id,signature,video_url from ctop_bytedance_video_info where material_id in (SELECT DISTINCT material_id from base_report_bytedance_video_daily where stat_datetime=#{statDate})
             ) t2 ON t1.material_id = t2.material_id
                 LEFT JOIN ctop_material_ascription t3 on t2.signature=t3.material_id

+ 0 - 7
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/impl/ETLReportBytedanceVideoServiceImpl.java

@@ -5,21 +5,14 @@ import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
 import cn.com.ctop.toutiao.modules.link.mapper.ETLReportBytedanceVideoMapper;
 import cn.com.ctop.toutiao.modules.link.service.IBaseReportBytedanceVideoDailyService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import javax.naming.ldap.HasControls;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 头条视频报表ETL

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

@@ -16,7 +16,4 @@ public interface IBytedanceVideoReportService {
     List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
 
     void pullVideoReport(CtopOauthToken oauthToken,String startDate, String endDate,int page);
-
-    void pullVideoReportByMaterialId(CtopOauthToken oauthToken, String startDate, String endDate,Long[] materialIds, int page);
-
 }

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

@@ -101,61 +101,4 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
             pullVideoReport(oauthToken, startDate, endDate, page + 1);
         }
     }
-
-    @Override
-    public void pullVideoReportByMaterialId(CtopOauthToken oauthToken, String startDate, String endDate,Long[] materialIds, int page) {
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", " application/json");
-        headers.put("Access-Token", oauthToken.getAccessToken());
-
-        JSONObject param = new JSONObject();
-        param.put("advertiser_id", oauthToken.getAccountId());
-        param.put("start_date",startDate);
-        param.put("end_date",endDate);
-        JSONObject filtering = new JSONObject();
-        filtering.put("material_id",materialIds);
-        param.put("filtering",filtering);
-        param.put("page_size", 200);
-        param.put("page", page);
-
-        JSONObject resultJson = JSONObject.parseObject(HttpUtils.httpGetRequest("https://ad.oceanengine.com/open_api/2/report/video/get/", headers, param));
-        if (Check.isNull(resultJson)) {
-            log.warn("拉取头条视频报表返回结果为空,advertiserId:{}", oauthToken.getAccountId());
-            return;
-        }
-        if(resultJson.getInteger("code")!=0){
-            log.error("拉取头条视频表异常,advertiserId:{},message:{}", oauthToken.getAccountId(),resultJson.getString("message"));
-            return;
-        }
-        JSONObject data = resultJson.getJSONObject("data");
-        if (null == data || data.size() <= 0) {
-            log.error("拉取头条视频表异常,data is null");
-            return;
-        }
-
-        JSONArray list= data.getJSONArray("list");
-        if(list.isEmpty()){
-            log.warn("拉取头条视频表,数据为空advertiserId:{}", oauthToken.getAccountId());
-            return;
-        }
-        List<BaseReportBytedanceVideoDaily> batch =new ArrayList<>();
-        list.forEach(videoReport->{
-            JSONObject videoReportJSONObject= (JSONObject)videoReport;
-            Long materialId= videoReportJSONObject.getJSONObject("dimensions").getLong("material_id");
-            JSONObject metrics= videoReportJSONObject.getJSONObject("metrics");
-            BaseReportBytedanceVideoDaily temp= JSONObject.toJavaObject(metrics,BaseReportBytedanceVideoDaily.class);
-            temp.setMaterialShow(metrics.getLong("show"));
-            temp.setConvertMaterial(metrics.getLong("convert"));
-            temp.setAccountId(oauthToken.getAccountId());
-            temp.setMaterialId(materialId);
-            temp.setStatDatetime(startDate);
-            batch.add(temp);
-        });
-        baseReportBytedanceVideoDailyService.saveBatch(batch);
-
-        if(resultJson.getJSONObject("data").getJSONObject("page_info").getInteger("total_page")>page){
-            pullVideoReport(oauthToken, startDate, endDate, page + 1);
-        }
-    }
-
 }