mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
取消lastStudyTime更新条件
This commit is contained in:
@@ -156,12 +156,17 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
String key = "studyId:" + studyId + ":courseId:" + courseId + ":courseContentId:" + courseContentId + ":studyItemId:" + studyItemId;
|
||||
String currentValue = redisTemplate.opsForValue().get(key);
|
||||
int lastDuration = 0;
|
||||
int sum = 10; // 原appendtime改为固定10秒调用一次接口
|
||||
Integer lastDuration = 0;
|
||||
Integer oldVideoTime = 0;
|
||||
Integer sum = 10; // 原appendtime改为固定10秒调用一次接口
|
||||
if (currentValue != null) {
|
||||
String[] partValues = currentValue.split("&");
|
||||
oldVideoTime = Integer.parseInt(partValues[0]);
|
||||
lastDuration = Integer.parseInt(partValues[1]);
|
||||
sum += lastDuration;
|
||||
if(oldVideoTime > videoTime){
|
||||
videoTime = oldVideoTime;// 取最大值最终入库
|
||||
}
|
||||
};
|
||||
|
||||
String value = videoTime + "&" + sum + "&" + now.format(formatter); // study_video_time & appendtime & time
|
||||
@@ -211,7 +216,6 @@ public class StudyServiceImpl implements IStudyService{
|
||||
if (redisValue != null) {
|
||||
String[] values = redisValue.split("&");
|
||||
int duration = Integer.parseInt(values[0]);
|
||||
// item.setStudyDuration(duration);
|
||||
item.setLastStudyTime(duration);
|
||||
log.info("-- studyIndex -----set 结果---------------- LastStudyTime = " + item.getLastStudyTime());
|
||||
}
|
||||
@@ -400,7 +404,7 @@ public class StudyServiceImpl implements IStudyService{
|
||||
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
||||
update.addFilter(FieldFilters.eq("id",studyContentId));
|
||||
//只记录时间长的时候的处理
|
||||
// update.addFilter(FieldFilters.lt("lastStudyTime", lastStudyTime));
|
||||
update.addFilter(FieldFilters.lt("lastStudyTime", lastStudyTime));
|
||||
update.addUpdateField("lastStudyTime", lastStudyTime);
|
||||
update.addUpdateField("lastTime", timestamp==null ? now : timestamp);
|
||||
scItemDao.update(update.builder());
|
||||
|
||||
Reference in New Issue
Block a user