Forráskód Böngészése

fix of 1000217 on 2021.1.19

jiequan.bi 4 éve
szülő
commit
77dd932542

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformOrderServiceImpl.java

@@ -55,7 +55,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
         PlatformOrder platformOrder= this.getOne(queryWrapper);
         platformOrder.setMaterialFinishAmount(platformOrder.getMaterialFinishAmount()+1);
         platformOrder.setMaterialFinishTime(DateUtils.getDate());
-        if(platformOrder.getMaterialAmount()==platformOrder.getMaterialFinishAmount()+1){
+        if(platformOrder.getMaterialAmount().equals(platformOrder.getMaterialFinishAmount())){
             platformOrder.setOrderStatus(3);
             platformOrder.setOrderFinishTime(DateUtils.getDate());
         }

+ 85 - 90
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyImage.java

@@ -1,36 +1,31 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
+import java.math.BigDecimal;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
+
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import org.jeecgframework.poi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 /**
  * 快手图片报表
  */
 @Data
 @TableName("ctop_kuaishou_report_daily_image")
-public class KuaishouReportDailyImage {
 
+public class KuaishouReportDailyImage {
+    
 	/**id*/
-	private Integer id;
-	/**账户ID*/
-	private Integer coverId;
-	/**计划ID*/
-	private Integer photoId;
-	/**channelType*/
-	@Excel(name = "channelType", width = 15)
-    @ApiModelProperty(value = "channelType")
-	private Integer channelType;
-	/**signature*/
-	@Excel(name = "signature", width = 15)
-    @ApiModelProperty(value = "signature")
-	private String signature;
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	/**封面ID*/
+	private Long coverId;
 	/**封面token*/
 	@Excel(name = "封面token", width = 15)
     @ApiModelProperty(value = "封面token")
@@ -39,14 +34,6 @@ public class KuaishouReportDailyImage {
 	@Excel(name = "封面url", width = 15)
     @ApiModelProperty(value = "封面url")
 	private String coverUrl;
-	/**视频url*/
-	@Excel(name = "视频url", width = 15)
-    @ApiModelProperty(value = "视频uel")
-	private String photoUrl;
-	/**素材类型*/
-	@Excel(name = "素材类型", width = 15)
-    @ApiModelProperty(value = "素材类型")
-	private String creativeMaterialTypeString;
 	/**场景*/
 	@Excel(name = "场景", width = 15)
     @ApiModelProperty(value = "场景")
@@ -54,75 +41,79 @@ public class KuaishouReportDailyImage {
 	/**花费(元)*/
 	@Excel(name = "花费(元)", width = 15)
     @ApiModelProperty(value = "花费(元)")
-	private java.math.BigDecimal charge;
+	private BigDecimal charge;
 	/**曝光数*/
 	@Excel(name = "曝光数", width = 15)
     @ApiModelProperty(value = "曝光数")
-	private Integer photoShow;
+	private Long photoShow;
 	/**素材曝光数*/
 	@Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-	private Integer aclick;
+	private Long aclick;
 	/**行为数*/
 	@Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-	private Integer bclick;
+	private Long bclick;
 	/**分享数*/
 	@Excel(name = "分享数", width = 15)
     @ApiModelProperty(value = "分享数")
-	private Integer photoShare;
+	private Long photoShare;
 	/**评论数*/
 	@Excel(name = "评论数", width = 15)
     @ApiModelProperty(value = "评论数")
-	private Integer photoComment;
+	private Long photoComment;
 	/**点赞数*/
 	@Excel(name = "点赞数", width = 15)
     @ApiModelProperty(value = "点赞数")
-	private Integer photoLike;
+	private Long photoLike;
 	/**新增关注数*/
 	@Excel(name = "新增关注数", width = 15)
     @ApiModelProperty(value = "新增关注数")
-	private Integer follow;
+	private Long follow;
 	/**取消关注数*/
 	@Excel(name = "取消关注数", width = 15)
     @ApiModelProperty(value = "取消关注数")
-	private Integer cancelFollow;
+	private Long cancelFollow;
 	/**举报数*/
 	@Excel(name = "举报数", width = 15)
     @ApiModelProperty(value = "举报数")
-	private Integer report;
+	private Long report;
 	/**拉黑数*/
 	@Excel(name = "拉黑数", width = 15)
     @ApiModelProperty(value = "拉黑数")
-	private Integer block;
+	private Long block;
 	/**减少此类作品数*/
 	@Excel(name = "减少此类作品数", width = 15)
     @ApiModelProperty(value = "减少此类作品数")
-	private Integer negative;
+	private Long negative;
 	/**应用下载数据-安卓下载开始数*/
 	@Excel(name = "应用下载数据-安卓下载开始数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
-	private Integer downloadStarted;
+	private Long downloadStarted;
 	/**应用下载数据-安卓下载完成数*/
 	@Excel(name = "应用下载数据-安卓下载完成数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
-	private Integer downloadCompleted;
+	private Long downloadCompleted;
 	/**应用下载数据-激活数*/
 	@Excel(name = "应用下载数据-激活数", width = 15)
     @ApiModelProperty(value = "应用下载数据-激活数")
-	private Integer activation;
+	private Long activation;
 	/**提交按钮点击数*/
 	@Excel(name = "提交按钮点击数", width = 15)
     @ApiModelProperty(value = "提交按钮点击数")
-	private Integer submit;
+	private Long submit;
 	/**日期*/
 	@Excel(name = "日期", width = 15)
     @ApiModelProperty(value = "日期")
 	private String statDate;
+	/**statHour*/
+	@Excel(name = "statHour", width = 15)
+    @ApiModelProperty(value = "statHour")
+	private String statHour;
 	/**封面点击数*/
 	@Excel(name = "封面点击数", width = 15)
     @ApiModelProperty(value = "封面点击数")
-	private Integer photoClick;
+	private Long photoClick;
 	/**封面点击率*/
 	@Excel(name = "封面点击率", width = 15)
     @ApiModelProperty(value = "封面点击率")
@@ -131,26 +122,14 @@ public class KuaishouReportDailyImage {
 	@Excel(name = "行为率", width = 15)
     @ApiModelProperty(value = "行为率")
 	private Double actionRatio;
-	/**平均千次曝光花费(元)*/
-	@Excel(name = "平均千次曝光花费(元)", width = 15)
-    @ApiModelProperty(value = "平均千次曝光花费(元)")
-	private java.math.BigDecimal impression1kCost;
-	/**平均点击单价(元)*/
-	@Excel(name = "平均点击单价(元)", width = 15)
-    @ApiModelProperty(value = "平均点击单价(元)")
-	private java.math.BigDecimal photoClickCost;
-	/**平均行为单价(元)*/
-	@Excel(name = "平均行为单价(元)", width = 15)
-    @ApiModelProperty(value = "平均行为单价(元)")
-	private java.math.BigDecimal actionCost;
 	/**应用下载数据-首日付费次数*/
 	@Excel(name = "应用下载数据-首日付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费次数")
-	private Integer eventPayFirstDay;
+	private Long eventPayFirstDay;
 	/**应用下载数据-首日付费金额*/
 	@Excel(name = "应用下载数据-首日付费金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费金额")
-	private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+	private BigDecimal eventPayPurchaseAmountFirstDay;
 	/**应用下载数据-首日ROI*/
 	@Excel(name = "应用下载数据-首日ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日ROI")
@@ -158,11 +137,11 @@ public class KuaishouReportDailyImage {
 	/**应用下载数据-付费次数*/
 	@Excel(name = "应用下载数据-付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-付费次数")
-	private Integer eventPay;
+	private Long eventPay;
 	/**应用下载数据-付费金额*/
 	@Excel(name = "应用下载数据-付费金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-付费金额")
-	private java.math.BigDecimal eventPayPurchaseAmount;
+	private BigDecimal eventPayPurchaseAmount;
 	/**应用下载数据-ROI*/
 	@Excel(name = "应用下载数据-ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-ROI")
@@ -170,11 +149,11 @@ public class KuaishouReportDailyImage {
 	/**应用下载数据-注册数*/
 	@Excel(name = "应用下载数据-注册数", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册数")
-	private Integer eventRegister;
+	private Long eventRegister;
 	/**应用下载数据-注册成本*/
 	@Excel(name = "应用下载数据-注册成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册成本")
-	private java.math.BigDecimal eventRegisterCost;
+	private BigDecimal eventRegisterCost;
 	/**应用下载数据-注册率*/
 	@Excel(name = "应用下载数据-注册率", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册率")
@@ -182,19 +161,19 @@ public class KuaishouReportDailyImage {
 	/**应用下载数据-完件数*/
 	@Excel(name = "应用下载数据-完件数", width = 15)
     @ApiModelProperty(value = "应用下载数据-完件数")
-	private Integer eventJinJianApp;
+	private Long eventJinJianApp;
 	/**应用下载数据-完件成本*/
 	@Excel(name = "应用下载数据-完件成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-完件成本")
-	private java.math.BigDecimal eventJinJianAppCost;
+	private BigDecimal eventJinJianAppCost;
 	/**应用下载数据-授信数*/
 	@Excel(name = "应用下载数据-授信数", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信数")
-	private Integer eventCreditGrantApp;
+	private Long eventCreditGrantApp;
 	/**应用下载数据-授信成本*/
 	@Excel(name = "应用下载数据-授信成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信成本")
-	private java.math.BigDecimal eventCreditGrantAppCost;
+	private BigDecimal eventCreditGrantAppCost;
 	/**应用下载数据-授信率*/
 	@Excel(name = "应用下载数据-授信率", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信率")
@@ -202,27 +181,43 @@ public class KuaishouReportDailyImage {
 	/**应用下载数据-付款成功数*/
 	@Excel(name = "应用下载数据-付款成功数", width = 15)
     @ApiModelProperty(value = "应用下载数据-付款成功数")
-	private Integer eventOrderPaid;
+	private Long eventOrderPaid;
 	/**应用下载数据-付款成功金额*/
 	@Excel(name = "应用下载数据-付款成功金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-付款成功金额")
-	private java.math.BigDecimal eventOrderPaidPurchaseAmount;
+	private BigDecimal eventOrderPaidPurchaseAmount;
+	/**应用下载数据-单次付款成本*/
+	@Excel(name = "应用下载数据-单次付款成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-单次付款成本")
+	private BigDecimal eventOrderPaidCost;
+	/**落地页数据-表单提交数*/
+	@Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+	private Long formCount;
+	/**落地页数据-表单提交单价*/
+	@Excel(name = "落地页数据-表单提交单价", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交单价")
+	private BigDecimal formCost;
+	/**落地页数据-表单提交点击率*/
+	@Excel(name = "落地页数据-表单提交点击率", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交点击率")
+	private Double formActionRatio;
 	/**落地页数据-落地页完件数*/
 	@Excel(name = "落地页数据-落地页完件数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页完件数")
-	private Integer eventJinJianLandingPage;
+	private Long eventJinJianLandingPage;
 	/**落地页数据-落地页完件成本*/
 	@Excel(name = "落地页数据-落地页完件成本", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页完件成本")
-	private java.math.BigDecimal eventJinJianLandingPageCost;
+	private BigDecimal eventJinJianLandingPageCost;
 	/**落地页数据-落地页授信数*/
 	@Excel(name = "落地页数据-落地页授信数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信数")
-	private Integer eventCreditGrantLandingPage;
+	private Long eventCreditGrantLandingPage;
 	/**落地页数据-落地页授信成本*/
 	@Excel(name = "落地页数据-落地页授信成本", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信成本")
-	private java.math.BigDecimal eventCreditGrantLandingPageCost;
+	private BigDecimal eventCreditGrantLandingPageCost;
 	/**落地页数据-落地页授信率*/
 	@Excel(name = "落地页数据-落地页授信率", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信率")
@@ -230,31 +225,15 @@ public class KuaishouReportDailyImage {
 	/**应用下载数据-次留成本(仅支持分日查询)*/
 	@Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
-	private java.math.BigDecimal eventNextDayStayCost;
+	private BigDecimal eventNextDayStayCost;
 	/**应用下载数据-次留率(仅支持分日查询)*/
 	@Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
-	private Integer eventNextDayStayRatio;
-	/**落地页数据-表单提交点击率*/
-	@Excel(name = "落地页数据-表单提交点击率", width = 15)
-    @ApiModelProperty(value = "落地页数据-表单提交点击率")
-	private Double formActionRatio;
-	/**应用下载数据-单次付款成本*/
-	@Excel(name = "应用下载数据-单次付款成本", width = 15)
-    @ApiModelProperty(value = "应用下载数据-单次付款成本")
-	private java.math.BigDecimal eventOrderPaidCost;
+	private Long eventNextDayStayRatio;
 	/**应用下载数据-次留数(仅支持分日查询)*/
 	@Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
-	private Integer eventNextDayStay;
-	/**落地页数据-表单提交单价*/
-	@Excel(name = "落地页数据-表单提交单价", width = 15)
-    @ApiModelProperty(value = "落地页数据-表单提交单价")
-	private java.math.BigDecimal formCost;
-	/**落地页数据-表单提交数*/
-	@Excel(name = "落地页数据-表单提交数", width = 15)
-    @ApiModelProperty(value = "落地页数据-表单提交数")
-	private Integer formCount;
+	private Long eventNextDayStay;
 	/**3s播放率*/
 	@Excel(name = "3s播放率", width = 15)
     @ApiModelProperty(value = "3s播放率")
@@ -271,4 +250,20 @@ public class KuaishouReportDailyImage {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
 	private Date updateTime;
+	/**accountId*/
+	@Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+	private Long accountId;
+	/**code*/
+	@Excel(name = "code", width = 15)
+    @ApiModelProperty(value = "code")
+	private String code;
+	/**userId*/
+	@Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+	private String userId;
+	/**realname*/
+	@Excel(name = "realname", width = 15)
+    @ApiModelProperty(value = "realname")
+	private String realname;
 }

+ 26 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyImageServiceImpl.java

@@ -12,6 +12,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.units.qual.K;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -29,6 +31,9 @@ import java.util.Map;
 @Service
 public class KuaishouReportDailyImageServiceImpl extends ServiceImpl<KuaishouReportDailyImageMapper, KuaishouReportDailyImage> implements IKuaishouReportDailyImageService {
 
+    @Autowired
+    KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+
     @Override
     public void getMaterialImageReport(Long accountId, String accessToken, String startDate, String endDate, Integer page) {
 
@@ -38,20 +43,20 @@ public class KuaishouReportDailyImageServiceImpl extends ServiceImpl<KuaishouRep
 
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
-        param.put("page_size", 2000);
+        param.put("start_date",startDate);
+        param.put("end_date",endDate);
+        param.put("view_type",7);
+        param.put("temporal_granularity","DAILY");
+        param.put("page_size", 1000);
         param.put("page", page);
 
-        JSONObject resultJson = JSONObject.parseObject(HttpUtils.kuaiShouhttpPostRequest("https://ad.e.kuaishou.com/rest/openapi/v1/report/campaign_report", param.toJSONString(), headers));
+        JSONObject resultJson = JSONObject.parseObject(HttpUtils.kuaiShouhttpPostRequest("https://ad.e.kuaishou.com/rest/openapi/v1/report/material_report", param.toJSONString(), headers));
         if (Check.isNull(resultJson)) {
-            log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
-            return;
-        }
-        Integer code = resultJson.getInteger("code");
-        if (null == code || code != 0) {
-            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, resultJson.getString("message"));
+            log.error("获取素材图片报表返回结果为空,advertiserId:{}", accountId);
             return;
         }
-        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+
+        JSONArray details = resultJson.getJSONArray("details");
         if (null == details || details.size() <= 0) {
             return;
         }
@@ -59,9 +64,20 @@ public class KuaishouReportDailyImageServiceImpl extends ServiceImpl<KuaishouRep
         details.forEach(detail->{
             JSONObject detailJSON = (JSONObject) detail;
             if (!Check.isNull(detailJSON)) {
-                KuaishouReportDailyImage kuaishouReportDailyImage =new KuaishouReportDailyImage();
+                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"));
+                KuaishouReportDailyImage kuaishouReportDailyImage = JSONObject.toJavaObject(detailJSON,KuaishouReportDailyImage.class);
+                kuaishouReportDailyImage.setAccountId(accountId);
+
+                imageReports.add(kuaishouReportDailyImage);
             }
         });
+        this.saveBatch(imageReports);
+        if(resultJson.getInteger("total_count")>(1000*page)){
+            getMaterialImageReport(accountId, accessToken, startDate, endDate, page + 1);
+        }
     }
 
 }