瀏覽代碼

整合头条基建数

zhaoxian 2 年之前
父節點
當前提交
2eca7eb023

+ 16 - 9
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BytedanceAccountReportDailyDwMapper.xml

@@ -149,7 +149,10 @@
         </if>
         </if>
         ) t7 ON t1.project_id = t7.project_id
         ) t7 ON t1.project_id = t7.project_id
         LEFT JOIN (
         LEFT JOIN (
-        SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
+        SELECT project_id,
+               IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',
+               SUM(new_cpd_project_num) as 'projectNum'
+        FROM
         application.app_bytedance_account_base_info_d
         application.app_bytedance_account_base_info_d
         WHERE stat_date =DATE_FORMAT(DATE_SUB(#{startTime}, INTERVAL 1 DAY ), '%Y%m%d')
         WHERE stat_date =DATE_FORMAT(DATE_SUB(#{startTime}, INTERVAL 1 DAY ), '%Y%m%d')
         AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
         AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
@@ -242,7 +245,11 @@
         </if>
         </if>
         ) t6 ON t1.project_id = t6.project_id
         ) t6 ON t1.project_id = t6.project_id
         LEFT JOIN (
         LEFT JOIN (
-        SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
+        SELECT
+               project_id,
+               IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',
+               SUM(new_cpd_project_num) as 'projectNum'
+        FROM
         application.app_bytedance_account_base_info_d
         application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startTime}
         WHERE stat_date >= #{startTime}
         AND stat_date &lt;= #{endTime}
         AND stat_date &lt;= #{endTime}
@@ -331,7 +338,7 @@
 
 
     <select id="getToutiaoOperateInfoHourly" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getToutiaoOperateInfoHourly" resultType="com.alibaba.fastjson.JSONObject">
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
-        COUNT(DISTINCT t.project_id) 'projectNum',
+        COUNT(DISTINCT t.project_id) 'projectNums',
         SUM(t.cost) 'totalCost',
         SUM(t.cost) 'totalCost',
         t.user_id as 'userId',
         t.user_id as 'userId',
         t2.realname as 'userName',
         t2.realname as 'userName',
@@ -383,7 +390,7 @@
 
 
     <select id="getToutiaoOperateInfo" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getToutiaoOperateInfo" resultType="com.alibaba.fastjson.JSONObject">
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
-        COUNT(DISTINCT t.project_id) 'projectNum',
+        COUNT(DISTINCT t.project_id) 'projectNums',
         SUM(t.cost) 'totalCost',
         SUM(t.cost) 'totalCost',
         t.user_id as 'userId',
         t.user_id as 'userId',
         t2.realname as 'userName',
         t2.realname as 'userName',
@@ -413,7 +420,7 @@
         ) t3 ON t.user_id = t3.user_id
         ) t3 ON t.user_id = t3.user_id
         LEFT JOIN (
         LEFT JOIN (
         SELECT user_id,
         SELECT user_id,
-        IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(trust_unit_num),0) as 'newUnitNum',
+        IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(trust_unit_num),0) + IFNULL(SUM(promotion_num),0)  as 'newUnitNum',
         IFNULL(SUM(new_campaign_num),0) as 'newCampaignNum',
         IFNULL(SUM(new_campaign_num),0) as 'newCampaignNum',
         SUM(new_cpd_project_num) as 'projectNum'
         SUM(new_cpd_project_num) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
         FROM application.app_bytedance_account_base_info_d
@@ -447,7 +454,7 @@
         SELECT
         SELECT
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
-        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNum',
+        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNums',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         t3.lastCost,
         t3.lastCost,
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
@@ -501,7 +508,7 @@
         </if>
         </if>
         ) t3 ON 1 = 1
         ) t3 ON 1 = 1
         LEFT JOIN (
         LEFT JOIN (
-        SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
+        SELECT IFNULL(SUM(new_ad_num),0) +IFNULL(SUM(promotion_num),0)  as 'unitNum',
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
         FROM application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startDate}
         WHERE stat_date >= #{startDate}
@@ -520,7 +527,7 @@
         SELECT
         SELECT
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
-        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNum',
+        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNums',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         t3.lastCost,
         t3.lastCost,
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
@@ -572,7 +579,7 @@
         </if>
         </if>
         ) t3 ON 1 = 1
         ) t3 ON 1 = 1
         LEFT JOIN (
         LEFT JOIN (
-        SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
+        SELECT IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(promotion_num),0)  as 'unitNum',
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
         FROM application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startDate}
         WHERE stat_date >= #{startDate}

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

@@ -323,7 +323,8 @@
         IFNULL(SUM( abi.new_video_num ),0) AS newVideoNum,
         IFNULL(SUM( abi.new_video_num ),0) AS newVideoNum,
         IFNULL(SUM( abi.new_hot_num ),0) AS newHotNum,
         IFNULL(SUM( abi.new_hot_num ),0) AS newHotNum,
         IFNULL(SUM( abi.new_cpd_project_num ),0) AS newCpdProjectNum,
         IFNULL(SUM( abi.new_cpd_project_num ),0) AS newCpdProjectNum,
-        IFNULL(SUM( abi.new_ad_num ),0) AS newUnitNum
+        IFNULL(SUM( abi.new_ad_num ),0) AS newUnitNum,
+        IFNULL(SUM( abi.promotion_num ),0) AS newUnitNum2
         from application.app_bytedance_account_base_info_d abi,
         from application.app_bytedance_account_base_info_d abi,
         `jeecg-boot`.ctop_user_allocation u
         `jeecg-boot`.ctop_user_allocation u
         WHERE abi.account_id = u.account_id
         WHERE abi.account_id = u.account_id

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

@@ -496,7 +496,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
-                    operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum") + newUnitNumNow);//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    operate.setNewUnitNum(newUnitNumNow);//组
                     operate.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//组
                     operate.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//组
 
 
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
@@ -609,7 +612,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
-                    operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum") + newUnitNumNow);//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    operate.setNewUnitNum(newUnitNumNow);//组
 
 
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
                     List<KuaiShouOperateVo> userOperate = materialStareMapper.getBytedanceOperateInfo(lastTimeStart, lastTimeEnd, ids);
                     List<KuaiShouOperateVo> userOperate = materialStareMapper.getBytedanceOperateInfo(lastTimeStart, lastTimeEnd, ids);
@@ -755,7 +761,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
-                    projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     projectInfo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//基建数
                     projectInfo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
 
 
@@ -937,7 +946,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     //projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     //projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
-                    projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
 
 
 
 
@@ -1576,7 +1588,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
 
 
                 if (mediaType.equals("1")) {
                 if (mediaType.equals("1")) {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, startDate, entDate);
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, startDate, entDate);
-                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
                     groupVo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));
                     groupVo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));
                 } else {
                 } else {
                     //查询 历史上新组
                     //查询 历史上新组
@@ -1728,11 +1742,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     if (mediaType.equals("1")) {
                     if (mediaType.equals("1")) {
                         //查询 当天有效 上新计划 上新组
                         //查询 当天有效 上新计划 上新组
                         newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
                         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);
                     } else {
                     } else {
                         //查询 当天有效 上新计划 上新组
                         //查询 当天有效 上新计划 上新组
                         newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
                         newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
+                        newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     }
                     }
-                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                 }
                 }
 
 
                 if (mediaType.equals("1")) {
                 if (mediaType.equals("1")) {