From 790c2ba4a0b46edf191e3bac84931f796bd42b8f Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: Wed, 24 Jul 2024 09:02:49 +0800
Subject: [PATCH] 三方对接接口优化
---
exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java
index 30729bb..8a4a0a6 100644
--- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java
@@ -1,15 +1,11 @@
package com.gkhy.exam.institutionalaccess.service.serviceImpl;
-import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth;
-import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack;
+import com.gkhy.exam.institutionalaccess.entity.*;
import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery;
import com.gkhy.exam.institutionalaccess.model.vo.ThStudyAuthVO;
import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO;
import com.gkhy.exam.institutionalaccess.model.vo.ThStudyTrackVO;
-import com.gkhy.exam.institutionalaccess.service.ThStudyAuthService;
-import com.gkhy.exam.institutionalaccess.service.ThStudyDetailService;
-import com.gkhy.exam.institutionalaccess.service.ThStudyRecordManagerService;
-import com.gkhy.exam.institutionalaccess.service.ThStudyTrackService;
+import com.gkhy.exam.institutionalaccess.service.*;
import com.gkhy.exam.institutionalaccess.utils.ConvertTimeUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,18 +24,39 @@
private ThStudyTrackService thStudyTrackService;
@Autowired
private ThStudyAuthService thStudyAuthService;
+ @Autowired
+ private ThCourseChapterService thCourseChapterService;;
+ @Autowired
+ private ThCourseService thCourseService;
+ @Autowired
+ private ThBatchService thBatchService;
+ @Autowired
+ private ThStudentService studentService;;
@Override
public List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query) {
+ query.setStartSize((query.getPageNum()-1)*query.getPageSize());
+
List<ThStudyDetailVO> thStudyDetailVOS = thStudyDetailService.listByPage(query);
if(!CollectionUtils.isEmpty(thStudyDetailVOS)){
List<String> detailUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getUuid).collect(Collectors.toList());
//获取认证记录
- List<ThStudyAuth> authList = thStudyAuthService.getListByStudyDetaiIds(detailUuids);
+ List<ThStudyAuth> authList = thStudyAuthService.getByStudyDetaiUuids(detailUuids);
//获取轨迹
List<ThStudyTrack> trackList = thStudyTrackService.getListByStudyDetaiIds(detailUuids);
-
+ //获取章节名称
+ List<String> chapterUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getChapterUuid).collect(Collectors.toList());
+ List<ThCourseChapter> chapterList = thCourseChapterService.getChapterNameByUuids(chapterUuids);
+ //获取课程名称
+ List<String> courseUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getCourseUuid).collect(Collectors.toList());
+ List<ThCourse> courseList = thCourseService.getCourseNameByUuids(courseUuids);
+ //获取批次名称
+ List<String> batchUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getBatchUuid).collect(Collectors.toList());
+ List<ThBatch> batchList = thBatchService.getBatchNameByUuids(batchUuids);
+ //学生信息
+ List<String> idcards = thStudyDetailVOS.stream().map(ThStudyDetailVO::getIdcard).collect(Collectors.toList());
+ List<ThStudent> studentList = studentService.getNameByIdcards(idcards);
for(ThStudyDetailVO thStudyDetailVO : thStudyDetailVOS){
thStudyDetailVO.setDurationDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getDuration()));
thStudyDetailVO.setStartPositionDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getStartPosition()));
@@ -61,6 +78,23 @@
}).collect(Collectors.toList());
thStudyDetailVO.setAuthList(thStudyAuthVOList);
thStudyDetailVO.setTrackList(trackVOList);
+ List<ThCourseChapter> chapterSelectList = chapterList.stream().filter(chapter -> chapter.getUuid().equals(thStudyDetailVO.getChapterUuid())).collect(Collectors.toList());
+ if(!CollectionUtils.isEmpty(chapterSelectList)){
+ thStudyDetailVO.setChapterName(chapterSelectList.get(0).getChapterName());
+ }
+ List<ThCourse> courseSelectList = courseList.stream().filter(c -> c.getUuid().equals(thStudyDetailVO.getCourseUuid())).collect(Collectors.toList());
+ if(!CollectionUtils.isEmpty(courseSelectList)){
+ thStudyDetailVO.setCourseName(courseSelectList.get(0).getCourseName());
+ }
+ List<ThBatch> batchSelectList = batchList.stream().filter(b -> b.getUuid().equals(thStudyDetailVO.getBatchUuid())).collect(Collectors.toList());
+ if(!CollectionUtils.isEmpty(batchSelectList)){
+ thStudyDetailVO.setBatchName(batchSelectList.get(0).getBatchName());
+ }
+ List<ThStudent> studentSelectList = studentList.stream().filter(thStudent -> thStudent.getIdcard().equals(thStudyDetailVO.getIdcard())).collect(Collectors.toList());
+ if(!CollectionUtils.isEmpty(studentSelectList)){
+ thStudyDetailVO.setName(studentSelectList.get(0).getName());
+ }
+
}
}
return thStudyDetailVOS;
--
Gitblit v1.9.2