diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java index fc4629a..744ba92 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java @@ -44,7 +44,7 @@ public class ExerciseExperimentalTraining { @ApiOperation("**获取案例题基础信息") @AnonymousAccess public ResultEntity getCaseInfo(@RequestParam String chapterId) { - List sysCaseQuestions= null; + List sysCaseQuestions = null; try { sysCaseQuestions = CaseApi.selectCaseByChapterId(chapterId); } catch (IOException e) { @@ -108,7 +108,7 @@ public class ExerciseExperimentalTraining { @AnonymousAccess @ApiOperation("实训演练页面查询") @PostMapping("getCourseChapter") - public ResultEntity> getIndexTheoryTest(@RequestParam String userId,@RequestParam String systemOwner) { + public ResultEntity> getIndexTheoryTest(@RequestParam String userId, @RequestParam String systemOwner) { // List sysCourseList = sysCourseMapper.getBySchoolId(); List sysCourseList = null; try { @@ -116,12 +116,11 @@ public class ExerciseExperimentalTraining { } catch (IOException e) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心获取内置二级目录失败"); } - if(sysCourseList.isEmpty()){ + if (sysCourseList.isEmpty()) { return null; } List dtoList = new ArrayList<>(); - // 批量查询所有章节 List courseIds = sysCourseList.stream() .map(SysTwoCatalog::getTwoId) @@ -132,14 +131,23 @@ public class ExerciseExperimentalTraining { } catch (IOException e) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据课程IDList查询章节集合失败"); } - if(sysCourseChapters.isEmpty()){ - return null; + if (sysCourseChapters.isEmpty()) { + //三级为空返回二级的信息 + for (SysTwoCatalog sysTwoCatalog : sysCourseList) { + SysCourseDto newDto = new SysCourseDto(); + newDto.setCourseId(sysTwoCatalog.getTwoId()); + newDto.setSequence(sysTwoCatalog.getSort()); + newDto.setCourseName(sysTwoCatalog.getTwoName()); + newDto.setSchoolId(sysTwoCatalog.getCreator()); + dtoList.add(newDto); + return new ResultEntity>(dtoList); + } } // 批量查询所有案例题步骤 SysCaseQuestionStepExample stepExample = new SysCaseQuestionStepExample(); stepExample.setOrderByClause("sort"); - List sysCaseQuestionSteps= null; + List sysCaseQuestionSteps = null; try { sysCaseQuestionSteps = CaseApi.selectAllStepBySystemOwner(systemOwner); } catch (IOException e) { @@ -152,7 +160,7 @@ public class ExerciseExperimentalTraining { // 批量查询案例题ID Map> caseIdMap = null; try { - caseIdMap = CaseApi.getMapChapterIdAndCaseIdsByCourseIdAndChapterId(sysCourseChapters,systemOwner); + caseIdMap = CaseApi.getMapChapterIdAndCaseIdsByCourseIdAndChapterId(sysCourseChapters, systemOwner); } catch (IOException e) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心查询失败"); } @@ -161,7 +169,7 @@ public class ExerciseExperimentalTraining { List progressByChapterIds = stuTrainingMapper.getByUserIdAndChapterIds(userId, sysCourseChapters.stream().map(SysThreeCatalog::getThreeId).collect(Collectors.toList())); Map progressMap = progressByChapterIds.stream() - .collect(Collectors.toMap(StuTraining::getChapterId,stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO), (p1, p2) -> p1)); + .collect(Collectors.toMap(StuTraining::getChapterId, stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO), (p1, p2) -> p1)); // 构建结果列表 for (SysTwoCatalog sysCourse : sysCourseList) { @@ -187,12 +195,12 @@ public class ExerciseExperimentalTraining { // 获取案例题步骤信息 List caseIds = caseIdMap.get(chapter.getThreeId()); if (caseIds != null && !caseIds.isEmpty()) { - Listlist =new ArrayList<>(); + List list = new ArrayList<>(); for (String caseId : caseIds) { List steps = caseStepsMap.get(caseId); if (steps != null && !steps.isEmpty()) { for (TestTestSysCaseQuestionStepWithBLOBs step : steps) { - AAA aaa =new AAA(); + AAA aaa = new AAA(); aaa.setStepID(step.getCaseStepId()); aaa.setTitle(step.getTitle()); aaa.setSort(step.getSort()); @@ -245,9 +253,9 @@ public class ExerciseExperimentalTraining { } catch (IOException e) { return false; } - if(resourceDataList.size()>0){ + if (resourceDataList.size() > 0) { return true; - }else { + } else { return false; } }