Browse Source

总后台统计管理新增完课统计和小程序观课统计

luolinsong 4 days ago
parent
commit
b84249c79e

+ 28 - 0
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -8,7 +8,9 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.ServletUtils;
 import com.fs.course.param.FsCourseOverParam;
 import com.fs.course.param.FsCourseWatchLogListParam;
+import com.fs.course.param.FsCourseWatchLogParam;
 import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
+import com.fs.course.vo.FsCoureseWatchLogVO;
 import com.fs.course.vo.FsCourseOverVO;
 import com.fs.course.vo.FsCourseWatchLogListVO;
 import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
@@ -175,4 +177,30 @@ public class FsCourseWatchLogController extends BaseController
         List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVO(param);
         return getDataTable(list);
     }
+    
+    /**
+     * 每个公司对应小程序观看人数统计
+     *
+     * @param fsCourseWatchLog
+     * @return
+     */
+    @GetMapping("/getAppIdList")
+    public TableDataInfo getAppIdList( FsCourseWatchLogParam fsCourseWatchLog) {
+        startPage();
+        List<FsCoureseWatchLogVO> list = fsCourseWatchLogService.selectAppIdList(fsCourseWatchLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 每个公司对应观看人数统计
+     *
+     * @param fsCourseWatchLog
+     * @return
+     */
+    @GetMapping("/getUserIdList")
+    public TableDataInfo getUserIdList( FsCourseWatchLogParam fsCourseWatchLog) {
+        startPage(); 
+        List<FsCoureseWatchLogVO> list = fsCourseWatchLogService.selectUserIdList(fsCourseWatchLog);
+        return getDataTable(list);
+    }
 }

+ 4 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -715,4 +715,8 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
             "</script>"
     })
     List<Long> getExContactIdsIdsByWatchLogIds(@Param("watchLogIds")List<Long> watchLogIds);
+
+    List<FsCoureseWatchLogVO> selectAppIdList(FsCourseWatchLogParam fsCourseWatchLog);
+    
+    List<FsCoureseWatchLogVO> selectUserIdList(FsCourseWatchLogParam fsCourseWatchLog);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogParam.java

@@ -18,4 +18,10 @@ public class FsCourseWatchLogParam extends BaseEntity {
 
     private String externalUserId;
 
+    
+    private Long companyId;
+    private String appId;
+    private String companyName;
+ 
+   
 }

+ 3 - 0
fs-service/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java

@@ -154,4 +154,7 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
      * @return
      */
     List<Long> getExContactIdsIdsByWatchLogIds(List<Long> watchLogIds);
+    
+    List<FsCoureseWatchLogVO> selectAppIdList(FsCourseWatchLogParam fsCourseWatchLog);
+    List<FsCoureseWatchLogVO> selectUserIdList(FsCourseWatchLogParam fsCourseWatchLog);
 }

+ 8 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -1346,6 +1346,14 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return fsCourseWatchLogMapper.getExContactIdsIdsByWatchLogIds(watchLogIds);
     }
 
+    @Override
+    public List<FsCoureseWatchLogVO> selectAppIdList(FsCourseWatchLogParam fsCourseWatchLog) {
+       return  fsCourseWatchLogMapper.selectAppIdList(fsCourseWatchLog);
+    } 
+    @Override
+    public List<FsCoureseWatchLogVO> selectUserIdList(FsCourseWatchLogParam fsCourseWatchLog) {
+       return  fsCourseWatchLogMapper.selectUserIdList(fsCourseWatchLog);
+    }
 
 
 }

+ 24 - 0
fs-service/src/main/java/com/fs/course/vo/FsCoureseWatchLogVO.java

@@ -0,0 +1,24 @@
+package com.fs.course.vo;
+
+import lombok.Data;
+
+@Data
+public class FsCoureseWatchLogVO {
+    
+    private String companyId;
+    private String companyName;
+    private String appName;
+    private String appId;
+    //总人数
+    private String appAllNum;
+    
+    
+    //个微完播人数
+    private Integer typeOneAll;
+    //企微完播人数
+    private Integer typeTwoAll;
+    //总完播人数
+    private Integer typeAll;
+    //总观看人数
+    private Integer allUserId;
+}

+ 67 - 0
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -1044,4 +1044,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY
             log_id DESC
     </select>
+
+    <select id="selectAppIdList" resultType="com.fs.course.vo.FsCoureseWatchLogVO"
+            parameterType="com.fs.course.param.FsCourseWatchLogParam">
+        SELECT
+        c.company_id ,
+        c.company_name,
+        l.app_id,
+        f.NAME appName,
+        count( l.app_id ) appAllNum
+        FROM
+        fs_course_watch_log l
+        INNER JOIN fs_course_play_source_config f ON l.app_id = f.appid
+        INNER JOIN company c ON l.company_id = c.company_id
+        WHERE
+        f.is_del ='0' and c.is_del ='0'
+        <if test="createTime != null">
+            AND DATE(l.create_time) = #{createTime}
+        </if>
+        <if test="companyId != null">
+            AND l.company_id = #{companyId}
+        </if>
+        <if test="appId != null">
+            AND l.app_id = #{appId}
+        </if>
+        <if test="companyName != null">
+            AND c.company_name like concat('%', #{companyName}, '%')
+        </if>
+        GROUP BY
+        l.company_id,
+        l.app_id
+        ORDER BY
+        l.company_id
+    </select>
+
+    <select id="selectUserIdList" resultType="com.fs.course.vo.FsCoureseWatchLogVO"
+            parameterType="com.fs.course.param.FsCourseWatchLogParam">
+        SELECT
+        c.company_id ,
+        c.company_name,
+        COUNT(DISTINCT CASE WHEN l.log_type = 2 AND l.send_type = 1 THEN l.user_id END) typeOneAll,
+        COUNT(DISTINCT CASE WHEN l.log_type = 2 AND l.send_type = 2 THEN l.user_id END) typeTwoAll,
+        COUNT(DISTINCT CASE WHEN l.log_type = 2 THEN l.user_id END) typeAll,
+        COUNT(DISTINCT CASE WHEN l.log_type != 3 THEN l.user_id END) allUserId
+        FROM
+        fs_course_watch_log l
+        INNER JOIN company c ON l.company_id = c.company_id
+        WHERE
+        c.is_del ='0'
+        <if test="createTime != null">
+            AND DATE(l.create_time) = #{createTime}
+        </if>
+        <if test="companyId != null">
+            AND l.company_id = #{companyId}
+        </if>
+        <if test="appId != null">
+            AND l.app_id = #{appId}
+        </if>
+        <if test="companyName != null">
+            AND c.company_name like concat('%', #{companyName}, '%')
+        </if>
+        GROUP BY
+        c.company_id, c.company_name
+        ORDER BY
+        c.company_id;
+
+    </select>
+    
 </mapper>