ソースを参照

Merge branch 'test'

yumeng 5 年 前
コミット
8063a89f21

+ 0 - 2
module-report/src/main/java/cn/com/ctop/bytedance/controller/AccountReportController.java

@@ -38,7 +38,6 @@ public class AccountReportController {
             userAllocationQueryWrapper.groupBy("account_id");
             userAllocationQueryWrapper.orderByAsc("advertiser_name");
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
-
             result.setSuccess(true);
             result.setMessage("查询成功");
             result.setResult(userAllocations);
@@ -72,5 +71,4 @@ public class AccountReportController {
     }
 
 
-
 }

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/mapper/AccountReportMapper.java

@@ -110,11 +110,11 @@ public interface AccountReportMapper {
 
 
     /**
-     * 查询所有明细
      *
      * @param accountIds
      * @return
      */
+
     List<JSONObject> selectAccountReport(@Param("accountIds") JSONArray accountIds);
 
 

+ 17 - 8
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/AccountReportMapper.xml

@@ -29,19 +29,28 @@
 
     <select id="selectAccountReport" resultType="com.alibaba.fastjson.JSONObject">
         select
-        sum(charge) cost,
-        sum(photo_show) photoShow,
-        sum(photo_click) photoClick,
-        sum(aclick) aclick,
-        stat_hour statHour
+        sum(t1.charge) cost, -- 消耗
+        sum(t1.photo_show) photoShow, -- 封面展示
+        sum(t1.photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+        (sum(t1.photo_click) / sum(t1.photo_show)) photoClickRatio, -- 封面点击率
+        (sum(t1.form_count) / sum(t1.bclick)) cvr,
+        (sum(t1.charge) / (sum(t1.photo_show) * 1000)) cpm,
+        sum(t1.bclick) bClick,-- 行为数
+        sum(t1.form_count) formCount,
+        (sum(t1.charge) / sum(t1.form_count)) formPrice, -- 表单提交单价
+        t1.account_id accountId,
+        t2.auth_name accountName
         from
-        ctop_kuaishou_report_daily_account
-        where account_id in
+        ctop_kuaishou_report_daily_account t1
+        LEFT JOIN ctop_user_allocation t2
+        ON t1.account_id = t2.account_id
+        where t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by stat_hour;
+        group by t1.account_id;
     </select>
 
 

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

@@ -231,8 +231,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
     public JSONObject getStatistics(JSONObject json) {
         JSONObject returnJson = new JSONObject();
         try {
-
-
             Integer type = json.getInteger("type");
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当前日期
             String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 当前日期-1
@@ -270,7 +268,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         Long photoShow = nowAccountSummary.getLong("photoShow");// 今日封面展示
                         Long yesterdayPhotoShow = yesterdayAccountSummary.getLong("photoShow");// 昨日封面展示
                         if (!Check.isNull(photoShow) && !Check.isNull(yesterdayPhotoShow)) {
@@ -282,7 +279,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         Long photoClick = nowAccountSummary.getLong("photoClick");// 封面点击
                         Long yesterdayPhotoClick = yesterdayAccountSummary.getLong("photoClick");
                         if (!Check.isNull(photoClick) && !Check.isNull(yesterdayPhotoClick)) {
@@ -294,7 +290,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         Long nowAClick = nowAccountSummary.getLong("aclick"); // 爆光
                         Long yesterdayAClick = yesterdayAccountSummary.getLong("aclick");
                         if (!Check.isNull(nowAClick) && !Check.isNull(nowAClick)) {
@@ -306,7 +301,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         BigDecimal nowPhotoClickRatio = nowAccountSummary.getBigDecimal("photoClickRatio"); // 封面点击率
                         BigDecimal yesterdayPhotoClickRatio = yesterdayAccountSummary.getBigDecimal("photoClickRatio");
                         if (!Check.isNull(nowPhotoClickRatio) && !Check.isNull(yesterdayPhotoClickRatio)) {
@@ -318,7 +312,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         BigDecimal nowCvr = nowAccountSummary.getBigDecimal("cvr"); // cvr
                         BigDecimal yesterdayCvr = yesterdayAccountSummary.getBigDecimal("cvr");
                         if (!Check.isNull(nowCvr) && !Check.isNull(yesterdayCvr)) {
@@ -330,7 +323,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         BigDecimal nowCpm = nowAccountSummary.getBigDecimal("cpm"); // cpm
                         BigDecimal yesterdayCpm = yesterdayAccountSummary.getBigDecimal("cpm");
                         if (!Check.isNull(nowCpm) && !Check.isNull(yesterdayCpm)) {
@@ -342,7 +334,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         Long nowBClick = nowAccountSummary.getLong("bClick"); // 行为数
                         Long yesterdayBClick = yesterdayAccountSummary.getLong("bClick");
                         if (!Check.isNull(nowBClick) && !Check.isNull(yesterdayBClick)) {
@@ -354,7 +345,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
-
                         Long nowFormCount = nowAccountSummary.getLong("formCount"); // 表单提交数
                         Long yesterdayFormCount = yesterdayAccountSummary.getLong("formCount");
 
@@ -365,7 +355,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             } else {
                                 chainRatioJson.put("formCountProportion", 0); //表单提交数环比
                             }
-
                         }
 
                         BigDecimal nowFormPrice = nowAccountSummary.getBigDecimal("formPrice"); // 表单提交单价
@@ -377,11 +366,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             } else {
                                 chainRatioJson.put("formPriceProportion", 0); // 表单提交单价环比
                             }
-
                         }
                     }
-
-
                 }
 
                 returnJson.put("chainRatio", chainRatioJson);