Jelajahi Sumber

仅考技能展示/实践操作的提示处理

mingfu 1 Minggu lalu
induk
melakukan
6fcff753a6

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

@@ -184,6 +184,7 @@ public class FrontStudentController extends BaseController {
             Long planId = directed.getLongValue("majorId");
             Long universityId = directed.getLongValue("universityId");
             directed.put("notice", learnTeacherService.updateDirected(user.getUserId(), universityId, planId));
+            directionStudy.set(0, directed);
         }
         user.setDirectedStudy(directionStudy.toJSONString());
         return sysUserService.updateUserProfile(user) > 0 ? AjaxResult.success("更新成功") : AjaxResult.success("无更新");

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

@@ -357,6 +357,9 @@ public class ExamService {
     }
 
     private AnswerSheet openExaminee(LearnStudent ls, Long subjectId, SysUser sysUser) {
+        if(StringUtils.isNotBlank(ls.getModules()) && ls.getModules().equals("技能展示/实践操作")) {
+            throw new ValidationException("该专业只考技能展示/实践操作");
+        }
         AMarjorPlan plan = marjorPlanService.selectAMarjorPlanById(ls.getMajorPlanId());
         if(null == plan) {
             throw new ValidationException("专业id无效");
@@ -385,7 +388,7 @@ public class ExamService {
             existPaperIdSet.add(e.getPaperId());
         }
         existPaperIdSet.clear(); // TODO 忽略已做的卷
-        LearnPaper paper = getBestPaper(sysUser.getExamType(), plan, subjectId, existPaperIdSet);
+        LearnPaper paper = getBestPaper(sysUser.getExamType(), plan, subjectId, existPaperIdSet); // getAvailPaper(sysUser.getExamType(), ls, subjectId, existPaperIdSet)
         examinee.setPaperId(paper.getId());
         examinee.setState(ExamineeStatus.Sign.getVal());
         examinee.setDuration(0L);
@@ -513,6 +516,21 @@ public class ExamService {
         return answerSheet;
     }
 
+    private LearnPaper getAvailPaper(ExamType examType, LearnStudent student, Long subjectId, Set<Long> existPaperIdSet) {
+        LearnPaper paperCond = new LearnPaper();
+        paperCond.setSubjectId(subjectId);
+        paperCond.setPaperType(PaperType.Simulated.name());
+        paperCond.setStatus(1);
+        paperCond.setDirectKey(student.getUniversityId() + "_" + examType.name() + "_" + student.getDirectKey());
+        List<LearnPaper> paperList = learnPaperService.selectLearnPaperList(paperCond);
+        for(LearnPaper paper : paperList) {
+            if(existPaperIdSet.add(paper.getId())) {
+                return paper;
+            }
+        }
+        throw new ValidationException("未初始化院校模拟题库: " + subjectId + ":" + student.getDirectKey());
+    }
+
     private LearnPaper getBestPaper(ExamType examType, AMarjorPlan plan, Long subjectId, Set<Long> existPaperIdSet) {
         String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
         LearnPaper paperCond = new LearnPaper();

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

@@ -334,10 +334,11 @@ public class LearnTeacherService {
         if(null != directedKnowledge) {
             upStudent.setDirectKey(directedKnowledge.getDirectKey());
             modules = directedKnowledge.getModules();
+            upStudent.setModules(modules);
         }
         learnStudentMapper.updateLearnStudent(upStudent);
         Set<String> moduleSet = Sets.newHashSet(StringUtils.trimToEmpty(modules).split(","));
-        return moduleSet.size() == 1 && moduleSet.contains("技能展示") ? "专业只考技能展示" : "";
+        return moduleSet.size() == 1 && moduleSet.contains("技能展示/实践操作") ? "专业只考技能展示/实践操作" : "";
     }
 
     private LearnDirectedKnowledge getBestLearnDirectedKnowledge(AMarjorPlan plan, Map<String, LearnDirectedKnowledge> directedKnowledgeMap) {

+ 11 - 2
ie-system/src/main/java/com/ruoyi/learn/domain/LearnStudent.java

@@ -1,7 +1,5 @@
 package com.ruoyi.learn.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
@@ -33,6 +31,9 @@ public class LearnStudent extends BaseEntity
     @Excel(name = "定向键")
     private String directKey;
 
+    @Excel(name = "定向考试类型")
+    private String modules;
+
     @Excel(name = "专业组")
     private String majorGroup;
 
@@ -124,4 +125,12 @@ public class LearnStudent extends BaseEntity
     public void setStatus(Integer status) {
         this.status = status;
     }
+
+    public String getModules() {
+        return modules;
+    }
+
+    public void setModules(String modules) {
+        this.modules = modules;
+    }
 }

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

@@ -10,12 +10,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="campusId"    column="campus_id"    />
         <result property="universityId"    column="university_id"    />
         <result property="directKey"    column="direct_key"    />
+        <result property="modules"    column="modules"    />
         <result property="majorGroup"    column="major_group"    />
         <result property="majorPlanId"    column="major_plan_id"    />
     </resultMap>
 
     <sql id="selectLearnStudentVo">
-        select student_id, class_id, campus_id, university_id,direct_key, major_group,major_plan_id from learn_student
+        select student_id, class_id, campus_id, university_id,direct_key, modules, major_group,major_plan_id from learn_student
     </sql>
 
     <select id="selectLearnStudentList" parameterType="LearnStudent" resultMap="LearnStudentResult">
@@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="campusId != null">campus_id,</if>
             <if test="universityId != null">university_id,</if>
             <if test="directKey != null">direct_key,</if>
+            <if test="modules != null">modules,</if>
             <if test="majorGroup != null">major_group,</if>
             <if test="majorPlanId != null">major_plan_id,</if>
          </trim>
@@ -73,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="campusId != null">#{campusId},</if>
             <if test="universityId != null">#{universityId},</if>
             <if test="directKey != null">#{directKey},</if>
+            <if test="modules != null">#{modules},</if>
             <if test="majorGroup != null">#{majorGroup},</if>
             <if test="majorPlanId != null">#{majorPlanId},</if>
          </trim>
@@ -85,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="campusId != null">campus_id = #{campusId},</if>
             <if test="universityId != null">university_id = #{universityId},</if>
             <if test="directKey != null">direct_key = #{directKey},</if>
+            <if test="modules != null">modules = #{modules},</if>
             <if test="majorGroup != null">major_group = #{majorGroup},</if>
             <if test="majorPlanId != null">major_plan_id = #{majorPlanId},</if>
         </trim>