Browse Source

Merge branch 'master' into test

yumeng 4 năm trước cách đây
mục cha
commit
73c00d1a52
27 tập tin đã thay đổi với 1532 bổ sung81 xóa
  1. 34 30
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  5. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/controller/ThirdConfigAdvertiserController.java
  6. 132 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/controller/ThirdConfigController.java
  7. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/entity/ThirdConfig.java
  8. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/entity/ThirdConfigAdvertiser.java
  9. 22 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/ThirdConfigAdvertiserMapper.java
  10. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/ThirdConfigMapper.java
  11. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/xml/ThirdConfigAdvertiserMapper.xml
  12. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/xml/ThirdConfigMapper.xml
  13. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/IThirdConfigAdvertiserService.java
  14. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/IThirdConfigService.java
  15. 35 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/impl/ThirdConfigAdvertiserServiceImpl.java
  16. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/impl/ThirdConfigServiceImpl.java
  17. 51 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceOperationRecordJob.java
  18. 21 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java
  19. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  20. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl2.java
  21. 82 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java
  22. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceOperationRecord.java
  23. 527 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceReportPlayableDaily.java
  24. 1 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceOperationRecordMapper.java
  25. 35 29
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceOperationRecordMapper.xml
  26. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceInterfaceService.java
  27. 119 6
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java

+ 34 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -40,6 +40,7 @@ public class ShiroConfig {
 
     @Value("${spring.redis.password}")
     private String redisPassword;
+
     /**
      * Filter Chain定义说明
      * <p>
@@ -166,6 +167,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/job/test/*", "anon");
+        filterChainDefinitionMap.put("/third/*", "anon");
+        //filterChainDefinitionMap.put("/kuaishou/**", "anon");
         filterChainDefinitionMap.put("/rest/script/*", "anon");
         filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
 
@@ -202,35 +205,36 @@ public class ShiroConfig {
         return securityManager;
     }
 
-	/**
-	 * 下面的代码是添加注解支持
-	 * @return
-	 */
-	@Bean
-	@DependsOn("lifecycleBeanPostProcessor")
-	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
-		DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
-		defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
-		/**
-		* 解决重复代理问题 github#994
-		* 添加前缀判断 不匹配 任何Advisor
-		*/
-		defaultAdvisorAutoProxyCreator.setUsePrefix(true);
-		defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
-		return defaultAdvisorAutoProxyCreator;
-	}
+    /**
+     * 下面的代码是添加注解支持
+     *
+     * @return
+     */
+    @Bean
+    @DependsOn("lifecycleBeanPostProcessor")
+    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        /**
+         * 解决重复代理问题 github#994
+         * 添加前缀判断 不匹配 任何Advisor
+         */
+        defaultAdvisorAutoProxyCreator.setUsePrefix(true);
+        defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
+        return defaultAdvisorAutoProxyCreator;
+    }
 
-	@Bean
-	public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
-		return new LifecycleBeanPostProcessor();
-	}
+    @Bean
+    public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
 
-	@Bean
-	public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
-		AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
-		advisor.setSecurityManager(securityManager);
-		return advisor;
-	}
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
 
     /**
      * cacheManager 缓存 redis实现
@@ -257,9 +261,9 @@ public class ShiroConfig {
     @Bean
     public RedisManager redisManager() {
         RedisManager redisManager = new RedisManager();
-		redisManager.setHost(host);
-		redisManager.setPort(oConvertUtils.getInt(port));
-		redisManager.setTimeout(0);
+        redisManager.setHost(host);
+        redisManager.setPort(oConvertUtils.getInt(port));
+        redisManager.setTimeout(0);
         if (!StringUtils.isEmpty(redisPassword)) {
             redisManager.setPassword(redisPassword);
         }

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

@@ -35,10 +35,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Slf4j
 @RestController
@@ -228,6 +225,11 @@ public class CallbackController {
         return "授权绑定失败!";
     }
 
+
+    public static void main(String[] args) {
+        System.err.println(UUID.randomUUID().toString().replace("-", ""));
+    }
+
     @RequestMapping("/bytedance")
     public String bytedance(HttpServletRequest request,
                             HttpServletResponse response,

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

@@ -219,7 +219,7 @@ public class MaterialInfoController {
         materialInfo.setCreateTime(null);
         if (!Check.isNull(materialInfo.getUserId())) {
             String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
-            if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
+            if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
             } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {

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

@@ -967,5 +967,4 @@ public class TestController {
         return result;
     }
 
-
 }

+ 248 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/controller/ThirdConfigAdvertiserController.java

@@ -0,0 +1,248 @@
+package org.jeecg.modules.third.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.third.entity.ThirdConfigAdvertiser;
+import org.jeecg.modules.third.server.IThirdConfigAdvertiserService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Slf4j
+@Api(tags = "对外配置关联广告主")
+@RestController
+@RequestMapping("/n/thirtConfigAdvertiser")
+public class ThirdConfigAdvertiserController {
+    @Autowired
+    private IThirdConfigAdvertiserService thirtConfigAdvertiserService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param thirtConfigAdvertiser
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-分页列表查询")
+    @ApiOperation(value = "对外配置关联广告主-分页列表查询", notes = "对外配置关联广告主-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ThirdConfigAdvertiser>> queryPageList(ThirdConfigAdvertiser thirtConfigAdvertiser,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<ThirdConfigAdvertiser>> result = new Result<>();
+        QueryWrapper<ThirdConfigAdvertiser> queryWrapper = QueryGenerator.initQueryWrapper(thirtConfigAdvertiser, req.getParameterMap());
+        Page<ThirdConfigAdvertiser> page = new Page<ThirdConfigAdvertiser>(pageNo, pageSize);
+        IPage<ThirdConfigAdvertiser> pageList = thirtConfigAdvertiserService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param thirtConfigAdvertiser
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-添加")
+    @ApiOperation(value = "对外配置关联广告主-添加", notes = "对外配置关联广告主-添加")
+    @PostMapping(value = "/add")
+    public Result<ThirdConfigAdvertiser> add(@RequestBody ThirdConfigAdvertiser thirtConfigAdvertiser) {
+        Result<ThirdConfigAdvertiser> result = new Result<>();
+        try {
+            thirtConfigAdvertiserService.save(thirtConfigAdvertiser);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param thirtConfigAdvertiser
+     * @return
+     */
+    @AutoLog(value = "对外配置关联广告主-编辑")
+    @ApiOperation(value = "对外配置关联广告主-编辑", notes = "对外配置关联广告主-编辑")
+    @PutMapping(value = "/edit")
+    public Result<ThirdConfigAdvertiser> edit(@RequestBody ThirdConfigAdvertiser thirtConfigAdvertiser) {
+        Result<ThirdConfigAdvertiser> result = new Result<ThirdConfigAdvertiser>();
+        ThirdConfigAdvertiser thirtConfigAdvertiserEntity = thirtConfigAdvertiserService.getById(thirtConfigAdvertiser.getId());
+        if (thirtConfigAdvertiserEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = thirtConfigAdvertiserService.updateById(thirtConfigAdvertiser);
+            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 {
+            thirtConfigAdvertiserService.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<ThirdConfigAdvertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<ThirdConfigAdvertiser> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.thirtConfigAdvertiserService.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<ThirdConfigAdvertiser> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ThirdConfigAdvertiser> result = new Result<>();
+        ThirdConfigAdvertiser thirtConfigAdvertiser = thirtConfigAdvertiserService.getById(id);
+        if (thirtConfigAdvertiser == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(thirtConfigAdvertiser);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<ThirdConfigAdvertiser> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                ThirdConfigAdvertiser thirtConfigAdvertiser = JSON.parseObject(deString, ThirdConfigAdvertiser.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(thirtConfigAdvertiser, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<ThirdConfigAdvertiser> pageList = thirtConfigAdvertiserService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "对外配置关联广告主列表");
+        mv.addObject(NormalExcelConstants.CLASS, ThirdConfigAdvertiser.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<ThirdConfigAdvertiser> listThirtConfigAdvertisers = ExcelImportUtil.importExcel(file.getInputStream(), ThirdConfigAdvertiser.class, params);
+                thirtConfigAdvertiserService.saveBatch(listThirtConfigAdvertisers);
+                return Result.ok("文件导入成功!数据行数:" + listThirtConfigAdvertisers.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("文件导入失败!");
+    }
+
+}

+ 132 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/controller/ThirdConfigController.java

@@ -0,0 +1,132 @@
+package org.jeecg.modules.third.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.third.entity.ThirdConfig;
+import org.jeecg.modules.third.entity.ThirdConfigAdvertiser;
+import org.jeecg.modules.third.server.IThirdConfigAdvertiserService;
+import org.jeecg.modules.third.server.IThirdConfigService;
+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 java.util.List;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Slf4j
+@Api(tags = "对外配置")
+@RestController
+@RequestMapping("/third")
+public class ThirdConfigController {
+    @Autowired
+    private IThirdConfigService thirdConfigService;
+    @Autowired
+    private IThirdConfigAdvertiserService thirdConfigAdvertiserService;
+
+    @PostMapping(value = "/getAdvertiserList")
+    public Result<List<String>> getAdvertiserList(@RequestBody JSONObject requestJson) {
+
+        Result<List<String>> result = new Result<>();
+        try {
+            Long appId = requestJson.getLong("appId");
+            if (Check.isNull(appId)) {
+                throw new Exception("必传参数appId不能为空");
+            }
+            QueryWrapper<ThirdConfig> thirdConfigQueryWrapper = new QueryWrapper<>();
+            thirdConfigQueryWrapper.eq("app_id", appId);
+            ThirdConfig config = thirdConfigService.getOne(thirdConfigQueryWrapper);
+            if (Check.isNull(config)) {
+                throw new Exception("appId不正确");
+            }
+            String secret = requestJson.getString("secret");
+            if (Check.isNull(secret)) {
+                throw new Exception("secret不能为空");
+            }
+            if (!secret.equals(config.getSecret())) {
+                throw new Exception("secret不正确");
+            }
+
+            List<String> advertiserList = thirdConfigAdvertiserService.getAdvertiserListByAppId(appId);
+            result.setResult(advertiserList);
+
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+            result.setCode(-1);
+
+        }
+        return result;
+    }
+
+
+    @PostMapping(value = "/getAdvertiserCost")
+    public Result<List<JSONObject>> getAdvertiserCost(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+
+            Long appId = requestJson.getLong("appId");
+            if (Check.isNull(appId)) {
+                throw new Exception("必传参数appId不能为空");
+            }
+            QueryWrapper<ThirdConfig> thirdConfigQueryWrapper = new QueryWrapper<>();
+            thirdConfigQueryWrapper.eq("app_id", appId);
+            ThirdConfig config = thirdConfigService.getOne(thirdConfigQueryWrapper);
+            if (Check.isNull(config)) {
+                throw new Exception("appId不正确");
+            }
+            String secret = requestJson.getString("secret");
+            if (Check.isNull(secret)) {
+                throw new Exception("secret不能为空");
+            }
+            if (!secret.equals(config.getSecret())) {
+                throw new Exception("secret不正确");
+            }
+
+            String advertiserName = requestJson.getString("advertiserName");
+            if (Check.isNull(advertiserName)) {
+                throw new Exception("请输入需要查询广告主名称");
+            }
+
+            QueryWrapper<ThirdConfigAdvertiser> thirtConfigAdvertiserQueryWrapper = new QueryWrapper<>();
+            thirtConfigAdvertiserQueryWrapper.eq("app_id", appId);
+            thirtConfigAdvertiserQueryWrapper.eq("advertiser_name", advertiserName);
+            thirtConfigAdvertiserQueryWrapper.last("limit 1");
+            ThirdConfigAdvertiser configAdvertiser = thirdConfigAdvertiserService.getOne(thirtConfigAdvertiserQueryWrapper);
+            if (Check.isNull(configAdvertiser)) {
+                throw new Exception("此appId下暂无此广告主信息");
+
+            }
+            String startDate = requestJson.getString("startDate");
+            if (Check.isNull(startDate)) {
+                throw new Exception("请输入查询开始时间");
+            }
+
+            String endDate = requestJson.getString("endDate");
+            if (Check.isNull(endDate)) {
+                throw new Exception("请输入查询结束时间");
+            }
+
+
+            List<JSONObject> costList = thirdConfigAdvertiserService.getAdvertiserCost(appId, advertiserName, startDate, endDate);
+            result.setResult(costList);
+        } catch (Exception e) {
+            result.setCode(-1);
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+}

+ 57 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/entity/ThirdConfig.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.third.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Data
+@TableName("ctop_thirt_config")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_thirt_config对象", description = "对外配置")
+public class ThirdConfig {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * appId
+     */
+    @Excel(name = "appId", width = 15)
+    @ApiModelProperty(value = "appId")
+    private Long appId;
+    /**
+     * secret
+     */
+    @Excel(name = "secret", width = 15)
+    @ApiModelProperty(value = "secret")
+    private String secret;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * update
+     */
+    @ApiModelProperty(value = "update")
+    private Date updateTime;
+}

+ 57 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/entity/ThirdConfigAdvertiser.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.third.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Data
+@TableName("ctop_thirt_config_advertiser")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_thirt_config_advertiser对象", description = "对外配置关联广告主")
+public class ThirdConfigAdvertiser {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * appId
+     */
+    @Excel(name = "appId", width = 15)
+    @ApiModelProperty(value = "appId")
+    private Integer appId;
+    /**
+     * advertsierName
+     */
+    @Excel(name = "advertsierName", width = 15)
+    @ApiModelProperty(value = "advertiserName")
+    private String advertiserName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * update
+     */
+    @ApiModelProperty(value = "update")
+    private Date updateTime;
+}

+ 22 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/ThirdConfigAdvertiserMapper.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.third.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.third.entity.ThirdConfigAdvertiser;
+
+import java.util.List;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author: jeecg-boot
+ * @date: 2020-08-14
+ * @cersion: V1.0
+ */
+public interface ThirdConfigAdvertiserMapper extends BaseMapper<ThirdConfigAdvertiser> {
+
+    List<JSONObject> getAdvertiserCost(@Param("appId") Long appId, @Param("advertiserName") String advertiserName, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<String> getAdvertiserListByAppId(@Param("appId") Long appId);
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/ThirdConfigMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.third.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.third.entity.ThirdConfig;
+
+/**
+ * 对外配置
+ *
+ * @author: jeecg-boot
+ * @date: 2020-08-14
+ * @cersion: V1.0
+ */
+public interface ThirdConfigMapper extends BaseMapper<ThirdConfig> {
+
+}

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/xml/ThirdConfigAdvertiserMapper.xml

@@ -0,0 +1,24 @@
+<?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="org.jeecg.modules.third.mapper.ThirdConfigAdvertiserMapper">
+
+    <select id="getAdvertiserListByAppId" resultType="java.lang.String">
+     select advertiser_name
+      from ctop_thirt_config_advertiser
+     where  app_id = #{appId}
+     group by advertiser_name
+    </select>
+
+    <select id="getAdvertiserCost" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(t2.charge) as 'charge',
+        stat_date as 'statDate'
+        from ctop_kuaishou_advertiser_base_info t1
+        LEFT JOIN ctop_kuaishou_report_daily_account t2
+        ON t1.account_id = t2.account_id
+        WHERE t1.corporation_name = #{advertiserName}
+        and t2.stat_date &gt;= #{startDate}
+        AND t2.stat_date &lt;= #{endDate}
+        GROUP BY t2.stat_date
+    </select>
+
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/mapper/xml/ThirdConfigMapper.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="org.jeecg.modules.third.mapper.ThirdConfigMapper">
+
+</mapper>

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/IThirdConfigAdvertiserService.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.third.server;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.third.entity.ThirdConfigAdvertiser;
+
+import java.util.List;
+
+/**
+ * @Description: 对外配置关联广告主
+ * @Author: jeecg-boot
+ * @Date: 2020-08-14
+ * @Version: V1.0
+ */
+public interface IThirdConfigAdvertiserService extends IService<ThirdConfigAdvertiser> {
+
+    List<String> getAdvertiserListByAppId(Long appId);
+
+    List<JSONObject> getAdvertiserCost(Long appId, String advertiserName, String startDate, String endDate);
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/IThirdConfigService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.third.server;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.third.entity.ThirdConfig;
+
+/**
+ * @Description: 对外配置
+ * @Author: jeecg-boot
+ * @Date: 2020-08-14
+ * @Version: V1.0
+ */
+public interface IThirdConfigService extends IService<ThirdConfig> {
+
+}

+ 35 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/impl/ThirdConfigAdvertiserServiceImpl.java

@@ -0,0 +1,35 @@
+package org.jeecg.modules.third.server.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.third.entity.ThirdConfigAdvertiser;
+import org.jeecg.modules.third.mapper.ThirdConfigAdvertiserMapper;
+import org.jeecg.modules.third.server.IThirdConfigAdvertiserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对外配置关联广告主
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Service
+public class ThirdConfigAdvertiserServiceImpl extends ServiceImpl<ThirdConfigAdvertiserMapper, ThirdConfigAdvertiser> implements IThirdConfigAdvertiserService {
+    @Autowired
+    private ThirdConfigAdvertiserMapper thirdConfigAdvertiserMapper;
+
+
+    @Override
+    public List<String> getAdvertiserListByAppId(Long appId) {
+        return thirdConfigAdvertiserMapper.getAdvertiserListByAppId(appId);
+    }
+
+    @Override
+    public List<JSONObject> getAdvertiserCost(Long appId, String advertiserName, String startDate, String endDate) {
+        return thirdConfigAdvertiserMapper.getAdvertiserCost(appId, advertiserName, startDate, endDate);
+    }
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/third/server/impl/ThirdConfigServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.third.server.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.third.entity.ThirdConfig;
+import org.jeecg.modules.third.mapper.ThirdConfigMapper;
+import org.jeecg.modules.third.server.IThirdConfigService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 对外配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-14
+ */
+@Service
+public class ThirdConfigServiceImpl extends ServiceImpl<ThirdConfigMapper, ThirdConfig> implements IThirdConfigService {
+
+}

+ 51 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceOperationRecordJob.java

@@ -0,0 +1,51 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceBidWarningService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class BytedanceOperationRecordJob {
+    @Autowired
+    private IBytedanceInterfaceService bytedanceInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
+
+    @XxlJob("bytedanceOperationRecordJob")
+    public ReturnT<String> execute(String startDate, String endDate) throws Exception {
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            return ReturnT.FAIL;
+        }
+
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        if (null == tokens || tokens.size() <= 0) {
+            XxlJobLogger.log("定时获取头条操作记录数据异常:未获取到可用的token");
+            return ReturnT.FAIL;
+        }
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    XxlJobLogger.log("定时获取头条操作记录数据开始,accountId:" + token.getAccountId() + "操作目标为:" + 2 + "时间:" + startDate + "~" + endDate);
+                    bytedanceInterfaceService.searchLog(token.getAccountId(), token, 2, startDate, endDate);
+                    XxlJobLogger.log("定时获取头条操作记录数据结束,accountId:" + token.getAccountId() + "操作目标为:" + 2 + "时间:" + startDate + "~" + endDate);
+                }
+            });
+        });
+        return ReturnT.SUCCESS;
+    }
+}

+ 21 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java

@@ -3,10 +3,11 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouActionBarText;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActionBarTextService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IMaterialRefuseService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -28,13 +30,13 @@ import java.util.concurrent.Executors;
 @RequestMapping("/MaterialRefuse/")
 public class MaterialRefuseController {
     @Autowired
-    private IMaterialRefuseService materialRefuseService;
-    @Autowired
     private CtopOauthTokenMapper oauthTokenMapper;
     @Autowired
     private IKuaiShouUpdateService updateService;
     @Autowired
     private IKuaiShouCreativeService creativeService;
+    @Autowired
+    private IKuaiShouActionBarTextService actionBarTextService;
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
 
 
@@ -61,6 +63,22 @@ public class MaterialRefuseController {
     }
 
 
+    @GetMapping(value = "getAllActionBarText")
+    public Result<List<KuaiShouActionBarText>> getAllActionBarText() {
+        Result<List<KuaiShouActionBarText>> result = new Result<>();
+        try {
+            //  QueryWrapper<KuaiShouActionBarText> actionBarTextQueryWrapper = new QueryWrapper<>();
+            List<KuaiShouActionBarText> list = actionBarTextService.list();
+            result.setResult(list);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
     @GetMapping(value = "syncCreative")
     public Result<Boolean> syncCreative(Long accountId, Long campaignId) {
         Result<Boolean> result = new Result<>();

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java

@@ -86,7 +86,9 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
         headers.put("Access-Token", accessToken);
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
-        param.put("campaign_id", campaignId);
+        if (!Check.isNull(campaignId)) {
+            param.put("campaign_id", campaignId);
+        }
         param.put("page_size", 200);
         param.put("page", page);
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl2.java

@@ -10,7 +10,6 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService2;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.ArrayStack;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

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

@@ -0,0 +1,82 @@
+package cn.com.ctop.toutiao.modules.report.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+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.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by JQ.bi on 2020.6.5
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/bytedance/report")
+public class BytedanceInterfaceController {
+
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+    @Autowired
+    private IBytedanceInterfaceService bytedanceInterfaceService;
+
+
+    /**
+     * 头条视频素材报表--此接口仅有视频素材,单个accountId拉取数据
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/bytedancePlayableReportByAccountId")
+    public Result bytedancePlayableReportByAccountId(@RequestParam(name = "startDate") String startDate,
+                                                          @RequestParam(name = "endDate") String endDate,
+                                                          @RequestParam(name = "accountId") Long accountId) {
+        Result result = new Result<>();
+        if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)||accountId==null){
+            result.error500("开始时间,结束时间和账户id不能为空");
+            return result;
+        }
+        try {
+            log.info("头条获取单个账户视频素材报表数据任务执行开始");
+            Long starttime = System.currentTimeMillis();
+            CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+            if (null == token ) {
+                log.info("头条获取单个账户视频素材报表数据任务执行失败:未获取到可用的token");
+                return result;
+            }
+
+            //间隔天数
+            Long days = DateUtils.getDiscrepantDays(startDate, endDate);
+            String start = null;
+            String end = null;
+            for (int i = 0; i <= days; i++) {
+                start = DateUtils.addDay(startDate, i);
+                end = start;
+                //获取头条素材报表数据
+                bytedanceInterfaceService.bytedancePlayableReport(token, start, end);
+            }
+
+            Long endtime = System.currentTimeMillis();
+            log.info("头条获取视频素材报表数据任务执行结束,执行耗时:{}秒", (endtime - starttime) / 1000);
+        } catch (Exception e) {
+            log.error("头条获取视频素材报表数据任务执行结失败");
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+}

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceOperationRecord.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.material.entity;
+package cn.com.ctop.toutiao.modules.report.entity;
 
 import lombok.Data;
 

+ 527 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceReportPlayableDaily.java

@@ -0,0 +1,527 @@
+package cn.com.ctop.toutiao.modules.report.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.util.DateUtils;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 头条视频素材日报表--仅包含视频素材
+ * @author sunzhen
+ */
+@Data
+@TableName("ctop_bytedance_report_playable_daily")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_report_playable_daily", description="头条视频素材日报表--仅包含视频素材")
+public class BytedanceReportPlayableDaily {
+
+	/**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;
+
+	/**点击量1*/
+	@Excel(name = "点击量1", width = 15)
+	@ApiModelProperty(value = "点击量1")
+	private Integer click;
+	/**总花费1*/
+	@Excel(name = "总花费1", width = 15)
+	@ApiModelProperty(value = "总花费1")
+	private 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 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;
+	/**互动数据-关注数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;
+	/**次留数1*/
+	@Excel(name = "次留数1", width = 15)
+	@ApiModelProperty(value = "次留数1")
+	private Integer nextDayOpen;
+	/**次留率1*/
+	@Excel(name = "次留率1", width = 15)
+	@ApiModelProperty(value = "次留率1")
+	private BigDecimal nextDayOpenRate;
+	/**次留成本*/
+	@Excel(name = "次留成本", width = 15)
+	@ApiModelProperty(value = "次留成本")
+	private BigDecimal nextDayOpenCost;
+	/**素材类型*/
+	@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 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 BigDecimal activePayCost;
+	/**download*/
+	@Excel(name = "download", width = 15)
+	@ApiModelProperty(value = "download")
+	private Integer download;
+	/**cpa*/
+	@Excel(name = "cpa", width = 15)
+	@ApiModelProperty(value = "cpa")
+	private BigDecimal cpa;
+	/**cpc*/
+	@Excel(name = "cpc", width = 15)
+	@ApiModelProperty(value = "cpc")
+	private BigDecimal cpc;
+	/**locationClick*/
+	@Excel(name = "locationClick", width = 15)
+	@ApiModelProperty(value = "locationClick")
+	private Integer locationClick;
+	/**playOverRate*/
+	@Excel(name = "playOverRate", width = 15)
+	@ApiModelProperty(value = "playOverRate")
+	private BigDecimal playOverRate;
+	/**ctr*/
+	@Excel(name = "ctr", width = 15)
+	@ApiModelProperty(value = "ctr")
+	private BigDecimal ctr;
+	/**cpm*/
+	@Excel(name = "cpm", width = 15)
+	@ApiModelProperty(value = "cpm")
+	private BigDecimal cpm;
+	/**wifiPlayRate*/
+	@Excel(name = "wifiPlayRate", width = 15)
+	@ApiModelProperty(value = "wifiPlayRate")
+	private BigDecimal wifiPlayRate;
+	/**like*/
+	@Excel(name = "like", width = 15)
+	@ApiModelProperty(value = "like")
+	private Integer likeMaterial;
+	/**activePayRate*/
+	@Excel(name = "activePayRate", width = 15)
+	@ApiModelProperty(value = "activePayRate")
+	private BigDecimal activePayRate;
+	/**activeCost*/
+	@Excel(name = "activeCost", width = 15)
+	@ApiModelProperty(value = "activeCost")
+	private BigDecimal activeCost;
+	/**gameAddictionCost*/
+	@Excel(name = "gameAddictionCost", width = 15)
+	@ApiModelProperty(value = "gameAddictionCost")
+	private BigDecimal gameAddictionCost;
+	/**gameAddiction*/
+	@Excel(name = "gameAddiction", width = 15)
+	@ApiModelProperty(value = "gameAddiction")
+	private Integer gameAddiction;
+	/**activeRate*/
+	@Excel(name = "activeRate", width = 15)
+	@ApiModelProperty(value = "activeRate")
+	private 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 BigDecimal gameAddictionRate;
+	/**activeRegisterRate*/
+	@Excel(name = "activeRegisterRate", width = 15)
+	@ApiModelProperty(value = "activeRegisterRate")
+	private BigDecimal activeRegisterRate;
+	/**averageVideoPlay*/
+	@Excel(name = "averageVideoPlay", width = 15)
+	@ApiModelProperty(value = "averageVideoPlay")
+	private BigDecimal averageVideoPlay;
+	/**downloadFinishCost*/
+	@Excel(name = "downloadFinishCost", width = 15)
+	@ApiModelProperty(value = "downloadFinishCost")
+	private 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 BigDecimal activeRegisterCost;
+	/**show*/
+	@Excel(name = "show", width = 15)
+	@ApiModelProperty(value = "show")
+	private Integer showMaterial;
+	/**convertRate*/
+	@Excel(name = "convertRate", width = 15)
+	@ApiModelProperty(value = "convertRate")
+	private BigDecimal convertRate;
+	/**downloadFinishRate*/
+	@Excel(name = "downloadFinishRate", width = 15)
+	@ApiModelProperty(value = "downloadFinishRate")
+	private BigDecimal downloadFinishRate;
+	/**installFinishRate*/
+	@Excel(name = "installFinishRate", width = 15)
+	@ApiModelProperty(value = "installFinishRate")
+	private 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;
+	/**playOver*/
+	@Excel(name = "playOver", width = 15)
+	@ApiModelProperty(value = "playOver")
+	private Integer playOver;
+	/**downloadStartCost*/
+	@Excel(name = "downloadStartCost", width = 15)
+	@ApiModelProperty(value = "downloadStartCost")
+	private 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 BigDecimal validPlayRate;
+	/**averagePlayTimePerPlay*/
+	@Excel(name = "averagePlayTimePerPlay", width = 15)
+	@ApiModelProperty(value = "averagePlayTimePerPlay")
+	private BigDecimal averagePlayTimePerPlay;
+	/**convertCost*/
+	@Excel(name = "convertCost", width = 15)
+	@ApiModelProperty(value = "convertCost")
+	private BigDecimal convertCost;
+	/**convertShowRate*/
+	@Excel(name = "convertShowRate", width = 15)
+	@ApiModelProperty(value = "convertShowRate")
+	private BigDecimal convertShowRate;
+	/**installFinishCost*/
+	@Excel(name = "installFinishCost", width = 15)
+	@ApiModelProperty(value = "installFinishCost")
+	private BigDecimal installFinishCost;
+
+	private BigDecimal downloadStartRate;
+
+
+
+
+	public BytedanceReportPlayableDaily() {
+	}
+
+	public BytedanceReportPlayableDaily(JSONObject detailJson, Long accountId) {
+		JSONObject dimensions = detailJson.getJSONObject("dimensions");
+		this.accountId = accountId;
+		//this.setPlayableName(dimensions.getString("playable_name"));
+		//this.setPlayableUrl(dimensions.getString("playable_url"));
+		//this.setPlayableId(dimensions.getLong("playable_id"));
+		//this.setPlayablePreviewUrl(dimensions.getString("playable_preview_url"));
+		//this.setPlayableOrientation(dimensions.getString("playable_orientation"));
+		this.setStatDatetime(dimensions.getDate("stat_datetime") == null ? null : DateUtils.formatDate(dimensions.getDate("stat_datetime"), "yyyy-MM-dd"));
+
+		JSONObject metrics = detailJson.getJSONObject("metrics");
+		this.setActivePayAmount(metrics.getInteger("active_pay_amount"));
+		this.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
+		this.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
+		this.setNextDayOpen(metrics.getInteger("next_day_open"));
+		this.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
+		this.setConvertMaterial(metrics.getInteger("convert"));
+		this.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
+		this.setInAppCart(metrics.getInteger("in_app_cart"));
+		this.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
+		this.setConsultEffective(metrics.getInteger("consult_effective"));
+		this.setViewMaterial(metrics.getInteger("view"));
+		this.setDownload(metrics.getInteger("download"));
+		this.setCpa(metrics.getBigDecimal("cpa"));
+		this.setCpc(metrics.getBigDecimal("cpc"));
+		this.setLocationClick(metrics.getInteger("location_click"));
+		this.setPhoneConfirm(metrics.getInteger("phone_confirm"));
+		this.setIesMusicClick(metrics.getInteger("ies_music_click"));
+		this.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
+		this.setWifiPlay(metrics.getInteger("wifi_play"));
+		this.setShopping(metrics.getInteger("shopping"));
+		this.setQq(metrics.getInteger("qq"));
+		this.setCtr(metrics.getBigDecimal("ctr"));
+		this.setCpm(metrics.getBigDecimal("cpm"));
+		this.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
+		this.setLikeMaterial(metrics.getInteger("like"));
+		this.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
+		this.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
+		this.setActiveCost(metrics.getBigDecimal("active_cost"));
+		this.setActive(metrics.getInteger("active"));
+		this.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
+		this.setGameAddiction(metrics.getInteger("game_addiction"));
+		this.setActiveRate(metrics.getBigDecimal("active_rate"));
+		this.setClick(metrics.getInteger("click"));
+		this.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
+		this.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
+		this.setDownloadStart(metrics.getInteger("download_start"));
+		this.setHomeVisited(metrics.getInteger("home_visited"));
+		this.setPhone(metrics.getInteger("phone"));
+		this.setPhoneEffective(metrics.getInteger("phone_effective"));
+		this.setInAppPay(metrics.getInteger("in_app_pay"));
+		this.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
+		this.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
+		this.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
+		this.setTotalPlay(metrics.getInteger("total_play"));
+		this.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
+		this.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
+		this.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
+		this.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
+		this.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
+		this.setShowMaterial(metrics.getInteger("show"));
+		this.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
+		this.setMapSearch(metrics.getInteger("map_search"));
+		this.setButton(metrics.getInteger("button"));
+		this.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
+		this.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
+		this.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
+		this.setConvertRate(metrics.getBigDecimal("convert_rate"));
+		this.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
+		this.setConsult(metrics.getInteger("consult"));
+		this.setShareMaterial(metrics.getInteger("share"));
+		this.setVote(metrics.getInteger("vote"));
+		this.setValidPlay(metrics.getInteger("valid_play"));
+		this.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
+		this.setRedirect(metrics.getInteger("redirect"));
+		this.setPayCount(metrics.getInteger("pay_count"));
+		this.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
+		this.setCost(metrics.getBigDecimal("cost"));
+		this.setPhoneConnect(metrics.getInteger("phone_connect"));
+		this.setCoupon(metrics.getInteger("coupon"));
+		this.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
+		this.setDownloadFinish(metrics.getInteger("download_finish"));
+		this.setWechat(metrics.getInteger("wechat"));
+		this.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
+		this.setInstallFinish(metrics.getInteger("install_finish"));
+		this.setLottery(metrics.getInteger("lottery"));
+		this.setPlayOver(metrics.getInteger("play_over"));
+		this.setInAppOrder(metrics.getInteger("in_app_order"));
+		this.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
+		this.setFollow(metrics.getInteger("follow"));
+		this.setMessage(metrics.getInteger("message"));
+		this.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
+		this.setPlayDuration(metrics.getInteger("play_duration"));
+		this.setForm(metrics.getInteger("form"));
+		this.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
+		this.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
+		this.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
+		this.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
+		this.setCommentMaterial(metrics.getInteger("comment"));
+		this.setInAppUv(metrics.getInteger("in_app_uv"));
+		this.setRegister(metrics.getInteger("register"));
+		this.setConvertCost(metrics.getBigDecimal("convert_cost"));
+	}
+
+}

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

@@ -1,9 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.mapper;
 
-import cn.com.ctop.toutiao.modules.material.entity.ByteDanceOperationRecord;
-import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import cn.com.ctop.toutiao.modules.report.entity.ByteDanceOperationRecord;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;

+ 35 - 29
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceOperationRecordMapper.xml

@@ -3,24 +3,26 @@
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceOperationRecordMapper">
 
     <select id="insertOperationRecordCampaign">
-        insert into
+        replace into
         ctop_bytedance_operation_record_campaign
         (
-            account_id,
-            object_id,
-            object_type,
-            content_title,
-            object_name,
-            operation_create_time,
-            content_log,
-            operator,
-            opt_ip,
-            operation_target
+        account_id,
+        stat_date,
+        object_id,
+        object_type,
+        content_title,
+        object_name,
+        operation_create_time,
+        content_log,
+        operator,
+        opt_ip,
+        operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -28,31 +30,33 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>
     </select>
 
     <select id="insertOperationRecordPlan">
-        insert into
+        replace into
         ctop_bytedance_operation_record_plan
         (
-            account_id,
-            object_id,
-            object_type,
-            content_title,
-            object_name,
-            operation_create_time,
-            content_log,
-            operator,
-            opt_ip,
-            operation_target
+        account_id,
+        stat_date,
+        object_id,
+        object_type,
+        content_title,
+        object_name,
+        operation_create_time,
+        content_log,
+        operator,
+        opt_ip,
+        operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -60,17 +64,18 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>
     </select>
 
     <select id="insertOperationRecordCreative">
-        insert into
+        replace into
         ctop_bytedance_operation_record_creative
         (
         account_id,
+        stat_date,
         object_id,
         object_type,
         content_title,
@@ -82,9 +87,10 @@
         operation_target
         )
         values
-        <foreach collection="records" item="report" separator=",">
+        <foreach collection="records" item="record" separator=",">
             (
             #{record.accountId},
+            #{record.statDate},
             #{record.objectId},
             #{record.objectType},
             #{record.contentTitle},
@@ -92,7 +98,7 @@
             #{record.operationCreateTime},
             #{record.contentLog},
             #{record.operator},
-            #{record.type},
+            #{record.optIp},
             #{record.operationTarget}
             )
         </foreach>

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

@@ -6,4 +6,7 @@ public interface IBytedanceInterfaceService {
 
     void searchLog(Long accountId, CtopOauthToken token, Integer operationType, String startDate, String endDate);
 
+    //头条试玩报表
+    int bytedancePlayableReport(CtopOauthToken token, String startDate, String endDate);
+
 }

+ 119 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java

@@ -1,16 +1,17 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCampaign;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
-import cn.com.ctop.toutiao.modules.material.entity.ByteDanceOperationRecord;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedancePlanDailyReport;
+import cn.com.ctop.toutiao.modules.report.entity.ByteDanceOperationRecord;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportVideoMaterialDaily;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceOperationRecordMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
 import com.alibaba.fastjson.JSONArray;
@@ -114,7 +115,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
 
         JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
         if (json == null) {
-            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data));
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data) + ";;;返回值为:"+ json);
             return ;
         }
 
@@ -141,7 +142,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 record.setOperationCreateTime(logJson.getDate("create_time"));
                 record.setStatDate(DateUtils.formatDate(logJson.getDate("create_time")));
                 record.setOperator(logJson.getString("operator"));
-                record.setOptIp(logJson.getString("opt_id"));
+                record.setOptIp(logJson.getString("opt_ip"));
                 record.setOperationTarget(operationType);
 
                 records.add(record);
@@ -156,9 +157,10 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 logSearchByPage(page+1, pageSize, token, accountId, objectId, operationType, startTime, endTime);
             }
         }else{
-            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data),";;;返回值为:"+ json);
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data)+";;;返回值为:"+ json);
             return ;
         }
+        //return 200;
     }
 
     private void insertLog(Integer operationTarget, List<ByteDanceOperationRecord> records){
@@ -171,4 +173,115 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
         }
     }
 
+    //////////////////////////////////////////////////
+
+
+    /**
+     * 头条视频素材报表
+     * @param token
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public int bytedancePlayableReport(CtopOauthToken token, String startDate, String endDate) {
+        Long accountId = token.getAccountId();
+        log.info("头条素材报表当前accountId为:{}  {}~{},开始" , accountId, startDate,endDate);
+        Integer page = 1;
+        Integer pageSize = 100;
+        int code = bytedancePlayableReportByPage(page, pageSize, token, accountId, startDate, endDate);
+        if (code != 200 && code != 1) {
+            BytedanceReportMaterialRetry retry = new BytedanceReportMaterialRetry();
+            retry.setAccountId(accountId);
+            retry.setStatus(0);
+            retry.setStartDate(startDate);
+            retry.setEndDate(endDate);
+            retry.setStatusCode(code);
+            retry.setType(2);  //1素材报表重试,2视频素材报表重试
+            //bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
+        }
+        log.info("头条素材报表当前accountId为:{}  {}~{},结束" , accountId, startDate,endDate);
+        return code;
+    }
+
+    private int bytedancePlayableReportByPage(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/";
+
+        // 请求参数
+        Map data = new HashMap();
+        data.put("advertiser_id", accountId);
+        data.put("start_date", startDate);
+        data.put("end_date", endDate);
+        data.put("page", page);
+        data.put("page_size", pageSize);
+        data.put("group_by", new String[]{"STAT_GROUP_BY_PLAYABLE_ID", "STAT_GROUP_BY_TIME_DAY"});  //, "STAT_GROUP_BY_TIME_DAY"
+
+        JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
+        if (json == null) {
+            log.error("返回为空,请求有误:" + JSONObject.toJSONString(data));
+            return -2;
+        }
+
+        int returnCode = 200;
+        try {
+            if (!Check.isNull(json)) {
+                Integer code = json.getInteger("code");
+                if (code != 0) {
+                    log.error("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + json + "请求为:" + JSONObject.toJSONString(data));
+                    return -1;
+                }
+
+                JSONObject jsonData = json.getJSONObject("data");
+                if (Check.isNull(jsonData)) {
+                    log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + json + "请求为:" + JSONObject.toJSONString(data));
+                    return -1;
+                }
+                JSONObject pageInfo = jsonData.getJSONObject("page_info");
+                Integer totalPage = pageInfo.getInteger("total_page");
+                Integer currentPage = pageInfo.getInteger("page");
+
+                JSONArray jsonArrayay = jsonData.getJSONArray("list");
+                if (jsonArrayay.size() == 0) {
+                    log.info("accountId:" + accountId + ";没有数据。总页数为:" + totalPage + "当前页数为:" + currentPage);
+                    return 1;
+                }
+
+                List<BytedanceReportVideoMaterialDaily> bytedanceReportVideoMaterialDailyList = new ArrayList<>();
+                for (int i = 0; i < jsonArrayay.size(); i++) {
+                    JSONObject detailJson = jsonArrayay.getJSONObject(i);
+                    if (!Check.isNull(detailJson)) {
+                        BytedanceReportVideoMaterialDaily daily = new BytedanceReportVideoMaterialDaily(detailJson, accountId);
+                        bytedanceReportVideoMaterialDailyList.add(daily);
+                    }
+                }
+                //bytedanceReportMaterialDailyMapper.replaceIntoVideoMaterialBatch(bytedanceReportVideoMaterialDailyList);
+                if (currentPage >= totalPage) {
+                    log.info("头条视频素材报表当前accountId为:{}  {}~{},接口数据拉取成功" , accountId, startDate,endDate);
+                    return 1;
+                } else {
+                    return bytedancePlayableReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
+                }
+            } else {
+                log.error("头条视频素材报表服务器返回为空,accountId:" + accountId + ",json:" + json + "请求为:" + JSONObject.toJSONString(data));
+                return -1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("头条视频素材报表其他错误,accountId:" + accountId + ",json:" + json + "请求为:" + JSONObject.toJSONString(data));
+            returnCode = -3;
+        }
+        return returnCode;
+    }
+
+
+
+
+
+
+
 }