yumeng hace 5 años
padre
commit
408fc45004

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

@@ -14,7 +14,9 @@
         ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount, -- 表单提交数
-        (sum(charge) / sum(form_count)) formPrice -- 表单提交单价
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        sum(activation) activationCount, -- 激活数
+        (sum(charge) / sum(activation)) activationPrice -- 激活单价
         from
         ctop_kuaishou_report_hourly_account
         where stat_date = #{date}
@@ -39,8 +41,8 @@
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount,
         (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
-        account_id accountId
-
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
         from
         ctop_kuaishou_report_daily_account
         where account_id in
@@ -64,10 +66,10 @@
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount,
         (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
-        account_id accountId
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
         from
         ctop_kuaishou_report_daily_account
-
         where stat_date <= #{startDate}
         and stat_date >= #{endDate}
         and account_id in
@@ -91,8 +93,10 @@
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount,
         (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
-        account_id accountId
-
+        sum(activation) activationCount, -- 激活数
+        (sum(charge) / sum(activation)) activationPrice, -- 激活单价
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
         from
         ctop_kuaishou_report_hourly_account
         where stat_date = #{date}
@@ -256,7 +260,8 @@
         sum(bclick) bClick,-- 行为数
         sum(form_count) formCount,
         (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
-        account_id accountId
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
         from
         ctop_kuaishou_report_hourly_account
         where account_id in

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

@@ -355,6 +355,18 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             }
                         }
 
+
+                        Long nowActivationCount = nowAccountSummary.getLong("activationCount"); // 激活数
+                        Long yesterdayActivationCount = yesterdayAccountSummary.getLong("activationCount");
+                        if (!Check.isNull(nowActivationCount) && !Check.isNull(yesterdayActivationCount)) {
+                            if (yesterdayAClick != 0L) {
+                                double activationCountProportion = (nowActivationCount.doubleValue() - yesterdayActivationCount.doubleValue()) / yesterdayActivationCount.doubleValue();
+                                chainRatioJson.put("activationCountProportion", activationCountProportion);
+                            } else {
+                                chainRatioJson.put("activationCountProportion", 0); //表单提交数环比
+                            }
+                        }
+
                         BigDecimal nowFormPrice = nowAccountSummary.getBigDecimal("formPrice"); // 表单提交单价
                         BigDecimal yesterdayFormPrice = yesterdayAccountSummary.getBigDecimal("formPrice");
                         if (!Check.isNull(nowFormPrice) && !Check.isNull(yesterdayFormPrice)) {
@@ -364,10 +376,21 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             } else {
                                 chainRatioJson.put("formPriceProportion", 0); // 表单提交单价环比
                             }
+
+
+                            BigDecimal nowActivationPrice = nowAccountSummary.getBigDecimal("activationPrice"); // 表单提交单价
+                            BigDecimal yesterdayActivationPrice = yesterdayAccountSummary.getBigDecimal("activationPrice");
+                            if (!Check.isNull(nowActivationPrice) && !Check.isNull(yesterdayActivationPrice)) {
+                                if (yesterdayFormPrice.compareTo(new BigDecimal(0)) != 0) {
+                                    BigDecimal activationPriceProportion = (nowActivationPrice.subtract(yesterdayActivationPrice)).divide(yesterdayActivationPrice, BigDecimal.ROUND_HALF_UP, 2);
+                                    chainRatioJson.put("activationPriceProportion", activationPriceProportion.divide(discount, BigDecimal.ROUND_HALF_UP, 2));
+                                } else {
+                                    chainRatioJson.put("activationPriceProportion", 0); // 表单提交单价环比
+                                }
+                            }
                         }
                     }
                 }
-
                 returnJson.put("chainRatio", chainRatioJson);
             } else if (type == 2) {
                 if (Check.isNull(statHour)) {