Bläddra i källkod

头条素材报表修改

hcst_sunzhen 5 år sedan
förälder
incheckning
a553f14ecd

+ 2 - 1
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java

@@ -3,6 +3,7 @@ package cn.com.ctop.bytedance.mapper;
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import retrofit2.http.PartMap;
 
 import java.util.List;
 import java.util.Map;
@@ -14,7 +15,7 @@ import java.util.Map;
  * @Version: V1.0
  */
 public interface BytedanceCreativeDailyReportMapper extends BaseMapper<BytedanceCreativeDailyReport> {
-    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReport(Map<String, Object> paramsMap);
+    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReport(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
     List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReport(Map<String, Object> paramsMap);
 

+ 6 - 8
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -29,7 +29,7 @@
         left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
         left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
         where
-        t3.id is not NULL
+        t3.id is not NULL and t4.id is not null
         and t1.media_id = '1'
         and t1.account_id != ''
         <if test="userId != null">
@@ -37,14 +37,13 @@
         </if>
 
         <if test="startDate != null">
-            and t2.stat_datetime &gt;= #{startDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         </if>
         <if test="endDate != null">
-            and t2.stat_datetime &lt;= #{endDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
         </if>
         group by t4.signature
         order by sum(t2.cost) desc
-        limit 100
     </select>
 
     <select id="bytedanceCreativeAccountReport" parameterType="Map"
@@ -79,18 +78,17 @@
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        and t3.id is not NULL and t4.id is not null
         and t1.media_id = '1'
-        and t1.account_id != ''
         <if test="startDate != null">
-            and t2.stat_datetime &gt;= #{startDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         </if>
         <if test="endDate != null">
-            and t2.stat_datetime &lt;= #{endDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
         </if>
         and t3.id is not NULL
         group by t4.signature
         order by sum(t2.cost) desc
-        limit 100
     </select>
 
     <insert id="replaceBatch">

+ 10 - 7
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceCreativeDailyReportServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.bytedance.service.impl;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.bytedance.mapper.BytedanceCreativeDailyReportMapper;
+import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.bytedance.service.IBytedanceCreativeDailyReportService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
@@ -24,21 +25,23 @@ import java.util.Map;
 public class BytedanceCreativeDailyReportServiceImpl extends ServiceImpl<BytedanceCreativeDailyReportMapper, BytedanceCreativeDailyReport> implements IBytedanceCreativeDailyReportService {
     @Autowired
     private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
+    @Autowired
+    private MaterialReportMapper materialReportMapper;
 
     @Override
     public List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList(JSONObject json) {
         String userId = json.getString("userId");
+        String startDate = json.getString("startDate");
+        String endDate = json.getString("endDate");
         if (Check.isNull(userId)) {
             return null;
         }
-        String nowDate = json.getString("startDate");
-        String endDate = json.getString("endDate");
-        Map<String, Object> paramsMap = new HashMap<>();
-        paramsMap.put("userId", userId);
-        paramsMap.put("startDate", nowDate);
-        paramsMap.put("endDate", endDate);
+        String roleCode = materialReportMapper.getRoleCodeByUserId(json.getString("userId"));
+        if (!"admin".equals(roleCode)) {
+            userId = "";
+        }
 
-        return bytedanceCreativeDailyReportMapper.bytedanceCreativeDailyReport(paramsMap);
+        return bytedanceCreativeDailyReportMapper.bytedanceCreativeDailyReport(userId, startDate, endDate);
     }
 
     @Override

+ 3 - 3
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -16,7 +16,7 @@
             d4.id as plane_id,
             d4.realname as plane_name
         from ctop_kuaishou_report_daily_creative_statistic a
-        left join ctop_material_info b on a.signature = b.code
+        left join (select id, create_time ,code from ctop_material_info group by code) b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
         left join sys_user d2 on c.shot_id = d2.id
@@ -481,7 +481,7 @@
         ctop_bytedance_report_creative_daily a
         left join ctop_bytedance_creative b on a.creative_id = b.id
         left join ctop_bytedance_video_info c on b.video_id = c.id
-        left join ctop_material_info d on c.signature = d.code
+        left join (select id, create_time ,code from ctop_material_info group by code) d on c.signature = d.code
         left join ctop_material_ascription e on d.id = e.material_id
         left join sys_user f1 on e.clip_id = f1.id
         left join sys_user f2 on e.shot_id = f2.id
@@ -492,7 +492,7 @@
         date_format(a.stat_datetime, '%Y-%m-%d') &gt;= #{startTime} and
         date_format(a.stat_datetime, '%Y-%m-%d') &lt;= #{endTime} and
         date_format(d.create_time, '%Y-%m-%d') &gt;= #{startDate} and
-        date_format(d.update_time, '%Y-%m-%d') &lt;= #{endDate}
+        date_format(d.create_time, '%Y-%m-%d') &lt;= #{endDate}
         group by c.signature
         having sum(a.cost) >= 5000
     </select>