ソースを参照

Merge branch 'video-dev' into test

# Conflicts:
#	module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
hcst_sunzhen 5 年 前
コミット
fce112631e
17 ファイル変更223 行追加38 行削除
  1. 21 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  2. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java
  3. 4 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  4. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml
  5. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  6. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  7. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  8. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  9. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  10. 36 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java
  11. 70 12
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java
  12. 3 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java
  13. 18 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml
  14. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java
  15. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportService.java
  16. 19 16
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java
  17. 4 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

+ 21 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -54,7 +54,6 @@ public class UserAllocationController {
     @Autowired
     private IProjectMemberService projectMemberService;
 
-
     @GetMapping(value = "/accountTurnProject")
     public Result<Object> getAccountList(Long accountId, Long projectId) {
         Result<Object> result = new Result<>();
@@ -355,4 +354,25 @@ public class UserAllocationController {
         }
         return result;
     }
+
+    /**
+     * 统计报表 查看所有账号
+     *
+     * @param projectId
+     * @return
+     */
+    @GetMapping(value = "/selectAccountListByProjectId")
+    public Result<List<UserAllocation>> selectAccountListByProjectId(Long projectId) {
+        Result<List<UserAllocation>> result = new Result<>();
+        try {
+            List<UserAllocation> userAllocations = userAllocationService.selectAccountListByProjectId(projectId);
+            result.setSuccess(true);
+            result.setResult(userAllocations);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success("查询失败");
+        }
+        return result;
+    }
+
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -36,4 +37,6 @@ public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
     List<CtopOauthToken> selectKuaiShouToken();
 
     List<CtopOauthToken> selectToutiaoToken();
+
+    CtopOauthToken getAccessTokenByAccountIdAndMediaId(@Param("mediaId")Integer mediaId, @Param("accountId")Long accountId);
 }

+ 4 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -2,6 +2,9 @@ package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @Description: 用户分配
@@ -10,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @Version: V1.0
  */
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
-
+    List<UserAllocation> selectAccountListByProjectId(@Param("projectId")Long projectId);
 }

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml

@@ -97,4 +97,13 @@
         group by account_id
     </select>
 
+    <select id="getAccessTokenByAccountIdAndMediaId" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
+        select
+        *
+        from
+        ctop_oauth_token
+        where media_id = #{mediaId}
+        and account_id = #{accountId}
+    </select>
+
 </mapper>

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

@@ -2,4 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.UserAllocationMapper">
 
+    <select id="selectAccountListByProjectId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
+        select
+        a.user_id as userId,
+        a.user_name as userName,
+        a.auth_name as authName,
+        a.account_id as accountId
+        from
+        ctop_user_allocation a
+        left join ctop_project b on a.project_id = b.id
+        where b.id = #{projectId}
+    </select>
 </mapper>

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

@@ -27,4 +27,6 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
     List<CtopOauthToken> selectKuaiShouToken();
 
     List<CtopOauthToken> selectToutiaoToken();
+
+    CtopOauthToken getAccessTokenByAccountIdAndMediaId(Integer mediaId, Long accountId);
 }

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

@@ -16,4 +16,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     UserAllocation getByAccountId(Long accountId);
 
     List<UserAllocation> getByProjectId(Long projectId, String systemType);
+
+    List<UserAllocation> selectAccountListByProjectId(Long projectId);
 }

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -191,4 +191,10 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
     public List<CtopOauthToken> selectToutiaoToken() {
         return cTopOauthTokenMapper.selectToutiaoToken();
     }
+
+
+    @Override
+    public CtopOauthToken getAccessTokenByAccountIdAndMediaId(Integer mediaId, Long accountId) {
+        return cTopOauthTokenMapper.getAccessTokenByAccountIdAndMediaId(mediaId, accountId);
+    }
 }

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

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.context.annotation.Primary;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -19,6 +20,8 @@ import java.util.List;
 @Service
 @Primary
 public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
 
     @Override
     public UserAllocation getByAccountId(Long accountId) {
@@ -39,4 +42,12 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         queryWrapper.orderByDesc("id");
         return this.list(queryWrapper);
     }
+
+    @Override
+    public List<UserAllocation> selectAccountListByProjectId(Long projectId) {
+        List<UserAllocation> list = userAllocationMapper.selectAccountListByProjectId(projectId);
+        return list;
+    }
+
+
 }

+ 36 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

@@ -77,6 +77,42 @@ public class ByteDanceVideoReportDailyController {
 		 return result;
 	 }
 
+	@AutoLog(value = "头条视频单个账户按天汇总")
+	@ApiOperation(value = "头条视频单个账户按天汇总", notes = "头条视频单个账户按天汇总")
+	@GetMapping(value = "/videoInfoListByAccountId")
+	public Result videoInfoListByAccountId(@RequestParam(name = "startDate") String startDate,
+										 @RequestParam(name = "endDate") String endDate,
+										   @RequestParam(name = "accountId") Long accountId,
+										 HttpServletRequest req){
+		Result result = new Result();
+		int days = DateUtils.dateDiff(startDate, endDate);
+		List<String> dateList = new ArrayList<>();
+		for(int i=0; i<=days; i++){
+			String endStr = DateUtils.addDay(startDate ,i);
+			dateList.add(endStr);
+			System.out.println(endStr);
+		}
+
+		final ExecutorService executorService = Executors.newFixedThreadPool(8);
+		dateList.forEach(date -> {
+			executorService.submit(new Runnable() {
+				@Override
+				public void run() {
+					try {
+						System.out.println("头条视频按天汇总接口现在在跑的时间为:" + date + "~" + date);
+						videoReportDailyService.videoInfoListByAccountId(date, date,accountId);
+					} catch (Exception e) {
+						e.printStackTrace();
+					} finally {
+					}
+				}
+			});
+		});
+
+		result.setSuccess(true);
+		return result;
+	}
+
 	@AutoLog(value = "头条视频账户视频关联方法")
 	@ApiOperation(value = "头条视频账户视频关联方法", notes = "头条视频账户视频关联方法")
 	@PostMapping(value = "/accountVideoMap")

+ 70 - 12
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

@@ -3,6 +3,7 @@ package cn.com.ctop.toutiao.modules.report.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
@@ -24,6 +25,8 @@ public class BytedanceReportController {
     private IBytedanceReportService bytedanceReportService;
     @Autowired
     private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
 
     @PostMapping("/kuaiShou/accountReport")
     public Result<JSONObject> getKuaiShouAccountReport(@RequestBody JSONObject requestJson) {
@@ -185,9 +188,28 @@ public class BytedanceReportController {
                     @Override
                     public void run() {
                         try {
-                            CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(retry.getAccountId()));
+                            String startDate = retry.getStartDate();
+                            String endDate = retry.getEndDate();
+                            Long accountId = retry.getAccountId();
+                            CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
                             log.info("头条素材报表当前accountId为:" + token.getAccountId());
-                            bytedanceReportService.bytedanceMaterialReportRetry(token, retry.getStartDate(), retry.getEndDate());
+                            //int code = bytedanceReportService.bytedanceMaterialReportRetry(token, startDate, endDate);
+
+                            Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                            String start = null;
+                            String end = null;
+                            for (int i = 0; i <= days; i++) {
+                                start = DateUtils.addDay(startDate, i);
+                                end = start;
+                                //获取头条素材报表数据
+                                int code = bytedanceReportService.bytedanceMaterialReport(token, start, end);
+                                if(code ==200 || code == 1){
+                                    //重试成功清洗数据
+                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start,end,accountId);
+                                }
+                            }
+                            byteDanceVideoReportDailyService.videoInfoListByAccountId(retry.getStartDate(), retry.getEndDate(), token.getAccountId());
+
                         } catch (Exception e) {
                             e.printStackTrace();
                         } finally {
@@ -207,18 +229,54 @@ public class BytedanceReportController {
         return result;
     }
 
+    /**
+     * 绑定头条账户之后的操作,对此账户进行素材报表数据拉取以及素材报表数据清洗
+     * @param accountId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/bytedance/bytedanceMaterialReportAndVideoReport")
+    public Result bytedanceMaterialReportAndVideoReport(@RequestParam(name = "accountId") Long accountId,
+                                          @RequestParam(name = "startDate") String startDate,
+                                          @RequestParam(name = "endDate") String endDate) {
+        Result result = new Result<>();
+        if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate) || null == accountId){
+            result.error500("开始时间和结束时间、accountId均不能为空");
+            return result;
+        }
 
+        try {
+            log.info("头条获取素材报表数据任务执行开始");
+            Long starttime = System.currentTimeMillis();
+            CtopOauthToken token = tokenService.getAccessTokenByAccountIdAndMediaId(1,accountId);
+            if (null == token) {
+                log.info("头条获取素材报表数据任务执行失败:未获取到可用的token,accountId:" + accountId);
+                return result;
+            }
 
+            Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+            String start = null;
+            String end = null;
+            for (int i = 0; i <= days; i++) {
+                start = DateUtils.addDay(startDate, i);
+                end = start;
+                //获取头条素材报表数据
+                int code = bytedanceReportService.bytedanceMaterialReport(token, start, end);
+                //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
+                if(code ==200 || code == 1){
+                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start,end,accountId);
+                }
+            }
 
-
-
-
-
-
-
-
-
-
-
+            Long endtime = System.currentTimeMillis();
+            log.info("头条获取素材报表数据任务执行结束,accountId:{},执行耗时:{}秒", accountId, (endtime - starttime) / 1000);
+        } catch (Exception e) {
+            log.error("头条获取素材报表数据任务执行结失败accountId:" + accountId);
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
 
 }

+ 3 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java

@@ -17,7 +17,9 @@ import java.util.List;
  */
 public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVideoReportDaily> {
 
-    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId);
+    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId")Long accountId);
+
+    String getCompanyIdByAccountId(@Param("accountId")Long accountId);
 
     BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds")List<Long> accountIds);
 

+ 18 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml

@@ -425,8 +425,7 @@
         and media_id = #{mediaId}
     </select>
 
-    <select id="videoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
-        select
+    <sql id="videoInfoSql">
         a.account_id as accountId,
         b.project_id as projectId,
         b.project_name as projectName,
@@ -629,10 +628,14 @@
         when sum(a.click) != 0
         then sum(a.download_start)/sum(a.click)
         else 0 end as downloadStartRate, --  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
+    </sql>
 
+    <select id="videoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
+        select
+        <include refid="videoInfoSql"></include>
         #{companyId} as companyId
         from ctop_bytedance_report_material_daily a
-        left join ctop_user_allocation b on a.account_id = b.account_id
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
         left join user_company c on b.user_id = c.user_id
         left join ctop_bytedance_video_info d on a.material_id = d.material_id
         left join (select code,url,material_name from ctop_material_info group by code) e on d.signature = e.code
@@ -641,9 +644,21 @@
         'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL')
         and date_format(stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         and date_format(stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+        <if test="accountId != null">
+            and a.account_id = #{accountId}
+        </if>
         group by `statDatetime`,`accountId`,`signature`
     </select>
 
+    <select id="getCompanyIdByAccountId" resultType="string">
+        select
+        c.company_id
+        from
+        ctop_user_allocation b
+        left join user_company c on b.user_id = c.user_id
+        where b.account_id = #{accountId}
+    </select>
+
     <select id="videoInfoListGroupOperator" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
         select
         <include refid="selectSql"></include>

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

@@ -17,6 +17,8 @@ public interface IByteDanceVideoReportDailyService extends IService<ByteDanceVid
 
     void videoInfoList(String startDate, String endDate);
 
+    void videoInfoListByAccountId(String startDate, String endDate, Long accountId);
+
     PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort);
 
     PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort);

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportService.java

@@ -37,9 +37,9 @@ public interface IBytedanceReportService {
 
     void bytedanceAsyncTaskGet();
 
-    void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate);
+    int bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate);
 
-    void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate);
+    int bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate);
 
     List<BytedanceReportMaterialRetry> getRetryList();
 }

+ 19 - 16
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
@@ -20,6 +21,7 @@ import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.logging.Logger;
 
 /**
  * 视频按时间段统计
@@ -28,6 +30,7 @@ import java.util.List;
  * @version V1.0
  */
 @Service
+@Slf4j
 public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceVideoReportDailyMapper, ByteDanceVideoReportDaily> implements IByteDanceVideoReportDailyService {
 
     @Autowired
@@ -49,27 +52,27 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         wrapper.eq("company_id", companyId);
         byteDanceVideoReportDailyMapper.delete(wrapper);
 
-        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId);
+        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId, null);
         for (ByteDanceVideoReportDaily m:mList){
             byteDanceVideoReportDailyMapper.insert(m);
         }
+    }
 
-        //QueryWrapper<ByteDanceVideoReportDaily> queryWrapper = new QueryWrapper<>();
+    //根据accountId和时间清洗头条素材为头条视频报表数据
+    public void videoInfoListByAccountId(String startDate, String endDate, Long accountId){
+        QueryWrapper<ByteDanceVideoReportDaily> wrapper = new QueryWrapper<>();
+        wrapper.ge("stat_datetime",startDate);
+        wrapper.le("stat_datetime",endDate);
+        wrapper.eq("account_id", accountId);
+        byteDanceVideoReportDailyMapper.delete(wrapper);
 
-        //List<ByteDanceVideoReportDaily> mList2 = byteDanceVideoReportDailyMapper.selectList(wrapper);
-        //
-        //for(ByteDanceVideoReportDaily m:mList2){
-        //    String statDate  = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
-        //    BigDecimal cost = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(statDate,statDate,m.getSignature(),companyId);
-        //
-        //    BigDecimal huanbi =BigDecimal.ZERO;
-        //    if(cost != null && cost.compareTo(BigDecimal.ZERO)>0){
-        //        huanbi = m.getCost().subtract(cost).divide(cost,7, BigDecimal.ROUND_HALF_UP);
-        //    }
-        //
-        //    m.setHuanbi(huanbi);
-        //    byteDanceVideoReportDailyMapper.updateById(m);
-        //}
+        String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByAccountId(accountId);
+
+        List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId, accountId);
+        for (ByteDanceVideoReportDaily m:mList){
+            byteDanceVideoReportDailyMapper.insert(m);
+        }
+        log.info("根据accountId和时间清洗头条素材为头条视频报表数据结束,开始时间:{},结束时间:{},accountId:{}",startDate,endDate,accountId );
     }
 
     //视频按天列表

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

@@ -710,7 +710,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     /////////////////////////////////////////////////////////\
     //素材报表
     @Override
-    public void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate) {
+    public int bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate) {
         Long accountId = token.getAccountId();
         // log.info("头条素材报表当前accountId为:" + accountId);
         Integer page = 1;
@@ -729,10 +729,11 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             retry.setStatus(1);
             bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
         }
+        return code;
     }
 
     @Override
-    public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate) {
+    public int bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate) {
         Long accountId = token.getAccountId();
         // log.info("头条素材报表当前accountId为:" + accountId);
         Integer page = 1;
@@ -747,6 +748,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             retry.setStatusCode(code);
             bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
         }
+        return code;
     }
 
     private int bytedanceMaterialReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate) {