he2802 1 год назад
Родитель
Сommit
9651ba742b

+ 18 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -865,7 +865,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                 CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
                 menuQueryBo.setCourseId(courseVo.getCourseId());
                 List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(menuQueryBo);
-                courseMenuVoList.forEach(courseMenuVo -> {
+                for(CourseMenuVo courseMenuVo : courseMenuVoList){
                     if(courseMenuVo.getType()==1){
                         SyncUserChapterList syncUserChapterItem = new SyncUserChapterList();
                         syncUserChapterItem.setChapterId(courseMenuVo.getMenuId());
@@ -873,7 +873,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                         List<SyncUserChapterList> ChildChapList = new ArrayList<>();
                         //获取章信息
                         List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
-                        courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
+                        for(CourseModuleChapterVo courseModuleChapterVo : courseModuleChapterVoList){
                             SyncUserChapterList syncUserChapterChildItem = new SyncUserChapterList();
                             syncUserChapterChildItem.setChapterId(courseModuleChapterVo.getChapterId());
                             syncUserChapterChildItem.setChapterName(courseModuleChapterVo.getName());
@@ -893,6 +893,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                                 LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                 lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
                                 List<UserStudyRecordPhoto> examPhoto = userStudyRecordPhotoService.list(lqw);
+                                if(Validator.isEmpty(studyEndTime)||(studyEndTime.longValue()<userPeriodStatusVo.getRecordEndTime().longValue())){
+                                    studyEndTime = userPeriodStatusVo.getRecordEndTime();
+                                }
                                 if(Validator.isNotEmpty(examPhoto)&&examPhoto.size()>0){
                                     UserStudyRecordPhoto photo = examPhoto.get(0);
                                     syncUserChapterChildItem.setImageSrc(ossHost+"/"+photo.getPhoto());
@@ -901,6 +904,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                                     syncUserChapterChildItem.setExamTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
                                     syncUserChapterChildItem.setExamScore(userPeriodStatusVo.getPerformance().toString());
                                     syncUserChapterChildItem.setStudyIP(userPeriodStatusVo.getIp());
+                                    if(Validator.isEmpty(studyStartTime)||(studyStartTime.longValue()>examPhoto.get(0).getCreateTime().longValue())){
+                                        studyStartTime = examPhoto.get(0).getCreateTime();
+                                    }
                                 }
                             }
                             List<ClassPeriodSectionVo> classPeriodSectionVos = classGradeUserMapper.listPeriodSection(courseModuleChapterVo.getChapterId(), bo.getGoodsId(), courseVo.getCourseId(), bo.getUserId());
@@ -929,6 +935,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                                     syncUserStudyRec.setCreateTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
                                     syncUserStudyRec.setEndTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
                                     syncUserStudyRec.setStudyIP(userPeriodStatusVo.getIp());
+                                    if(Validator.isEmpty(studyEndTime)||(studyEndTime.longValue()<userPeriodStatusVo.getRecordEndTime().longValue())){
+                                        studyEndTime = userPeriodStatusVo.getRecordEndTime();
+                                    }
                                     List<SyncUserImageRc> ImgList = new ArrayList<>();
                                     for (UserStudyRecordPhoto videoPhoto : videoPhoto2) {
                                         SyncUserImageRc imageRc = new SyncUserImageRc();
@@ -937,19 +946,24 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
                                         imageRc.setMatchData(Validator.isNotEmpty(videoPhoto.getSimilarity())?videoPhoto.getSimilarity().toString():null);
                                         ImgList.add(imageRc);
                                     }
+                                    if(Validator.isEmpty(studyStartTime)||(studyStartTime.longValue()>videoPhoto2.get(0).getCreateTime().longValue())){
+                                        studyStartTime = videoPhoto2.get(0).getCreateTime();
+                                    }
                                     syncUserStudyRec.setImgList(ImgList);
                                 }
                                 RecList.add(syncUserStudyRec);
                             }
                             syncUserChapterChildItem.setRecList(RecList);
                             ChildChapList.add(syncUserChapterChildItem);
-                        });
+                        };
                         syncUserChapterItem.setChildChapList(ChildChapList);
                         ChapterList.add(syncUserChapterItem);
                     }
-                });
+                }
             }
             studyRec.setChapterList(ChapterList);
+            studyRec.setBeginTime(DateUtils.timestampToDateFormat(studyStartTime));
+            studyRec.setEndTime(DateUtils.timestampToDateFormat(studyEndTime));
         }
         //学习记录推送到旧系统