mingfu 1 неделя назад
Родитель
Сommit
1578b5fe0d

+ 1 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontPaperController.java

@@ -138,6 +138,7 @@ public class FrontPaperController {
         String subjectKey = NumberUtils.isPositive(learnPaper.getSubjectId()) ? String.valueOf(sysUser.getExamMajor()) : "0";
         String subjectKey = NumberUtils.isPositive(learnPaper.getSubjectId()) ? String.valueOf(sysUser.getExamMajor()) : "0";
         learnPaper.setLocations(sysUser.getLocation());
         learnPaper.setLocations(sysUser.getLocation());
         learnPaper.setDirectKey(sysUser.getExamType().name() + "_" + subjectKey);
         learnPaper.setDirectKey(sysUser.getExamType().name() + "_" + subjectKey);
+        learnPaper.setSubjectId(null);
         List<LearnPaper> list = learnPaperService.selectLearnPaperList(learnPaper);
         List<LearnPaper> list = learnPaperService.selectLearnPaperList(learnPaper);
         return list;
         return list;
     }
     }

+ 4 - 4
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontStudentController.java

@@ -384,17 +384,17 @@ public class FrontStudentController extends BaseController {
 
 
     @ApiOperation("练习列表")
     @ApiOperation("练习列表")
     @GetMapping("record/practice")
     @GetMapping("record/practice")
-    public TableDataInfo practice()
+    public TableDataInfo practice(@ApiParam @RequestParam(defaultValue = "0") Integer questionType)
     {
     {
         startPage();
         startPage();
-        return getDataTable(learnStatService.selectStudentPractices(SecurityUtils.getUserId(), PaperType.Practice));
+        return getDataTable(learnStatService.selectStudentPractices(SecurityUtils.getUserId(), PaperType.Practice, questionType));
     }
     }
 
 
     @ApiOperation("同步练习列表")
     @ApiOperation("同步练习列表")
     @GetMapping("record/coursePractice")
     @GetMapping("record/coursePractice")
-    public TableDataInfo coursePractice()
+    public TableDataInfo coursePractice(@ApiParam @RequestParam(defaultValue = "0") Integer questionType)
     {
     {
-        return getDataTable(learnStatService.selectStudentPractices(SecurityUtils.getUserId(), PaperType.Course));
+        return getDataTable(learnStatService.selectStudentPractices(SecurityUtils.getUserId(), PaperType.Course, questionType));
     }
     }
 
 
     @ApiOperation("56 记录-视频学习")
     @ApiOperation("56 记录-视频学习")

+ 4 - 1
ie-admin/src/main/java/com/ruoyi/web/service/ExamService.java

@@ -564,7 +564,10 @@ public class ExamService {
             up.setStatus(PaperStatus.Valid.getVal());
             up.setStatus(PaperStatus.Valid.getVal());
             paperMapper.updateLearnPaper(up);
             paperMapper.updateLearnPaper(up);
         }
         }
-        List<LearnPaperQuestion> pqList = paperService.getQuestionsByRandom(studentId,  15, useKnowledgeIds, Arrays.stream(QuestionType.values()).map(QuestionType::getTitle).collect(Collectors.toList()), 0);
+        List<String> types = questionType.equals(0)
+                ? Arrays.stream(QuestionType.values()).map(QuestionType::getTitle).collect(Collectors.toList())
+                : Lists.newArrayList(QuestionType.Single.getTitle(), QuestionType.Judgment.getTitle());
+        List<LearnPaperQuestion> pqList = paperService.getQuestionsByRandom(studentId,  15, useKnowledgeIds, types, 0);
         if(CollectionUtils.isEmpty(pqList)) {
         if(CollectionUtils.isEmpty(pqList)) {
             throw new RuntimeException("本知识点题已做完");
             throw new RuntimeException("本知识点题已做完");
         }
         }

+ 2 - 2
ie-admin/src/main/java/com/ruoyi/web/service/LearnStatService.java

@@ -36,8 +36,8 @@ public class LearnStatService {
         this.learnStudentService = learnStudentService;
         this.learnStudentService = learnStudentService;
         this.learnTeacherService = learnTeacherService1;
         this.learnTeacherService = learnTeacherService1;
     }
     }
-    public List<JSONObject> selectStudentPractices(Long studentId, PaperType paperType) {
-        return examineeMapper.selectStudentPractices(studentId, paperType.getVal());
+    public List<JSONObject> selectStudentPractices(Long studentId, PaperType paperType, Integer questionType) {
+        return examineeMapper.selectStudentPractices(studentId, paperType.getVal(), questionType);
     }
     }
 
 
 
 

+ 1 - 1
ie-admin/src/main/java/com/ruoyi/web/service/PaperService.java

@@ -557,7 +557,7 @@ public class PaperService {
     }
     }
 
 
     public List<LearnPaperQuestion> getQuestionsByRandom(Long studentId, Integer total, Collection<Long> knowledgeIds, List<String> types, Integer questionType) {
     public List<LearnPaperQuestion> getQuestionsByRandom(Long studentId, Integer total, Collection<Long> knowledgeIds, List<String> types, Integer questionType) {
-        Map<String, KnowTypeAssign> knowTypeAssignMap = buildKnowTypeAssignMap(studentId, "2", null, types, knowledgeIds, true, 0);
+        Map<String, KnowTypeAssign> knowTypeAssignMap = buildKnowTypeAssignMap(studentId, "2", null, types, knowledgeIds, true, questionType);
         List<KnowTypeAssign> knowTypeAssignList = Lists.newArrayList(knowTypeAssignMap.values());
         List<KnowTypeAssign> knowTypeAssignList = Lists.newArrayList(knowTypeAssignMap.values());
         List<LearnPaperQuestion> pqList = Lists.newArrayList();
         List<LearnPaperQuestion> pqList = Lists.newArrayList();
         Set<String> existQuestionSet = Sets.newHashSet();
         Set<String> existQuestionSet = Sets.newHashSet();

+ 1 - 1
ie-system/src/main/java/com/ruoyi/learn/mapper/LearnExamineeMapper.java

@@ -24,7 +24,7 @@ public interface LearnExamineeMapper
     public List<JSONObject> selectSimulatedStuSubjectStats(@Param("studentId") Long studentId);
     public List<JSONObject> selectSimulatedStuSubjectStats(@Param("studentId") Long studentId);
 
 
     public List<JSONObject> selectExamRankingStats(@Param("paperType") Integer paperType, @Param("stuScore") Integer stuScore, @Param("paperIds") Collection<Long> paperIds);
     public List<JSONObject> selectExamRankingStats(@Param("paperType") Integer paperType, @Param("stuScore") Integer stuScore, @Param("paperIds") Collection<Long> paperIds);
-    public List<JSONObject> selectStudentPractices(@Param("studentId") Long studentId, @Param("paperType") Integer paperType);
+    public List<JSONObject> selectStudentPractices(@Param("studentId") Long studentId, @Param("paperType") Integer paperType, @Param("questionType") Integer questionType);
 
 
     /**
     /**
      * 查询答卷
      * 查询答卷

+ 2 - 1
ie-system/src/main/resources/mapper/learn/LearnExamineeMapper.xml

@@ -115,10 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <select id="selectStudentPractices" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectStudentPractices" resultType="com.alibaba.fastjson2.JSONObject">
-        SELECT e.`examinee_id` examineeId, e.`end_time` endTime, SUBSTRING_INDEX(SUBSTRING_INDEX(p.`paperName`, '-', 2), '-', -1) paperName, LENGTH(SUBSTRING_INDEX(SUBSTRING_INDEX(p.`direct_key`, '_', 2), '_', -1)) > 0 AS directed
+        SELECT e.`examinee_id` examineeId, e.`end_time` endTime, SUBSTRING_INDEX(SUBSTRING_INDEX(p.`paperName`, '-', 2), '-', -1) paperName, LENGTH(SUBSTRING_INDEX(SUBSTRING_INDEX(p.`direct_key`, '_', 2), '_', -1)) > 0 AS directed, SUBSTRING_INDEX(p.`direct_key`, '_', -1) as questionType
           FROM `learn_examinee` e
           FROM `learn_examinee` e
           JOIN `learn_paper` p ON e.`paper_id` = p.`id`
           JOIN `learn_paper` p ON e.`paper_id` = p.`id`
          WHERE e.student_id = #{studentId} and e.`paper_type` = #{paperType} AND e.`state` &gt;= 4
          WHERE e.student_id = #{studentId} and e.`paper_type` = #{paperType} AND e.`state` &gt;= 4
+         and SUBSTRING_INDEX(p.`direct_key`, '_', -1) = #{questionType}
         ORDER BY e.`end_time` DESC
         ORDER BY e.`end_time` DESC
     </select>
     </select>