Sfoglia il codice sorgente

知识点学生统计增加天数

mingfu 4 settimane fa
parent
commit
804e83d0d9

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

@@ -72,7 +72,7 @@ public class LearnStatService {
         JSONObject result = new JSONObject();
         Map cond = Dict.create().set("classId", classId);
         JSONObject header = answerMapper.selectClassKnowledgeHeader(cond);
-        result.put("rate", header.getIntValue("rate"));
+        result.put("rate", null == header ? 0 : header.getIntValue("rate"));
         List<JSONObject> list = answerMapper.selectClassKnowledgeDetail(cond);
         AtomicInteger index = new AtomicInteger(1);
         list.forEach(s -> {

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

@@ -949,7 +949,7 @@ public class PaperService {
             }
         }
         if(CollectionUtils.isEmpty(pqList)) {
-            throw new RuntimeException("题数不足");
+            throw new RuntimeException("题数不足2");
         }
         reSort(pqList);
         return pqList;
@@ -985,7 +985,7 @@ public class PaperService {
                 }
                 if(ktc.assign > 0L) {
                     qCond.setId(null);
-                    qCond.setNumber(ktc.assign > 500 ? (long) random.nextInt(ktc.assign.intValue() - 500) :  0L);
+                    qCond.setNumber(ktc.assign > 1000 ? (long) random.nextInt(ktc.assign.intValue() - 1000) :  0L);
                     List<LearnQuestions> questions = questionsMapper.selectQuestionsForPaper(qCond);
                     ktc.assign = addRandomList(knowId, typeDef.getType(), questions, random, total.longValue(), ktc.assign, typeDef.getScore(), existQuestionSet, seqId, pqList);
                     if(pqList.size() == total) {
@@ -998,7 +998,7 @@ public class PaperService {
             }
         }
         if(pqList.size() < total) {
-            throw new RuntimeException("题数不足 " + types.stream().map( t -> t.getType().getTitle()).collect(Collectors.joining(",")) + ":" + StringUtils.join(knownIds, ","));
+            throw new RuntimeException("题数不足3 " + types.stream().map( t -> t.getType().getTitle()).collect(Collectors.joining(",")) + ":" + StringUtils.join(knownIds, ","));
         }
         return pqList;
     }

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

@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectClassKnowledgeDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
         SELECT ls.`student_id` id, u.`nick_name` `name`
-             , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
+             , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, COUNT(DISTINCT DATE(a.create_time)) `time`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
         FROM `learn_answer` a
         JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
         JOIN `sys_user` u ON u.`user_id` = ls.`student_id`