Explorar o código

我的看课记录 批量添加标签

三七 hai 2 semanas
pai
achega
1453a79866

+ 24 - 0
fs-company/src/main/java/com/fs/company/controller/course/FsCourseWatchLogController.java

@@ -20,17 +20,22 @@ import com.fs.course.vo.FsCourseWatchLogListVO;
 import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
+import com.fs.qw.param.QwTagSearchParam;
 import com.fs.qw.param.QwWatchLogStatisticsListParam;
+import com.fs.qw.service.IQwTagService;
 import com.fs.qw.service.IQwWatchLogService;
 import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
 import com.fs.qw.vo.QwWatchLogStatisticsListVO;
 import com.fs.sop.mapper.SopUserLogsMapper;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 短链课程看课记录Controller
@@ -60,6 +65,9 @@ public class FsCourseWatchLogController extends BaseController
     @Autowired
     private IFsUserCoursePeriodDaysService userCoursePeriodDaysService;
 
+    @Autowired
+    private IQwTagService iQwTagService;
+
     /**
      * 查询短链课程看课记录列表
      */
@@ -181,6 +189,22 @@ public class FsCourseWatchLogController extends BaseController
         startPage();
 
         List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        list.forEach(vo -> {
+            if (!Objects.equals(vo.getTagIds(), "[]") && vo.getTagIds()!=null) {
+                QwTagSearchParam tagParam = new QwTagSearchParam();
+                Gson gson = new Gson();
+                List<String> tagIds = gson.fromJson(
+                        vo.getTagIds(),
+                        new TypeToken<List<String>>() {
+                        }.getType()
+                );
+
+                tagParam.setTagIds(tagIds);
+
+                vo.setTagIdsName(iQwTagService.selectQwTagListByTagIds(tagParam));
+            }
+
+        });
         return getDataTable(list);
     }
 

+ 4 - 4
fs-company/src/main/java/com/fs/company/controller/qw/QwExternalContactController.java

@@ -474,8 +474,8 @@ public class QwExternalContactController extends BaseController
         return qwExternalContactService.addUserTag(Param);
     }
 
-    @PreAuthorize("@ss.hasPermi('qw:externalContact:addTag')")
-    @Log(title = "添加标签", businessType = BusinessType.UPDATE)
+    @PreAuthorize("@ss.hasPermi('qw:externalContact:addTagByWatch')")
+    @Log(title = "看课记录-添加标签", businessType = BusinessType.UPDATE)
     @PostMapping("/addTagByWatch")
     public R addTagByWatch(@RequestBody QwExtContactAddTagByWatchParam Param) throws JSONException {
 
@@ -492,8 +492,8 @@ public class QwExternalContactController extends BaseController
         return qwExternalContactService.delUserTag(Param);
     }
 
-    @PreAuthorize("@ss.hasPermi('qw:externalContact:delTag')")
-    @Log(title = "在看课记录这移除标签", businessType = BusinessType.UPDATE)
+    @PreAuthorize("@ss.hasPermi('qw:externalContact:delTagByWatch')")
+    @Log(title = "看课记录-移除标签", businessType = BusinessType.UPDATE)
     @PostMapping("/delTagByWatch")
     public R delTagByWatch(@RequestBody QwExtContactAddTagByWatchParam Param)
     {

+ 3 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -128,6 +128,8 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(@Param("maps") FsCourseWatchLogListParam param);
 
+    List<QwExternalContact> selectFsCourseWatchLogListByWatchLogVO(@Param("maps") FsCourseWatchLogListParam param);
+
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListByParam(FsCourseWatchLogListParam param);
 
     @Select("select l.*,v.title,c.course_name from fs_course_watch_log l LEFT JOIN fs_user_course_video v ON v.video_id = l.video_id LEFT JOIN fs_user_course c ON c.course_id = l.course_id WHERE l.qw_external_contact_id =#{id} ORDER BY l.create_time  desc LIMIT 1  ")
@@ -656,7 +658,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
     @Select("<script>" +
             "select qec.id,qec.user_id,qec.external_user_id,qec.corp_id,qec.tag_ids,qec.name from fs_course_watch_log qwl " +
             "left join qw_external_contact qec on qwl.qw_external_contact_id=qec.id " +
-            "        where qwl.log_id in\n" +
+            "        where qec.status=0 and qwl.log_id in\n" +
             "        <foreach collection=\"logIds\" item=\"id\" open=\"(\" separator=\",\" close=\")\">\n" +
             "            #{id}\n" +
             "        </foreach>" +

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

@@ -43,6 +43,7 @@ import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.mapper.QwWatchLogMapper;
 import com.fs.qw.param.QwSidebarStatsParam;
+import com.fs.qw.param.QwTagSearchParam;
 import com.fs.qw.param.SendSopParamDetails;
 import com.fs.qw.vo.QwSopCourseFinishTempSetting;
 import com.fs.qw.vo.QwSopTempSetting;
@@ -53,6 +54,8 @@ import com.fs.store.service.cache.IFsUserCacheService;
 import com.fs.store.service.cache.IFsUserCourseCacheService;
 import com.fs.system.service.ISysConfigService;
 import com.fs.tag.service.FsTagUpdateService;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import com.hc.openapi.tool.util.StringUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;

+ 8 - 0
fs-service/src/main/java/com/fs/course/vo/FsCourseWatchLogListVO.java

@@ -6,6 +6,7 @@ import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 短链课程看课记录对象 fs_course_watch_log
@@ -144,4 +145,11 @@ public class FsCourseWatchLogListVO extends BaseEntity
 
     //看课方式:1 app  2 小程序
     private Integer watchType;
+
+    /**
+    * 标签
+    */
+    private String tagIds;
+
+    private List<String> tagIdsName;
 }

+ 1 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -275,6 +275,7 @@ public interface QwUserMapper extends BaseMapper<QwUser>
 
     @Select("SELECT\n" +
             "\tqu.id AS dictValue,\n" +
+            "\tqu.qw_user_id,\n" +
             "\tqu.qw_user_name AS dictLabel,\n" +
             "\tqu.corp_id,\n" +
             "\tqc.corp_name\n" +

+ 5 - 0
fs-service/src/main/java/com/fs/qw/param/QwExtContactAddTagByWatchParam.java

@@ -1,5 +1,6 @@
 package com.fs.qw.param;
 
+import com.fs.course.param.FsCourseWatchLogListParam;
 import lombok.Data;
 
 import java.util.List;
@@ -15,4 +16,8 @@ public class QwExtContactAddTagByWatchParam {
     */
     List<Long> logIds;
     List<String> tagIds;
+
+    private boolean filter;
+
+    private FsCourseWatchLogListParam param;
 }

+ 17 - 4
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -1440,7 +1440,15 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
             // 1. 批量查询所有用户数据
             List<QwExternalContact> contacts;
             try {
-                contacts = fsCourseWatchLogMapper.selectQwWatchLogFomExtContact(param.getLogIds());
+                if(param.isFilter()){
+                    param.getParam().setPageNum(null);
+                    param.getParam().setPageSize(null);
+                    param.getParam().setExternalStatus(0);
+                    contacts = fsCourseWatchLogMapper.selectFsCourseWatchLogListByWatchLogVO(param.getParam());
+                }else {
+                    contacts = fsCourseWatchLogMapper.selectQwWatchLogFomExtContact(param.getLogIds());
+                }
+
                 if (contacts == null || contacts.isEmpty()) {
                     return R.error("成功:0,失败:" + param.getLogIds().size());
                 }
@@ -1719,10 +1727,15 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
             // 1. 批量查询所有用户数据
             List<QwExternalContact> contacts;
             try {
-                contacts = fsCourseWatchLogMapper.selectQwWatchLogFomExtContact(param.getLogIds());
-                if (contacts == null || contacts.isEmpty()) {
-                    return R.error("成功:0,失败:" + param.getLogIds().size());
+                if(param.isFilter()){
+                    param.getParam().setPageNum(null);
+                    param.getParam().setPageSize(null);
+                    param.getParam().setExternalStatus(0);
+                    contacts = fsCourseWatchLogMapper.selectFsCourseWatchLogListByWatchLogVO(param.getParam());
+                }else {
+                    contacts = fsCourseWatchLogMapper.selectQwWatchLogFomExtContact(param.getLogIds());
                 }
+
             } catch (Exception e) {
                 return R.error("批量查询用户数据失败:" + e.getMessage());
             }

+ 2 - 1
fs-service/src/main/java/com/fs/qw/vo/QwOptionsVO.java

@@ -6,6 +6,7 @@ import lombok.Data;
 public class QwOptionsVO {
     String dictValue;
     String dictLabel;
-    String CorpId;
+    String qwUserId;
+    String corpId;
     String corpName;
 }

+ 288 - 156
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -35,164 +35,296 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                camp_period_time,project,period_id,watch_type  from fs_course_watch_log
     </sql>
 
-    <select id="selectFsCourseWatchLogList" parameterType="FsCourseWatchLog" resultMap="FsCourseWatchLogResult">
-        <include refid="selectFsCourseWatchLogVo"/>
-        <where>
-            <if test="userId != null "> and user_id = #{userId}</if>
-            <if test="videoId != null "> and video_id = #{videoId}</if>
-            <if test="logType != null "> and log_type = #{logType}</if>
-            <if test="qwExternalContactId != null "> and qw_external_contact_id = #{qwExternalContactId}</if>
-            <if test="duration != null "> and duration = #{duration}</if>
-            <if test="qwUserId != null  and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
-            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
-            <if test="companyId != null "> and company_id = #{companyId}</if>
-            <if test="courseId != null "> and course_id = #{courseId}</if>
-            <if test="sendType != null "> and send_type = #{sendType}</if>
-            <if test="campPeriodTime != null "> and camp_period_time = #{campPeriodTime}</if>
-            <if test="project != null "> and project = #{project}</if>
-            <if test="watchType != null "> and watch_type = #{watchType}</if>
-        </where>
-    </select>
+            <select id="selectFsCourseWatchLogList" parameterType="FsCourseWatchLog" resultMap="FsCourseWatchLogResult">
+                <include refid="selectFsCourseWatchLogVo"/>
+                <where>
+                    <if test="userId != null "> and user_id = #{userId}</if>
+                    <if test="videoId != null "> and video_id = #{videoId}</if>
+                    <if test="logType != null "> and log_type = #{logType}</if>
+                    <if test="qwExternalContactId != null "> and qw_external_contact_id = #{qwExternalContactId}</if>
+                    <if test="duration != null "> and duration = #{duration}</if>
+                    <if test="qwUserId != null  and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
+                    <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+                    <if test="companyId != null "> and company_id = #{companyId}</if>
+                    <if test="courseId != null "> and course_id = #{courseId}</if>
+                    <if test="sendType != null "> and send_type = #{sendType}</if>
+                    <if test="campPeriodTime != null "> and camp_period_time = #{campPeriodTime}</if>
+                    <if test="project != null "> and project = #{project}</if>
+                    <if test="watchType != null "> and watch_type = #{watchType}</if>
+                </where>
+            </select>
 
-    <select id="selectFsCourseWatchLogByLogId" parameterType="Long" resultMap="FsCourseWatchLogResult">
-        <include refid="selectFsCourseWatchLogVo"/>
-        where log_id = #{logId}
-    </select>
+            <select id="selectFsCourseWatchLogByLogId" parameterType="Long" resultMap="FsCourseWatchLogResult">
+                <include refid="selectFsCourseWatchLogVo"/>
+                where log_id = #{logId}
+            </select>
 
-    <select id="selectFsCourseWatchLogListVO" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
-        select l.log_id,l.project,l.period_id,l.user_id,uc.course_name,v.title as video_name,qec.avatar as external_user_avatar,qec.status as externalStatus,
-        l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
-        cu.nick_name as company_user_name ,l.send_type,l.create_time,l.update_time,l.last_heartbeat_time,
-        qu.qw_user_name,qec.name as external_user_name,c.company_id,u.avatar as fsAvatar,u.nick_name as fsNickName,qec.create_time as qec_create_time,
-        u.is_vip isVip,l.reward_type,cu.dept_id, l.watch_type
-         from fs_course_watch_log l
-         left join fs_user_course_video v on v.video_id = l.video_id
-         left join fs_user_course uc on uc.course_id = l.course_id
-         left join fs_user u on u.user_id = l.user_id
-         left join company_user cu on cu.user_id = l.company_user_id
-         left join company c on c.company_id = l.company_id
-         LEFT JOIN qw_user qu on qu.id= l.qw_user_id
-         LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
-        <where>
-            <if test ='maps.isVip != null and maps.isVip == 0'>
-                and (l.user_id = 0 or l.user_id is null)
-            </if>
-            <if test ='maps.isVip != null and maps.isVip == 1'>
-                and l.user_id != 0 and l.user_id is not null
-            </if>
-            <if test ='maps.sendType !=null'>
-                and l.send_type = #{maps.sendType}
-            </if>
-            <if test ='maps.userId !=null'>
-                and l.user_id = #{maps.userId}
-            </if>
-            <if test ='maps.logId !=null'>
-                and l.log_id = #{maps.logId}
-            </if>
-            <if test ='maps.project !=null'>
-                and l.project = #{maps.project}
-            </if>
-            <if test ='maps.qwExternalContactId !=null'>
-                and l.qw_external_contact_id = #{maps.qwExternalContactId}
-            </if>
-            <if test ='maps.qwUserId !=null'>
-                and l.qw_user_id = #{maps.qwUserId}
-            </if>
-            <if test ='maps.courseId !=null'>
-                and l.course_id = #{maps.courseId}
-            </if>
-            <if test ='maps.videoId !=null'>
-                and l.video_id = #{maps.videoId}
-            </if>
-            <if test ='maps.logType !=null'>
-                and l.log_type = #{maps.logType}
-            </if>
-            <if test ='maps.companyId !=null'>
-                and l.company_id = #{maps.companyId}
-            </if>
-            <if test ='maps.watchType !=null'>
-                and l.watch_type = #{maps.watchType}
-            </if>
-            <if test ='maps.companyUserId !=null'>
-                and l.company_user_id = #{maps.companyUserId}
-            </if>
-            <if test ='maps.companyUserName !=null and maps.companyUserName!=""'>
-                and cu.nick_name  like concat('%', #{maps.companyUserName}, '%')
-            </if>
-            <if test ='maps.nickName !=null and maps.nickName!=""'>
-                and u.nick_name  like concat('%', #{maps.nickName}, '%')
-            </if>
-            <if test ='maps.externalUserName !=null and maps.externalUserName!=""'>
-                and qec.name  like concat('%', #{maps.externalUserName}, '%')
-            </if>
-            <if test= 'maps.qecSTime != null '>
-                and DATE(qec.create_time) &gt;= DATE(#{maps.qecSTime})
-            </if>
-            <if test='maps.qecETime != null '>
-                and DATE(qec.create_time) &lt;= DATE(#{maps.qecETime})
-            </if>
-            <if test= 'maps.sTime != null '>
-                and l.create_time &gt;= #{maps.sTime}
-            </if>
-            <if test='maps.eTime != null '>
-                and l.create_time &lt;= #{maps.eTime}
-            </if>
-            <if test= 'maps.scheduleStartTime != null '>
-                and l.camp_period_time &gt;= #{maps.scheduleStartTime}
-            </if>
-            <if test='maps.scheduleEndTime != null '>
-                and l.camp_period_time &lt;= #{maps.scheduleEndTime}
-            </if>
-            <if test= 'maps.upSTime != null '>
-                and l.update_time &gt;= #{maps.upSTime}
-            </if>
-            <if test='maps.upETime != null '>
-                and l.update_time &lt; date_add(#{maps.upETime}, interval 1 day)
-            </if>
-            <if test="maps.sopIds != null and maps.sopIds.size() > 0">
-                and l.sop_id in
-                <foreach item="sopId" index="index" collection="maps.sopIds" open="(" separator="," close=")">
-                    #{sopId}
-                </foreach>
-            </if>
-            <if test ='maps.project !=null'>
-                and l.project = #{maps.project}
-            </if>
-            <if test="maps.sopId != null  and maps.sopId != '' ">
-                and l.sop_id = #{maps.sopId}
-            </if>
-            <if test="maps.externalStatus != null  and maps.externalStatus != '' ">
-                and qec.status = #{maps.externalStatus}
-            </if>
-            <if test="maps.periodId != null">
-                and l.period_id = #{maps.periodId}
-            </if>
-            <if test="maps.periodIds != null and maps.periodIds.size() > 0">
-                and l.period_id in
-                <foreach item="periodId" index="index" collection="maps.periodIds" open="(" separator="," close=")">
-                    #{periodId}
-                </foreach>
-            </if>
-            <if test="maps.qwUserName != null  and maps.qwUserName != '' ">
-                and qu.qw_user_name = #{maps.qwUserName}
-            </if>
-            <if test="maps.deptId != null  and maps.deptId != '' ">
-                and cu.dept_id = #{maps.deptId}
-            </if>
-            <if test='maps.cuDeptIdList != null and !maps.cuDeptIdList.isEmpty() and  maps.userType != "00" '>
-                AND cu.dept_id IN
-                <foreach collection='maps.cuDeptIdList' item='item' open='(' separator=',' close=')'>
-                    #{item}
-                </foreach>
-            </if>
-            <if test="maps.userIds != null and !maps.userIds.isEmpty()">
-                AND cu.user_id IN
-                    <foreach collection='maps.userIds' item='item' open='(' separator=',' close=')'>
-                        #{item}
-                    </foreach>
-            </if>
-                </where>
-                 order by l.finish_time desc,l.update_time desc,l.create_time desc
+            <select id="selectFsCourseWatchLogListVO" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
+                select l.log_id,l.project,l.period_id,l.user_id,uc.course_name,v.title as video_name,qec.avatar as external_user_avatar,qec.status as externalStatus,
+                l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
+                cu.nick_name as company_user_name ,l.send_type,l.create_time,l.update_time,l.last_heartbeat_time,
+                qu.qw_user_name,qec.name as external_user_name,c.company_id,u.avatar as fsAvatar,u.nick_name as fsNickName,qec.create_time as qec_create_time,
+                u.is_vip isVip,l.reward_type,cu.dept_id, l.watch_type,qec.tag_ids
+                 from fs_course_watch_log l
+                 left join fs_user_course_video v on v.video_id = l.video_id
+                 left join fs_user_course uc on uc.course_id = l.course_id
+                 left join fs_user u on u.user_id = l.user_id
+                 left join company_user cu on cu.user_id = l.company_user_id
+                 left join company c on c.company_id = l.company_id
+                 LEFT JOIN qw_user qu on qu.id= l.qw_user_id
+                 LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
+                <where>
+                    <if test ='maps.isVip != null and maps.isVip == 0'>
+                        and (l.user_id = 0 or l.user_id is null)
+                    </if>
+                    <if test ='maps.isVip != null and maps.isVip == 1'>
+                        and l.user_id != 0 and l.user_id is not null
+                    </if>
+                    <if test ='maps.sendType !=null'>
+                        and l.send_type = #{maps.sendType}
+                    </if>
+                    <if test ='maps.userId !=null'>
+                        and l.user_id = #{maps.userId}
+                    </if>
+                    <if test ='maps.logId !=null'>
+                        and l.log_id = #{maps.logId}
+                    </if>
+                    <if test ='maps.project !=null'>
+                        and l.project = #{maps.project}
+                    </if>
+                    <if test ='maps.qwExternalContactId !=null'>
+                        and l.qw_external_contact_id = #{maps.qwExternalContactId}
+                    </if>
+                    <if test ='maps.qwUserId !=null'>
+                        and l.qw_user_id = #{maps.qwUserId}
+                    </if>
+                    <if test ='maps.courseId !=null'>
+                        and l.course_id = #{maps.courseId}
+                    </if>
+                    <if test ='maps.videoId !=null'>
+                        and l.video_id = #{maps.videoId}
+                    </if>
+                    <if test ='maps.logType !=null'>
+                        and l.log_type = #{maps.logType}
+                    </if>
+                    <if test ='maps.companyId !=null'>
+                        and l.company_id = #{maps.companyId}
+                    </if>
+                    <if test ='maps.watchType !=null'>
+                        and l.watch_type = #{maps.watchType}
+                    </if>
+                    <if test ='maps.companyUserId !=null'>
+                        and l.company_user_id = #{maps.companyUserId}
+                    </if>
+                    <if test ='maps.companyUserName !=null and maps.companyUserName!=""'>
+                        and cu.nick_name  like concat('%', #{maps.companyUserName}, '%')
+                    </if>
+                    <if test ='maps.nickName !=null and maps.nickName!=""'>
+                        and u.nick_name  like concat('%', #{maps.nickName}, '%')
+                    </if>
+                    <if test ='maps.externalUserName !=null and maps.externalUserName!=""'>
+                        and qec.name  like concat('%', #{maps.externalUserName}, '%')
+                    </if>
+                    <if test= 'maps.qecSTime != null '>
+                        and DATE(qec.create_time) &gt;= DATE(#{maps.qecSTime})
+                    </if>
+                    <if test='maps.qecETime != null '>
+                        and DATE(qec.create_time) &lt;= DATE(#{maps.qecETime})
+                    </if>
+                    <if test= 'maps.sTime != null '>
+                        and l.create_time &gt;= #{maps.sTime}
+                    </if>
+                    <if test='maps.eTime != null '>
+                        and l.create_time &lt;= #{maps.eTime}
+                    </if>
+                    <if test= 'maps.scheduleStartTime != null '>
+                        and l.camp_period_time &gt;= #{maps.scheduleStartTime}
+                    </if>
+                    <if test='maps.scheduleEndTime != null '>
+                        and l.camp_period_time &lt;= #{maps.scheduleEndTime}
+                    </if>
+                    <if test= 'maps.upSTime != null '>
+                        and l.update_time &gt;= #{maps.upSTime}
+                    </if>
+                    <if test='maps.upETime != null '>
+                        and l.update_time &lt; date_add(#{maps.upETime}, interval 1 day)
+                    </if>
+                    <if test="maps.sopIds != null and maps.sopIds.size() > 0">
+                        and l.sop_id in
+                        <foreach item="sopId" index="index" collection="maps.sopIds" open="(" separator="," close=")">
+                            #{sopId}
+                        </foreach>
+                    </if>
+                    <if test ='maps.project !=null'>
+                        and l.project = #{maps.project}
+                    </if>
+                    <if test="maps.sopId != null  and maps.sopId != '' ">
+                        and l.sop_id = #{maps.sopId}
+                    </if>
+                    <if test="maps.externalStatus != null  and maps.externalStatus != '' ">
+                        and qec.status = #{maps.externalStatus}
+                    </if>
+                    <if test="maps.periodId != null">
+                        and l.period_id = #{maps.periodId}
+                    </if>
+                    <if test="maps.periodIds != null and maps.periodIds.size() > 0">
+                        and l.period_id in
+                        <foreach item="periodId" index="index" collection="maps.periodIds" open="(" separator="," close=")">
+                            #{periodId}
+                        </foreach>
+                    </if>
+                    <if test="maps.qwUserName != null  and maps.qwUserName != '' ">
+                        and qu.qw_user_name = #{maps.qwUserName}
+                    </if>
+                    <if test="maps.deptId != null  and maps.deptId != '' ">
+                        and cu.dept_id = #{maps.deptId}
+                    </if>
+                    <if test='maps.cuDeptIdList != null and !maps.cuDeptIdList.isEmpty() and  maps.userType != "00" '>
+                        AND cu.dept_id IN
+                        <foreach collection='maps.cuDeptIdList' item='item' open='(' separator=',' close=')'>
+                            #{item}
+                        </foreach>
+                    </if>
+                    <if test="maps.userIds != null and !maps.userIds.isEmpty()">
+                        AND cu.user_id IN
+                            <foreach collection='maps.userIds' item='item' open='(' separator=',' close=')'>
+                                #{item}
+                            </foreach>
+                    </if>
+                        </where>
+                         order by l.finish_time desc,l.update_time desc,l.create_time desc
+            </select>
+
+            <select id="selectFsCourseWatchLogListByWatchLogVO" resultType="com.fs.qw.domain.QwExternalContact">
+                        select qec.id,qec.user_id,qec.external_user_id,qec.corp_id,qec.tag_ids,qec.name
+                                from fs_course_watch_log l
+                        left join fs_user u on u.user_id = l.user_id
+                        left join company_user cu on cu.user_id = l.company_user_id
+                        LEFT JOIN qw_user qu on qu.id= l.qw_user_id
+                        LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
+                        <where>
+                            <if test ='maps.isVip != null and maps.isVip == 0'>
+                                and (l.user_id = 0 or l.user_id is null)
+                            </if>
+                            <if test ='maps.isVip != null and maps.isVip == 1'>
+                                and l.user_id != 0 and l.user_id is not null
+                            </if>
+                            <if test ='maps.sendType !=null'>
+                                and l.send_type = #{maps.sendType}
+                            </if>
+                            <if test ='maps.userId !=null'>
+                                and l.user_id = #{maps.userId}
+                            </if>
+                            <if test ='maps.logId !=null'>
+                                and l.log_id = #{maps.logId}
+                            </if>
+                            <if test ='maps.project !=null'>
+                                and l.project = #{maps.project}
+                            </if>
+                            <if test ='maps.qwExternalContactId !=null'>
+                                and l.qw_external_contact_id = #{maps.qwExternalContactId}
+                            </if>
+                            <if test ='maps.qwUserId !=null'>
+                                and l.qw_user_id = #{maps.qwUserId}
+                            </if>
+                            <if test ='maps.courseId !=null'>
+                                and l.course_id = #{maps.courseId}
+                            </if>
+                            <if test ='maps.videoId !=null'>
+                                and l.video_id = #{maps.videoId}
+                            </if>
+                            <if test ='maps.logType !=null'>
+                                and l.log_type = #{maps.logType}
+                            </if>
+                            <if test ='maps.companyId !=null'>
+                                and l.company_id = #{maps.companyId}
+                            </if>
+                            <if test ='maps.watchType !=null'>
+                                and l.watch_type = #{maps.watchType}
+                            </if>
+                            <if test ='maps.companyUserId !=null'>
+                                and l.company_user_id = #{maps.companyUserId}
+                            </if>
+                            <if test ='maps.companyUserName !=null and maps.companyUserName!=""'>
+                                and cu.nick_name  like concat('%', #{maps.companyUserName}, '%')
+                            </if>
+                            <if test ='maps.nickName !=null and maps.nickName!=""'>
+                                and u.nick_name  like concat('%', #{maps.nickName}, '%')
+                            </if>
+                            <if test ='maps.externalUserName !=null and maps.externalUserName!=""'>
+                                and qec.name  like concat('%', #{maps.externalUserName}, '%')
+                            </if>
+                            <if test= 'maps.qecSTime != null '>
+                                and DATE(qec.create_time) &gt;= DATE(#{maps.qecSTime})
+                            </if>
+                            <if test='maps.qecETime != null '>
+                                and DATE(qec.create_time) &lt;= DATE(#{maps.qecETime})
+                            </if>
+                            <if test= 'maps.sTime != null '>
+                                and l.create_time &gt;= #{maps.sTime}
+                            </if>
+                            <if test='maps.eTime != null '>
+                                and l.create_time &lt;= #{maps.eTime}
+                            </if>
+                            <if test= 'maps.scheduleStartTime != null '>
+                                and l.camp_period_time &gt;= #{maps.scheduleStartTime}
+                            </if>
+                            <if test='maps.scheduleEndTime != null '>
+                                and l.camp_period_time &lt;= #{maps.scheduleEndTime}
+                            </if>
+                            <if test= 'maps.upSTime != null '>
+                                and l.update_time &gt;= #{maps.upSTime}
+                            </if>
+                            <if test='maps.upETime != null '>
+                                and l.update_time &lt; date_add(#{maps.upETime}, interval 1 day)
+                            </if>
+                            <if test="maps.sopIds != null and maps.sopIds.size() > 0">
+                                and l.sop_id in
+                                <foreach item="sopId" index="index" collection="maps.sopIds" open="(" separator="," close=")">
+                                    #{sopId}
+                                </foreach>
+                            </if>
+                            <if test ='maps.project !=null'>
+                                and l.project = #{maps.project}
+                            </if>
+                            <if test="maps.sopId != null  and maps.sopId != '' ">
+                                and l.sop_id = #{maps.sopId}
+                            </if>
+                            <if test="maps.externalStatus != null  and maps.externalStatus != '' ">
+                                and qec.status = #{maps.externalStatus}
+                            </if>
+                            <if test="maps.periodId != null">
+                                and l.period_id = #{maps.periodId}
+                            </if>
+                            <if test="maps.periodIds != null and maps.periodIds.size() > 0">
+                                and l.period_id in
+                                <foreach item="periodId" index="index" collection="maps.periodIds" open="(" separator="," close=")">
+                                    #{periodId}
+                                </foreach>
+                            </if>
+                            <if test="maps.qwUserName != null  and maps.qwUserName != '' ">
+                                and qu.qw_user_name = #{maps.qwUserName}
+                            </if>
+                            <if test="maps.deptId != null  and maps.deptId != '' ">
+                                and cu.dept_id = #{maps.deptId}
+                            </if>
+                            <if test='maps.cuDeptIdList != null and !maps.cuDeptIdList.isEmpty() and  maps.userType != "00" '>
+                                AND cu.dept_id IN
+                                <foreach collection='maps.cuDeptIdList' item='item' open='(' separator=',' close=')'>
+                                    #{item}
+                                </foreach>
+                            </if>
+                            <if test="maps.userIds != null and !maps.userIds.isEmpty()">
+                                AND cu.user_id IN
+                                <foreach collection='maps.userIds' item='item' open='(' separator=',' close=')'>
+                                    #{item}
+                                </foreach>
+                            </if>
+                        </where>
+                        GROUP BY
+                        qec.user_id,
+                        qec.external_user_id,
+                        qec.corp_id
             </select>
 
             <select id="selectFsCourseWatchLogListByParam" resultType="com.fs.course.vo.FsCourseWatchLogListVO">