From e56506444f601d6c7ad7bfc863739e06cc9033c5 Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Wed, 17 Apr 2024 11:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=90=86=E8=AE=BA=E8=80=83?= =?UTF-8?q?=E8=AF=95=E6=89=80=E6=9C=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/stu/ExamController.java | 31 +++ .../controller/stu/TheoryTestController.java | 47 +++- .../tea/TeaObjectiveController.java | 2 +- .../tea/TeaResourceCenterController.java | 13 +- .../entity/SysObjectiveQuestion.java | 14 +- .../entity/SysObjectiveQuestionExample.java | 56 ++--- .../entity/TeaResourceCenter.java | 12 +- .../entity/TeaResourceCenterExample.java | 56 ++--- .../stu_dto/StuTheoryExamDetailDto.java | 23 ++ .../sys_dto/SysObjectiveQuestionDto.java | 12 +- .../service/stu/ITheoryTestService.java | 9 + .../service/stu/impl/ExerciseServiceImpl.java | 17 +- .../stu/impl/TheoryTestServiceImpl.java | 214 +++++++++++++++--- .../tea/ITeaResourceCenterService.java | 4 +- .../tea/impl/TeaObjectiveServiceImpl.java | 8 +- .../impl/TeaResourceCenterServiceImpl.java | 10 +- src/main/resources/mapper/SysCourseMapper.xml | 13 ++ .../mapper/SysObjectiveQuestionMapper.xml | 36 +-- .../mapper/TeaResourceCenterMapper.xml | 28 +-- 19 files changed, 444 insertions(+), 161 deletions(-) create mode 100644 src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExamController.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryExamDetailDto.java diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExamController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExamController.java new file mode 100644 index 0000000..65c335f --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExamController.java @@ -0,0 +1,31 @@ +package com.sztzjy.financial_bigdata.controller.stu; + +import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; +import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; +import com.sztzjy.financial_bigdata.util.ResultEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@Api(tags = "实战考核") +@RequestMapping("api/stu/examController") +public class ExamController { + + //基础知识题目展示 +// @GetMapping("basicKnowledge") +// @ApiOperation("基础知识") +// @AnonymousAccess +// public ResultEntity> basicKnowledge(@RequestParam String userId) { +// +// } + + //交卷 + + //案例考核 +} 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 49edd95..fe2e203 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,13 +1,20 @@ 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.entity.StuTheoryExam; +import com.sztzjy.financial_bigdata.entity.StuTheoryRecord; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; +import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto; +import com.sztzjy.financial_bigdata.mapper.StuTheoryRecordMapper; import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService; import com.sztzjy.financial_bigdata.util.ResultEntity; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; @@ -20,6 +27,8 @@ import java.util.List; public class TheoryTestController { @Autowired ITheoryTestService theoryTestService; + @Autowired + StuTheoryRecordMapper recordMapper; //开始考试 选择 35道单选,每题2分,5道多选每题4分,10道判断每题1分 @GetMapping("startTheoryTest") @@ -58,9 +67,45 @@ public class TheoryTestController { } //移除错题集 + @GetMapping("removeError") + @ApiOperation("移除错题集") + public ResultEntity removeError(@RequestParam String userId, + @ApiParam("客观题id")@RequestParam String objectiveQuestionId, + @ApiParam("题目类型 single、many、judge")@RequestParam String type){ + Boolean flag=theoryTestService.removeError(userId,objectiveQuestionId,type); + if(flag){ + return new ResultEntity<>(HttpStatus.OK, "移除错题集成功"); + }else { + return new ResultEntity<>(HttpStatus.BAD_REQUEST, "移除错题集失败"); + } + } + //考试记录查询 + @GetMapping("getTheoryTestList") + @ApiOperation("获取理论考试数据集") + public ResultEntity> getTheoryTestList(@RequestParam String userId, + @RequestParam Integer index, + @RequestParam Integer size){ + PageInfo pageInfo=theoryTestService.getTheoryTestList(userId,index,size); + return new ResultEntity<>(HttpStatus.OK, "获取理论考试数据集成功",pageInfo); + } + //考试记录详情查询 - //答题次数、平均正确率、排名 + @GetMapping("getTheoryTestDetail") + @ApiOperation("获取理论考试数据详情") + public ResultEntity> getTheoryTestDetail(@ApiParam("理论考试id")@RequestParam String theoryExamId, + @RequestParam Integer index, + @RequestParam Integer size){ + List detailDtoList=theoryTestService.getTheoryTestDetail(theoryExamId,index,size); + return new ResultEntity<>(HttpStatus.OK, "获取理论考试数据详情成功",detailDtoList); + } + //答题次数、平均正确率、排名(理论考试记录) + @GetMapping("getTheoryRecord") + @ApiOperation("获取理论考试记录数据") + public ResultEntity getTheoryRecord(String userId){ + StuTheoryRecord stuTheoryRecord = recordMapper.selectByPrimaryKey(userId); + return new ResultEntity<>(HttpStatus.OK, "获取理论考试记录数据成功",stuTheoryRecord); + } } 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 9c0deb8..b4446c9 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 @@ -62,7 +62,7 @@ public class TeaObjectiveController { @ApiOperation("客观题列表查看") public ResultEntity> selectObjectiveList(@RequestParam String schoolId, @ApiParam("课程ID") @RequestParam String courseId, - @ApiParam("题目类型 0单选 1多选 2判断")@RequestParam(required = false)String type, + @ApiParam("题目类型 single单选 many多选 judge判断")@RequestParam(required = false)String type, @ApiParam("搜索关键词")@RequestParam(required = false)String content, @RequestParam Integer index, @RequestParam Integer size) { 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 bf4ac71..64232c2 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 @@ -42,13 +42,14 @@ public class TeaResourceCenterController { //上传资源文件 - @GetMapping("uploadResource") + @PostMapping("uploadResource") @ApiOperation("上传资源文件") + @AnonymousAccess public ResultEntity uploadResource(@RequestParam MultipartFile file, @ApiParam("学校id") @RequestParam(required = false) String schoolId, - @ApiParam("章节Id") @RequestParam String chapterId, + @ApiParam("课程Id") @RequestParam String courseId, @ApiParam("上传文件类型 文件/视频") @RequestParam String type) { - Boolean flag = resourceCenterService.uploadResource(file, schoolId, chapterId,type); + Boolean flag = resourceCenterService.uploadResource(file, schoolId, courseId,type); if (flag) { return new ResultEntity<>(HttpStatus.OK, "新增成功"); } else { @@ -61,14 +62,15 @@ public class TeaResourceCenterController { @GetMapping("selectResource") @ApiOperation("查看资源文件列表,图片资源使用默认图片") public ResultEntity> uploadResourceCenter(@ApiParam("学校id") @RequestParam(required = false) String schoolId, - @ApiParam("章节Id") @RequestParam String chapterId) { - List list = resourceCenterService.selectResource(schoolId, chapterId); + @ApiParam("课程Id") @RequestParam String courseId) { + List list = resourceCenterService.selectResource(schoolId, courseId); return new ResultEntity(HttpStatus.OK, "查看资源文件列表,展示成功", list); } //下载资源文件 @GetMapping("downloadResource") @ApiOperation("下载资源文件") + @AnonymousAccess public void downloadResource(@ApiParam("资源ID") @RequestParam String resourceId, HttpServletResponse response) { resourceCenterService.downloadResource(resourceId, response); } @@ -76,6 +78,7 @@ public class TeaResourceCenterController { //查看资源文件 @GetMapping("/getResource") @ApiOperation("查看资源文件") + @AnonymousAccess public ResponseEntity streamVideo(@RequestParam String resourceId, HttpServletResponse response) { TeaResourceCenter resourceCenter = resourceCenterMapper.selectByPrimaryKey(resourceId); String url = resourceCenter.getResourceUrl(); diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestion.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestion.java index 0d180ac..e99e860 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestion.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestion.java @@ -25,10 +25,10 @@ public class SysObjectiveQuestion { @ApiModelProperty("章节名称") private String chapterName; - @ApiModelProperty("内置,新增") + @ApiModelProperty("内置,新增 0为老师导入 1为内置") private String inputType; - @ApiModelProperty("题目类型") + @ApiModelProperty("题目类型 0单选 1多选 2判断") private String type; @ApiModelProperty("分数") @@ -56,7 +56,7 @@ public class SysObjectiveQuestion { private String answer; @ApiModelProperty("答案解析") - private String analyze; + private String analysis; @ApiModelProperty("学校Id") private String schoolId; @@ -181,12 +181,12 @@ public class SysObjectiveQuestion { this.answer = answer == null ? null : answer.trim(); } - public String getAnalyze() { - return analyze; + public String getAnalysis() { + return analysis; } - public void setAnalyze(String analyze) { - this.analyze = analyze == null ? null : analyze.trim(); + public void setAnalysis(String analysis) { + this.analysis = analysis == null ? null : analysis.trim(); } public String getSchoolId() { diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestionExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestionExample.java index 42c77f2..e6f95e7 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestionExample.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysObjectiveQuestionExample.java @@ -1145,73 +1145,73 @@ public class SysObjectiveQuestionExample { return (Criteria) this; } - public Criteria andAnalyzeIsNull() { - addCriterion("analyze is null"); + public Criteria andAnalysisIsNull() { + addCriterion("analysis is null"); return (Criteria) this; } - public Criteria andAnalyzeIsNotNull() { - addCriterion("analyze is not null"); + public Criteria andAnalysisIsNotNull() { + addCriterion("analysis is not null"); return (Criteria) this; } - public Criteria andAnalyzeEqualTo(String value) { - addCriterion("analyze =", value, "analyze"); + public Criteria andAnalysisEqualTo(String value) { + addCriterion("analysis =", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeNotEqualTo(String value) { - addCriterion("analyze <>", value, "analyze"); + public Criteria andAnalysisNotEqualTo(String value) { + addCriterion("analysis <>", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeGreaterThan(String value) { - addCriterion("analyze >", value, "analyze"); + public Criteria andAnalysisGreaterThan(String value) { + addCriterion("analysis >", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeGreaterThanOrEqualTo(String value) { - addCriterion("analyze >=", value, "analyze"); + public Criteria andAnalysisGreaterThanOrEqualTo(String value) { + addCriterion("analysis >=", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeLessThan(String value) { - addCriterion("analyze <", value, "analyze"); + public Criteria andAnalysisLessThan(String value) { + addCriterion("analysis <", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeLessThanOrEqualTo(String value) { - addCriterion("analyze <=", value, "analyze"); + public Criteria andAnalysisLessThanOrEqualTo(String value) { + addCriterion("analysis <=", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeLike(String value) { - addCriterion("analyze like", value, "analyze"); + public Criteria andAnalysisLike(String value) { + addCriterion("analysis like", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeNotLike(String value) { - addCriterion("analyze not like", value, "analyze"); + public Criteria andAnalysisNotLike(String value) { + addCriterion("analysis not like", value, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeIn(List values) { - addCriterion("analyze in", values, "analyze"); + public Criteria andAnalysisIn(List values) { + addCriterion("analysis in", values, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeNotIn(List values) { - addCriterion("analyze not in", values, "analyze"); + public Criteria andAnalysisNotIn(List values) { + addCriterion("analysis not in", values, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeBetween(String value1, String value2) { - addCriterion("analyze between", value1, value2, "analyze"); + public Criteria andAnalysisBetween(String value1, String value2) { + addCriterion("analysis between", value1, value2, "analysis"); return (Criteria) this; } - public Criteria andAnalyzeNotBetween(String value1, String value2) { - addCriterion("analyze not between", value1, value2, "analyze"); + public Criteria andAnalysisNotBetween(String value1, String value2) { + addCriterion("analysis not between", value1, value2, "analysis"); return (Criteria) this; } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java index 026a525..d24ba93 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java @@ -11,8 +11,8 @@ public class TeaResourceCenter { @ApiModelProperty("资源ID") private String resourceId; - @ApiModelProperty("章节ID") - private String chapterId; + @ApiModelProperty("课程ID") + private String courseId; @ApiModelProperty("资源地址") private String resourceUrl; @@ -37,12 +37,12 @@ public class TeaResourceCenter { this.resourceId = resourceId == null ? null : resourceId.trim(); } - public String getChapterId() { - return chapterId; + public String getCourseId() { + return courseId; } - public void setChapterId(String chapterId) { - this.chapterId = chapterId == null ? null : chapterId.trim(); + public void setCourseId(String courseId) { + this.courseId = courseId == null ? null : courseId.trim(); } public String getResourceUrl() { diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java index 2e1f1c5..70eae0a 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java @@ -174,73 +174,73 @@ public class TeaResourceCenterExample { return (Criteria) this; } - public Criteria andChapterIdIsNull() { - addCriterion("chapter_id is null"); + public Criteria andCourseIdIsNull() { + addCriterion("course_id is null"); return (Criteria) this; } - public Criteria andChapterIdIsNotNull() { - addCriterion("chapter_id is not null"); + public Criteria andCourseIdIsNotNull() { + addCriterion("course_id is not null"); return (Criteria) this; } - public Criteria andChapterIdEqualTo(String value) { - addCriterion("chapter_id =", value, "chapterId"); + public Criteria andCourseIdEqualTo(String value) { + addCriterion("course_id =", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdNotEqualTo(String value) { - addCriterion("chapter_id <>", value, "chapterId"); + public Criteria andCourseIdNotEqualTo(String value) { + addCriterion("course_id <>", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdGreaterThan(String value) { - addCriterion("chapter_id >", value, "chapterId"); + public Criteria andCourseIdGreaterThan(String value) { + addCriterion("course_id >", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdGreaterThanOrEqualTo(String value) { - addCriterion("chapter_id >=", value, "chapterId"); + public Criteria andCourseIdGreaterThanOrEqualTo(String value) { + addCriterion("course_id >=", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdLessThan(String value) { - addCriterion("chapter_id <", value, "chapterId"); + public Criteria andCourseIdLessThan(String value) { + addCriterion("course_id <", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdLessThanOrEqualTo(String value) { - addCriterion("chapter_id <=", value, "chapterId"); + public Criteria andCourseIdLessThanOrEqualTo(String value) { + addCriterion("course_id <=", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdLike(String value) { - addCriterion("chapter_id like", value, "chapterId"); + public Criteria andCourseIdLike(String value) { + addCriterion("course_id like", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdNotLike(String value) { - addCriterion("chapter_id not like", value, "chapterId"); + public Criteria andCourseIdNotLike(String value) { + addCriterion("course_id not like", value, "courseId"); return (Criteria) this; } - public Criteria andChapterIdIn(List values) { - addCriterion("chapter_id in", values, "chapterId"); + public Criteria andCourseIdIn(List values) { + addCriterion("course_id in", values, "courseId"); return (Criteria) this; } - public Criteria andChapterIdNotIn(List values) { - addCriterion("chapter_id not in", values, "chapterId"); + public Criteria andCourseIdNotIn(List values) { + addCriterion("course_id not in", values, "courseId"); return (Criteria) this; } - public Criteria andChapterIdBetween(String value1, String value2) { - addCriterion("chapter_id between", value1, value2, "chapterId"); + public Criteria andCourseIdBetween(String value1, String value2) { + addCriterion("course_id between", value1, value2, "courseId"); return (Criteria) this; } - public Criteria andChapterIdNotBetween(String value1, String value2) { - addCriterion("chapter_id not between", value1, value2, "chapterId"); + public Criteria andCourseIdNotBetween(String value1, String value2) { + addCriterion("course_id not between", value1, value2, "courseId"); return (Criteria) this; } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryExamDetailDto.java b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryExamDetailDto.java new file mode 100644 index 0000000..8ece1bb --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryExamDetailDto.java @@ -0,0 +1,23 @@ +package com.sztzjy.financial_bigdata.entity.stu_dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class StuTheoryExamDetailDto { + @ApiModelProperty("序号") + private String num; + + @ApiModelProperty("题干") + private String content; + @ApiModelProperty("答案") + private String answer; + @ApiModelProperty("我的选项") + private String mychoice; + @ApiModelProperty("状态") + private String status; + @ApiModelProperty("得分") + private String score; +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/sys_dto/SysObjectiveQuestionDto.java b/src/main/java/com/sztzjy/financial_bigdata/entity/sys_dto/SysObjectiveQuestionDto.java index 6c208e6..c146ceb 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/sys_dto/SysObjectiveQuestionDto.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/sys_dto/SysObjectiveQuestionDto.java @@ -62,7 +62,7 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{ private String answer; @ApiModelProperty("答案解析") - private String analyze; + private String analysis; @ApiModelProperty("学校Id") private String schoolId; @@ -199,12 +199,12 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{ this.answer = answer; } - public String getAnalyze() { - return analyze; + public String getAnalysis() { + return analysis; } - public void setAnalyze(String analyze) { - this.analyze = analyze; + public void setAnalysis(String analysis) { + this.analysis = analysis; } public String getSchoolId() { @@ -233,7 +233,7 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{ this.questionD =sysObjectiveQuestion.getQuestionD(); this.questionE =sysObjectiveQuestion.getQuestionE(); this.answer =sysObjectiveQuestion.getAnswer(); - this.analyze =sysObjectiveQuestion.getAnalyze(); + this.analysis =sysObjectiveQuestion.getAnalysis(); this.schoolId =sysObjectiveQuestion.getSchoolId(); } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/stu/ITheoryTestService.java b/src/main/java/com/sztzjy/financial_bigdata/service/stu/ITheoryTestService.java index d913ef5..8287245 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/stu/ITheoryTestService.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/stu/ITheoryTestService.java @@ -1,6 +1,9 @@ package com.sztzjy.financial_bigdata.service.stu; +import com.github.pagehelper.PageInfo; +import com.sztzjy.financial_bigdata.entity.StuTheoryExam; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; +import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto; import java.util.List; @@ -11,4 +14,10 @@ public interface ITheoryTestService { int endTheoryTest(StuTheoryTestDto theoryTestDto); List selectErrors(String userId); + + Boolean removeError(String userId, String objectiveQuestionId, String type); + + PageInfo getTheoryTestList(String userId, Integer index, Integer size); + + List getTheoryTestDetail(String theoryExamId, Integer index, Integer size); } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/ExerciseServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/ExerciseServiceImpl.java index 7ffd57d..c74de0a 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/ExerciseServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/ExerciseServiceImpl.java @@ -13,10 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; +import java.util.*; @Service public class ExerciseServiceImpl implements IExerciseService { @@ -69,8 +66,8 @@ public class ExerciseServiceImpl implements IExerciseService { trainingMapper.updateByPrimaryKey(bloBs); return dtos; }else { - if(bloBs.getLearningEvalAnswer().isEmpty()){ //判断是否提交过 未提交 - List learningEvalIdlist = Collections.singletonList(bloBs.getLearningEvalIdlist()); + if(bloBs.getLearningEvalAnswer()==null){ //判断是否提交过 未提交 + List learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", ")); for (int i = 0; i < learningEvalIdlist.size(); i++) { String objectiveId = learningEvalIdlist.get(i); SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveId); @@ -79,8 +76,8 @@ public class ExerciseServiceImpl implements IExerciseService { } return dtos; }else { //提交 - List learningEvalAnswerList = Collections.singletonList(bloBs.getLearningEvalAnswer()); - List learningEvalIdlist = Collections.singletonList(bloBs.getLearningEvalIdlist()); + List learningEvalAnswerList = Arrays.asList(bloBs.getLearningEvalAnswer().substring(1, bloBs.getLearningEvalAnswer().length() - 1).split(", ")); + List learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", ")); for (int i = 0; i < learningEvalIdlist.size(); i++) { String objectiveId = learningEvalIdlist.get(i); String stuAnswer = learningEvalAnswerList.get(i); @@ -102,7 +99,7 @@ public class ExerciseServiceImpl implements IExerciseService { example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId); List stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example); - if (!stuTrainingWithBLOBs.get(0).getLearningEvalAnswer().isEmpty()){ + if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){ return false; } List stuAnswerList = new ArrayList<>(); @@ -129,7 +126,7 @@ public class ExerciseServiceImpl implements IExerciseService { progress=progress.add(BigDecimal.valueOf(1)); } bloBs.setProgress(progress); - int i = trainingMapper.updateByPrimaryKey(bloBs); + int i = trainingMapper.updateByPrimaryKeyWithBLOBs(bloBs); return i==1; } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java index 4249d74..a2a7a16 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java @@ -5,15 +5,15 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.entity.*; +import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto; -import com.sztzjy.financial_bigdata.mapper.StuErrorMapper; -import com.sztzjy.financial_bigdata.mapper.StuTheoryExamMapper; -import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper; +import com.sztzjy.financial_bigdata.mapper.*; import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService; import com.sztzjy.financial_bigdata.util.PageUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.*; @Service @@ -24,10 +24,15 @@ public class TheoryTestServiceImpl implements ITheoryTestService { SysObjectiveQuestionMapper objectiveQuestionMapper; @Autowired StuErrorMapper errorMapper; + @Autowired + StuUserMapper userMapper; + @Autowired + StuTheoryRecordMapper theoryRecordMapper; //开始考试 1 先查询考试时间最近的一堂考试 判断是否超过2小时 如果没超过 根据理论考试表中的题目ID和答案进行回显 // 如果超过了两小时 定时方法算分将数据保存到理论考试表和理论记录表中 如果根据userid查询理论记录表中数据未null 则需要创建 // 之前没有进行考试 从客观题库表中查询 35道单选,每题2分,5道多选每题4分,10道判断每题1分 并将id保存至理论考试表中 + // 注意 开始考试后 要生成理论记录表基础数据 @Override public List startTheoryTest(String userId) { StuTheoryExamExample example = new StuTheoryExamExample(); @@ -36,6 +41,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService { List stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example); if (stuTheoryExams.isEmpty()) { //之前没有进行考试 List objectiveQuestionList = GenerateTest(userId); + GenerateTheoryRecordFirst(userId); return objectiveQuestionList; } else { //根据考试时间排序 查询最近的一条 StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); @@ -45,21 +51,21 @@ public class TheoryTestServiceImpl implements ITheoryTestService { List objectiveQuestionList = GenerateTest(userId); return objectiveQuestionList; } else { //在两个小时内 返回最近的一条试卷 - List returnQuestionList=new ArrayList(); + List returnQuestionList = new ArrayList(); String singleIds = stuTheoryExam.getSingleIds(); String multipleIds = stuTheoryExam.getMultipleIds(); String judgeIds = stuTheoryExam.getJudgeIds(); - List singleIdList = Arrays.asList(singleIds); + List singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", ")); for (int i = 0; i < singleIdList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i)); returnQuestionList.add(objectiveQuestion); } - List multipleIdList = Arrays.asList(multipleIds); + List multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", ")); for (int i = 0; i < multipleIdList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(multipleIdList.get(i)); returnQuestionList.add(objectiveQuestion); } - List judgeIdList = Arrays.asList(judgeIds); + List judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", ")); for (int i = 0; i < judgeIdList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(judgeIdList.get(i)); returnQuestionList.add(objectiveQuestion); @@ -69,6 +75,54 @@ public class TheoryTestServiceImpl implements ITheoryTestService { } } + //第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据 + public void GenerateTheoryRecordFirst(String userId){ + StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId); + if(record==null){ + StuUser stuUser = userMapper.selectByPrimaryKey(userId); + StuTheoryRecord stuTheoryRecord = new StuTheoryRecord(); + stuTheoryRecord.setUserId(userId); + stuTheoryRecord.setSchoolId(stuUser.getSchoolId()); + stuTheoryRecord.setClassId(stuUser.getClassId()); + stuTheoryRecord.setName(stuUser.getName()); + stuTheoryRecord.setStudentId(stuUser.getStudentId()); + stuTheoryRecord.setExamCount(0); + } + } + + public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){ + StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId); + if(record!=null){ + record.setExamCount(record.getExamCount()+1); + if(record.getHighestScore()==null){ + record.setHighestScore(score); + }else { + if(record.getHighestScore().compareTo(score)<0){ + record.setHighestScore(score); + } + } + if(record.getLowestScore()==null){ + record.setLowestScore(score); + }else { + if(record.getLowestScore().compareTo(score)>0){ + record.setLowestScore(score); + } + } + if(record.getTotalDuration()==null){ + record.setTotalDuration(examDuration); + }else { + record.setTotalDuration(examDuration+record.getTotalDuration()); + } + if(record.getAverageScore()==null){ + record.setAverageScore(score); + }else { + Integer examCount = record.getExamCount(); + BigDecimal averageScore = record.getAverageScore(); + BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount)); + multiply.add(score).divide(BigDecimal.valueOf(examCount).add(BigDecimal.valueOf(1))).setScale(2,BigDecimal.ROUND_HALF_UP); + } + } + } //随机生成100分题目 @@ -102,13 +156,14 @@ public class TheoryTestServiceImpl implements ITheoryTestService { } + //交卷后 更新理论考试记录数据 @Override public int endTheoryTest(StuTheoryTestDto theoryTestDto) { StuTheoryExamExample example = new StuTheoryExamExample(); example.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId()); example.setOrderByClause("exam_time DESC"); List stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example); - StuTheoryExamWithBLOBs stuTheoryExam= stuTheoryExams.get(0); + StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); stuTheoryExam.setExamDuration(theoryTestDto.getExamDuration()); stuTheoryExam.setScore(theoryTestDto.getScore()); stuTheoryExam.setAccuracy(theoryTestDto.getAccuracy()); @@ -124,7 +179,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService { StuErrorExample errorExample = new StuErrorExample(); errorExample.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId()); List stuErrors = errorMapper.selectByExampleWithBLOBs(errorExample); - if(stuErrors.isEmpty()){ + if (stuErrors.isEmpty()) { StuErrorWithBLOBs stuError = new StuErrorWithBLOBs(); stuError.setErrorId(String.valueOf(UUID.randomUUID())); stuError.setUserId(theoryTestDto.getUserId()); @@ -132,10 +187,10 @@ public class TheoryTestServiceImpl implements ITheoryTestService { stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds())); stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds())); errorMapper.insert(stuError); - }else { + } else { StuErrorWithBLOBs stuError = stuErrors.get(0); - if(!stuError.getSingleIds().isEmpty()){ - List stringList = Arrays.asList(stuError.getSingleIds()); + if (!stuError.getSingleIds().isEmpty()) { + List stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", ")); List singleErrorIds = theoryTestDto.getSingleErrorIds(); List combinedList = new ArrayList<>(stringList); @@ -143,11 +198,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService { Set uniqueSet = new HashSet<>(combinedList); List uniqueList = new ArrayList<>(uniqueSet); stuError.setSingleIds(String.valueOf(uniqueList)); - }else { + } else { stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds())); } - if(!stuError.getMultipleIds().isEmpty()){ - List stringList = Arrays.asList(stuError.getMultipleIds()); + if (!stuError.getMultipleIds().isEmpty()) { + List stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", ")); List multipleErrorIds = theoryTestDto.getMultipleErrorIds(); List combinedList = new ArrayList<>(stringList); @@ -155,22 +210,23 @@ public class TheoryTestServiceImpl implements ITheoryTestService { Set uniqueSet = new HashSet<>(combinedList); List uniqueList = new ArrayList<>(uniqueSet); stuError.setMultipleIds(String.valueOf(uniqueList)); - }else { + } else { stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds())); } - if(!stuError.getJudgeIds().isEmpty()){ - List stringList = Arrays.asList(stuError.getJudgeIds()); + if (!stuError.getJudgeIds().isEmpty()) { + List stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", ")); List judgeErrorIds = theoryTestDto.getJudgeErrorIds(); List combinedList = new ArrayList<>(stringList); combinedList.addAll(judgeErrorIds); Set uniqueSet = new HashSet<>(combinedList); List uniqueList = new ArrayList<>(uniqueSet); stuError.setJudgeIds(String.valueOf(uniqueList)); - }else { + } else { stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds())); } errorMapper.updateByPrimaryKey(stuError); } + UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration()); return i; } @@ -179,30 +235,30 @@ public class TheoryTestServiceImpl implements ITheoryTestService { StuErrorExample example = new StuErrorExample(); example.createCriteria().andUserIdEqualTo(userId); List stuErrors = errorMapper.selectByExampleWithBLOBs(example); - if(stuErrors.isEmpty()){ + if (stuErrors.isEmpty()) { return null; - }else { - List objectiveQuestionList=new ArrayList<>(); + } else { + List objectiveQuestionList = new ArrayList<>(); StuErrorWithBLOBs stuError = stuErrors.get(0); String singleIds = stuError.getSingleIds(); - if(!singleIds.isEmpty()){ - List singleIdList = Arrays.asList(singleIds); + if (!singleIds.isEmpty()) { + List singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", ")); for (int i = 0; i < singleIdList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i)); objectiveQuestionList.add(objectiveQuestion); } } String multipleIds = stuError.getMultipleIds(); - if(!multipleIds.isEmpty()){ - List stringList = Arrays.asList(multipleIds); + if (!multipleIds.isEmpty()) { + List stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", ")); for (int i = 0; i < stringList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i)); objectiveQuestionList.add(objectiveQuestion); } } String judgeIds = stuError.getJudgeIds(); - if(!judgeIds.isEmpty()){ - List stringList = Arrays.asList(judgeIds); + if (!judgeIds.isEmpty()) { + List stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", ")); for (int i = 0; i < stringList.size(); i++) { SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i)); objectiveQuestionList.add(objectiveQuestion); @@ -211,4 +267,106 @@ public class TheoryTestServiceImpl implements ITheoryTestService { return objectiveQuestionList; } } + + @Override + public Boolean removeError(String userId, String objectiveQuestionId, String type) { + StuErrorExample stuErrorExample = new StuErrorExample(); + stuErrorExample.createCriteria().andUserIdEqualTo(userId); + List stuErrors = errorMapper.selectByExampleWithBLOBs(stuErrorExample); + if (stuErrors.isEmpty()) { + return false; + } + StuErrorWithBLOBs error = stuErrors.get(0); + if (Constant.OBJECTIVE_TYPE_SINGLE.equals(type)) { + List stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", ")); + Set set = new LinkedHashSet<>(stringList); + set.remove(objectiveQuestionId); + if(set.isEmpty()){ + error.setSingleIds(null); + }else { + List list = new ArrayList<>(set); + error.setSingleIds(String.valueOf(list)); + } + } + if (Constant.OBJECTIVE_TYPE_Many.equals(type)) { + Set set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", "))); + set.remove(objectiveQuestionId); + if(set.isEmpty()){ + error.setMultipleIds(null); + }else { + List list = new ArrayList<>(set); + error.setMultipleIds(String.valueOf(list)); + } + } + if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){ + Set set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", "))); + set.remove(objectiveQuestionId); + if(set.isEmpty()){ + error.setJudgeIds(null); + }else { + List list = new ArrayList<>(set); + error.setJudgeIds(String.valueOf(list)); + } + } + int i = errorMapper.updateByPrimaryKeyWithBLOBs(error); + return i==1; + } + + @Override + public PageInfo getTheoryTestList(String userId, Integer index, Integer size) { + PageHelper.startPage(index, size); + StuTheoryExamExample example = new StuTheoryExamExample(); + example.createCriteria().andUserIdEqualTo(userId); + List stuTheoryExams = theoryExamMapper.selectByExample(example); + PageInfo pageInfo = new PageInfo<>(stuTheoryExams); + return pageInfo; + } + + @Override + public List getTheoryTestDetail(String theoryExamId, Integer index, Integer size) { + StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId); + String singleIds = theoryExam.getSingleIds(); + ArrayList idsList = new ArrayList<>(); + List singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", ")); + String multipleIds = theoryExam.getMultipleIds(); + List multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", ")); + String judgeIds = theoryExam.getJudgeIds(); + List judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", ")); + idsList.addAll(singleIdList); + idsList.addAll(multipleIdList); + idsList.addAll(judgeIdList); + ArrayList answerList = new ArrayList<>(); + List singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(", ")); + List multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(", ")); + List judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(", ")); + answerList.addAll(singleStuAnswer); + answerList.addAll(multipleStuAnswer); + answerList.addAll(judgeStuAnswer); + List detailDtos=new ArrayList<>(); + for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) { + StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto(); + String objectiveQuestionId = idsList.get(i); + String stuAnswer = answerList.get(i); + SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveQuestionId); + BigDecimal score = objectiveQuestion.getScore(); + String content = objectiveQuestion.getContent(); + String answer = objectiveQuestion.getAnswer(); + if(answer.equals(stuAnswer)){ + detailDto.setScore(String.valueOf(score)); + detailDto.setStatus("正确"); + }else { + detailDto.setScore("0"); + detailDto.setStatus("错误"); + } + detailDto.setContent(content); + detailDto.setMychoice(stuAnswer); + detailDto.setAnswer(answer); + detailDtos.add(detailDto); + } + + + return detailDtos; + } + + } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java index 200aea8..2478bc2 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java @@ -7,8 +7,8 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; public interface ITeaResourceCenterService { - Boolean uploadResource(MultipartFile file, String schoolId,String chapterId,String type); + Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type); - List selectResource(String schoolId, String chapterId); + List selectResource(String schoolId, String courseId); void downloadResource(String resourceId, HttpServletResponse response); } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java index e1d22a5..1dc607a 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java @@ -71,11 +71,11 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { SysObjectiveQuestionExample.Criteria criteria2 = example.createCriteria(); criteria.andSchoolIdEqualTo(schoolId).andCourseIdEqualTo(courseId); criteria2.andSchoolIdEqualTo(Constant.BUILT_IN_SCHOOL_ID).andCourseIdEqualTo(courseId); - if(!type.isEmpty()){ + if(type!=null){ criteria.andTypeEqualTo(type); criteria2.andTypeEqualTo(type); } - if(!content.isEmpty()){ + if(content!=null){ criteria.andContentLike(content); criteria2.andContentLike(content); } @@ -142,7 +142,7 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { obj.setQuestionC(question_c); obj.setQuestionD(question_d); obj.setAnswer(answer); - obj.setAnalyze(analyze); + obj.setAnalysis(analyze); obj.setSchoolId(schoolId); objectiveQuestionList.add(obj); } @@ -187,7 +187,7 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { obj.setQuestionC(question_c); obj.setQuestionD(question_d); obj.setAnswer(answer); - obj.setAnalyze(analyze); + obj.setAnalysis(analyze); obj.setSchoolId(schoolId); objectiveQuestionList.add(obj); } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java index e39ae00..ae6c5e8 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java @@ -20,13 +20,13 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService { @Autowired TeaResourceCenterMapper resourceCenterMapper; @Override - public Boolean uploadResource(MultipartFile file, String schoolId,String chapterId,String type) { + public Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type) { String uploadUrl = fileUtil.upload(file); TeaResourceCenter resourceCenter=new TeaResourceCenter(); resourceCenter.setResourceId(String.valueOf(UUID.randomUUID())); resourceCenter.setResourceName(file.getOriginalFilename()); resourceCenter.setResourceUrl(uploadUrl); - resourceCenter.setChapterId(chapterId); + resourceCenter.setCourseId(courseId); resourceCenter.setSchoolId(schoolId); resourceCenter.setType(type); resourceCenter.setImageUrl(null); @@ -39,12 +39,12 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService { } @Override - public List selectResource(String schoolId, String chapterId) { + public List selectResource(String schoolId, String courseId) { TeaResourceCenterExample example=new TeaResourceCenterExample(); TeaResourceCenterExample.Criteria criteria = example.createCriteria(); TeaResourceCenterExample.Criteria criteria2 = example.createCriteria(); - criteria.andChapterIdEqualTo(chapterId).andSchoolIdEqualTo(schoolId); - criteria2.andChapterIdEqualTo(chapterId).andSchoolIdIsNull(); + criteria.andCourseIdEqualTo(courseId).andSchoolIdEqualTo(schoolId); + criteria2.andCourseIdEqualTo(courseId).andSchoolIdIsNull(); example.or(criteria2); List teaResourceCenterList = resourceCenterMapper.selectByExample(example); return teaResourceCenterList; diff --git a/src/main/resources/mapper/SysCourseMapper.xml b/src/main/resources/mapper/SysCourseMapper.xml index 45ada86..b261ce9 100644 --- a/src/main/resources/mapper/SysCourseMapper.xml +++ b/src/main/resources/mapper/SysCourseMapper.xml @@ -208,4 +208,17 @@ input_type = #{inputType,jdbcType=VARCHAR} where course_id = #{courseId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/SysObjectiveQuestionMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionMapper.xml index 328ad88..88dbf1a 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionMapper.xml @@ -17,7 +17,7 @@ - + @@ -81,7 +81,7 @@ objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type, score, content, question_a, question_b, question_c, question_d, question_e, answer, - analyze, school_id + analysis, school_id - SELECT * FROM sys_objective_question - WHERE chapter_id #{chapterId,jdbcType=VARCHAR} + SELECT + objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type, + score, content, question_a, question_b, question_c, question_d, question_e, answer, school_id + FROM sys_objective_question + WHERE chapter_id = #{chapterId,jdbcType=VARCHAR} ORDER BY RAND() LIMIT 10 diff --git a/src/main/resources/mapper/TeaResourceCenterMapper.xml b/src/main/resources/mapper/TeaResourceCenterMapper.xml index 146a3fa..81280aa 100644 --- a/src/main/resources/mapper/TeaResourceCenterMapper.xml +++ b/src/main/resources/mapper/TeaResourceCenterMapper.xml @@ -3,7 +3,7 @@ - + @@ -69,7 +69,7 @@ - resource_id, chapter_id, resource_url, image_url, resource_name, school_id, type + resource_id, course_id, resource_url, image_url, resource_name, school_id, type