|
@@ -13,6 +13,7 @@ import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.course.domain.FsCourseLink;
|
|
import com.fs.course.domain.FsCourseLink;
|
|
|
import com.fs.course.service.impl.FsUserCourseVideoServiceImpl;
|
|
import com.fs.course.service.impl.FsUserCourseVideoServiceImpl;
|
|
|
|
|
+import com.fs.enums.ExceptionCodeEnum;
|
|
|
import com.fs.his.domain.FsUser;
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
import com.fs.his.service.IFsUserService;
|
|
import com.fs.his.service.IFsUserService;
|
|
@@ -669,10 +670,10 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
//用户不存在唤起重新授权
|
|
//用户不存在唤起重新授权
|
|
|
if (fsUser == null) {
|
|
if (fsUser == null) {
|
|
|
- return R.error(401, "未授权");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.USER_NOT_FOUND.getCode(), ExceptionCodeEnum.USER_NOT_FOUND.getDescription());
|
|
|
}
|
|
}
|
|
|
if (fsUser.getStatus() == 0) {
|
|
if (fsUser.getStatus() == 0) {
|
|
|
- return R.error("会员被停用,无权限,请联系客服!");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.MEMBER_DISABLED.getCode(), ExceptionCodeEnum.MEMBER_DISABLED.getDescription());
|
|
|
}
|
|
}
|
|
|
//未注册提示
|
|
//未注册提示
|
|
|
String noRegisterMsg = "由于您还未完成注册,请联系伴学助手完成注册即可观看!";
|
|
String noRegisterMsg = "由于您还未完成注册,请联系伴学助手完成注册即可观看!";
|
|
@@ -684,7 +685,7 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
|
|
|
} else if (null != param.getQwExternalId()) {
|
|
} else if (null != param.getQwExternalId()) {
|
|
|
return handleLivePerson(param,fsUser, noMemberMsg, noRegisterMsg);
|
|
return handleLivePerson(param,fsUser, noMemberMsg, noRegisterMsg);
|
|
|
} else {
|
|
} else {
|
|
|
- return R.error("直播参数错误");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.LIVE_PARAM_ERROR.getCode(), ExceptionCodeEnum.LIVE_PARAM_ERROR.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -874,6 +875,12 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
|
|
|
@Override
|
|
@Override
|
|
|
@Async
|
|
@Async
|
|
|
public void qwTagMarkByLiveWatchLog(Long liveId) {
|
|
public void qwTagMarkByLiveWatchLog(Long liveId) {
|
|
|
|
|
+ //休眠2分钟 等待看课中断的所有看课记录状态被正确处理标记
|
|
|
|
|
+ try {
|
|
|
|
|
+ Thread.sleep(120000L);
|
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
log.info("处理直播间打标签: liveId={}", liveId);
|
|
log.info("处理直播间打标签: liveId={}", liveId);
|
|
|
//查询直播间的标签配置
|
|
//查询直播间的标签配置
|
|
|
List<LiveTagItemVO> liveTagConfig = liveTagConfigMapper.getLiveTagListByliveId(liveId);
|
|
List<LiveTagItemVO> liveTagConfig = liveTagConfigMapper.getLiveTagListByliveId(liveId);
|
|
@@ -1087,7 +1094,7 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
LiveWatchUser liveWatchUser = baseMapper.selectByUniqueIndex(liveId, userId, liveFlag, replayFlag);
|
|
LiveWatchUser liveWatchUser = baseMapper.selectByUniqueIndex(liveId, userId, liveFlag, replayFlag);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (liveWatchUser != null) {
|
|
if (liveWatchUser != null) {
|
|
|
if (liveWatchUser.getOnlineSeconds() == null || duration > liveWatchUser.getOnlineSeconds()) {
|
|
if (liveWatchUser.getOnlineSeconds() == null || duration > liveWatchUser.getOnlineSeconds()) {
|
|
|
liveWatchUser.setOnlineSeconds(duration);
|
|
liveWatchUser.setOnlineSeconds(duration);
|
|
@@ -1116,25 +1123,25 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
|
|
|
public Long getTotalWatchDuration(Long liveId, Long userId) {
|
|
public Long getTotalWatchDuration(Long liveId, Long userId) {
|
|
|
try {
|
|
try {
|
|
|
long totalDuration = 0L;
|
|
long totalDuration = 0L;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 1. 查询直播观看记录(liveFlag=1, replayFlag=0)
|
|
// 1. 查询直播观看记录(liveFlag=1, replayFlag=0)
|
|
|
LiveWatchUser liveRecord = baseMapper.selectByUniqueIndex(liveId, userId, 1, 0);
|
|
LiveWatchUser liveRecord = baseMapper.selectByUniqueIndex(liveId, userId, 1, 0);
|
|
|
if (liveRecord != null && liveRecord.getOnlineSeconds() != null) {
|
|
if (liveRecord != null && liveRecord.getOnlineSeconds() != null) {
|
|
|
totalDuration += liveRecord.getOnlineSeconds();
|
|
totalDuration += liveRecord.getOnlineSeconds();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 2. 查询回放观看记录(liveFlag=0, replayFlag=1)
|
|
// 2. 查询回放观看记录(liveFlag=0, replayFlag=1)
|
|
|
LiveWatchUser replayRecord = baseMapper.selectByUniqueIndex(liveId, userId, 0, 1);
|
|
LiveWatchUser replayRecord = baseMapper.selectByUniqueIndex(liveId, userId, 0, 1);
|
|
|
if (replayRecord != null && replayRecord.getOnlineSeconds() != null) {
|
|
if (replayRecord != null && replayRecord.getOnlineSeconds() != null) {
|
|
|
totalDuration += replayRecord.getOnlineSeconds();
|
|
totalDuration += replayRecord.getOnlineSeconds();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("查询总观看时长: liveId={}, userId={}, liveDuration={}, replayDuration={}, total={}",
|
|
log.debug("查询总观看时长: liveId={}, userId={}, liveDuration={}, replayDuration={}, total={}",
|
|
|
liveId, userId,
|
|
liveId, userId,
|
|
|
liveRecord != null ? liveRecord.getOnlineSeconds() : 0,
|
|
liveRecord != null ? liveRecord.getOnlineSeconds() : 0,
|
|
|
replayRecord != null ? replayRecord.getOnlineSeconds() : 0,
|
|
replayRecord != null ? replayRecord.getOnlineSeconds() : 0,
|
|
|
totalDuration);
|
|
totalDuration);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return totalDuration;
|
|
return totalDuration;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("查询总观看时长失败: liveId={}, userId={}", liveId, userId, e);
|
|
log.error("查询总观看时长失败: liveId={}, userId={}", liveId, userId, e);
|