فهرست منبع

fix 观看记录

he2802 3 سال پیش
والد
کامیت
159177a983

+ 13 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -338,12 +338,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         CourseSection section = iCourseSectionService.getById(bo.getSectionId());
         add.setSectionType(section.getSectionType());
         add.setIdentification(bo.getIdentification());
-        this.save(add);
+   //     this.save(add);
         if (ObjectUtils.isNull(bo.getOrderGoodsId())){
             //没有购买商品,通过分享观看
             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);
 *//*            queryBo.setUserId(bo.getUserId());
             queryBo.setGradeId(bo.getGradeId());
@@ -352,10 +352,10 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             queryBo.setModuleId(bo.getModuleId());
             queryBo.setChapterId(bo.getChapterId());
             queryBo.setSectionId(bo.getSectionId());
-            queryBo.setOrderGoodsId(bo.getOrderGoodsId());*//*
+            queryBo.setOrderGoodsId(bo.getOrderGoodsId());
             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);
             }else{
                 //修改最后一条记录,减少观看数据
@@ -364,7 +364,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                 if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
                     lastVo.setStatus(1);
                 }
-                if(add.getOrderGoodsId().equals(lastVo.getOrderGoodsId())&&(add.getSectionId().equals(lastVo.getSectionId()))&&(add.getGoodsId().equals(lastVo.getGoodsId()))){
+                lastVo.setStudyDuration(add.getStudyDuration()+lastVo.getStudyDuration());
+                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());
                     UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
                     update.setUpdateTime(DateUtils.getNowTime());
@@ -372,11 +377,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                     add.setRecordId(update.getRecordId());
                 }else{
                     this.save(add);
-                }
+                }*/
             }
         }else{
             this.save(add);
-        }*/
+        }
 
         //新增学时记录,照片
         userPeriodSave(add, bo);