ソースを参照

异步报表、素材报表

hcst_sunzhen 5 年 前
コミット
686a26a39c
26 ファイル変更2212 行追加18 行削除
  1. 47 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  2. 59 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ToutiaoMaterialsLoadJob.java
  3. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java
  4. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  5. 12 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml
  6. 48 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  7. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  8. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  9. 12 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  10. 40 6
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  11. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java
  12. 243 0
      module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceDailyReportTaskController.java
  13. 66 4
      module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java
  14. 243 0
      module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportMaterialDailyController.java
  15. 73 0
      module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceDailyReportTask.java
  16. 448 0
      module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceReportMaterialDaily.java
  17. 17 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceDailyReportTaskMapper.java
  18. 18 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceReportMaterialDailyMapper.java
  19. 5 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceDailyReportTaskMapper.xml
  20. 208 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  21. 14 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceDailyReportTaskService.java
  22. 14 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceReportMaterialDailyService.java
  23. 9 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceReportService.java
  24. 19 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceDailyReportTaskServiceImpl.java
  25. 19 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportMaterialDailyServiceImpl.java
  26. 580 4
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

+ 47 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -45,10 +45,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 素材信息
@@ -496,4 +493,50 @@ public class MaterialInfoController {
         return Result.ok("文件导入失败!");
     }
 
+    @AutoLog(value = "获取有效素材")
+    @ApiOperation(value = "获取有效素材", notes = "获取有效素材")
+    @GetMapping(value = "/effiMaterialInfo")
+    public Result<IPage<MaterialInfo>> effiMaterialInfo(MaterialInfo materialInfo,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<MaterialInfo>> result = new Result<>();
+        QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
+
+        List<String> effiList = materialInfoService.getEffiCode();
+        Object createTime = materialInfo.getCreateTime();
+        materialInfo.setCreateTime(null);
+        queryWrapper.in("code", effiList);
+        queryWrapper.groupBy("code");
+        //queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
+
+        Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
+        IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
+
+        List<MaterialInfo> materialInfoList = pageList.getRecords();
+        if (materialInfoList.size() != 0) {
+            for (MaterialInfo material : materialInfoList) {
+                //判断是否已经同步到快手平台
+                Integer kuaishouMaterialUpCount = materialInfoService.getKuaishouUpVideoCount(material.getCode());
+                if (kuaishouMaterialUpCount > 0) {
+                    material.setKuaishouVideoIsUp(1);
+                } else {
+                    material.setKuaishouVideoIsUp(0);
+                }
+                //判断是否已经同步到抖音平台
+                Integer toutiaoMaterialUpCount = materialInfoService.getToutiaoUpVideoCount(material.getCode());
+                if (toutiaoMaterialUpCount > 0) {
+                    material.setToutiaoVideoIsUp(1);
+                } else {
+                    material.setToutiaoVideoIsUp(0);
+                }
+            }
+        }
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+
 }

+ 59 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ToutiaoMaterialsLoadJob.java

@@ -0,0 +1,59 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.bytedance.service.IBytedanceReportService;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class ToutiaoMaterialsLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                //增加接口的开始和结束日期
+                String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+                String endDate = startDate;
+                //获取头条token数据
+                List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+                executorService = Executors.newFixedThreadPool(8);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                //获取头条素材报表数据
+                                bytedanceReportService.bytedanceMaterialReport(token,startDate,endDate);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("头条素材数据同步完成,"+ "开始时间:" + startDate + ",结束时间:" + endDate);
+            }
+        };
+        thread.start();
+
+    }
+}

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

@@ -34,4 +34,6 @@ public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
     CtopOauthToken selectByAccountId(Long accountId);
 
     List<CtopOauthToken> selectKuaiShouToken();
+
+    List<CtopOauthToken> selectToutiaoToken();
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -27,4 +28,8 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     Integer getToutiaoUpVideoCount(@Param("code") String code);
 
     JSONObject getGeneralizationInfo(@Param("code") String code);
+
+    List<String> getEffiSignature();
+
+    MaterialInfo getMaterialInfoByCode(@Param("code")String code);
 }

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

@@ -85,4 +85,16 @@
         and t1.media_id = 2
 
     </select>
+
+    <select id="selectToutiaoToken" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
+        select  t1.*
+        from ctop_oauth_token t1
+        left join ctop_user_allocation t2
+        on t1.account_id = t2.account_id
+        where t2.account_status = 0
+        and t1.media_id = 1
+        and user_id != 'e9ca23d68d884d4ebb19d07889727dae' <!-- 去掉管理员 -->
+        group by account_id
+    </select>
+
 </mapper>

+ 48 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -86,5 +86,53 @@
 	  )t
     </select>
 
+    <select id="getEffiSignature" resultType="string">
+        select
+        efficient_video_signature
+        from ctop_user_efficient_video_map
+        where company_id is not null
+        group by efficient_video_signature
+
+    </select>
+
+    <!--TODO -->
+    <select id="getEffiSignatureCount" resultType="integer">
+        select
+        count(1)
+        from
+            (
+            select
+            efficient_video_signature
+            from ctop_user_efficient_video_map
+            where company_id is not null
+            group by efficient_video_signature
+            ) a
+    </select>
+
+    <select id="getMaterialInfoByCode" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
+            select
+            id,
+            code,
+            url,
+            watermark_code as watermarkCode,
+            material_name as materialName,
+            watermark_url as watermarkUrl,
+            watermark_material_name as watermarkMaterialName,
+            user_id as userId,
+            auditor_id as auditorId,
+            status as status,
+            material_describe as materialDescribe,
+            project_id as projectId,
+            refuse_reason as refuseReason,
+            creative_copywriter as creativeCopywriter,
+            refuse_file as refuseFile,
+            excellent,
+            type
+        from
+        ctop_material_info
+        where code = #{code}
+        limit 1
+    </select>
+
 
 </mapper>

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

@@ -25,4 +25,6 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
     List<CtopOauthToken> getTokenListByType(String platformTypeBytedance);
 
     List<CtopOauthToken> selectKuaiShouToken();
+
+    List<CtopOauthToken> selectToutiaoToken();
 }

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -57,4 +58,9 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
      * @return
      */
     Map<String, Object> insertImage(JSONObject json);
+
+
+    List<MaterialInfo> effiMaterialInfo();
+
+    List<String> getEffiCode();
 }

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

@@ -168,4 +168,16 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
     public List<CtopOauthToken> selectKuaiShouToken() {
         return cTopOauthTokenMapper.selectKuaiShouToken();
     }
+
+
+    /**
+     * 获取toutiao有效账户列表
+     *
+     * @return
+     */
+
+    @Override
+    public List<CtopOauthToken> selectToutiaoToken() {
+        return cTopOauthTokenMapper.selectToutiaoToken();
+    }
 }

+ 40 - 6
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -24,10 +24,7 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.nio.channels.FileChannel;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.regex.Pattern;
@@ -47,6 +44,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IVideoWatermarkTemplateService videoWatermarkTemplateService;
     @Autowired
     private IVideoWatermarkTaskService videoWatermarkTaskService;
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
     @Value("${oss.replace.replace-value}")
     private String replaceValue;
     @Value("${oss.replace.replace-old-value}")
@@ -244,8 +243,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
      * @return
      */
 
-    @Autowired
-    private MaterialInfoMapper materialInfoMapper;
+    //@Autowired
+    //private MaterialInfoMapper materialInfoMapper;
 
 
     @Override
@@ -546,4 +545,39 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
         return resultMap;
     }
+
+    public List<String> getEffiCode(){
+        return materialInfoMapper.getEffiSignature();
+    }
+
+    public List<MaterialInfo> effiMaterialInfo(){
+        List<MaterialInfo> materialInfoList = new ArrayList<>();
+        List<String> effiSignatureList = materialInfoMapper.getEffiSignature();
+        for(String code:effiSignatureList){
+            MaterialInfo materialInfo = materialInfoMapper.getMaterialInfoByCode(code);
+
+            if (materialInfo == null){
+                continue;
+            }
+            //判断是否已经同步到快手平台
+            Integer kuaishouMaterialUpCount = materialInfoMapper.getKuaishouUpVideoCount(code);
+            if (kuaishouMaterialUpCount > 0) {
+                materialInfo.setKuaishouVideoIsUp(1);
+            } else {
+                materialInfo.setKuaishouVideoIsUp(0);
+            }
+            //判断是否已经同步到抖音平台
+            Integer toutiaoMaterialUpCount = materialInfoMapper.getToutiaoUpVideoCount(code);
+            if (toutiaoMaterialUpCount > 0) {
+                materialInfo.setToutiaoVideoIsUp(1);
+            } else {
+                materialInfo.setToutiaoVideoIsUp(0);
+            }
+            materialInfoList.add(materialInfo);
+        }
+
+        return materialInfoList;
+    }
+
+
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java

@@ -24,6 +24,9 @@ public class CtopAdConstant {
     public static final String KUAISHOU_LOAD_JOB_TYPE_HISTORY = "history";
     public static final String KUAISHOU_LOAD_JOB_TYPE_DAILY = "daily";
 
+    public static final String BYTEDANCE_LOAD_JOB_TYPE_ASYNC = "async";
+    public static final String BYTEDANCE_LOAD_JOB_TYPE_DAILY = "daily";
+
     /**
      * 销售角色Id
      */

+ 243 - 0
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceDailyReportTaskController.java

@@ -0,0 +1,243 @@
+package cn.com.ctop.bytedance.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.bytedance.entity.BytedanceDailyReportTask;
+import cn.com.ctop.bytedance.service.IBytedanceDailyReportTaskService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 头条异步报表任务表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条异步报表任务表")
+@RestController
+@RequestMapping("/bytedance/bytedanceDailyReportTask")
+public class BytedanceDailyReportTaskController {
+	@Autowired
+	private IBytedanceDailyReportTaskService bytedanceDailyReportTaskService;
+	
+	/**
+	  * 分页列表查询
+	 * @param bytedanceDailyReportTask
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-分页列表查询")
+	@ApiOperation(value="头条异步报表任务表-分页列表查询", notes="头条异步报表任务表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceDailyReportTask>> queryPageList(BytedanceDailyReportTask bytedanceDailyReportTask,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<BytedanceDailyReportTask>> result = new Result<IPage<BytedanceDailyReportTask>>();
+		QueryWrapper<BytedanceDailyReportTask> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceDailyReportTask, req.getParameterMap());
+		Page<BytedanceDailyReportTask> page = new Page<BytedanceDailyReportTask>(pageNo, pageSize);
+		IPage<BytedanceDailyReportTask> pageList = bytedanceDailyReportTaskService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param bytedanceDailyReportTask
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-添加")
+	@ApiOperation(value="头条异步报表任务表-添加", notes="头条异步报表任务表-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceDailyReportTask> add(@RequestBody BytedanceDailyReportTask bytedanceDailyReportTask) {
+		Result<BytedanceDailyReportTask> result = new Result<BytedanceDailyReportTask>();
+		try {
+			bytedanceDailyReportTaskService.save(bytedanceDailyReportTask);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param bytedanceDailyReportTask
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-编辑")
+	@ApiOperation(value="头条异步报表任务表-编辑", notes="头条异步报表任务表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceDailyReportTask> edit(@RequestBody BytedanceDailyReportTask bytedanceDailyReportTask) {
+		Result<BytedanceDailyReportTask> result = new Result<BytedanceDailyReportTask>();
+		BytedanceDailyReportTask bytedanceDailyReportTaskEntity = bytedanceDailyReportTaskService.getById(bytedanceDailyReportTask.getId());
+		if(bytedanceDailyReportTaskEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceDailyReportTaskService.updateById(bytedanceDailyReportTask);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-通过id删除")
+	@ApiOperation(value="头条异步报表任务表-通过id删除", notes="头条异步报表任务表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			bytedanceDailyReportTaskService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-批量删除")
+	@ApiOperation(value="头条异步报表任务表-批量删除", notes="头条异步报表任务表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceDailyReportTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<BytedanceDailyReportTask> result = new Result<BytedanceDailyReportTask>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceDailyReportTaskService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "头条异步报表任务表-通过id查询")
+	@ApiOperation(value="头条异步报表任务表-通过id查询", notes="头条异步报表任务表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceDailyReportTask> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceDailyReportTask> result = new Result<BytedanceDailyReportTask>();
+		BytedanceDailyReportTask bytedanceDailyReportTask = bytedanceDailyReportTaskService.getById(id);
+		if(bytedanceDailyReportTask==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceDailyReportTask);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<BytedanceDailyReportTask> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              BytedanceDailyReportTask bytedanceDailyReportTask = JSON.parseObject(deString, BytedanceDailyReportTask.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(bytedanceDailyReportTask, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<BytedanceDailyReportTask> pageList = bytedanceDailyReportTaskService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "头条异步报表任务表列表");
+      mv.addObject(NormalExcelConstants.CLASS, BytedanceDailyReportTask.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("头条异步报表任务表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BytedanceDailyReportTask> listBytedanceDailyReportTasks = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceDailyReportTask.class, params);
+              bytedanceDailyReportTaskService.saveBatch(listBytedanceDailyReportTasks);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceDailyReportTasks.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 66 - 4
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java

@@ -1,15 +1,18 @@
 package cn.com.ctop.bytedance.controller;
 
 import cn.com.ctop.bytedance.service.IBytedanceReportService;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 
 @Slf4j
@@ -18,6 +21,8 @@ import java.util.List;
 public class BytedanceReportController {
     @Autowired
     private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
 
     /**
      * 昨日总花费
@@ -93,5 +98,62 @@ public class BytedanceReportController {
 
     }
 
+    @PostMapping("/bytedance/async")
+    public Result<List<JSONObject>> asyncTaskCreate(@RequestBody JSONObject requestJson) {
+
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            bytedanceReportService.bytedanceAsyncTaskCreate();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+
+    }
+
+    @PostMapping("/bytedance/async/taskGet")
+    public Result<List<JSONObject>> bytedanceAsyncTaskGet(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            bytedanceReportService.bytedanceAsyncTaskGet();
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+    @GetMapping("/bytedance/bytedanceMaterialReport")
+    public Result bytedanceMaterialReport(@RequestParam(name = "startDate")String startDate,
+                                                            @RequestParam(name = "endDate")String endDate) {
+        Result result = new Result<>();
+        if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            result.error500("开始时间和结束时间不能为空");
+            return result;
+        }
+
+        try {
+            log.info("头条获取素材报表数据任务执行开始");
+            Long start = System.currentTimeMillis();
+            List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+            if (null == tokens || tokens.size() <= 0) {
+                log.info("头条获取素材报表数据任务执行失败:未获取到可用的token");
+                return result;
+            }
+            for (CtopOauthToken token : tokens) {
+                //if(token.getAccountId() == 1662649623517198L){
+                    bytedanceReportService.bytedanceMaterialReport(token,startDate,endDate);
+                //}
+            }
+            Long end = System.currentTimeMillis();
+            log.info("头条获取素材报表数据任务执行结束,执行耗时:{}秒", (end - start) / 1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
 
 }

+ 243 - 0
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportMaterialDailyController.java

@@ -0,0 +1,243 @@
+package cn.com.ctop.bytedance.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.bytedance.entity.BytedanceReportMaterialDaily;
+import cn.com.ctop.bytedance.service.IBytedanceReportMaterialDailyService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 素材报表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="素材报表")
+@RestController
+@RequestMapping("/bytedance/bytedanceReportMaterialDaily")
+public class BytedanceReportMaterialDailyController {
+	@Autowired
+	private IBytedanceReportMaterialDailyService bytedanceReportMaterialDailyService;
+	
+	/**
+	  * 分页列表查询
+	 * @param bytedanceReportMaterialDaily
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-分页列表查询")
+	@ApiOperation(value="素材报表-分页列表查询", notes="素材报表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceReportMaterialDaily>> queryPageList(BytedanceReportMaterialDaily bytedanceReportMaterialDaily,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<BytedanceReportMaterialDaily>> result = new Result<IPage<BytedanceReportMaterialDaily>>();
+		QueryWrapper<BytedanceReportMaterialDaily> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceReportMaterialDaily, req.getParameterMap());
+		Page<BytedanceReportMaterialDaily> page = new Page<BytedanceReportMaterialDaily>(pageNo, pageSize);
+		IPage<BytedanceReportMaterialDaily> pageList = bytedanceReportMaterialDailyService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param bytedanceReportMaterialDaily
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-添加")
+	@ApiOperation(value="素材报表-添加", notes="素材报表-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceReportMaterialDaily> add(@RequestBody BytedanceReportMaterialDaily bytedanceReportMaterialDaily) {
+		Result<BytedanceReportMaterialDaily> result = new Result<BytedanceReportMaterialDaily>();
+		try {
+			bytedanceReportMaterialDailyService.save(bytedanceReportMaterialDaily);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param bytedanceReportMaterialDaily
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-编辑")
+	@ApiOperation(value="素材报表-编辑", notes="素材报表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceReportMaterialDaily> edit(@RequestBody BytedanceReportMaterialDaily bytedanceReportMaterialDaily) {
+		Result<BytedanceReportMaterialDaily> result = new Result<BytedanceReportMaterialDaily>();
+		BytedanceReportMaterialDaily bytedanceReportMaterialDailyEntity = bytedanceReportMaterialDailyService.getById(bytedanceReportMaterialDaily.getId());
+		if(bytedanceReportMaterialDailyEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceReportMaterialDailyService.updateById(bytedanceReportMaterialDaily);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-通过id删除")
+	@ApiOperation(value="素材报表-通过id删除", notes="素材报表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			bytedanceReportMaterialDailyService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-批量删除")
+	@ApiOperation(value="素材报表-批量删除", notes="素材报表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceReportMaterialDaily> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<BytedanceReportMaterialDaily> result = new Result<BytedanceReportMaterialDaily>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceReportMaterialDailyService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "素材报表-通过id查询")
+	@ApiOperation(value="素材报表-通过id查询", notes="素材报表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceReportMaterialDaily> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceReportMaterialDaily> result = new Result<BytedanceReportMaterialDaily>();
+		BytedanceReportMaterialDaily bytedanceReportMaterialDaily = bytedanceReportMaterialDailyService.getById(id);
+		if(bytedanceReportMaterialDaily==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceReportMaterialDaily);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<BytedanceReportMaterialDaily> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              BytedanceReportMaterialDaily bytedanceReportMaterialDaily = JSON.parseObject(deString, BytedanceReportMaterialDaily.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(bytedanceReportMaterialDaily, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<BytedanceReportMaterialDaily> pageList = bytedanceReportMaterialDailyService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "素材报表列表");
+      mv.addObject(NormalExcelConstants.CLASS, BytedanceReportMaterialDaily.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材报表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BytedanceReportMaterialDaily> listBytedanceReportMaterialDailys = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceReportMaterialDaily.class, params);
+              bytedanceReportMaterialDailyService.saveBatch(listBytedanceReportMaterialDailys);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceReportMaterialDailys.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 73 - 0
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceDailyReportTask.java

@@ -0,0 +1,73 @@
+package cn.com.ctop.bytedance.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 头条异步报表任务表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_daily_report_task")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_daily_report_task对象", description="头条异步报表任务表")
+public class BytedanceDailyReportTask {
+
+	/**主键ID*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+	private Integer id;
+	/**广告账户ID(相当于头条返回的access_token数据中的advertiser_id)*/
+	@Excel(name = "广告账户ID(相当于头条返回的access_token数据中的advertiser_id)", width = 15)
+    @ApiModelProperty(value = "广告账户ID(相当于头条返回的access_token数据中的advertiser_id)")
+	private Long accountId;
+	/**任务id*/
+	@Excel(name = "任务id", width = 15)
+    @ApiModelProperty(value = "任务id")
+	private Long taskId;
+	/**任务名称*/
+	@Excel(name = "任务名称", width = 15)
+    @ApiModelProperty(value = "任务名称")
+	private String taskName;
+	/**任务类型REPORT-普通报表;REPORT_DPA-DPA报表;REPORT_BIDWORD-关键词/搜索词报表*/
+	@Excel(name = "任务类型REPORT-普通报表;REPORT_DPA-DPA报表;REPORT_BIDWORD-关键词/搜索词报表", width = 15)
+    @ApiModelProperty(value = "任务类型REPORT-普通报表;REPORT_DPA-DPA报表;REPORT_BIDWORD-关键词/搜索词报表")
+	private String taskType;
+	/**任务创建时间*/
+	@Excel(name = "任务创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "任务创建时间")
+	private Date taskCreateTime;
+	/**任务参数*/
+	@Excel(name = "任务参数", width = 15)
+    @ApiModelProperty(value = "任务参数")
+	private Object taskParams;
+	/**返回参数*/
+	@Excel(name = "返回参数", width = 15)
+    @ApiModelProperty(value = "返回参数")
+	private Object json;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**修改时间*/
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+
+    private String taskStatus;
+}

+ 448 - 0
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceReportMaterialDaily.java

@@ -0,0 +1,448 @@
+package cn.com.ctop.bytedance.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 素材报表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_report_material_daily")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_report_material_daily对象", description="素材报表")
+public class BytedanceReportMaterialDaily {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**广告主id*/
+	@Excel(name = "广告主id", width = 15)
+    @ApiModelProperty(value = "广告主id")
+	private Long accountId;
+	/**数据起始时间1*/
+	@Excel(name = "数据起始时间1", width = 15)
+    @ApiModelProperty(value = "数据起始时间1")
+	private String statDatetime;
+	///**展示量*/
+	//@Excel(name = "展示量", width = 15)
+    //@ApiModelProperty(value = "展示量")
+	//private Integer showNum;
+	/**点击量1*/
+	@Excel(name = "点击量1", width = 15)
+    @ApiModelProperty(value = "点击量1")
+	private Integer click;
+	///**转化量*/
+	//@Excel(name = "转化量", width = 15)
+    //@ApiModelProperty(value = "转化量")
+	//private Integer convertNum;
+	/**总花费1*/
+	@Excel(name = "总花费1", width = 15)
+    @ApiModelProperty(value = "总花费1")
+	private java.math.BigDecimal cost;
+	/**应用下载-激活1*/
+	@Excel(name = "应用下载-激活1", width = 15)
+    @ApiModelProperty(value = "应用下载-激活1")
+	private Integer active;
+	/**应用下载-安卓下载完成1*/
+	@Excel(name = "应用下载-安卓下载完成1", width = 15)
+    @ApiModelProperty(value = "应用下载-安卓下载完成1")
+	private Integer downloadFinish;
+	/**应用下载-安卓下载开始1*/
+	@Excel(name = "应用下载-安卓下载开始1", width = 15)
+    @ApiModelProperty(value = "应用下载-安卓下载开始1")
+	private Integer downloadStart;
+	///**应用下载-点击安装数*/
+	//@Excel(name = "应用下载-点击安装数", width = 15)
+    //@ApiModelProperty(value = "应用下载-点击安装数")
+	//private Integer clickInstall;
+	/**应用下载-安卓安装完成*/
+	@Excel(name = "应用下载-安卓安装完成", width = 15)
+    @ApiModelProperty(value = "应用下载-安卓安装完成")
+	private Integer installFinish;
+	/**应用下载-注册1*/
+	@Excel(name = "应用下载-注册1", width = 15)
+    @ApiModelProperty(value = "应用下载-注册1")
+	private Integer register;
+	/**应用下载-付费数1*/
+	@Excel(name = "应用下载-付费数1", width = 15)
+    @ApiModelProperty(value = "应用下载-付费数1")
+	private Integer payCount;
+	/**应用下载-到达uv1*/
+	@Excel(name = "应用下载-到达uv1", width = 15)
+    @ApiModelProperty(value = "应用下载-到达uv1")
+	private Integer inAppUv;
+	/**应用下载-详情页到站uv1*/
+	@Excel(name = "应用下载-详情页到站uv1", width = 15)
+    @ApiModelProperty(value = "应用下载-详情页到站uv1")
+	private Integer inAppDetailUv;
+	/**应用下载-加入购物车1*/
+	@Excel(name = "应用下载-加入购物车1", width = 15)
+    @ApiModelProperty(value = "应用下载-加入购物车1")
+	private Integer inAppCart;
+	/**应用下载-提交订单1*/
+	@Excel(name = "应用下载-提交订单1", width = 15)
+    @ApiModelProperty(value = "应用下载-提交订单1")
+	private Integer inAppOrder;
+	/**应用下载-付费1*/
+	@Excel(name = "应用下载-付费1", width = 15)
+    @ApiModelProperty(value = "应用下载-付费1")
+	private Integer inAppPay;
+	/**落地页-电话拨打数1*/
+	@Excel(name = "落地页-电话拨打数1", width = 15)
+    @ApiModelProperty(value = "落地页-电话拨打数1")
+	private Integer phone;
+	/**表单提交数1*/
+	@Excel(name = "表单提交数1", width = 15)
+    @ApiModelProperty(value = "表单提交数1")
+	private Integer form;
+	/**落地页-地图搜索1*/
+	@Excel(name = "落地页-地图搜索1", width = 15)
+    @ApiModelProperty(value = "落地页-地图搜索1")
+	private Integer mapSearch;
+	/**落地页-按钮button1*/
+	@Excel(name = "落地页-按钮button1", width = 15)
+    @ApiModelProperty(value = "落地页-按钮button1")
+	private Integer button;
+	/**落地页-关键页面浏览1*/
+	@Excel(name = "落地页-关键页面浏览1", width = 15)
+    @ApiModelProperty(value = "落地页-关键页面浏览1")
+	private Integer viewMaterial;
+	/**落地页-QQ咨询数1*/
+	@Excel(name = "落地页-QQ咨询数1", width = 15)
+    @ApiModelProperty(value = "落地页-QQ咨询数1")
+	private Integer qq;
+	/**落地页-抽奖数1*/
+	@Excel(name = "落地页-抽奖数1", width = 15)
+    @ApiModelProperty(value = "落地页-抽奖数1")
+	private Integer lottery;
+	/**落地页-投票1*/
+	@Excel(name = "落地页-投票1", width = 15)
+    @ApiModelProperty(value = "落地页-投票1")
+	private Integer vote;
+	/**落地页-页面跳转1*/
+	@Excel(name = "落地页-页面跳转1", width = 15)
+    @ApiModelProperty(value = "落地页-页面跳转1")
+	private Integer redirect;
+	/**落地页-商品购买1*/
+	@Excel(name = "落地页-商品购买1", width = 15)
+    @ApiModelProperty(value = "落地页-商品购买1")
+	private Integer shopping;
+	/**落地页-在线咨询1*/
+	@Excel(name = "落地页-在线咨询1", width = 15)
+    @ApiModelProperty(value = "落地页-在线咨询1")
+	private Integer consult;
+	/**落地页-微信1*/
+	@Excel(name = "落地页-微信1", width = 15)
+    @ApiModelProperty(value = "落地页-微信1")
+	private Integer wechat;
+	/**落地页-智能电话确认拨打1*/
+	@Excel(name = "落地页-智能电话确认拨打1", width = 15)
+    @ApiModelProperty(value = "落地页-智能电话确认拨打1")
+	private Integer phoneConfirm;
+	/**落地页-智能电话确认接通1*/
+	@Excel(name = "落地页-智能电话确认接通1", width = 15)
+    @ApiModelProperty(value = "落地页-智能电话确认接通1")
+	private Integer phoneConnect;
+	/**落地页-智能电话有效咨询1*/
+	@Excel(name = "落地页-智能电话有效咨询1", width = 15)
+    @ApiModelProperty(value = "落地页-智能电话有效咨询1")
+	private Integer consultEffective;
+	/**视频-总播放1*/
+	@Excel(name = "视频-总播放1", width = 15)
+    @ApiModelProperty(value = "视频-总播放1")
+	private Integer totalPlay;
+	/**视频-有效播放1*/
+	@Excel(name = "视频-有效播放1", width = 15)
+    @ApiModelProperty(value = "视频-有效播放1")
+	private Integer validPlay;
+	/**视频-wifi播放1*/
+	@Excel(name = "视频-wifi播放1", width = 15)
+    @ApiModelProperty(value = "视频-wifi播放1")
+	private Integer wifiPlay;
+	/**视频-播放时长,单位ms1*/
+	@Excel(name = "视频-播放时长,单位ms1", width = 15)
+    @ApiModelProperty(value = "视频-播放时长,单位ms1")
+	private Integer playDurationSum;
+	/**视频-播放25%进度总数1*/
+	@Excel(name = "视频-播放25%进度总数1", width = 15)
+    @ApiModelProperty(value = "视频-播放25%进度总数1")
+	private Integer play25FeedBreak;
+	/**视频-播放50%进度总数1*/
+	@Excel(name = "视频-播放50%进度总数1", width = 15)
+    @ApiModelProperty(value = "视频-播放50%进度总数1")
+	private Integer play50FeedBreak;
+	/**视频-播放75%进度总数*/
+	@Excel(name = "视频-播放75%进度总数", width = 15)
+    @ApiModelProperty(value = "视频-播放75%进度总数")
+	private Integer play75FeedBreak;
+	/**视频-播放100%进度总数1*/
+	@Excel(name = "视频-播放100%进度总数1", width = 15)
+    @ApiModelProperty(value = "视频-播放100%进度总数1")
+	private Integer play100FeedBreak;
+	/**附加创意-电话按钮1*/
+	@Excel(name = "附加创意-电话按钮1", width = 15)
+    @ApiModelProperty(value = "附加创意-电话按钮1")
+	private Integer advancedCreativePhoneClick;
+	/**附加创意-在线咨询1*/
+	@Excel(name = "附加创意-在线咨询1", width = 15)
+    @ApiModelProperty(value = "附加创意-在线咨询1")
+	private Integer advancedCreativeCounselClick;
+	/**附加创意-表单提交1*/
+	@Excel(name = "附加创意-表单提交1", width = 15)
+    @ApiModelProperty(value = "附加创意-表单提交1")
+	private Integer advancedCreativeFormClick;
+	/**互动数据-分享数1*/
+	@Excel(name = "互动数据-分享数1", width = 15)
+    @ApiModelProperty(value = "互动数据-分享数1")
+	private Integer shareMaterial;
+	/**互动数据-评论数1*/
+	@Excel(name = "互动数据-评论数1", width = 15)
+    @ApiModelProperty(value = "互动数据-评论数1")
+	private Integer commentMaterial;
+	///**互动数据-点赞数*/
+	//@Excel(name = "互动数据-点赞数", width = 15)
+    //@ApiModelProperty(value = "互动数据-点赞数")
+	//private Integer likeNum;
+	/**互动数据-关注数1*/
+	@Excel(name = "互动数据-关注数1", width = 15)
+    @ApiModelProperty(value = "互动数据-关注数1")
+	private Integer follow;
+	/**互动数据-主页访问量1*/
+	@Excel(name = "互动数据-主页访问量1", width = 15)
+    @ApiModelProperty(value = "互动数据-主页访问量1")
+	private Integer homeVisited;
+	/**互动数据-挑战赛查看数1*/
+	@Excel(name = "互动数据-挑战赛查看数1", width = 15)
+    @ApiModelProperty(value = "互动数据-挑战赛查看数1")
+	private Integer iesChallengeClick;
+	/**互动数据-音乐查看数1*/
+	@Excel(name = "互动数据-音乐查看数1", width = 15)
+    @ApiModelProperty(value = "互动数据-音乐查看数1")
+	private Integer iesMusicClick;
+	///**互动数据-单次互动成本*/
+	//@Excel(name = "互动数据-单次互动成本", width = 15)
+    //@ApiModelProperty(value = "互动数据-单次互动成本")
+	//private java.math.BigDecimal interactPerCost;
+	/**次留数1*/
+	@Excel(name = "次留数1", width = 15)
+    @ApiModelProperty(value = "次留数1")
+	private Integer nextDayOpen;
+	/**次留率1*/
+	@Excel(name = "次留率1", width = 15)
+    @ApiModelProperty(value = "次留率1")
+	private java.math.BigDecimal nextDayOpenRate;
+	/**次留成本*/
+	@Excel(name = "次留成本", width = 15)
+    @ApiModelProperty(value = "次留成本")
+	private java.math.BigDecimal nextDayOpenCost;
+	///**createTime*/
+    //@ApiModelProperty(value = "createTime")
+	//private Date createTime;
+	///**updateTime*/
+    //@ApiModelProperty(value = "updateTime")
+	//private Date updateTime;
+	/**素材类型*/
+	@Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+	private String imageMode;
+	/**素材id*/
+	@Excel(name = "素材id", width = 15)
+    @ApiModelProperty(value = "素材id")
+	private Long materialId;
+	/**投放位置*/
+	@Excel(name = "投放位置", width = 15)
+    @ApiModelProperty(value = "投放位置")
+	private String inventory;
+	/**activePayAmount*/
+	@Excel(name = "activePayAmount", width = 15)
+    @ApiModelProperty(value = "activePayAmount")
+	private Integer activePayAmount;
+	/**validPlayCost*/
+	@Excel(name = "validPlayCost", width = 15)
+    @ApiModelProperty(value = "validPlayCost")
+	private java.math.BigDecimal validPlayCost;
+	/**advancedCreativeCouponAddition*/
+	@Excel(name = "advancedCreativeCouponAddition", width = 15)
+    @ApiModelProperty(value = "advancedCreativeCouponAddition")
+	private Integer advancedCreativeCouponAddition;
+	/**convert*/
+	@Excel(name = "convert", width = 15)
+    @ApiModelProperty(value = "convert")
+	private Integer convertMaterial;
+	/**activePayCost*/
+	@Excel(name = "activePayCost", width = 15)
+    @ApiModelProperty(value = "activePayCost")
+	private java.math.BigDecimal activePayCost;
+	/**download*/
+	@Excel(name = "download", width = 15)
+    @ApiModelProperty(value = "download")
+	private Integer download;
+	/**cpa*/
+	@Excel(name = "cpa", width = 15)
+    @ApiModelProperty(value = "cpa")
+	private java.math.BigDecimal cpa;
+	/**cpc*/
+	@Excel(name = "cpc", width = 15)
+    @ApiModelProperty(value = "cpc")
+	private java.math.BigDecimal cpc;
+	/**locationClick*/
+	@Excel(name = "locationClick", width = 15)
+    @ApiModelProperty(value = "locationClick")
+	private Integer locationClick;
+	/**playOverRate*/
+	@Excel(name = "playOverRate", width = 15)
+    @ApiModelProperty(value = "playOverRate")
+	private java.math.BigDecimal playOverRate;
+	/**ctr*/
+	@Excel(name = "ctr", width = 15)
+    @ApiModelProperty(value = "ctr")
+	private java.math.BigDecimal ctr;
+	/**cpm*/
+	@Excel(name = "cpm", width = 15)
+    @ApiModelProperty(value = "cpm")
+	private java.math.BigDecimal cpm;
+	/**wifiPlayRate*/
+	@Excel(name = "wifiPlayRate", width = 15)
+    @ApiModelProperty(value = "wifiPlayRate")
+	private java.math.BigDecimal wifiPlayRate;
+	/**like*/
+	@Excel(name = "like", width = 15)
+    @ApiModelProperty(value = "like")
+	private Integer likeMaterial;
+	/**activePayRate*/
+	@Excel(name = "activePayRate", width = 15)
+    @ApiModelProperty(value = "activePayRate")
+	private java.math.BigDecimal activePayRate;
+	/**activeCost*/
+	@Excel(name = "activeCost", width = 15)
+    @ApiModelProperty(value = "activeCost")
+	private java.math.BigDecimal activeCost;
+	/**gameAddictionCost*/
+	@Excel(name = "gameAddictionCost", width = 15)
+    @ApiModelProperty(value = "gameAddictionCost")
+	private java.math.BigDecimal gameAddictionCost;
+	/**gameAddiction*/
+	@Excel(name = "gameAddiction", width = 15)
+    @ApiModelProperty(value = "gameAddiction")
+	private Integer gameAddiction;
+	/**activeRate*/
+	@Excel(name = "activeRate", width = 15)
+    @ApiModelProperty(value = "activeRate")
+	private java.math.BigDecimal activeRate;
+	/**playDuration10s*/
+	@Excel(name = "playDuration10s", width = 15)
+    @ApiModelProperty(value = "playDuration10s")
+	private Integer playDuration_10s;
+	/**phoneEffective*/
+	@Excel(name = "phoneEffective", width = 15)
+    @ApiModelProperty(value = "phoneEffective")
+	private Integer phoneEffective;
+	/**gameAddictionRate*/
+	@Excel(name = "gameAddictionRate", width = 15)
+    @ApiModelProperty(value = "gameAddictionRate")
+	private java.math.BigDecimal gameAddictionRate;
+	/**activeRegisterRate*/
+	@Excel(name = "activeRegisterRate", width = 15)
+    @ApiModelProperty(value = "activeRegisterRate")
+	private java.math.BigDecimal activeRegisterRate;
+	/**averageVideoPlay*/
+	@Excel(name = "averageVideoPlay", width = 15)
+    @ApiModelProperty(value = "averageVideoPlay")
+	private java.math.BigDecimal averageVideoPlay;
+	/**downloadFinishCost*/
+	@Excel(name = "downloadFinishCost", width = 15)
+    @ApiModelProperty(value = "downloadFinishCost")
+	private java.math.BigDecimal downloadFinishCost;
+	/**playDuration3s*/
+	@Excel(name = "playDuration3s", width = 15)
+    @ApiModelProperty(value = "playDuration3s")
+	private Integer playDuration_3s;
+	/**activeRegisterCost*/
+	@Excel(name = "activeRegisterCost", width = 15)
+    @ApiModelProperty(value = "activeRegisterCost")
+	private java.math.BigDecimal activeRegisterCost;
+	/**show*/
+	@Excel(name = "show", width = 15)
+    @ApiModelProperty(value = "show")
+	private Integer showMaterial;
+	/**convertRate*/
+	@Excel(name = "convertRate", width = 15)
+    @ApiModelProperty(value = "convertRate")
+	private java.math.BigDecimal convertRate;
+	/**downloadFinishRate*/
+	@Excel(name = "downloadFinishRate", width = 15)
+    @ApiModelProperty(value = "downloadFinishRate")
+	private java.math.BigDecimal downloadFinishRate;
+	/**installFinishRate*/
+	@Excel(name = "installFinishRate", width = 15)
+    @ApiModelProperty(value = "installFinishRate")
+	private java.math.BigDecimal installFinishRate;
+	/**coupon*/
+	@Excel(name = "coupon", width = 15)
+    @ApiModelProperty(value = "coupon")
+	private Integer coupon;
+	/**couponSinglePage*/
+	@Excel(name = "couponSinglePage", width = 15)
+    @ApiModelProperty(value = "couponSinglePage")
+	private Integer couponSinglePage;
+	///**installFinsih*/
+	//@Excel(name = "installFinsih", width = 15)
+    //@ApiModelProperty(value = "installFinsih")
+	//private Integer installFinsih;
+	/**playOver*/
+	@Excel(name = "playOver", width = 15)
+    @ApiModelProperty(value = "playOver")
+	private Integer playOver;
+	/**downloadStartCost*/
+	@Excel(name = "downloadStartCost", width = 15)
+    @ApiModelProperty(value = "downloadStartCost")
+	private java.math.BigDecimal downloadStartCost;
+	/**message*/
+	@Excel(name = "message", width = 15)
+    @ApiModelProperty(value = "message")
+	private Integer message;
+	/**playDuration*/
+	@Excel(name = "playDuration", width = 15)
+    @ApiModelProperty(value = "playDuration")
+	private Integer playDuration;
+	/**validPlayRate*/
+	@Excel(name = "validPlayRate", width = 15)
+    @ApiModelProperty(value = "validPlayRate")
+	private java.math.BigDecimal validPlayRate;
+	/**averagePlayTimePerPlay*/
+	@Excel(name = "averagePlayTimePerPlay", width = 15)
+    @ApiModelProperty(value = "averagePlayTimePerPlay")
+	private java.math.BigDecimal averagePlayTimePerPlay;
+	/**convertCost*/
+	@Excel(name = "convertCost", width = 15)
+    @ApiModelProperty(value = "convertCost")
+	private java.math.BigDecimal convertCost;
+	/**convertShowRate*/
+	@Excel(name = "convertShowRate", width = 15)
+    @ApiModelProperty(value = "convertShowRate")
+	private java.math.BigDecimal convertShowRate;
+	/**installFinishCost*/
+	@Excel(name = "installFinishCost", width = 15)
+    @ApiModelProperty(value = "installFinishCost")
+	private java.math.BigDecimal installFinishCost;
+
+	private BigDecimal downloadStartRate;
+}

+ 17 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceDailyReportTaskMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.bytedance.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.bytedance.entity.BytedanceDailyReportTask;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 头条异步报表任务表
+ * @author: jeecg-boot
+ * @date:   2020-04-16
+ * @cersion: V1.0
+ */
+public interface BytedanceDailyReportTaskMapper extends BaseMapper<BytedanceDailyReportTask> {
+
+}

+ 18 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceReportMaterialDailyMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.bytedance.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.bytedance.entity.BytedanceReportMaterialDaily;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材报表
+ * @author: jeecg-boot
+ * @date:   2020-04-16
+ * @cersion: V1.0
+ */
+public interface BytedanceReportMaterialDailyMapper extends BaseMapper<BytedanceReportMaterialDaily> {
+
+    void replaceIntoBatch(@Param("infos") List<BytedanceReportMaterialDaily> infos);
+}

+ 5 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceDailyReportTaskMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.bytedance.mapper.BytedanceDailyReportTaskMapper">
+
+</mapper>

+ 208 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.bytedance.mapper.BytedanceReportMaterialDailyMapper">
+
+    <insert id="replaceIntoBatch">
+        REPLACE INTO ctop_bytedance_report_material_daily
+        (
+        account_id,
+        stat_datetime,
+        click,
+        cost,
+        active,
+        download_finish,
+        download_start,
+        install_finish,
+        register,
+        pay_count,
+        in_app_uv,
+        in_app_detail_uv,
+        in_app_cart,
+        in_app_order,
+        in_app_pay,
+        phone,
+        form,
+        map_search,
+        button,
+        view_material,
+        qq,
+        lottery,
+        vote,
+        redirect,
+        shopping,
+        consult,
+        wechat,
+        phone_confirm,
+        phone_connect,
+        consult_effective,
+        total_play,
+        valid_play,
+        wifi_play,
+        play_duration_sum,
+        play25_feed_break,
+        play50_feed_break,
+        play75_feed_break,
+        play100_feed_break,
+        advanced_creative_phone_click,
+        advanced_creative_counsel_click,
+        advanced_creative_form_click,
+        share_material,
+        comment_material,
+        follow,
+        home_visited,
+        ies_challenge_click,
+        ies_music_click,
+        next_day_open,
+        next_day_open_rate,
+        next_day_open_cost,
+        image_mode,
+        material_id,
+        inventory,
+        active_pay_amount,
+        valid_play_cost,
+        advanced_creative_coupon_addition,
+        convert_material,
+        active_pay_cost,
+        download,
+        cpa,
+        cpc,
+        location_click,
+        play_over_rate,
+        ctr,
+        cpm,
+        wifi_play_rate,
+        like_material,
+        active_pay_rate,
+        active_cost,
+        game_addiction_cost,
+        game_addiction,
+        active_rate,
+        play_duration_10s,
+        phone_effective,
+        game_addiction_rate,
+        active_register_rate,
+        average_video_play,
+        download_finish_cost,
+        play_duration_3s,
+        active_register_cost,
+        show_material,
+        convert_rate,
+        download_finish_rate,
+        install_finish_rate,
+        coupon,
+        coupon_single_page,
+        play_over,
+        download_start_cost,
+        message,
+        play_duration,
+        valid_play_rate,
+        average_play_time_per_play,
+        convert_cost,
+        convert_show_rate,
+        install_finish_cost,
+        download_start_rate
+        )
+        VALUES
+        <foreach collection="infos" item="info" separator=",">
+      (
+        #{info.accountId},
+        #{info.statDatetime},
+        #{info.click},
+        #{info.cost},
+        #{info.active},
+        #{info.downloadFinish},
+        #{info.downloadStart},
+        #{info.installFinish},
+        #{info.register},
+        #{info.payCount},
+        #{info.inAppUv},
+        #{info.inAppDetailUv},
+        #{info.inAppCart},
+        #{info.inAppOrder},
+        #{info.inAppPay},
+        #{info.phone},
+        #{info.form},
+        #{info.mapSearch},
+        #{info.button},
+        #{info.viewMaterial},
+        #{info.qq},
+        #{info.lottery},
+        #{info.vote},
+        #{info.redirect},
+        #{info.shopping},
+        #{info.consult},
+        #{info.wechat},
+        #{info.phoneConfirm},
+        #{info.phoneConnect},
+        #{info.consultEffective},
+        #{info.totalPlay},
+        #{info.validPlay},
+        #{info.wifiPlay},
+        #{info.playDurationSum},
+        #{info.play25FeedBreak},
+        #{info.play50FeedBreak},
+        #{info.play75FeedBreak},
+        #{info.play100FeedBreak},
+        #{info.advancedCreativePhoneClick},
+        #{info.advancedCreativeCounselClick},
+        #{info.advancedCreativeFormClick},
+        #{info.shareMaterial},
+        #{info.commentMaterial},
+        #{info.follow},
+        #{info.homeVisited},
+        #{info.iesChallengeClick},
+        #{info.iesMusicClick},
+        #{info.nextDayOpen},
+        #{info.nextDayOpenRate},
+        #{info.nextDayOpenCost},
+        #{info.imageMode},
+        #{info.materialId},
+        #{info.inventory},
+        #{info.activePayAmount},
+        #{info.validPlayCost},
+        #{info.advancedCreativeCouponAddition},
+        #{info.convertMaterial},
+        #{info.activePayCost},
+        #{info.download},
+        #{info.cpa},
+        #{info.cpc},
+        #{info.locationClick},
+        #{info.playOverRate},
+        #{info.ctr},
+        #{info.cpm},
+        #{info.wifiPlayRate},
+        #{info.likeMaterial},
+        #{info.activePayRate},
+        #{info.activeCost},
+        #{info.gameAddictionCost},
+        #{info.gameAddiction},
+        #{info.activeRate},
+        #{info.playDuration_10s},
+        #{info.phoneEffective},
+        #{info.gameAddictionRate},
+        #{info.activeRegisterRate},
+        #{info.averageVideoPlay},
+        #{info.downloadFinishCost},
+        #{info.playDuration_3s},
+        #{info.activeRegisterCost},
+        #{info.showMaterial},
+        #{info.convertRate},
+        #{info.downloadFinishRate},
+        #{info.installFinishRate},
+        #{info.coupon},
+        #{info.couponSinglePage},
+        #{info.playOver},
+        #{info.downloadStartCost},
+        #{info.message},
+        #{info.playDuration},
+        #{info.validPlayRate},
+        #{info.averagePlayTimePerPlay},
+        #{info.convertCost},
+        #{info.convertShowRate},
+        #{info.installFinishCost},
+        #{info.downloadStartRate}
+         )
+        </foreach>
+    </insert>
+
+</mapper>

+ 14 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceDailyReportTaskService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.bytedance.service;
+
+import cn.com.ctop.bytedance.entity.BytedanceDailyReportTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 头条异步报表任务表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+public interface IBytedanceDailyReportTaskService extends IService<BytedanceDailyReportTask> {
+
+}

+ 14 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceReportMaterialDailyService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.bytedance.service;
+
+import cn.com.ctop.bytedance.entity.BytedanceReportMaterialDaily;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材报表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+public interface IBytedanceReportMaterialDailyService extends IService<BytedanceReportMaterialDaily> {
+
+}

+ 9 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceReportService.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.bytedance.service;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import com.alibaba.fastjson.JSONObject;
 
 import java.util.List;
@@ -32,4 +33,12 @@ public interface IBytedanceReportService {
      * @return
      */
     List<JSONObject> getReportList(JSONObject requestJson);
+
+
+
+    void bytedanceAsyncTaskCreate();
+
+    void bytedanceAsyncTaskGet();
+
+    void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate);
 }

+ 19 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceDailyReportTaskServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.bytedance.service.impl;
+
+import cn.com.ctop.bytedance.entity.BytedanceDailyReportTask;
+import cn.com.ctop.bytedance.mapper.BytedanceDailyReportTaskMapper;
+import cn.com.ctop.bytedance.service.IBytedanceDailyReportTaskService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 头条异步报表任务表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Service
+public class BytedanceDailyReportTaskServiceImpl extends ServiceImpl<BytedanceDailyReportTaskMapper, BytedanceDailyReportTask> implements IBytedanceDailyReportTaskService {
+
+}

+ 19 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportMaterialDailyServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.bytedance.service.impl;
+
+import cn.com.ctop.bytedance.entity.BytedanceReportMaterialDaily;
+import cn.com.ctop.bytedance.mapper.BytedanceReportMaterialDailyMapper;
+import cn.com.ctop.bytedance.service.IBytedanceReportMaterialDailyService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 素材报表
+ * @author jeecg-boot
+ * @date   2020-04-16
+ * @version V1.0
+ */
+@Service
+public class BytedanceReportMaterialDailyServiceImpl extends ServiceImpl<BytedanceReportMaterialDailyMapper, BytedanceReportMaterialDaily> implements IBytedanceReportMaterialDailyService {
+
+}

+ 580 - 4
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -1,30 +1,53 @@
 package cn.com.ctop.bytedance.service.impl;
 
 import cn.com.ctop.bytedance.entity.BytedanceAdvertiserDailyReport;
+import cn.com.ctop.bytedance.entity.BytedanceDailyReportTask;
+import cn.com.ctop.bytedance.entity.BytedanceReportMaterialDaily;
 import cn.com.ctop.bytedance.mapper.BytedanceAdvertiserDailyReportMapper;
+import cn.com.ctop.bytedance.mapper.BytedanceDailyReportTaskMapper;
 import cn.com.ctop.bytedance.mapper.BytedanceReportMapper;
+import cn.com.ctop.bytedance.mapper.BytedanceReportMaterialDailyMapper;
+import cn.com.ctop.bytedance.service.IBytedanceDailyReportTaskService;
 import cn.com.ctop.bytedance.service.IBytedanceReportService;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
+import cn.com.ctop.kuaishou.modules.utils.DownloadUtils;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.net.URI;
+import java.util.*;
 
 @Service
+@Slf4j
 public class BytedanceReportServiceImpl implements IBytedanceReportService {
+
+    @Value("${jeecg.path.report-history}")
+    private String downloadPath;
     @Autowired
     private UserAllocationMapper userAllocationMapper;
 
@@ -37,6 +60,18 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     @Autowired
     private KuaishouReportDailyAccountMapper kuaishouReportDailyAccountMapper;
 
+    @Autowired
+    private BytedanceDailyReportTaskMapper bytedanceDailyReportTaskMapper;
+
+    @Autowired
+    private IBytedanceDailyReportTaskService bytedanceDailyReportTaskService;
+
+    @Autowired
+    private ICtopOauthTokenService ctopOauthTokenService;
+
+    @Autowired
+    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
+
     /**
      * 媒体昨日总消耗
      *
@@ -634,4 +669,545 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         }
         return reportList;
     }
+
+    /////////////////////////////////////////////////////////////////////////////////////////////////
+    //创建异步任务
+    public void bytedanceAsyncTaskCreate () {
+        String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+        String endDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -31));
+        String type = "BYTEDANCE_LOAD_JOB_TYPE_ASYNC";
+        Long accountId = 1662649623517198L;
+
+        CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(accountId);
+        String access_token = token.getAccessToken();
+        Long advertiser_id = accountId;
+        //final Long[] ad_ids = new Long[]{1L};
+        //List<String> fields_list = FIELDS;
+        //ist<String> fields_list = new ArrayList<>();
+
+        // 请求地址
+        String open_api_domain = "https://ad.toutiao.com";
+        String path = "/open_api/2/async_task/create/";
+
+        String taskName = System.currentTimeMillis() + "";
+        // 请求参数
+        final Map filtering = new HashMap() {
+            {
+                //put("start_date", startDate);
+                //put("end_date", endDate);
+                put("start_date", "2020-04-01");
+                put("end_date", "2020-04-15");
+                put("group_by", new String[]{"STAT_GROUP_BY_CREATIVE_ID","STAT_GROUP_BY_TIME_DAY","STAT_GROUP_BY_CREATIVE_MATERIAL_MODE"});   //按照创意分组、天分组、创意类型分组查询
+            }
+        };
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", advertiser_id);
+                put("task_name", taskName);
+                put("task_type", "REPORT");
+                put("task_params", filtering);
+            }
+        };
+
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "POST";
+            }
+        };
+
+        httpEntity.setHeader("Access-Token", access_token);
+
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(open_api_domain + path));
+            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuffer result = new StringBuffer();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+
+                JSONObject  json = JSONObject.parseObject(result.toString());
+                String jsonString = JSON.toJSONString(json);
+
+                if(!Check.isNull(json)){
+                    Integer code = json.getInteger("code");
+                    if(code != 0){
+                        log.info("返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ",message:"+ json.getString("message"));
+                        return;
+                    }
+                    JSONObject dataJson = json.getJSONObject("data");
+
+                    //解析数据并入库
+                    BytedanceDailyReportTask task = new BytedanceDailyReportTask();
+                    task.setAccountId(accountId);
+                    task.setTaskCreateTime(dataJson.getDate("create_time") == null ? null : dataJson.getDate("create_time"));
+                    task.setTaskId(dataJson.getLong("task_id") ==  null ? null : dataJson.getLong("task_id") );
+                    task.setTaskName(dataJson.getString("task_name") == null ? null : dataJson.getString("task_name"));
+                    task.setTaskParams(JSON.toJSONString(dataJson.getJSONObject("task_params")));
+                    task.setJson(jsonString);
+                    task.setTaskStatus(dataJson.getString("task_status"));
+                    task.setTaskType(dataJson.getString("task_type"));
+                    bytedanceDailyReportTaskMapper.insert(task);
+                }
+
+            }else{
+                log.error("请求有误:" + response );
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    //获取任务列表
+    public void bytedanceAsyncTaskGet(){
+        QueryWrapper<BytedanceDailyReportTask> taskQueryWrapper = new QueryWrapper<>();
+        //查询三种状态的信息--任务已创建、任务执行中、任务处理中
+        taskQueryWrapper.in("task_status", "ASYNC_TASK_STATUS_CREATED","ASYNC_TASK_STATUS_EXECUTING","ASYNC_TASK_STATUS_EXECUTING_STAGE2");
+        taskQueryWrapper.orderByDesc("create_time");
+        List<BytedanceDailyReportTask> taskList = bytedanceDailyReportTaskService.list(taskQueryWrapper);
+
+        if (!Check.isNull(taskList)) {
+            for (BytedanceDailyReportTask task : taskList) {
+                CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(task.getAccountId());
+
+                if (!Check.isNull(token)) {
+                    // 请求地址
+                    String open_api_domain = "https://ad.toutiao.com";
+                    String path = "/open_api/2/async_task/get/";
+
+                    String access_token = token.getAccessToken();
+                    Long accountId = task.getAccountId();
+                    final Long advertiser_id = accountId;
+                    //Long taskId = 682327L;
+
+                    // 请求参数
+                    final Map filtering = new HashMap() {
+                        {
+                            put("task_ids",new Long[]{task.getTaskId()});
+                            put("task_name", task.getTaskName());
+                        }
+                    };
+                    Map data = new HashMap(){
+                        {
+                            put("advertiser_id", advertiser_id);
+                            put("filtering", filtering);
+                        }
+                    };
+
+                    // 构造请求
+                    HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+                        @Override
+                        public String getMethod() {
+                            return "GET";
+                        }
+                    };
+
+                    httpEntity.setHeader("Access-Token",access_token);
+
+                    CloseableHttpResponse response = null;
+                    CloseableHttpClient client = null;
+
+                    try {
+                        client = HttpClientBuilder.create().build();
+                        httpEntity.setURI(URI.create(open_api_domain + path));
+                        httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+
+                        response = client.execute(httpEntity);
+                        log.info("response为:" +  response);
+                        if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                            BufferedReader bufferedReader  = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                            StringBuffer result = new StringBuffer();
+                            String line = "";
+                            while((line = bufferedReader.readLine()) != null) {
+                                result.append(line);
+                            }
+                            bufferedReader.close();
+
+                            JSONObject  json = JSONObject.parseObject(result.toString());
+                            String jsonString = JSON.toJSONString(json);
+                            log.info("返回json为" + jsonString);
+
+                            if(!Check.isNull(json)){
+                                Integer code = json.getInteger("code");
+                                if(code != 0){
+                                    log.info("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + "taskId:" + task.getTaskId());
+                                    return;
+                                }
+
+                                JSONObject jsonData = json.getJSONObject("data");
+                                if (Check.isNull(jsonData)){
+                                    log.error("获取任务列表返回信息data内容为空");
+                                }
+                                JSONArray jsonArrayay = jsonData.getJSONArray("list");
+
+                                for (int i = 0; i < jsonArrayay.size(); i++) {
+                                    JSONObject detailJson = jsonArrayay.getJSONObject(i);
+                                    if (!Check.isNull(detailJson)) {
+                                        String taskStatus = detailJson.getString("task_status");
+
+                                        if (taskStatus .equals( "ASYNC_TASK_STATUS_COMPLETED")) {
+                                            bytedanceAsyncTaskDownload(task,token);
+                                        }
+                                            task.setTaskStatus(taskStatus);
+                                            bytedanceDailyReportTaskMapper.updateById(task);
+                                        }
+                                    }
+                                }
+
+                        }else{
+                            log.error("请求有误:" + response);
+                        }
+
+                    } catch (ClientProtocolException e) {
+                        e.printStackTrace();
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    } finally {
+                        try {
+                            if (response != null) {
+                                response.close();
+                            }
+                            client.close();
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                    }
+
+                }
+            }
+        }
+    }
+
+    //下载任务结果
+    private void bytedanceAsyncTaskDownload(BytedanceDailyReportTask task, CtopOauthToken token){
+        // 请求地址
+        String open_api_domain = "https://ad.toutiao.com";
+        String path = "/open_api/2/async_task/download/";
+
+        Long accountId = task.getAccountId();
+        final Long advertiser_id = accountId;
+        String access_token = token.getAccessToken();
+        Long taskId = task.getTaskId();
+
+        //Map data = new HashMap(){
+        //    {
+        //        put("advertiser_id", advertiser_id);
+        //        put("task_id", taskId);
+        //    }
+        //};
+        //
+        //// 构造请求
+        //HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+        //    @Override
+        //    public String getMethod() {
+        //        return "GET";
+        //    }
+        //};
+        //
+        //httpEntity.setHeader("Access-Token",access_token);
+        //
+        //CloseableHttpResponse response = null;
+        //CloseableHttpClient client = null;
+
+
+
+        try {
+            //client = HttpClientBuilder.create().build();
+            //httpEntity.setURI(URI.create(open_api_domain + path));
+            //httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+            //
+            //response = client.execute(httpEntity);
+            //log.info("response为:" +  response);
+            //if (response != null && response.getStatusLine().getStatusCode() == 200) {
+            //    BufferedReader bufferedReader  = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+            //    StringBuffer result = new StringBuffer();
+            //    String line = "";
+            //    while((line = bufferedReader.readLine()) != null) {
+            //        result.append(line);
+            //    }
+            //    bufferedReader.close();
+
+            String url = open_api_domain + path;
+            String fileName = task.getAccountId() + "_" +  ".csv";
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("advertiser_id", task.getAccountId());
+            requestMap.put("task_id", task.getTaskId());
+            String localPath = DownloadUtils.downloadByUrl(requestMap, downloadPath, url, token.getAccessToken(), fileName);
+
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            //task.setTaskStatus(5);
+        }
+
+        return;
+    }
+
+
+
+
+    /////////////////////////////////////////////////////////\
+    //素材报表
+    public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
+        //CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(accountId);
+        Long accountId = token.getAccountId();
+        Integer page = 1;
+        Integer pageSize = 500;
+        bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
+    }
+
+    private void bytedanceMaterialReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate){
+        //log.info("当前页数:"+ page);
+        String access_token = token.getAccessToken();
+
+        // 请求地址
+        String open_api_domain = "https://ad.oceanengine.com";
+        String path = "/open_api/2/report/integrated/get/";
+
+        // 请求参数
+        final Map filtering = new HashMap() {
+            {
+                put("image_mode",new String[]{"MATERIAL_IMAGE_MODE_TITLE"});
+            }
+        };
+
+        Map data = new HashMap(){
+            {
+                put("advertiser_id", accountId);
+                put("start_date",startDate);
+                put("end_date",endDate);
+                put("page",page);
+                put("page_size",pageSize);
+                put("group_by", new String[]{"STAT_GROUP_BY_MATERIAL_ID","STAT_GROUP_BY_INVENTORY","STAT_GROUP_BY_IMAGE_MODE","STAT_GROUP_BY_TIME_DAY"});
+                //put("group_by", new String[]{"STAT_GROUP_BY_MATERIAL_ID"});
+                //put("filtering",filtering);
+                //put("order_field","stat_datetime");
+                //put("order_type","ASC");
+            }
+        };
+
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+
+        httpEntity.setHeader("Access-Token",access_token);
+
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(open_api_domain + path));
+            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+
+            response = client.execute(httpEntity);
+            //System.out.println(response);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader  = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuffer result = new StringBuffer();
+                String line = "";
+                while((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+
+                JSONObject  json = JSONObject.parseObject(result.toString());
+                String jsonString = JSON.toJSONString(json);
+                //log.info("返回值为:" + jsonString);
+
+                if(!Check.isNull(json)){
+                    Integer code = json.getInteger("code");
+                    if(code != 0){
+                        log.info("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId );
+                        return;
+                    }
+
+                    JSONObject jsonData = json.getJSONObject("data");
+                    if (Check.isNull(jsonData)){
+                        log.error("获取任务列表返回信息data内容为空");
+                    }
+                    JSONObject pageInfo = jsonData.getJSONObject("page_info");
+                    Integer totalPage = pageInfo.getInteger("total_page");
+                    Integer currentPage = pageInfo.getInteger("page");
+
+                    JSONArray jsonArrayay = jsonData.getJSONArray("list");
+                    List<BytedanceReportMaterialDaily> bytedanceReportMaterialDailyList = new ArrayList<>();
+                    for (int i = 0; i < jsonArrayay.size(); i++) {
+                        BytedanceReportMaterialDaily daily = new BytedanceReportMaterialDaily();
+                        daily.setAccountId(accountId);
+                        JSONObject detailJson = jsonArrayay.getJSONObject(i);
+                        if (!Check.isNull(detailJson)) {
+                            JSONObject dimensions = detailJson.getJSONObject("dimensions");
+                            daily.setImageMode(dimensions.getString("image_mode"));
+                            daily.setMaterialId(dimensions.getLong("material_id"));
+                            daily.setInventory(dimensions.getString("inventory"));
+                            daily.setStatDatetime(dimensions.getDate("stat_datetime")==null?null:DateUtils.formatDate(dimensions.getDate("stat_datetime"),"yyyy-MM-dd"));
+
+                            JSONObject metrics = detailJson.getJSONObject("metrics");
+                            daily.setActivePayAmount(metrics.getInteger("active_pay_amount"));
+                            daily.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
+                            daily.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
+                            daily.setNextDayOpen(metrics.getInteger("next_day_open"));
+                            daily.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
+                            daily.setConvertMaterial(metrics.getInteger("convert"));
+                            daily.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
+                            daily.setInAppCart(metrics.getInteger("in_app_cart"));
+                            daily.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
+                            daily.setConsultEffective(metrics.getInteger("consult_effective"));
+                            daily.setViewMaterial(metrics.getInteger("view"));
+                            daily.setDownload(metrics.getInteger("download"));
+                            daily.setCpa(metrics.getBigDecimal("cpa"));
+                            daily.setCpc(metrics.getBigDecimal("cpc"));
+                            daily.setLocationClick(metrics.getInteger("location_click"));
+                            daily.setPhoneConfirm(metrics.getInteger("phone_confirm"));
+                            daily.setIesMusicClick(metrics.getInteger("ies_music_click"));
+                            daily.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
+                            daily.setWifiPlay(metrics.getInteger("wifi_play"));
+                            daily.setShopping(metrics.getInteger("shopping"));
+                            daily.setQq(metrics.getInteger("qq"));
+                            daily.setCtr(metrics.getBigDecimal("ctr"));
+                            daily.setCpm(metrics.getBigDecimal("cpm"));
+                            daily.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
+                            daily.setLikeMaterial(metrics.getInteger("like"));
+                            daily.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
+                            daily.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
+                            daily.setActiveCost(metrics.getBigDecimal("active_cost"));
+                            daily.setActive(metrics.getInteger("active"));
+                            daily.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
+                            daily.setGameAddiction(metrics.getInteger("game_addiction"));
+                            daily.setActiveRate(metrics.getBigDecimal("active_rate"));
+                            daily.setClick(metrics.getInteger("click"));
+                            daily.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
+                            daily.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
+                            daily.setDownloadStart(metrics.getInteger("download_start"));
+                            daily.setHomeVisited(metrics.getInteger("home_visited"));
+                            daily.setPhone(metrics.getInteger("phone"));
+                            daily.setPhoneEffective(metrics.getInteger("phone_effective"));
+                            daily.setInAppPay(metrics.getInteger("in_app_pay"));
+                            daily.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
+                            daily.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
+                            daily.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
+                            daily.setTotalPlay(metrics.getInteger("total_play"));
+                            daily.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
+                            daily.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
+                            daily.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
+                            daily.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
+                            daily.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
+                            daily.setShowMaterial(metrics.getInteger("show"));
+                            daily.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
+                            daily.setMapSearch(metrics.getInteger("map_search"));
+                            daily.setButton(metrics.getInteger("button"));
+                            daily.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
+                            daily.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
+                            daily.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
+                            daily.setConvertRate(metrics.getBigDecimal("convert_rate"));
+                            daily.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
+                            daily.setConsult(metrics.getInteger("consult"));
+                            daily.setShareMaterial(metrics.getInteger("share"));
+                            daily.setVote(metrics.getInteger("vote"));
+                            daily.setValidPlay(metrics.getInteger("valid_play"));
+                            daily.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
+                            daily.setRedirect(metrics.getInteger("redirect"));
+                            daily.setPayCount(metrics.getInteger("pay_count"));
+                            daily.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
+                            daily.setCost(metrics.getBigDecimal("cost"));
+                            daily.setPhoneConnect(metrics.getInteger("phone_connect"));
+                            daily.setCoupon(metrics.getInteger("coupon"));
+                            daily.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
+                            daily.setDownloadFinish(metrics.getInteger("download_finish"));
+                            daily.setWechat(metrics.getInteger("wechat"));
+                            daily.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
+                            daily.setInstallFinish(metrics.getInteger("install_finish"));
+                            daily.setLottery(metrics.getInteger("lottery"));
+                            daily.setPlayOver(metrics.getInteger("play_over"));
+                            daily.setInAppOrder(metrics.getInteger("in_app_order"));
+                            daily.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
+                            daily.setFollow(metrics.getInteger("follow"));
+                            daily.setMessage(metrics.getInteger("message"));
+                            daily.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
+                            daily.setPlayDuration(metrics.getInteger("play_duration"));
+                            daily.setForm(metrics.getInteger("form"));
+                            daily.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
+                            daily.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
+                            daily.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
+                            daily.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
+                            daily.setCommentMaterial(metrics.getInteger("comment"));
+                            daily.setInAppUv(metrics.getInteger("in_app_uv"));
+                            daily.setRegister(metrics.getInteger("register"));
+                            daily.setConvertCost(metrics.getBigDecimal("convert_cost"));
+
+                            bytedanceReportMaterialDailyList.add(daily);
+                            //bytedanceReportMaterialDailyMapper.insert(daily);
+                        }
+                    }
+
+                    bytedanceReportMaterialDailyMapper.replaceIntoBatch(bytedanceReportMaterialDailyList);
+                    if(currentPage >= totalPage){
+                        return;
+                    }else{
+                        bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
+                    }
+                }
+            }else{
+                log.error("头条素材报表请求有误:accountId:" + accountId + ",开始时间:" + startDate + "结束时间:" + endDate + "错误返回:" +response);
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+