Преглед на файлове

快手素材报表改版

yumeng преди 4 години
родител
ревизия
f9ea2d8576

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 8080
   tomcat:
     max-swallow-size: -1
   servlet:

+ 18 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -38,6 +38,23 @@ public class KsVideoReportCtrl {
     @Autowired
     IKsVideoReportService ksVideoReportService;
 
+
+    @PostMapping("/getDesignList")
+    public Result<List<JSONObject>> getDesignList() {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> designList = ksVideoReportService.getDesignList();
+            result.setSuccess(true);
+            result.setResult(designList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
     @PostMapping("/list")
     public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
         Result<PageInfo<JSONObject>> result = new Result<>();
@@ -62,7 +79,7 @@ public class KsVideoReportCtrl {
                 throw new Exception("请输入查询结束时间");
             }
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
-            System.err.println(filedAll);
+            //   System.err.println(filedAll);
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java

@@ -14,4 +14,6 @@ public interface KsVideoReportMapper {
     List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("signature") String signature);
 
     List<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getDesignList();
 }

+ 41 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -3,14 +3,21 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper">
 
     <select id="getKuaiShouVideoReportByMap" resultType="com.alibaba.fastjson.JSONObject" parameterType="map">
-        select t3.* from (
         SELECT
-        ${filed}
+        t1.*,
+        t2.clip_name as clip,
+        t2.plan_name as plan,
+        t2.shot_name as shot,
+        t2.design_team_leader_name as designLeader,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        t2.channel_name AS channel,
+        t2.state_date as createTime
         FROM
-        ctop_etl_kuaishou_account_material_report_daily t1
-        LEFT JOIN ctop_etl_kuaishou_video_info t2 ON t1.signature = t2.video_code
-        WHERE
-        1 = 1
+        (select ${filed}
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where 1 = 1
         <if test="accountIds !=null and accountIds != ''">
             and t1.account_id in
             <foreach item="item" index="index" collection="accountIds"
@@ -24,8 +31,15 @@
         <if test="endDate !=null and endDate != ''">
             AND t1.stat_date &lt;= #{endDate}
         </if>
-        <if test="designTeamLeaderId !=null and designTeamLeaderId != ''">
-            AND t2.design_team_leader_id = #{designTeamLeaderId}
+        GROUP BY t1.signature
+        ORDER BY ${target} ${order}
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        WHERE
+        1 = 1
+        <if test="leaderId !=null and leaderId != ''">
+            AND t2.design_team_leader_id = #{leaderId}
         </if>
         <if test="clipId !=null and clipId != ''">
             AND t2.clip_id = #{clipId}
@@ -36,9 +50,6 @@
         <if test="shotId !=null and shotId != ''">
             AND t2.shot_id = #{shotId}
         </if>
-        GROUP BY t1.signature
-        ) t3
-        ORDER BY #{target} #{order}
     </select>
 
 
@@ -120,4 +131,23 @@
         order by t1.stat_date desc
     </select>
 
+    <select id="getDesignList" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	t1.user_id AS 'userId',
+	LEFT (t1.company_name, 2) AS 'companyName',
+	t3.role_name AS 'ruleName',
+	t1.user_name AS 'userName'
+    FROM
+	user_company t1
+    LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
+    LEFT JOIN sys_role t3 ON t2.role_id = t3.id
+    WHERE
+	t3.role_code IN (
+		'plan',
+		'shot',
+		'clip',
+		'designTeamLeader'
+	)
+    </select>
+
 </mapper>

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java

@@ -16,4 +16,6 @@ public interface IKsVideoReportService {
     List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
 
     PageInfo<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap, int pageSize, int pageNo);
+
+    List<JSONObject> getDesignList();
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java

@@ -43,4 +43,9 @@ public class KsVideoReportServiceImpl implements IKsVideoReportService {
 
     }
 
+    @Override
+    public List<JSONObject> getDesignList() {
+        return ksVideoReportMapper.getDesignList();
+    }
+
 }

+ 4 - 38
module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json

@@ -1,49 +1,15 @@
 {
+
+
   "signature": {
     "filed": "t1.signature as signature ",
     "comment": "素材标识"
   },
-
-  "clip": {
-    "filed": "t2.clip_name as clip ",
-    "comment": "剪辑"
-  },
-  "plan": {
-    "filed": "t2.plan_name as plan ",
-    "comment": "编导"
-  },
-  "shot": {
-    "filed": "t2.shot_name as shot ",
-    "comment": "拍摄"
-  },
-  "designLeader": {
-    "filed": "t2.design_team_leader_name as designLeader ",
-    "comment": "设计负责人"
-  },
-  "materialName": {
-    "filed": "t2.video_name as materialName ",
-    "comment": "素材名称"
-  },
   "projectName": {
     "filed": "t1.project_name as projectName ",
     "comment": "项目名称"
   },
-  "createTime": {
-    "filed": "t1.stat_date as createTime ",
-    "comment": "上线日期"
-  },
-  "coverUrl": {
-    "filed": "t2.cover_url as coverUrl ",
-    "comment": "封面"
-  },
-  "url": {
-    "filed": "t2.url as url ",
-    "comment": "视频"
-  },
-  "channel": {
-    "filed": "t2.channel_name AS channel",
-    "comment": "素材来源"
-  },
+
   "cost": {
     "filed": "IFNULL(sum(t1.charge),0) as cost ",
     "comment": "消耗"
@@ -149,7 +115,7 @@
     "comment": "付费次数成本"
   },
   "ROI": {
-    "filed": "CASE WHEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) IS NULL THEN 0 ELSE sum(t1.event_pay_purchase_amount) / sum(t1.charge) end AS ROI ",
+    "filed": "CASE WHEN sum(t1.charge) != 0  THEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) else 0 END AS ROI",
     "comment": "ROI"
   },
   "register": {