Jelajahi Sumber

首頁,头条版位数据添加

zhaoxian 2 tahun lalu
induk
melakukan
26da9b732c

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

@@ -140,9 +140,7 @@ public class KuaiShouOperateProjectVo {
     private String shangXiaHua;
     private String lianMeng;
     private String xinxiLiu;
-
-
-
+    private String inventory;
 
 
 }

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

@@ -697,10 +697,38 @@
         d.project_id AS projectId,
         d.project_name AS projectName,
         SUM( d.cost ) AS totalCost,
+        t2.inventory,
         ( SELECT realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName
         FROM
         application.bytedance_advertiser_report_hourly_dw d
-        WHERE
+        LEFT JOIN (select project_id,
+        group_concat(concat(inventory_name,':',cost)) as 'inventory'
+        from (
+        select project_id,inventory_name,sum(cost) as cost from
+        application.bytedance_advertiser_inventory_report_daily_dw
+        where cost > 0
+        <if test="startDate != null and startDate != '' ">
+            and stat_datetime &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and stat_datetime &lt;= #{endDate}
+        </if>
+        <if test="projectId != null and projectId != '' ">
+            and project_id = #{projectId}
+        </if>
+        <if test='list!=null and list.size()>0'>
+            AND user_id IN
+            <foreach collection="list" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+
+        group by project_id, inventory_name
+        ORDER BY cost desc
+        )t
+        group by project_id
+        ) t2 on d.project_id = t2.project_id WHERE
         d.cost > 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
@@ -1552,42 +1580,42 @@
                       ) a
                           RIGHT JOIN
                       (
-                          SELECT d.advertiser_id                                                                       dAccountId,
-                                 d.campaign_id                                                                         campaignId,
-                                 d.campaign_name                                                                       campaignName,
-                                 d.unit_id                                                                             dunit_id,
-                                 d.unit_name                                                                           unitName,
-                                 IFNULL(SUM(d.charge), 0)                                                           AS charge,
-                                 IFNULL(SUM(d.activation), 0)                                                       AS activation,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0)                             AS activationPrice,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0)                             AS activationCost,
+                          SELECT d.advertiser_id                                                   dAccountId,
+                                 d.campaign_id                                                     campaignId,
+                                 d.campaign_name                                                   campaignName,
+                                 d.unit_id                                                         dunit_id,
+                                 d.unit_name                                                       unitName,
+                                 IFNULL(SUM(d.charge), 0)                                       AS charge,
+                                 IFNULL(SUM(d.activation), 0)                                   AS activation,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0)         AS activationPrice,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0)         AS activationCost,
                                  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 `leave`,
-                                 IFNULL(SUM(d.event_pay), 0)                                                        AS eventPay,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_pay), 2), 0)                              AS eventPayCost,
+                                    0)                                                          AS `leave`,
+                                 IFNULL(SUM(d.event_pay), 0)                                    AS eventPay,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_pay), 2), 0)          AS eventPayCost,
                                  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 eventPayRate,
-                                 IFNULL(SUM(d.event_new_user_pay), 0)                                               AS eventNewUserPay,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_new_user_pay), 2), 0)                     AS eventNewUserPayCost,
+                                    0)                                                          AS eventPayRate,
+                                 IFNULL(SUM(d.event_new_user_pay), 0)                           AS eventNewUserPay,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_new_user_pay), 2), 0) AS eventNewUserPayCost,
                                  IFNULL(ROUND(SUM(d.event_new_user_pay) / (SUM(d.activation) + SUM(d.form_count)), 2),
-                                        0)                                                                          AS eventNewUserPayRate,
-                                 IFNULL(SUM(d.event_app_invoked), 0)                                                AS eventAppInvoked,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_app_invoked), 2), 0)                      AS eventAppInvokedCost,
-                                 IFNULL(SUM(d.event_register), 0)                                                   AS eventRegister,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_register), 2), 0)                         AS eventRegisterCost,
-                                 IFNULL(SUM(d.key_action), 0)                                                       AS keyAction,
-                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.key_action), 2), 0)                             AS keyActionCost,
+                                        0)                                                      AS eventNewUserPayRate,
+                                 IFNULL(SUM(d.event_app_invoked), 0)                            AS eventAppInvoked,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_app_invoked), 2), 0)  AS eventAppInvokedCost,
+                                 IFNULL(SUM(d.event_register), 0)                               AS eventRegister,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.event_register), 2), 0)     AS eventRegisterCost,
+                                 IFNULL(SUM(d.key_action), 0)                                   AS keyAction,
+                                 IFNULL(ROUND(SUM(d.charge) / SUM(d.key_action), 2), 0)         AS keyActionCost,
                                  IF(SUM(d.key_action) / SUM(d.activation) > 0.0001,
                                     CONCAT(ROUND(SUM(d.key_action) / SUM(d.activation) * 100, 2), '%'),
-                                    0)                                                                              AS keyActionRate,
-                                 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,
-                                 SUM(d.bclick)                                                                         bClick
+                                    0)                                                          AS keyActionRate,
+                                 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,
+                                 SUM(d.bclick)                                                     bClick
                           FROM media_api.kuaishou_unit_report_hourly d
                           WHERE d.advertiser_id = #{accountId}
                             AND d.stat_date = #{nowDate}

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

@@ -498,7 +498,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
                     Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     operate.setNewUnitNum(newUnitNumNow);//组
                     operate.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//组
 
@@ -614,7 +614,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
                     Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     operate.setNewUnitNum(newUnitNumNow);//组
 
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
@@ -724,10 +724,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     int newUnitNumNow = 0;
                     int trustUnitNum = 0;
                     if (startDate == now || entDate == now) {
-
-                        //查询当天数据
-
-
                         //时报 消费
                         //环比 = (当前 - 上阶段 ) / 上阶段
                         int hour = DateUtils.getNowHour();
@@ -763,7 +759,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
                     Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     projectInfo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
@@ -948,11 +944,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
                     Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
-                    List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
-                    projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
+                    List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(), startDate, entDate);
+                    projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0) + "").getLong("num"));//上传到助手
 
 
                     /*
@@ -1592,7 +1588,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, startDate, entDate);
                     Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     groupVo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));
                 } else {
                     //查询 历史上新组
@@ -1746,7 +1742,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                         newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
                         Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                         Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
-                        newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                        newUnitNumNow = Math.addExact(unitNum, unitNum1);
                     } else {
                         //查询 当天有效 上新计划 上新组
                         newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);