Jelajahi Sumber

注册分享链接 区分小程序和app

wangxy 2 minggu lalu
induk
melakukan
1a86928adf

+ 1 - 1
fs-service/src/main/java/com/fs/course/domain/FsCourseWatchLog.java

@@ -91,6 +91,6 @@ public class FsCourseWatchLog extends BaseEntity
     /** im发送消息详情id */
     private Long imMsgSendDetailId;
 
-    private Integer typeFlag; //0 小程序 1 app
+//    private Integer typeFlag; //0 小程序 1 app
 
 }

+ 1 - 1
fs-service/src/main/java/com/fs/course/param/newfs/FsUserCourseAddCompanyUserParam.java

@@ -47,5 +47,5 @@ public class FsUserCourseAddCompanyUserParam implements Serializable {
     /**
      * 来源标识 0小程序 1 app
      */
-    private Integer typeFlag;
+    private Integer typeFlag=0;
 }

+ 47 - 44
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -631,9 +631,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
                 log.setUserId(param.getUserId());
             }
             //区分课程来源 0 小程序 1 app
-            if (param.getTypeFlag() != null) {
-                log.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                log.setTypeFlag(param.getTypeFlag());
+//            }
             log.setUpdateTime(new Date());
             //重粉逻辑
             //
@@ -657,9 +657,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             //看课记录中userId为0绑定userId
             log.setUserId(param.getUserId());
             //区分课程来源
-            if (param.getTypeFlag() != null) {
-                log.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                log.setTypeFlag(param.getTypeFlag());
+//            }
             log.setUpdateTime(new Date());
             courseWatchLogMapper.updateFsCourseWatchLog(log);
         }
@@ -782,9 +782,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
         log.setQwUserId(Long.valueOf(param.getQwUserId()));
         log.setCreateTime(new Date());
         log.setLogType(3);
-        if (param.getTypeFlag() != null) {
-            log.setTypeFlag(param.getTypeFlag());
-        }
+//        if (param.getTypeFlag() != null) {
+//            log.setTypeFlag(param.getTypeFlag());
+//        }
         logger.info("【群聊生成看课记录】:{}", param);
         courseWatchLogMapper.insertFsCourseWatchLog(log);
     }
@@ -865,9 +865,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             if (log.getUserId() == null || log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())) {
                 log.setUserId(param.getUserId());
             }
-            if (param.getTypeFlag() != null) {
-                log.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                log.setTypeFlag(param.getTypeFlag());
+//            }
             log.setUpdateTime(new Date());
             courseWatchLogMapper.updateFsCourseWatchLog(log);
 
@@ -908,9 +908,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             if (log.getUserId() == null || log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())) {
                 log.setUserId(param.getUserId());
             }
-            if (param.getTypeFlag() != null) {
-                log.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                log.setTypeFlag(param.getTypeFlag());
+//            }
             log.setUpdateTime(new Date());
             courseWatchLogMapper.updateFsCourseWatchLog(log);
 
@@ -1942,9 +1942,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             if (watchCourseVideo != null) {
                 FsCourseWatchLog updateLog = new FsCourseWatchLog();
                 updateLog.setUpdateTime(new Date());
-                if (param.getTypeFlag() != null) {
-                    updateLog.setTypeFlag(param.getTypeFlag());
-                }
+//                if (param.getTypeFlag() != null) {
+//                    updateLog.setTypeFlag(param.getTypeFlag());
+//                }
                 courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
             } else {
                 FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
@@ -1953,9 +1953,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
                 fsCourseWatchLog.setDuration(0L);
                 fsCourseWatchLog.setCreateTime(new Date());
                 fsCourseWatchLog.setLogType(1);
-                if (param.getTypeFlag() != null) {
-                    fsCourseWatchLog.setTypeFlag(param.getTypeFlag());
-                }
+//                if (param.getTypeFlag() != null) {
+//                    fsCourseWatchLog.setTypeFlag(param.getTypeFlag());
+//                }
                 courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
                 String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + 0;
                 redisCache.setCacheObject(redisKey, LocalDateTime.now().toString());
@@ -1969,20 +1969,23 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
         if (companyUser == null) {
             return ResponseResult.fail(405, "当前销售不存在");
         }
-        //营期公司的开关状态
-        List<Integer> selected = periodCompanyMapper.selectRegistrationSwitchByPeriodId(param.getPeriodId());
-        //课程注册链接开关
-        FsUserCoursePeriodDays fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysById(param.getId());
-        if (CollectionUtils.isNotEmpty(selected) &&fsUserCoursePeriodDays != null) {
-            Integer registrationSwitch = fsUserCoursePeriodDays.getRegistrationSwitch();
-            //注册开关开启  未注册的用户不允许看课
-           if((registrationSwitch!=null&&registrationSwitch==1)&&selected.contains(1)){
-               //查询用户是否注册
-               FsSalesUserPeriodRelation fsSalesUserPeriodRelation = periodRelationMapper.selectBySalesUserPeriodAndDays(param.getCompanyUserId(), param.getUserId(), param.getPeriodId(),param.getId());
-               if (fsSalesUserPeriodRelation == null) {
-                   return ResponseResult.fail(506, "当前营期下的用户未绑定该销售,请注册");
-               }
-           }
+        if(param.getTypeFlag()==0){
+            //小程序看课需要判断是否注册
+            //营期公司的开关状态
+            List<Integer> selected = periodCompanyMapper.selectRegistrationSwitchByPeriodId(param.getPeriodId());
+            //课程注册链接开关
+            FsUserCoursePeriodDays fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysById(param.getId());
+            if (CollectionUtils.isNotEmpty(selected) &&fsUserCoursePeriodDays != null) {
+                Integer registrationSwitch = fsUserCoursePeriodDays.getRegistrationSwitch();
+                //注册开关开启  未注册的用户不允许看课
+                if((registrationSwitch!=null&&registrationSwitch==1)&&selected.contains(1)){
+                    //查询用户是否注册
+                    FsSalesUserPeriodRelation fsSalesUserPeriodRelation = periodRelationMapper.selectBySalesUserPeriodAndDays(param.getCompanyUserId(), param.getUserId(), param.getPeriodId(),param.getId());
+                    if (fsSalesUserPeriodRelation == null) {
+                        return ResponseResult.fail(506, "当前营期下的用户未绑定该销售,请注册");
+                    }
+                }
+            }
         }
         // 获取课程所属项目id
         FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
@@ -2055,9 +2058,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             updateLog.setPeriodId(param.getPeriodId());
             updateLog.setProject(courseProject);
             updateLog.setUpdateTime(new Date());
-            if (param.getTypeFlag() != null) {
-                updateLog.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                updateLog.setTypeFlag(param.getTypeFlag());
+//            }
             courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
         } else {
             FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
@@ -2067,9 +2070,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             fsCourseWatchLog.setCreateTime(new Date());
             fsCourseWatchLog.setLogType(1);
             fsCourseWatchLog.setProject(courseProject);
-            if (param.getTypeFlag() != null) {
-                fsCourseWatchLog.setTypeFlag(param.getTypeFlag());
-            }
+//            if (param.getTypeFlag() != null) {
+//                fsCourseWatchLog.setTypeFlag(param.getTypeFlag());
+//            }
             courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
 
             String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
@@ -3132,9 +3135,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
             log.setCreateTime(new Date());
             log.setLogType(3);
             logger.info("【群聊生成看课记录】:{}", param);
-            if(param.getTypeFlag()!=null){
-                log.setTypeFlag(param.getTypeFlag());
-            }
+//            if(param.getTypeFlag()!=null){
+//                log.setTypeFlag(param.getTypeFlag());
+//            }
             courseWatchLogMapper.insertFsCourseWatchLog(log);
         } catch (BeansException e) {
             return R.error("群聊生成看课记录失败!");