Jelajahi Sumber

feat: 会员观看数据明细汇总需求调整

caoliqin 2 hari lalu
induk
melakukan
b09f578f91

+ 13 - 1
fs-admin/src/main/java/com/fs/course/controller/FsUserWatchCourseStatisticsController.java

@@ -105,6 +105,18 @@ public class FsUserWatchCourseStatisticsController extends BaseController
         return toAjax(fsUserWatchCourseStatisticsService.deleteFsUserWatchCourseStatisticsByIds(ids));
     }
 
+    /**
+     * 查询会员观看数据明细汇总
+     */
+    @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:listTotal')")
+    @GetMapping("/listTotal")
+    public TableDataInfo listTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
+    {
+        startPage();
+        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsListTotal(fsUserWatchCourseStatistics);
+        return getDataTable(list);
+    }
+
     /**
      * 导出会员看课统计-按课程汇总统计列表
      */
@@ -112,7 +124,7 @@ public class FsUserWatchCourseStatisticsController extends BaseController
     @GetMapping("/exportTotal")
     public AjaxResult exportTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
     {
-        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
+        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsListTotal(fsUserWatchCourseStatistics);
         List<FsUserWatchCourseStatisticsExportVO> listVO = list.stream().map(v -> {
             FsUserWatchCourseStatisticsExportVO vo = new FsUserWatchCourseStatisticsExportVO();
             BeanUtils.copyProperties(v, vo);

+ 20 - 1
fs-company/src/main/java/com/fs/course/controller/FsUserWatchCourseStatisticsController.java

@@ -54,10 +54,27 @@ public class FsUserWatchCourseStatisticsController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsUserWatchCourseStatistics.setCompanyId( loginUser.getCompany().getCompanyId());
         List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
         ExcelUtil<FsUserWatchCourseStatistics> util = new ExcelUtil<FsUserWatchCourseStatistics>(FsUserWatchCourseStatistics.class);
         return util.exportExcel(list, "会员观看数据明细");
     }
+
+    /**
+     * 查询会员观看数据明细汇总
+     */
+    @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:listTotal')")
+    @GetMapping("/listTotal")
+    public TableDataInfo listTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsUserWatchCourseStatistics.setCompanyId( loginUser.getCompany().getCompanyId());
+        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsListTotal(fsUserWatchCourseStatistics);
+        return getDataTable(list);
+    }
+
     /**
      * 导出会员看课统计-按课程汇总统计列表
      */
@@ -65,7 +82,9 @@ public class FsUserWatchCourseStatisticsController extends BaseController
     @GetMapping("/exportTotal")
     public AjaxResult exportTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
     {
-        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsUserWatchCourseStatistics.setCompanyId( loginUser.getCompany().getCompanyId());
+        List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsListTotal(fsUserWatchCourseStatistics);
         List<FsUserWatchCourseStatisticsExportVO> listVO = list.stream().map(v -> {
             FsUserWatchCourseStatisticsExportVO vo = new FsUserWatchCourseStatisticsExportVO();
             BeanUtils.copyProperties(v, vo);

+ 8 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsUserWatchCourseStatisticsMapper.java

@@ -27,6 +27,14 @@ public interface FsUserWatchCourseStatisticsMapper extends BaseMapper<FsUserWatc
      */
     List<FsUserWatchCourseStatistics> selectFsUserWatchCourseStatisticsList(FsUserWatchCourseStatistics fsUserWatchCourseStatistics);
 
+    /**
+     * 查询会员看课明细汇总
+     *
+     * @param fsUserWatchCourseStatistics 会员看课统计-按课程统计
+     * @return 会员看课统计-按课程统计集合
+     */
+    List<FsUserWatchCourseStatistics> selectFsUserWatchCourseStatisticsListTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics);
+
     /**
      * 新增会员看课统计-按课程统计
      *

+ 8 - 0
fs-service-system/src/main/java/com/fs/course/service/IFsUserWatchCourseStatisticsService.java

@@ -27,6 +27,14 @@ public interface IFsUserWatchCourseStatisticsService extends IService<FsUserWatc
      */
     List<FsUserWatchCourseStatistics> selectFsUserWatchCourseStatisticsList(FsUserWatchCourseStatistics fsUserWatchCourseStatistics);
 
+    /**
+     * 查询会员看课明细汇总
+     *
+     * @param fsUserWatchCourseStatistics 会员看课统计-按课程统计
+     * @return 会员看课统计-按课程统计集合
+     */
+    List<FsUserWatchCourseStatistics> selectFsUserWatchCourseStatisticsListTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics);
+
     /**
      * 新增会员看课统计-按课程统计
      *

+ 6 - 0
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserWatchCourseStatisticsServiceImpl.java

@@ -62,6 +62,12 @@ public class FsUserWatchCourseStatisticsServiceImpl extends ServiceImpl<FsUserWa
         return baseMapper.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
     }
 
+    @Override
+    public List<FsUserWatchCourseStatistics> selectFsUserWatchCourseStatisticsListTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
+    {
+        return baseMapper.selectFsUserWatchCourseStatisticsListTotal(fsUserWatchCourseStatistics);
+    }
+
     /**
      * 新增会员看课统计-按课程统计
      *

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -617,6 +617,8 @@ public class FsUserServiceImpl implements IFsUserService
         if (countRedPacket != null) {
             vo.setAnswerRedPacketTime(countRedPacket.getAnswerRedPacketTime());
             vo.setAnswerRedPacketAmount(countRedPacket.getAnswerRedPacketAmount());
+        } else {
+            vo.setAnswerRedPacketAmount(BigDecimal.ZERO);
         }
         if (countAnswer != null) {
             vo.setAnswerTime(countAnswer.getAnswerTime());

+ 3 - 1
fs-service-system/src/main/java/com/fs/store/vo/h5/UserDetailsVO.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 用户会员详情 输出参数
  */
@@ -21,7 +23,7 @@ public class UserDetailsVO {
     private int answerRedPacketTime;
 
     @ApiModelProperty(value = "答题红包金额")
-    private int answerRedPacketAmount;
+    private BigDecimal answerRedPacketAmount;
 
     @ApiModelProperty(value = "完播次数")
     private int completeWatchCount;

+ 56 - 1
fs-service-system/src/main/resources/mapper/course/FsUserWatchCourseStatisticsMapper.xml

@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="courseId != null "> and course_id = #{courseId}</if>
             <if test="courseName != null  and courseName != ''"> and course_name like concat('%', #{courseName}, '%')</if>
             <if test="videoId != null "> and video_id = #{videoId}</if>
-            <if test="videoTitle != null  and videoTitle != ''"> and video_title = #{videoTitle}</if>
+            <if test="videoTitle != null  and videoTitle != ''"> and video_title like concat('%', #{videoTitle}, '%')</if>
             <if test="companyId != null "> and company_id = #{companyId}</if>
             <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
             <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
@@ -62,6 +62,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <select id="selectFsUserWatchCourseStatisticsListTotal" parameterType="FsUserWatchCourseStatistics" resultMap="FsUserWatchCourseStatisticsResult">
+        SELECT
+        id,
+        period_id,
+        period_name,
+        course_id,
+        course_name,
+        video_id,
+        video_title,
+        company_id,
+        company_name,
+        company_user_id,
+        course_start_date_time,
+        -- 	company_user_name,
+        period_starting_time,
+--         new_user_num,
+--         user_num,
+        sum(new_user_num) as new_user_num,
+        sum(user_num) as user_num,
+        watch_num,
+        complete_watch_num,
+        complete_watch_rate,
+        answer_num,
+        answer_right_num,
+        answer_right_rate,
+        red_packet_num,
+        red_packet_amount
+        from fs_user_watch_course_statistics
+        <where>
+            <if test="periodId != null "> and period_id = #{periodId}</if>
+            <if test="periodName != null  and periodName != ''"> and period_name like concat('%', #{periodName}, '%')</if>
+            <if test="courseId != null "> and course_id = #{courseId}</if>
+            <if test="courseName != null  and courseName != ''"> and course_name like concat('%', #{courseName}, '%')</if>
+            <if test="videoId != null "> and video_id = #{videoId}</if>
+            <if test="videoTitle != null  and videoTitle != ''"> and video_title like concat('%', #{videoTitle}, '%')</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+            <if test="courseStartDateTime != null "> and course_start_date_time like concat(DATE(#{courseStartDateTime}),'%')</if>
+            <if test="companyUserName != null  and companyUserName != ''"> and company_user_name like concat('%', #{companyUserName}, '%')</if>
+            <if test="periodStartingTime != null "> and period_starting_time like concat(DATE(#{periodStartingTime}), '%')</if>
+            <if test="newUserNum != null "> and new_user_num = #{newUserNum}</if>
+            <if test="userNum != null "> and user_num = #{userNum}</if>
+            <if test="watchNum != null "> and watch_num = #{watchNum}</if>
+            <if test="completeWatchNum != null "> and complete_watch_num = #{completeWatchNum}</if>
+            <if test="completeWatchRate != null "> and complete_watch_rate = #{completeWatchRate}</if>
+            <if test="answerNum != null "> and answer_num = #{answerNum}</if>
+            <if test="answerRightNum != null "> and answer_right_num = #{answerRightNum}</if>
+            <if test="answerRightRate != null "> and answer_right_rate = #{answerRightRate}</if>
+            <if test="redPacketNum != null "> and red_packet_num = #{redPacketNum}</if>
+            <if test="redPacketAmount != null "> and red_packet_amount = #{redPacketAmount}</if>
+        </where>
+        group by fs_user_watch_course_statistics.company_id, course_start_date_time
+    </select>
+
     <select id="selectFsUserWatchCourseStatisticsById" parameterType="Long" resultMap="FsUserWatchCourseStatisticsResult">
         <include refid="selectFsUserWatchCourseStatisticsVo"/>
         where id = #{id}