Quellcode durchsuchen

淘宝注册数

yumeng vor 5 Jahren
Ursprung
Commit
6bc7819c3d

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

@@ -18,7 +18,16 @@
         ((sum(charge) / sum(form_count)) / #{discount}) afterFormPrice, -- 表单提交单价
         sum(activation) activationCount, -- 激活数
         (sum(charge) / sum(activation)) activationPrice, -- 激活单价
-        ((sum(charge) / sum(activation)) / #{discount}) afterActivationPrice -- 激活单价
+        ((sum(charge) / sum(activation)) / #{discount}) afterActivationPrice, -- 激活单价
+        sum(event_register) eventRegister, -- 注册数
+
+        (case
+        when sum(event_register) != 0
+        then (sum(charge) / sum(charge))
+        else 0
+        end
+        ) eventRegisterCost -- 注册成本
+
         from
         ctop_kuaishou_report_hourly_account
         where stat_date = #{date}
@@ -105,6 +114,15 @@
         (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
         sum(activation) activationCount, -- 激活数
         (sum(charge) / sum(activation)) activationPrice, -- 激活单价
+        sum(event_register) eventRegister, -- 注册数
+
+        (case
+        when sum(event_register) != 0
+        then (sum(charge) / sum(charge))
+        else 0
+        end
+        ) eventRegisterCost, -- 注册成本
+
         account_id accountId,
         (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
         from

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

@@ -480,7 +480,6 @@ public class AccountReportServiceImpl implements IAccountReportService {
                             chainRatioJson.put("beforeActivationPriceProportion", 0);
                         }
 
-
                         // 转化提交单价
                         BigDecimal nowAfterActivationPrice = nowAccountSummary.getBigDecimal("afterActivationPrice");
                         BigDecimal yesterdayAfterActivationPrice = yesterdayAccountSummary.getBigDecimal("afterActivationPrice");
@@ -495,8 +494,39 @@ public class AccountReportServiceImpl implements IAccountReportService {
                         } else {
                             chainRatioJson.put("afterActivationPriceProportion", 0);
                         }
+
+
+                        BigDecimal nowEventRegisterCost = nowAccountSummary.getBigDecimal("eventRegisterCost");  // 今日注册成本
+                        BigDecimal yesterdayEventRegisterCost = yesterdayAccountSummary.getBigDecimal("eventRegisterCost"); // 昨日注册成本
+                        if (!Check.isNull(nowEventRegisterCost) && !Check.isNull(yesterdayEventRegisterCost)) {
+                            if (yesterdayEventRegisterCost.compareTo(new BigDecimal(0)) != 0) {
+                                BigDecimal eventRegisterCostProportion = (nowEventRegisterCost.subtract(yesterdayEventRegisterCost)).divide(yesterdayEventRegisterCost, 4, RoundingMode.HALF_UP);
+                                chainRatioJson.put("eventRegisterCostProportion", eventRegisterCostProportion);
+                            } else {
+                                chainRatioJson.put("eventRegisterCostProportion", 0);
+                            }
+                        } else {
+                            chainRatioJson.put("eventRegisterCostProportion", 0);
+                        }
+
+
+                        BigDecimal nowEventRegister = nowAccountSummary.getBigDecimal("eventRegister");  // 今日注册数
+                        BigDecimal yesterdayEventRegister = yesterdayAccountSummary.getBigDecimal("eventRegister"); // 昨日注册数
+                        if (!Check.isNull(nowEventRegister) && !Check.isNull(yesterdayEventRegister)) {
+                            if (yesterdayEventRegister.compareTo(new BigDecimal(0)) != 0) {
+                                BigDecimal eventRegisterProportion = (nowEventRegister.subtract(yesterdayEventRegister)).divide(yesterdayEventRegister, 4, RoundingMode.HALF_UP);
+                                chainRatioJson.put("eventRegisterProportion", eventRegisterProportion);
+                            } else {
+                                chainRatioJson.put("eventRegisterProportion", 0);
+                            }
+                        } else {
+                            chainRatioJson.put("eventRegisterProportion", 0);
+                        }
+
+
                         returnJson.put("chainRatio", chainRatioJson);
                     }
+
                 }
             } else if (type == 2) {
                 queryMap.put("statDate", anotherDay);
@@ -581,6 +611,4 @@ public class AccountReportServiceImpl implements IAccountReportService {
         }
         return returnJson;
     }
-
-
 }