From 94a137629e4a89e4cec816b9b4c8a148900c0e7a Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Fri, 19 Jul 2024 09:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=94=B9=E7=89=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CourseController.java | 5 - .../stu/ExerciseExperimentalTraining.java | 63 ------------ .../controller/stu/StuIndexController.java | 10 +- .../controller/stu/TheoryTestController.java | 6 -- .../controller/tea/TeaCaseController.java | 78 +-------------- .../controller/tea/TeaCaseStepController.java | 20 ++-- .../tea/TeaExamManageController.java | 54 +++++++--- .../tea/TeaGradeManageController.java | 95 ++++++++++++------ .../tea/TeaObjectiveController.java | 23 ++--- .../tea/TeaResourceCenterController.java | 98 ------------------- .../tea/TeaResourceDataController.java | 32 ------ .../controller/tea/UserController.java | 5 + .../resourceCenterAPI/CaseApi.java | 76 +++++++++++--- .../resourceCenterAPI/CourseAPI.java | 23 ++++- .../resourceCenterAPI/ObjectiveApi.java | 53 +++++++++- .../service/tea/ITeaGradeManageService.java | 9 +- .../tea/impl/TeaGradeManageServiceImpl.java | 30 +++--- src/main/resources/mapper/StuErrorMapper.xml | 2 +- .../resources/mapper/StuStudentExamMapper.xml | 2 +- .../mapper/StuTheoryRecordMapper.xml | 2 +- .../mapper/SysResourceLearningMapper.xml | 2 +- src/main/resources/mapper/SysWeightMapper.xml | 2 +- .../mapper/TeaAndStudentExamMapper.xml | 2 +- .../resources/mapper/TeaExamManageMapper.xml | 2 +- .../resources/mapper/TrainingReportMapper.xml | 2 +- 25 files changed, 299 insertions(+), 397 deletions(-) diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java index b8c5dfe..d4be5b4 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java @@ -27,11 +27,6 @@ import java.util.List; public class CourseController { @Autowired ICourseService courseService; - @Autowired - SysCourseChapterMapper chapterMapper; - @Autowired - SysCourseMapper courseMapper; - //编辑课程顺序 //转移 // @GetMapping("updateCourseSequence") 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 51d0c70..4254e8d 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 @@ -32,23 +32,12 @@ import java.util.stream.Collectors; @Api(tags = "实训演练-实训案例-实验实训") @RequestMapping("api/stu/exercise/experimentalTrainingController") public class ExerciseExperimentalTraining { - @Autowired - private SysCourseMapper sysCourseMapper; - @Autowired - private SysCourseChapterMapper sysCourseChapterMapper; @Autowired private StuTrainingMapper stuTrainingMapper; - - @Autowired - SysCaseQuestionMapper caseQuestionMapper; - @Autowired - SysCaseQuestionStepMapper caseQuestionStepMapper; @Autowired ITeaCaseStepService stepService; @Autowired ITeaResourceDataService resourceDataService; - @Autowired - SysResourceDataMapper resourceDataMapper; //获取案例题基础信息 @GetMapping("getCaseInfo") @@ -116,49 +105,6 @@ public class ExerciseExperimentalTraining { } -// @AnonymousAccess -// @ApiOperation("实训演练页面查询") -// @PostMapping("getCourseChapter") -// public ResultEntity> getIndexTheoryTest(@RequestParam String userId) { -// List sysCourseList = sysCourseMapper.getBySchoolId(); -// List dtoList = new ArrayList<>(); -// Map map = new HashMap<>(); -// for (SysCourse sysCourse : sysCourseList) { -// SysCourseDto newDto = new SysCourseDto(); -// BeanUtils.copyProperties(sysCourse, newDto); -// String courseId = newDto.getCourseId(); -// map.put(courseId,newDto); -// SysCourseChapterExample courseChapterExample = new SysCourseChapterExample(); -// courseChapterExample.createCriteria().andCourseIdEqualTo(courseId); -// courseChapterExample.setOrderByClause("sequence ASC"); -// List sysCourseChapters = sysCourseChapterMapper.selectByExample(courseChapterExample); -// List CourseChapterDtoList = new ArrayList<>(); -// -// List chapterIds = new ArrayList<>(); -// for (SysCourseChapter sysCourseChapter : sysCourseChapters) { -// SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto(); -// BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto); -// String chapterId = sysCourseChapter.getChapterId(); -// BigDecimal progress = stuTrainingMapper.getByUserIdAndChapterId(userId, chapterId); -// sysCourseChapterDto.setSchedule(progress); -// CourseChapterDtoList.add(sysCourseChapterDto); -// chapterIds.add(chapterId); -// } -// SysCaseQuestionExample example = new SysCaseQuestionExample(); -// example.createCriteria().andChapterIdIn(chapterIds); -// List list = caseQuestionMapper.selectByExample(example); -// List caseIds = list.stream().map(SysCaseQuestion::getCaseId).collect(Collectors.toList()); -// SysCaseQuestionStepExample sysCaseQuestionStepExample = new SysCaseQuestionStepExample(); -// sysCaseQuestionStepExample.createCriteria().andCaseIdIn(caseIds); -// List sysCaseQuestionSteps = caseQuestionStepMapper.selectByExample(sysCaseQuestionStepExample); -// Map collect = sysCaseQuestionSteps.stream().collect(Collectors.toMap(SysCaseQuestionStep::getCaseStepId,SysCaseQuestionStep::getTitle)); -// newDto.setTitleAndId(collect); -// newDto.setSysCourseChapterDtos(CourseChapterDtoList); -// dtoList.add(newDto); -// } -// return new ResultEntity>(dtoList); -// } -// @AnonymousAccess @@ -241,15 +187,6 @@ public class ExerciseExperimentalTraining { return new ResultEntity>(dtoList); } - - //数据集下载 -// @GetMapping("downloadResourceDataByCaseId") -// @ApiOperation("数据集下载") -// @AnonymousAccess -// public void downloadResourceDataByCaseId(@ApiParam("案例题id") @RequestParam String caseId, HttpServletResponse response) { -// resourceDataService.downloadResourceDataByCaseId(caseId, response); -// } - //判断案例是否有数据集 @GetMapping("haveResourceData") @ApiOperation("判断案例是否有数据集") diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/StuIndexController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/StuIndexController.java index bd16120..686004d 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/StuIndexController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/StuIndexController.java @@ -42,16 +42,10 @@ public class StuIndexController { @Autowired private SysLoginLogMapper sysLoginLogMapper; @Autowired - private SysCourseMapper sysCourseMapper; - @Autowired - private SysObjectiveQuestionMapper sysObjectiveQuestionMapper; - @Autowired private StuStudentExamMapper studentExamMapper; @Autowired private TeaExamManageMapper teaExamManageMapper; @Autowired - private TeaResourceCenterMapper teaResourceCenterMapper; - @Autowired private StuIndexService stuIndexService; @Autowired private SysResourceLearningMapper sysResourceLearningMapper; @@ -60,8 +54,6 @@ public class StuIndexController { @Autowired private StuTrainingMapper stuTrainingMapper; @Autowired - private SysCourseChapterMapper sysCourseChapterMapper; - @Autowired private StuTheoryExamMapper theoryExamMapper; @Autowired private TeaAndStudentExamMapper teaAndStudentExamMapper; @@ -86,7 +78,7 @@ public class StuIndexController { @ApiOperation("***(本接口作废、该数据调用getObjQuestionCount接口)理论考试数据,按顺序依次为单选,多选,判断") @PostMapping("getIndexTheoryTest") public ResultEntity> getIndexTheoryTest(@RequestParam String schoolId) { - return new ResultEntity>(sysObjectiveQuestionMapper.getIndexTheoryTest(schoolId)); + return null; } @AnonymousAccess diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java index 9c0525f..2451ff5 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java @@ -1,10 +1,8 @@ package com.sztzjy.financial_bigdata.controller.stu; -import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; -import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; import com.sztzjy.financial_bigdata.entity.stu_dto.ObjQuestionCountDto; @@ -13,7 +11,6 @@ import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestRecordDto; import com.sztzjy.financial_bigdata.mapper.StuTheoryRecordMapper; import com.sztzjy.financial_bigdata.mapper.StuUserMapper; -import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper; import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi; import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService; import com.sztzjy.financial_bigdata.util.ResultEntity; @@ -26,7 +23,6 @@ import org.springframework.web.bind.annotation.*; import java.io.IOException; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -40,8 +36,6 @@ public class TheoryTestController { StuTheoryRecordMapper recordMapper; @Autowired StuUserMapper userMapper; - @Autowired - SysObjectiveQuestionMapper objectiveQuestionMapper; //开始考试 选择 35道单选,每题2分,5道多选每题4分,10道判断每题1分 @GetMapping("startTheoryTest") diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java index d21c6b9..0f6344c 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java @@ -3,10 +3,7 @@ package com.sztzjy.financial_bigdata.controller.tea; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestion; -import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestionStep; import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs; -import com.sztzjy.financial_bigdata.mapper.SysCaseQuestionMapper; -import com.sztzjy.financial_bigdata.mapper.SysCaseQuestionStepMapper; import com.sztzjy.financial_bigdata.resourceCenterAPI.CaseApi; import com.sztzjy.financial_bigdata.service.tea.ITeaCaseService; import com.sztzjy.financial_bigdata.util.ResultEntity; @@ -27,10 +24,6 @@ import java.util.List; public class TeaCaseController { @Autowired ITeaCaseService caseService; - @Autowired - SysCaseQuestionStepMapper stepMapper; - @Autowired - SysCaseQuestionMapper questionMapper; //实训案例新增 内置数据必须附带章节id 老师上传的数据不需要 @PostMapping("insertCase") @@ -40,9 +33,6 @@ public class TeaCaseController { if (caseQuestion.getTwoId().isEmpty() || schoolId.isEmpty() || caseQuestion.getTitle().isEmpty() || caseQuestion.getContent().isEmpty()) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "案例题新增失败,必填内容为空"); } - if (caseQuestion.getThreeId().isEmpty()) { - return new ResultEntity<>(HttpStatus.BAD_REQUEST, "案例题新增失败,章节不能为空"); - } try { Boolean flag = CaseApi.insertCase(caseQuestion, schoolId, systemOwner); if (flag) { @@ -92,9 +82,9 @@ public class TeaCaseController { @GetMapping("/caseDelete") @ApiOperation("**案例题删除") @AnonymousAccess - public ResultEntity caseDelete(@ApiParam("案例题IDList") @RequestParam String caseId) { + public ResultEntity caseDelete(@ApiParam("案例题IDList") @RequestParam String caseId,@RequestParam String systemOwner) { try { - Boolean flag = CaseApi.caseDelete(caseId); + Boolean flag = CaseApi.caseDelete(caseId,systemOwner); if (flag) { return new ResultEntity<>(HttpStatus.OK, "客观题删除成功"); } else { @@ -105,29 +95,18 @@ public class TeaCaseController { } } - //案例题上下架 -// @GetMapping("unmountStatusCase") -// @ApiOperation("案例题上下架") -// public ResultEntity unmountStatusCase(@RequestParam String caseId, -// @ApiParam("上架传true 下架传false") Boolean unmountStatus) { -// Boolean flag = caseService.unmountStatusCase(caseId, unmountStatus); -// if (flag) { -// return new ResultEntity<>(HttpStatus.OK, "客观题上下架成功"); -// } else { -// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "客观题上下架失败"); -// } -// } + //案例题编辑 @PostMapping("updateCase") @ApiOperation("**案例题编辑") @AnonymousAccess - public ResultEntity updateCase(@RequestBody TestSysCaseQuestion caseQuestion, @RequestParam String schoolId) { + public ResultEntity updateCase(@RequestBody TestSysCaseQuestion caseQuestion, @RequestParam String schoolId,@RequestParam String systemOwner) { if (caseQuestion.getTwoId().isEmpty() || schoolId.isEmpty() || caseQuestion.getTitle().isEmpty() || caseQuestion.getContent().isEmpty()) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "案例题更新失败,必填内容为空"); } try { - Boolean flag = CaseApi.updateCase(caseQuestion, schoolId); + Boolean flag = CaseApi.updateCase(caseQuestion, schoolId,systemOwner); if (flag) { return new ResultEntity<>(HttpStatus.OK, "案例题更新成功"); } else { @@ -138,53 +117,6 @@ public class TeaCaseController { } } - - //案例题库选择课程名展示 -// @GetMapping("selectAllCourse") -// @ApiOperation("案例题库选择课程名展示") -// @AnonymousAccess -// public ResultEntity> selectAllCourse(@RequestParam String schoolId) { -// List list = caseService.selectAllCourseName(schoolId); -// return new ResultEntity<>(HttpStatus.OK, "案例题库选择课程名展示成功", list); -// } - - //案例题库选择章节名展示 -// @GetMapping("selectChapterByCourseId") -// @ApiOperation("案例题库选择章节名展示") -// @AnonymousAccess -// public ResultEntity> selectChapterByCourseId(@ApiParam("课程id") @RequestParam String courseId) { -// List list = caseService.selectChapterByCourseId(courseId); -// return new ResultEntity<>(HttpStatus.OK, "案例题库选择章节名展示成功", list); -// } -// -// //案例题库内容展示 -// @GetMapping("selectAllCaseByChapterId") -// @ApiOperation("案例题库选择案例题内容展示") -// @AnonymousAccess -// public ResultEntity> selectAllCaseByChapterId(@RequestParam String chapterId) { -// List list = caseService.selectAllCaseByChapterId(chapterId); -// return new ResultEntity<>(HttpStatus.OK, "案例题库选择案例题内容展示成功", list); -// } - -// //案例题库所有信息展示 -// @GetMapping("selectAllCaseBySchoolId") -// @ApiOperation("案例题库选择案例题内容展示") -// @AnonymousAccess -// public ResultEntity> selectAllCaseBySchoolId(@RequestParam String schoolId){ -// SysCaseQuestionExample example = new SysCaseQuestionExample(); -// if(Constant.BUILT_IN_SCHOOL_ID.equals(schoolId)){ -// example.createCriteria().andSchoolIdEqualTo(schoolId); -// }else { -// ArrayList schoolIds = new ArrayList<>(); -// schoolIds.add(schoolId); -// schoolIds.add(Constant.BUILT_IN_SCHOOL_ID); -// example.createCriteria().andSchoolIdIn(schoolIds); -// } -// List sysCaseQuestions = questionMapper.selectByExample(example); -// return new ResultEntity<>(HttpStatus.OK, "新增考试案例题预览展示成功",sysCaseQuestions); -// } - - //新增考试案例题预览 @GetMapping("selectCaseStepDetailByCaseId") @ApiOperation("**案例题步骤信息查询") diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseStepController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseStepController.java index 040e229..8c43a4d 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseStepController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseStepController.java @@ -96,16 +96,16 @@ public class TeaCaseStepController { } //案例题步骤内容查看 - @GetMapping("selectCaseStepDetails") - @ApiOperation("**案例题步骤内容查看") - public ResultEntity selectCaseStepDetails(@ApiParam("案例题步骤ID") @RequestParam String caseStepId) { - try { - TestSysCaseQuestionStep caseStep = CaseApi.selectCaseStepDetails(caseStepId); - return new ResultEntity<>(HttpStatus.OK, "案例题步骤内容查看成功",caseStep); - } catch (IOException e) { - return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); - } - } +// @GetMapping("selectCaseStepDetails") +// @ApiOperation("**案例题步骤内容查看") +// public ResultEntity selectCaseStepDetails(@ApiParam("案例题步骤ID") @RequestParam String caseStepId) { +// try { +// TestSysCaseQuestionStep caseStep = CaseApi.selectCaseStepDetails(caseStepId); +// return new ResultEntity<>(HttpStatus.OK, "案例题步骤内容查看成功",caseStep); +// } catch (IOException e) { +// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); +// } +// } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java index 7a60cb0..4b4dd84 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java @@ -4,10 +4,13 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; import com.sztzjy.financial_bigdata.entity.*; +import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TrainingDto; import com.sztzjy.financial_bigdata.mapper.*; +import com.sztzjy.financial_bigdata.resourceCenterAPI.CaseApi; +import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi; import com.sztzjy.financial_bigdata.service.tea.ITeaExamManageService; import com.sztzjy.financial_bigdata.util.ResultEntity; import com.sztzjy.financial_bigdata.util.file.IFileUtil; @@ -20,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; +import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; @@ -37,14 +41,10 @@ public class TeaExamManageController { @Autowired private ITeaExamManageService examManageService; @Autowired - private SysObjectiveQuestionMapper sysObjectiveQuestionMapper; - @Autowired private TeaExamManageMapper teaExamManageMapper; @Autowired private StuStudentExamMapper studentExamMapper; @Autowired - private StuTrainingMapper stuTrainingMapper; - @Autowired private TeaAndStudentExamMapper teaAndStudentExamMapper; @Autowired private StuClassMapper stuClassMapper; @@ -57,24 +57,44 @@ public class TeaExamManageController { @ApiOperation("新增考试--获取选题量和分数") public ResultEntity> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List ids) { List list = new ArrayList<>(ids); - Map map = sysObjectiveQuestionMapper.selectByList(list); + Map map = null; + try { + map = ObjectiveApi.getChooseObjCountAndSorce(ids); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口获取选题量和分数异常"); + } return new ResultEntity<>(map); } @AnonymousAccess @PostMapping("/getAllCount") - @ApiOperation("新增考试--获取题目总数量") - public ResultEntity getAllCount(@RequestParam String schoolId) { - TeaExamManageCountDto teaExamManageCountDto = sysObjectiveQuestionMapper.selectAllCount(schoolId); - return new ResultEntity(teaExamManageCountDto); + @ApiOperation("***新增考试--获取题目总数量") + public ResultEntity getAllCount(@RequestParam String schoolId,@RequestParam String systemOwner) { + try { + Integer single = ObjectiveApi.selectCountSingle(schoolId, systemOwner); + Integer many = ObjectiveApi.selectCountMany(schoolId, systemOwner); + Integer judge = ObjectiveApi.selectCountJudge(schoolId, systemOwner); + TeaExamManageCountDto teaExamManageCountDto = new TeaExamManageCountDto(); + teaExamManageCountDto.setSingleCount(single); + teaExamManageCountDto.setManyCount(many); + teaExamManageCountDto.setJudgeCount(judge); + return new ResultEntity(teaExamManageCountDto); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口获取题目总数异常"); + } } @AnonymousAccess @PostMapping("/selectObjectivityByType") - @ApiOperation("新增考试--选择客观题时展示") - public ResultEntity> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type, - @RequestParam String schoolId) { - List list = sysObjectiveQuestionMapper.selectObjectivityByType(type, schoolId); + @ApiOperation("***新增考试--选择客观题时展示") + public ResultEntity> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type, + @RequestParam String schoolId,@RequestParam String systemOwner) { + List list = null; + try { + list = ObjectiveApi.selectObjByType(type, schoolId, systemOwner); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心选择客观题时展示题目异常"); + } return new ResultEntity<>(list); } @@ -83,7 +103,13 @@ public class TeaExamManageController { @PostMapping("/selectTrainingByIds") @ApiOperation("新增考试--展示案例题详细信息") public ResultEntity> selectTrainingByIds(@RequestBody List ids) { - return new ResultEntity>(stuTrainingMapper.selectTrainingByIds(ids)); + List trainingDtos = null; + try { + trainingDtos = CaseApi.selectTrainingByIds(ids); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心新增考试--展示案例题详细信息异常"); + } + return new ResultEntity>(trainingDtos); } diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaGradeManageController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaGradeManageController.java index 19dc223..39c4b60 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaGradeManageController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaGradeManageController.java @@ -5,9 +5,15 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; import com.sztzjy.financial_bigdata.entity.*; +import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; +import com.sztzjy.financial_bigdata.entity.resource_entity.SysTwoCatalog; +import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs; import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto; import com.sztzjy.financial_bigdata.entity.tea_dto.*; import com.sztzjy.financial_bigdata.mapper.*; +import com.sztzjy.financial_bigdata.resourceCenterAPI.CaseApi; +import com.sztzjy.financial_bigdata.resourceCenterAPI.CourseAPI; +import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi; import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService; import com.sztzjy.financial_bigdata.service.tea.impl.TeaGradeManageServiceImpl; import com.sztzjy.financial_bigdata.util.PageUtil; @@ -63,16 +69,9 @@ public class TeaGradeManageController { @Autowired private TeaAndStudentExamMapper teaAndStudentExamMapper; @Autowired - private SysCourseMapper sysCourseMapper; - @Autowired private SysWeightMapper sysWeightMapper; @Autowired private StuTheoryExamMapper stuTheoryExamMapper; - @Autowired - private SysCaseQuestionStepMapper sysCaseQuestionStepMapper; - @Autowired - private SysObjectiveQuestionMapper sysObjectiveQuestionMapper; - @AnonymousAccess @PostMapping("/getExamInfo") @@ -234,16 +233,23 @@ public class TeaGradeManageController { @AnonymousAccess @PostMapping("/getGradeReportCase") - @ApiOperation("考试模式--成绩报告案例题questionOriginal所属章节,contentOriginal为考核点数量,Sort为序号") //TODO 案例题正确率字段暂无 + @ApiOperation("***考试模式--成绩报告案例题questionOriginal所属章节,contentOriginal为考核点数量,Sort为序号") //TODO 案例题正确率字段暂无 public ResultEntity> getGradeReportCase(@RequestParam Integer index, @RequestParam Integer size, - @RequestParam String examManageId) { + @RequestParam String examManageId, + @RequestParam String schoolId, + @RequestParam String systemOwner) { TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId); String caseIdList = teaExamManageWithBLOBs.getCaseIdlist(); List list = Arrays.asList(caseIdList.split(",")); - List resultList = sysCaseQuestionStepMapper.getGradeReportCase(list); + List resultList = null; + try { + resultList = CaseApi.getGradeReportCase(list, schoolId, systemOwner); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); + } int i = 1; - for (SysCaseQuestionStep sysCaseQuestionStep : resultList) { + for (TestTestSysCaseQuestionStepWithBLOBs sysCaseQuestionStep : resultList) { sysCaseQuestionStep.setSort(i); i++; } @@ -279,10 +285,15 @@ public class TeaGradeManageController { list.addAll(Arrays.asList(split)); } - List resultList = sysObjectiveQuestionMapper.getGradeReportObjective(list); + List resultList = null; + try { + resultList = ObjectiveApi.selectBatchByIdList(list); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); + } if (!resultList.isEmpty()) { int i = 0; - for (SysObjectiveQuestion sysObjectiveQuestion : resultList) { + for (SysObjectiveQuestions sysObjectiveQuestion : resultList) { i++; sysObjectiveQuestion.setObjectiveId(Integer.toString(i)); } @@ -398,37 +409,47 @@ public class TeaGradeManageController { @AnonymousAccess @PostMapping("/getTrainingInfo") - @ApiOperation("练习模式--页面展示") + @ApiOperation("***练习模式--页面展示") public ResultEntity> getTrainingInfo(@RequestParam Integer index, @RequestParam Integer size, @RequestParam String schoolId, @ApiParam("学号或姓名搜索框") @RequestParam(required = false) String keyWord, - @RequestParam(required = false) String classId) { - return new ResultEntity>(iTeaGradeManageService.getTrainingInfo(index, size, schoolId, keyWord, classId)); + @RequestParam(required = false) String classId, + @RequestParam String systemOwner) { + return new ResultEntity>(iTeaGradeManageService.getTrainingInfo(index, size, schoolId, keyWord, classId,systemOwner)); } @AnonymousAccess @GetMapping("/exportTrainingInfo") - @ApiOperation("练习模式--页面导出") + @ApiOperation("***练习模式--页面导出") public void exportTrainingInfo(HttpServletResponse response, @RequestParam String schoolId, @ApiParam("学号或姓名搜索框") @RequestParam(required = false) String keyWord, - @RequestParam(required = false) String classId) { - iTeaGradeManageService.exportTrainingInfo(response, schoolId, keyWord, classId); + @RequestParam(required = false) String classId, + @RequestParam String systemOwner) { + iTeaGradeManageService.exportTrainingInfo(response, schoolId, keyWord, classId,systemOwner); } @AnonymousAccess @PostMapping("/getTrainingDetailsInfo") @ApiOperation("练习模式--详情页面展示") public ResultEntity> getTrainingDetailsInfo(@RequestParam String userId) { - return new ResultEntity<>(iTeaGradeManageService.getTrainingDetailsInfo(userId)); + try { + return new ResultEntity<>(iTeaGradeManageService.getTrainingDetailsInfo(userId)); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心异常"); + } } @AnonymousAccess @GetMapping("/exportTrainingDetailsInfo") @ApiOperation("练习模式--详情页面导出") public void exportTrainingDetailsInfo(HttpServletResponse response, @RequestParam String userId) { - iTeaGradeManageService.exportTrainingDetailsInfo(response, userId); + try { + iTeaGradeManageService.exportTrainingDetailsInfo(response, userId); + } catch (IOException e) { + e.printStackTrace(); + } } @AnonymousAccess @@ -474,9 +495,14 @@ public class TeaGradeManageController { @AnonymousAccess @PostMapping("/getChapterName") - @ApiOperation("评阅-章节下拉框") - public ResultEntity> getReportCorrect() { - List list = sysCourseMapper.selectNameByCourseID(); + @ApiOperation("***评阅-章节下拉框") + public ResultEntity> getReportCorrect(String schoolId,String systemOwner) { + List list = null; + try { + list = CourseAPI.selectNameByCourseID(schoolId, systemOwner); + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心异常"); + } return new ResultEntity<>(list); } @@ -539,16 +565,27 @@ public class TeaGradeManageController { @AnonymousAccess @PostMapping("/getModuleBySchoolId") - @ApiOperation("练习模式--权重页面下拉选择模块框") - public ResultEntity>> getModuleBySchoolId(@RequestParam String schoolId) { - List> moduleBySchoolId = sysCourseMapper.getModuleBySchoolId(schoolId); - return new ResultEntity<>(moduleBySchoolId); + @ApiOperation("***练习模式--权重页面下拉选择模块框") + public ResultEntity>> getModuleBySchoolId(@RequestParam String schoolId,@RequestParam String systemOwner) { + List> list= null; + try { + List twoCatalogs = CourseAPI.selectCourseList(systemOwner, schoolId); + for (int i = 0; i < twoCatalogs.size(); i++) { + HashMap hashMap = new HashMap<>(); + SysTwoCatalog sysTwoCatalog = twoCatalogs.get(i); + hashMap.put(sysTwoCatalog.getTwoId(),sysTwoCatalog.getTwoName()); + list.add(hashMap); + } + } catch (IOException e) { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心异常"); + } + return new ResultEntity<>(list); } @AnonymousAccess @PostMapping("/getModuleByCourseId") @ApiOperation("练习模式--权重回显") - public ResultEntity getModuleBySchoolId(@RequestParam String courseId, + public ResultEntity getModuleByCourseId(@RequestParam String courseId, @RequestParam String schoolId) { SysWeightExample sysWeightExample = new SysWeightExample(); sysWeightExample.createCriteria().andSchoolIdEqualTo(schoolId).andCourseIdEqualTo(courseId); diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaObjectiveController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaObjectiveController.java index a43d9c0..a4f400c 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaObjectiveController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaObjectiveController.java @@ -2,7 +2,6 @@ package com.sztzjy.financial_bigdata.controller.tea; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; -import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; import com.sztzjy.financial_bigdata.entity.resource_entity.dto.SysObjectiveQuestionsDto; import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi; @@ -13,14 +12,11 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.python.antlr.ast.Str; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -33,8 +29,6 @@ public class TeaObjectiveController { ITeaObjectiveService teaObjectiveService; @Autowired IFileUtil fileUtil; - @Value("${file.path}") - private String filePath; //客观题新增 @PostMapping("insertObjective") @@ -77,15 +71,16 @@ public class TeaObjectiveController { @ApiOperation("**客观题列表查看") @AnonymousAccess public ResultEntity> selectObjectiveList(@RequestParam String schoolId, - @ApiParam("课程ID") @RequestParam String courseId, - @ApiParam("章节Id") @RequestParam(required = false) String chapterId, - @ApiParam("题目类型 0单选 1多选 2判断")@RequestParam(required = false)String type, - @ApiParam("搜索关键词")@RequestParam(required = false)String content, - @RequestParam Integer index, - @RequestParam Integer size) { + @ApiParam("课程ID") @RequestParam String courseId, + @ApiParam("章节Id") @RequestParam(required = false) String chapterId, + @ApiParam("题目类型 0单选 1多选 2判断")@RequestParam(required = false)String type, + @ApiParam("搜索关键词")@RequestParam(required = false)String content, + @RequestParam Integer index, + @RequestParam Integer size, + @RequestParam String systemOwner) { PageInfo pageInfo = null; try { - pageInfo = ObjectiveApi.selectObjectiveList(schoolId, courseId,chapterId, type, content, index, size); + pageInfo = ObjectiveApi.selectObjectiveList(schoolId, courseId,chapterId, type, content, index, size,systemOwner); return new ResultEntity<>(HttpStatus.OK, "客观题列表查看成功",pageInfo); } catch (IOException e) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java index ac9a038..a9ada94 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java @@ -3,10 +3,6 @@ package com.sztzjy.financial_bigdata.controller.tea; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.resource_entity.SysResource; -import com.sztzjy.financial_bigdata.entity.sys_dto.SysCourseDto; -import com.sztzjy.financial_bigdata.mapper.SysCourseChapterMapper; -import com.sztzjy.financial_bigdata.mapper.SysCourseMapper; -import com.sztzjy.financial_bigdata.mapper.TeaResourceCenterMapper; import com.sztzjy.financial_bigdata.resourceCenterAPI.ResourceCenterApi; import com.sztzjy.financial_bigdata.service.tea.ITeaResourceCenterService; import com.sztzjy.financial_bigdata.util.ResultEntity; @@ -14,22 +10,11 @@ import com.sztzjy.financial_bigdata.util.file.IFileUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.FileSystemResource; -import org.springframework.core.io.Resource; import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; //资源中心 @@ -41,37 +26,9 @@ public class TeaResourceCenterController { IFileUtil fileUtil; @Autowired ITeaResourceCenterService resourceCenterService; - @Autowired - TeaResourceCenterMapper resourceCenterMapper; @Value("${file.path}") private String filePath; - @Autowired - private SysCourseMapper sysCourseMapper; - @Autowired - private SysCourseChapterMapper courseChapterMapper; - - //上传资源文件 -// @PostMapping("uploadResource") -// @ApiOperation("**上传资源文件") -// @AnonymousAccess -// public ResultEntity uploadResource(@RequestParam MultipartFile file, -// @ApiParam("学校id") @RequestParam String schoolId, -// @ApiParam("课程Id") @RequestParam String courseId, -// @ApiParam("上传文件类型 课件/视频") @RequestParam String type, -// @ApiParam("课程名称") @RequestParam String courseName, -// @RequestParam String systemOwner) { -// try { -// Boolean flag = ResourceCenterApi.uploadResource(file, schoolId, courseId, type,systemOwner,courseName); -// if (flag) { -// return new ResultEntity<>(HttpStatus.OK, "新增成功"); -// } else { -// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "新增失败"); -// } -// } catch (IOException e) { -// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); -// } -// } //根据课程id查看资源文件列表 @AnonymousAccess @@ -101,59 +58,4 @@ public class TeaResourceCenterController { } } - //下载资源文件 -// @GetMapping("downloadResource") -// @ApiOperation("**下载资源文件") -// @AnonymousAccess -// public void downloadResource(@ApiParam("资源ID") @RequestParam String resourceId,String resourceName, HttpServletResponse response) { -// try { -// ResourceCenterApi.downloadResource(resourceName,resourceId,response); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - - //查看资源文件 - @GetMapping("/getResource") - @ApiOperation("**查看资源文件") - @AnonymousAccess - public ResponseEntity streamVideo(@RequestParam String resourceId, HttpServletResponse response) { - TeaResourceCenter resourceCenter = resourceCenterMapper.selectByPrimaryKey(resourceId); - String url = resourceCenter.getResourceUrl(); - String videoPath = filePath + url; - File videoFile = new File(videoPath); - if("视频".equals(resourceCenter.getType())){ - if (videoFile.exists()) { - Path path = Paths.get(videoPath); - FileSystemResource fileSystemResource = new FileSystemResource(videoFile); - return ResponseEntity.ok() - .contentType(MediaType.parseMediaType("video/mp4")) - .body(fileSystemResource); - } else { - return ResponseEntity.notFound().build(); - } - }else if("文件".equals(resourceCenter.getType())){ - if (videoFile.exists()) { - Path path = Paths.get(videoPath); - FileSystemResource fileSystemResource = new FileSystemResource(videoFile); - if(url.endsWith("pptx")){ - return ResponseEntity.ok() - .contentType(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.presentationml.presentation")) - .body(fileSystemResource); - }else if(url.endsWith("ppt")){ - return ResponseEntity.ok() - .contentType(MediaType.parseMediaType("application/vnd.ms-powerpoint")) - .body(fileSystemResource); - }else { - return ResponseEntity.ok() - .contentType(MediaType.parseMediaType("application/pdf")) - .body(fileSystemResource); - } - } else { - return ResponseEntity.notFound().build(); - } - } - return ResponseEntity.notFound().build(); - } - } diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceDataController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceDataController.java index 3676db4..2c27c60 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceDataController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceDataController.java @@ -11,9 +11,7 @@ import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -23,24 +21,6 @@ import java.util.List; public class TeaResourceDataController { @Autowired ITeaResourceDataService resourceDataService; - //数据集上传 -// @PostMapping("uploadResourceData") -// @ApiOperation("**数据集文件上传") -// @AnonymousAccess -// public ResultEntity uploadResourceData(@RequestParam MultipartFile file, -// @ApiParam("学校id") String schoolId, -// @ApiParam("案例题id") @RequestParam String caseId) { -// try { -// Boolean flag = ResourceDataApi.uploadResourceData(file,schoolId,caseId); -// if (flag) { -// return new ResultEntity<>(HttpStatus.OK, "数据集文件上传成功"); -// } else { -// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "数据集文件上传失败"); -// } -// } catch (IOException e) { -// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); -// } -// } //数据集信息查询 @GetMapping("selectResourceDataList") @@ -55,7 +35,6 @@ public class TeaResourceDataController { } } - //数据集删除 @GetMapping("deleteResourceData") @ApiOperation("**数据集删除") @@ -74,15 +53,4 @@ public class TeaResourceDataController { } } -// //数据集下载 -// @GetMapping("downloadResourceData") -// @ApiOperation("**数据集下载-暂未完成") -// @AnonymousAccess -// public void downloadResourceData(@RequestParam String resourceName,@ApiParam("资源ID") @RequestParam String resourceDataId, HttpServletResponse response) { -// try { -// ResourceDataApi.downloadResourceData(resourceName,resourceDataId,response); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/UserController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/UserController.java index 773e507..77b280a 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/UserController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/UserController.java @@ -188,8 +188,12 @@ public class UserController { @PostMapping("/getClassNameByClassId") @ApiOperation("根据班级ID返回班级名称") + @AnonymousAccess public ResultEntity getClassNameByClassId(@RequestParam String classId) { StuClass stuClass = classMapper.selectByPrimaryKey(classId); + if(stuClass==null){ + return null; + } return new ResultEntity<>(stuClass.getClassName()); } @@ -537,6 +541,7 @@ public class UserController { long examPeopleCount = stuUserMapper.countByExample(stuUserExample); StuStudentExamExample stuStudentExamExample = new StuStudentExamExample(); + stuStudentExamExample.createCriteria().andUseridIsNull(); //考试次数 long examTime = studentExamMapper.countByExample(stuStudentExamExample); HashMap countMap = new HashMap<>(); diff --git a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CaseApi.java b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CaseApi.java index 6752dfc..2029459 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CaseApi.java +++ b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CaseApi.java @@ -6,15 +6,20 @@ import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.sztzjy.financial_bigdata.config.Constant; +import com.sztzjy.financial_bigdata.entity.SysCaseQuestion; import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestion; import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestionStep; import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs; +import com.sztzjy.financial_bigdata.entity.tea_dto.TrainingDto; import com.sztzjy.financial_bigdata.util.HttpUtils; +import com.sztzjy.financial_bigdata.util.ResultEntity; import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.RequestParam; import java.io.IOException; import java.lang.reflect.Type; +import java.net.URLEncoder; import java.util.Date; import java.util.List; @@ -34,6 +39,10 @@ public class CaseApi { private final static String selectCaseStepDetails = Constant.API_URL + "/api/tea/CaseApi/selectCaseStepDetails"; private final static String selectCaseStepListBatchByIdListAndSort = Constant.API_URL + "/api/tea/CaseApi/selectCaseStepListBatchByIdListAndSort"; + private final static String selectTrainingByIds = Constant.API_URL + "/api/tea/CaseApi/selectTrainingByIds"; + private final static String getGradeReportCase = Constant.API_URL + "/api/tea/CaseApi/getGradeReportCase"; + + /** * local:案例题新增 * rsapi:案例题新增 @@ -60,9 +69,9 @@ public class CaseApi { public static PageInfo selectCaseList(String schoolId, String keyword, Integer index, Integer size, String systemOwner) throws IOException { String requestBody = ""; if (StringUtils.isBlank(keyword)) { - requestBody = "systemOwner=" + systemOwner + "&schoolId=" + schoolId+"&index="+index+"&size="+size; + requestBody = "systemOwner=" + systemOwner + "&schoolId=" + schoolId + "&index=" + index + "&size=" + size; } else { - requestBody = "systemOwner=" + systemOwner + "&schoolId=" + schoolId+"&index="+index+"&size="+size+"&keyword="+keyword; + requestBody = "systemOwner=" + systemOwner + "&schoolId=" + schoolId + "&index=" + index + "&size=" + size + "&keyword=" + keyword; } JSONObject object = HttpUtils.sendPost( selectCaseList, @@ -81,7 +90,7 @@ public class CaseApi { * rsapi:案例题详情查询 */ public static TestSysCaseQuestion selectCaseDetails(String caseId) throws IOException { - String requestBody = "caseId="+caseId; + String requestBody = "caseId=" + caseId; JSONObject object = HttpUtils.sendPost( selectCaseDetails, requestBody); @@ -98,15 +107,15 @@ public class CaseApi { * local:案例题删除 * rsapi:案例题删除 */ - public static Boolean caseDelete(String caseId) throws IOException { - String requestBody = "caseId="+caseId; + public static Boolean caseDelete(String caseId, String systemOwner) throws IOException { + String requestBody = "caseId=" + caseId + "&systemOwner=" + systemOwner; JSONObject object = HttpUtils.sendPost( caseDelete, requestBody); String respString = object.get("respString").toString(); - if("true".equals(respString)){ + if ("true".equals(respString)) { return true; - }else { + } else { return false; } } @@ -116,7 +125,7 @@ public class CaseApi { * rsapi:根据三级Id查询案例题 */ public static List selectCaseByChapterId(String chapterId) throws IOException { - String requestBody = "threeId="+chapterId; + String requestBody = "threeId=" + chapterId; JSONObject object = HttpUtils.sendPost( selectCaseByChapterId, requestBody); @@ -152,8 +161,9 @@ public class CaseApi { * local:案例题编辑 * rsapi:案例题编辑 */ - public static Boolean updateCase(TestSysCaseQuestion caseQuestion, String schoolId) throws IOException { + public static Boolean updateCase(TestSysCaseQuestion caseQuestion, String schoolId, String systemOwner) throws IOException { caseQuestion.setSource(schoolId); + caseQuestion.setOneName(systemOwner); Gson gson = new Gson(); JSONObject object = HttpUtils.sendPost( updateCase, @@ -171,7 +181,7 @@ public class CaseApi { * rsapi:案例题步骤信息查询 */ public static List selectCaseStepDetailByCaseId(String caseId) throws IOException { - String requestBody = "caseId="+caseId; + String requestBody = "caseId=" + caseId; JSONObject object = HttpUtils.sendPost( selectCaseStepDetailByCaseId, requestBody); @@ -222,15 +232,15 @@ public class CaseApi { * local:案例题步骤删除 * rsapi:案例题步骤删除 */ - public static Boolean deleteCaseStep(String caseId) throws IOException { - String requestBody = "caseId="+caseId; + public static Boolean deleteCaseStep(String caseStepId) throws IOException { + String requestBody = "caseStepId=" + caseStepId; JSONObject object = HttpUtils.sendPost( deleteCaseStep, requestBody); String respString = object.get("respString").toString(); - if("true".equals(respString)){ + if ("true".equals(respString)) { return true; - }else { + } else { return false; } } @@ -240,7 +250,7 @@ public class CaseApi { * rsapi:案例题步骤信息查询 */ public static TestTestSysCaseQuestionStepWithBLOBs selectCaseStepDetails(String caseStepId) throws IOException { - String requestBody = "caseStepId="+caseStepId; + String requestBody = "caseStepId=" + caseStepId; JSONObject object = HttpUtils.sendPost( selectCaseStepDetails, requestBody); @@ -272,4 +282,40 @@ public class CaseApi { return list; } + /** + * 单独接口 + * 展示案例题详细信息 + */ + public static List selectTrainingByIds(List caseStepIdList) throws IOException { + Gson gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .create(); + // 构建带有 schoolId 的 URL + String urlWithParams = selectTrainingByIds; + JSONObject object = HttpUtils.sendPost( + urlWithParams, + gson.toJson(caseStepIdList), "application/json", null); + Type listType = new TypeToken>() { + }.getType(); + List list = gson.fromJson(object.get("respString").toString(), listType); + return list; + } + + /** + * 单独接口 + * 考试模式--成绩报告案例题questionOriginal所属章节,contentOriginal为考核点数量,Sort为序号 + */ + public static List getGradeReportCase(List caseIdList, String schoolId, String systemOwner) throws IOException { + Gson gson = new Gson(); + // 构建带有 schoolId 的 URL + String urlWithParams = getGradeReportCase + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8"); + JSONObject object = HttpUtils.sendPost( + urlWithParams, + gson.toJson(caseIdList), "application/json", null); + Type listType = new TypeToken>() { + }.getType(); + List list = gson.fromJson(object.get("respString").toString(), listType); + return list; + } + } diff --git a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CourseAPI.java b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CourseAPI.java index 8842788..c6b45e6 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CourseAPI.java +++ b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/CourseAPI.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.lang.reflect.Type; import java.util.Date; import java.util.List; +import java.util.Map; public class CourseAPI { private final static String getAllTwoCatalogList = Constant.API_URL + "/api/sys/courseApi/getAllTwoCatalogList"; @@ -29,6 +30,9 @@ public class CourseAPI { private final static String selectChaptersByCourseIdsAndAsc = Constant.API_URL + "/api/sys/courseApi/selectChaptersByCourseIdsAndAsc"; private final static String getTotalChapterCount = Constant.API_URL + "/api/sys/courseApi/getTotalChapterCount"; private final static String selectChapterByChapterId = Constant.API_URL + "/api/sys/courseApi/selectChapterByChapterId"; + private final static String selectNameByCourseID = Constant.API_URL + "/api/sys/courseApi/selectNameByCourseID"; + private final static String getModuleBySchoolId = Constant.API_URL + "/api/sys/courseApi/getModuleBySchoolId"; + /** * local:查看课程 @@ -202,8 +206,23 @@ public class CourseAPI { } - - + /** + * 单独接口 + * 查询章节名称集合 + */ + public static List selectNameByCourseID(String schoolId,String systemOwner) throws IOException { + String requestBody = "schoolId="+schoolId+"&systemOwner="+systemOwner; + JSONObject object = HttpUtils.sendPost( + selectNameByCourseID, + requestBody); + Gson gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .create(); + Type listType = new TypeToken>() { + }.getType(); + List list = gson.fromJson(object.get("respString").toString(), listType); + return list; + } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/ObjectiveApi.java b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/ObjectiveApi.java index 60bf9e3..f5e2d5a 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/ObjectiveApi.java +++ b/src/main/java/com/sztzjy/financial_bigdata/resourceCenterAPI/ObjectiveApi.java @@ -9,8 +9,11 @@ import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; import com.sztzjy.financial_bigdata.entity.resource_entity.SysTwoCatalog; import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestion; +import com.sztzjy.financial_bigdata.entity.resource_entity.dto.SysObjectiveQuestionsDto; +import com.sztzjy.financial_bigdata.entity.tea_dto.TrainingDto; import com.sztzjy.financial_bigdata.util.HttpUtils; import io.swagger.annotations.ApiParam; +import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; @@ -21,6 +24,7 @@ import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.net.URL; import java.net.URLEncoder; import java.util.Date; @@ -44,12 +48,14 @@ public class ObjectiveApi { private final static String selectCountSingle = Constant.API_URL + "/api/sys/ObjectiveApi/selectCountSingle"; private final static String selectCountMany = Constant.API_URL + "/api/sys/ObjectiveApi/selectCountMany"; private final static String selectCountJudge = Constant.API_URL + "/api/sys/ObjectiveApi/selectCountJudge"; + private final static String getChooseObjCountAndSorce = Constant.API_URL + "/api/sys/ObjectiveApi/getChooseObjCountAndSorce"; + private final static String selectObjByType = Constant.API_URL + "/api/sys/ObjectiveApi/selectObjByType"; /** * local:客观题新增 * rsapi:客观题新增 */ - public static Boolean insertObjective(SysObjectiveQuestions objective, String systemOwner, String schoolId) throws IOException { + public static Boolean insertObjective(SysObjectiveQuestionsDto objective, String systemOwner, String schoolId) throws IOException { objective.setSource(schoolId); objective.setObjectiveId(systemOwner); Gson gson = new Gson(); @@ -87,8 +93,8 @@ public class ObjectiveApi { * local:客观题列表查看 * rsapi:客观题列表查看 */ - public static PageInfo selectObjectiveList(String schoolId, String courseId,String chapterId, String type, String content, Integer index, Integer size) throws IOException { - String requestBody = "schoolId=" + schoolId + "&courseId=" + courseId+"&index="+index+"&size="+size; + public static PageInfo selectObjectiveList(String schoolId, String courseId,String chapterId, String type, String content, Integer index, Integer size,String systemOwner) throws IOException { + String requestBody = "schoolId=" + schoolId + "&courseId=" + courseId+"&index="+index+"&size="+size+"&systemOwner="+systemOwner; String contentStr=""; String typeStr=""; String chapterStr=""; @@ -330,6 +336,47 @@ public class ObjectiveApi { } + /** + * 获取所选客观题数量及分数 + */ + public static Map getChooseObjCountAndSorce(List objectIdList) throws IOException { + Gson gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .create(); + // 构建带有 schoolId 的 URL + String urlWithParams = getChooseObjCountAndSorce; + JSONObject object = HttpUtils.sendPost( + urlWithParams, + gson.toJson(objectIdList), "application/json", null); + Type listType = new TypeToken>() { + }.getType(); + Map map = gson.fromJson(object.get("respString").toString(), listType); + return map; + } + + /** + * 根据客观题类型查询客观题 + */ + public static List selectObjByType(String type,String schoolId,String systemOwner) throws IOException { + String requestBody = "type="+type+"&schoolId="+schoolId+"&systemOwner="+systemOwner; + JSONObject object = HttpUtils.sendPost( + selectObjByType, + requestBody); + Gson gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .create(); + Type listType = new TypeToken>() { + }.getType(); + List caseQuestionList = gson.fromJson(object.get("respString").toString(), listType); + return caseQuestionList; + } + + /** + * 单独接口 + */ + + + } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaGradeManageService.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaGradeManageService.java index 6112a98..a891015 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaGradeManageService.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaGradeManageService.java @@ -8,6 +8,7 @@ import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -15,15 +16,15 @@ import java.util.List; * @Date 2024/3/19 */ public interface ITeaGradeManageService { - PageInfo getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId); + PageInfo getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId,String systemOwner); - void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId); + void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId,String systemOwner); TeaExaminationDetailsDto getCountChart(String examManageId, String classId); - List getTrainingDetailsInfo(String userId); + List getTrainingDetailsInfo(String userId) throws IOException; - void exportTrainingDetailsInfo(HttpServletResponse response, String userId); + void exportTrainingDetailsInfo(HttpServletResponse response, String userId) throws IOException; PageInfo getReportCorrect(String schoolId, Integer index, Integer size, String module, String classId, String keyWord); diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaGradeManageServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaGradeManageServiceImpl.java index 4d666e0..6e601b8 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaGradeManageServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaGradeManageServiceImpl.java @@ -4,9 +4,11 @@ import cn.hutool.core.util.IdUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.entity.*; +import com.sztzjy.financial_bigdata.entity.resource_entity.SysThreeCatalog; import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto; import com.sztzjy.financial_bigdata.entity.tea_dto.*; import com.sztzjy.financial_bigdata.mapper.*; +import com.sztzjy.financial_bigdata.resourceCenterAPI.CourseAPI; import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService; import com.sztzjy.financial_bigdata.util.PageUtil; import com.sztzjy.financial_bigdata.util.excel.FilePortUtil; @@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; @@ -40,8 +43,6 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { @Autowired private TeaExamManageMapper teaExamManageMapper; @Autowired - private SysCourseChapterMapper sysCourseChapterMapper; - @Autowired private StuStudentExamMapper studentExamMapper; @Autowired private StuTheoryRecordMapper stuTheoryRecordMapper; @@ -50,8 +51,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { @Override - public PageInfo getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId) { - List list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId); + public PageInfo getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId,String systemOwner) { + List list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId,systemOwner); assert !list.isEmpty(); list.sort(new TotalScoreComparator()); int i = 0; @@ -70,8 +71,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { * @Date 2024/3/19 */ @Override - public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId) { - List list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId); + public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId,String systemOwner) { + List list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId,systemOwner); //导出的表名 String title = IdUtil.simpleUUID(); //表中第一行表头字段 @@ -168,18 +169,18 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { @Override - public List getTrainingDetailsInfo(String userId) { + public List getTrainingDetailsInfo(String userId) throws IOException { StuTrainingExample trainingExample = new StuTrainingExample(); trainingExample.createCriteria().andUserIdEqualTo(userId); List stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(trainingExample); List list = new ArrayList<>(); for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainingWithBLOBs) { BigDecimal moduleScore = getModuleScore(stuTrainingWithBLOB); - SysCourseChapter sysCourseChapter = sysCourseChapterMapper.selectByPrimaryKey(stuTrainingWithBLOB.getChapterId()); + SysThreeCatalog sysCourseChapter = CourseAPI.selectChapterByChapterId(stuTrainingWithBLOB.getChapterId()); TeaTrainingDto newData = new TeaTrainingDto(); BeanUtils.copyProperties(stuTrainingWithBLOB, newData); if (sysCourseChapter != null) { - newData.setTaskModule(sysCourseChapter.getChapterName()); + newData.setTaskModule(sysCourseChapter.getThreeId()); } if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) { String reportId = stuTrainingWithBLOB.getReportId(); @@ -202,7 +203,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { } @Override - public void exportTrainingDetailsInfo(HttpServletResponse response, String userId) { + public void exportTrainingDetailsInfo(HttpServletResponse response, String userId) throws IOException { List list = getTrainingDetailsInfo(userId); //导出的表名 String title = IdUtil.simpleUUID(); @@ -287,7 +288,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { } - private List getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId) { + private List getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId,String systemOwner) { StuUserExample userExample = new StuUserExample(); StuUserExample.Criteria criteria = userExample.createCriteria(); criteria.andSchoolIdEqualTo(schoolId).andRoleIdEqualTo(4); @@ -327,7 +328,12 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService { List trainingReports = trainingReportMapper.selectByPrimaryKeys(reportIds); Map reportIdToScoreMap = trainingReports.stream().collect(Collectors.toMap(TrainingReport::getReportId, TrainingReport::getTeacherScore)); // 获取总模块数量 - BigDecimal chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId); + BigDecimal chapterNum = null; + try { + chapterNum = BigDecimal.valueOf(CourseAPI.getTotalChapterCount(systemOwner)); + } catch (IOException e) { + return null; + } // 遍历用户,计算分数并封装DTO List list = new ArrayList<>(); diff --git a/src/main/resources/mapper/StuErrorMapper.xml b/src/main/resources/mapper/StuErrorMapper.xml index 0db3ec3..50051d9 100644 --- a/src/main/resources/mapper/StuErrorMapper.xml +++ b/src/main/resources/mapper/StuErrorMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/StuStudentExamMapper.xml b/src/main/resources/mapper/StuStudentExamMapper.xml index f85dff1..15df6d8 100644 --- a/src/main/resources/mapper/StuStudentExamMapper.xml +++ b/src/main/resources/mapper/StuStudentExamMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/StuTheoryRecordMapper.xml b/src/main/resources/mapper/StuTheoryRecordMapper.xml index e8502f1..5cfe0bb 100644 --- a/src/main/resources/mapper/StuTheoryRecordMapper.xml +++ b/src/main/resources/mapper/StuTheoryRecordMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/SysResourceLearningMapper.xml b/src/main/resources/mapper/SysResourceLearningMapper.xml index 2b5df7e..3ec833c 100644 --- a/src/main/resources/mapper/SysResourceLearningMapper.xml +++ b/src/main/resources/mapper/SysResourceLearningMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/SysWeightMapper.xml b/src/main/resources/mapper/SysWeightMapper.xml index 0df9726..a603ceb 100644 --- a/src/main/resources/mapper/SysWeightMapper.xml +++ b/src/main/resources/mapper/SysWeightMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/TeaAndStudentExamMapper.xml b/src/main/resources/mapper/TeaAndStudentExamMapper.xml index 6342c9c..0a773b6 100644 --- a/src/main/resources/mapper/TeaAndStudentExamMapper.xml +++ b/src/main/resources/mapper/TeaAndStudentExamMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/TeaExamManageMapper.xml b/src/main/resources/mapper/TeaExamManageMapper.xml index 10e94bf..22ef503 100644 --- a/src/main/resources/mapper/TeaExamManageMapper.xml +++ b/src/main/resources/mapper/TeaExamManageMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/src/main/resources/mapper/TrainingReportMapper.xml b/src/main/resources/mapper/TrainingReportMapper.xml index 97f53a0..7d5532e 100644 --- a/src/main/resources/mapper/TrainingReportMapper.xml +++ b/src/main/resources/mapper/TrainingReportMapper.xml @@ -1,6 +1,6 @@ - +