|
@@ -322,7 +322,13 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ if(Validator.isEmpty(add.getVideoCurrentTime())){
|
|
|
|
|
+ add.setVideoCurrentTime(0L);
|
|
|
|
|
+ }
|
|
|
if(Validator.isNotEmpty(add.getStudyDuration())){
|
|
if(Validator.isNotEmpty(add.getStudyDuration())){
|
|
|
|
|
+ /* if(add.getStudyDuration().longValue()>60L){
|
|
|
|
|
+ add.setStudyDuration(60L); //前端60秒提交一次,超过60按60算
|
|
|
|
|
+ }*/
|
|
|
add.setStartTime(DateUtils.getNowTime().longValue() - add.getStudyDuration().longValue());
|
|
add.setStartTime(DateUtils.getNowTime().longValue() - add.getStudyDuration().longValue());
|
|
|
}else{
|
|
}else{
|
|
|
add.setStartTime(DateUtils.getNowTime().longValue());
|
|
add.setStartTime(DateUtils.getNowTime().longValue());
|
|
@@ -338,33 +344,43 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
CourseSection section = iCourseSectionService.getById(bo.getSectionId());
|
|
CourseSection section = iCourseSectionService.getById(bo.getSectionId());
|
|
|
add.setSectionType(section.getSectionType());
|
|
add.setSectionType(section.getSectionType());
|
|
|
add.setIdentification(bo.getIdentification());
|
|
add.setIdentification(bo.getIdentification());
|
|
|
- this.save(add);
|
|
|
|
|
|
|
+ // this.save(add);
|
|
|
if (ObjectUtils.isNull(bo.getOrderGoodsId())){
|
|
if (ObjectUtils.isNull(bo.getOrderGoodsId())){
|
|
|
//没有购买商品,通过分享观看
|
|
//没有购买商品,通过分享观看
|
|
|
|
|
+ this.save(add);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
-/* if(courseSectionVo.getSectionType()==1||courseSectionVo.getSectionType()==2||courseSectionVo.getSectionType()==3){
|
|
|
|
|
|
|
+ if(courseSectionVo.getSectionType()==1||courseSectionVo.getSectionType()==2||courseSectionVo.getSectionType()==3){
|
|
|
UserStudyRecordQueryBo queryBo = BeanUtil.toBean(bo, UserStudyRecordQueryBo.class);
|
|
UserStudyRecordQueryBo queryBo = BeanUtil.toBean(bo, UserStudyRecordQueryBo.class);
|
|
|
-*//* queryBo.setUserId(bo.getUserId());
|
|
|
|
|
|
|
+ queryBo.setUserId(bo.getUserId());
|
|
|
queryBo.setGradeId(bo.getGradeId());
|
|
queryBo.setGradeId(bo.getGradeId());
|
|
|
queryBo.setGoodsId(bo.getGoodsId());
|
|
queryBo.setGoodsId(bo.getGoodsId());
|
|
|
queryBo.setCourseId(bo.getCourseId());
|
|
queryBo.setCourseId(bo.getCourseId());
|
|
|
queryBo.setModuleId(bo.getModuleId());
|
|
queryBo.setModuleId(bo.getModuleId());
|
|
|
queryBo.setChapterId(bo.getChapterId());
|
|
queryBo.setChapterId(bo.getChapterId());
|
|
|
queryBo.setSectionId(bo.getSectionId());
|
|
queryBo.setSectionId(bo.getSectionId());
|
|
|
- queryBo.setOrderGoodsId(bo.getOrderGoodsId());*//*
|
|
|
|
|
|
|
+ queryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
UserStudyRecordVo lastVo = queryLast(queryBo);
|
|
UserStudyRecordVo lastVo = queryLast(queryBo);
|
|
|
- if(Validator.isEmpty(lastVo)||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
|
|
|
|
|
- //如果没有历史数据或者之前播放时长比现在晚,则新增观看记录
|
|
|
|
|
|
|
+ if(Validator.isEmpty(lastVo)||Validator.isNotEmpty(bo.getPhoto())||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
|
|
|
|
|
+ //如果没有历史数据或者之前播放时长比现在晚,或者携带照片则新增观看记录
|
|
|
this.save(add);
|
|
this.save(add);
|
|
|
}else{
|
|
}else{
|
|
|
- //修改最后一条记录,减少观看数据
|
|
|
|
|
lastVo.setVideoCurrentTime(add.getVideoCurrentTime());
|
|
lastVo.setVideoCurrentTime(add.getVideoCurrentTime());
|
|
|
lastVo.setEndTime(add.getEndTime());
|
|
lastVo.setEndTime(add.getEndTime());
|
|
|
if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
|
|
if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
|
|
|
lastVo.setStatus(1);
|
|
lastVo.setStatus(1);
|
|
|
}
|
|
}
|
|
|
- if(add.getOrderGoodsId().equals(lastVo.getOrderGoodsId())&&(add.getSectionId().equals(lastVo.getSectionId()))&&(add.getGoodsId().equals(lastVo.getGoodsId()))){
|
|
|
|
|
|
|
+ if(lastVo.getVideoCurrentTime().longValue()<=add.getVideoCurrentTime().longValue()){
|
|
|
|
|
+ lastVo.setStudyDuration(lastVo.getStudyDuration().longValue()+(add.getVideoCurrentTime().longValue()-lastVo.getVideoCurrentTime().longValue()));
|
|
|
|
|
+ }else{
|
|
|
|
|
+ lastVo.setStudyDuration(lastVo.getStudyDuration().longValue()+add.getStudyDuration().longValue());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
|
|
|
|
|
+ update.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ this.updateById(update);
|
|
|
|
|
+ add.setRecordId(update.getRecordId());
|
|
|
|
|
+ /*if(add.getOrderGoodsId().equals(lastVo.getOrderGoodsId())&&(add.getSectionId().equals(lastVo.getSectionId()))&&(add.getGoodsId().equals(lastVo.getGoodsId()))){
|
|
|
lastVo.setStudyDuration(add.getStudyDuration()+lastVo.getStudyDuration());
|
|
lastVo.setStudyDuration(add.getStudyDuration()+lastVo.getStudyDuration());
|
|
|
UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
|
|
UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
@@ -372,11 +388,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
add.setRecordId(update.getRecordId());
|
|
add.setRecordId(update.getRecordId());
|
|
|
}else{
|
|
}else{
|
|
|
this.save(add);
|
|
this.save(add);
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
this.save(add);
|
|
this.save(add);
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//新增学时记录,照片
|
|
//新增学时记录,照片
|
|
|
userPeriodSave(add, bo);
|
|
userPeriodSave(add, bo);
|