he2802 пре 3 година
родитељ
комит
7d09517d63

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -322,6 +322,9 @@ 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())){
             add.setStartTime(DateUtils.getNowTime().longValue() - add.getStudyDuration().longValue());
             add.setStartTime(DateUtils.getNowTime().longValue() - add.getStudyDuration().longValue());
         }else{
         }else{
@@ -364,7 +367,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                 if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
                 if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
                     lastVo.setStatus(1);
                     lastVo.setStatus(1);
                 }
                 }
-                lastVo.setStudyDuration(add.getStudyDuration()+lastVo.getStudyDuration());
+                if(lastVo.getVideoCurrentTime().longValue()<=add.getVideoCurrentTime().longValue()){
+                    lastVo.setStudyDuration(lastVo.getStudyDuration()+(add.getVideoCurrentTime().longValue()-lastVo.getVideoCurrentTime().longValue()));
+                }else{
+                    lastVo.setStudyDuration(lastVo.getStudyDuration()+add.getStudyDuration());
+                }
+
                 UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
                 UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
                 update.setUpdateTime(DateUtils.getNowTime());
                 update.setUpdateTime(DateUtils.getNowTime());
                 this.updateById(update);
                 this.updateById(update);