Parcourir la source

修改代码层级结构

syh il y a 4 ans
Parent
commit
d3f7b3259f
100 fichiers modifiés avec 8869 ajouts et 0 suppressions
  1. 35 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/ConvertVo.java
  2. 25 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/KuaiShouReportDailyMaterialVo.java
  3. 107 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/KuaiShouVideoGetVo.java
  4. 13 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/VideoGetvo.java
  5. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/BatchMapper.java
  6. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouAdvertiserBaseInfoMapper.java
  7. 14 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCampaignDayBudgetMapper.java
  8. 20 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCampaignMapper.java
  9. 25 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCreativeMapper.java
  10. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouDailyFlowsMapper.java
  11. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouDailyReportTaskMapper.java
  12. 25 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouGroupMapper.java
  13. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouGroupTargetMapper.java
  14. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouHistoryReportTaskMapper.java
  15. 22 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouImageGetMapper.java
  16. 32 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  17. 22 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouVideoGetMapper.java
  18. 40 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaishouOperationRecordMapper.java
  19. 16 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaishouProgramCreativeMapper.java
  20. 10 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/MaterialRefuseMapper.java
  21. 55 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/BatchMapper.xml
  22. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouAdvertiserBaseInfoMapper.xml
  23. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCampaignDayBudgetMapper.xml
  24. 44 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCampaignMapper.xml
  25. 130 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCreativeMapper.xml
  26. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouDailyFlowsMapper.xml
  27. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouDailyReportTaskMapper.xml
  28. 115 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouGroupMapper.xml
  29. 70 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouGroupTargetMapper.xml
  30. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouHistoryReportTaskMapper.xml
  31. 50 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouImageGetMapper.xml
  32. 321 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  33. 60 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  34. 392 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaishouOperationRecordMapper.xml
  35. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaishouProgramCreativeMapper.xml
  36. 26 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/MateriaRefuseMapper.xml
  37. 20 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouAdvertiserBaseInfoService.java
  38. 14 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCampaignDayBudgetService.java
  39. 20 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCampaignService.java
  40. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCommentService.java
  41. 45 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCreativeService.java
  42. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouDailyFlowsService.java
  43. 18 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouDailyReportTaskService.java
  44. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouGroupService.java
  45. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouGroupTargetService.java
  46. 21 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouHistoryReportTaskService.java
  47. 18 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouImageGetService.java
  48. 9 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouMaterialUploadService.java
  49. 14 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouReportDailyMaterialService.java
  50. 22 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouVideoGetService.java
  51. 337 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouInterfaceService.java
  52. 21 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouProgramCreativeService.java
  53. 9 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouRealTimeDataService.java
  54. 103 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/IKuaiShouCommentServiceImpl.java
  55. 52 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouAdvertiserBaseInfoServiceImpl.java
  56. 18 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCampaignDayBudgetServiceImpl.java
  57. 63 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCampaignServiceImpl.java
  58. 189 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCreativeServiceImpl.java
  59. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouDailyFlowsServiceImpl.java
  60. 177 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  61. 398 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouGroupServiceImpl.java
  62. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouGroupTargetServiceImpl.java
  63. 366 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  64. 41 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouImageGetServiceImpl.java
  65. 216 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java
  66. 90 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  67. 123 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  68. 2208 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouInterfaceServiceImpl.java
  69. 250 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouProgramCreativeServiceImpl.java
  70. 110 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouRealTimeDataServiceImpl.java
  71. 142 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/CtopOauthToken.java
  72. 52 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialCutFrame.java
  73. 48 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialCutFrameTask.java
  74. 157 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialInfo.java
  75. 74 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/OauthAgentToken.java
  76. 115 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/UserAllocation.java
  77. 59 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/CtopOauthTokenMapper.java
  78. 23 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialCutFrameMapper.java
  79. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialCutFrameTaskMapper.java
  80. 36 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialInfoMapper.java
  81. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/OauthAgentTokenMapper.java
  82. 32 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/UserAllocationMapper.java
  83. 138 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/CtopOauthTokenMapper.xml
  84. 37 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialCutFrameMapper.xml
  85. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialCutFrameTaskMapper.xml
  86. 139 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialInfoMapper.xml
  87. 5 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/OauthAgentTokenMapper.xml
  88. 79 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/UserAllocationMapper.xml
  89. 42 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/ICtopOauthTokenService.java
  90. 32 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IMaterialCutFrameService.java
  91. 15 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IMaterialCutFrameTaskService.java
  92. 14 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IOauthAgentTokenService.java
  93. 9 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IRefreshTokenService.java
  94. 37 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IUserAllocationService.java
  95. 296 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/CtopOauthTokenServiceImpl.java
  96. 260 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/MaterialCutFrameServiceImpl.java
  97. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/MaterialCutFrameTaskServiceImpl.java
  98. 19 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/OauthAgentTokenServiceImpl.java
  99. 84 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/RefreshTokenServiceImpl.java
  100. 0 0
      xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/UserAllocationServiceImpl.java

+ 35 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/ConvertVo.java

@@ -0,0 +1,35 @@
+package com.xxl.job.executor.batch.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ConvertVo implements Serializable {
+    @JsonProperty("app_name")
+    private String appName;
+    @JsonProperty("convert_target")
+    private Integer convertTarget;
+    @JsonProperty("convert_name")
+    private String convertName;
+    @JsonProperty("deep_conversion_count")
+    private Long deepConversionCount;
+    @JsonProperty("deep_conversion_type")
+    private Integer deepConversionType;
+    @JsonProperty("type")
+    private Integer type;
+    @JsonProperty("app_id")
+    private Long appId;
+    @JsonProperty("convert_id")
+    private Long convertId;
+    @JsonProperty("convert_count")
+    private Long convertCount;
+    @JsonProperty("click_url")
+    private String clickUrl;
+    @JsonProperty("create_time")
+    private String createTime;
+    @JsonProperty("update_time")
+    private String updateTime;
+
+}

+ 25 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/KuaiShouReportDailyMaterialVo.java

@@ -0,0 +1,25 @@
+package com.xxl.job.executor.batch.entity.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-09
+ */
+@Data
+
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class KuaiShouReportDailyMaterialVo {
+
+    /**
+     * id
+     */
+    private Long id;
+    private Long photoId;
+}

+ 107 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/KuaiShouVideoGetVo.java

@@ -0,0 +1,107 @@
+package com.xxl.job.executor.batch.entity.vo;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 快手-获取视频接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+
+public class KuaiShouVideoGetVo implements Serializable {
+
+    private BigDecimal charge;
+    private String statDate;
+
+    /**
+     * 视频id
+     */
+    private String photoId;
+
+    /**
+     * 视频预览链接
+     */
+    private String url;
+    /**
+     * 视频首帧图片链接
+     */
+    private String coverUrl;
+    /**
+     * 视频首帧图片链接
+     */
+    private String signature;
+
+    private Integer materialType;
+
+
+    public BigDecimal getCharge() {
+        return charge;
+    }
+
+    public void setCharge(BigDecimal charge) {
+        this.charge = charge;
+    }
+
+    public String getStatDate() {
+        return statDate;
+    }
+
+    public void setStatDate(String statDate) {
+        this.statDate = statDate;
+    }
+
+    public String getPhotoId() {
+        return photoId;
+    }
+
+    public void setPhotoId(String photoId) {
+        this.photoId = photoId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getCoverUrl() {
+        return coverUrl;
+    }
+
+    public void setCoverUrl(String coverUrl) {
+        this.coverUrl = coverUrl;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public Integer getMaterialType() {
+        return materialType;
+    }
+
+    public void setMaterialType(Integer materialType) {
+        this.materialType = materialType;
+    }
+
+    @Override
+    public String toString() {
+        return "KuaiShouVideoGetVo{" +
+                "charge=" + charge +
+                ", statDate='" + statDate + '\'' +
+                ", photoId='" + photoId + '\'' +
+                ", url='" + url + '\'' +
+                ", coverUrl='" + coverUrl + '\'' +
+                ", signature='" + signature + '\'' +
+                ", materialType=" + materialType +
+                '}';
+    }
+}

+ 13 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/entity/vo/VideoGetvo.java

@@ -0,0 +1,13 @@
+package com.xxl.job.executor.batch.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class VideoGetvo implements Serializable {
+    private String signature;
+    private Integer channelType;
+
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/BatchMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.mapper;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+
+public interface BatchMapper {
+    BigDecimal getDailyCost(@Param("accountId") Long accountId);
+
+    BigDecimal getHourCost(@Param("accountId") Long accountId, @Param("statDate") String statDate);
+
+    BigDecimal getBudget(@Param("accountId") Long accountId);
+
+    BigDecimal getProjectMaxBidByProject(@Param("projectId") Long projectId);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouAdvertiserBaseInfoMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouAdvertiserBaseInfo;
+
+/**
+ * 快手-广告主基本信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-09-18
+ * @cersion: V1.0
+ */
+public interface KuaiShouAdvertiserBaseInfoMapper extends BaseMapper<KuaiShouAdvertiserBaseInfo> {
+
+}

+ 14 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCampaignDayBudgetMapper.java

@@ -0,0 +1,14 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaignDayBudget;
+
+/**
+ * @Description: 快手-修改广告计划记录表
+ * @Author: jeecg-boot
+ * @Date: 2019-09-11
+ * @Version: V1.0
+ */
+public interface KuaiShouCampaignDayBudgetMapper extends BaseMapper<KuaiShouCampaignDayBudget> {
+
+}

+ 20 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCampaignMapper.java

@@ -0,0 +1,20 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaign;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-获取广告计划信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface KuaiShouCampaignMapper extends BaseMapper<KuaiShouCampaign> {
+
+    void replaceBatch(@Param(value = "campaigns") List<KuaiShouCampaign> campaigns);
+
+    List<Long> queryIdsByPutStatus(Long accountId, String putStatus);
+}

+ 25 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouCreativeMapper.java

@@ -0,0 +1,25 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouCreative;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-创意信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
+
+    void replaceBatch(@Param(value = "creatives") List<KuaiShouCreative> creatives);
+
+    Integer checkCreativeCount(@Param("accountId") Long accountId, @Param("unitId") Long unitId);
+
+    Integer getCreateCount(Long accountId, String startTime);
+
+    List<JSONObject> checkZombieProject(String date);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouDailyFlowsMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyFlows;
+
+/**
+ * 快手-日流水信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-05
+ * @cersion: V1.0
+ */
+public interface KuaiShouDailyFlowsMapper extends BaseMapper<KuaiShouDailyFlows> {
+
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouDailyReportTaskMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyReportTask;
+
+/**
+ * 分天记录表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-12
+ * @cersion: V1.0
+ */
+public interface KuaiShouDailyReportTaskMapper extends BaseMapper<KuaiShouDailyReportTask> {
+
+}

+ 25 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouGroupMapper.java

@@ -0,0 +1,25 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouGroup;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 广告组信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface KuaiShouGroupMapper extends BaseMapper<KuaiShouGroup> {
+    void replaceBatch(@Param(value = "groups") List<KuaiShouGroup> groups);
+
+    List<String> selectWarningGroup(@Param("accountId") Long accountId, @Param("maxBid") Long maxBid);
+
+    List<String> selectWarningCpaBid(@Param("accountId") Long accountId, @Param("maxBid") BigDecimal maxDeepCapBid);
+
+    List<KuaiShouGroup> queryByMap(Map<String, Object> map);
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouGroupTargetMapper.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouGroupTarget;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手-定向信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-17
+ * @cersion: V1.0
+ */
+public interface KuaiShouGroupTargetMapper extends BaseMapper<KuaiShouGroupTarget> {
+
+    void replaceBatch(@Param("targets") List<KuaiShouGroupTarget> targets);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouHistoryReportTaskMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouHistoryReportTask;
+
+/**
+ * 快手历史数据任务记录
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-09
+ * @cersion: V1.0
+ */
+public interface KuaiShouHistoryReportTaskMapper extends BaseMapper<KuaiShouHistoryReportTask> {
+
+}

+ 22 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouImageGetMapper.java

@@ -0,0 +1,22 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-获取图片接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+public interface KuaiShouImageGetMapper extends BaseMapper<KuaiShouImageGet> {
+
+    void replaceBatch(@Param(value = "images") List<KuaiShouImageGet> imagesGets);
+
+    String getUrlByCode(String signature);
+
+    String getCutFrameUrlByCode(String signature);
+}

+ 32 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouReportDailyMaterialMapper.java

@@ -0,0 +1,32 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouReportDailyMaterialVo;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo;
+import com.xxl.job.executor.batch.entity.vo.VideoGetvo;
+import com.xxl.job.executor.report.entity.KuaiShouReportDailyMaterial;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材
+ *
+ * @author: jeecg-boot
+ * @date: 2020-09-09
+ * @cersion: V1.0
+ */
+public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouReportDailyMaterial> {
+    void loadMaterialDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    List<KuaiShouReportDailyMaterialVo> getPhotoList(@Param("accountId") Long accountId, @Param("statDate") String statDate);
+
+    VideoGetvo getVideoGetByPhotoId(@Param("photoId") Long photoId);
+
+    List<KuaiShouReportDailyMaterialVo> getPhotoListByDate(@Param("statDate") String statDate);
+
+    List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
+
+    void batchReplace(@Param("addList") List<KuaiShouReportDailyMaterial> addList);
+}

+ 22 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaiShouVideoGetMapper.java

@@ -0,0 +1,22 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaiShouVideoGet;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 快手-获取视频接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
+
+    void replaceBatch(@Param(value = "videos") List<KuaiShouVideoGet> videoGets);
+
+    List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
+}

+ 40 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaishouOperationRecordMapper.java

@@ -0,0 +1,40 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaishouOperationRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+public interface KuaishouOperationRecordMapper extends BaseMapper<KuaishouOperationRecord> {
+
+    void deleteOperationRecordInfoAccount(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoAccount(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoCampaign(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoCampaign(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoUnit(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoUnit(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoCreative(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoCreative(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoVideo(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoVideo(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoApp(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoApp(@Param("records") List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoPackage(@Param("record") KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoPackage(@Param("records") List<KuaishouOperationRecord> records);
+
+}

+ 16 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/KuaishouProgramCreativeMapper.java

@@ -0,0 +1,16 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.batch.entity.KuaishouProgramCreative;
+
+/**
+ * 快手-程序化创意
+ *
+ * @author: jeecg-boot
+ * @date: 2020-09-22
+ * @cersion: V1.0
+ */
+public interface KuaishouProgramCreativeMapper extends BaseMapper<KuaishouProgramCreative> {
+
+
+}

+ 10 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/MaterialRefuseMapper.java

@@ -0,0 +1,10 @@
+package com.xxl.job.executor.batch.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+public interface MaterialRefuseMapper {
+    List<JSONObject> selectRefuseCreativeByAccountId(Long accountId);
+
+}

+ 55 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/BatchMapper.xml

@@ -0,0 +1,55 @@
+<?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="com.xxl.job.executor.batch.mapper.BatchMapper">
+
+    <select id="getDailyCost" resultType="java.math.BigDecimal">
+      select
+      (case
+        when sum(charge) != ''
+        then sum(charge)
+        else 0
+        end
+        )
+      from ctop_kuaishou_report_daily_account
+      where account_id = #{accountId}
+    </select>
+
+
+    <select id="getHourCost" resultType="java.math.BigDecimal">
+      select
+      (case
+        when sum(charge) != ''
+        then sum(charge)
+        else 0
+        end
+        )
+
+      from ctop_kuaishou_report_hourly_account
+      where account_id = #{accountId}
+      and stat_date = #{statDate}
+    </select>
+
+    <select id="getBudget" resultType="java.math.BigDecimal">
+      select
+      (case
+        when sum(day_budget) != ''
+        then sum(day_budget)
+        else 0
+        end
+        )
+
+      from ctop_kuaishou_campaign
+      where account_id = #{accountId}
+    </select>
+
+
+    <select id="getProjectMaxBidByProject" resultType="java.math.BigDecimal">
+      select
+      max_bid
+      from
+      ctop_project
+      where id = #{projectId}
+    </select>
+
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouAdvertiserBaseInfoMapper.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="com.xxl.job.executor.batch.mapper.KuaiShouAdvertiserBaseInfoMapper">
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCampaignDayBudgetMapper.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="com.xxl.job.executor.batch.mapper.KuaiShouCampaignDayBudgetMapper">
+
+</mapper>

+ 44 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCampaignMapper.xml

@@ -0,0 +1,44 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouCampaignMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_campaign(
+        id,
+        account_id,
+        campaign_id,
+        campaign_name,
+        status,
+        day_budget,
+        campaign_type,
+        put_status,
+        create_channel,
+        put_create_time,
+        put_update_time,
+        create_time,
+        update_time)
+        values
+        <foreach collection="campaigns" item="campaign" separator=",">
+            (#{campaign.id},
+            #{campaign.accountId},
+            #{campaign.campaignId},
+            #{campaign.campaignName},
+            #{campaign.status},
+            #{campaign.dayBudget},
+            #{campaign.campaignType},
+            #{campaign.putStatus},
+            #{campaign.createChannel},
+            #{campaign.putCreateTime},
+            #{campaign.putUpdateTime},
+            #{campaign.createTime},
+            #{campaign.updateTime})
+        </foreach>
+    </insert>
+
+    <select id="queryIdsByPutStatus" resultType="java.lang.Long">
+        SELECT campaign_id
+        FROM
+        ctop_kuaishou_campaign
+        WHERE account_id = #{accountId}
+        AND put_status = #{putStatus}
+    </select>
+</mapper>

+ 130 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouCreativeMapper.xml

@@ -0,0 +1,130 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouCreativeMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_creative(id,
+        account_id,
+        campaign_id,
+        unit_id,
+        creative_id,
+        creative_name,
+        creative_material_type,
+        photo_id,
+        material_url,
+        image_tokens,
+        status,
+        put_status,
+        create_channel,
+        review_detail,
+        cover_url,
+        image_token,
+        cover_width,
+        cover_height,
+        overlay_bg_url,
+        overlay_bg_image_token,
+        sticker_title,
+        overlay_type,
+        click_track_url,
+        impression_url,
+        ad_photo_played_t3s_url,
+        description,
+        action_bar_text,
+        first_frame_type,
+        site_id,
+        programmed_creative_material,
+        photo_ids,
+        short_slogan,
+        actionbar_click_url,
+        creative_create_time,
+        creative_update_time,
+        creative_category,
+        creative_tag,
+        create_time,
+        update_time)
+        values
+        <foreach collection="creatives" item="creative" separator=",">
+            (#{creative.id},
+            #{creative.accountId},
+            #{creative.campaignId},
+            #{creative.unitId},
+            #{creative.creativeId},
+            #{creative.creativeName},
+            #{creative.creativeMaterialType},
+            #{creative.photoId},
+            #{creative.materialUrl},
+            #{creative.imageTokens},
+            #{creative.status},
+            #{creative.putStatus},
+            #{creative.createChannel},
+            #{creative.reviewDetail},
+            #{creative.coverUrl},
+            #{creative.imageToken},
+            #{creative.coverWidth},
+            #{creative.coverHeight},
+            #{creative.overlayBgUrl},
+            #{creative.overlayBgImageToken},
+            #{creative.stickerTitle},
+            #{creative.overlayType},
+            #{creative.clickTrackUrl},
+            #{creative.impressionUrl},
+            #{creative.adPhotoPlayedT3sUrl},
+            #{creative.description},
+            #{creative.actionBarText},
+            #{creative.firstFrameType},
+            #{creative.siteId},
+            #{creative.programmedCreativeMaterial},
+            #{creative.photoIds},
+            #{creative.shortSlogan},
+            #{creative.actionbarClickUrl},
+            #{creative.creativeCreateTime},
+            #{creative.creativeUpdateTime},
+            #{creative.creativeCategory},
+            #{creative.creativeTag},
+            #{creative.createTime},
+            #{creative.updateTime})
+        </foreach>
+    </insert>
+
+    <select id="checkCreativeCount" resultType="java.lang.Integer">
+     select count(1)
+     from ctop_kuaishou_creative
+     where  account_id = #{accountId}
+     and unit_id = #{unitId}
+    </select>
+
+    <select id="getCreateCount" resultType="java.lang.Integer">
+
+    SELECT
+	count(1)
+   FROM
+	ctop_kuaishou_creative
+   WHERE account_id = #{accountId}
+   AND creative_create_time &gt;= #{startTime}
+   AND create_channel = 1;
+    </select>
+
+    <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.id,
+        t1.account_id AS accountId,
+        t1.creative_id AS creativeId,
+        t1.creative_name AS creativeName,
+        t1.campaign_id AS campaignId,
+        t4.campaign_name AS campaignName,
+        t1.unit_id AS unitId,
+        t5.unit_name AS unitName,
+        t3.id AS projectId,
+        t3.project_name AS projectName,
+        t2.user_id AS userId
+        FROM
+        ctop_kuaishou_creative t1
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        LEFT JOIN ctop_kuaishou_campaign t4 ON t1.campaign_id = t4.campaign_id
+        LEFT JOIN ctop_kuaishou_group t5 ON t1.unit_id = t5.unit_id
+        WHERE
+        creative_create_time &lt;= #{date}
+        AND t1. STATUS = 42
+        and t1.put_status = 1
+    </select>
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouDailyFlowsMapper.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="com.xxl.job.executor.batch.mapper.KuaiShouDailyFlowsMapper">
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouDailyReportTaskMapper.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="com.xxl.job.executor.batch.mapper.KuaiShouDailyReportTaskMapper">
+
+</mapper>

+ 115 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -0,0 +1,115 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouGroupMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_group(
+        id,
+        account_id,
+        campaign_id,
+        unit_id,
+        unit_name,
+        status,
+        put_status,
+        create_channel,
+        review_detail,
+        bid_type,
+        bid,
+        cpa_bid,
+        ocpx_action_type,
+        deep_conversion_type,
+        deep_conversion_bid,
+        day_budget,
+        speed,
+        begin_time,
+        end_time,
+        schedule_time,
+        scene_id,
+        show_mode,
+        unit_type,
+        url_type,
+        url,
+        app_id,
+        app_icon_url,
+        convert_id,
+        use_app_market,
+        app_store,
+        group_create_time,
+        group_update_time,
+        create_time,
+        update_time)
+        values
+        <foreach collection="groups" item="getGroup" separator=",">
+            (
+            #{getGroup.id},
+            #{getGroup.accountId},
+            #{getGroup.campaignId},
+            #{getGroup.unitId},
+            #{getGroup.unitName},
+            #{getGroup.status},
+            #{getGroup.putStatus},
+            #{getGroup.createChannel},
+            #{getGroup.reviewDetail},
+            #{getGroup.bidType},
+            #{getGroup.bid},
+            #{getGroup.cpaBid},
+            #{getGroup.ocpxActionType},
+            #{getGroup.deepConversionType},
+            #{getGroup.deepConversionBid},
+            #{getGroup.dayBudget},
+            #{getGroup.speed},
+            #{getGroup.beginTime},
+            #{getGroup.endTime},
+            #{getGroup.scheduleTime},
+            #{getGroup.sceneId},
+            #{getGroup.showMode},
+            #{getGroup.unitType},
+            #{getGroup.urlType},
+            #{getGroup.url},
+            #{getGroup.appId},
+            #{getGroup.appIconUrl},
+            #{getGroup.convertId},
+            #{getGroup.useAppMarket},
+            #{getGroup.appStore,},
+            #{getGroup.groupCreateTime},
+            #{getGroup.groupUpdateTime},
+            #{getGroup.createTime},
+            #{getGroup.updateTime})
+        </foreach>
+    </insert>
+
+
+    <select id="selectWarningGroup" resultType="java.lang.String">
+   SELECT
+   unit_name
+   FROM ctop_kuaishou_group
+   WHERE account_id = #{accountId}
+   and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
+   and status = 20
+   group by unit_id
+    </select>
+
+
+    <select id="selectWarningCpaBid" resultType="java.lang.String">
+   SELECT
+   unit_name
+   FROM ctop_kuaishou_group
+   WHERE account_id = #{accountId}
+   and deep_conversion_bid &gt; #{maxBid}
+   group by unit_id
+    </select>
+
+    <select id="queryByMap" resultType="com.xxl.job.executor.batch.entity.KuaiShouGroup">
+        SELECT
+        t1.*,t2.campaign_name as campaignName
+        FROM ctop_kuaishou_group t1
+        LEFT JOIN ctop_kuaishou_campaign t2
+        ON t1.campaign_id = t2.campaign_id
+        WHERE t1.account_id = #{accountId}
+        and t1.put_status = #{putStatus}
+        <if test="campaignId != null">
+            t1.campaign_id = #{campaignId}
+        </if>
+    </select>
+
+
+</mapper>

+ 70 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouGroupTargetMapper.xml

@@ -0,0 +1,70 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouGroupTargetMapper">
+
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_group_target(
+        account_id ,
+        unit_id,
+        region,
+        age_min,
+        age_max,
+        ages_range,
+        gender,
+        platform_os,
+        android_osv,
+        ios_osv,
+        network,
+        device_brand,
+        device_price,
+        business_interest_type,
+        business_interest,
+        fans_star,
+        interest_video,
+        app_interest,
+        app_ids,
+        population,
+        exclude_population,
+        third_platform_code,
+        filter_converted_level,
+        is_open,
+        no_age_break,
+        no_gender_break,
+        no_area_break
+        )
+        values
+        <foreach collection="targets" item="targets" separator=",">
+            (
+            #{targets.accountId},
+            #{targets.unitId},
+            #{targets.region},
+            #{targets.ageMin},
+            #{targets.ageMax},
+            #{targets.agesRange},
+            #{targets.gender},
+            #{targets.platformOs},
+            #{targets.androidOsv},
+            #{targets.iosOsv},
+            #{targets.network},
+            #{targets.deviceBrand},
+            #{targets.devicePrice},
+            #{targets.businessInterestType},
+            #{targets.businessInterest},
+            #{targets.fansStar},
+            #{targets.interestVideo},
+            #{targets.appInterest},
+            #{targets.appIds},
+            #{targets.population},
+            #{targets.excludePopulation},
+            #{targets.thirdPlatformCode},
+            #{targets.filterConvertedLevel},
+            #{targets.isOpen},
+            #{targets.noAgeBreak},
+            #{targets.noGenderBreak},
+            #{targets.noAreaBreak}
+            )
+        </foreach>
+    </insert>
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouHistoryReportTaskMapper.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="com.xxl.job.executor.batch.mapper.KuaiShouHistoryReportTaskMapper">
+
+</mapper>

+ 50 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouImageGetMapper.xml

@@ -0,0 +1,50 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouImageGetMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_image_get(
+        id,
+        account_id,
+        url,
+        width,
+        height,
+        size,
+        format,
+        material_type,
+        signature,
+        image_token,
+        stat_date
+        )
+        values
+        <foreach collection="images" item="image" separator=",">
+            (
+            #{image.id},
+            #{image.accountId},
+            #{image.url},
+            #{image.width},
+            #{image.height},
+            #{image.size},
+            #{image.format},
+            #{image.materialType},
+            #{image.signature},
+            #{image.imageToken},
+            #{image.statDate}
+            )
+        </foreach>
+    </insert>
+
+    <select id="getUrlByCode" resultType="java.lang.String">
+        select url from ctop_material_image_info
+        where  code = #{signature}
+        limit 1
+    </select>
+
+    <select id="getCutFrameUrlByCode" resultType="java.lang.String">
+        select url from ctop_material_cut_frame
+        where  signature = #{signature}
+        limit 1
+    </select>
+
+
+</mapper>

+ 321 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -0,0 +1,321 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouReportDailyMaterialMapper">
+    <insert id="batchReplace">
+        replace into ctop_kuaishou_report_daily_material(
+        account_id,
+        photo_id,
+        channel_type,
+        signature,
+        image_token,
+        cover_url,
+        photo_url,
+        creative_material_type_string,
+        ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        form_action_ratio,
+        event_order_paid_cost,
+        event_next_day_stay,
+        form_cost,
+        form_count,
+        play_3s_ratio
+        )
+        values
+        <foreach collection="addList" item="material" separator=",">
+            (
+            #{material.accountId},
+            #{material.photoId},
+            #{material.channelType},
+            #{material.signature},
+            #{material.imageToken},
+            #{material.coverUrl},
+            #{material.photoUrl},
+            #{material.creativeMaterialTypeString},
+            #{material.adScene},
+            #{material.charge},
+            #{material.photoShow},
+            #{material.aclick},
+            #{material.bclick},
+            #{material.photoShare},
+            #{material.photoComment},
+            #{material.photoLike},
+            #{material.follow},
+            #{material.cancelFollow},
+            #{material.report},
+            #{material.block},
+            #{material.negative},
+            #{material.downloadStarted},
+            #{material.downloadCompleted},
+            #{material.activation},
+            #{material.submit},
+            #{material.statDate},
+            #{material.photoClick},
+            #{material.photoClickRatio},
+            #{material.actionRatio},
+            #{material.impression1kCost},
+            #{material.photoClickCost},
+            #{material.actionCost},
+            #{material.eventPayFirstDay},
+            #{material.eventPayPurchaseAmountFirstDay},
+            #{material.eventPayFirstDayRoi},
+            #{material.eventPay},
+            #{material.eventPayPurchaseAmount},
+            #{material.eventPayRoi},
+            #{material.eventRegister},
+            #{material.eventRegisterCost},
+            #{material.eventRegisterRatio},
+            #{material.eventJinJianApp},
+            #{material.eventJinJianAppCost},
+            #{material.eventCreditGrantApp},
+            #{material.eventCreditGrantAppCost},
+            #{material.eventCreditGrantAppRatio},
+            #{material.eventOrderPaid},
+            #{material.eventOrderPaidPurchaseAmount},
+            #{material.eventJinJianLandingPage},
+            #{material.eventJinJianLandingPageCost},
+            #{material.eventCreditGrantLandingPage},
+            #{material.eventCreditGrantLandingPageCost},
+            #{material.eventCreditGrantLandingRatio},
+            #{material.eventNextDayStayCost},
+            #{material.eventNextDayStayRatio},
+            #{material.formActionRatio},
+            #{material.eventOrderPaidCost},
+            #{material.eventNextDayStay},
+            #{material.formCost},
+            #{material.formCount},
+            #{material.play3sRatio}
+            )
+        </foreach>
+
+    </insert>
+
+
+    <insert id="loadMaterialDailyReport">
+		LOAD DATA local INFILE  #{localPath}
+	    INTO TABLE ctop_kuaishou_report_daily_material
+		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
+		IGNORE 1 LINES
+		(photo_id,
+		image_token,
+		cover_url,
+		photo_url,
+		@photo_caption,
+		@creative_material_type_string,
+        @ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        @stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        @click_1k_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_order_paid_cost,
+        form_count,
+        form_cost,
+        form_action_ratio,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        event_next_day_stay,
+        play_3s_ratio,
+        @event_valid_clues,
+        @event_valid_clues_cost,
+        @ad_product_cnt,
+        @event_goods_view,
+        @merchant_reco_fans,
+        @event_order_amount_roi,
+        @event_goods_view_cost,
+        @merchant_reco_fans_cost,
+        @event_new_user_pay,
+        @event_new_user_pay_cost,
+        @event_new_user_pay_ratio,
+        @event_button_click,
+        @event_button_click_cost,
+        @event_button_click_ratio,
+        @play_5s_ratio,
+        @play_end_ratio,
+        @event_order_paid_roi,
+        @event_new_user_jinjian_app,
+        @event_new_user_jinjian_app_cost,
+        @event_new_user_jinjian_app_roi,
+        @event_new_user_credit_grant_app,
+        @event_new_user_credit_grant_app_cost,
+        @event_new_user_credit_grant_app_roi,
+        @event_new_user_jinjian_page,
+        @event_new_user_jinjian_page_cost,
+        @event_new_user_jinjian_page_roi,
+        @event_new_user_credit_grant_page,
+        @event_new_user_credit_grant_page_cost,
+        @event_new_user_credit_grant_page_roi,
+        @event_appoint_form,
+        @event_appoint_form_cost,
+        @event_appoint_form_ratio,
+        @event_appoint_jump_click,
+        @event_appoint_jump_click_cost,
+        @event_appoint_jump_click_ratio
+        )
+          set account_id = #{accountId}
+    </insert>
+
+    <select id="getPhotoList" resultType="com.xxl.job.executor.batch.entity.vo.KuaiShouReportDailyMaterialVo">
+        select
+        id as id,
+        photo_id as photoId
+        from
+        ctop_kuaishou_report_daily_material
+        where account_id = #{accountId}
+        <if test="statDate != null and statDate != '' ">
+            and stat_date = #{statDate}
+        </if>
+        group by photo_id
+
+    </select>
+
+    <select id="getPhotoListByDate"
+            resultType="com.xxl.job.executor.batch.entity.vo.KuaiShouReportDailyMaterialVo">
+        select
+        id as id,
+        photo_id as photoId
+        from
+        ctop_kuaishou_report_daily_material
+        WHERE stat_date = #{statDate}
+        and signature is null
+        group by photo_id
+    </select>
+
+    <select id="getVideoGetByPhotoId" resultType="com.xxl.job.executor.batch.entity.vo.VideoGetvo">
+      select
+      signature as 'signature',
+      channel_type as 'channelType'
+      from ctop_kuaishou_video_get
+      where photo_id = #{photoId}
+      and signature is not null
+      limit 1
+    </select>
+
+
+    <select id="getVideoList" parameterType="java.util.Map"
+            resultType="com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo">
+
+        SELECT
+        sum(t1.charge) as 'charge',
+        t1.photo_id AS 'photoId',
+        t1.photo_url AS 'url',
+        t1.cover_url AS 'coverUrl',
+        t1.signature AS 'signature',
+        t2.material_type AS 'materialType'
+        FROM
+        ctop_kuaishou_report_daily_material t1
+        LEFT JOIN (
+        SELECT
+        material_type,
+        signature,
+        status
+        FROM
+        ctop_kuaishou_video_get
+        WHERE
+        account_id = #{accountId} group by signature) t2
+        ON t1.signature = t2.signature
+        WHERE
+        t1.account_id = #{accountId}
+        AND t1.channel_type = #{channelType}
+        AND t2.material_type = #{materialType}
+        AND t2.status = 0
+        <if test="startDate != null and startDate != '' ">
+            and t1.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and t1.stat_date &lt;= #{endDate}
+        </if>
+
+        GROUP BY
+        signature
+        ORDER BY
+        sum(t1.charge) DESC
+    </select>
+
+
+</mapper>

+ 60 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -0,0 +1,60 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaiShouVideoGetMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_video_get(
+        id,
+        account_id,
+        photo_id,
+        width,
+        height,
+        url,
+        cover_url,
+        material_type,
+        signature,
+        update_time
+        )
+        values
+        <foreach collection="videos" item="video" separator=",">
+            (
+            #{video.id},
+            #{video.accountId},
+            #{video.photoId},
+            #{video.width},
+            #{video.height},
+            #{video.url},
+            #{video.coverUrl},
+            #{video.materialType},
+            #{video.signature},
+            #{video.updateTime}
+
+            )
+        </foreach>
+    </insert>
+
+
+    <select id="getVideoList" parameterType="java.util.Map"
+            resultType="com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo">
+        select
+        stat_date as 'statDate',
+        photo_id as 'photoId',
+        url as 'url',
+        cover_url as 'coverUrl',
+        signature as 'signature',
+        material_type as 'materialType'
+        from ctop_kuaishou_video_get
+        where account_id = #{accountId}
+        and channel_type = #{channelType}
+        and material_type = #{materialType}
+        and status = 0
+        <if test="startDate != null and startDate != '' ">
+            and stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and stat_date &lt;= #{endDate}
+        </if>
+        group by signature
+        order by stat_date desc
+    </select>
+
+</mapper>

+ 392 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaishouOperationRecordMapper.xml

@@ -0,0 +1,392 @@
+<?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="com.xxl.job.executor.batch.mapper.KuaishouOperationRecordMapper">
+
+    <delete id="deleteOperationRecordInfoAccount">
+        delete
+        from
+        ctop_kuaishou_operation_record_account
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoAccount">
+        replace into
+        ctop_kuaishou_operation_record_account
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+
+    <delete id="deleteOperationRecordInfoCampaign">
+        delete
+        from
+        ctop_kuaishou_operation_record_campaign
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+           and
+           object_id = #{record.objectId}
+           and
+           operation_type = #{record.operationType}
+           and
+           operation_target = #{record.operationTarget}
+           and
+           role_type = #{record.roleType}
+           and
+           operation_time = #{record.operationTime}
+           -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoCampaign">
+        replace into
+        ctop_kuaishou_operation_record_campaign
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+    <delete id="deleteOperationRecordInfoUnit">
+        delete
+        from
+        ctop_kuaishou_operation_record_unit
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+         and
+         object_id = #{record.objectId}
+         and
+         operation_type = #{record.operationType}
+         and
+         operation_target = #{record.operationTarget}
+         and
+         role_type = #{record.roleType}
+         and
+         operation_time = #{record.operationTime}
+         -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoUnit">
+        replace into
+        ctop_kuaishou_operation_record_unit
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+    <delete id="deleteOperationRecordInfoCreative">
+        delete
+        from
+        ctop_kuaishou_operation_record_creative
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoCreative">
+        replace into
+        ctop_kuaishou_operation_record_creative
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+    <delete id="deleteOperationRecordInfoVideo">
+        delete
+        from
+        ctop_kuaishou_operation_record_video
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoVideo">
+        replace into
+        ctop_kuaishou_operation_record_video
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+    <delete id="deleteOperationRecordInfoApp">
+        delete
+        from
+        ctop_kuaishou_operation_record_app
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoApp">
+        replace into
+        ctop_kuaishou_operation_record_app
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+    <delete id="deleteOperationRecordInfoPackage">
+        delete
+        from
+        ctop_kuaishou_operation_record_package
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoPackage">
+        replace into
+        ctop_kuaishou_operation_record_package
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        log
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.log}
+            )
+        </foreach>
+
+    </insert>
+
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/KuaishouProgramCreativeMapper.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="com.xxl.job.executor.batch.mapper.KuaishouProgramCreativeMapper">
+
+</mapper>

+ 26 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/mapper/xml/MateriaRefuseMapper.xml

@@ -0,0 +1,26 @@
+<?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="com.xxl.job.executor.batch.mapper.MaterialRefuseMapper">
+
+    <select id="selectRefuseCreativeByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select
+         t1.account_id accountId,
+         t1.campaign_id campaignId,
+         t1.unit_id unitId,
+         t1.creative_id creativeId,
+         t1.creative_name creativeName,
+         t2.url videoUrl,
+         t1.cover_url coverUrl,
+         t1.review_detail reviewDetail,
+         t1.description description
+    from
+        ctop_kuaishou_creative t1
+       left join ctop_kuaishou_video_get t2
+       on t1.account_id = t2.account_id
+       and t1.photo_id = t2.photo_id
+       where  t1.account_id = #{accountId}
+       and t1.status = 42
+       order by t1.creative_id desc
+    </select>
+
+</mapper>

+ 20 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouAdvertiserBaseInfoService.java

@@ -0,0 +1,20 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouAdvertiserBaseInfo;
+
+import java.util.List;
+
+/**
+ * 快手-广告主基本信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-18
+ */
+public interface IKuaiShouAdvertiserBaseInfoService extends IService<KuaiShouAdvertiserBaseInfo> {
+
+    KuaiShouAdvertiserBaseInfo getBaseInfo(Long accountId);
+
+    List<KuaiShouAdvertiserBaseInfo> getAccountIdList(String userId);
+}

+ 14 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCampaignDayBudgetService.java

@@ -0,0 +1,14 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaignDayBudget;
+
+/**
+ * @Description: 快手-修改广告计划记录表
+ * @Author: jeecg-boot
+ * @Date: 2019-09-11
+ * @Version: V1.0
+ */
+public interface IKuaiShouCampaignDayBudgetService extends IService<KuaiShouCampaignDayBudget> {
+
+}

+ 20 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCampaignService.java

@@ -0,0 +1,20 @@
+package com.xxl.job.executor.batch.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaign;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-获取广告计划信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
+
+    void replaceBatch(List<KuaiShouCampaign> campaigns);
+
+    List<JSONArray> getJsonArrByAccount(Long accountId, int idSize);
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCommentService.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.batch.service;
+
+/**
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-19
+ */
+public interface IKuaiShouCommentService {
+
+    /**
+     * 屏蔽评论,先查后屏蔽
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    void shieldComment(Long accountId);
+}

+ 45 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouCreativeService.java

@@ -0,0 +1,45 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouCreative;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-创意信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
+
+    void replaceBatch(List<KuaiShouCreative> creatives);
+
+    /**
+     * 获取MD5
+     *
+     * @param creativeId
+     * @return
+     */
+    String getCodeByCreativeId(Long creativeId);
+
+    /**
+     * 创意条数
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    Integer checkCreativeCount(Long accountId, Long unitId);
+
+    void syncCreative(Long accountId, String accessToken, Long campaignId, Integer page);
+
+    /**
+     * 获取当前创意创建数
+     * @param accountId
+     * @param startTime
+     * @return
+     */
+
+    Integer getCreateCount(Long accountId, String startTime);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouDailyFlowsService.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyFlows;
+
+/**
+ * 快手-日流水信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-05
+ */
+public interface IKuaiShouDailyFlowsService extends IService<KuaiShouDailyFlows> {
+
+}

+ 18 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouDailyReportTaskService.java

@@ -0,0 +1,18 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyReportTask;
+
+/**
+ * 分天记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-12
+ */
+public interface IKuaiShouDailyReportTaskService extends IService<KuaiShouDailyReportTask> {
+    void formatCreativeDailyReportData(Long accountId, String statDate);
+
+    void getTaskList(Long accountId, String token, String statDate);
+
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouGroupService.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouGroup;
+
+/**
+ * @Description: 广告组信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
+
+    void getGroupList(String accessToken, Long accountId);
+
+    void getGroupByUnitId(String accessToken, Long accountId, Long unitId);
+
+    void getCreativeByUnit(String accessToken, Long accountId, Long unitId);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouGroupTargetService.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouGroupTarget;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+public interface IKuaiShouGroupTargetService extends IService<KuaiShouGroupTarget> {
+
+}

+ 21 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouHistoryReportTaskService.java

@@ -0,0 +1,21 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouHistoryReportTask;
+
+/**
+ * 快手历史数据任务记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-09
+ */
+public interface IKuaiShouHistoryReportTaskService extends IService<KuaiShouHistoryReportTask> {
+    void createTask(Long accountId, String token, String startDate, String endDate, String taskType);
+
+    void getTaskList();
+
+    void getMd5(String statDate, Long accountId);
+
+    void getMd5V2(String statDate);
+}

+ 18 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouImageGetService.java

@@ -0,0 +1,18 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-获取图片接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+public interface IKuaiShouImageGetService extends IService<KuaiShouImageGet> {
+    void replaceBatch(List<KuaiShouImageGet> imageGets);
+
+    String getUrlByCode(String signature);
+}

+ 9 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouMaterialUploadService.java

@@ -0,0 +1,9 @@
+package com.xxl.job.executor.batch.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IKuaiShouMaterialUploadService {
+    JSONObject video(String url, Integer type, Long accountId, String accessToken, String signature);
+
+    String kuauiShouImageUpload(String url, String signature, Long accountId, String token);
+}

+ 14 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouReportDailyMaterialService.java

@@ -0,0 +1,14 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.report.entity.KuaiShouReportDailyMaterial;
+
+/**
+ * @Description: 素材
+ * @Author: jeecg-boot
+ * @Date: 2020-09-09
+ * @Version: V1.0
+ */
+public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouReportDailyMaterial> {
+    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page);
+}

+ 22 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaiShouVideoGetService.java

@@ -0,0 +1,22 @@
+package com.xxl.job.executor.batch.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaiShouVideoGet;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 快手-获取视频接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
+    void replaceBatch(List<KuaiShouVideoGet> videoGets);
+
+    void getKeyFrame(String token, Long accountId, String videoMd5, String photoId);
+
+    List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> stringObjectMap);
+}

+ 337 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouInterfaceService.java

@@ -0,0 +1,337 @@
+package com.xxl.job.executor.batch.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.material.entity.KuaishouResult;
+import com.xxl.job.executor.material.entity.KuaishouResultToken;
+import com.xxl.job.executor.report.entity.*;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author yumeng
+ * 2019年11月12日11:08:52
+ */
+public interface IKuaishouInterfaceService {
+
+    /**
+     * 计划日报
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportDailyCampaign> getCampaignDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 计划时报
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportHourlyCampaign> getCampaignHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 组日报
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 组时报
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 创意日报 暂停使用
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportDailyCreative> getCreativeDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 创意时报 暂停使用
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param startDate
+     * @param endDate
+     * @param pageSize
+     * @param pageNum
+     * @return
+     */
+    KuaishouResult<KuaishouReportHourlyCreative> getCreativeHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
+
+    /**
+     * 获取广告计划信息  单条
+     *
+     * @param accessToken
+     * @param advertiserId
+     */
+    void getCampaign(String accessToken, Long advertiserId, Long campaignId);
+
+
+    /**
+     * 获取创意列表
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getCreativeList(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取视频信息
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param photoId
+     */
+    void getVideoInfo(String accessToken, Long advertiserId, String photoId);
+
+
+    /**
+     * 获取token
+     *
+     * @param authCode
+     * @return
+     */
+    KuaishouResultToken getAccessToken(String authCode, Integer agentType);
+
+    /**
+     * 取可选的深度转化类型
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @return
+     */
+    JSONObject getDeepConversionInfosV2(Long advertiserId, String accessToken);
+
+    /**
+     * 根据创意id 获取创意信息
+     *
+     * @param accessToken
+     * @param advertiserId
+     * @param creativeId
+     */
+    void getCreativeByCreativeId(String accessToken, Long advertiserId, Long creativeId);
+
+    /**
+     * 获取视频
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @param photoId
+     */
+    void videoGet(Long advertiserId, String accessToken, String photoId, String signature);
+
+    /**
+     * 获取图片信息
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @param imageToken
+     */
+    void imageGet(Long advertiserId, String accessToken, String imageToken);
+
+    /**
+     * 文件上传 发送请求
+     *
+     * @param url
+     * @param paramMap
+     * @param headerMap
+     * @param filePath
+     */
+    String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap, String filePath);
+
+    /**
+     * 快手 广告主信息
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    Map<String, Object> advertiserInfo(Long accountId, String accessToken);
+
+    /**
+     * 获取视频列表
+     *
+     * @param token
+     * @param
+     */
+    void getVideoList(CtopOauthToken token, String startDate, String endDate);
+
+    /**
+     * 获取广告主分天报表
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取计划分天报表
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取广告计划分天报表 暂停使用
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取创意分天报表 暂停使用
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     * @param campaignIds
+     */
+    void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate, JSONArray campaignIds, JSONArray creativeIds);
+
+    /**
+     * 获取广告主时报
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取计划时报
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserCampaignReportHourly(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取组时报
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取创意时报 暂停使用
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserCreativeReportHourly(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取计划列表
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getCampaignList(CtopOauthToken token, Date startDate, Date endDate);
+
+    /**
+     * 获取组列表
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getGroupList(CtopOauthToken token, Date startDate, Date endDate);
+
+
+    /**
+     * 获取快手图片列表
+     *
+     * @param token
+     */
+    void getImageList(CtopOauthToken token, String statDate);
+
+
+    /**
+     * 获取账户余额
+     *
+     * @param oauthToken
+     * @return
+     */
+    JSONObject fundGet(CtopOauthToken oauthToken);
+
+
+    /**
+     * 获取账户流水数据
+     *
+     * @param token
+     */
+    void getDailyFlows(CtopOauthToken token);
+
+    /**
+     * 获取素造素材列表
+     *
+     * @param token
+     * @param accountId
+     * @param page
+     */
+    void getSuZaoList(String token, Long accountId, int page, String startDate, String endDate);
+
+    /**
+     * 异步获取创意信息
+     *
+     * @param accountId
+     * @param accessToken
+     * @param campaignId
+     */
+
+    void getAsyncCreativeList(Long accountId, String accessToken, Long campaignId);
+
+    void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
+
+    void getOperationRecord(Long advertiserId, String accessToken, Integer operationTarget, String startDate, String endDate);
+}
+
+
+

+ 21 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouProgramCreativeService.java

@@ -0,0 +1,21 @@
+package com.xxl.job.executor.batch.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.batch.entity.KuaishouProgramCreative;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+
+/**
+ * @Description: 快手-程序化创意
+ * @Author: jeecg-boot
+ * @Date: 2020-09-22
+ * @Version: V1.0
+ */
+public interface IKuaishouProgramCreativeService extends IService<KuaishouProgramCreative> {
+    void getProgramCreative(Long accountId, Long unitId, String accessToken, String startDate, String endDate, Integer page);
+
+    JSONObject createProgramCreative(CtopOauthToken oauthToken, JSONObject requestJson);
+
+    JSONArray getProgramCreativeCover(JSONArray md5Arr);
+}

+ 9 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/IKuaishouRealTimeDataService.java

@@ -0,0 +1,9 @@
+package com.xxl.job.executor.batch.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface IKuaishouRealTimeDataService {
+    JSONArray getCampaignDate(Long accountId, String token, Long campaignId, String startDate, String endDate);
+
+    JSONArray getUnitDate(Long accountId, String token, Long unitId, String startDate, String endDate);
+}

+ 103 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/IKuaiShouCommentServiceImpl.java

@@ -0,0 +1,103 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.enums.NoEn;
+import com.xxl.job.executor.batch.service.IKuaiShouCommentService;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.service.ICtopOauthTokenService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 评论
+ */
+@Slf4j
+@Service
+public class IKuaiShouCommentServiceImpl implements IKuaiShouCommentService {
+
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+    @Override
+    public void shieldComment(Long accountId) {
+        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+        queryComments(oauthToken.getAccessToken(), accountId, 1, 500, 0);
+    }
+
+    /**
+     * 查询评论
+     *
+     * @param
+     * @return com.alibaba.fastjson.JSONArray
+     * @throws
+     * @author ZHAOXA
+     */
+    private JSONArray queryComments(String token, Long accountId, int page, int pageSize, int num) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.COMMENT_LIST;
+        Map<String, String> header = new HashMap<>();
+        header.put("Access-Token", token);
+        header.put("Content-Type", "application/json");
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", accountId);
+        params.put("shield_status", NoEn.NO1.valueInt());//未隐藏数据
+        params.put("page", page);
+        params.put("page_size", pageSize);
+        String result = HttpUtils.httpPostRequest(url, params, header);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject dataJson = resultJson.getJSONObject("data");
+                JSONArray details = dataJson.getJSONArray("details");
+                if (!Check.isNull(details)) {
+                    if (num <= 50) {
+                        if (shieldCommentApi(token, accountId, details)) {
+                            queryComments(token, accountId, page, pageSize, ++num);
+                        }
+                    }
+                }
+                return null;
+            } else {
+                log.error("查询评论列表数据接口返回信息错误:accountId:{},返回信息:{}", accountId, resultJson);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 执行屏蔽接口
+     *
+     * @param
+     * @return com.alibaba.fastjson.JSONArray
+     * @throws
+     * @author ZHAOXA
+     */
+    private boolean shieldCommentApi(String token, Long accountId, JSONArray comments) {
+        if (Check.isNull(comments)) {
+            return false;
+        }
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.COMMENT_SHIELD;
+        Map<String, String> header = new HashMap<>();
+        header.put("Access-Token", token);
+        header.put("Content-Type", "application/json");
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", accountId);
+        params.put("shield_list", comments);
+        String result = HttpUtils.httpPostRequest(url, params, header);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            return code == 0;
+        }
+        return false;
+    }
+}

+ 52 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouAdvertiserBaseInfoServiceImpl.java

@@ -0,0 +1,52 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouAdvertiserBaseInfo;
+import com.xxl.job.executor.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouAdvertiserBaseInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 快手-广告主基本信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-18
+ */
+@Service
+public class KuaiShouAdvertiserBaseInfoServiceImpl extends ServiceImpl<KuaiShouAdvertiserBaseInfoMapper, KuaiShouAdvertiserBaseInfo> implements IKuaiShouAdvertiserBaseInfoService {
+    @Autowired
+    private KuaiShouAdvertiserBaseInfoMapper advertiserBaseInfoMapper;
+
+    /**
+     * 根据accountId获取对象
+     *
+     * @param accountId
+     * @return
+     */
+    @Override
+    public KuaiShouAdvertiserBaseInfo getBaseInfo(Long accountId) {
+        QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.last("limit 1");
+        return advertiserBaseInfoMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     * 获取账户列表
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<KuaiShouAdvertiserBaseInfo> getAccountIdList(String userId) {
+        QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        queryWrapper.groupBy("account_id");
+        return advertiserBaseInfoMapper.selectList(queryWrapper);
+    }
+}

+ 18 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCampaignDayBudgetServiceImpl.java

@@ -0,0 +1,18 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaignDayBudget;
+import com.xxl.job.executor.batch.mapper.KuaiShouCampaignDayBudgetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouCampaignDayBudgetService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: 快手-修改广告计划记录表
+ * @Author: jeecg-boot
+ * @Date: 2019-09-11
+ * @Version: V1.0
+ */
+@Service
+public class KuaiShouCampaignDayBudgetServiceImpl extends ServiceImpl<KuaiShouCampaignDayBudgetMapper, KuaiShouCampaignDayBudget> implements IKuaiShouCampaignDayBudgetService {
+
+}

+ 63 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCampaignServiceImpl.java

@@ -0,0 +1,63 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaign;
+import com.xxl.job.executor.batch.mapper.KuaiShouCampaignMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouCampaignService;
+import com.xxl.job.executor.utils.Check;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 快手-获取广告计划信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+@Service
+public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMapper, KuaiShouCampaign> implements IKuaiShouCampaignService {
+    @Autowired
+    private KuaiShouCampaignMapper campaignMapper;
+
+    @Override
+    public void replaceBatch(List<KuaiShouCampaign> campaigns) {
+        campaignMapper.replaceBatch(campaigns);
+    }
+
+
+    /**
+     * 获取创意
+     *
+     * @param accountId
+     * @return
+     */
+    @Override
+    public List<JSONArray> getJsonArrByAccount(Long accountId, int idSize) {
+        QueryWrapper<KuaiShouCampaign> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        List<KuaiShouCampaign> list = this.list(queryWrapper);
+        List<JSONArray> campaignArr = new ArrayList<>();
+        if (!Check.isNull(list)) {
+            int arrSize = list.size() % idSize == 0 ? list.size() / idSize : list.size() / idSize + 1;
+            for (int i = 0; i < arrSize; i++) {
+                JSONArray arr = new JSONArray();
+                for (int j = i * idSize; j <= idSize * (i + 1) - 1; j++) {
+                    if (j <= list.size() - 1) {
+                        KuaiShouCampaign campaign = list.get(i);
+                        arr.add(campaign.getCampaignId());
+                    }
+                }
+                campaignArr.add(arr);
+            }
+            return campaignArr;
+        }
+
+        return null;
+    }
+
+}

+ 189 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouCreativeServiceImpl.java

@@ -0,0 +1,189 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouCreative;
+import com.xxl.job.executor.batch.entity.KuaiShouVideoGet;
+import com.xxl.job.executor.batch.mapper.KuaiShouCreativeMapper;
+import com.xxl.job.executor.batch.mapper.KuaiShouVideoGetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouCreativeService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @Description: 快手-创意信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+@Slf4j
+@Service
+public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMapper, KuaiShouCreative> implements IKuaiShouCreativeService {
+    @Autowired
+    private KuaiShouCreativeMapper kuaiShouCreativeMapper;
+    @Autowired
+    private KuaiShouVideoGetMapper kuaiShouVideoGetMapper;
+
+    @Override
+    public void replaceBatch(List<KuaiShouCreative> creatives) {
+        kuaiShouCreativeMapper.replaceBatch(creatives);
+    }
+
+    @Override
+    public String getCodeByCreativeId(Long creativeId) {
+        QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
+        creativeQueryWrapper.eq("creative_id", creativeId);
+        creativeQueryWrapper.orderByDesc("create_time");
+        creativeQueryWrapper.last("limit 1");
+        KuaiShouCreative kuaiShouCreative = kuaiShouCreativeMapper.selectOne(creativeQueryWrapper);
+        if (!Check.isNull(kuaiShouCreative)) {
+            String photoId = kuaiShouCreative.getPhotoId();
+            if (!Check.isNull(photoId)) {
+                QueryWrapper<KuaiShouVideoGet> videoGetQueryWrapper = new QueryWrapper<>();
+                videoGetQueryWrapper.eq("photo_id", photoId);
+                videoGetQueryWrapper.orderByDesc("create_time");
+                videoGetQueryWrapper.last("limit 1");
+                KuaiShouVideoGet kuaiShouVideoGet = kuaiShouVideoGetMapper.selectOne(videoGetQueryWrapper);
+                if (!Check.isNull(kuaiShouVideoGet)) {
+                    return kuaiShouVideoGet.getSignature();
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 创意条数
+     *
+     * @param accountId
+     * @param unitId
+     * @return
+     */
+    @Override
+    public Integer checkCreativeCount(Long accountId, Long unitId) {
+        return kuaiShouCreativeMapper.checkCreativeCount(accountId, unitId);
+    }
+
+    @Override
+    public void syncCreative(Long accountId, String accessToken, Long campaignId, Integer page) {
+
+
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", accessToken);
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        if (!Check.isNull(campaignId)) {
+            param.put("campaign_id", campaignId);
+        }
+        param.put("page_size", 200);
+        param.put("page", page);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return;
+        }
+        List<KuaiShouCreative> creatives = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+            if (!Check.isNull(detailJson)) {
+                KuaiShouCreative creative = new KuaiShouCreative();
+                creative.setId("" + accountId + detailJson.getLong("creative_id"));
+                creative.setAccountId(accountId);
+                creative.setCampaignId(detailJson.getLong("campaign_id"));
+                creative.setUnitId(detailJson.getLong("unit_id"));
+                creative.setCreativeId(detailJson.getLong("creative_id"));
+                creative.setCreativeName(detailJson.getString("creative_name"));
+                creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                    creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                }
+
+                if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                    creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                }
+                creative.setStatus(detailJson.getInteger("status"));
+                creative.setPutStatus(detailJson.getInteger("put_status"));
+                creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                creative.setReviewDetail(detailJson.getString("review_detail"));
+                creative.setCoverUrl(detailJson.getString("cover_url"));
+                creative.setImageToken(detailJson.getString("image_token"));
+                creative.setCoverWidth(detailJson.getString("cover_width"));
+                creative.setCoverHeight(detailJson.getString("cover_height"));
+                creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                creative.setStickerTitle(detailJson.getString("sticker_title"));
+                creative.setOverlayType(detailJson.getString("overlay_type"));
+                creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                creative.setImpressionUrl(detailJson.getString("impression_url"));
+                creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
+                creative.setShortSlogan(detailJson.getString("short_slogan"));
+                creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
+                JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+                if (!Check.isNull(displayInfoJson)) {
+                    creative.setDescription(displayInfoJson.getString("description"));
+                    creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                }
+                creative.setCreativeCategory(detailJson.getInteger("creative_category"));
+                if (!Check.isNull(detailJson.getJSONArray("creative_tag"))) {
+                    creative.setCreativeTag(detailJson.getJSONArray("creative_tag").toJSONString());
+                }
+                creative.setCreateTime(new Date());
+                creative.setUpdateTime(new Date());
+                creative.setSiteId(detailJson.getLong("site_id"));
+                creative.setPhotoId(detailJson.getString("photo_id"));
+                if (detailJson.getLong("photo_id") == 0) {
+                    JSONArray photoIds = new JSONArray();
+                    JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                    if (!Check.isNull(programmed_creative_material)) {
+                        creative.setProgrammedCreativeMaterial(programmed_creative_material.toJSONString());
+                        JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                        if (!Check.isNull(materials)) {
+                            for (int j = 0; j < materials.size(); j++) {
+                                JSONObject materialJson = materials.getJSONObject(j);
+                                if (!Check.isNull(materialJson)) {
+                                    Long photo_id = materialJson.getLong("photo_id");
+                                    photoIds.add(String.valueOf(photo_id));
+                                }
+                            }
+                            creative.setPhotoIds(photoIds.toJSONString());
+                        }
+                    }
+                }
+                creatives.add(creative);
+            }
+        }
+        this.replaceBatch(creatives);
+        this.syncCreative(accountId, accessToken, campaignId, page + 1);
+    }
+
+    @Override
+    public Integer getCreateCount(Long accountId, String startTime) {
+        return kuaiShouCreativeMapper.getCreateCount(accountId, startTime);
+    }
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouDailyFlowsServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyFlows;
+import com.xxl.job.executor.batch.mapper.KuaiShouDailyFlowsMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouDailyFlowsService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-日流水信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-05
+ */
+@Service
+public class KuaiShouDailyFlowsServiceImpl extends ServiceImpl<KuaiShouDailyFlowsMapper, KuaiShouDailyFlows> implements IKuaiShouDailyFlowsService {
+
+}

+ 177 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -0,0 +1,177 @@
+package com.xxl.job.executor.batch.service.impl;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyReportTask;
+import com.xxl.job.executor.batch.mapper.KuaiShouDailyReportTaskMapper;
+import com.xxl.job.executor.batch.mapper.KuaiShouReportDailyMaterialMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouDailyReportTaskService;
+import com.xxl.job.executor.batch.service.IKuaiShouHistoryReportTaskService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.report.mapper.KuaishouReportDailyCampaignMapper;
+import com.xxl.job.executor.report.mapper.KuaishouReportDailyCreativeMapper;
+import com.xxl.job.executor.report.mapper.KuaishouReportDailyGroupMapper;
+import com.xxl.job.executor.report.mapper.KuaishouReportDailyImageMapper;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.LoadFileUtil;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 分天记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-12
+ */
+@Slf4j
+@Service
+public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDailyReportTaskMapper, KuaiShouDailyReportTask> implements IKuaiShouDailyReportTaskService {
+    @Value("${jeecg.path.report-daily}")
+    private String downloadPath;
+    @Autowired
+    private KuaishouReportDailyCampaignMapper reportDailyCampaignMapper;
+    @Autowired
+    private KuaishouReportDailyGroupMapper reportDailyGroupMapper;
+    @Autowired
+    private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
+    @Autowired
+    private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
+    @Autowired
+    private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+
+    @Override
+    public void formatCreativeDailyReportData(Long accountId, String statDate) {
+        reportDailyCreativeMapper.formatCreativeDailyReportData(accountId, statDate);
+    }
+
+    /**
+     * 获取任务列表
+     */
+    @Override
+    public void getTaskList(Long accountId, String token, String statDate) {
+        QueryWrapper<KuaiShouDailyReportTask> taskQueryWrapper = new QueryWrapper<>();
+        taskQueryWrapper.eq("task_status", 0);
+        taskQueryWrapper.eq("account_id", accountId);
+        taskQueryWrapper.eq("stat_date", statDate);
+        taskQueryWrapper.orderByDesc("create_time");
+        List<KuaiShouDailyReportTask> dailyTaskList = this.list(taskQueryWrapper);
+        if (!Check.isNull(dailyTaskList)) {
+            for (KuaiShouDailyReportTask task : dailyTaskList) {
+                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ASYNC_TASK_LIST;
+                Map<String, String> headers = new HashMap<>();
+                headers.put("Content-Type", "application/json");
+                headers.put("Access-Token", token);
+                JSONObject param = new JSONObject();
+                param.put("advertiser_id", task.getAccountId());
+                JSONArray taskIds = new JSONArray();
+                taskIds.add(task.getTaskId());
+                param.put("task_ids", taskIds);
+                String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+                JSONObject resultJson = JSONObject.parseObject(result);
+                if (!Check.isNull(resultJson)) {
+                    Integer code = resultJson.getInteger("code");
+                    if (code == 0) {
+                        JSONObject dataJson = resultJson.getJSONObject("data");
+                        if (!Check.isNull(dataJson)) {
+                            JSONArray details = dataJson.getJSONArray("details");
+                            if (!Check.isNull(details)) {
+                                for (int i = 0; i < details.size(); i++) {
+                                    JSONObject detailJson = details.getJSONObject(i);
+                                    if (!Check.isNull(detailJson)) {
+                                        Integer taskStatus = detailJson.getInteger("task_status");
+                                        if (taskStatus == 2) {
+                                            loadFile(token, task);
+                                        } else if (taskStatus == 3) {
+                                            task.setTaskStatus(3);
+                                            task.setUpdateTime(new Date());
+                                            this.updateById(task);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    } else {
+                        log.error("快手获取任务列表返回错误,accountId:{},返回结果:{}", task.getAccountId(), resultJson);
+                    }
+                } else {
+                    log.error("快手获取任务列表返回信息为空,accountId:{}", task.getAccountId());
+                }
+            }
+        }
+    }
+
+
+    private void loadFile(String token, KuaiShouDailyReportTask task) {
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ASYNC_TASK_DOWNLOAD;
+            String fileName = task.getAccountId() + "_" + task.getStatDate() + "_" + task.getViewType() + ".csv";
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("advertiser_id", task.getAccountId());
+            requestMap.put("task_id", task.getTaskId());
+            String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath + task.getStatDate() + "//", url, token, fileName);
+            if (!Check.isNull(localPath)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("account_id", task.getAccountId());
+                deleteMap.put("stat_date", task.getStatDate());
+                if (task.getViewType() == 2) {
+                    reportDailyCampaignMapper.deleteByMap(deleteMap);
+                    reportDailyCampaignMapper.loadCampaignDailyReport(task.getAccountId(), localPath);
+                } else if (task.getViewType() == 3) {
+                    reportDailyGroupMapper.deleteByMap(deleteMap);
+                    reportDailyGroupMapper.loadGroupDailyReport(task.getAccountId(), localPath);
+                } else if (task.getViewType() == 4) {
+                    reportDailyCreativeMapper.deleteByMap(deleteMap);
+                    reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
+                } else if (task.getViewType() == 10) {
+                    reportDailyCreativeMapper.deleteByAccountIdAndStatDate(task.getAccountId(), task.getStatDate());
+                    reportDailyCreativeMapper.loadProgramCreativeDailyReport(task.getAccountId(), localPath);
+                } else if (task.getViewType() == 5) {
+                    kuaishouReportDailyMaterialMapper.deleteByMap(deleteMap);
+                    kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
+                    Thread thread = new Thread() {
+                        @Override
+                        public void run() {
+                            try {
+                                Thread.sleep(1 * 500L);
+                                kuaiShouHistoryReportTaskService.getMd5(task.getStatDate(), task.getAccountId());
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+
+                    };
+                    thread.start();
+                } else if (task.getViewType() == 7) {
+                    //封面报表
+                    kuaishouReportDailyImageMapper.deleteByMap(deleteMap);
+                    kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(), localPath);
+                    //清洗数据
+                    kuaishouReportDailyImageMapper.updateImageReportCode();
+                    kuaishouReportDailyImageMapper.updateImageReportUserId();
+                    kuaishouReportDailyImageMapper.updateImageReportRealname();
+                }
+            }
+
+            task.setTaskStatus(4);
+        } catch (Exception e) {
+            e.printStackTrace();
+            task.setTaskStatus(5);
+        }
+        task.setUpdateTime(new Date());
+        this.updateById(task);
+    }
+
+}

+ 398 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouGroupServiceImpl.java

@@ -0,0 +1,398 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouCampaign;
+import com.xxl.job.executor.batch.entity.KuaiShouCreative;
+import com.xxl.job.executor.batch.entity.KuaiShouGroup;
+import com.xxl.job.executor.batch.entity.KuaiShouGroupTarget;
+import com.xxl.job.executor.batch.mapper.KuaiShouGroupMapper;
+import com.xxl.job.executor.batch.mapper.KuaiShouGroupTargetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouCampaignService;
+import com.xxl.job.executor.batch.service.IKuaiShouCreativeService;
+import com.xxl.job.executor.batch.service.IKuaiShouGroupService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * @Description: 广告组信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-23
+ * @Version: V1.0
+ */
+
+@Slf4j
+@Service
+public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, KuaiShouGroup> implements IKuaiShouGroupService {
+    @Autowired
+    private IKuaiShouCampaignService kuaiShouCampaignService;
+    @Autowired
+    private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private KuaiShouGroupTargetMapper groupTargetMapper;
+    private static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+
+    /**
+     * 获取广告组
+     *
+     * @param accessToken
+     * @param accountId
+     */
+    @Override
+    public void getGroupList(String accessToken, Long accountId) {
+        QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+        campaignQueryWrapper.eq("account_id", accountId);
+        campaignQueryWrapper.orderByDesc("put_create_time");
+        campaignQueryWrapper.last("limit 15");
+        List<KuaiShouCampaign> list = kuaiShouCampaignService.list(campaignQueryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouCampaign campaign : list) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    getGroupListByPage(accessToken, accountId, campaign.getCampaignId(), 1);
+                }
+            });
+        }
+
+
+    }
+
+
+    private void getGroupListByPage(String accessToken, Long accountId, Long campaignId, int page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        param.put("campaign_id", campaignId);
+        param.put("page_size", 500);
+        param.put("page", page);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", "application/json");
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告组接口异常,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        if (null == code || code != 0) {
+            log.error("获取广告组返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+        addGroupV2(accountId, details);
+        getGroupListByPage(accessToken, accountId, campaignId, page + 1);
+    }
+
+
+    @Override
+    public void getGroupByUnitId(String accessToken, Long accountId, Long unitId) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        param.put("unit_id", unitId);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", "application/json");
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告组接口异常,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        if (null == code || code != 0) {
+            log.error("获取广告组返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+        addGroupV2(accountId, details);
+    }
+
+
+    /**
+     * 根据组获取创意
+     *
+     * @param accessToken
+     * @param accountId
+     * @param unitId
+     */
+    @Override
+    public void getCreativeByUnit(String accessToken, Long accountId, Long unitId) {
+
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", " application/json");
+            headers.put("Access-Token", accessToken);
+            JSONObject param = new JSONObject();
+            param.put("advertiser_id", accountId);
+            param.put("page_size", 500);
+
+
+            param.put("unit_id", unitId);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (Check.isNull(resultJson)) {
+                log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            String message = resultJson.getString("message");
+            if (null == code || code != 0) {
+                log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+                return;
+            }
+            JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+            if (null == details || details.size() <= 0) {
+                return;
+            }
+            for (int i = 0; i < details.size(); i++) {
+                JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+                if (!Check.isNull(detailJson)) {
+                    KuaiShouCreative creative = new KuaiShouCreative();
+                    creative.setId("" + accountId + detailJson.getLong("creative_id"));
+                    creative.setAccountId(accountId);
+                    creative.setCampaignId(detailJson.getLong("campaign_id"));
+                    creative.setUnitId(detailJson.getLong("unit_id"));
+                    creative.setCreativeId(detailJson.getLong("creative_id"));
+                    creative.setCreativeName(detailJson.getString("creative_name"));
+                    creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                    if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                        creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                    }
+
+                    if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                        creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                    }
+                    creative.setStatus(detailJson.getInteger("status"));
+                    creative.setPutStatus(detailJson.getInteger("put_status"));
+                    creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                    creative.setReviewDetail(detailJson.getString("review_detail"));
+                    creative.setCoverUrl(detailJson.getString("cover_url"));
+                    creative.setImageToken(detailJson.getString("image_token"));
+                    creative.setCoverWidth(detailJson.getString("cover_width"));
+                    creative.setCoverHeight(detailJson.getString("cover_height"));
+                    creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                    creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                    creative.setStickerTitle(detailJson.getString("sticker_title"));
+                    creative.setOverlayType(detailJson.getString("overlay_type"));
+                    creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                    creative.setImpressionUrl(detailJson.getString("impression_url"));
+                    creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                    creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                    creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                    creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
+                    creative.setShortSlogan(detailJson.getString("short_slogan"));
+                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
+                    JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+                    if (!Check.isNull(displayInfoJson)) {
+                        creative.setDescription(displayInfoJson.getString("description"));
+                        creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                    }
+                    creative.setCreativeCategory(detailJson.getInteger("creative_category"));
+                    if (!Check.isNull(detailJson.getJSONArray("creative_tag"))) {
+                        creative.setCreativeTag(detailJson.getJSONArray("creative_tag").toJSONString());
+                    }
+                    creative.setCreateTime(new Date());
+                    creative.setUpdateTime(new Date());
+                    creative.setSiteId(detailJson.getLong("site_id"));
+                    creative.setPhotoId(detailJson.getString("photo_id"));
+                    if (detailJson.getLong("photo_id") == 0) {
+                        JSONArray photoIds = new JSONArray();
+                        JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                        if (!Check.isNull(programmed_creative_material)) {
+                            creative.setProgrammedCreativeMaterial(programmed_creative_material.toJSONString());
+                            JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                            if (!Check.isNull(materials)) {
+                                for (int j = 0; j < materials.size(); j++) {
+                                    JSONObject materialJson = materials.getJSONObject(j);
+                                    if (!Check.isNull(materialJson)) {
+                                        Long photo_id = materialJson.getLong("photo_id");
+                                        photoIds.add(String.valueOf(photo_id));
+                                    }
+                                }
+                                creative.setPhotoIds(photoIds.toJSONString());
+                            }
+                        }
+                    }
+                    creativeService.saveOrUpdate(creative);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void addGroupV2(Long advertiserId, JSONArray details) {
+        if (!Check.isNull(details)) {
+            List<KuaiShouGroup> groups = new ArrayList<>();
+            List<KuaiShouGroupTarget> targets = new ArrayList<>();
+            for (int i = 0; i < details.size(); i++) {
+                JSONObject detail = JSONObject.parseObject(details.get(i).toString());
+                if (!Check.isNull(detail)) {
+                    Integer bid_type = detail.getInteger("bid_type");
+                    Long bid = detail.getLong("bid");
+                    Integer ocpx_action_type = detail.getInteger("ocpx_action_type");
+                    Long unitId = detail.getLong("unit_id");
+                    String unit_name = detail.getString("unit_name");
+                    Integer status = detail.getInteger("status");
+                    Integer put_status = detail.getInteger("put_status");
+
+                    KuaiShouGroup group = new KuaiShouGroup();
+                    group.setId("" + advertiserId + unitId);
+                    group.setAccountId(advertiserId);
+                    group.setCampaignId(detail.getLong("campaign_id"));
+                    group.setUnitId(unitId);
+                    group.setUnitName(unit_name);
+                    group.setStatus(status);
+                    group.setPutStatus(put_status);
+                    group.setCreateChannel(detail.getInteger("create_channel"));
+                    group.setReviewDetail(detail.getString("review_detail"));
+                    group.setBidType(bid_type);
+                    group.setBid(bid);
+                    group.setCpaBid(detail.getLong("cpa_bid"));
+                    group.setOcpxActionType(ocpx_action_type);
+                    group.setDeepConversionType(detail.getInteger("deep_conversion_type"));
+                    group.setDeepConversionBid(detail.getLong("deep_conversion_bid"));
+                    group.setDayBudget(detail.getLong("day_budget"));
+                    group.setSpeed(detail.getInteger("speed"));
+                    group.setBeginTime(detail.getString("begin_time"));
+                    group.setEndTime(detail.getString("end_time"));
+                    group.setScheduleTime(detail.getString("schedule_time"));
+                    group.setSceneId(detail.getJSONArray("scene_id") + "");
+                    group.setShowMode(detail.getInteger("show_mode"));
+                    group.setUnitType(detail.getInteger("unit_type"));
+                    group.setUrlType(detail.getInteger("url_type"));
+                    group.setUrl(detail.getString("url"));
+                    group.setAppId(detail.getLong("app_id"));
+                    group.setAppIconUrl(detail.getString("app_icon_url"));
+                    group.setGroupCreateTime(detail.getString("create_time"));
+                    group.setGroupUpdateTime(detail.getString("update_time"));
+                    group.setConvertId(detail.getLong("convert_id"));
+                    group.setUseAppMarket(detail.getInteger("use_app_market"));
+                    group.setAppStore(detail.getJSONArray("app_store") + "");
+                    group.setCreateTime(new Date());
+                    group.setUpdateTime(new Date());
+                    groups.add(group);
+
+                    JSONObject targetJson = detail.getJSONObject("target");
+                    if (!Check.isNull(targetJson)) {
+                        KuaiShouGroupTarget groupTarget = new KuaiShouGroupTarget();
+                        groupTarget.setAccountId(advertiserId);
+                        groupTarget.setUnitId(unitId);
+                        if (!Check.isNull(targetJson.getJSONArray("region"))) {
+                            groupTarget.setRegion(targetJson.getJSONArray("region").toJSONString());
+                        }
+
+                        JSONObject age = targetJson.getJSONObject("age");
+                        if (!Check.isNull(age)) {
+                            groupTarget.setAgeMin(age.getInteger("min"));
+                            groupTarget.setAgeMax(age.getInteger("max"));
+                        }
+                        if (!Check.isNull(targetJson.getJSONArray("ages_range"))) {
+                            groupTarget.setAgesRange(targetJson.getJSONArray("ages_range").toJSONString());
+                        }
+
+                        groupTarget.setGender(targetJson.getInteger("gender"));
+                        groupTarget.setPlatformOs(targetJson.getInteger("platform_os"));
+                        groupTarget.setAndroidOsv(targetJson.getInteger("android_osv"));
+                        groupTarget.setIosOsv(targetJson.getInteger("ios_osv"));
+                        groupTarget.setNetwork(targetJson.getInteger("network"));
+                        if (!Check.isNull(targetJson.getJSONArray("device_brand"))) {
+                            groupTarget.setDeviceBrand(targetJson.getJSONArray("device_brand").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("device_price"))) {
+                            groupTarget.setDevicePrice(targetJson.getJSONArray("device_price").toJSONString());
+                        }
+
+                        groupTarget.setBusinessInterestType(targetJson.getInteger("business_interest_type"));
+                        if (!Check.isNull(targetJson.getJSONArray("business_interest"))) {
+                            groupTarget.setBusinessInterest(targetJson.getJSONArray("business_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("fans_star"))) {
+                            groupTarget.setFansStar(targetJson.getJSONArray("fans_star").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("interest_video"))) {
+                            groupTarget.setInterestVideo(targetJson.getJSONArray("interest_video").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_interest"))) {
+                            groupTarget.setAppInterest(targetJson.getJSONArray("app_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_ids"))) {
+                            groupTarget.setAppIds(targetJson.getJSONArray("app_ids").toJSONString());
+                        }
+
+
+                        if (!Check.isNull(targetJson.getInteger("filter_converted_level"))) {
+                            groupTarget.setFilterConvertedLevel(targetJson.getInteger("filter_converted_level"));
+                        }
+
+
+                        if (!Check.isNull(targetJson.getJSONArray("population"))) {
+                            groupTarget.setPopulation(targetJson.getJSONArray("population").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("exclude_population"))) {
+                            groupTarget.setExcludePopulation(targetJson.getJSONArray("exclude_population").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("third_platform_code"))) {
+                            groupTarget.setThirdPlatformCode(targetJson.getJSONArray("third_platform_code").toJSONString());
+                        }
+
+
+                        JSONObject intelliExtend = targetJson.getJSONObject("intelli_extend");
+                        if (!Check.isNull(intelliExtend)) {
+                            groupTarget.setIsOpen(intelliExtend.getInteger("is_open"));
+                            groupTarget.setNoAgeBreak(intelliExtend.getInteger("no_age_break"));
+                            groupTarget.setNoGenderBreak(intelliExtend.getInteger("no_gender_break"));
+                            groupTarget.setNoAreaBreak(intelliExtend.getInteger("no_area_break"));
+
+                        }
+                        targets.add(groupTarget);
+                    }
+                }
+            }
+            if (!Check.isNull(groups)) {
+                groupMapper.replaceBatch(groups);
+            }
+            if (!Check.isNull(targets)) {
+                groupTargetMapper.replaceBatch(targets);
+            }
+        }
+    }
+
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouGroupTargetServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouGroupTarget;
+import com.xxl.job.executor.batch.mapper.KuaiShouGroupTargetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouGroupTargetService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Service
+public class KuaiShouGroupTargetServiceImpl extends ServiceImpl<KuaiShouGroupTargetMapper, KuaiShouGroupTarget> implements IKuaiShouGroupTargetService {
+
+}

+ 366 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -0,0 +1,366 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouDailyReportTask;
+import com.xxl.job.executor.batch.entity.KuaiShouHistoryReportTask;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouReportDailyMaterialVo;
+import com.xxl.job.executor.batch.entity.vo.VideoGetvo;
+import com.xxl.job.executor.batch.mapper.KuaiShouHistoryReportTaskMapper;
+import com.xxl.job.executor.batch.mapper.KuaiShouReportDailyMaterialMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouDailyReportTaskService;
+import com.xxl.job.executor.batch.service.IKuaiShouHistoryReportTaskService;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.service.ICtopOauthTokenService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.report.entity.KuaiShouReportDailyMaterial;
+import com.xxl.job.executor.report.mapper.*;
+import com.xxl.job.executor.utils.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 快手历史数据任务记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-09
+ */
+@Slf4j
+@Service
+public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHistoryReportTaskMapper, KuaiShouHistoryReportTask> implements IKuaiShouHistoryReportTaskService {
+    @Value("${jeecg.path.report-history}")
+    private String downloadPath;
+    static List<Integer> historyTypeList;
+    static List<Integer> dailyTypeList;
+    @Autowired
+    private ICtopOauthTokenService ctopOauthTokenService;
+    @Autowired
+    private KuaishouReportDailyAccountMapper reportDailyAccountMapper;
+    @Autowired
+    private KuaishouReportDailyCampaignMapper reportDailyCampaignMapper;
+    @Autowired
+    private KuaishouReportDailyGroupMapper reportDailyGroupMapper;
+    @Autowired
+    private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
+    @Autowired
+    private IKuaiShouDailyReportTaskService dailyReportTaskService;
+    @Autowired
+    private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+
+
+    @Override
+    public void createTask(Long accountId, String token, String startDate, String endDate, String taskType) {
+        if (Check.isNull(accountId) || Check.isNull(token)) {
+            log.error("token或accountId为空");
+            return;
+        }
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ASYNC_TASK_CREAT;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", "application/json");
+            headers.put("Access-Token", token);
+            JSONObject param = new JSONObject();
+            param.put("advertiser_id", accountId);
+            JSONObject taskParams = new JSONObject();
+            taskParams.put("start_date", startDate);
+            taskParams.put("end_date", endDate);
+
+            if (null != taskType && taskType.equals(CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY)) {
+                if (Check.isNull(dailyTypeList)) {
+                    getDailyTypeList();
+                }
+                for (int i = 0; i < dailyTypeList.size(); i++) {
+                    Integer type = dailyTypeList.get(i);
+                    String taskName = accountId + "_" + type + "_" + System.currentTimeMillis();
+                    param.put("task_name", taskName);
+                    taskParams.put("view_type", type);
+                    param.put("task_params", taskParams);
+
+                    String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+                    JSONObject resultJson = JSONObject.parseObject(result);
+                    if (!Check.isNull(resultJson)) {
+                        Integer code = resultJson.getInteger("code");
+                        if (code == 0) {
+                            JSONObject dataJson = resultJson.getJSONObject("data");
+                            KuaiShouDailyReportTask dailyReportTask = new KuaiShouDailyReportTask();
+                            dailyReportTask.setAccountId(accountId);
+                            dailyReportTask.setStatDate(endDate);
+                            dailyReportTask.setTaskId(dataJson.getString("task_id"));
+                            dailyReportTask.setViewType(type);
+                            dailyReportTask.setTaskStatus(0);
+                            dailyReportTask.setTaskName(taskName);
+                            dailyReportTaskService.save(dailyReportTask);
+                        } else {
+                            log.error("快手分天报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
+                        }
+                    }
+                }
+            } else {
+                if (Check.isNull(historyTypeList)) {
+                    getHistoryTypeList();
+                }
+                for (int i = 0; i < historyTypeList.size(); i++) {
+                    Integer type = historyTypeList.get(i);
+                    String taskName = accountId + "_" + type + "_" + System.currentTimeMillis();
+                    param.put("task_name", taskName);
+                    taskParams.put("view_type", type);
+                    param.put("task_params", taskParams);
+                    String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+                    JSONObject resultJson = JSONObject.parseObject(result);
+                    log.info("请求状态返回数据:{}", resultJson);
+                    if (!Check.isNull(resultJson)) {
+                        Integer code = resultJson.getInteger("code");
+                        if (code == 0) {
+                            JSONObject dataJson = resultJson.getJSONObject("data");
+                            KuaiShouHistoryReportTask reportTask = new KuaiShouHistoryReportTask();
+                            reportTask.setAccountId(accountId);
+                            reportTask.setStartDate(startDate);
+                            reportTask.setEndDate(endDate);
+                            reportTask.setTaskId(dataJson.getString("task_id"));
+                            reportTask.setViewType(type);
+                            reportTask.setTaskStatus(0);
+                            reportTask.setTaskName(taskName);
+                            this.save(reportTask);
+                        } else {
+                            log.error("快手历史报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 获取任务列表
+     */
+    @Override
+    public void getTaskList() {
+        log.info("开始历史数据文件检查下载");
+        QueryWrapper<KuaiShouHistoryReportTask> taskQueryWrapper = new QueryWrapper<>();
+        taskQueryWrapper.eq("task_status", 0);
+        taskQueryWrapper.orderByDesc("create_time");
+        List<KuaiShouHistoryReportTask> taskList = this.list(taskQueryWrapper);
+        if (!Check.isNull(taskList)) {
+            for (KuaiShouHistoryReportTask task : taskList) {
+                CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(task.getAccountId());
+                if (!Check.isNull(token)) {
+                    String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ASYNC_TASK_LIST;
+                    Map<String, String> headers = new HashMap<>();
+                    headers.put("Content-Type", "application/json");
+                    headers.put("Access-Token", token.getAccessToken());
+                    JSONObject param = new JSONObject();
+                    param.put("advertiser_id", task.getAccountId());
+                    JSONArray taskIds = new JSONArray();
+                    taskIds.add(task.getTaskId());
+                    param.put("task_ids", taskIds);
+                    String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+                    JSONObject resultJson = JSONObject.parseObject(result);
+                    log.info("请求状态返回数据:{}", resultJson);
+                    if (!Check.isNull(resultJson)) {
+                        Integer code = resultJson.getInteger("code");
+                        if (code == 0) {
+                            JSONObject dataJson = resultJson.getJSONObject("data");
+                            if (!Check.isNull(dataJson)) {
+                                JSONArray details = dataJson.getJSONArray("details");
+                                if (!Check.isNull(details)) {
+                                    for (int i = 0; i < details.size(); i++) {
+                                        JSONObject detailJson = details.getJSONObject(i);
+                                        if (!Check.isNull(detailJson)) {
+                                            Integer taskStatus = detailJson.getInteger("task_status");
+                                            if (taskStatus == 2) {
+                                                loadFile(token.getAccessToken(), task);
+                                            } else if (taskStatus == 3) {
+                                                task.setTaskStatus(3);
+                                                this.updateById(task);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        } else {
+                            log.error("快手获取任务列表返回错误,accountId:{},返回结果:{}", task.getAccountId(), resultJson);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+    private void loadFile(String token, KuaiShouHistoryReportTask task) {
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ASYNC_TASK_DOWNLOAD;
+            String fileName = task.getAccountId() + "_" + task.getViewType() + ".csv";
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("advertiser_id", task.getAccountId());
+            requestMap.put("task_id", task.getTaskId());
+            String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token, fileName);
+            if (!Check.isNull(localPath)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("account_id", task.getAccountId());
+
+                if (task.getViewType() == 1) {
+                    reportDailyAccountMapper.deleteByMap(deleteMap);
+                    reportDailyAccountMapper.loadAccountDailyReport(task.getAccountId(), localPath);
+                } else if (task.getViewType() == 2) {
+                    reportDailyCampaignMapper.deleteByMap(deleteMap);
+                    reportDailyCampaignMapper.loadCampaignDailyReport(task.getAccountId(), localPath);
+
+                } else if (task.getViewType() == 3) {
+                    reportDailyGroupMapper.deleteByMap(deleteMap);
+                    reportDailyGroupMapper.loadGroupDailyReport(task.getAccountId(), localPath);
+
+                } else if (task.getViewType() == 4) {
+                    reportDailyCreativeMapper.deleteByMap(deleteMap);
+                    reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
+
+                } else if (task.getViewType() == 10) {
+                    reportDailyCreativeMapper.deleteByAccountId(task.getAccountId());
+                    reportDailyCreativeMapper.loadProgramCreativeDailyReport(task.getAccountId(), localPath);
+
+                } else if (task.getViewType() == 5) {
+                    kuaishouReportDailyMaterialMapper.deleteByMap(deleteMap);
+                    kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
+                    Thread thread = new Thread() {
+                        @Override
+                        public void run() {
+                            try {
+                                Thread.sleep(1 * 500L);
+                                getMd5(null, task.getAccountId());
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+
+                    };
+                    thread.start();
+                } else if (task.getViewType() == 7) {
+                    kuaishouReportDailyImageMapper.deleteByMap(deleteMap);
+                    //封面报表
+                    kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(), localPath);
+                    //清洗数据
+                    kuaishouReportDailyImageMapper.updateImageReportCode();
+                    kuaishouReportDailyImageMapper.updateImageReportUserId();
+                    kuaishouReportDailyImageMapper.updateImageReportRealname();
+                }
+
+
+            }
+            task.setTaskStatus(4);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            task.setTaskStatus(5);
+        }
+        this.updateById(task);
+
+    }
+
+
+    private void getHistoryTypeList() {
+
+        historyTypeList = new ArrayList<>();
+        historyTypeList.add(1);
+        historyTypeList.add(2);
+        historyTypeList.add(3);
+        historyTypeList.add(4);
+        historyTypeList.add(5);
+        historyTypeList.add(7);
+        historyTypeList.add(10);
+
+
+    }
+
+    private void getDailyTypeList() {
+        dailyTypeList = new ArrayList<>();
+        dailyTypeList.add(2);
+        dailyTypeList.add(3);
+        dailyTypeList.add(4);
+        dailyTypeList.add(5);
+        dailyTypeList.add(7);
+        dailyTypeList.add(10);
+    }
+
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(30);
+
+    @Override
+    public void getMd5(String statDate, Long accountId) {
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(accountId, statDate);
+                if (!Check.isNull(photoList)) {
+                    for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
+                        Long photoId = materialVo.getPhotoId();
+                        VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
+                        if (!Check.isNull(videoGetvo)) {
+                            QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
+                            updateQueryWrapper.eq("photo_id", photoId);
+                            if (!Check.isNull(statDate)) {
+                                updateQueryWrapper.eq("stat_date", statDate);
+                            }
+
+                            updateQueryWrapper.isNull("signature");
+                            KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                            material.setSignature(videoGetvo.getSignature());
+                            material.setChannelType(videoGetvo.getChannelType());
+                            kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
+                            log.info("修改成功:photoId:{},accountId:{}", photoId, accountId);
+                        }
+
+                    }
+                }
+            }
+        });
+
+    }
+
+    @Override
+    public void getMd5V2(String statDate) {
+        List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoListByDate(statDate);
+        if (!Check.isNull(photoList)) {
+            for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        Long photoId = materialVo.getPhotoId();
+                        VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
+                        if (!Check.isNull(videoGetvo)) {
+                            QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
+                            updateQueryWrapper.eq("photo_id", photoId);
+                            if (!Check.isNull(statDate)) {
+                                updateQueryWrapper.eq("stat_date", statDate);
+                            }
+                            KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                            material.setSignature(videoGetvo.getSignature());
+                            material.setChannelType(videoGetvo.getChannelType());
+                            kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
+                        }
+                    }
+                });
+            }
+        }
+
+
+    }
+
+
+}

+ 41 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouImageGetServiceImpl.java

@@ -0,0 +1,41 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
+import com.xxl.job.executor.batch.mapper.KuaiShouImageGetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouImageGetService;
+import com.xxl.job.executor.utils.Check;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-获取图片接口
+ * @Author: jeecg-boot
+ * @Date: 2019-12-03
+ * @Version: V1.0
+ */
+@Service
+public class KuaiShouImageGetServiceImpl extends ServiceImpl<KuaiShouImageGetMapper, KuaiShouImageGet> implements IKuaiShouImageGetService {
+    @Autowired
+    private KuaiShouImageGetMapper imageGetMapper;
+
+    @Override
+    public void replaceBatch(List<KuaiShouImageGet> imageGets) {
+        imageGetMapper.replaceBatch(imageGets);
+    }
+
+    @Override
+    public String getUrlByCode(String signature) {
+        String url = imageGetMapper.getUrlByCode(signature);
+        if (!Check.isNull(url)) {
+            return url;
+        } else {
+            return imageGetMapper.getCutFrameUrlByCode(signature);
+        }
+
+
+    }
+
+}

+ 216 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java

@@ -0,0 +1,216 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
+import com.xxl.job.executor.batch.service.IKuaiShouImageGetService;
+import com.xxl.job.executor.batch.service.IKuaiShouMaterialUploadService;
+import com.xxl.job.executor.batch.service.IKuaiShouVideoGetService;
+import com.xxl.job.executor.batch.service.IKuaishouInterfaceService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.constant.MaterialEnum;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.LoadFileUtil;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploadService {
+
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+    @Autowired
+    private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private IKuaiShouVideoGetService kuaiShouVideoGetService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    /**
+     * 上传文件
+     *
+     * @param
+     * @param type
+     * @param accountId
+     */
+    @Override
+    public JSONObject video(String url, Integer type, Long accountId, String accessToken, String signature) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            log.info("开始本地视频上传");
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+            String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+            File file = new File(localUrl);
+            FileSystemResource resource = new FileSystemResource(file);
+            Map<String, String> headerMap = new HashMap<>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            headerMap.put("Access-Token", accessToken);
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("signature", signature);
+            requestJson.put("file", resource);
+            requestJson.put("type", type);
+            requestJson.put("advertiser_id", accountId);
+            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                if (resultJson.getInteger("code") == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        String photoId = dataJson.getString("photo_id");
+                        returnJson.put("success", true);
+                        returnJson.put("photoId", photoId);
+                        returnJson.put("signature", signature);
+                        returnJson.put("message", "上传成功");
+                        try {
+                            Thread.sleep(1 * 1000L);
+                            kuaishouInterfaceService.getVideoInfo(accessToken, accountId, photoId);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+
+                    }
+                    LoadFileUtil.delFile(localUrl);
+                    log.info("快手素材上传完成,accountId:{},code:{},返回信息:{}", accountId, signature, resultJson);
+                } else {
+                    log.error("快手上传素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                    returnJson.put("success", false);
+                    returnJson.put("signature", signature);
+                    returnJson.put("message", resultJson.getString("message"));
+                }
+            } else {
+                log.error("快手上传素材返回信息为空请求参数:{}", requestJson);
+                returnJson.put("success", false);
+                returnJson.put("signature", signature);
+                returnJson.put("message", "调用快手后台返回结果为空");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("success", false);
+            returnJson.put("signature", signature);
+            returnJson.put("message", "系统异常");
+
+        }
+        return returnJson;
+
+
+    }
+
+
+    @Override
+    public String kuauiShouImageUpload(String url, String signature, Long accountId, String token) {
+        try {
+            Map<String, String> headerMap = new HashMap<>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("signature", signature);
+            requestJson.put("url", url);
+            requestJson.put("type", 2);
+            requestJson.put("advertiser_id", accountId);
+            headerMap.put("Access-Token", token);
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+            requestJson.put("upload_type", "2");
+            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                if (resultJson.getInteger("code") == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        String image_token = dataJson.getString("image_token");
+                        KuaiShouImageGet imageGet = new KuaiShouImageGet();
+                        imageGet.setId(accountId + image_token);
+                        imageGet.setAccountId(accountId);
+                        imageGet.setUrl(dataJson.getString("url"));
+                        imageGet.setWidth(dataJson.getInteger("width"));
+                        imageGet.setHeight(dataJson.getInteger("height"));
+                        imageGet.setSize(dataJson.getInteger("size"));
+                        imageGet.setFormat(dataJson.getString("format"));
+                        Integer type = MaterialEnum.getTypeBySize(dataJson.getInteger("width"), dataJson.getInteger("height"));
+                        if (!Check.isNull(type)) {
+                            imageGet.setMaterialType(type);
+                        }
+                        imageGet.setSignature(signature);
+                        imageGet.setImageToken(image_token);
+                        iKuaiShouImageGetService.saveOrUpdate(imageGet);
+                        return dataJson.getString("image_token");
+                    }
+
+                } else {
+                    log.error("上传图片失败,accountId:{},code:{},data:{}", accountId, signature, resultJson);
+                }
+
+
+            } else {
+                log.error("上传图片,返回结果为空,accountId:{},code:{},data:{}", accountId, signature, resultJson);
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+
+        }
+
+        return null;
+    }
+
+
+    public String uploadFile(MultipartFile multipartFile, String dirPath) throws IOException {
+        String fileName = multipartFile.getOriginalFilename();
+        String fileSuffix = fileName.substring(fileName.lastIndexOf("."), fileName.length());
+        String localFileName = System.currentTimeMillis() + fileSuffix;
+        String filePath = dirPath + File.separator + localFileName;
+        File localFile = new File(filePath);
+        File imagePath = new File(dirPath);
+        if (!imagePath.exists()) {
+            imagePath.mkdirs();
+        }
+        multipartFile.transferTo(localFile);
+        return filePath;
+    }
+
+    @Autowired
+    private RestTemplate rest;
+
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) {
+        try {
+            MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
+            if (!Check.isNullMap(paramMap)) {
+                for (String key : paramMap.keySet()) {
+                    param.add(key, paramMap.get(key));
+                }
+                HttpHeaders headers = new HttpHeaders();
+                if (!Check.isNullMap(headerMap)) {
+                    for (String key : headerMap.keySet()) {
+                        headers.add(key, headerMap.get(key));
+                    }
+                }
+                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
+                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
+                return responseEntity.getBody();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+}

+ 90 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java

@@ -0,0 +1,90 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.vo.VideoGetvo;
+import com.xxl.job.executor.batch.mapper.KuaiShouReportDailyMaterialMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouReportDailyMaterialService;
+import com.xxl.job.executor.report.entity.KuaiShouReportDailyMaterial;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-09
+ */
+@Slf4j
+@Service
+public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShouReportDailyMaterialMapper, KuaiShouReportDailyMaterial> implements IKuaiShouReportDailyMaterialService {
+    @Autowired
+    private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
+
+    /**
+     * 获取素材数据
+     *
+     * @param accountId
+     * @param startDate
+     * @param endDate
+     */
+    @Override
+    public void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/report/material_report";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        param.put("view_type", 5);
+        param.put("page_size", 1000);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            return;
+        }
+
+        Integer totalCount = resultJson.getInteger("total_count");
+        if (null == totalCount||totalCount == 0) {
+            return;
+        }
+        JSONArray details = resultJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+
+        List<KuaiShouReportDailyMaterial> addList = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = details.getJSONObject(i);
+            detailJson.put("photo_like", detailJson.getInteger("like"));
+            detailJson.put("photo_share", detailJson.getInteger("share"));
+            detailJson.put("photo_comment", detailJson.getInteger("comment"));
+            detailJson.put("photo_show", detailJson.getInteger("show"));
+            KuaiShouReportDailyMaterial material = JSONObject.toJavaObject(detailJson, KuaiShouReportDailyMaterial.class);
+            VideoGetvo videoGetvo = dailyMaterialMapper.getVideoGetByPhotoId(material.getPhotoId());
+            if (!Check.isNull(videoGetvo)) {
+                material.setChannelType(videoGetvo.getChannelType());
+                material.setSignature(videoGetvo.getSignature());
+            }
+            material.setAccountId(accountId);
+            addList.add(material);
+        }
+        dailyMaterialMapper.batchReplace(addList);
+        getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, page + 1);
+    }
+}

+ 123 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaiShouVideoGetServiceImpl.java

@@ -0,0 +1,123 @@
+package com.xxl.job.executor.batch.service.impl;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouVideoGet;
+import com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo;
+import com.xxl.job.executor.batch.mapper.KuaiShouVideoGetMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouVideoGetService;
+import com.xxl.job.executor.common.entity.MaterialCutFrame;
+import com.xxl.job.executor.common.service.IMaterialCutFrameService;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.LoadFileUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * @Description: 快手-获取视频接口
+ * @Author: jeecg-boot
+ * @Date: 2019-07-25
+ * @Version: V1.0
+ */
+@Slf4j
+@Service
+public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMapper, KuaiShouVideoGet> implements IKuaiShouVideoGetService {
+    @Autowired
+    private KuaiShouVideoGetMapper videoGetMapper;
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(15);
+
+
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+    @Override
+    public void replaceBatch(List<KuaiShouVideoGet> videoGets) {
+        videoGetMapper.replaceBatch(videoGets);
+    }
+
+    /**
+     * 获取关键帧
+     *
+     * @param
+     */
+    @Override
+    public synchronized void getKeyFrame(String token, Long accountId, String videoMd5, String photoId) {
+        try {
+            if (Check.isNull(videoMd5)) {
+                return;
+            }
+            QueryWrapper<MaterialCutFrame> cutFrameQueryWrapper = new QueryWrapper<>();
+            cutFrameQueryWrapper.eq("video_signature", videoMd5);
+            cutFrameQueryWrapper.last("limit 1");
+            MaterialCutFrame one = materialCutFrameService.getOne(cutFrameQueryWrapper);
+            if (!Check.isNull(one)) {
+                return;
+            }
+            log.info("开始视频抽帧,md5:{}", videoMd5);
+            String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/key_frame";
+            JSONArray photoArr = new JSONArray();
+            photoArr.add(photoId);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", token);
+            headers.put("Content-Type", "application/json");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", accountId);
+            requestJson.put("photo_ids", photoArr);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONArray dataArr = resultJson.getJSONArray("data");
+                    if (!Check.isNull(dataArr)) {
+                        for (int i = 0; i < dataArr.size(); i++) {
+                            String imageUrl = dataArr.getString(i);
+                            String localPath = LoadFileUtil.downLoadFromUrl(imageUrl, downloadUrl);
+                            String md5 = null;
+                            try {
+                                md5 = LoadFileUtil.getMD5(localPath);
+                            } catch (IOException e) {
+                                e.printStackTrace();
+                                continue;
+                            }
+                            Map<String, Object> deleteMap = new HashMap<>();
+                            deleteMap.put("video_signature", videoMd5);
+                            deleteMap.put("signature", md5);
+                            materialCutFrameService.removeByMap(deleteMap);
+                            MaterialCutFrame materialCutFrame = new MaterialCutFrame();
+                            materialCutFrame.setImageIndex(i);
+                            materialCutFrame.setVideoSignature(videoMd5);
+                            materialCutFrame.setUrl(imageUrl);
+                            materialCutFrame.setSignature(md5);
+                            materialCutFrameService.save(materialCutFrame);
+                            LoadFileUtil.delFile(localPath);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Override
+    public List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap) {
+        return videoGetMapper.getVideoList(requestMap);
+    }
+}

Fichier diff supprimé car celui-ci est trop grand
+ 2208 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouInterfaceServiceImpl.java


+ 250 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouProgramCreativeServiceImpl.java

@@ -0,0 +1,250 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
+import com.xxl.job.executor.batch.entity.KuaishouProgramCreative;
+import com.xxl.job.executor.batch.mapper.KuaishouProgramCreativeMapper;
+import com.xxl.job.executor.batch.service.IKuaiShouImageGetService;
+import com.xxl.job.executor.batch.service.IKuaiShouMaterialUploadService;
+import com.xxl.job.executor.batch.service.IKuaishouProgramCreativeService;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.service.IMaterialCutFrameService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import lombok.var;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-程序化创意
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-22
+ */
+@Service
+@Slf4j
+public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProgramCreativeMapper, KuaishouProgramCreative> implements IKuaishouProgramCreativeService {
+
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
+
+
+    @Override
+    public void getProgramCreative(Long accountId, Long unitId, String accessToken, String startDate, String endDate, Integer page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", accessToken);
+        Map<String, Object> param = new HashMap<>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", startDate);
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", endDate);
+        }
+
+        if (!Check.isNull(unitId)) {
+            JSONArray array = new JSONArray();
+            array.add(unitId);
+            param.put("unit_ids", array);
+        }
+
+
+        param.put("advertiser_id", accountId);
+        param.put("page_size", 500);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手广程序化创意异常:{},accountId:{}", message, accountId);
+            return;
+        }
+        JSONObject dataJson = resultJson.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            log.error("获取快手广程序化创意返回data为空,accountId:{}", accountId);
+            return;
+        }
+        JSONArray details = dataJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+
+        List<KuaishouProgramCreative> programCreativeList = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = details.getJSONObject(i);
+            if (!Check.isNull(detailJson)) {
+                detailJson.put("creative_create_time", detailJson.getDate("create_time"));
+                detailJson.put("creative_update_time", detailJson.getDate("update_time"));
+                var programCreative = JSONObject.toJavaObject(detailJson, KuaishouProgramCreative.class);
+                programCreative.setAccountId(accountId);
+                programCreative.setId(accountId + "_" + programCreative.getUnitId());
+                programCreativeList.add(programCreative);
+
+            }
+        }
+
+        this.saveOrUpdateBatch(programCreativeList);
+    }
+
+    /**
+     * 创建程序化2.0
+     *
+     * @param oauthToken
+     * @param requestJson
+     * @return
+     */
+
+    @Override
+    public JSONObject createProgramCreative(CtopOauthToken oauthToken, JSONObject requestJson) {
+
+        JSONObject returnJson = new JSONObject();
+        try {
+
+
+            JSONObject pramsJson = new JSONObject();
+            pramsJson.put("advertiser_id", oauthToken.getAccountId());
+            pramsJson.put("unit_id", requestJson.getLong("unitId"));
+            pramsJson.put("package_name", requestJson.getString("packageName"));
+            pramsJson.put("horizontal_photo_ids", requestJson.getJSONArray("horizontalPhotoIds"));
+            pramsJson.put("vertical_photo_ids", requestJson.getJSONArray("verticalPhotoIds"));
+            pramsJson.put("cover_image_tokens", requestJson.getJSONArray("coverImageTokens"));
+            if (!Check.isNull(requestJson.getLong("siteId"))) {
+                pramsJson.put("site_id", requestJson.getLong("siteId"));
+            }
+
+            if (!Check.isNull(requestJson.getJSONArray("stickerStyles"))) {
+                pramsJson.put("sticker_styles", requestJson.getJSONArray("stickerStyles"));
+            }
+
+            if (!Check.isNull(requestJson.getJSONArray("coverSlogans"))) {
+                pramsJson.put("cover_slogans", requestJson.getJSONArray("coverSlogans"));
+            }
+
+            Integer creativeCategory = requestJson.getInteger("creativeCategory");
+            JSONArray creativeTag = requestJson.getJSONArray("creativeTag");
+
+            if (!Check.isNull(creativeCategory) && !Check.isNull(creativeTag)) {
+                pramsJson.put("creative_category", creativeCategory);
+                pramsJson.put("creative_tag", creativeTag);
+            }
+            pramsJson.put("action_bar", requestJson.getString("actionBarText"));
+            pramsJson.put("captions", requestJson.getJSONArray("captions"));
+            if (!Check.isNull(requestJson.getString("clickUrl"))) {
+                pramsJson.put("click_url", requestJson.getString("clickUrl"));
+            }
+            if (!Check.isNull(requestJson.getString("actionbarClickUrl"))) {
+                pramsJson.put("actionbar_click_url", requestJson.getString("actionbarClickUrl"));
+            }
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", "application/json");
+            headers.put("Access-Token", oauthToken.getAccessToken());
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_CREATE;
+            JSONArray coverImageTokens = requestJson.getJSONArray("coverImageTokens");
+            JSONArray cover_image_tokens = new JSONArray();
+            requestJson.remove(coverImageTokens);
+            if (!Check.isNull(coverImageTokens)) {
+
+                for (int i = 0; i < coverImageTokens.size(); i++) {
+                    String signature = coverImageTokens.getString(i);
+                    if (Check.isNull(signature)) {
+                        continue;
+                    }
+                    String imageToken = null;
+
+                    if (!Check.isNull(signature)) {
+                        QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
+                        queryWrapper.eq("account_id", oauthToken.getAccountId());
+                        queryWrapper.eq("signature", signature);
+                        queryWrapper.last("limit 1");
+                        KuaiShouImageGet imageGet = imageGetService.getOne(queryWrapper);
+                        if (!Check.isNull(imageGet)) {
+                            imageToken = imageGet.getImageToken();
+                        } else {
+                            String imageUrl = imageGetService.getUrlByCode(signature);
+                            imageToken = uploadService.kuauiShouImageUpload(imageUrl, signature, oauthToken.getAccountId(), oauthToken.getAccessToken());
+                        }
+                        cover_image_tokens.add(imageToken);
+                    }
+
+
+                }
+
+
+            }
+
+            pramsJson.put("cover_image_tokens", cover_image_tokens);
+
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, pramsJson.toJSONString(), headers);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            log.info("创建程序化创意返回结果:{}", jsonObject);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    returnJson.put("isTrueOrFalse", true);
+                    returnJson.put("message", "创建成功");
+                } else {
+                    log.error("创建失败:入参:{}", pramsJson);
+                    returnJson.put("isTrueOrFalse", false);
+                    returnJson.put("message", jsonObject.getString("message"));
+                }
+
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("isTrueOrFalse", false);
+            returnJson.put("message", "系统错误");
+
+        }
+
+
+        return returnJson;
+    }
+
+    @Override
+    public JSONArray getProgramCreativeCover(JSONArray md5Arr) {
+
+        JSONArray returnArr = new JSONArray();
+        for (int i = 0; i < md5Arr.size(); i++) {
+            String signature = md5Arr.getString(i);
+            if (Check.isNull(signature)) {
+                continue;
+            }
+            List<JSONObject> coverArr = materialCutFrameService.getProgramCreativeCover(signature);
+            if (!Check.isNull(coverArr)) {
+                for (int j = 0; j < coverArr.size(); j++) {
+                    JSONObject jsonObject = JSONObject.parseObject(coverArr.get(j).toJSONString());
+                    if (!Check.isNull(jsonObject)) {
+                        returnArr.add(jsonObject);
+                    }
+                }
+
+            }
+
+        }
+        return returnArr;
+    }
+
+
+}

+ 110 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/batch/service/impl/KuaishouRealTimeDataServiceImpl.java

@@ -0,0 +1,110 @@
+package com.xxl.job.executor.batch.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.executor.batch.service.IKuaishouRealTimeDataService;
+import com.xxl.job.executor.constant.KuaishouInterfaceConstant;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class KuaishouRealTimeDataServiceImpl implements IKuaishouRealTimeDataService {
+    /**
+     * 获取计划实时数据
+     *
+     * @param accountId
+     * @param token
+     * @param campaignId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public JSONArray getCampaignDate(Long accountId, String token, Long campaignId, String startDate, String endDate) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        param.put("page_size", 2000);
+        param.put("page", 1);
+
+        JSONArray array = new JSONArray();
+        array.add(campaignId);
+        param.put("campaign_ids", array);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            System.err.println(result);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    JSONObject data = jsonObject.getJSONObject("data");
+                    if (!Check.isNull(data)) {
+                        return data.getJSONArray("details");
+                    }
+
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 获取组实时数据
+     *
+     * @param accountId
+     * @param token
+     * @param unitId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public JSONArray getUnitDate(Long accountId, String token, Long unitId, String startDate, String endDate) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        param.put("page_size", 2000);
+        param.put("page", 1);
+
+        JSONArray array = new JSONArray();
+        array.add(unitId);
+        param.put("unit_ids", array);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    JSONObject data = jsonObject.getJSONObject("data");
+                    if (!Check.isNull(data)) {
+                        return data.getJSONArray("details");
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 142 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/CtopOauthToken.java

@@ -0,0 +1,142 @@
+package com.xxl.job.executor.common.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @Description: oauth授权码
+ * @Author: jeecg-boot
+ * @Date: 2019-07-09
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_oauth_token")
+public class CtopOauthToken implements Serializable {
+
+    /**
+     * 主键ID
+     */
+    @TableId
+    private String id;
+    /**
+     * 媒体ID(外部广告平台类型,快手/头条/抖音等)
+     */
+    private String mediaId;
+    /**
+     * 广告主ID(自己平台用户内部id)
+     */
+    private String advertiserId;
+    /**
+     * 广告账户ID(相当于头条返回的access_token数据中的advertiser_id)
+     */
+    private Long accountId;
+    /**
+     * 访问令牌
+     */
+    private String accessToken;
+    /**
+     * 访问令牌有效期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date accessTokenExpiresIn;
+    /**
+     * 刷新令牌
+     */
+    private String refreshToken;
+
+
+    private Integer agentType;
+
+    /**
+     * 刷新令牌有效期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date refreshTokenExpiresIn;
+
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    public CtopOauthToken(String userId, JSONObject data) {
+        Long accountId = data.getLong("advertiser_id");
+        this.id = String.valueOf(accountId);
+        this.advertiserId = userId;
+        this.mediaId = "1";
+        this.accountId = accountId;
+        String accessToken = data.getString("access_token");
+        Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
+        Integer expiresIn = data.getInteger("expires_in");
+        String refreshToken = data.getString("refresh_token");
+        this.accessToken = accessToken;
+        this.refreshToken = refreshToken;
+        Date now = new Date();
+        this.accessTokenExpiresIn = addSecond(now, expiresIn);
+        this.refreshTokenExpiresIn = addSecond(now, refreshTokenExpiresIn);
+        this.createTime = now;
+        this.updateTime = now;
+    }
+
+    public CtopOauthToken() {
+    }
+
+    public CtopOauthToken(CtopOauthToken token, JSONObject data) {
+        this.advertiserId = token.getAdvertiserId();
+        this.mediaId = "1";
+        this.accountId = token.getAccountId();
+        String accessToken = data.getString("access_token");
+        Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
+        Integer expiresIn = data.getInteger("expires_in");
+        String refreshToken = data.getString("refresh_token");
+        this.accessToken = accessToken;
+        this.refreshToken = refreshToken;
+        Date now = new Date();
+        this.accessTokenExpiresIn = addSecond(now, expiresIn);
+        this.refreshTokenExpiresIn = addSecond(now, refreshTokenExpiresIn);
+        this.updateTime = now;
+    }
+
+    private static Date addSecond(Date date, int seconds) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.SECOND, seconds);
+        return calendar.getTime();
+    }
+
+    @Override
+    public String toString() {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return id +
+                "," + mediaId +
+                "," + advertiserId +
+                "," + accountId +
+                "," + accessToken +
+                "," + sdf.format(accessTokenExpiresIn) +
+                "," + refreshToken +
+                "," + sdf.format(refreshTokenExpiresIn) +
+                "," + sdf.format(createTime) +
+                "," + sdf.format(updateTime);
+    }
+}

+ 52 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialCutFrame.java

@@ -0,0 +1,52 @@
+package com.xxl.job.executor.common.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+@Data
+@TableName("ctop_material_cut_frame")
+public class MaterialCutFrame {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 素材库id
+     */
+    private String videoSignature;
+    /**
+     * url
+     */
+    private String url;
+    /**
+     * md5
+     */
+    private String signature;
+    /**
+     * 素材标
+     */
+    private Integer imageIndex;
+
+    /**
+     * createTime
+     */
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+}

+ 48 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialCutFrameTask.java

@@ -0,0 +1,48 @@
+package com.xxl.job.executor.common.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+@Data
+@TableName("ctop_material_cut_frame_task")
+public class MaterialCutFrameTask {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 视频md5
+     */
+    private String videoSignature;
+    /**
+     * jobId
+     */
+    private String jobId;
+    /**
+     * 任务状态 0 未执行 1 已完成
+     */
+    private Integer jobStatus;
+    /**
+     * createTime
+     */
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+
+    private Integer cloud_type;
+}

+ 157 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/MaterialInfo.java

@@ -0,0 +1,157 @@
+package com.xxl.job.executor.common.entity;
+
+import com.alibaba.fastjson.JSONObject;
+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 lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 素材信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-10-11
+ */
+@Data
+@TableName("ctop_material_info")
+public class MaterialInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * code
+     */
+    private String code;
+    private String watermarkCode;
+    /**
+     * url
+     */
+    private String url;
+    /**
+     * 封面url
+     */
+    private String coverUrl;
+
+    /**
+     * 水印素材链接
+     */
+    private String watermarkUrl;
+
+    private String type;
+    /**
+     * 审核人id
+     */
+    private String auditorId;
+    /**
+     * status
+     * <p>
+     * 0-待审核 1-审核通过 2-审核拒绝
+     */
+    private Integer status;
+    /**
+     * userId
+     */
+    private String userId;
+
+    private String materialDescribe;
+
+    private Long projectId;
+
+    /**
+     * 素材名称
+     */
+    private String materialName;
+
+    /**
+     * 水印素材名称
+     */
+    private String watermarkMaterialName;
+
+    /**
+     * 拒绝原因
+     */
+    private String refuseReason;
+    /**
+     * 拒绝上传文件
+     */
+    private String refuseFile;
+
+    /**
+     * 创意文案
+     */
+    private String creativeCopywriter;
+
+    /**
+     * 是否优秀素材
+     */
+    private Integer excellent;
+    /**
+     * createTime
+     */
+    private Object createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+
+    private Integer toutiaoEffiType; //判断是否为头条有效素材0否_1是
+
+    private Integer kuaishouEffiType; //判断是否为快手有效素材0否_1是
+
+    @TableField(exist = false)
+    private Integer kuaishouVideoIsUp;  //判断是否已经同步到快手平台0否_1是
+
+    @TableField(exist = false)
+    private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
+
+    @TableField(exist = false)
+    private JSONObject byteDance;
+
+    @TableField(exist = false)
+    private JSONObject kuaiShou;
+
+    @TableField(exist = false)
+    private String videoRoleCode;  //拍摄时候担任的角色
+
+    @TableField(exist = false)
+    private String originRoleName;  //原本的角色
+
+    @TableField(exist = false)
+    private BigDecimal cost;
+
+    @TableField(exist = false)
+    private BigDecimal bytedanceCost;
+
+    @TableField(exist = false)
+    private String realname;
+
+    @TableField(exist = false)
+    private Boolean whetherUnaudited;  // 是否有未审核封面
+
+
+    @TableField(exist = false)
+    private String mediaId;  // 是否有未审核封面
+
+    @TableField(exist = false)
+    private String projectName;  // 是否有未审核封面
+
+
+    private String supplierCode; // 素造供应商
+
+
+    @TableField(exist = false)
+    private String startDate;  // 是否有未审核封面
+
+    @TableField(exist = false)
+    private String endDate;  // 是否有未审核封面
+
+
+}

+ 74 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/OauthAgentToken.java

@@ -0,0 +1,74 @@
+package com.xxl.job.executor.common.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 代理商token
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-18
+ */
+@Data
+@TableName("ctop_oauth_agent_token")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class OauthAgentToken {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * 媒体ID(外部广告平台类型,快手/头条/抖音等)
+     */
+    private String mediaId;
+
+    private Long agentId;
+    /**
+     * 访问令牌
+     */
+    private String accessToken;
+    /**
+     * 访问令牌有效期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date accessTokenExpiresIn;
+    /**
+     * 刷新令牌
+     */
+    private String refreshToken;
+    /**
+     * 刷新令牌有效期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date refreshTokenExpiresIn;
+    /**
+     * 代理商类型 0:三方代理商 1:本代理商
+     */
+    private Integer agentType;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+}

+ 115 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/entity/UserAllocation.java

@@ -0,0 +1,115 @@
+package com.xxl.job.executor.common.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 用户分配
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-08-08
+ */
+@Data
+@TableName("ctop_user_allocation")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UserAllocation implements Serializable {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 登陆人id
+     */
+    private String userId;
+
+    private String userName;
+
+    /**
+     * 账户id --授权
+     */
+    private Long accountId;
+    /**
+     * 广告主ID
+     */
+    private String advertiserId;
+
+    private String systemType;
+
+    /**
+     * 项目id
+     */
+    private Long projectId;
+
+    /**
+     * 输入账号  --登陆
+     */
+    private String accountName;
+
+    /**
+     * 预警 金额
+     */
+    private BigDecimal warningAmount;
+
+    /**
+     * 预警 比例
+     */
+    private BigDecimal warningProportion;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /**
+     * 授权名称
+     */
+    private String authName;
+
+
+    /**
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer accountStatus;
+
+    /**
+     * 检测链接预警
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer monitoringLink;
+
+    /**
+     * 检测链接预警
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer landingPage;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+    /**
+     * 平台类型 1 头条 2快手
+     */
+    private String mediaId;
+}

+ 59 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/CtopOauthTokenMapper.java

@@ -0,0 +1,59 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: oauth授权码
+ * @Author: jeecg-boot
+ * @Date: 2019-07-09
+ * @Version: V1.0
+ */
+public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
+    /**
+     * 更新
+     *
+     * @param oauthToken
+     * @return
+     */
+    int updateByPrimaryKeySelective(CtopOauthToken oauthToken);
+
+    /**
+     * 根据accountId查询
+     *
+     * @param accountId
+     * @return
+     */
+    CtopOauthToken selectByAccountId(Long accountId);
+
+    List<CtopOauthToken> selectKuaiShouToken();
+
+    List<CtopOauthToken> selectKuaiShouTokenBefore();
+
+    List<CtopOauthToken> selectToutiaoToken();
+
+    CtopOauthToken getAccessTokenByAccountIdAndMediaId(@Param("mediaId") Integer mediaId, @Param("accountId") Long accountId);
+
+    List<CtopOauthToken> getToutiaoTokenByCreateTime(@Param("createTime") String createTime);
+
+    /**
+     * 查询头条token
+     *
+     * @param platformTypeByteDance
+     * @return
+     */
+    List<CtopOauthToken> selectByteDanceTokens(@Param("mediaId") String platformTypeByteDance);
+
+
+    /**
+     * 查询头条token
+     *
+     * @param platformTypeByteDance
+     * @return
+     */
+    List<CtopOauthToken> selectKuaiShouTokens(@Param("mediaId") String platformTypeByteDance);
+
+}

+ 23 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialCutFrameMapper.java

@@ -0,0 +1,23 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.MaterialCutFrame;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 截屏
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-25
+ * @cersion: V1.0
+ */
+public interface MaterialCutFrameMapper extends BaseMapper<MaterialCutFrame> {
+
+    List<MaterialCutFrame> getListByVideoSignature(@Param(value = "videoSignature") String signature);
+
+    List<JSONObject> getProgramCreativeCover(@Param("signature") String signature);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialCutFrameTaskMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.MaterialCutFrameTask;
+
+/**
+ * 截帧 任务表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-06-01
+ * @cersion: V1.0
+ */
+public interface MaterialCutFrameTaskMapper extends BaseMapper<MaterialCutFrameTask> {
+
+}

+ 36 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/MaterialInfoMapper.java

@@ -0,0 +1,36 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.MaterialInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-10-11
+ * @cersion: V1.0
+ */
+public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
+
+    String selectUserNameById(@Param("auditorId") String auditorId);
+
+    Integer selectCountByMap(Map<String, Object> requestMap);
+
+    Integer getKuaishouUpVideoCount(@Param("code") String code);
+
+    Integer getToutiaoUpVideoCount(@Param("code") String code);
+
+    List<String> getEffiSignature();
+
+    MaterialInfo getMaterialInfoByCode(@Param("code") String code);
+
+    Long getProjectIdByAccountId(@Param("accountId") Long accountId);
+
+    List<MaterialInfo> getListByDate(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<MaterialInfo> getListByParams(@Param("tagCode") String tagCode, @Param("type") String type, @Param("status") Integer status, @Param("projectIds") List<Long> projectIds, @Param("materialName") String materialName, @Param("code") String code, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userId") String userId);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/OauthAgentTokenMapper.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.OauthAgentToken;
+
+/**
+ * 代理商token
+ *
+ * @author: jeecg-boot
+ * @date: 2020-08-18
+ * @cersion: V1.0
+ */
+public interface OauthAgentTokenMapper extends BaseMapper<OauthAgentToken> {
+
+}

+ 32 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/UserAllocationMapper.java

@@ -0,0 +1,32 @@
+package com.xxl.job.executor.common.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.common.entity.UserAllocation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-08-08
+ * @Version: V1.0
+ */
+public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
+    List<UserAllocation> selectAccountListByProjectId(@Param("projectId") Long projectId);
+
+    String queryAdvertiserId(@Param("accountId") Long accountId);
+
+    String queryUserIdByAccountId(@Param("accountId") Long accountId);
+
+    List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(@Param("userId") Long userId);
+
+    Long getProjectIdByAccountId(@Param("accountId") Long accountId);
+
+    UserAllocation getUserAllocation(@Param("accountId") Long accountId);
+}

+ 138 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/CtopOauthTokenMapper.xml

@@ -0,0 +1,138 @@
+<?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="com.xxl.job.executor.common.mapper.CtopOauthTokenMapper">
+
+    <resultMap id="BaseResultMap" type="com.xxl.job.executor.common.entity.CtopOauthToken">
+        <result column="id" property="id" jdbcType="BIGINT"/>
+        <result column="media_id" property="mediaId" jdbcType="VARCHAR"/>
+        <result column="advertiser_id" property="advertiserId" jdbcType="VARCHAR"/>
+        <result column="account_id" property="accountId" jdbcType="BIGINT"/>
+        <result column="access_token" property="accessToken" jdbcType="VARCHAR"/>
+        <result column="refresh_token" property="refreshToken" jdbcType="VARCHAR"/>
+        <result column="access_token_expires_in" property="accessTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="refresh_token_expires_in" property="refreshTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="agent_type" property="agentType" jdbcType="INTEGER"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,media_id,advertiser_id,account_id,access_token,refresh_token,access_token_expires_in,refresh_token_expires_in,agent_type,create_time,update_time
+   </sql>
+
+    <select id="selectByteDanceTokens" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+        where media_id = #{mediaId}
+        group by access_token
+    </select>
+
+    <select id="selectKuaiShouTokens" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+        where media_id = #{mediaId}
+        group by account_id
+    </select>
+
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.xxl.job.executor.common.entity.CtopOauthToken">
+        update ctop_oauth_token
+        <set>
+
+            <if test="mediaId != null">
+                media_id = #{mediaId},
+            </if>
+
+            <if test="advertiserId != null">
+                advertiser_id = #{advertiserId},
+            </if>
+
+            <if test="accessToken != null">
+                access_token = #{accessToken},
+            </if>
+
+            <if test="accessTokenExpiresIn != null">
+                access_token_expires_in = #{accessTokenExpiresIn},
+            </if>
+
+            <if test="refreshToken != null">
+                refresh_token = #{refreshToken,jdbcType=VARCHAR},
+            </if>
+
+            <if test="refreshTokenExpiresIn != null">
+                refresh_token_expires_in = #{refreshTokenExpiresIn},
+            </if>
+
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+        </set>
+        where account_id = #{accountId}
+    </update>
+
+    <select id="selectByAccountId" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+        where account_id = #{accountId}
+        order by create_time desc
+        limit 1
+    </select>
+
+
+    <select id="selectKuaiShouToken" resultType="com.xxl.job.executor.common.entity.CtopOauthToken">
+        select  t1.*
+        from ctop_oauth_token t1
+        left join ctop_user_allocation t2
+        on t1.account_id = t2.account_id
+        where t2.account_status = 0
+        and t1.media_id = 2
+
+    </select>
+
+    <select id="selectKuaiShouTokenBefore" resultType="com.xxl.job.executor.common.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="com.xxl.job.executor.common.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 in (1,3) and t2.account_status = 0
+        group by account_id
+    </select>
+
+    <select id="getAccessTokenByAccountIdAndMediaId" resultType="com.xxl.job.executor.common.entity.CtopOauthToken">
+        select
+        *
+        from
+        ctop_oauth_token
+        where media_id = #{mediaId}
+        and account_id = #{accountId}
+    </select>
+
+    <!-- 根据mediaType 和 账户绑定助手时间createTime 获取accountId -->
+    <select id="getToutiaoTokenByCreateTime" resultType="com.xxl.job.executor.common.entity.CtopOauthToken">
+            select t1.*
+        from ctop_oauth_token t1
+        left join ctop_user_allocation t2
+        on t1.account_id = t2.account_id
+        where t2.account_status = 0
+        and t1.media_id in (1,3)
+        and date_format(t2.create_time, '%Y-%m-%d') = #{createTime}
+        group by account_id
+    </select>
+
+</mapper>

+ 37 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialCutFrameMapper.xml

@@ -0,0 +1,37 @@
+<?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="com.xxl.job.executor.common.mapper.MaterialCutFrameMapper">
+
+    <select id="getListByVideoSignature" resultType="com.xxl.job.executor.common.entity.MaterialCutFrame">
+        select a.signature,
+       (select frame.url
+        from ctop_material_cut_frame frame
+        where frame.signature = a.signature
+        order by id desc
+        limit 1) as 'url',
+       (select frame.image_index
+        from ctop_material_cut_frame frame
+        where frame.signature = a.signature
+        order by id desc
+        limit 1) as 'image_index',
+       (select frame.id
+        from ctop_material_cut_frame frame
+        where frame.signature = a.signature
+        order by id desc
+        limit 1) as 'id'
+       from (select distinct signature
+      from ctop_material_cut_frame
+      where video_signature = #{videoSignature}) a;
+    </select>
+
+
+    <select id="getProgramCreativeCover" resultType="com.alibaba.fastjson.JSONObject">
+      SELECT
+      signature as 'signature',
+      url as 'url'
+      FROM ctop_material_cut_frame
+      WHERE video_signature = #{signature}
+      ORDER BY RAND() LIMIT 5;
+    </select>
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialCutFrameTaskMapper.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="com.xxl.job.executor.common.mapper.MaterialCutFrameTaskMapper">
+
+</mapper>

+ 139 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/MaterialInfoMapper.xml

@@ -0,0 +1,139 @@
+<?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="com.xxl.job.executor.common.mapper.MaterialInfoMapper">
+
+
+    <select id="getProjectIdByAccountId" resultType="java.lang.Long">
+
+       select
+       project_id
+       from ctop_user_allocation
+       where  account_id = #{accountId}
+
+    </select>
+
+    <select id="selectUserNameById" resultType="java.lang.String">
+   select realname from  sys_user where  id = #{auditorId}
+    </select>
+
+
+    <select id="selectCountByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
+
+        select count(1)
+        from ctop_material_info
+        where 1 = 1
+        <if test="userId != null">
+            and user_id = #{userId}
+        </if>
+
+        <if test="status != null">
+            and status = #{status}
+        </if>
+
+
+    </select>
+
+    <select id="getKuaishouUpVideoCount" resultType="java.lang.Integer">
+        select
+        count(1)
+        from
+        ctop_kuaishou_video_get v
+        where
+        v.signature = #{code}
+    </select>
+
+    <select id="getToutiaoUpVideoCount" resultType="java.lang.Integer">
+        select
+        count(1)
+        from
+        ctop_bytedance_video_info v
+        where
+        v.signature = #{code}
+    </select>
+
+
+
+    <select id="getEffiSignature" resultType="string">
+        select
+        efficient_video_signature
+        from ctop_user_efficient_video_map
+        where company_id is not null
+        group by efficient_video_signature
+
+    </select>
+
+    <select id="getMaterialInfoByCode" resultType="com.xxl.job.executor.common.entity.MaterialInfo">
+            select
+            id,
+            code,
+            url,
+            watermark_code as watermarkCode,
+            material_name as materialName,
+            watermark_url as watermarkUrl,
+            watermark_material_name as watermarkMaterialName,
+            user_id as userId,
+            auditor_id as auditorId,
+            status as status,
+            material_describe as materialDescribe,
+            project_id as projectId,
+            refuse_reason as refuseReason,
+            creative_copywriter as creativeCopywriter,
+            refuse_file as refuseFile,
+            excellent,
+            type
+        from
+        ctop_material_info
+        where code = #{code}
+        limit 1
+    </select>
+
+    <select id="getListByParams" resultType="com.xxl.job.executor.common.entity.MaterialInfo">
+        select
+        distinct matInfo.code,
+        matInfo.project_id,
+        matInfo.id
+        from ctop_material_info matInfo
+        <if test="tagCode!=null">
+            left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
+        </if>
+        where 1=1
+        <if test="tagCode!=null">
+            and tagInfo.tag_code like concat(#{tagCode},'%')
+        </if>
+        <if test="status!=null">
+            and matInfo.status = #{status}
+        </if>
+        <if test="userId!=null">
+            and matInfo.user_id = #{userId}
+        </if>
+        <if test="code!=null">
+            and matInfo.code = #{code}
+        </if>
+        <if test="materialName!=null">
+            and matInfo.material_name like concat('%',#{materialName},'%')
+        </if>
+        <if test="projectIds!=null">
+            and matInfo.project_id in
+            <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate!=null">
+            and matInfo.create_time &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and matInfo.create_time &lt;= #{endDate}
+        </if>
+        order by matInfo.create_time desc
+
+    </select>
+    <select id="getListByDate" resultType="com.xxl.job.executor.common.entity.MaterialInfo">
+        select  *  from
+        ctop_material_info
+        where  1 = 1
+        and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
+
+</mapper>

+ 5 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/OauthAgentTokenMapper.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="com.xxl.job.executor.common.mapper.OauthAgentTokenMapper">
+
+</mapper>

+ 79 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/mapper/xml/UserAllocationMapper.xml

@@ -0,0 +1,79 @@
+<?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="com.xxl.job.executor.common.mapper.UserAllocationMapper">
+
+    <select id="selectAccountListByProjectId" resultType="com.xxl.job.executor.common.entity.UserAllocation">
+        select
+        a.user_id as userId,
+        a.user_name as userName,
+        a.auth_name as authName,
+        a.account_id as accountId
+        from
+        ctop_user_allocation a
+        left join ctop_project b on a.project_id = b.id
+        where b.id = #{projectId}
+    </select>
+
+    <select id="queryAdvertiserId" resultType="String">
+        select
+            distinct advertiser_id
+        from
+            ctop_user_allocation
+        where account_id=#{accountId}
+    </select>
+    <select id="queryUserIdByAccountId" resultType="String">
+        select
+            distinct user_id
+        from
+            ctop_user_allocation
+        where account_id=#{accountId}
+    </select>
+
+    <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
+       select
+       account_id as 'accountId',
+       user_name as 'userName',
+       auth_name as 'authName'
+       from ctop_user_allocation
+       where project_id = #{projectId}
+       order by create_time desc
+    </select>
+
+    <select id="getUserIdListByProjectId" resultType="com.alibaba.fastjson.JSONObject">
+   SELECT t1.user_id as 'userId',
+    t1.account_id as 'accountId',
+    t1.user_name  as 'userName'
+    from  ctop_kuaishou_advertiser_base_info t1  LEFT JOIN
+    ctop_user_allocation  t2
+    ON t1.account_id = t2.account_id
+    WHERE t2.project_id = #{projectId}
+    GROUP BY t1.user_id;
+    </select>
+
+
+    <select id="getAccountIdListByUserId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+    t1.account_id as 'accountId',
+    t1.auth_name  as 'authName',
+    t1.user_name as 'userName'
+    from ctop_user_allocation   t1  LEFT JOIN
+    ctop_kuaishou_advertiser_base_info t2
+    ON t1.account_id = t2.account_id
+    WHERE t2.user_id = #{userId}
+    AND t1.account_status = 0
+    </select>
+
+    <select id="getProjectIdByAccountId" resultType="java.lang.Long">
+    select  project_id  from  ctop_user_allocation
+    where account_id = #{accountId}
+    limit 1
+    </select>
+
+    <select id="getUserAllocation" resultType="com.xxl.job.executor.common.entity.UserAllocation">
+    select  *  from  ctop_user_allocation
+    where account_id=#{accountId}
+    limit 1
+    </select>
+
+
+</mapper>

+ 42 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/ICtopOauthTokenService.java

@@ -0,0 +1,42 @@
+package com.xxl.job.executor.common.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: oauth授权码
+ * @Author: jeecg-boot
+ * @Date: 2019-07-09
+ * @Version: V1.0
+ */
+public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
+
+    CtopOauthToken getOauthTokenByAccountId(String accountId);
+
+    CtopOauthToken getTokenByAccountId(Long accountId);
+
+    Map<String, Object> getByteDanceAccessToken(CtopOauthToken token);
+
+    void getKuaiShouRefreshToken(Long accountId, String token, String refreshToken, Integer agentType);
+
+    List<CtopOauthToken> getTokenListByType(String platformTypeBytedance);
+
+    List<CtopOauthToken> selectKuaiShouToken();
+
+    List<CtopOauthToken> selectKuaiShouTokenBefore();
+
+    List<CtopOauthToken> selectToutiaoToken();
+
+    CtopOauthToken getAccessTokenByAccountIdAndMediaId(Integer mediaId, Long accountId);
+
+    List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime);
+
+    List<CtopOauthToken> getByProjectId(Long projectId);
+
+    CtopOauthToken selectOneByMediaId(String platformTypeKuaishou);
+
+    void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken);
+}

+ 32 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IMaterialCutFrameService.java

@@ -0,0 +1,32 @@
+package com.xxl.job.executor.common.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.common.entity.MaterialCutFrame;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+public interface IMaterialCutFrameService extends IService<MaterialCutFrame> {
+
+    List<MaterialCutFrame> getListByVideoSignature(String signature);
+
+    void getCosCutFrame(String url, String materialId) throws IOException;  //腾讯云抽帧
+
+    void loadCosCutFrame(String jobId, String videoSignature);  //腾讯云抽帧任务状态查询以及数据入库
+
+    void getTencentCutFrame(String videoUrl, String materialId, String coveUrl);
+
+    boolean updateTencentCutFrame(String videoMD5);
+
+    MaterialCutFrame getCutFrameByCode(String code);
+
+    List<JSONObject> getProgramCreativeCover(String signature);
+}

+ 15 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IMaterialCutFrameTaskService.java

@@ -0,0 +1,15 @@
+package com.xxl.job.executor.common.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.common.entity.MaterialCutFrameTask;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+public interface IMaterialCutFrameTaskService extends IService<MaterialCutFrameTask> {
+
+}

+ 14 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IOauthAgentTokenService.java

@@ -0,0 +1,14 @@
+package com.xxl.job.executor.common.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.common.entity.OauthAgentToken;
+
+/**
+ * @Description: 代理商token
+ * @Author: jeecg-boot
+ * @Date: 2020-08-18
+ * @Version: V1.0
+ */
+public interface IOauthAgentTokenService extends IService<OauthAgentToken> {
+
+}

+ 9 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IRefreshTokenService.java

@@ -0,0 +1,9 @@
+package com.xxl.job.executor.common.service;
+
+public interface IRefreshTokenService {
+    void getKuaiShouRefresh();
+
+    void byteDanceRefresh(String accountId);
+
+    void getKuaiShouAgentRefresh();
+}

+ 37 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/IUserAllocationService.java

@@ -0,0 +1,37 @@
+package com.xxl.job.executor.common.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.common.entity.UserAllocation;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-08-08
+ * @Version: V1.0
+ */
+public interface IUserAllocationService extends IService<UserAllocation> {
+
+    UserAllocation getByAccountId(Long accountId);
+
+    List<UserAllocation> getByParams(Long projectId, String systemType, Integer accountStatus);
+
+    Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data);
+
+    Map<String, Object> getPangolinProjectListByParams(String userId);
+
+    List<UserAllocation> getByMediaId(String mediaId);
+
+    String getAdvertiserIdByAccountId(Long accountId);
+
+    List<JSONObject> getAccountListByProject(Long projectId);
+
+    List<JSONObject> getUserIdListByProjectId(Long projectId);
+
+    List<JSONObject> getAccountIdListByUserId(Long userId);
+
+    List<UserAllocation> getUserAllocations(String mediaId, int switchType);
+}

+ 296 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/CtopOauthTokenServiceImpl.java

@@ -0,0 +1,296 @@
+package com.xxl.job.executor.common.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.entity.OauthAgentToken;
+import com.xxl.job.executor.common.mapper.CtopOauthTokenMapper;
+import com.xxl.job.executor.common.mapper.OauthAgentTokenMapper;
+import com.xxl.job.executor.common.service.ICtopOauthTokenService;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.HttpUtils;
+import com.xxl.job.executor.utils.PropertiesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @Description: oauth授权码
+ * @Author: jeecg-boot
+ * @Date: 2019-07-09
+ * @Version: V1.0
+ */
+@Slf4j
+@Service
+public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper, CtopOauthToken> implements ICtopOauthTokenService {
+    @Autowired
+    private CtopOauthTokenMapper ctopOauthTokenMapper;
+    @Autowired
+    private OauthAgentTokenMapper agentTokenMapper;
+
+    @Override
+    public CtopOauthToken getOauthTokenByAccountId(String accountId) {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+
+    @Override
+    public CtopOauthToken getTokenByAccountId(Long accountId) {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+    /**
+     * 刷新token
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> getByteDanceAccessToken(CtopOauthToken token) {
+        Map<String, Object> resultMap = new HashMap<>();
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + "/oauth2/refresh_token";
+        Map<String, Object> param = new HashMap<>();
+        param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
+        param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
+        param.put("grant_type", "refresh_token");
+        param.put("refresh_token", token.getRefreshToken());
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        System.err.println(JSONObject.parseObject(result));
+        XxlJobHelper.log("头条刷新token;accountId:{},返回信息:{}", token.getAccountId(), result);
+        if (null == result || "".equals(result.trim()) || "null".equalsIgnoreCase(result)) {
+            XxlJobHelper.log("头条刷新token失败;accountId:{},返回信息:{}", token.getAccountId(), result);
+            resultMap.put("message", "token刷新失败");
+            resultMap.put("token", token);
+            resultMap.put("code", 0);
+            return resultMap;
+        }
+        JSONObject resultObject = JSONObject.parseObject(result);
+        Integer code = resultObject.getInteger("code");
+        String message = resultObject.getString("message");
+        if (code == 0) {
+            JSONObject data = resultObject.getJSONObject("data");
+            CtopOauthToken updateRefreshToken = new CtopOauthToken();
+            updateRefreshToken.setAccessToken(data.getString("access_token"));
+            updateRefreshToken.setRefreshToken(data.getString("refresh_token"));
+            Date now = new Date();
+            Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
+            Integer expiresIn = data.getInteger("expires_in");
+            updateRefreshToken.setRefreshTokenExpiresIn(addSecond(now, refreshTokenExpiresIn));
+            updateRefreshToken.setAccessTokenExpiresIn(addSecond(now, expiresIn));
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("access_token", token.getAccessToken());
+            queryWrapper.eq("media_id", 1);
+            int i = ctopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
+            if (i > 0) {
+                XxlJobHelper.log("头条刷新token成功:accountId:{}", token.getAccountId());
+            }
+            resultMap.put("message", "token刷新成功");
+            resultMap.put("code", 0);
+        } else {
+            XxlJobHelper.log("头条刷新token失败;accountId:{},返回信息:{}", token.getAccountId(), message);
+            resultMap.put("message", message);
+            resultMap.put("token", token);
+            resultMap.put("code", 0);
+        }
+        return resultMap;
+    }
+
+    /**
+     * 快手 刷新token
+     *
+     * @param accountId
+     * @param refreshToken
+     * @return
+     */
+    @Override
+    public void getKuaiShouRefreshToken(Long accountId, String token, String refreshToken, Integer agentType) {
+        log.info("快手刷新token入参,accountId:{},token:{},refreshToken:{}", accountId, token, refreshToken);
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + "/rest/openapi/oauth2/authorize/refresh_token";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        Map<String, Object> param = new HashMap<>();
+        if (agentType == 1) {
+            param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
+            param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+        } else if (agentType == 0) {
+            param.put("app_id", PropertiesUtils.getConfig("kuaishou_third_appid"));
+            param.put("secret", PropertiesUtils.getConfig("kuaishou_third_secret"));
+        }
+
+        param.put("refresh_token", refreshToken);
+        try {
+            CtopOauthToken oauthToken = ctopOauthTokenMapper.selectByAccountId(accountId);
+            if (null == oauthToken) {
+                log.error("查询token信息返回结果为空,accountId:{}", accountId);
+                return;
+            }
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            log.info("快手刷新token返回结果:{}", refreshToken);
+            if (Check.isNull(resultJson)) {
+                log.error("快手刷新token返回结果为空,accountId:{}", accountId);
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            if (null == code || code != 0) {
+                log.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
+                return;
+            }
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (null == dataJson) {
+                log.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
+                return;
+            }
+            oauthToken.setAccessToken(dataJson.getString("access_token"));
+            long accessTokenExpireIn = dataJson.getLong("access_token_expires_in") * 1000L;
+            long now = System.currentTimeMillis();
+            Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
+            oauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
+            oauthToken.setRefreshToken(dataJson.getString("refresh_token"));
+            long refreshTokenExpireIn = dataJson.getLong("refresh_token_expires_in") * 1000L;
+            Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
+            oauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+            oauthToken.setUpdateTime(new Date());
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("media_id", 2);
+            int i = ctopOauthTokenMapper.update(oauthToken, queryWrapper);
+            if (i > 0) {
+                log.info("快手刷新token成功,accountId:{}", accountId);
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            log.error("快手刷新token失败,accountId{}", accountId);
+        }
+    }
+
+    @Override
+    public List<CtopOauthToken> getTokenListByType(String platformType) {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        if (null != platformType && !"".equals(platformType.trim())) {
+            queryWrapper.eq("media_id", platformType);
+        }
+        queryWrapper.orderByDesc("account_id");
+        return this.list(queryWrapper);
+    }
+
+    /**
+     * 获取快手有效账户列表
+     *
+     * @return
+     */
+
+    @Override
+    public List<CtopOauthToken> selectKuaiShouToken() {
+        return ctopOauthTokenMapper.selectKuaiShouToken();
+    }
+
+    @Override
+    public List<CtopOauthToken> selectKuaiShouTokenBefore() {
+        return ctopOauthTokenMapper.selectKuaiShouTokenBefore();
+    }
+
+    @Override
+    public List<CtopOauthToken> selectToutiaoToken() {
+        return ctopOauthTokenMapper.selectToutiaoToken();
+    }
+
+    @Override
+    public CtopOauthToken getAccessTokenByAccountIdAndMediaId(Integer mediaId, Long accountId) {
+        return ctopOauthTokenMapper.getAccessTokenByAccountIdAndMediaId(mediaId, accountId);
+    }
+
+    @Override
+    public List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime) {
+        return ctopOauthTokenMapper.getToutiaoTokenByCreateTime(createTime);
+    }
+
+    @Override
+    public List<CtopOauthToken> getByProjectId(Long projectId) {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", projectId).eq("account_status", 0);
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public CtopOauthToken selectOneByMediaId(String platformTypeKuaishou) {
+        QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+        tokenQueryWrapper.eq("media_id", platformTypeKuaishou);
+        tokenQueryWrapper.orderByDesc("create_time");
+        tokenQueryWrapper.last("limit 1");
+        return this.getOne(tokenQueryWrapper);
+    }
+
+    @Override
+    public void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken) {
+        log.info("快手刷新token入参,token:{},refreshToken:{}", accessToken, refreshToken);
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + "/rest/openapi/oauth2/authorize/refresh_token";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        Map<String, Object> param = new HashMap<>();
+
+        param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
+        param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+        param.put("refresh_token", refreshToken);
+        try {
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            log.info("快手刷新代理商token返回结果:{}", refreshToken);
+            if (Check.isNull(resultJson)) {
+                log.error("快手刷新代理商token返回结果为空,token:{}", accessToken);
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            if (null == code || code != 0) {
+                log.error("快手刷新代理商token失败,token:{},result:{}", accessToken, resultJson);
+                return;
+            }
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (null == dataJson) {
+                log.error("快手刷新代理商token失败,token:{},result:{}", accessToken, resultJson);
+                return;
+            }
+
+            QueryWrapper<OauthAgentToken> agentTokenQueryWrapper = new QueryWrapper<>();
+            agentTokenQueryWrapper.eq("agent_id", agentId);
+            OauthAgentToken updateAgentToken = new OauthAgentToken();
+            updateAgentToken.setAccessToken(dataJson.getString("access_token"));
+            updateAgentToken.setRefreshToken(dataJson.getString("refresh_token"));
+            long accessTokenExpireIn = dataJson.getLong("access_token_expires_in") * 1000L;
+            long now = System.currentTimeMillis();
+            Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
+            updateAgentToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
+            long refreshTokenExpireIn = dataJson.getLong("refresh_token_expires_in") * 1000L;
+            Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
+            updateAgentToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+            updateAgentToken.setUpdateTime(new Date());
+            int update = agentTokenMapper.update(updateAgentToken, agentTokenQueryWrapper);
+            if (update > 0) {
+                log.info("刷新代理商token完成");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            log.error("快手刷新代理商token失败,token{}", accessToken);
+        }
+
+
+    }
+
+    private Date addSecond(Date date, int seconds) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.SECOND, seconds);
+        return calendar.getTime();
+    }
+
+
+}

+ 260 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/MaterialCutFrameServiceImpl.java

@@ -0,0 +1,260 @@
+package com.xxl.job.executor.common.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.common.entity.MaterialCutFrame;
+import com.xxl.job.executor.common.entity.MaterialCutFrameTask;
+import com.xxl.job.executor.common.mapper.MaterialCutFrameMapper;
+import com.xxl.job.executor.common.service.IMaterialCutFrameService;
+import com.xxl.job.executor.common.service.IMaterialCutFrameTaskService;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.CloudVideoProcessUtil;
+import com.xxl.job.executor.utils.CosUtil;
+import com.xxl.job.executor.utils.LoadFileUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+@Slf4j
+@Service
+public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMapper, MaterialCutFrame> implements IMaterialCutFrameService {
+
+    private static String ossLocation = "oss-cn-beijing";
+    private static String ossBucket = "ctop-media";
+    private static String ossOutputObject = "output_{Count}.jpg";
+
+    @Value("${jeecg.path.image-upload}")
+    private String imageUpLoadPath;
+
+
+    @Autowired
+    private IMaterialCutFrameTaskService cutFrameTaskService;
+    @Autowired
+    private MaterialCutFrameMapper materialCutFrameMapper;
+
+    @Override
+    public List<MaterialCutFrame> getListByVideoSignature(String videoSignature) {
+        return materialCutFrameMapper.getListByVideoSignature(videoSignature);
+    }
+
+
+    //腾讯云抽帧
+    @Override
+    public void getCosCutFrame(String url, String materialId) throws IOException {
+        try {
+
+            QueryWrapper<MaterialCutFrameTask> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("video_signature", materialId);
+            queryWrapper.last("limit 1");
+            MaterialCutFrameTask checkCutFrame = cutFrameTaskService.getOne(queryWrapper);
+            if (!Check.isNull(checkCutFrame)) {
+                log.info("已存推荐封面");
+                return;
+            }
+
+            //抽帧ossOutputObject1
+            String ossOutputObject1 = "/cutFrame/" + materialId + "/_";
+            String replaceUrl = url.replace("https://" + CosUtil.bucket + ".cos.ap-chongqing.myqcloud.com", "");  //地址
+            String resp = CosUtil.processMedia(replaceUrl, ossOutputObject1);
+            JSONObject respJson = JSONObject.parseObject(resp);
+            String jobId = respJson.getString("TaskId"); //{"Response": {"TaskId": "2600000655-WorkflowTask-c0b385f27c4993437029b5da175542aet0","RequestId": "4c23ce23-087f-4d4b-b73b-907d77d6d78d" } }
+            MaterialCutFrameTask cutFrameTask = new MaterialCutFrameTask();
+            cutFrameTask.setJobStatus(0);
+            cutFrameTask.setJobId(jobId);
+            cutFrameTask.setCloud_type(2);
+            cutFrameTask.setVideoSignature(materialId);
+            cutFrameTaskService.save(cutFrameTask);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+    }
+
+
+    //抽帧任务状态查询,如果完成则把抽帧入库
+    @Override
+    public void loadCosCutFrame(String jobId, String videoSignature) {
+        try {
+            String resp = CosUtil.describeTaskDetail(jobId);
+            if (Check.isNull(resp)) {
+                return;
+            }
+
+            JSONObject respJson = JSONObject.parseObject(resp);
+            String status = respJson.getString("Status");
+
+            if (!"FINISH".equals(status)) {
+                return;
+            }
+
+
+            JSONArray resultSetArray = respJson.getJSONObject("WorkflowTask").getJSONArray("MediaProcessResultSet");
+            if (Check.isNull(resultSetArray)) {
+                return;
+            }
+            JSONObject resultSetObject = resultSetArray.getJSONObject(0);
+            if (Check.isNull(resultSetObject)) {
+                return;
+            }
+            JSONArray snapshotArray = resultSetObject.getJSONObject("SampleSnapshotTask").getJSONObject("Output").getJSONArray("ImagePathSet");
+
+            if (Check.isNull(snapshotArray)) {
+                return;
+            }
+
+            for (int i = 0; i < snapshotArray.size(); i++) {
+                String imagePath = snapshotArray.getString(i);
+                String urlStr = "https://" + CosUtil.bucket + ".cos.ap-chongqing.myqcloud.com" + imagePath;
+
+                //下载到本地获取图片md5
+                String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, imageUpLoadPath);
+                String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+
+                MaterialCutFrame cutFrame = new MaterialCutFrame();
+                cutFrame.setSignature(cutFrameMd5);
+                cutFrame.setUrl(urlStr);
+                cutFrame.setVideoSignature(videoSignature);
+                cutFrame.setImageIndex(i);
+                this.save(cutFrame);
+            }
+
+            QueryWrapper<MaterialCutFrameTask> updateQueryWrapper = new QueryWrapper<>();
+            updateQueryWrapper.eq("job_id", jobId);
+            updateQueryWrapper.eq("video_signature", videoSignature);
+            MaterialCutFrameTask updateTask = new MaterialCutFrameTask();
+            updateTask.setJobStatus(1);
+            cutFrameTaskService.update(updateTask, updateQueryWrapper);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+
+    }
+
+
+    @Override
+    public void getTencentCutFrame(String videoUrl, String materialId, String coveUrl) {
+        try {
+
+            if (Check.isNull(materialId)) {
+                return;
+            }
+            String loadImage = "cutFrame/" + materialId + "/${Number}.jpg";
+            QueryWrapper<MaterialCutFrame> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("video_signature", materialId);
+            queryWrapper.last("limit 1");
+            MaterialCutFrame checkMaterialCutFrame = this.getOne(queryWrapper);
+            if (!Check.isNull(checkMaterialCutFrame)) {
+                log.info("已存推荐封面");
+                return;
+            }
+            // 添加首帧
+            String coverCutFramePath = LoadFileUtil.downLoadFromUrl(coveUrl, imageUpLoadPath);
+            String CutFrameMd5 = LoadFileUtil.getMD5(coverCutFramePath);
+            MaterialCutFrame coveCutFrame = new MaterialCutFrame();
+            coveCutFrame.setSignature(CutFrameMd5);
+            coveCutFrame.setUrl(coveUrl);
+            coveCutFrame.setVideoSignature(materialId);
+            coveCutFrame.setImageIndex(0);
+            this.save(coveCutFrame);
+            LoadFileUtil.delFile(coverCutFramePath);
+            // 请求从数据接口 获取其余14张截图
+            getCut(materialId, videoUrl, loadImage, 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+    private void getCut(String materialId, String videoUrl, String loadImage, Integer count) {
+        try {
+            Map<String, Object> coverMap = CloudVideoProcessUtil.videoCutFrameHandle(videoUrl, loadImage);
+            for (int i = 0; i <= 13; i++) {
+                String url = (String) coverMap.get(String.valueOf(i));
+                if (!Check.isNull(url)) {
+                    String cutFramePath = LoadFileUtil.downLoadFromUrl(url, imageUpLoadPath);
+                    String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+                    Map<String, Object> deleteMap = new HashMap<>();
+                    deleteMap.put("video_signature", materialId);
+                    deleteMap.put("signature", cutFrameMd5);
+                    this.removeByMap(deleteMap);
+                    MaterialCutFrame cutFrame = new MaterialCutFrame();
+                    cutFrame.setSignature(cutFrameMd5);
+                    cutFrame.setUrl(url);
+                    cutFrame.setVideoSignature(materialId);
+                    cutFrame.setImageIndex(i + 1);
+                    this.save(cutFrame);
+                    LoadFileUtil.delFile(cutFramePath);
+                }
+            }
+
+        } catch (Exception e) {
+            log.info("抽帧异常,code:{}", materialId);
+            e.printStackTrace();
+            if (count >= 4) {
+                return;
+            }
+            getCut(materialId, videoUrl, loadImage, count + 1);
+
+        }
+
+    }
+
+    @Override
+    public boolean updateTencentCutFrame(String videoMD5) {
+        boolean result = true;
+        Map<String, Object> coverMap = CloudVideoProcessUtil.supplementFrameUrl(videoMD5);
+        for (int i = 0; i <= 13; i++) {
+            String url = (String) coverMap.get(String.valueOf(i));
+            if (!Check.isNull(url)) {
+                String cutFramePath = LoadFileUtil.downLoadFromUrl(url, imageUpLoadPath);
+                String cutFrameMd5 = null;
+                try {
+                    cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+                } catch (IOException e) {
+                    log.error(e.getMessage());
+                }
+                QueryWrapper<MaterialCutFrame> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("video_signature", videoMD5);
+                queryWrapper.eq("image_index", i + 1);
+                MaterialCutFrame cutFrame = new MaterialCutFrame();
+                cutFrame.setSignature(cutFrameMd5);
+                cutFrame.setUrl(url);
+                result = this.update(cutFrame, queryWrapper);
+                LoadFileUtil.delFile(cutFramePath);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public MaterialCutFrame getCutFrameByCode(String code) {
+        QueryWrapper<MaterialCutFrame> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("video_signature", code);
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+    @Override
+    public  List<JSONObject>  getProgramCreativeCover(String signature) {
+        return materialCutFrameMapper.getProgramCreativeCover(signature);
+    }
+
+
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/MaterialCutFrameTaskServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.common.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.common.entity.MaterialCutFrameTask;
+import com.xxl.job.executor.common.mapper.MaterialCutFrameTaskMapper;
+import com.xxl.job.executor.common.service.IMaterialCutFrameTaskService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 截帧 任务表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-06-01
+ */
+@Service
+public class MaterialCutFrameTaskServiceImpl extends ServiceImpl<MaterialCutFrameTaskMapper, MaterialCutFrameTask> implements IMaterialCutFrameTaskService {
+
+}

+ 19 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/OauthAgentTokenServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xxl.job.executor.common.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.common.entity.OauthAgentToken;
+import com.xxl.job.executor.common.mapper.OauthAgentTokenMapper;
+import com.xxl.job.executor.common.service.IOauthAgentTokenService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 代理商token
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-08-18
+ */
+@Service
+public class OauthAgentTokenServiceImpl extends ServiceImpl<OauthAgentTokenMapper, OauthAgentToken> implements IOauthAgentTokenService {
+
+}

+ 84 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/RefreshTokenServiceImpl.java

@@ -0,0 +1,84 @@
+package com.xxl.job.executor.common.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.entity.OauthAgentToken;
+import com.xxl.job.executor.common.mapper.CtopOauthTokenMapper;
+import com.xxl.job.executor.common.service.ICtopOauthTokenService;
+import com.xxl.job.executor.common.service.IOauthAgentTokenService;
+import com.xxl.job.executor.common.service.IRefreshTokenService;
+import com.xxl.job.executor.utils.Check;
+import com.xxl.job.executor.utils.CtopAdConstant;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Slf4j
+@Service
+public class RefreshTokenServiceImpl implements IRefreshTokenService {
+    @Autowired
+    private CtopOauthTokenMapper oauthTokenMapper;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IOauthAgentTokenService agentTokenService;
+
+    /**
+     * 获取所有token
+     *
+     * @return
+     */
+    @Override
+    public void getKuaiShouRefresh() {
+        List<CtopOauthToken> oauthTokens = oauthTokenMapper.selectKuaiShouTokens(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (!Check.isNull(oauthTokens)) {
+            for (CtopOauthToken oauthToken : oauthTokens) {
+                XxlJobHelper.log("刷新token,accountId:{}", oauthToken.getAccountId());
+                //快手
+                if (CtopAdConstant.PLATFORM_TYPE_KUAISHOU.equals(oauthToken.getMediaId().trim())) {
+                    oauthTokenService.getKuaiShouRefreshToken(oauthToken.getAccountId(), oauthToken.getAccessToken(), oauthToken.getRefreshToken(), oauthToken.getAgentType());
+                }
+            }
+        } else {
+            XxlJobHelper.log("----------------------刷新token获取数据返回结果为空----------------------------------");
+        }
+    }
+
+    @Override
+    public void byteDanceRefresh(String accountId) {
+        if (null == accountId || "".equals(accountId.trim()) || "null".equalsIgnoreCase(accountId)) {
+            List<CtopOauthToken> byteDanceOauthTokens = oauthTokenMapper.selectByteDanceTokens(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+            if (!Check.isNull(byteDanceOauthTokens)) {
+                for (CtopOauthToken oauthToken : byteDanceOauthTokens) {
+                    oauthTokenService.getByteDanceAccessToken(oauthToken);
+                }
+            }
+        } else {
+            CtopOauthToken token = oauthTokenMapper.selectByAccountId(Long.parseLong(accountId));
+            if (token == null) {
+                XxlJobHelper.log("未获取到账户数据,accountId:{}", accountId);
+                return;
+            }
+            oauthTokenService.getByteDanceAccessToken(token);
+        }
+    }
+
+    @Override
+    public void getKuaiShouAgentRefresh() {
+        QueryWrapper<OauthAgentToken> agentTokenQueryWrapper = new QueryWrapper<>();
+        agentTokenQueryWrapper.eq("media_id", 2);
+        List<OauthAgentToken> list = agentTokenService.list(agentTokenQueryWrapper);
+        if (!Check.isNull(list)) {
+            for (OauthAgentToken agentToken : list) {
+                oauthTokenService.getKuaiShouAgentRefreshToken(agentToken.getAgentId(), agentToken.getAccessToken(), agentToken.getRefreshToken());
+
+            }
+
+        }
+
+
+    }
+}

+ 0 - 0
xxl-job-kuaishou/src/main/java/com/xxl/job/executor/common/service/impl/UserAllocationServiceImpl.java


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff