Преглед изворни кода

Merge branch 'master' into test

yumeng пре 5 година
родитељ
комит
0973da65ae

+ 0 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouReportController.java

@@ -82,11 +82,9 @@ public class KuaiShouReportController {
                             if (i == 0) {
                                 kuaishouInterfaceService.getAccountHourlyReport(accessToken, advertiserId, nowDate, nowDate, 500, 1);
                                 hourDate = nowDate;
-                                System.err.println(nowDate);
                             } else if (i > 0) {
                                 String hourAnotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", hourDate, -1);
                                 kuaishouInterfaceService.getAccountHourlyReport(accessToken, advertiserId, hourAnotherDay, hourAnotherDay, 500, 1);
-                                System.err.println(hourAnotherDay);
                                 hourDate = hourAnotherDay;
                             }
 
@@ -107,12 +105,4 @@ public class KuaiShouReportController {
 
     }
 
-
-    public static void main(String[] args) throws ParseException {
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String anotherDay1 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay1, -180);
-
-        System.err.println(anotherDay);
-    }
 }

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

@@ -168,11 +168,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("page", pageNum);
         KuaishouResult<KuaishouReportHourlyAccount> kuaishouResult = null;
         try {
-
             String result = HttpUtils.httpPostRequest(url, param, headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
-                System.err.println(resultJson);
                 if (resultJson.getInteger("code") == 0) {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNull(dataJson)) {
@@ -184,7 +182,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             Long like = detailJson.getLong("like");
                             detailJson.put("photo_like", like);
                             KuaishouReportHourlyAccount kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
-//                            System.err.println(kuaishouReportHourlyAccount);
                             kuaishouReportHourlyAccount.setAccountId(advertiserId);
                             kuaishouReportHourlyAccount.setId("" + advertiserId + kuaishouReportHourlyAccount.getStatDate() + kuaishouReportHourlyAccount.getStatHour());
                             hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);

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

@@ -11,7 +11,7 @@
         sum(aclick) aclick, -- 素材曝光数
         (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
         (sum(form_count) / sum(bclick)) cvr,
-        (sum(charge) / (sum(photo_show) * 1000)) cpm,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount, -- 表单提交数
         (sum(charge) / sum(form_count)) formPrice -- 表单提交单价
@@ -29,86 +29,80 @@
 
     <select id="selectAccountReport" resultType="com.alibaba.fastjson.JSONObject">
         select
-        sum(t1.charge) cost, -- 消耗
-        sum(t1.photo_show) photoShow, -- 封面展示
-        sum(t1.photo_click) photoClick, -- 封面点击
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(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
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        account_id accountId
+
         from
-        ctop_kuaishou_report_daily_account t1
-        LEFT JOIN ctop_user_allocation t2
-        ON t1.account_id = t2.account_id
-        where t1.account_id in
+        ctop_kuaishou_report_daily_account
+        where account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by t1.account_id;
+        group by account_id;
     </select>
 
 
     <select id="selectAccountReportByDate" resultType="com.alibaba.fastjson.JSONObject">
         select
-        sum(t1.charge) cost, -- 消耗
-        sum(t1.photo_show) photoShow, -- 封面展示
-        sum(t1.photo_click) photoClick, -- 封面点击
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(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
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        account_id accountId
         from
-        ctop_kuaishou_report_daily_account t1
-        LEFT JOIN ctop_user_allocation t2
-        ON t1.account_id = t2.account_id
-        where t1.stat_date &lt;= #{startDate}
-        and t1.stat_date &gt;= #{endDate}
-        and t1.account_id in
+        ctop_kuaishou_report_daily_account
+
+        where stat_date &lt;= #{startDate}
+        and stat_date &gt;= #{endDate}
+        and account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by t1.account_id;
+        group by account_id;
     </select>
 
 
     <select id="selectReportDetailGroupAccountId" resultType="com.alibaba.fastjson.JSONObject">
         select
-        sum(t1.charge) cost, -- 消耗
-        sum(t1.photo_show) photoShow, -- 封面展示
-        sum(t1.photo_click) photoClick, -- 封面点击
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(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
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        account_id accountId
+
         from
-        ctop_kuaishou_report_hourly_account t1
-        LEFT JOIN ctop_user_allocation t2
-        ON t1.account_id = t2.account_id
-        where t1.stat_date = #{date}
-        and t1.account_id in
+        ctop_kuaishou_report_hourly_account
+        where stat_date = #{date}
+        and stat_hour &lt;= #{statHour}
+        and account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        and stat_hour &lt;= #{statHour}
-        group by t1.account_id;
+        group by account_id;
     </select>
 
 
@@ -252,30 +246,25 @@
 
     <select id="selectAllByAccounts" resultType="com.alibaba.fastjson.JSONObject">
         select
-        sum(t1.charge) cost, -- 消耗
-        sum(t1.photo_show) photoShow, -- 封面展示
-        sum(t1.photo_click) photoClick, -- 封面点击
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(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
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        account_id accountId
         from
-        ctop_kuaishou_report_hourly_account t1
-        LEFT JOIN ctop_user_allocation t2
-        ON t1.account_id = t2.account_id
-        where t1.account_id in
+        ctop_kuaishou_report_hourly_account
+        where account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by t1.account_id;
-
-
+        group by account_id
     </select>
 
 

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

@@ -250,6 +250,7 @@ public class AccountReportServiceImpl implements IAccountReportService {
                     hour = statHour;
                 }
                 JSONObject chainRatioJson = new JSONObject();
+                System.out.println(hour);
                 accountDetail = accountReportMapper.selectReportDetailGroupAccountId(nowDate, accountIds, hour);
                 JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour);
                 if (!Check.isNull(nowAccountSummary)) {