|
@@ -366,9 +366,18 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
for (String key : keys) {
|
|
|
//取key中数据
|
|
|
String[] parts = key.split(":");
|
|
|
- Long userId = Long.parseLong(parts[3]);
|
|
|
- Long videoId = Long.parseLong(parts[4]);
|
|
|
- Long companyUserId = Long.parseLong(parts[5]);
|
|
|
+ Long userId=null;
|
|
|
+ Long videoId=null;
|
|
|
+ Long companyUserId=null;
|
|
|
+ try {
|
|
|
+ userId = Long.parseLong(parts[3]);
|
|
|
+ videoId = Long.parseLong(parts[4]);
|
|
|
+ companyUserId = Long.parseLong(parts[5]);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("key中id为null:{}", key);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String durationStr = redisCache.getCacheObject(key);
|
|
|
if(durationStr==null){
|
|
|
log.error("key中数据为null:{}",key);
|
|
@@ -948,7 +957,16 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
public Long getVideoDuration(Long videoId){
|
|
|
//将视频时长也存到redis
|
|
|
String videoRedisKey = "h5user:video:duration:" + videoId;
|
|
|
- Long videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
+ Long videoDuration=0L;
|
|
|
+ try {
|
|
|
+ videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
+ }catch (Exception e){
|
|
|
+ String string = redisCache.getCacheObject(videoRedisKey);
|
|
|
+ videoDuration=Long.parseLong(string);
|
|
|
+ log.error("key中id为S:{}", videoDuration);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (videoDuration==null){
|
|
|
FsUserCourseVideo video = courseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
|
|
|
videoDuration=video.getDuration();
|