mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-15 22:06:50 +08:00
upd 埋点接口调整
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -216,6 +217,18 @@ public class StudyServiceImpl implements IStudyService{
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateLastTime(String studyContentId, int lastStudyTime,String aid) {
|
||||
// 获取时长
|
||||
StudyCourseItem sci = scItemDao.findOne(FieldFilters.eq("id", studyContentId),FieldFilters.eq("aid", aid));
|
||||
Integer endTime = sci.getLastStudyTime();
|
||||
// 间隔时长
|
||||
int abs = 0;
|
||||
if(lastStudyTime - endTime < 0){
|
||||
//从头开始
|
||||
abs = lastStudyTime;
|
||||
}else{
|
||||
// 获取时长
|
||||
abs = lastStudyTime - endTime;
|
||||
}
|
||||
// 更新最后的学习时间点
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
||||
@@ -226,6 +239,14 @@ public class StudyServiceImpl implements IStudyService{
|
||||
update.addUpdateField("lastTime", now);
|
||||
scItemDao.update(update.builder());
|
||||
//增加用户的学习时长,在api中调用
|
||||
|
||||
// 添加学习时长
|
||||
String contentId = sci.getContentId();
|
||||
UpdateBuilder updSc=UpdateBuilder.from(StudyCourse.class);
|
||||
|
||||
// 追加总时长
|
||||
String sql="Update boe_study_course set total_duration=total_duration+"+abs+",status=(case when status<2 then 2 else status end),progress=(case when progress=0 then 1 else progress end) where id=?1";
|
||||
scDao.sqlUpdate(sql,contentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user