瀏覽代碼

feat: 员工(销售)完播

xdd 2 周之前
父節點
當前提交
85cecde182

+ 34 - 26
fs-admin/src/test/java/com/fs/task/StoreTaskTest.java

@@ -1,26 +1,34 @@
-//package com.fs.task;
-//
-//
-//import com.fs.FSAdminApplication;
-//import com.fs.course.service.IFsCourseWatchLogService;
-//import org.junit.Test;
-//import org.junit.runner.RunWith;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.boot.test.context.SpringBootTest;
-//
-//@RunWith(value = org.springframework.test.context.junit4.SpringRunner.class)
-//@SpringBootTest(classes = FSAdminApplication.class)
-//public class StoreTaskTest {
-//    @Autowired
-//    private IFsCourseWatchLogService fsCourseWatchLogService;
-//    @Autowired
-//    private FsCourseTask fsCourseTask;
-//    @Test
-//    public void addQwWatchLog() {
-//        fsCourseWatchLogService.addCourseWatchLogDayNew();
-//    }
-//    @Test
-//    public void test() throws Exception {
-//        fsCourseTask.hyWorkTask();
-//    }
-//}
+package com.fs.task;
+
+
+import com.fs.FSAdminApplication;
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.statis.service.FsStatisSalerWatchService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@RunWith(value = org.springframework.test.context.junit4.SpringRunner.class)
+@SpringBootTest(classes = FSAdminApplication.class)
+public class StoreTaskTest {
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+    @Autowired
+    private FsCourseTask fsCourseTask;
+    @Autowired
+    private FsStatisSalerWatchService fsStatisSalerWatchService;
+    @Test
+    public void addQwWatchLog() {
+        fsCourseWatchLogService.addCourseWatchLogDayNew();
+    }
+    @Test
+    public void test() throws Exception {
+        fsCourseTask.hyWorkTask();
+    }
+
+    @Test
+    public void testWriteData(){
+        fsStatisSalerWatchService.writeData();
+    }
+}

+ 5 - 3
fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -261,15 +261,17 @@ public interface CompanyUserMapper
 
     int setIsRegisterMember(@Param("status") boolean status, @Param("userIds")List<Long> userIds);
 
-    @Select("select user_id,dept_id,user_name from company_user where del_flag=0 and status=0")
+    @Select("select user_id,dept_id,user_name,company_id from company_user where del_flag=0 and status=0")
     List<CompanyUser> selectAllCompanyUserList();
 
     /**
      * 获取对应的销售观看记录数
+     *
      * @param companyUserId
+     * @param periodId
      * @return
      */
-    Long queryCompanyUserWatchCount(Long companyUserId);
+    Long queryCompanyUserWatchCount(@Param("companyUserId") Long companyUserId, @Param("periodId") Long periodId);
 
-    Long queryCompanyUserWatchCountCompleted(Long userId);
+    Long queryCompanyUserWatchCountCompleted(@Param("companyUserId") Long companyUserId,@Param("periodId") Long periodId);
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsUserCoursePeriodMapper.java

@@ -4,6 +4,7 @@ import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.param.CompanyRedPacketParam;
 import com.fs.course.vo.FsUserCoursePeriodVO;
 import com.fs.course.vo.PeriodRedPacketVO;
+import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -127,4 +128,9 @@ public interface FsUserCoursePeriodMapper
      */
     @Update("update fs_user_course_period set period_status = 3, update_time = now() where period_status = 2 and period_end_time < #{now}")
     void endPeriod(@Param("now") LocalDate now);
+
+
+    @Select("select * from fs_user_course_period where find_in_set(${companyId},company_id) and #{previousDay} >= period_starting_time and #{previousDay} <= period_end_time ")
+    List<Long> queryPeriod(@Param("companyId") Long companyId,
+                           @Param("previousDay") LocalDate previousDay);
 }

+ 4 - 1
fs-service-system/src/main/java/com/fs/sop/mapper/QwSopLogsMapper.java

@@ -13,6 +13,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
+import java.time.LocalDate;
 import java.util.List;
 
 /**
@@ -289,6 +290,8 @@ public interface QwSopLogsMapper extends BaseMapper<QwSopLogs> {
     void batchUpdateQwSopLogsById(@Param("data") List<QwSopLogs> logs);
 
     @DataSource(DataSourceType.SOP)
-    Long selectQwSopLogsCountByQwUserId(@Param("data") List<String> qwUserIdList);
+    Long selectQwSopLogsCountByQwUserId(@Param("data") List<String> qwUserIdList,
+                                        @Param("periodId") Long periodId,
+                                        @Param("previousDay") LocalDate previousDay);
 
 }

+ 8 - 1
fs-service-system/src/main/java/com/fs/statis/domain/FsStatisSalerWatch.java

@@ -5,6 +5,8 @@ import lombok.NoArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 
+import java.time.LocalDate;
+
 /**
  * 销售观看统计实体类
  */
@@ -66,7 +68,7 @@ public class FsStatisSalerWatch {
     /**
      * 未上线-未参与
      */
-    private Long offlineNotPart; // 注意:原SQL中 'offine_not_part' 可能有拼写错误,这里修正为 offlineNotPart
+    private Long offlineNotPart;
 
     /**
      * 未上线-未观看 (原SQL注释为'为观看',推测应为'未观看')
@@ -102,4 +104,9 @@ public class FsStatisSalerWatch {
      * 训练营id
      */
     private Long periodId;
+
+    /**
+     * 数据日期
+     */
+    private LocalDate dataDate;
 }

+ 0 - 5
fs-service-system/src/main/java/com/fs/statis/mapper/FsStatisPeriodWatchMapper.java

@@ -93,11 +93,6 @@ public interface FsStatisPeriodWatchMapper {
      *
      * @return 实体对象列表
      */
-    @Select("SELECT id, period_id, period_num, not_reg_num, registered_num, reg_rate, " +
-            "watch_completed_rate, offline_total, offline_not_reg_num, offline_not_watch_num, " +
-            "online_total, online_rate, online_watch_completed_rate, online_watch_not_completed, " +
-            "online_watch_completed, data_date " +
-            "FROM fs_statis_period_watch")
     List<FsStatisPeriodWatch> selectAll();
 
     List<FsStatisPeriodWatch> queryList(StatsWatchLogPageListDTO param);

+ 1 - 0
fs-service-system/src/main/java/com/fs/statis/mapper/FsStatisSalerWatchMapper.java

@@ -82,4 +82,5 @@ public interface FsStatisSalerWatchMapper {
 
     List<FsStatisSalerWatch> queryList(StatsWatchLogPageListDTO param);
 
+    void batchSave(@Param("list") List<FsStatisSalerWatch> writeData);
 }

+ 63 - 18
fs-service-system/src/main/java/com/fs/statis/service/impl/FsStatisSalerWatchServiceImpl.java

@@ -2,21 +2,29 @@ package com.fs.statis.service.impl;
 
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.course.domain.FsUserCoursePeriod;
+import com.fs.course.mapper.FsUserCoursePeriodMapper;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.statis.domain.FsStatisSalerWatch;
 import com.fs.statis.dto.StatsWatchLogPageListDTO;
 import com.fs.statis.mapper.FsStatisSalerWatchMapper;
 import com.fs.statis.service.FsStatisSalerWatchService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 销售观看统计服务实现类
  */
-@Service
+@Service("fsStatisSalerWatchService")
+@Slf4j
 public class FsStatisSalerWatchServiceImpl implements FsStatisSalerWatchService {
 
     private final FsStatisSalerWatchMapper fsStatisSalerWatchMapper;
@@ -27,12 +35,15 @@ public class FsStatisSalerWatchServiceImpl implements FsStatisSalerWatchService
 
     private final QwSopLogsMapper qwSopLogsMapper;
 
+    private final FsUserCoursePeriodMapper fsUserCoursePeriodMapper;
+
     @Autowired
-    public FsStatisSalerWatchServiceImpl(FsStatisSalerWatchMapper fsStatisSalerWatchMapper, CompanyUserMapper companyUserMapper, QwUserMapper qwUserMapper, QwSopLogsMapper qwSopLogsMapper) {
+    public FsStatisSalerWatchServiceImpl(FsStatisSalerWatchMapper fsStatisSalerWatchMapper, CompanyUserMapper companyUserMapper, QwUserMapper qwUserMapper, QwSopLogsMapper qwSopLogsMapper, FsUserCoursePeriodMapper fsUserCoursePeriodMapper) {
         this.fsStatisSalerWatchMapper = fsStatisSalerWatchMapper;
         this.companyUserMapper = companyUserMapper;
         this.qwUserMapper = qwUserMapper;
         this.qwSopLogsMapper = qwSopLogsMapper;
+        this.fsUserCoursePeriodMapper = fsUserCoursePeriodMapper;
     }
 
     /**
@@ -105,26 +116,60 @@ public class FsStatisSalerWatchServiceImpl implements FsStatisSalerWatchService
         // 获取前一天的时间
         List<CompanyUser> companyUserList = this.companyUserMapper.selectAllCompanyUserList();
 
+
+        List<FsStatisSalerWatch> writeData = new ArrayList<>();
+
+        LocalDate previousDay = LocalDate.now().minusDays(1);
         for (CompanyUser companyUser : companyUserList) {
+
+            if(companyUser.getCompanyId() == null) {
+                log.info("销售{} 对应公司id {} 为空!",companyUser.getUserId(),companyUser.getCompanyId());
+                continue;
+            }
+            // 确定当前销售对应的营期
+            List<Long> periodList = fsUserCoursePeriodMapper.queryPeriod(companyUser.getCompanyId(),previousDay);
+
             // 找到销售关联的企微账号
             List<String> qwUserIdList = qwUserMapper.findQwUserIdListByCompanyUserId(companyUser.getUserId());
-            // 去sop记录表找对应的SOP发送记录,记录数作为营期人数
-            Long periodCount = qwSopLogsMapper.selectQwSopLogsCountByQwUserId(qwUserIdList);
-            // 再去course_watch_log找对应的销售观看记录作为已报名数
-            Long registerCount = companyUserMapper.queryCompanyUserWatchCount(companyUser.getUserId());
-            Long completedCount = companyUserMapper.queryCompanyUserWatchCountCompleted(companyUser.getUserId());
-
-
-            FsStatisSalerWatch fsStatisSalerWatch = new FsStatisSalerWatch();
-            fsStatisSalerWatch.setDeptId(companyUser.getDeptId());
-            fsStatisSalerWatch.setCompanyUserId(companyUser.getUserId());
-            fsStatisSalerWatch.setTrainCampNum(periodCount);
-            fsStatisSalerWatch.setNotRegisteredNum(periodCount - registerCount);
-            fsStatisSalerWatch.setRegisteredNum(registerCount);
-            fsStatisSalerWatch.setCompletedNum(completedCount);
-            fsStatisSalerWatch.setFinishedRate((float) (completedCount / registerCount));
-            fsStatisSalerWatch.setRegRate((float) (registerCount / periodCount));
 
+            for (Long periodId : periodList) {
+                // 去sop记录表找对应的SOP发送记录,记录数作为营期人数
+                Long periodCount = qwSopLogsMapper.selectQwSopLogsCountByQwUserId(qwUserIdList,periodId,previousDay);
+                // 再去course_watch_log找对应的销售观看记录作为已报名数
+                Long registerCount = companyUserMapper.queryCompanyUserWatchCount(companyUser.getUserId(),periodId);
+                Long completedCount = companyUserMapper.queryCompanyUserWatchCountCompleted(companyUser.getUserId(),periodId);
+
+
+                FsStatisSalerWatch fsStatisSalerWatch = new FsStatisSalerWatch();
+                fsStatisSalerWatch.setDeptId(companyUser.getDeptId());
+                fsStatisSalerWatch.setCompanyUserId(companyUser.getUserId());
+                fsStatisSalerWatch.setTrainCampNum(periodCount);
+                fsStatisSalerWatch.setNotRegisteredNum(periodCount - registerCount);
+                fsStatisSalerWatch.setRegisteredNum(registerCount);
+                fsStatisSalerWatch.setCompletedNum(completedCount);
+
+                float regRate = 0.0f;
+                if(periodCount != 0) {
+                    regRate = registerCount / periodCount;
+                }
+                float finishedRate = 0.0f;
+                if(registerCount != 0) {
+                    finishedRate = completedCount / registerCount;
+                }
+
+
+                fsStatisSalerWatch.setRegRate(regRate);
+                fsStatisSalerWatch.setFinishedRate(finishedRate);
+                fsStatisSalerWatch.setDataDate(previousDay);
+
+                fsStatisSalerWatch.setPeriodId(periodId);
+
+                writeData.add(fsStatisSalerWatch);
+            }
+        }
+
+        if(CollectionUtils.isNotEmpty(writeData)){
+            fsStatisSalerWatchMapper.batchSave(writeData);
         }
     }
 }

+ 19 - 2
fs-service-system/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -501,10 +501,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ${params.dataScope}
     </select>
     <select id="queryCompanyUserWatchCount" resultType="java.lang.Long">
-        select count(1) from fs_course_watch_log where company_user_id = #{companyUserId}
+        select count(1) from fs_course_watch_log
+        <where>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
+            <if test="periodId != null">
+                AND period_id = #{periodId}
+            </if>
+        </where>
     </select>
     <select id="queryCompanyUserWatchCountCompleted" resultType="java.lang.Long">
-
+        select count(1) from fs_course_watch_log
+        <where>
+            AND log_type = 2
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
+            <if test="periodId != null">
+                AND period_id = #{periodId}
+            </if>
+        </where>
     </select>
 
     <update id="setIsRegisterMember" parameterType="Long">

+ 14 - 8
fs-service-system/src/main/resources/mapper/sop/QwSopLogsMapper.xml

@@ -553,15 +553,21 @@
         ORDER BY send_time desc
     </select>
     <select id="selectQwSopLogsCountByQwUserId" resultType="java.lang.Long">
-        select count(1) from qw_sop_logs where
-            type = '0'
+        select count(1) from qw_sop_logs
+        <where>
+            AND type = '0'
             AND send_status = '1'
-            AND create_time >= CURDATE()
-            AND create_time &lt; DATE_ADD(CURDATE(), INTERVAL 1 DAY)
-            AND qw_userid in
-            <foreach collection="data" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
+            AND DATE(real_send_time) = #{previousDay}
+            AND user_logs_id = #{periodId}
+            <if test="data != null and data.size() > 0">
+                AND qw_userid in
+                <foreach collection="data" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+
+        </where>
+
     </select>
 
 

+ 0 - 20
fs-service-system/src/main/resources/mapper/statis/FsStatisEveryDayMapper.xml

@@ -45,26 +45,6 @@
         where id = #{id,jdbcType=INTEGER}
     </delete>
 
-    <!-- 插入记录 (所有字段) -->
-    <insert id="insert" parameterType="com.fs.statis.domain.FsStatisEveryDayWatch" useGeneratedKeys="true" keyProperty="id">
-        insert into fs_statis_every_day_watch (
-            data_date, period_id, period_num,
-            not_reg_num, registered_num, reg_rate,
-            completed_rate, offline_total, offline_not_reg_num,
-            offline_not_watch_num, online_total, online_rate,
-            online_completed_rate, online_not_comp_rate_num,
-            online_completed_num, company_user_id
-        )
-        values (
-                   #{dataDate,jdbcType=TIMESTAMP}, #{periodId,jdbcType=INTEGER}, #{periodNum,jdbcType=INTEGER},
-                   #{notRegNum,jdbcType=INTEGER}, #{registeredNum,jdbcType=INTEGER}, #{regRate,jdbcType=REAL},
-                   #{completedRate,jdbcType=REAL}, #{offlineTotal,jdbcType=INTEGER}, #{offlineNotRegNum,jdbcType=INTEGER},
-                   #{offlineNotWatchNum,jdbcType=INTEGER}, #{onlineTotal,jdbcType=INTEGER}, #{onlineRate,jdbcType=REAL},
-                   #{onlineCompletedRate,jdbcType=REAL}, #{onlineNotCompRateNum,jdbcType=INTEGER},
-                   #{onlineCompletedNum,jdbcType=INTEGER}, #{companyUserId,jdbcType=INTEGER}
-               )
-    </insert>
-
     <!-- 选择性插入记录 (只插入非空字段) -->
     <insert id="insertSelective" parameterType="com.fs.statis.domain.FsStatisEveryDayWatch" useGeneratedKeys="true" keyProperty="id">
         insert into fs_statis_every_day_watch

+ 0 - 86
fs-service-system/src/main/resources/mapper/statis/FsStatisPeriodWatchMapper.xml

@@ -30,92 +30,6 @@
         online_watch_completed, data_date
     </sql>
 
-    <!-- 根据主键查询数据 -->
-    <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
-        SELECT
-        <include refid="Base_Column_List" />
-        FROM fs_statis_period_watch
-        WHERE id = #{id,jdbcType=INTEGER}
-    </select>
-
-    <!-- 新增数据 -->
-    <insert id="insert" parameterType="com.fs.statis.domain.FsStatisPeriodWatch">
-        INSERT INTO fs_statis_period_watch (
-            id, period_id, period_num, not_reg_num, registered_num, reg_rate,
-            watch_completed_rate, offline_total, offline_not_reg_num, offline_not_watch_num,
-            online_total, online_rate, online_watch_completed_rate, online_watch_not_completed,
-            online_watch_completed, data_date
-        )
-        VALUES (
-                   #{id,jdbcType=INTEGER}, #{periodId,jdbcType=INTEGER}, #{periodNum,jdbcType=INTEGER},
-                   #{notRegNum,jdbcType=INTEGER}, #{registeredNum,jdbcType=INTEGER}, #{regRate,jdbcType=DECIMAL},
-                   #{watchCompletedRate,jdbcType=DECIMAL}, #{offlineTotal,jdbcType=INTEGER},
-                   #{offlineNotRegNum,jdbcType=INTEGER}, #{offlineNotWatchNum,jdbcType=INTEGER},
-                   #{onlineTotal,jdbcType=INTEGER}, #{onlineRate,jdbcType=DECIMAL},
-                   #{onlineWatchCompletedRate,jdbcType=DECIMAL}, #{onlineWatchNotCompleted,jdbcType=INTEGER},
-                   #{onlineWatchCompleted,jdbcType=INTEGER}, #{dataDate,jdbcType=DATE}
-               )
-    </insert>
-
-    <!-- 根据主键更新数据 (动态SQL,只更新非null字段) -->
-    <update id="updateById" parameterType="com.fs.statis.domain.FsStatisPeriodWatch">
-        UPDATE fs_statis_period_watch
-        <set>
-            <if test="periodId != null">
-                period_id = #{periodId,jdbcType=INTEGER},
-            </if>
-            <if test="periodNum != null">
-                period_num = #{periodNum,jdbcType=INTEGER},
-            </if>
-            <if test="notRegNum != null">
-                not_reg_num = #{notRegNum,jdbcType=INTEGER},
-            </if>
-            <if test="registeredNum != null">
-                registered_num = #{registeredNum,jdbcType=INTEGER},
-            </if>
-            <if test="regRate != null">
-                reg_rate = #{regRate,jdbcType=DECIMAL},
-            </if>
-            <if test="watchCompletedRate != null">
-                watch_completed_rate = #{watchCompletedRate,jdbcType=DECIMAL},
-            </if>
-            <if test="offlineTotal != null">
-                offline_total = #{offlineTotal,jdbcType=INTEGER},
-            </if>
-            <if test="offlineNotRegNum != null">
-                offline_not_reg_num = #{offlineNotRegNum,jdbcType=INTEGER},
-            </if>
-            <if test="offlineNotWatchNum != null">
-                offline_not_watch_num = #{offlineNotWatchNum,jdbcType=INTEGER},
-            </if>
-            <if test="onlineTotal != null">
-                online_total = #{onlineTotal,jdbcType=INTEGER},
-            </if>
-            <if test="onlineRate != null">
-                online_rate = #{onlineRate,jdbcType=DECIMAL},
-            </if>
-            <if test="onlineWatchCompletedRate != null">
-                online_watch_completed_rate = #{onlineWatchCompletedRate,jdbcType=DECIMAL},
-            </if>
-            <if test="onlineWatchNotCompleted != null">
-                online_watch_not_completed = #{onlineWatchNotCompleted,jdbcType=INTEGER},
-            </if>
-            <if test="onlineWatchCompleted != null">
-                online_watch_completed = #{onlineWatchCompleted,jdbcType=INTEGER},
-            </if>
-            <if test="dataDate != null">
-                data_date = #{dataDate,jdbcType=DATE},
-            </if>
-        </set>
-        WHERE id = #{id,jdbcType=INTEGER}
-    </update>
-
-    <!-- 根据主键删除数据 -->
-    <delete id="deleteById" parameterType="java.lang.Integer">
-        DELETE FROM fs_statis_period_watch
-        WHERE id = #{id,jdbcType=INTEGER}
-    </delete>
-
     <!-- 查询所有数据 -->
     <select id="selectAll" resultMap="BaseResultMap">
         SELECT

+ 24 - 53
fs-service-system/src/main/resources/mapper/statis/FsStatisSalerWatchMapper.xml

@@ -30,20 +30,6 @@
         online_incomplete_playback, online_complete_playback
     </sql>
 
-    <!-- 根据ID查询销售观看统计 -->
-    <select id="findById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM fs_statis_saler_watch
-        WHERE id = #{id,jdbcType=INTEGER}
-    </select>
-
-    <!-- 查询所有销售观看统计 -->
-    <select id="findAll" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM fs_statis_saler_watch
-    </select>
     <select id="queryList" resultType="com.fs.statis.domain.FsStatisSalerWatch">
         select * from fs_statis_saler_watch
         <where>
@@ -65,51 +51,36 @@
         </where>
     </select>
 
-    <!-- 新增销售观看统计 -->
-    <insert id="insert" parameterType="com.fs.statis.domain.FsStatisSalerWatch" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
+    <insert id="batchSave">
         INSERT INTO fs_statis_saler_watch (
             dept_id, company_user_id, train_camp_num,
             not_registered_num, registered_num, reg_rate,
             finished_rate, offline_total, offline_not_part,
             offline_not_watched, online_total, online_online_rate,
             online_playback_comple_rate, online_incomplete_playback,
-            online_complete_playback
-        ) VALUES (
-                     #{deptId,jdbcType=INTEGER}, #{companyUserId,jdbcType=INTEGER}, #{trainCampNum,jdbcType=INTEGER},
-                     #{notRegisteredNum,jdbcType=INTEGER}, #{registeredNum,jdbcType=INTEGER}, #{regRate,jdbcType=FLOAT},
-                     #{finishedRate,jdbcType=FLOAT}, #{offlineTotal,jdbcType=INTEGER}, #{offlineNotPart,jdbcType=INTEGER},
-                     #{offlineNotWatched,jdbcType=INTEGER}, #{onlineTotal,jdbcType=INTEGER}, #{onlineOnlineRate,jdbcType=FLOAT},
-                     #{onlinePlaybackCompleRate,jdbcType=FLOAT}, #{onlineIncompletePlayback,jdbcType=INTEGER},
-                     #{onlineCompletePlayback,jdbcType=INTEGER}
-                 )
+            online_complete_playback,period_id,data_date
+        ) VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+                #{item.deptId,jdbcType=INTEGER},
+                #{item.companyUserId,jdbcType=INTEGER},
+                #{item.trainCampNum,jdbcType=INTEGER},
+                #{item.notRegisteredNum,jdbcType=INTEGER},
+                #{item.registeredNum,jdbcType=INTEGER},
+                #{item.regRate,jdbcType=FLOAT},
+                #{item.finishedRate,jdbcType=FLOAT},
+                #{item.offlineTotal,jdbcType=INTEGER},
+                #{item.offlineNotPart,jdbcType=INTEGER},
+                #{item.offlineNotWatched,jdbcType=INTEGER},
+                #{item.onlineTotal,jdbcType=INTEGER},
+                #{item.onlineOnlineRate,jdbcType=FLOAT},
+                #{item.onlinePlaybackCompleRate,jdbcType=FLOAT},
+                #{item.onlineIncompletePlayback,jdbcType=INTEGER},
+                #{item.onlineCompletePlayback,jdbcType=INTEGER},
+                #{item.periodId,jdbcType=INTEGER},
+                #{item.dataDate,jdbcType=VARCHAR}
+            )
+        </foreach>
     </insert>
 
-    <!-- 更新销售观看统计 -->
-    <update id="update" parameterType="com.fs.statis.domain.FsStatisSalerWatch">
-        UPDATE fs_statis_saler_watch
-        SET
-            dept_id = #{deptId,jdbcType=INTEGER},
-            company_user_id = #{companyUserId,jdbcType=INTEGER},
-            train_camp_num = #{trainCampNum,jdbcType=INTEGER},
-            not_registered_num = #{notRegisteredNum,jdbcType=INTEGER},
-            registered_num = #{registeredNum,jdbcType=INTEGER},
-            reg_rate = #{regRate,jdbcType=FLOAT},
-            finished_rate = #{finishedRate,jdbcType=FLOAT},
-            offline_total = #{offlineTotal,jdbcType=INTEGER},
-            offline_not_part = #{offlineNotPart,jdbcType=INTEGER},
-            offline_not_watched = #{offlineNotWatched,jdbcType=INTEGER},
-            online_total = #{onlineTotal,jdbcType=INTEGER},
-            online_online_rate = #{onlineOnlineRate,jdbcType=FLOAT},
-            online_playback_comple_rate = #{onlinePlaybackCompleRate,jdbcType=FLOAT},
-            online_incomplete_playback = #{onlineIncompletePlayback,jdbcType=INTEGER},
-            online_complete_playback = #{onlineCompletePlayback,jdbcType=INTEGER}
-        WHERE id = #{id,jdbcType=INTEGER}
-    </update>
-
-    <!-- 根据ID删除销售观看统计 -->
-    <delete id="deleteById" parameterType="java.lang.Integer">
-        DELETE FROM fs_statis_saler_watch
-        WHERE id = #{id,jdbcType=INTEGER}
-    </delete>
-
 </mapper>