Pārlūkot izejas kodu

今正侧边栏根据营期解锁

三七 1 dienu atpakaļ
vecāks
revīzija
41495cb4c0

+ 14 - 0
fs-qwhook/src/main/java/com/fs/app/controller/ApisQwUserController.java

@@ -21,6 +21,8 @@ import com.fs.qw.vo.QwExternalListByHeavyVO;
 import com.fs.qw.vo.QwTagGroupListVO;
 import com.fs.qw.vo.sidebar.ExternalContactInfoVO;
 import com.fs.qw.vo.sidebar.ExternalContactTagVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -49,6 +51,10 @@ public class ApisQwUserController extends BaseController {
     @Autowired
     private IQwTagGroupService qwTagGroupService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -112,6 +118,14 @@ public class ApisQwUserController extends BaseController {
         return R.ok().put("data", result);
     }
 
+
+    @GetMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId) {
+        List<ExtCourseSopWatchLogVO> tagList = iSopUserLogsInfoService.getExtCourseSopWatchLog(qwExternalContactId);
+        return R.ok().put("data", tagList);
+    }
+
     @GetMapping("/externalContact")
     @ApiOperation("获取侧边栏外部联系人信息")
     public R getExternalContactInfo(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId) {

+ 11 - 0
fs-qwhook/src/main/java/com/fs/app/controller/QwUserController.java

@@ -17,6 +17,8 @@ import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.QwTagGroupListVO;
 import com.fs.qw.vo.sidebar.ExternalContactInfoVO;
 import com.fs.qw.vo.sidebar.ExternalContactTagVO;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -45,6 +47,9 @@ public class QwUserController extends BaseController {
     @Autowired
     private IQwTagGroupService qwTagGroupService;
 
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -81,6 +86,12 @@ public class QwUserController extends BaseController {
         return R.ok();
     }
 
+    @GetMapping("/extCourseSopWatchLog")
+    @ApiOperation("获取外部联系人按照 营期天数 获取到的今天该看的课")
+    public R getExtCourseSopWatchLog(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId) {
+        List<ExtCourseSopWatchLogVO> tagList = iSopUserLogsInfoService.getExtCourseSopWatchLog(qwExternalContactId);
+        return R.ok().put("data", tagList);
+    }
 
     @GetMapping("/externalContact")
     @ApiOperation("获取侧边栏外部联系人信息")

+ 4 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoMapper.java

@@ -119,6 +119,7 @@ public interface FsUserCourseVideoMapper
     @Select("select v.*  from fs_user_course_video v  " +
             "where v.is_del = 0 and v.course_id = #{courseId}  order by v.course_sort  ")
     List<FsUserCourseVideo> selectFsUserCourseListByCourseId(Long courseId);
+
     @Select({"<script> " +
             "select v.video_id, v.title, v.video_url, v.thumbnail, SEC_TO_TIME(v.duration) as duration,v.create_time, v.talent_id, v.course_id, " +
             " v.status, v.course_sort  from fs_user_course_video v  " +
@@ -200,4 +201,7 @@ public interface FsUserCourseVideoMapper
     List<FsUserCourseVideoPageListVO> selectFsUserCourseVideoListByMap(@Param("params") Map<String, Object> params);
 
     FsUserCourseVideo selectByFileKey(@Param("params")String fileKey);
+
+    @Select("select title from fs_user_course_video WHERE video_id=#{videoId}")
+    String selectFsUserCourseVideoByVideoForTitle(@Param("videoId") Long videoId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/service/IFsUserCourseVideoService.java

@@ -178,4 +178,6 @@ public interface IFsUserCourseVideoService
     R createRoomMiniLink(FsCourseLinkMiniParam param);
 
     FsUserCourseVideo selectByFileKey(String fileKey);
+
+    String selectFsUserCourseVideoByVideoForTitle(Long videoId);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -2049,6 +2049,11 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         return fsUserCourseVideo;
     }
 
+    @Override
+    public String selectFsUserCourseVideoByVideoForTitle(Long videoId) {
+        return fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoForTitle(videoId);
+    }
+
     /**
      * 获取视频时长(优先从Redis获取,不存在则查数据库)
      */

+ 22 - 0
fs-service/src/main/java/com/fs/sop/mapper/SopUserLogsInfoMapper.java

@@ -6,6 +6,7 @@ import com.fs.sop.domain.SopUserLogsInfo;
 import com.fs.sop.params.BatchSopUserLogsInfoParamU;
 import com.fs.sop.params.DeleteQwSopParam;
 import com.fs.sop.params.SopUserLogsInfoDelParam;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.fs.sop.vo.SopUserLogsInfoVOE;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -210,4 +211,25 @@ public interface SopUserLogsInfoMapper {
     @DataSource(DataSourceType.SOP)
     @Select("SELECT create_time,fs_user_id  FROM sop_user_logs_info where sop_id = #{sopId} ")
     List<SopUserLogsInfo> selectFsUserIdSopUserLogsInfoBySopId(@Param("sopId")String sopId);
+
+    @DataSource(DataSourceType.SOP)
+    @Select("<script>" +
+            "SELECT\n" +
+            "  qs.id as sopId,\n" +
+            "\tqs.`name` as sopName,\n" +
+            "  MAX(qstr.course_id) AS course_id,\n" +
+            "  MAX(qstr.video_id) AS video_id,\n" +
+            "  sul.start_time,\n" +
+            "  DATEDIFF(CURRENT_DATE, sul.start_time) + 1 AS count_days\n" +
+            "FROM\n" +
+            "  `sop_user_logs_info` suli \n" +
+            "  LEFT JOIN sop_user_logs sul ON suli.user_logs_id = sul.id\n" +
+            "  INNER JOIN qw_sop qs ON qs.id = sul.sop_id AND qs.`status` IN (2,3,4)\n" +
+            "  LEFT JOIN qw_sop_temp_day qsts ON qs.temp_id = qsts.temp_id AND qsts.day_num = DATEDIFF(CURRENT_DATE, sul.start_time) + 1 \n" +
+            "  LEFT JOIN qw_sop_temp_rules qstr ON qsts.id = qstr.day_id AND qstr.content_type = 2 \n" +
+            "WHERE\n" +
+            "  suli.external_id = #{qwExtContactId} AND qstr.video_id IS NOT NULL \n" +
+            "GROUP BY qsts.id, sul.start_time "+
+            "</script>")
+    List<ExtCourseSopWatchLogVO> getExtCourseSopWatchLog(@Param("qwExtContactId") Long qwExternalContactId);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/sop/service/ISopUserLogsInfoService.java

@@ -4,6 +4,7 @@ import com.fs.common.core.domain.R;
 import com.fs.sop.domain.SopUserLogsInfo;
 import com.fs.sop.params.BatchSopUserLogsInfoParam;
 import com.fs.sop.params.SendUserLogsInfoMsgParam;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.fs.sop.vo.SopUserLogsInfoVOE;
 
 import java.util.List;
@@ -71,4 +72,6 @@ public interface ISopUserLogsInfoService {
     public R batchUpdateSopUserLogsInfoToTime(BatchSopUserLogsInfoParam param);
     public R sendUserLogsInfoMsg(SendUserLogsInfoMsgParam param);
     public R sendUserLogsInfoMsgType(SendUserLogsInfoMsgParam param);
+
+    public List<ExtCourseSopWatchLogVO> getExtCourseSopWatchLog(Long qwExternalContactId);
 }

+ 17 - 0
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -19,6 +19,7 @@ import com.fs.course.mapper.FsCourseLinkMapper;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
 import com.fs.course.param.FsCourseLinkCreateParam;
 import com.fs.course.service.IFsCourseLinkService;
+import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.fastGpt.domain.FastGptChatReplaceWords;
 import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
 import com.fs.qw.domain.*;
@@ -47,6 +48,7 @@ import com.fs.sop.params.SopUserLogsParamByDate;
 import com.fs.sop.service.IQwSopService;
 import com.fs.sop.service.ISopUserLogsInfoService;
 import com.fs.sop.service.ISopUserLogsService;
+import com.fs.sop.vo.ExtCourseSopWatchLogVO;
 import com.fs.sop.vo.QwCreateLinkByAppVO;
 import com.fs.sop.vo.SopUserLogsInfoVOE;
 import com.fs.sop.vo.SopUserLogsVo;
@@ -141,6 +143,9 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
     @Autowired
     private IQwCompanyService iQwCompanyService;
 
+    @Autowired
+    private IFsUserCourseVideoService iFsUserCourseVideoService;
+
 
     @Autowired
     private CompanyUserMapper companyUserMapper;
@@ -867,6 +872,18 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
         return null;
     }
 
+    @Override
+    public List<ExtCourseSopWatchLogVO> getExtCourseSopWatchLog(Long qwExternalContactId) {
+
+        List<ExtCourseSopWatchLogVO> watchLogVOList = sopUserLogsInfoMapper.getExtCourseSopWatchLog(qwExternalContactId);
+
+        watchLogVOList.forEach(item->{
+            item.setTitle(iFsUserCourseVideoService.selectFsUserCourseVideoByVideoForTitle(item.getVideoId()));
+        });
+
+        return watchLogVOList;
+    }
+
     private R processQwSopLogsBySendMsg(SendUserLogsInfoMsgParam param,Integer draftStrategy) {
 
 

+ 51 - 0
fs-service/src/main/java/com/fs/sop/vo/ExtCourseSopWatchLogVO.java

@@ -0,0 +1,51 @@
+package com.fs.sop.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ExtCourseSopWatchLogVO {
+
+    /**
+    * sop任务编号
+    */
+    private String sopId;
+
+    /**
+    * sop任务名称
+    */
+    private String sopName;
+
+    /**
+    * 课程Id
+    */
+    private Long courseId;
+
+    /**
+    * 课节Id
+    */
+    private Long videoId;
+
+    /**
+    * 课节标题
+    */
+    private String title;
+
+
+    /**
+    * 营期时间
+     */
+    @Excel(name = "营期时间",dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date startTime;
+
+    /**
+    * 营期天数
+    */
+    private Integer countDays;
+
+
+}