Explorar o código

返回知识点已做数量,调整学习计划默念值

mingfu hai 1 mes
pai
achega
6b4fcc61c6

+ 0 - 18
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontExamController.java

@@ -1,35 +1,17 @@
 package com.ruoyi.web.controller.front;
 
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Sets;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dz.service.IDzControlService;
-import com.ruoyi.enums.ExamineeStatus;
 import com.ruoyi.enums.PaperType;
-import com.ruoyi.ie.domain.AMarjorPlan;
-import com.ruoyi.ie.service.IAMarjorPlanService;
 import com.ruoyi.learn.domain.AnswerSheet;
-import com.ruoyi.learn.domain.LearnExaminee;
-import com.ruoyi.learn.domain.LearnPaper;
-import com.ruoyi.learn.domain.PaperVO;
-import com.ruoyi.learn.service.ILearnExamineeService;
-import com.ruoyi.learn.service.ILearnPaperService;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.web.service.ExamService;
 import com.ruoyi.web.service.PaperService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.ValidationException;
-import java.util.List;
-import java.util.Set;
-
 @RestController
 @RequestMapping("/front/exam")
 @Api(tags = "前台-学习-考试练习")

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

@@ -232,15 +232,18 @@ public class FrontStudentController extends BaseController {
         Long videoTimes = 0L;
         Long questionCnt = 0L;
         Date today = new Date();
-        LearnPlanStudy todayStudy = null;
+        List<JSONObject> todayStudyList = Lists.newArrayList();
+        JSONObject todayStudy = null;
         for(LearnPlanStudy study : studyList) {
+            JSONObject planStudy = toStudyStats(study);
             if(!study.getReportDate().before(today)) { // 今天
                 doneDay++;
                 videoTimes += study.getVideoTime();
                 questionCnt = study.getQuestionCount();
             } else {
-                todayStudy = study;
+                todayStudy = planStudy;
             }
+            todayStudyList.add(planStudy);
         }
 
         Integer preDay = 0;
@@ -254,12 +257,21 @@ public class FrontStudentController extends BaseController {
         stats.put("unDoneDay", LocalDate.now().getDayOfMonth() - doneDay - preDay);
         stats.put("videoTimes", videoTimes);
         stats.put("questionCnt", questionCnt);
-        stats.put("studyList", studyList);
+        stats.put("studyList", todayStudyList);
         stats.put("today", todayStudy);
         stats.put("plan", curr);
         return AjaxResult.success(stats);
     }
 
+    private JSONObject toStudyStats(LearnPlanStudy todayStudy) {
+        JSONObject study = new JSONObject();
+        study.put("questionCnt", todayStudy.getQuestionCount());
+        study.put("videoTime", todayStudy.getVideoTime());
+        study.put("videoTimes", todayStudy.getVideoTime());
+        study.put("rightRate", "0");
+        return study;
+    }
+
     @ApiOperation("50 记录-知识点统计")
     @GetMapping("record/knowledge")
     public TableDataInfo getRecordKnowledge()
@@ -336,11 +348,7 @@ public class FrontStudentController extends BaseController {
         if(CollectionUtils.isNotEmpty(planList)) {
             return planList.get(0);
         }
-        cond.setQuestionCnt(90);
-        cond.setVideoTime(5);
-        cond.setStatus(0);
-        cond.setBeginTime(DateUtils.truncate(new Date(), Calendar.DATE));
-        return cond;
+        return null;
     }
 
 }

+ 7 - 5
ie-admin/src/main/java/com/ruoyi/web/service/LearnTeacherService.java

@@ -273,7 +273,7 @@ public class LearnTeacherService {
         LearnKnowledgeTree ktCond = new LearnKnowledgeTree();
         ktCond.setSubjectId(subjectId);
         List<LearnKnowledgeTree> ktList = learnKnowledgeTreeMapper.selectLearnKnowledgeTreeList(ktCond);
-        Map<Long, Integer> knowCountMap = null;
+        Map<Long, Integer[]> knowCountMap = null;
         if(count) {
             Map cond = Maps.newHashMap();
             cond.put("studentId", SecurityUtils.getUserId());
@@ -281,7 +281,7 @@ public class LearnTeacherService {
             cond.put("types", Lists.newArrayList("单选题", "判断题"));
             knowCountMap = Maps.newHashMap();
             for(LearnQuestions qs : learnQuestionsMapper.statByKnowledge(cond)) {
-                knowCountMap.put(qs.getKnowledgeId(), qs.getNumber().intValue());
+                knowCountMap.put(qs.getKnowledgeId(), new Integer[] { qs.getNumber().intValue(), qs.getId().intValue()} );
             }
         }
         return buildTree(ktList, knowledgeIdSet, knowCountMap);
@@ -361,7 +361,7 @@ public class LearnTeacherService {
         return knowledgeIdSet;
     }
 
-    public List<TreeNode> buildTree(List<LearnKnowledgeTree> ktList, Set<Long> knowledgeIdSet, Map<Long, Integer> knowCountMap) {
+    public List<TreeNode> buildTree(List<LearnKnowledgeTree> ktList, Set<Long> knowledgeIdSet, Map<Long, Integer[]> knowCountMap) {
         List<TreeNode> treeNodeList = Lists.newArrayList();
         Map<Long, TreeNode> teMap = Maps.newHashMap();
         for(LearnKnowledgeTree kt : ktList) {
@@ -392,13 +392,15 @@ public class LearnTeacherService {
         private String name;
         private Integer status;
         private Integer questionCount;
+        private Integer finishedCount;
 
         List<TreeNode> children = Lists.newArrayList();
-        public TreeNode(Long id, String name, Integer questionCount) {
+        public TreeNode(Long id, String name, Integer[] counts) {
             this.id = id;
             this.name = name;
             this.status = 0;
-            this.questionCount = null != questionCount ? questionCount : 0;
+            this.questionCount = null != counts ? counts[0] : 0;
+            this.finishedCount = null != counts ? counts[1] : 0;
         }
 
         public boolean setChecked(Set<Long> idSet) {

+ 14 - 1
ie-system/src/main/java/com/ruoyi/learn/domain/LearnPlanStudy.java

@@ -45,6 +45,11 @@ public class LearnPlanStudy extends BaseEntity
     @Excel(name = "完成题数")
     private Long questionCount;
 
+
+    /** 完成视频时间 */
+    @Excel(name = "完成视频数量")
+    private Long videoCount;
+
     /** 完成视频时间 */
     @Excel(name = "完成视频时间")
     private Long videoTime;
@@ -127,7 +132,15 @@ public class LearnPlanStudy extends BaseEntity
         return questionCount;
     }
 
-    public void setVideoTime(Long videoTime) 
+    public Long getVideoCount() {
+        return videoCount;
+    }
+
+    public void setVideoCount(Long videoCount) {
+        this.videoCount = videoCount;
+    }
+
+    public void setVideoTime(Long videoTime)
     {
         this.videoTime = videoTime;
     }

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

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="weekSeq"    column="week_seq"    />
         <result property="reportDate"    column="report_date"    />
         <result property="questionCount"    column="question_count"    />
+        <result property="videoCount"    column="video_count"    />
         <result property="videoTime"    column="video_time"    />
         <result property="questionPlan"    column="question_plan"    />
         <result property="videoPlan"    column="video_plan"    />
@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectLearnPlanStudyVo">
-        select id, student_id, plan_id, month_seq, week_seq, report_date, question_count, video_time, question_plan, video_plan, update_time from learn_plan_study
+        select id, student_id, plan_id, month_seq, week_seq, report_date, question_count, video_count, video_time, question_plan, video_plan, update_time from learn_plan_study
     </sql>
 
     <select id="selectLearnPlanStudyList" parameterType="LearnPlanStudy" resultMap="LearnPlanStudyResult">
@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="weekSeq != null "> and week_seq = #{weekSeq}</if>
             <if test="reportDate != null "> and report_date = #{reportDate}</if>
             <if test="questionCount != null "> and question_count = #{questionCount}</if>
+            <if test="videoCount != null "> and video_count = #{videoCount}</if>
             <if test="videoTime != null "> and video_time = #{videoTime}</if>
             <if test="questionPlan != null "> and question_plan = #{questionPlan}</if>
             <if test="videoPlan != null "> and video_plan = #{videoPlan}</if>
@@ -51,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="weekSeq != null">week_seq,</if>
             <if test="reportDate != null">report_date,</if>
             <if test="questionCount != null">question_count,</if>
+            <if test="videoCount != null">video_count,</if>
             <if test="videoTime != null">video_time,</if>
             <if test="questionPlan != null">question_plan,</if>
             <if test="videoPlan != null">video_plan,</if>
@@ -63,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="weekSeq != null">#{weekSeq},</if>
             <if test="reportDate != null">#{reportDate},</if>
             <if test="questionCount != null">#{questionCount},</if>
+            <if test="videoCount != null">#{videoCount},</if>
             <if test="videoTime != null">#{videoTime},</if>
             <if test="questionPlan != null">#{questionPlan},</if>
             <if test="videoPlan != null">#{videoPlan},</if>
@@ -79,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="weekSeq != null">week_seq = #{weekSeq},</if>
             <if test="reportDate != null">report_date = #{reportDate},</if>
             <if test="questionCount != null">question_count = #{questionCount},</if>
+            <if test="videoCount != null">video_count = #{videoCount},</if>
             <if test="videoTime != null">video_time = #{videoTime},</if>
             <if test="questionPlan != null">question_plan = #{questionPlan},</if>
             <if test="videoPlan != null">video_plan = #{videoPlan},</if>