浏览代码

feat:需求调整-营期添加“线”,并用于三张表统计

caoliqin 1 周之前
父节点
当前提交
48a12f38cc

+ 9 - 2
fs-service-system/src/main/java/com/fs/course/domain/FsUserCoursePeriod.java

@@ -5,9 +5,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.annotation.Excel;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.io.Serializable;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.LocalTime;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -17,8 +19,7 @@ import java.util.List;
  * @date 2025-04-15
  * @date 2025-04-15
  */
  */
 @Data
 @Data
-public class FsUserCoursePeriod
-{
+public class FsUserCoursePeriod implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
@@ -108,4 +109,10 @@ public class FsUserCoursePeriod
      * 删除状态0、正常,1、已删除
      * 删除状态0、正常,1、已删除
      */
      */
     private Integer delFlag;
     private Integer delFlag;
+
+    /**
+     * 营期线,即营期首次播放课程的日期
+     */
+    private Date periodLine;
+
 }
 }

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

@@ -2,6 +2,8 @@ package com.fs.course.domain;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fs.common.annotation.Excel;
 import com.fs.common.annotation.Excel;
@@ -123,5 +125,9 @@ public class FsUserWatchCourseStatistics extends BaseEntity{
     /** 用户的创建日期 */
     /** 用户的创建日期 */
     private Date userCreateDate;
     private Date userCreateDate;
 
 
+    /** 营期日期 */
+    @TableField(exist = false)
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date periodLine;
 
 
 }
 }

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

@@ -36,8 +36,8 @@ public class FsUserWatchStatistics extends BaseEntity{
     @Excel(name = "营期开始日期", width = 30, dateFormat = "yyyy-MM-dd")
     @Excel(name = "营期开始日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date periodStartingTime;
     private Date periodStartingTime;
 
 
-    /** 销售公司ids */
-//    @Excel(name = "销售公司ids")
+    /** 销售公司id */
+//    @Excel(name = "销售公司id")
     private String companyId;
     private String companyId;
 
 
     /** 销售公司名称 */
     /** 销售公司名称 */

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

@@ -145,6 +145,8 @@ public class FsUserWatchCourseStatisticsServiceImpl extends ServiceImpl<FsUserWa
             FsUserWatchCourseStatistics answerLogData = answerLogMap.get(key);
             FsUserWatchCourseStatistics answerLogData = answerLogMap.get(key);
             List<FsUserWatchCourseStatistics> userTotalDataList = userTotalMap.get(data.getCompanyUserId());
             List<FsUserWatchCourseStatistics> userTotalDataList = userTotalMap.get(data.getCompanyUserId());
             BeanUtils.copyProperties(data, vo);
             BeanUtils.copyProperties(data, vo);
+            // 改成使用营期线来表示营期开始时间
+            vo.setPeriodStartingTime(data.getPeriodLine() != null ? data.getPeriodLine() : data.getPeriodStartingTime());
 
 
             // 单独一个一个set,不用copy,避免copy出来的结果被前面的覆盖
             // 单独一个一个set,不用copy,避免copy出来的结果被前面的覆盖
             if(userTotalDataList != null && !userTotalDataList.isEmpty()){
             if(userTotalDataList != null && !userTotalDataList.isEmpty()){

+ 4 - 2
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserWatchStatisticsServiceImpl.java

@@ -151,7 +151,8 @@ public class FsUserWatchStatisticsServiceImpl extends ServiceImpl<FsUserWatchSta
                             FsUserWatchStatistics fsUserWatchStatistics = new FsUserWatchStatistics();
                             FsUserWatchStatistics fsUserWatchStatistics = new FsUserWatchStatistics();
                             BeanUtils.copyProperties(item, fsUserWatchStatistics);
                             BeanUtils.copyProperties(item, fsUserWatchStatistics);
                             ZonedDateTime zonedDateTime = item.getPeriodStartingTime().atStartOfDay(ZoneId.systemDefault());
                             ZonedDateTime zonedDateTime = item.getPeriodStartingTime().atStartOfDay(ZoneId.systemDefault());
-                            fsUserWatchStatistics.setPeriodStartingTime(Date.from(zonedDateTime.toInstant()));
+                            // 改成使用营期线来表示营期开始时间
+                            fsUserWatchStatistics.setPeriodStartingTime(item.getPeriodLine() != null ? item.getPeriodLine() : Date.from(zonedDateTime.toInstant()));
                             fsUserWatchStatistics.setCompanyId(companyIdStr.trim());
                             fsUserWatchStatistics.setCompanyId(companyIdStr.trim());
                             fsUserWatchStatistics.setCompanyName(company != null ? company.getCompanyName() : null);
                             fsUserWatchStatistics.setCompanyName(company != null ? company.getCompanyName() : null);
 
 
@@ -177,7 +178,8 @@ public class FsUserWatchStatisticsServiceImpl extends ServiceImpl<FsUserWatchSta
                                 fsUserWatchStatistics.setCompleteWatchNum(0);
                                 fsUserWatchStatistics.setCompleteWatchNum(0);
                                 fsUserWatchStatistics.setCompleteWatchRate(BigDecimal.ZERO);
                                 fsUserWatchStatistics.setCompleteWatchRate(BigDecimal.ZERO);
                             }
                             }
-
+                            fsUserWatchStatistics.setCreateTime(new Date());
+                            fsUserWatchStatistics.setUpdateTime(new Date());
                             return fsUserWatchStatistics;
                             return fsUserWatchStatistics;
                         })).collect(Collectors.toList());
                         })).collect(Collectors.toList());
 
 

+ 4 - 0
fs-service-system/src/main/java/com/fs/course/vo/FsUserCoursePeriodVO.java

@@ -85,4 +85,8 @@ public class FsUserCoursePeriodVO implements Serializable {
     @Excel(name = "营期状态")
     @Excel(name = "营期状态")
     private Long periodStatus;
     private Long periodStatus;
 
 
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "营期线", width = 31, dateFormat = "yyyy-MM-dd")
+    private Date periodLine;
+
 }
 }

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

@@ -204,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.start_date_time as courseStartDateTime
             a.start_date_time as courseStartDateTime
              ,b.course_name
              ,b.course_name
              ,c.title as videoTitle
              ,c.title as videoTitle
-             ,period.period_name,period.period_starting_time
+             ,period.period_name,period.period_starting_time,period.period_line
              ,company.company_id,company.company_name
              ,company.company_id,company.company_name
              ,company_user.user_id as companyUserId, company_user.nick_name as companyUserName
              ,company_user.user_id as companyUserId, company_user.nick_name as companyUserName
         FROM
         FROM
@@ -214,7 +214,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 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 on FIND_IN_SET(company.company_id, period.company_id) > 0
                 left join company_user on company_user.company_id = company.company_id
                 left join company_user on company_user.company_id = company.company_id
-        where period.period_name is not null
+        where period.del_flag ='0' and period.period_name is not null
         ORDER BY
         ORDER BY
             a.day_date
             a.day_date
     </select>
     </select>

+ 7 - 0
fs-service-system/src/main/resources/mapper/course/FsUserCoursePeriodMapper.xml

@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="maxViewNum"    column="max_view_num"    />
         <result property="maxViewNum"    column="max_view_num"    />
         <result property="courseLogo"    column="course_logo"    />
         <result property="courseLogo"    column="course_logo"    />
         <result property="openCommentStatus"    column="open_comment_status"    />
         <result property="openCommentStatus"    column="open_comment_status"    />
+        <result property="periodLine"    column="period_line"    />
     </resultMap>
     </resultMap>
 
 
     <sql id="selectFsUserCoursePeriodVo">
     <sql id="selectFsUserCoursePeriodVo">
@@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="periodType != null "> and period_type = #{periodType}</if>
             <if test="periodType != null "> and period_type = #{periodType}</if>
             <if test="periodStartingTime != null "> and period_starting_time = #{periodStartingTime}</if>
             <if test="periodStartingTime != null "> and period_starting_time = #{periodStartingTime}</if>
             <if test="periodEndTime != null "> and period_end_time = #{periodEndTime}</if>
             <if test="periodEndTime != null "> and period_end_time = #{periodEndTime}</if>
+            <if test="periodLine != null "> and period_line = #{periodLine}</if>
         </where>
         </where>
     </select>
     </select>
 
 
@@ -58,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         period_type,
         period_type,
         period_end_time,
         period_end_time,
         period_starting_time,
         period_starting_time,
+        period_line,
         fctc.training_camp_name AS trainingCampName,
         fctc.training_camp_name AS trainingCampName,
         GROUP_CONCAT( company.company_name ) AS companyName
         GROUP_CONCAT( company.company_name ) AS companyName
         FROM
         FROM
@@ -77,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             </if>
             <if test="periodStartingTime != null "> and period_starting_time &gt;= #{periodStartingTime}</if>
             <if test="periodStartingTime != null "> and period_starting_time &gt;= #{periodStartingTime}</if>
             <if test="periodEndTime != null "> and period_end_time &lt;= #{periodEndTime}</if>
             <if test="periodEndTime != null "> and period_end_time &lt;= #{periodEndTime}</if>
+            <if test="periodLine != null "> and period_line = #{periodLine}</if>
         </where>
         </where>
         group by fs_user_course_period.period_id
         group by fs_user_course_period.period_id
         order by create_time desc
         order by create_time desc
@@ -109,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maxViewNum != null">max_view_num,</if>
             <if test="maxViewNum != null">max_view_num,</if>
             <if test="courseLogo != null">course_logo,</if>
             <if test="courseLogo != null">course_logo,</if>
             <if test="openCommentStatus != null">open_comment_status,</if>
             <if test="openCommentStatus != null">open_comment_status,</if>
+            <if test="periodLine != null">period_line,</if>
          </trim>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="periodId != null">#{periodId},</if>
             <if test="periodId != null">#{periodId},</if>
@@ -130,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maxViewNum != null">#{maxViewNum},</if>
             <if test="maxViewNum != null">#{maxViewNum},</if>
             <if test="courseLogo != null">#{courseLogo},</if>
             <if test="courseLogo != null">#{courseLogo},</if>
             <if test="openCommentStatus != null">#{openCommentStatus},</if>
             <if test="openCommentStatus != null">#{openCommentStatus},</if>
+            <if test="periodLine != null">#{periodLine},</if>
         </trim>
         </trim>
     </insert>
     </insert>
 
 
@@ -154,6 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maxViewNum != null">max_view_num = #{maxViewNum},</if>
             <if test="maxViewNum != null">max_view_num = #{maxViewNum},</if>
             <if test="courseLogo != null and courseLogo !=''">course_logo = #{courseLogo},</if>
             <if test="courseLogo != null and courseLogo !=''">course_logo = #{courseLogo},</if>
             <if test="openCommentStatus != null">open_comment_status = #{openCommentStatus},</if>
             <if test="openCommentStatus != null">open_comment_status = #{openCommentStatus},</if>
+            <if test="periodLine != null">period_line = #{periodLine},</if>
         </trim>
         </trim>
         where period_id = #{periodId}
         where period_id = #{periodId}
     </update>
     </update>

+ 12 - 0
fs-service-system/src/main/resources/mapper/course/FsUserWatchCourseStatisticsMapper.xml

@@ -267,6 +267,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         </trim>
         on duplicate key update
         on duplicate key update
         <trim suffixOverrides=",">
         <trim suffixOverrides=",">
+            <if test="periodId != null">period_id = #{periodId},</if>
+            <if test="periodName != null">period_name = #{periodName},</if>
+            <if test="courseId != null">course_id = #{courseId},</if>
+            <if test="courseName != null">course_name = #{courseName},</if>
+            <if test="videoId != null">video_id = #{videoId},</if>
+            <if test="videoTitle != null">video_title = #{videoTitle},</if>
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="companyName != null">company_name = #{companyName},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="courseStartDateTime != null">course_start_date_time = #{courseStartDateTime},</if>
+            <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
+            <if test="periodStartingTime != null">period_starting_time = #{periodStartingTime},</if>
             <if test="newUserNum != null">new_user_num = #{newUserNum},</if>
             <if test="newUserNum != null">new_user_num = #{newUserNum},</if>
             <if test="userNum != null">user_num = #{userNum},</if>
             <if test="userNum != null">user_num = #{userNum},</if>
             <if test="watchNum != null">watch_num = #{watchNum},</if>
             <if test="watchNum != null">watch_num = #{watchNum},</if>

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

@@ -151,6 +151,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         </trim>
         on duplicate key update
         on duplicate key update
         <trim suffixOverrides=",">
         <trim suffixOverrides=",">
+            <if test="periodId != null">period_id = #{periodId},</if>
+            <if test="periodName != null">period_name = #{periodName},</if>
+            <if test="periodStartingTime != null">period_starting_time = #{periodStartingTime},</if>
             <if test="companyId != null and companyId !='' ">company_id = #{companyId},</if>
             <if test="companyId != null and companyId !='' ">company_id = #{companyId},</if>
             <if test="companyName != null">company_name = #{companyName},</if>
             <if test="companyName != null">company_name = #{companyName},</if>
             <if test="newUserNum != null">new_user_num = #{newUserNum},</if>
             <if test="newUserNum != null">new_user_num = #{newUserNum},</if>