Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/V2.0.1' into V2.0.1

zhaoxian 2 rokov pred
rodič
commit
65d8d14fd7

+ 11 - 11
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/ManagerSaleValueMapper.xml

@@ -24,7 +24,7 @@
     </select>
     </select>
 
 
     <select id="queryList" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryList" resultType="com.alibaba.fastjson.JSONObject">
-        select company_id as 'companyId',company_name as 'companyName'
+        select id as 'companyId',company_name as 'companyName'
         from `jeecg-boot`.sys_manager_company
         from `jeecg-boot`.sys_manager_company
     </select>
     </select>
 
 
@@ -91,10 +91,10 @@
         FROM `jeecg-boot`.ctop_project
         FROM `jeecg-boot`.ctop_project
         WHERE company_id = #{companyId}
         WHERE company_id = #{companyId}
         <if test='mediaId ==2'>
         <if test='mediaId ==2'>
-            AND (media_id = 2 or media_id = 4)
+           and  media_id in(2,4)
         </if>
         </if>
         <if test='mediaId ==1'>
         <if test='mediaId ==1'>
-            AND (media_id = 1 or media_id = 3)
+            AND media_id in(1,3)
         </if>
         </if>
         <if test="userIds !=null and userIds.size()>0">
         <if test="userIds !=null and userIds.size()>0">
             AND sale_id IN
             AND sale_id IN
@@ -220,10 +220,10 @@
         FROM `jeecg-boot`.ctop_project
         FROM `jeecg-boot`.ctop_project
         WHERE company_id = #{companyId}
         WHERE company_id = #{companyId}
         <if test='mediaId ==2'>
         <if test='mediaId ==2'>
-            AND (media_id = 2 or media_id = 4)
+            AND media_id in(2,4)
         </if>
         </if>
         <if test='mediaId ==1'>
         <if test='mediaId ==1'>
-            AND (media_id = 1 or media_id = 3)
+            AND media_id in(1,3)
         </if>
         </if>
         )
         )
         AND user_id in (select id
         AND user_id in (select id
@@ -266,10 +266,10 @@
         FROM `jeecg-boot`.ctop_project
         FROM `jeecg-boot`.ctop_project
         WHERE company_id = #{companyId}
         WHERE company_id = #{companyId}
         <if test='mediaId ==2'>
         <if test='mediaId ==2'>
-            AND (media_id = 2 or media_id = 4)
+            AND in(2,4)
         </if>
         </if>
         <if test='mediaId ==1'>
         <if test='mediaId ==1'>
-            AND (media_id = 1 or media_id = 3)
+            AND media_id in(1,3)
         </if>
         </if>
         )
         )
         AND user_id in (select id
         AND user_id in (select id
@@ -378,10 +378,10 @@
         FROM `jeecg-boot`.ctop_project
         FROM `jeecg-boot`.ctop_project
         WHERE company_id = #{companyId}
         WHERE company_id = #{companyId}
         <if test='mediaId ==2'>
         <if test='mediaId ==2'>
-            AND (media_id = 2 or media_id = 4)
+            AND media_id in(2,4)
         </if>
         </if>
         <if test='mediaId ==1'>
         <if test='mediaId ==1'>
-            AND (media_id = 1 or media_id = 3)
+            AND media_id in(1,3)
         </if>
         </if>
         )
         )
         AND user_id in (select id
         AND user_id in (select id
@@ -421,10 +421,10 @@
         FROM `jeecg-boot`.ctop_project
         FROM `jeecg-boot`.ctop_project
         WHERE company_id = #{companyId}
         WHERE company_id = #{companyId}
         <if test='mediaId ==2'>
         <if test='mediaId ==2'>
-            AND (media_id = 2 or media_id = 4)
+            AND media_id in(2,4)
         </if>
         </if>
         <if test='mediaId ==1'>
         <if test='mediaId ==1'>
-            AND (media_id = 1 or media_id = 3)
+            AND media_id in(1,3)
         </if>
         </if>
         )
         )
         AND user_id in (select id
         AND user_id in (select id

+ 44 - 59
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialReportOverViewV3Mapper.xml

@@ -642,74 +642,59 @@
     </select>
     </select>
 
 
     <select id="queryKuaishouTopDesign" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryKuaishouTopDesign" resultType="com.alibaba.fastjson.JSONObject">
-
-        select SUM(t1.charge ) as 'cost',
-        <if test="type == 1">t1.shot_name as userName, "摄像" as roleName</if>
-        <if test="type == 2">t1.clip_name as userName, "剪辑" as roleName</if>
-        <if test="type == 3">t1.plan_name as userName, "编导" as roleName</if>
-        from
-        application.kuaishou_material_video_report_daily_dw t1
-
-        left JOIN sys_user t2 on
-        <if test="type == 1">t1.shot_id =t2.id</if>
-        <if test="type == 2">t1.clip_id =t2.id</if>
-        <if test="type == 3">t1.plan_id =t2.id</if>
-        <where>
-            t1.stat_date >= #{startDate} and t1.stat_date &lt;= #{endDate} and t1.company_id=#{companyId} and
-            t2.status=1
-        </where>
-        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and
-            t1.shot_name != '' GROUP BY t1.shot_id
+        select t1.* from (
+        select sum(charge) as 'cost',
+        <if test="type == 1">shot_name as userName, "摄像" as roleName,shot_id as 'userId'</if>
+        <if test="type == 2">clip_name as userName, "剪辑" as roleName,clip_id as 'userId'</if>
+        <if test="type == 3">plan_name as userName, "编导" as roleName,plan_id as 'userId'</if>
+        from application.kuaishou_material_video_report_daily_dw
+        where 1 = 1
+        and stat_date >= #{startDate}
+        and stat_date &lt;= #{endDate}
+        and company_id = #{companyId}
+        <if test="type == 1">
+            and shot_id is not null
+            group by shot_id
         </if>
         </if>
-        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and
-            t1.clip_name != '' GROUP BY t1.clip_id
+        <if test="type == 2">
+            and clip_id is not null
+            group by clip_id
         </if>
         </if>
-        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and
-            t1.plan_name != '' GROUP BY t1.plan_id
+        <if test="type == 3">
+            and plan_id is not null
+            group by plan_id
         </if>
         </if>
-        ORDER BY cost desc
-
+        ) t1 left join `jeecg-boot`.sys_user t2 on t1.userId = t2.id
+        where t2.status = 1
+        order by t1.cost desc
     </select>
     </select>
 
 
     <select id="queryBytedanceTopDesign" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceTopDesign" resultType="com.alibaba.fastjson.JSONObject">
-        select SUM(t1.cost ) as 'cost',
-        <if test="type == 1">t1.shot_name as userName, "摄像" as roleName,</if>
-        <if test="type == 2">t1.clip_name as userName, "剪辑" as roleName,</if>
-        <if test="type == 3">t1.plan_name as userName, "编导" as roleName,</if>
-        IFNULL(COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null)),0) as
-        'videoHotCount',
-
-        ifnull( COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null))/
-        (SELECT COUNT(0) from application.app_bytedance_material_info where faddish_date >= #{startDate} and
-        faddish_date &lt;=
-        #{endDate} and company_id=#{companyId})*0.4,0)+
-        ifnull(SUM(t1.cost)/
-        (SELECT SUM(cost) from application.bytedance_material_video_report_daily_dw where stat_datetime
-        >= #{startDate} and stat_datetime &lt;= #{endDate}
-        )*0.6 ,0) as sort
-        from
-        application.app_bytedance_material_info t
-        LEFT JOIN application.bytedance_material_video_report_daily_dw t1 on t.material_id=t1.signature
-
-        left JOIN sys_user t2 on
-        <if test="type == 1">t1.shot_id =t2.id</if>
-        <if test="type == 2">t1.clip_id =t2.id</if>
-        <if test="type == 3">t1.plan_id =t2.id</if>
-
-        <where>
-            t1.stat_datetime >= #{startDate} and t1.stat_datetime &lt;= #{endDate} and t.company_id=#{companyId} and
-            t1.company_id=#{companyId} and t2.status=1
-        </where>
-        <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and
-            t1.shot_name != '' GROUP BY t1.shot_id
+        select t1.* from (
+        select sum(cost) as 'cost',
+        <if test="type == 1">shot_name as userName, "摄像" as roleName,shot_id as 'userId'</if>
+        <if test="type == 2">clip_name as userName, "剪辑" as roleName,clip_id as 'userId'</if>
+        <if test="type == 3">plan_name as userName, "编导" as roleName,plan_id as 'userId'</if>
+        from application.bytedance_material_video_report_daily_dw
+        where 1 = 1
+        and stat_datetime >= #{startDate}
+        and stat_datetime &lt;= #{endDate}
+        and company_id = #{companyId}
+        <if test="type == 1">
+            and shot_id is not null
+            group by shot_id
         </if>
         </if>
-        <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and
-            t1.clip_name != '' GROUP BY t1.clip_id
+        <if test="type == 2">
+            and clip_id is not null
+            group by clip_id
         </if>
         </if>
-        <if test="type == 3">AND t1.plan_id is not null and t1.plan_id != '' AND t1.plan_name is not null and
-            t1.plan_name != '' GROUP BY t1.plan_id
+        <if test="type == 3">
+            and plan_id is not null
+            group by plan_id
         </if>
         </if>
-        ORDER BY sort desc
+        ) t1 left join `jeecg-boot`.sys_user t2 on t1.userId = t2.id
+        where t2.status = 1
+        order by t1.cost desc
     </select>
     </select>
 
 
     <select id="queryBytedanceTopMaterialNew" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryBytedanceTopMaterialNew" resultType="com.alibaba.fastjson.JSONObject">

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

@@ -483,14 +483,15 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         //根据userID查询公司id
         //根据userID查询公司id
         String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
         String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
-            total = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId).size();
             PageHelper.startPage(pageNumber, pageSize, false);
             PageHelper.startPage(pageNumber, pageSize, false);
+            // 查询头条设计排行
             result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
             result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
-
+            total = result.size();
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
-            total = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId).size();
             PageHelper.startPage(pageNumber, pageSize, false);
             PageHelper.startPage(pageNumber, pageSize, false);
+            //查询快手设计排行版
             result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
             result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type, companyId);
+            total = result.size();
         }
         }
         int number = (page - 1) * 10 + 1;
         int number = (page - 1) * 10 + 1;
         for (JSONObject jsonObject : result) {
         for (JSONObject jsonObject : result) {