Explorar el Código

feat: 会员看课统计表完成

caoliqin hace 3 días
padre
commit
341e89c420

+ 21 - 2
fs-admin/src/main/java/com/fs/course/controller/FsUserWatchCourseStatisticsController.java

@@ -1,8 +1,10 @@
 package com.fs.course.controller;
 
 import java.util.List;
-
+import java.util.stream.Collectors;
+import com.fs.course.vo.FsUserWatchCourseStatisticsExportVO;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -57,7 +59,7 @@ public class FsUserWatchCourseStatisticsController extends BaseController
     {
         List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
         ExcelUtil<FsUserWatchCourseStatistics> util = new ExcelUtil<FsUserWatchCourseStatistics>(FsUserWatchCourseStatistics.class);
-        return util.exportExcel(list, "会员看课统计-按课程统计数据");
+        return util.exportExcel(list, "会员看数据明细");
     }
 
     /**
@@ -103,6 +105,23 @@ public class FsUserWatchCourseStatisticsController extends BaseController
         return toAjax(fsUserWatchCourseStatisticsService.deleteFsUserWatchCourseStatisticsByIds(ids));
     }
 
+    /**
+     * 导出会员看课统计-按课程汇总统计列表
+     */
+    @Log(title = "会员看课统计-按课程汇总统计", businessType = BusinessType.EXPORT)
+    @GetMapping("/exportTotal")
+    public AjaxResult exportTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
+    {
+        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
+        List<FsUserWatchCourseStatisticsExportVO> listVO = list.stream().map(v -> {
+            FsUserWatchCourseStatisticsExportVO vo = new FsUserWatchCourseStatisticsExportVO();
+            BeanUtils.copyProperties(v, vo);
+            return vo;
+        }).collect(Collectors.toList());
+        ExcelUtil<FsUserWatchCourseStatisticsExportVO> util = new ExcelUtil<FsUserWatchCourseStatisticsExportVO>(FsUserWatchCourseStatisticsExportVO.class);
+        return util.exportExcel(listVO, "会员观看数据明细汇总");
+    }
+
 
     @PostMapping("/test")
     @ApiOperation("测试看课统计明细定时任务")

+ 22 - 22
fs-service-system/src/main/java/com/fs/course/domain/FsUserWatchCourseStatistics.java

@@ -23,15 +23,25 @@ public class FsUserWatchCourseStatistics extends BaseEntity{
     private Long id;
 
     /** 营期id */
-    @Excel(name = "营期id")
+//    @Excel(name = "营期id")
     private Long periodId;
 
     /** 营期名称 */
     @Excel(name = "营期名称")
     private String periodName;
 
+    /** 营期开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "营期日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date periodStartingTime;
+
+    /** 课程开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "播出时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date courseStartDateTime;
+
     /** 课程id */
-    @Excel(name = "课程id")
+//    @Excel(name = "课程id")
     private Long courseId;
 
     /** 课程名称 */
@@ -39,41 +49,31 @@ public class FsUserWatchCourseStatistics extends BaseEntity{
     private String courseName;
 
     /** 视频id */
-    @Excel(name = "视频id")
+//    @Excel(name = "视频id")
     private Long videoId;
 
     /** 视频标题 */
-    @Excel(name = "视频标题")
+    @Excel(name = "视频小节")
     private String videoTitle;
 
     /** 销售公司id */
-    @Excel(name = "销售公司id")
+//    @Excel(name = "销售公司id")
     private Long companyId;
 
     /** 销售公司名称 */
-    @Excel(name = "销售公司名称")
+    @Excel(name = "销售公司")
     private String companyName;
 
     /** 销售id */
-    @Excel(name = "销售id")
+//    @Excel(name = "销售id")
     private Long companyUserId;
 
-    /** 课程开始日期 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "课程开始日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date courseStartDateTime;
-
     /** 销售名称 */
-    @Excel(name = "销售名称")
+    @Excel(name = "所属销售")
     private String companyUserName;
 
-    /** 营期开始日期 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "营期开始日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date periodStartingTime;
-
     /** 新增会员数量 */
-    @Excel(name = "新增会员数量")
+    @Excel(name = "新增会员")
     private Integer newUserNum;
 
     /** 会员数量 */
@@ -97,15 +97,15 @@ public class FsUserWatchCourseStatistics extends BaseEntity{
     private Integer answerNum;
 
     /** 答题正确人数 */
-    @Excel(name = "答题正确人数")
+    @Excel(name = "正确人数")
     private Integer answerRightNum;
 
     /** 答题正确率 */
-    @Excel(name = "答题正确率")
+    @Excel(name = "正确率")
     private BigDecimal answerRightRate;
 
     /** 红包领取数量 */
-    @Excel(name = "红包领取数")
+    @Excel(name = "红包领取数")
     private Integer redPacketNum;
 
     /** 红包领取总额 */

+ 1 - 1
fs-service-system/src/main/java/com/fs/course/domain/FsUserWatchStatistics.java

@@ -24,7 +24,7 @@ public class FsUserWatchStatistics extends BaseEntity{
     private Long id;
 
     /** 营期id */
-    @Excel(name = "营期id")
+//    @Excel(name = "营期id")
     private Long periodId;
 
     /** 营期名称 */

+ 93 - 0
fs-service-system/src/main/java/com/fs/course/vo/FsUserWatchCourseStatisticsExportVO.java

@@ -0,0 +1,93 @@
+package com.fs.course.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsUserWatchCourseStatisticsExportVO extends BaseEntity{
+
+    /** 主键id */
+    private Long id;
+
+    /** 营期id */
+//    @Excel(name = "营期id")
+    private Long periodId;
+
+    /** 营期名称 */
+    @Excel(name = "营期名称")
+    private String periodName;
+
+    /** 营期开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "营期日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date periodStartingTime;
+
+    /** 课程开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "播出时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date courseStartDateTime;
+
+    /** 课程id */
+//    @Excel(name = "课程id")
+    private Long courseId;
+
+    /** 课程名称 */
+    @Excel(name = "课程名称")
+    private String courseName;
+
+    /** 视频id */
+//    @Excel(name = "视频id")
+    private Long videoId;
+
+    /** 视频标题 */
+    @Excel(name = "视频小节")
+    private String videoTitle;
+
+    /** 销售公司id */
+//    @Excel(name = "销售公司id")
+    private Long companyId;
+
+    /** 销售公司名称 */
+    @Excel(name = "销售公司")
+    private String companyName;
+
+    /** 销售id */
+//    @Excel(name = "销售id")
+    private Long companyUserId;
+
+    /** 销售名称 */
+    @Excel(name = "所属销售")
+    private String companyUserName;
+
+    /** 新增会员数量 */
+    @Excel(name = "新增会员")
+    private Integer newUserNum;
+
+    /** 会员数量 */
+    @Excel(name = "会员数量")
+    private Integer userNum;
+
+    /** 观看人数 */
+    @Excel(name = "观看人数")
+    private Integer watchNum;
+
+    /** 完播人数 */
+    @Excel(name = "完播人数")
+    private Integer completeWatchNum;
+
+    /** 完播率 */
+    @Excel(name = "完播率")
+    private BigDecimal completeWatchRate;
+
+    /** 红包领取数量 */
+    @Excel(name = "红包领取个数")
+    private Integer redPacketNum;
+
+}

+ 1 - 0
fs-service-system/src/main/resources/mapper/course/FsUserCoursePeriodDaysMapper.xml

@@ -191,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 left join fs_user_course_period period on period.period_id = a.period_id
                 left join company on FIND_IN_SET(company.company_id, period.company_id) > 0
                 left join company_user on company_user.company_id = company.company_id
+        where period.period_name is not null
         ORDER BY
             a.day_date
     </select>

+ 1 - 0
fs-service-system/src/main/resources/mapper/course/FsUserWatchStatisticsMapper.xml

@@ -109,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN fs_user_course_period ON fwl.period_id = fs_user_course_period.period_id
         WHERE
             fwl.send_type = 1
+            and fs_user_course_period.period_name is not null
         GROUP BY
             fwl.period_id
     </select>

+ 2 - 3
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -1534,9 +1534,8 @@
         count( DISTINCT CASE WHEN to_days( fs_user.create_time ) = to_days( now()) THEN fs_user.user_id END ) as newUserNum
         ,company.company_id,
         company.company_name,
-        fs_user.company_user_id,
-        GROUP_CONCAT( DISTINCT company_user.user_id ) AS company_user_id,
-        GROUP_CONCAT( DISTINCT company_user.nick_name ) AS companyUserName
+        company_user.user_id AS companyUserId,
+        company_user.nick_name AS companyUserName
 
         FROM
         fs_user