瀏覽代碼

产品列表

hcst_sunzhen 4 年之前
父節點
當前提交
aa68b1978d
共有 19 個文件被更改,包括 1129 次插入60 次删除
  1. 260 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProductController.java
  2. 6 6
      jeecg-boot-module-system/src/main/resources/application-test.yml
  3. 126 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Advertiser.java
  4. 42 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Product.java
  5. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java
  6. 45 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProductMapper.java
  7. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml
  8. 208 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml
  9. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  10. 46 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProductService.java
  11. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  12. 127 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProductServiceImpl.java
  13. 25 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/ProductDto.java
  14. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/ProductInfoDto.java
  15. 51 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/ProductVO.java
  16. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/ProjectVO.java
  17. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/SaleVO.java
  18. 52 11
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceReportPlayableDaily.java
  19. 63 43
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java

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

@@ -0,0 +1,260 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.Advertiser;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.vo.ProductInfoDto;
+import cn.com.ctop.common.module.vo.ProductVO;
+import cn.com.ctop.common.module.vo.ProjectVO;
+import cn.com.ctop.manage.modules.actor.entity.Actor;
+import cn.com.ctop.manage.modules.actor.entity.ActorComment;
+import cn.com.ctop.manage.modules.actor.entity.ActorPhoto;
+import cn.com.ctop.manage.modules.actor.entity.ActorVideo;
+import cn.com.ctop.manage.modules.actor.service.IActorCommentService;
+import cn.com.ctop.manage.modules.actor.service.IActorPhotoService;
+import cn.com.ctop.manage.modules.actor.service.IActorService;
+import cn.com.ctop.manage.modules.actor.service.IActorVideoService;
+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.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@Slf4j
+@RequestMapping("/ctop/product")
+public class ProductController {
+    @Autowired
+    private IProductService productService;
+
+    //获取广告主列表
+    @ResponseBody
+    @RequestMapping(value = "/advertiserList")
+    public Result<List<Advertiser>> advertiserList(HttpServletRequest request,HttpServletResponse response){
+        log.info("/ctop/product/advertiserList 方法开始");
+        Result<List<Advertiser>> result = new Result();
+
+        try {
+            List<Advertiser> advertiserList = productService.advertiserList();
+            result.setResult(advertiserList);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/advertiserList 方法结束");
+        }
+
+        return result;
+    }
+
+    //根据广告主id获取项目列表
+    @ResponseBody
+    @RequestMapping(value = "/getProjectListByAdvertiserId")
+    public Result<List<Project>> getProjectListByAdvertiserId(@RequestBody ProductInfoDto dto,
+            HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/getProjectListByAdvertiserId 方法开始");
+        Result<List<Project>> result = new Result();
+
+        try {
+            List<Project> projectList = productService.getProjectListByAdvertiserId(dto.getAdvertiserId());
+            result.setResult(projectList);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/getProjectListByAdvertiserId 方法结束");
+        }
+
+        return result;
+    }
+
+    //根据项目列表获取运营和销售的信息
+    @ResponseBody
+    @RequestMapping(value = "/getSaleAndYunyingListByProjectIds")
+    public Result<Map<String, Object>> getSaleAndYunyingListByProjectIds(@RequestBody ProductInfoDto dto,
+                                                              HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/getProjectListByAdvertiserId 方法开始");
+        Result<Map<String, Object>> result = new Result();
+
+        try {
+            Map<String, Object> map = productService.getSaleAndYunyingListByProjectIds(dto.getProjectIds());
+            result.setResult(map);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/getProjectListByAdvertiserId 方法结束");
+        }
+
+        return result;
+    }
+
+    //逻辑删除产品
+    @ResponseBody
+    @RequestMapping(value = "/deleteProduct")
+    public Result deleteProduct(@RequestBody ProductInfoDto dto,HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/deleteProduct 方法开始");
+        Result result = new Result();
+
+        try {
+            productService.deleteProduct(dto.getProductId());
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/deleteProduct 方法结束");
+        }
+
+        return result;
+    }
+
+    //产品信息入库
+    @ResponseBody
+    @RequestMapping(value = "/insertOrUpdateProduct")
+    public Result insertOrUpdateProduct(@RequestBody ProductVO vo, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/insertOrUpdateProduct 方法开始");
+        Result result = new Result();
+
+        try {
+            productService.insertOrUpdateProduct(vo);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/insertOrUpdateProduct 方法结束");
+        }
+
+        return result;
+    }
+
+    //编辑产品反显
+    @ResponseBody
+    @RequestMapping(value = "/getProductInfo")
+    public Result<Map<String, Object>> getProductInfo(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/getProductInfo 方法开始");
+        Result<Map<String, Object>> result = new Result();
+
+        try {
+            Map<String, Object> productInfo = productService.getProductInfo(dto.getProductId());
+            result.setResult(productInfo);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/getProductInfo 方法结束");
+        }
+
+        return result;
+    }
+
+    //单独删除产品关联项目
+    @ResponseBody
+    @RequestMapping(value = "/deleteByProjectIdAndProductId")
+    public Result deleteByProjectIdAndProductId(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/deleteByProjectIdAndProductId 方法开始");
+        Result result = new Result();
+
+        try {
+            productService.deleteByProjectIdAndProductId(dto.getProjectId(), dto.getProductId());
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/deleteByProjectIdAndProductId 方法结束");
+        }
+
+        return result;
+    }
+
+    //编辑产品按钮反显
+    @ResponseBody
+    @RequestMapping(value = "/getProjectListByProductId")
+    public Result<List<ProjectVO>> getProjectListByProductId(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/getProjectListByProductId 方法开始");
+        Result<List<ProjectVO>> result = new Result();
+
+        try {
+            List<ProjectVO> projectListByProductId = productService.getProjectListByProductId(dto.getProductId());
+            result.setResult(projectListByProductId);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/getProjectListByProductId 方法结束");
+        }
+
+        return result;
+    }
+
+    //产品列表
+    @ResponseBody
+    @RequestMapping(value = "/getProductList")
+    public Result<List<ProductVO>> getProductList(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/getProductList 方法开始");
+        Result<List<ProductVO>> result = new Result();
+
+        try {
+            List<ProductVO> productList = productService.getProductList(dto.getAdvertiserName(), dto.getProductName(), dto.getPageNum(), dto.getPageSize());
+            result.setResult(productList);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/getProductList 方法结束");
+        }
+
+        return result;
+    }
+
+    //产品列表
+    @ResponseBody
+    @RequestMapping(value = "/insertProductProjectMap")
+    public Result insertProductProjectMap(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
+        log.info("/ctop/product/insertProductProjectMap 方法开始");
+        Result result = new Result();
+
+        try {
+            productService.insertProductProjectMap(dto.getProductId(), dto.getProjectIds());
+        }catch (Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("error");
+        }finally{
+            log.info("/ctop/product/insertProductProjectMap 方法结束");
+        }
+
+        return result;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+}

+ 6 - 6
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -91,16 +91,16 @@ spring:
         filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
-#      datasource:
-#        master:
-#          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          username: hcst
-#          password: test@20190531
       datasource:
         master:
-          url: jdbc:mysql://39.106.184.70/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
+#      datasource:
+#        master:
+#          url: jdbc:mysql://39.106.184.70/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: hcst
+#          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:

+ 126 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/Advertiser.java

@@ -0,0 +1,126 @@
+package cn.com.ctop.common.module.entity;
+
+import cn.com.ctop.common.module.annotation.Dict;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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 org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 广告主信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-06-11
+ */
+@Data
+@TableName("ctop_advertiser")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_advertiser对象", description = "广告主信息表")
+public class Advertiser {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "主键ID")
+    private String id;
+    /**
+     * 广告主名称
+     */
+    @Excel(name = "广告主名称", width = 15)
+    @ApiModelProperty(value = "广告主名称")
+    private String name;
+    /**
+     * 行业ID
+     */
+    @Excel(name = "行业ID", width = 15)
+    @ApiModelProperty(value = "行业ID")
+    @Dict(dicCode = "id",dictTable="sys_category",dicText="name")
+    private String industryId;
+    private String industryCode;
+    /**
+     * 销售ID
+     */
+    @Excel(name = "销售ID", width = 15)
+    @ApiModelProperty(value = "销售ID")
+    @Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
+    private String saleId;
+    /**
+     * 销售ID
+     */
+    @Excel(name = "广告主类别", width = 15)
+    @ApiModelProperty(value = "广告主类别")
+    private Integer advertiserType;
+
+    /**
+     * 代理商Id
+     */
+    private Long agentId;
+
+    /**
+     * 联系人姓名
+     */
+    @Excel(name = "联系人姓名", width = 15)
+    @ApiModelProperty(value = "联系人姓名")
+    private String contact;
+    /**
+     * 联系人手机
+     */
+    @Excel(name = "联系人手机", width = 15)
+    @ApiModelProperty(value = "联系人手机")
+    private String mobile;
+    /**
+     * 联系人邮箱
+     */
+    @Excel(name = "联系人邮箱", width = 15)
+    @ApiModelProperty(value = "联系人邮箱")
+    private String email;
+    /**
+     * 创建人
+     */
+    @Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @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 createTime;
+    /**
+     * 修改人
+     */
+    @Excel(name = "修改人", width = 15)
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**
+     * 修改时间
+     */
+    @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 updateTime;
+    private String userId;
+
+    private String companyId;
+
+    @TableField(exist = false)
+    private String saleName;
+
+
+}

+ 42 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/Product.java

@@ -0,0 +1,42 @@
+package cn.com.ctop.common.module.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 产品
+ */
+@Data
+public class Product {
+    /**
+     * id
+     */
+    private Long id;
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 广告主id
+     */
+    private String advertiserId;
+
+    /**
+     * 创建人
+     */
+    private String createUserId;
+
+    /**
+     * 媒体类型
+     */
+    private String mediaId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private Date updateTime;
+
+}

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

@@ -31,6 +31,8 @@ public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
 
     List<CtopOauthToken> selectKuaiShouToken();
 
+    List<CtopOauthToken> selectKuaiShouTokenBefore();
+
     List<CtopOauthToken> selectToutiaoToken();
 
     CtopOauthToken getAccessTokenByAccountIdAndMediaId(@Param("mediaId") Integer mediaId, @Param("accountId") Long accountId);

+ 45 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ProductMapper.java

@@ -0,0 +1,45 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.Advertiser;
+import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.vo.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+public interface ProductMapper extends BaseMapper<Product> {
+
+    void insertProduct(@Param("product") ProductVO product);
+
+    List<Advertiser> getAdvertiserList();
+
+    List<Project> getProjectListByAdvertiserId(@Param("advertiserId")String advertiserId);
+
+    List<ProductDto> getYunyingListByProjectIds(@Param("projectIds")List<Long> projectIds);
+
+    List<ProductDto> getSaleListByProjectIds(@Param("projectIds")List<Long> projectIds);
+
+    void logicDeleteProductById(@Param("id")Long id);
+
+    void deleteProductProjectMapByProductId(@Param("id")Long ProductId);
+
+    void insertProductProjectMap(@Param("projectIds")List<Long> projectIds, @Param("productId")Long productId);
+
+    void updateProduct(@Param("product")ProductVO product);
+
+    Product getProductInfo(@Param("id")Long id);
+
+    List<ProjectVO> getProjectListByProductId(@Param("productId")Long productId);
+
+    void deleteByProjectIdAndProductId(@Param("productId")Long productId, @Param("projectId")Long projectId);
+
+    List<ProductVO> getProductList(@Param("advertiserName")String advertiserName, @Param("productName")String productName);
+
+    List<SaleVO> getSalesListByProductId(@Param("productId")Long productId);
+
+    List<UserDto> getYunyingListByProductId(@Param("productId")Long productId);
+
+}

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

@@ -96,6 +96,15 @@
 
     </select>
 
+    <select id="selectKuaiShouTokenBefore" 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 t1.media_id = 2
+        and date_format(t2.create_time, '%Y-%m-%d') = date_sub(curdate(),interval 1 day)
+    </select>
+
     <select id="selectToutiaoToken" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
         select t1.*
         from ctop_oauth_token t1

+ 208 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.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.common.module.mapper.ProductMapper">
+
+    <insert id="insertProduct">
+        insert into
+        ctop_product
+        (
+            product_name,
+            media_id,
+            advertiser_id,
+            advertiser_name,
+            create_user_id,
+            product_status
+        )values(
+            #{product.productName},
+            #{product.mediaId},
+            #{product.advertiserId},
+            #{product.advertiserName},
+            #{product.createUserId},
+            #{project.productStatus}
+        )
+    </insert>
+
+    <select id="getAdvertiserList" resultType="cn.com.ctop.common.module.entity.Advertiser">
+        select
+        id as id,
+        name as name
+        from
+        ctop_advertiser
+    </select>
+
+    <select id="getProjectListByAdvertiserId" resultType="cn.com.ctop.common.module.entity.Project">
+        select
+        id,
+        project_name as projectName
+        from
+        ctop_project
+        where
+        advertiser_id = #{advertiserId}
+    </select>
+
+    <select id="getYunyingListByProjectIds" resultType="cn.com.ctop.common.module.vo.ProductDto">
+        select
+        distinct user_id as userId,
+        user_name as userName
+        from
+        ctop_user_allocation
+        where
+        project_id in
+        <foreach collection="projectIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+    </select>
+
+    <select id="getSaleListByProjectIds" resultType="cn.com.ctop.common.module.vo.ProductDto">
+        select
+        a.id as projectId,
+        a.project_name as projectName,
+        a.sale_id as saleId,
+        b.realname as saleName
+        from
+        ctop_project a
+        left join sys_user b on a.sale_id = b.id
+        where
+        a.id in
+        <foreach collection="projectIds" item="item" separator=","
+                       open="(" close=")">
+        #{item}
+        </foreach>
+    </select>
+
+    <update id="logicDeleteProductById">
+        update
+        ctop_product
+        set product_status = 0
+        where
+        id = #{id}
+    </update>
+
+    <delete id="deleteProductProjectMapByProductId">
+        delete
+        from
+        ctop_product_project_map
+        where
+        product_id  = #{id}
+    </delete>
+
+    <insert id="insertProductProjectMap">
+        insert into
+        ctop_product_project_map
+        (
+            product_id,
+            project_id,
+        )
+        values
+        <foreach collection="projectIds" item="projectId" separator=",">
+            (
+             #{productId},
+             #{projectId}
+            )
+        </foreach>
+    </insert>
+
+    <update id="updateProduct">
+        update
+        ctop_product
+        set
+        product_name = #{product.productName},
+        media_id = #{product.mediaId}
+      <!--  advertiser_id = #{product.advertiserId},
+        advertiser_name = #{product.advertiserName}  -->
+        where
+        id = #{product.id}
+    </update>
+
+    <select id="getProductInfo" resultType="cn.com.ctop.common.module.entity.Product">
+        select
+        id as id,
+        product_name as productName,
+        media_id as mediaId,
+        advertiser_id as advertiserId,
+        advertiser_name as advertiserName,
+        create_user_id as createUserId,
+        product_status as productStatus
+        from
+        ctop_product
+        where
+        id = #{id}
+    </select>
+
+    <select id="getProjectListByProductId" resultType="cn.com.ctop.common.module.vo.ProjectVO">
+        select
+        a.project_id as projectId,
+        b.project_name as projectName
+        from
+        ctop_product_project_map a
+        left join ctop_project b on a.project_id = b.id
+        where
+        a.product_id = #{productId}
+    </select>
+
+    <select id="deleteByProjectIdAndProductId">
+        delete
+        from
+        ctop_product_project_map
+        where
+        project_id = #{projectId}
+        and
+        product_id = #{productId}
+    </select>
+
+    <select id="getProductList" resultType="cn.com.ctop.common.module.vo.ProductVO">
+            select
+            id as id,
+            product_name as productName,
+            media_id as mediaId,
+            advertiser_id as advertiserId,
+            advertiser_name as advertiserName,
+            create_user_id as createUserId,
+            product_status as productStatus
+        from
+        ctop_product
+        where
+        product_status = 1 and
+        <if test="advertiserName != null and advertiserName != '' ">
+            advertiser_name like concat('%',advertiserName,'%') and
+        </if>
+        <if test="productName != null and productName != '' ">
+            product_name like concat('%', productName, '%') and
+        </if>
+        1=1
+    </select>
+
+    <select id="getSalesListByProductId" resultType="cn.com.ctop.common.module.vo.SaleVO">
+        select
+        b.sale_id as saleId,
+        c.realname as saleName
+        from
+        ctop_product_project_map a
+        left join (select id,project_name,sale_id from ctop_project) b on a.project_id = b.id
+        left join sys_user c on b.sale_id = c.id
+        where
+        product_id = #{productId}
+    </select>
+
+    <select id="getYunyingListByProductId" resultType="cn.com.ctop.common.module.vo.UserDto">
+        select
+        user_id as userId,
+        user_name as realname
+        from
+        ctop_user_allocation a
+        where
+        project_id in (
+        select project_id
+        from
+        ctop_product_project_map
+        where product_id = #{id}
+        )
+
+    </select>
+
+
+
+
+</mapper>

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

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

+ 46 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IProductService.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.Advertiser;
+import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.vo.ProductVO;
+import cn.com.ctop.common.module.vo.ProjectVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-19
+ */
+public interface IProductService extends IService<Product> {
+
+    List<Advertiser> advertiserList();
+
+    List<Project> getProjectListByAdvertiserId(String advertiserId);
+
+    Map<String,Object> getSaleAndYunyingListByProjectIds(List<Long> projectIds);
+
+    void deleteProduct(Long id);
+
+    void insertOrUpdateProduct(ProductVO product);
+
+    void insertProductProjectMap(Long productId, List<Long> projectIds);
+
+    Map<String, Object> getProductInfo(Long productId);
+
+    void deleteByProjectIdAndProductId(Long projectId, Long productId);
+
+    List<ProjectVO> getProjectListByProductId(Long productId);
+
+    List<ProductVO> getProductList(String advertiserName, String productName, Integer pageNum, Integer pageSize);
+
+
+
+
+
+}

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

@@ -190,6 +190,11 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         return ctopOauthTokenMapper.selectKuaiShouToken();
     }
 
+    @Override
+    public List<CtopOauthToken> selectKuaiShouTokenBefore() {
+        return ctopOauthTokenMapper.selectKuaiShouTokenBefore();
+    }
+
 
     /**
      * 获取toutiao有效账户列表

+ 127 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProductServiceImpl.java

@@ -0,0 +1,127 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.Advertiser;
+import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.mapper.ProductMapper;
+import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.vo.*;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Service
+public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {
+
+    @Autowired
+    private ProductMapper productMapper;
+
+    @Override
+    public List<Advertiser> advertiserList(){
+        return productMapper.getAdvertiserList();
+    }
+
+    @Override
+    public List<Project> getProjectListByAdvertiserId(String advertiserId){
+        return productMapper.getProjectListByAdvertiserId(advertiserId);
+    }
+
+    @Override
+    public Map<String,Object> getSaleAndYunyingListByProjectIds(List<Long> projectIds){
+        Map<String,Object> map = new HashMap<>();
+
+        List<ProductDto> saleList = productMapper.getSaleListByProjectIds(projectIds);
+        List<ProductDto> yunyingeList = productMapper.getYunyingListByProjectIds(projectIds);
+
+        map.put("saleList",saleList);
+        map.put("yunyingList",yunyingeList);
+
+        return map;
+    }
+
+    @Override
+    public void deleteProduct(Long id){
+        productMapper.logicDeleteProductById(id);
+    }
+
+    @Override
+    public void insertOrUpdateProduct(ProductVO product){
+        //更新
+        if(product.getId() != null){
+            //productMapper.deleteProductProjectMapByProductId(product.getId());
+            //if(product.getProjectIds() != null && product.getProjectIds().size() != 0 ){
+            //    productMapper.insertProductProjectMap(product.getProjectIds(), product.getId());
+            //}
+            productMapper.updateProduct(product);
+        }else { //入库
+            if(product.getProjectIds() != null && product.getProjectIds().size() != 0 ){
+                productMapper.insertProductProjectMap(product.getProjectIds(), product.getId());
+            }
+
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            product.setCreateUserId(sysUser.getId());
+            productMapper.insertProduct(product);
+        }
+    }
+
+    @Override
+    public void insertProductProjectMap(Long productId, List<Long> projectIds){
+        productMapper.insertProductProjectMap(projectIds, productId);
+    }
+
+  @Override
+    public Map<String, Object> getProductInfo(Long productId){
+        Map<String,Object> map = new HashMap<>();
+
+        Product product = productMapper.getProductInfo(productId);
+        List<ProjectVO> projectList = productMapper.getProjectListByProductId(productId);
+
+        map.put("product",product);
+        map.put("projectList",projectList);
+
+        return map;
+    }
+
+    @Override
+    public void deleteByProjectIdAndProductId(Long projectId, Long productId){
+        productMapper.deleteByProjectIdAndProductId(productId, projectId);
+    }
+
+    @Override
+    public List<ProjectVO> getProjectListByProductId(Long productId){
+        return productMapper.getProjectListByProductId(productId);
+    }
+
+    @Override
+    public List<ProductVO> getProductList(String advertiserName, String productName, Integer pageNum, Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductVO> productList = productMapper.getProductList(advertiserName, productName);
+
+        for(ProductVO product:productList){
+            List<ProjectVO> projectListByProductId = productMapper.getProjectListByProductId(product.getId());
+            List<SaleVO> salesListByProductId = productMapper.getSalesListByProductId(product.getId());
+            List<UserDto> yunyingListByProductId = productMapper.getYunyingListByProductId(product.getId());
+
+            product.setProjectList(projectListByProductId);
+            product.setSaleList(salesListByProductId);
+            product.setYunyingList(yunyingListByProductId);
+        }
+
+        return productList;
+
+    }
+
+
+
+
+
+
+}

+ 25 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/ProductDto.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.common.module.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class ProductDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String userId;
+
+    private String userName;
+
+    private String saleId;
+
+    private String saleName;
+
+    private Long projectId;
+
+    private String projectName;
+
+}

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/ProductInfoDto.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.common.module.vo;
+
+import com.github.pagehelper.PageInfo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class ProductInfoDto extends PageInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String advertiserId;
+
+    private List<Long> projectIds;
+
+    private Long productId;
+
+    private Long projectId;
+
+    private String advertiserName;
+
+    private String productName;
+
+}

+ 51 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/ProductVO.java

@@ -0,0 +1,51 @@
+package cn.com.ctop.common.module.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品
+ */
+@Data
+public class ProductVO {
+    /**
+     * id
+     */
+    private Long id;
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 广告主id
+     */
+    private String advertiserId;
+
+    /**
+     * 创建人
+     */
+    private String createUserId;
+
+    /**
+     * 媒体类型
+     */
+    private String mediaId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private Date updateTime;
+
+    private List<Long> projectIds;
+
+    private List<ProjectVO> projectList;
+
+    private List<SaleVO> saleList;
+
+    private List<UserDto> yunyingList;
+
+}

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/ProjectVO.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.common.module.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品
+ */
+@Data
+public class ProjectVO {
+   private Long projectId;
+   private String projectName;
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/SaleVO.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品
+ */
+@Data
+public class SaleVO {
+
+    private String saleId;
+
+    private String saleName;
+
+}

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.entity;
 
+import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -411,10 +412,50 @@ public class BytedanceReportPlayableDaily {
 	@Excel(name = "installFinishCost", width = 15)
 	@ApiModelProperty(value = "installFinishCost")
 	private BigDecimal installFinishCost;
-
 	private BigDecimal downloadStartRate;
 
+	private String playableName;  //试玩素材名称
+	private String playableUrl;  //试玩素材链接
+	private Long playableId;  //试玩素材ID
+	private String playablePreviewUrl; //试玩素材预览链接
+	private String playableOrientation; //试玩素材展示方向
+	private Long poi_address_click;  //落地页及门店数据-查看店铺地址
+	private BigDecimal attribution_convert_cost;  //转化数据(计费时间)-转化成本(计费时间)
 
+	private Long click_website;  //互动数据-主页内落地页访问量(主页官网访问量)
+	private Long message_action;  //互动数据-私信数
+	private Long advanced_creative_form_submit;  //附加创意-附加创意表单提交
+	private Long luban_live_slidecart_click_cnt;  //落地页及门店数据-直播间查看购物车数
+	private Long poi_collect;  //落地页及门店数据-店铺收藏
+	private Long luban_order_cnt;  //落地页及门店数据-鲁班订单量
+	private BigDecimal attribution_next_day_open_rate;  //应用下载广告数据-次留率
+	private Long attribution_next_day_open_cnt;  //应用下载广告数据-次留数
+	private BigDecimal loan_credit_rate;  //应用下载广告数据-授信率
+	private BigDecimal loan_credit_cost;  //应用下载广告数据-授信成本
+	private BigDecimal luban_order_stat_amount;  //落地页及门店数据-鲁班订单金额
+	private Long luban_live_enter_cnt;  //落地页及门店数据-直播间观看数
+	private Long click_landing_page;  //互动数据-推广页访问量
+	private Long luban_live_follow_cnt;  //落地页及门店数据-直播间关注数
+	private Long click_shopwindow;  //互动数据-主页商品橱窗访问量
+	private Long attribution_deep_convert;  //转化数据(计费时间)-深度转化数(计费时间)
+	private Long luban_live_pay_order_count ; //落地页及门店数据-直播间订单量
+	private BigDecimal luban_live_pay_order_stat_cost;  //落地页及门店数据-直播间订单金额
+	private Long card_show;  //视频数据3秒卡片展现
+	private Long pre_loan_credit;  //应用下载广告数据-预授信数
+	private Long redirect_to_shop; //落地页及门店数据-调起店铺
+	private BigDecimal attribution_deep_convert_cost;  //转化数据(计费时间)-深度转化成本(计费时间)
+	private BigDecimal pre_loan_credit_cost;  //应用下载广告数据-预授信成本
+	private BigDecimal avg_click_cost;  //展现数据-平均点击单价
+	private Long attribution_convert;  //转化数据(计费时间)-转化数(计费时间)
+	private BigDecimal attribution_next_day_open_cost;  //应用下载广告数据-次留成本
+	private BigDecimal loan_completion_rate;  //应用下载广告数据-完件率
+	private Long click_download;  //互动数据-主页下载链接点击量
+	private BigDecimal loan_completion_cost;  //应用下载广告数据-完件成本
+	private BigDecimal luban_order_roi;  //落地页及门店数据-鲁班ROI
+	private Long loan_completion;  //应用下载广告数据-完件数
+	private Long loan_credit; //应用下载广告数据-授信数
+	private BigDecimal avg_show_cost;  //展现数据-平均千次展现费用
+	private Long click_call_dy;  //互动数据-主页内电话拨打点击量
 
 
 	public BytedanceReportPlayableDaily() {
@@ -423,24 +464,24 @@ public class 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.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.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));  //1
 		this.setNextDayOpen(metrics.getInteger("next_day_open"));
-		this.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
-		this.setConvertMaterial(metrics.getInteger("convert"));
+		this.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition")); //1
+		this.setConvertMaterial(metrics.getInteger("convert")); //1
 		this.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
-		this.setInAppCart(metrics.getInteger("in_app_cart"));
+		this.setInAppCart(metrics.getInteger("in_app_cart")); //1
 		this.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
-		this.setConsultEffective(metrics.getInteger("consult_effective"));
+		this.setConsultEffective(metrics.getInteger("consult_effective")); //1
 		this.setViewMaterial(metrics.getInteger("view"));
 		this.setDownload(metrics.getInteger("download"));
 		this.setCpa(metrics.getBigDecimal("cpa"));

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

@@ -68,7 +68,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 parameterQueryWrapper.select("id");
                 List<ByteDanceCampaign> list = byteDanceCampaignService.list(parameterQueryWrapper);
                 for (ByteDanceCampaign campaign:list){
-                    logSearchByPage(pageNum, pageSize, token, accountId, campaign.getId(), 2, startTime, endTime);  //组
+                    int code = logSearchByPage(pageNum, pageSize, token, accountId, campaign.getId(), 2, startTime, endTime);  //组
                 }
             }else if(operationTarget == 3){
                 QueryWrapper<ByteDanceAdvertisePlan> parameterQueryWrapper = new QueryWrapper<>();
@@ -76,7 +76,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 parameterQueryWrapper.select("id");
                 List<ByteDanceAdvertisePlan> list = byteDanceAdvertisePlanService.list(parameterQueryWrapper);
                 for (ByteDanceAdvertisePlan plan:list){
-                    logSearchByPage(pageNum, pageSize, token, accountId, plan.getId(), 3, startTime, endTime);  //计划
+                    int code = logSearchByPage(pageNum, pageSize, token, accountId, plan.getId(), 3, startTime, endTime);  //计划
                 }
             }else if(operationTarget == 4){
                 QueryWrapper<ByteDanceCreative> parameterQueryWrapper = new QueryWrapper<>();
@@ -84,7 +84,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
                 parameterQueryWrapper.select("id");
                 List<ByteDanceCreative> list = byteDanceCreativeService.list(parameterQueryWrapper);
                 for(ByteDanceCreative creative:list){
-                    logSearchByPage(pageNum, pageSize, token, accountId, creative.getId(), 4, startTime, endTime);  //创意
+                    int code = logSearchByPage(pageNum, pageSize, token, accountId, creative.getId(), 4, startTime, endTime);  //创意
                 }
             }
         }catch (Exception e){
@@ -93,7 +93,7 @@ public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService
         }
     }
 
-    private void logSearchByPage(Integer pageNum, Integer pageSize, CtopOauthToken token, Long accountId, Long objectId, Integer operationType, String startTime, String endTime) {
+    private int logSearchByPage(Integer pageNum, Integer pageSize, CtopOauthToken token, Long accountId, Long objectId, Integer operationType, String startTime, String endTime) {
         log.info("当前页数:" + pageNum);
         String access_token = token.getAccessToken();
 
@@ -116,51 +116,71 @@ 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) + ";;;返回值为:"+ json);
-            return ;
+            return -2;
         }
 
-        int code =  json.getInteger("code");
-        if(code == 0){
-            List<ByteDanceOperationRecord>  records = new ArrayList<>();
-
-            JSONObject dataResultJson = json.getJSONObject("data");
-            JSONObject pageInfoJson = dataResultJson.getJSONObject("page_info");
-            int totalPage = pageInfoJson.getInteger("total_number");
-            int page = pageInfoJson.getInteger("page");
-
-            JSONArray logsArray = dataResultJson.getJSONArray("logs");
-            int logsSize = logsArray.size();
-            for (int i=0; i<logsSize ;i++){
-                JSONObject logJson =  logsArray.getJSONObject(i);
-                ByteDanceOperationRecord record = new ByteDanceOperationRecord();
-                record.setAccountId(accountId);
-                record.setContentTitle(logJson.getString("content_title"));
-                record.setContentLog(logJson.getString("content_log"));
-                record.setObjectId(logJson.getLong("object_id"));
-                record.setObjectName(logJson.getString("object_name"));
-                record.setObjectType(logJson.getString("object_type"));
-                record.setOperationCreateTime(logJson.getDate("create_time"));
-                record.setStatDate(DateUtils.formatDate(logJson.getDate("create_time")));
-                record.setOperator(logJson.getString("operator"));
-                record.setOptIp(logJson.getString("opt_ip"));
-                record.setOperationTarget(operationType);
-
-                records.add(record);
-            }
+        Integer returnCode = 200;
+        try {
+            int code = json.getInteger("code");
+            if (code == 0) {
+                List<ByteDanceOperationRecord> records = new ArrayList<>();
 
-            //按类型入库
-            if(records !=null && records.size()!=0){
-                insertLog(operationType, records);
-            }
+                JSONObject dataResultJson = json.getJSONObject("data");
+                JSONArray logsArray = dataResultJson.getJSONArray("logs");
+                JSONObject pageInfoJson = dataResultJson.getJSONObject("page_info");
+
+                if (Check.isNull(logsArray) || Check.isNull(pageInfoJson)) {
+                    log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + json + "请求为:" + JSONObject.toJSONString(data));
+                    return -1;
+                }
+
+                int totalPage = pageInfoJson.getInteger("total_number");
+                int page = pageInfoJson.getInteger("page");
+
+                if (totalPage == 0) {
+                    log.info("头条日志查询返回页数为0,请求:" + JSONObject.toJSONString(data) + ";;;返回值为:"+ json);
+                    return 1;
+                }
 
-            if(page < totalPage){
-                logSearchByPage(page+1, pageSize, token, accountId, objectId, operationType, startTime, endTime);
+                int logsSize = logsArray.size();
+                for (int i = 0; i < logsSize; i++) {
+                    JSONObject logJson = logsArray.getJSONObject(i);
+                    ByteDanceOperationRecord record = new ByteDanceOperationRecord();
+                    record.setAccountId(accountId);
+                    record.setContentTitle(logJson.getString("content_title"));
+                    record.setContentLog(logJson.getString("content_log"));
+                    record.setObjectId(logJson.getLong("object_id"));
+                    record.setObjectName(logJson.getString("object_name"));
+                    record.setObjectType(logJson.getString("object_type"));
+                    record.setOperationCreateTime(logJson.getDate("create_time"));
+                    record.setStatDate(DateUtils.formatDate(logJson.getDate("create_time")));
+                    record.setOperator(logJson.getString("operator"));
+                    record.setOptIp(logJson.getString("opt_ip"));
+                    record.setOperationTarget(operationType);
+
+                    records.add(record);
+                }
+
+                //按类型入库
+                if (records != null && records.size() != 0) {
+                    insertLog(operationType, records);
+                }
+
+                if (page < totalPage) {
+                    logSearchByPage(page + 1, pageSize, token, accountId, objectId, operationType, startTime, endTime);
+                }else{
+                    return 1;
+                }
+            } else {
+                log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data) + ";;;返回值为:" + json);
+                return -1;
             }
-        }else{
-            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data)+";;;返回值为:"+ json);
-            return ;
+        }catch(Exception e){
+            e.printStackTrace();
+            log.error("头条视频素材报表其他错误,accountId:" + accountId + ",json:" + json + "请求为:" + JSONObject.toJSONString(data));
+            returnCode = -3;
         }
-        //return 200;
+        return returnCode;
     }
 
     private void insertLog(Integer operationTarget, List<ByteDanceOperationRecord> records){