Sfoglia il codice sorgente

盯盘-账户-折线图

yangzian 3 anni fa
parent
commit
505b031ea0

+ 3 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouMaterialStareController.java

@@ -180,8 +180,9 @@ public class KuaiShouMaterialStareController {
     @GetMapping("/getKuaiShouAccountInfoBrokenLine")
     public Result<JSONObject> getKuaiShouAccountInfoBrokenLine(@RequestParam(name="accountId") long accountId,
                                                      @RequestParam(name="startTime") String startTime,
-                                                     @RequestParam(name="endTime") String endTime) {
-        return materialStareService.getKuaiShouAccountInfoBrokenLine(accountId,startTime,endTime);
+                                                     @RequestParam(name="endTime") String endTime,
+                                                     @RequestParam(name="type") String type) {
+        return materialStareService.getKuaiShouAccountInfoBrokenLine(accountId,startTime,endTime,type);
     }
 
 

+ 2 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java

@@ -57,9 +57,9 @@ public interface MaterialStareMapper {
     JSONObject getKuaiShouAccountTotalCost(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
 
     //快手 账户趋势图-时报
-    List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
+    List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("type")String type,@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
     //快手 账户趋势图-日报
-    List<JSONObject> getKuaiShouAccountInfoBrokenLineDaily(@Param("accountId")Long accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);
+    List<JSONObject> getKuaiShouAccountInfoBrokenLineDaily(@Param("type")String type,@Param("accountId")Long accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);
 
     //快手 账户 素材上新-有效-爆款   searchType: 0-全部 1-上新 2-有效 3-爆款
     List<JSONObject> getKuaiShouAccountMaterialNewAndEffectAndFaddish(@Param("accountId")Long accountId,@Param("searchType")String searchType,@Param("startDate")Long startDate, @Param("endDate")Long endDate);

+ 208 - 12
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -396,10 +396,77 @@
             (
                 SELECT
                     h.`hour` as tHour,
-                    h.charge AS tCost,
-                    IFNULL( ROUND(( h.charge / h.activation ), 2 ), 0 ) AS tActivationPrice,
-                    IFNULL( ROUND(( h.charge / h.event_new_user_pay ), 2 ), 0 ) AS tEventNewUserPayCost,
-                    IFNULL( ROUND( ( h.event_next_day_stay / h.activation ), 2 ), 0 ) AS tLeave
+                    <if test='type == "cost"'>
+                        h.charge AS tData,
+                    </if>
+                    <if test='type == "activation"'>
+                        IFNULL(h.activation,0) AS tData ,
+                    </if>
+                    <if test='type == "activationPrice"'>
+                        IFNULL(ROUND( (h.charge  /  h.activation) , 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "leave"'>
+                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,CONCAT(ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),'%'),0) AS tData,
+                    </if>
+                    <if test='type == "eventPay"'>
+                        IFNULL( h.event_pay ,0) AS tData,
+                    </if>
+                    <if test='type == "eventPayCost"'>
+                        IFNULL(ROUND(  (h.charge  /  h.event_pay ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "eventPayRate"'>
+                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,CONCAT(ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),'%'),0) AS tData,
+                    </if>
+                    <if test='type == "eventNewUserPay"'>
+                        IFNULL( h.event_new_user_pay ,0) AS tData,
+                    </if>
+                    <if test='type == "eventNewUserPayCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_new_user_pay ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "eventNewUserPayRate"'>
+                        IFNULL(ROUND( ( h.event_new_user_pay  /   h.activation  +  h.form_count ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "eventAppInvoked"'>
+                        IFNULL( h.event_app_invoked ,0) AS tData,
+                    </if>
+                    <if test='type == "eventAppInvokedCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_app_invoked ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "eventRegister"'>
+                        IFNULL( h.event_register ,0) AS tData,
+                    </if>
+                    <if test='type == "eventRegisterCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_register) , 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "keyAction"'>
+                        IFNULL( h.key_action ,0) AS tData,
+                    </if>
+                    <if test='type == "keyActionCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.key_action ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "keyActionRate"'>
+                        IF(( h.key_action /  h.activation ) > 0.0001,CONCAT( ROUND(( h.key_action / h.activation ) * 100 , 2 ), '%' ),0) AS tData,
+                    </if>
+                    <if test='type == "eventPayPurchaseAmountFirstDay"'>
+                        IFNULL( h.event_pay_purchase_amount_first_day ,0) AS tData,
+                    </if>
+                    <if test='type == "eventPayFirstDayRoi"'>
+                        IFNULL( h.event_pay_first_day_roi ,0) AS tData,
+                    </if>
+                    <if test='type == "formCount"'>
+                        IFNULL( h.form_count ,0) AS tData,
+                    </if>
+                    <if test='type == "formCountPrice"'>
+                        IFNULL(ROUND( ( h.charge /  h.form_count ), 2 ),0) AS tData,
+                    </if>
+                    <if test='type == "photoShow"'>
+                        IFNULL(h.`show`,0) as tData,
+                    </if>
+                    <if test='type == "photoClick"'>
+                        IFNULL(h.photo_click,0) as tData,
+                    </if>
+                    h.account_id as tAccountId
+
                 FROM
                     application.kuaishou_account_report_hourly_dw h
                 <where>
@@ -416,10 +483,76 @@
             (
                 SELECT
                     h.`hour` as yHour,
-                    h.charge AS yCost,
-                    IFNULL( ROUND(( h.charge / h.activation ), 2 ), 0 ) AS yActivationPrice,
-                    IFNULL( ROUND(( h.charge / h.event_new_user_pay ), 2 ), 0 ) AS yEventNewUserPayCost,
-                    IFNULL( ROUND( ( h.event_next_day_stay / h.activation ), 2 ), 0 ) AS yLeave
+                    <if test='type == "cost"'>
+                        h.charge AS yData,
+                    </if>
+                    <if test='type == "activation"'>
+                        IFNULL(h.activation,0) AS yData ,
+                    </if>
+                    <if test='type == "activationPrice"'>
+                        IFNULL(ROUND( (h.charge  /  h.activation) , 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "leave"'>
+                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,CONCAT(ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),'%'),0) AS yData,
+                    </if>
+                    <if test='type == "eventPay"'>
+                        IFNULL( h.event_pay ,0) AS yData,
+                    </if>
+                    <if test='type == "eventPayCost"'>
+                        IFNULL(ROUND(  (h.charge  /  h.event_pay ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "eventPayRate"'>
+                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,CONCAT(ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),'%'),0) AS yData,
+                    </if>
+                    <if test='type == "eventNewUserPay"'>
+                        IFNULL( h.event_new_user_pay ,0) AS yData,
+                    </if>
+                    <if test='type == "eventNewUserPayCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_new_user_pay ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "eventNewUserPayRate"'>
+                        IFNULL(ROUND( ( h.event_new_user_pay  /   h.activation  +  h.form_count ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "eventAppInvoked"'>
+                        IFNULL( h.event_app_invoked ,0) AS yData,
+                    </if>
+                    <if test='type == "eventAppInvokedCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_app_invoked ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "eventRegister"'>
+                        IFNULL( h.event_register ,0) AS yData,
+                    </if>
+                    <if test='type == "eventRegisterCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.event_register) , 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "keyAction"'>
+                        IFNULL( h.key_action ,0) AS yData,
+                    </if>
+                    <if test='type == "keyActionCost"'>
+                        IFNULL(ROUND( ( h.charge  /  h.key_action ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "keyActionRate"'>
+                        IF(( h.key_action /  h.activation ) > 0.0001,CONCAT( ROUND(( h.key_action / h.activation ) * 100 , 2 ), '%' ),0) AS yData,
+                    </if>
+                    <if test='type == "eventPayPurchaseAmountFirstDay"'>
+                        IFNULL( h.event_pay_purchase_amount_first_day ,0) AS yData,
+                    </if>
+                    <if test='type == "eventPayFirstDayRoi"'>
+                        IFNULL( h.event_pay_first_day_roi ,0) AS yData,
+                    </if>
+                    <if test='type == "formCount"'>
+                        IFNULL( h.form_count ,0) AS yData,
+                    </if>
+                    <if test='type == "formCountPrice"'>
+                        IFNULL(ROUND( ( h.charge /  h.form_count ), 2 ),0) AS yData,
+                    </if>
+                    <if test='type == "photoShow"'>
+                        IFNULL(h.`show`,0) as yData,
+                    </if>
+                    <if test='type == "photoClick"'>
+                        IFNULL(h.photo_click,0) as yData,
+                    </if>
+                    h.account_id as yAccountId
                 FROM
                     application.kuaishou_account_report_hourly_dw h
                 <where>
@@ -441,10 +574,73 @@
     <select id="getKuaiShouAccountInfoBrokenLineDaily" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             DATE_FORMAT(d.stat_date,'%Y-%m-%d') as dateTime,
-            SUM( d.charge ) as cost,
-            IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
-            IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ), 0 ) AS eventNewUserPayCost,
-            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
+            <if test='type == "cost"'>
+                SUM( d.charge ) as data,
+            </if>
+            <if test='type == "activation"'>
+                IFNULL(SUM( d.activation ),0) AS data,
+            </if>
+            <if test='type == "activationPrice"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS data,
+            </if>
+            <if test='type == "leave"'>
+                IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%'),0) AS data,
+            </if>
+            <if test='type == "eventPay"'>
+                IFNULL(SUM( d.event_pay ),0) AS data,
+            </if>
+            <if test='type == "eventPayCost"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS data,
+            </if>
+            <if test='type == "eventPayRate"'>
+                IF(SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) > 0.0001,CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0) AS data,
+            </if>
+            <if test='type == "eventNewUserPay"'>
+                IFNULL(SUM( d.event_new_user_pay ),0) AS data,
+            </if>
+            <if test='type == "eventNewUserPayCost"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ),0) AS data,
+            </if>
+            <if test='type == "eventNewUserPayRate"'>
+                IFNULL(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ),0) AS data,
+            </if>
+            <if test='type == "eventAppInvoked"'>
+                IFNULL(SUM( d.event_app_invoked ),0) AS data,
+            </if>
+            <if test='type == "eventAppInvokedCost"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ),0) AS data,
+            </if>
+            <if test='type == "eventRegister"'>
+                IFNULL(SUM( d.event_register ),0) AS data,
+            </if>
+            <if test='type == "eventRegisterCost"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS data,
+            </if>
+            <if test='type == "keyAction"'>
+                IFNULL(SUM( d.key_action ),0) AS data,
+            </if>
+            <if test='type == "keyActionCost"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS data,
+            </if>
+            <if test='type == "keyActionRate"'>
+                IF(SUM( d.key_action )/ SUM( d.activation ) > 0.0001,CONCAT( ROUND(SUM( d.key_action )/ SUM( d.activation ) * 100 , 2 ), '%' ),0) AS data,
+            </if>
+            <if test='type == "eventPayPurchaseAmountFirstDay"'>
+                IFNULL(SUM( d.event_pay_purchase_amount_first_day ),0) AS data,
+            </if>
+            <if test='type == "eventPayFirstDayRoi"'>
+                IFNULL(SUM( d.event_pay_first_day_roi ),0) AS data,
+            </if>
+            <if test='type == "formCount"'>
+                IFNULL(SUM( d.form_count ),0) AS data,
+            </if>
+            <if test='type == "formCountPrice"'>
+                IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS data,
+            </if>
+            <if test='type == "photoShow"'>
+                IFNULL(SUM(d.`show`),0) as data
+            </if>
+            d.account_id as accountId
         FROM
             application.kuaishou_account_report_daily_dw d
         <where>

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/MaterialStareService.java

@@ -27,7 +27,7 @@ public interface MaterialStareService {
 
     Result getKuaiShouAccountInfo(long accountId);
 
-    Result getKuaiShouAccountInfoBrokenLine(long accountId,String startTime, String endTime);
+    Result getKuaiShouAccountInfoBrokenLine(long accountId,String startTime, String endTime,String type);
 
     Result getKuaiShouAccountMaterialNewAndEffectAndFaddish(long accountId,String searchType,String startTime, String endTime,Integer pageNum,Integer pageSize);
 

+ 3 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -602,7 +602,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
      * @time: 2022/2/21
      */
     @Override
-    public Result getKuaiShouAccountInfoBrokenLine(long accountId, String startTime, String endTime) {
+    public Result getKuaiShouAccountInfoBrokenLine(long accountId, String startTime, String endTime,String type) {
 
         List<JSONObject> resultList = new ArrayList<>();
         try {
@@ -617,10 +617,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             if (daysBetween == 0){
                 //昨天
                 long yesterday = DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(entDate), -1));
-                resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineHour(accountId,startDate,yesterday);
+                resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineHour(type,accountId,startDate,yesterday);
                 return Result.successMsg("账户时报报折线图查询成功",resultList);
             }
-            resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineDaily(accountId,startDate,entDate);
+            resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineDaily(type,accountId,startDate,entDate);
             return Result.successMsg("账户日报折线图查询成功",resultList);
 
         }catch (Exception e){