Forráskód Böngészése

快手-盯盘-有效、上新修改

yangzian 3 éve
szülő
commit
83015c0d6d

+ 1 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/entity/vo/KuaiShouOperateAccountVo.java

@@ -25,6 +25,7 @@ public class KuaiShouOperateAccountVo {
 
     @ApiModelProperty(value = "运营姓名")
     private String userName;
+    private String userId;
 
     @ApiModelProperty(value = "预算")
     private Double warningAmount;

+ 1 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/entity/vo/KuaiShouOperateProjectVo.java

@@ -25,6 +25,7 @@ public class KuaiShouOperateProjectVo {
 
     @ApiModelProperty(value = "用户数量")
     private Integer userNum;
+    private String userId;
 
     @ApiModelProperty(value = "激活数")
     private Integer activation;

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

@@ -43,6 +43,9 @@ public interface MaterialStareMapper {
     //快手-查询账户数据信息
     List<KuaiShouOperateVo> getKuaiShouOperateInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);
 
+    //查看 快手 有效 计划 组
+    JSONObject getKuaiShouAccountBaseByUserId(@Param("userId")String userId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);
+
     //快手 -查询 项目 数据信息
     List<KuaiShouOperateProjectVo> getKuaiShouOperateProjectInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("projectId")String projectId,@Param("list")Set<String> operatorUserIds);
 

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

@@ -143,6 +143,27 @@
         </if>
     </select>
 
+    <!-- 查看 快手 有效 计划 组-->
+    <select id="getKuaiShouAccountBaseByUserId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT abi.account_id ,
+        SUM(abi.new_effect_num) as newEffectNum,
+        SUM(abi.new_campaign_num) as newCampaignNum,
+        SUM(abi.new_unit_num) as newUnitNum,
+        SUM( abi.new_video_num ) AS newVideoNum,
+        SUM( abi.new_hot_num ) AS newHotNum
+        from application.app_kuaishou_account_base_info_d abi,
+        `jeecg-boot`.ctop_user_allocation u
+        WHERE abi.account_id = u.account_id
+        and u.account_status = 0
+        and abi.user_id = #{userId}
+        <if test="startDate != null and startDate != '' ">
+            and abi.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and abi.stat_date &lt;= #{endDate}
+        </if>
+    </select>
+
 
 
     <!-- 快手 快手-查询账户数据信息 -->
@@ -151,32 +172,13 @@
         SUM( d.charge ) totalCost,
         COUNT(DISTINCT d.account_id) accountNum,
         d.user_id as userId,
-        (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName,
-        IFNULL(m.newEffectNum,0) as newEffectNum,
-        IFNULL(m.newCampaignNum,0) as newCampaignNum,
-        IFNULL(m.newUnitNum,0) as newUnitNum
+        (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN
-        (
-        SELECT abi.account_id ,
-        SUM(abi.new_effect_num) as newEffectNum,
-        SUM(abi.new_campaign_num) as newCampaignNum,
-        SUM(abi.new_unit_num) as newUnitNum
-        from application.app_kuaishou_account_base_info_d abi
-            <where>
-                <if test="startDate != null and startDate != '' ">
-                    and abi.stat_date &gt;= #{startDate}
-                </if>
-                <if test="endDate != null and endDate != '' ">
-                    and abi.stat_date &lt;= #{endDate}
-                </if>
-            </where>
-            GROUP BY abi.account_id
-        ) m
-        on d.account_id = m.account_id
+        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
+        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -201,6 +203,7 @@
         COUNT( DISTINCT d.account_id ) AS accountNum,
         d.project_id AS projectId,
         d.project_name AS projectName,
+        d.user_id AS userId,
         COUNT( DISTINCT d.user_id ) AS userNum,
         IFNULL(SUM( d.activation ),0)  AS activation,
         IF(SUM( d.charge ) / SUM( d.activation ) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
@@ -221,33 +224,13 @@
         IFNULL(SUM( d.event_pay_purchase_amount_first_day ),0)  AS eventPayPurchaseAmountFirstDay,
         IFNULL(SUM( d.event_pay_first_day_roi ),0)  AS eventPayFirstDayRoi,
         IFNULL(SUM( d.form_count ),0) AS formCount,
-        IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice,
-        IFNULL(m.newEffectNum,0) AS newEffectNum,
-        IFNULL(m.newVideoNum,0) AS newVideoNum,
-        IFNULL(m.newHotNum,0) AS newHotNum
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN (
-            SELECT
-            abi.account_id,
-            SUM( abi.new_effect_num ) AS newEffectNum,
-            SUM( abi.new_video_num ) AS newVideoNum,
-            SUM( abi.new_hot_num ) AS newHotNum
-            FROM
-            application.app_kuaishou_account_base_info_d abi
-            <where>
-                    <if test="startDate != null and startDate != '' ">
-                        and abi.stat_date &gt;= #{startDate}
-                    </if>
-                    <if test="endDate != null and endDate != '' ">
-                        and abi.stat_date &lt;= #{endDate}
-                    </if>
-                </where>
-                GROUP BY abi.account_id
-        ) m
-        on d.account_id = m.account_id
+        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
+        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -278,6 +261,7 @@
         d.account_name as accountName,
         d.project_id AS projectId,
         d.project_name AS projectName,
+        d.user_id AS userId,
         COUNT( DISTINCT d.user_id ) AS userNum,
         ( SELECT u.realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName,
         (SELECT u.warning_amount FROM `jeecg-boot`.ctop_user_allocation u where u.account_id = d.account_id) as warningAmount,
@@ -303,33 +287,13 @@
         IFNULL(SUM( d.form_count ),0) AS formCount,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice,
         IFNULL(SUM(d.`show`),0) as photoShow,
-        IFNULL(SUM(d.photo_click),0) as photoClick,
-        IFNULL(m.newEffectNum,0) AS newEffectNum,
-        IFNULL(m.newVideoNum,0) AS newVideoNum,
-        IFNULL(m.newHotNum,0) AS newHotNum
+        IFNULL(SUM(d.photo_click),0) as photoClick
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN (
-            SELECT
-            abi.account_id,
-            SUM( abi.new_effect_num ) AS newEffectNum,
-            SUM( abi.new_video_num ) AS newVideoNum,
-            SUM( abi.new_hot_num ) AS newHotNum
-            FROM
-            application.app_kuaishou_account_base_info_d abi
-            <where>
-                    <if test="startDate != null and startDate != '' ">
-                        and abi.stat_date &gt;= #{startDate}
-                    </if>
-                    <if test="endDate != null and endDate != '' ">
-                        and abi.stat_date &lt;= #{endDate}
-                    </if>
-                </where>
-                GROUP BY abi.account_id
-        ) m
-        on d.account_id = m.account_id
+        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
+        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>

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

@@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -366,6 +367,15 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         //查询运营数据
         List<KuaiShouOperateVo> listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
         for (KuaiShouOperateVo operate : listOperate) {
+
+            //查询 有效 上新计划 上新组
+            JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operate.getUserId(),startDate,entDate);
+            if (Check.isNull(newEffect)){
+                operate.setNewEffectNum(newEffect.getInteger("newEffectNum"));//有效
+                operate.setNewCampaignNum(newEffect.getInteger("newCampaignNum"));//计划
+                operate.setNewUnitNum(newEffect.getInteger("newUnitNum"));//组
+            }
+
             Set<String> userSet = new HashSet<String>(){{
                 add(operate.getUserId());
             }};
@@ -403,6 +413,15 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         //查询运营数据
         List<KuaiShouOperateVo> listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
         for (KuaiShouOperateVo operate : listOperate) {
+
+            //查询 有效 上新计划 上新组
+            JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operate.getUserId(),startDate,entDate);
+            if (Check.isNull(newEffect)){
+                operate.setNewEffectNum(newEffect.getInteger("newEffectNum"));//有效
+                operate.setNewCampaignNum(newEffect.getInteger("newCampaignNum"));//计划
+                operate.setNewUnitNum(newEffect.getInteger("newUnitNum"));//组
+            }
+
             Set<String> userSet = new HashSet<String>(){{
                 add(operate.getUserId());
             }};
@@ -469,6 +488,16 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             //查询运营数据-项目维度
             List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
             for (KuaiShouOperateProjectVo projectInfo : listOperate) {
+
+                //查询 有效 上新视频 爆款视频
+                JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(projectInfo.getUserId(),startDate,entDate);
+                if (Check.isNull(newEffect)){
+                    projectInfo.setNewEffectNum(newEffect.getInteger("newEffectNum"));//有效
+                    projectInfo.setNewVideoNum(newEffect.getInteger("newVideoNum"));//上新
+                    projectInfo.setNewHotNum(newEffect.getInteger("newHotNum"));//爆款
+                }
+
+
                 String projectId = projectInfo.getProjectId();
                 List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
                 //环比 = (当前 - 上阶段 ) / 上阶段
@@ -543,6 +572,16 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             //查询运营数据-账户 维度
             List<KuaiShouOperateAccountVo> listOperate = materialStareMapper.getKuaiShouOperateAccountInfo(startDate,entDate,projectId,null,operatorUserIds);
             for (KuaiShouOperateAccountVo accountInfo : listOperate) {
+
+                //查询 有效 上新视频 爆款视频
+                JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(accountInfo.getUserId(),startDate,entDate);
+                if (Check.isNull(newEffect)){
+                    accountInfo.setNewEffectNum(newEffect.getInteger("newEffectNum"));//有效
+                    accountInfo.setNewVideoNum(newEffect.getInteger("newVideoNum"));//上新
+                    accountInfo.setNewHotNum(newEffect.getInteger("newHotNum"));//爆款
+                }
+
+
                 long accountId = accountInfo.getAccountId();
                 List<KuaiShouOperateAccountVo> accountYearOnYearInfo = materialStareMapper.getKuaiShouOperateAccountInfo(lastTimeStart,lastTimeEnd,projectId,accountId,operatorUserIds);
                 //环比 = (当前 - 上阶段 ) / 上阶段