|
|
@ -19,8 +19,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
//实训演练-实训案例-实验实训
|
|
|
|
//实训演练-实训案例-实验实训
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -97,70 +97,115 @@ public class ExerciseExperimentalTraining {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
@ApiOperation("实训演练页面查询")
|
|
|
|
|
|
|
|
@PostMapping("getCourseChapter")
|
|
|
|
|
|
|
|
public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId) {
|
|
|
|
|
|
|
|
List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
|
|
|
|
|
|
|
|
List<SysCourseDto> dtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (SysCourse sysCourse : sysCourseList) {
|
|
|
|
|
|
|
|
SysCourseDto newDto = new SysCourseDto();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(sysCourse, newDto);
|
|
|
|
|
|
|
|
String courseId = newDto.getCourseId();
|
|
|
|
|
|
|
|
SysCourseChapterExample courseChapterExample = new SysCourseChapterExample();
|
|
|
|
|
|
|
|
courseChapterExample.createCriteria().andCourseIdEqualTo(courseId);
|
|
|
|
|
|
|
|
courseChapterExample.setOrderByClause("sequence ASC");
|
|
|
|
|
|
|
|
List<SysCourseChapter> sysCourseChapters = sysCourseChapterMapper.selectByExample(courseChapterExample);
|
|
|
|
|
|
|
|
List<SysCourseChapterDto> CourseChapterDtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (SysCourseChapter sysCourseChapter : sysCourseChapters) {
|
|
|
|
|
|
|
|
SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto);
|
|
|
|
|
|
|
|
BigDecimal progress = stuTrainingMapper.getByUserIdAndChapterId(userId, sysCourseChapter.getChapterId());
|
|
|
|
|
|
|
|
sysCourseChapterDto.setSchedule(progress);
|
|
|
|
|
|
|
|
CourseChapterDtoList.add(sysCourseChapterDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
newDto.setSysCourseChapterDtos(CourseChapterDtoList);
|
|
|
|
|
|
|
|
dtoList.add(newDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new ResultEntity<List<SysCourseDto>>(dtoList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @AnonymousAccess
|
|
|
|
// @AnonymousAccess
|
|
|
|
// @ApiOperation("实训演练页面查询")
|
|
|
|
// @ApiOperation("实训演练页面查询")
|
|
|
|
// @PostMapping("getCourseChapter")
|
|
|
|
// @PostMapping("getCourseChapter")
|
|
|
|
// public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId) {
|
|
|
|
// public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId) {
|
|
|
|
// List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
|
|
|
|
// List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
|
|
|
|
// List<SysCourseDto> dtoList = new ArrayList<>();
|
|
|
|
// List<SysCourseDto> dtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
// Map<String, SysCourseDto> map = new HashMap<>();
|
|
|
|
// for (SysCourse sysCourse : sysCourseList) {
|
|
|
|
// for (SysCourse sysCourse : sysCourseList) {
|
|
|
|
// SysCourseDto newDto = new SysCourseDto();
|
|
|
|
// SysCourseDto newDto = new SysCourseDto();
|
|
|
|
// BeanUtils.copyProperties(sysCourse, newDto);
|
|
|
|
// BeanUtils.copyProperties(sysCourse, newDto);
|
|
|
|
// String courseId = newDto.getCourseId();
|
|
|
|
// String courseId = newDto.getCourseId();
|
|
|
|
|
|
|
|
// map.put(courseId,newDto);
|
|
|
|
// SysCourseChapterExample courseChapterExample = new SysCourseChapterExample();
|
|
|
|
// SysCourseChapterExample courseChapterExample = new SysCourseChapterExample();
|
|
|
|
// courseChapterExample.createCriteria().andCourseIdEqualTo(courseId);
|
|
|
|
// courseChapterExample.createCriteria().andCourseIdEqualTo(courseId);
|
|
|
|
// courseChapterExample.setOrderByClause("sequence ASC");
|
|
|
|
// courseChapterExample.setOrderByClause("sequence ASC");
|
|
|
|
// List<SysCourseChapter> sysCourseChapters = sysCourseChapterMapper.selectByExample(courseChapterExample);
|
|
|
|
// List<SysCourseChapter> sysCourseChapters = sysCourseChapterMapper.selectByExample(courseChapterExample);
|
|
|
|
// List<SysCourseChapterDto> CourseChapterDtoList = new ArrayList<>();
|
|
|
|
// List<SysCourseChapterDto> CourseChapterDtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// List<String> chapterIds = new ArrayList<>();
|
|
|
|
// for (SysCourseChapter sysCourseChapter : sysCourseChapters) {
|
|
|
|
// for (SysCourseChapter sysCourseChapter : sysCourseChapters) {
|
|
|
|
//// stuTrainingMapper.getByUserIdAndChaptetId()
|
|
|
|
|
|
|
|
// SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto();
|
|
|
|
// SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto();
|
|
|
|
// BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto);
|
|
|
|
// BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto);
|
|
|
|
// StuTrainingExample example = new StuTrainingExample();
|
|
|
|
// String chapterId = sysCourseChapter.getChapterId();
|
|
|
|
// example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(sysCourseChapter.getChapterId());
|
|
|
|
// BigDecimal progress = stuTrainingMapper.getByUserIdAndChapterId(userId, chapterId);
|
|
|
|
// List<StuTrainingWithBLOBs> list = stuTrainingMapper.selectByExampleWithBLOBs(example);
|
|
|
|
// sysCourseChapterDto.setSchedule(progress);
|
|
|
|
// if (!list.isEmpty()) {
|
|
|
|
|
|
|
|
// StuTrainingWithBLOBs stuTrainingWithBLOBs = list.get(0);
|
|
|
|
|
|
|
|
// sysCourseChapterDto.setSchedule(stuTrainingWithBLOBs.getProgress());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// CourseChapterDtoList.add(sysCourseChapterDto);
|
|
|
|
// CourseChapterDtoList.add(sysCourseChapterDto);
|
|
|
|
|
|
|
|
// chapterIds.add(chapterId);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// SysCaseQuestionExample example = new SysCaseQuestionExample();
|
|
|
|
|
|
|
|
// example.createCriteria().andChapterIdIn(chapterIds);
|
|
|
|
|
|
|
|
// List<SysCaseQuestion> list = caseQuestionMapper.selectByExample(example);
|
|
|
|
|
|
|
|
// List<String> caseIds = list.stream().map(SysCaseQuestion::getCaseId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// SysCaseQuestionStepExample sysCaseQuestionStepExample = new SysCaseQuestionStepExample();
|
|
|
|
|
|
|
|
// sysCaseQuestionStepExample.createCriteria().andCaseIdIn(caseIds);
|
|
|
|
|
|
|
|
// List<SysCaseQuestionStep> sysCaseQuestionSteps = caseQuestionStepMapper.selectByExample(sysCaseQuestionStepExample);
|
|
|
|
|
|
|
|
// Map<String,String> collect = sysCaseQuestionSteps.stream().collect(Collectors.toMap(SysCaseQuestionStep::getCaseStepId,SysCaseQuestionStep::getTitle));
|
|
|
|
|
|
|
|
// newDto.setTitleAndId(collect);
|
|
|
|
// newDto.setSysCourseChapterDtos(CourseChapterDtoList);
|
|
|
|
// newDto.setSysCourseChapterDtos(CourseChapterDtoList);
|
|
|
|
// dtoList.add(newDto);
|
|
|
|
// dtoList.add(newDto);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return new ResultEntity<List<SysCourseDto>>(dtoList);
|
|
|
|
// return new ResultEntity<List<SysCourseDto>>(dtoList);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
@ApiOperation("实训演练页面查询")
|
|
|
|
|
|
|
|
@PostMapping("getCourseChapter")
|
|
|
|
|
|
|
|
public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId) {
|
|
|
|
|
|
|
|
List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
|
|
|
|
|
|
|
|
List<SysCourseDto> dtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> courseIds = sysCourseList.stream()
|
|
|
|
|
|
|
|
.map(SysCourse::getCourseId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysCourseChapter> sysCourseChapters = sysCourseChapterMapper.getChaptersByCourseIds(courseIds);
|
|
|
|
|
|
|
|
List<String> courseChapterIds = sysCourseChapters.stream().map(SysCourseChapter::getChapterId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<String>> idMap = new HashMap<>();
|
|
|
|
|
|
|
|
for (SysCourse sysCourse : sysCourseList) {
|
|
|
|
|
|
|
|
String courseId = sysCourse.getCourseId();
|
|
|
|
|
|
|
|
List<String> chapterIds = sysCourseChapters.stream()
|
|
|
|
|
|
|
|
.filter(chapter -> chapter.getCourseId().equals(courseId))
|
|
|
|
|
|
|
|
.map(SysCourseChapter::getChapterId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
idMap.put(courseId, chapterIds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//为循环提供数据
|
|
|
|
|
|
|
|
List<StuTraining> progressByChapterIds = stuTrainingMapper.getByUserIdAndChapterIds(userId, courseChapterIds); //循环外先查出所有进度
|
|
|
|
|
|
|
|
Map<String, BigDecimal> progressMap = progressByChapterIds.stream()
|
|
|
|
|
|
|
|
.collect(Collectors.toMap(StuTraining::getChapterId,
|
|
|
|
|
|
|
|
stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO),
|
|
|
|
|
|
|
|
(p1, p2) -> p1)); // 默认值为 BigDecimal.ZERO //进度为空则给0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//一层一层查出 课程,章节,章节下案例题
|
|
|
|
|
|
|
|
for (SysCourse sysCourse : sysCourseList) {
|
|
|
|
|
|
|
|
SysCourseDto newDto = new SysCourseDto();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(sysCourse, newDto);
|
|
|
|
|
|
|
|
String courseId = newDto.getCourseId();
|
|
|
|
|
|
|
|
List<SysCourseChapterDto> CourseChapterDtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (SysCourseChapter sysCourseChapter : sysCourseChapters) {
|
|
|
|
|
|
|
|
SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto);
|
|
|
|
|
|
|
|
String chapterId = sysCourseChapter.getChapterId();
|
|
|
|
|
|
|
|
BigDecimal progress = progressMap.get(chapterId);
|
|
|
|
|
|
|
|
sysCourseChapterDto.setSchedule(progress);
|
|
|
|
|
|
|
|
CourseChapterDtoList.add(sysCourseChapterDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询案例题
|
|
|
|
|
|
|
|
List<String> list1 = idMap.get(courseId); //取出章节ID
|
|
|
|
|
|
|
|
SysCaseQuestionExample example = new SysCaseQuestionExample();
|
|
|
|
|
|
|
|
example.createCriteria().andChapterIdIn(list1);
|
|
|
|
|
|
|
|
List<SysCaseQuestion> list = caseQuestionMapper.selectByExample(example);
|
|
|
|
|
|
|
|
List<String> caseIds = list.stream().map(SysCaseQuestion::getCaseId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
SysCaseQuestionStepExample sysCaseQuestionStepExample = new SysCaseQuestionStepExample();
|
|
|
|
|
|
|
|
sysCaseQuestionStepExample.createCriteria().andCaseIdIn(caseIds);
|
|
|
|
|
|
|
|
List<SysCaseQuestionStep> sysCaseQuestionSteps = caseQuestionStepMapper.selectByExample(sysCaseQuestionStepExample);
|
|
|
|
|
|
|
|
Map<String, String> collect = sysCaseQuestionSteps.stream().collect(Collectors.toMap(SysCaseQuestionStep::getCaseStepId, SysCaseQuestionStep::getTitle));
|
|
|
|
|
|
|
|
newDto.setSysCourseChapterDtos(CourseChapterDtoList);
|
|
|
|
|
|
|
|
dtoList.add(newDto);
|
|
|
|
|
|
|
|
newDto.setTitleAndId(collect);
|
|
|
|
|
|
|
|
newDto.setSysCourseChapterDtos(CourseChapterDtoList);
|
|
|
|
|
|
|
|
dtoList.add(newDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new ResultEntity<List<SysCourseDto>>(dtoList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//数据集下载
|
|
|
|
//数据集下载
|
|
|
|