فهرست منبع

文化知识点查询科目和知识点需要处理专业组

mingfu 3 هفته پیش
والد
کامیت
aa8d97545e

+ 5 - 6
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontExamController.java

@@ -44,8 +44,9 @@ public class FrontExamController {
     private final ILearnStudentService learnStudentService;
     private final ILearnCultureKnowledgeService learnCultureKnowledgeService;
     private final IBBusiWishUniversitiesService wishUniversitiesService;
+    private final LearnTeacherService learnTeacherService;
 
-    public FrontExamController(ExamService examService, SyTestMajorService syTestMajorService, CacheService cacheService, IDzSubjectService dzSubjectService, IDzSubjectService dzSubjectService1, StudentService studentService, ISysUserService sysUserService, ILearnStudentService learnStudentService, ILearnCultureKnowledgeService learnCultureKnowledgeService, IBBusiWishUniversitiesService wishUniversitiesService) {
+    public FrontExamController(ExamService examService, SyTestMajorService syTestMajorService, CacheService cacheService, IDzSubjectService dzSubjectService, IDzSubjectService dzSubjectService1, StudentService studentService, ISysUserService sysUserService, ILearnStudentService learnStudentService, ILearnCultureKnowledgeService learnCultureKnowledgeService, IBBusiWishUniversitiesService wishUniversitiesService, LearnTeacherService learnTeacherService) {
         this.examService = examService;
         this.syTestMajorService = syTestMajorService;
         this.cacheService = cacheService;
@@ -55,6 +56,7 @@ public class FrontExamController {
         this.learnStudentService = learnStudentService;
         this.learnCultureKnowledgeService = learnCultureKnowledgeService;
         this.wishUniversitiesService = wishUniversitiesService;
+        this.learnTeacherService = learnTeacherService;
     }
 
     @GetMapping("/subjects")
@@ -66,11 +68,8 @@ public class FrontExamController {
         if(ExamType.SVS.equals(sysUser.getExamType())) {
             Set<Long> subjectIdSet;
             LearnStudent ls = learnStudentService.selectLearnStudentByStudentId(sysUser.getUserId());
-            if(null != ls && null != ls.getUniversityId()) {
-                LearnCultureKnowledge ckCond = new LearnCultureKnowledge();
-                ckCond.setUniversityId(ls.getUniversityId());
-                ckCond.setExamineeTypes(sysUser.getExamType().name());
-                subjectIdSet = learnCultureKnowledgeService.selectLearnCultureKnowledgeList(ckCond).stream().map(t -> Long.parseLong(t.getSubjects())).collect(Collectors.toSet());
+            if(null != ls && null != ls.getMajorPlanId()) {
+                subjectIdSet = learnTeacherService.getLearnCultureKnowledgeList(ls.getMajorPlanId()).stream().map(t -> Long.parseLong(t.getSubjects())).collect(Collectors.toSet());
                 if(subjectIdSet.isEmpty()) {
                     BBusiWishUniversities u = wishUniversitiesService.selectBBusiWishUniversitiesById(ls.getUniversityId());
                     if(null != u.getBxLevel() && u.getBxLevel().contains("民办")) {

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

@@ -539,6 +539,40 @@ public class LearnTeacherService {
         Set<String> moduleSet = Sets.newHashSet(StringUtils.trimToEmpty(modules).split(","));
         return moduleSet.size() == 1 && moduleSet.contains("技能展示/实践操作") ? "该专业只考技能展示/实践操作" : "";
     }
+    public List<LearnCultureKnowledge> getLearnCultureKnowledgeList(Long planId) {
+        AMarjorPlan plan = marjorPlanMapper.selectAMarjorPlanById(planId);
+        if(null == plan) {
+            return Lists.newArrayList();
+        }
+        LearnCultureKnowledge ckCond = new LearnCultureKnowledge();
+        ckCond.setUniversityId(plan.getUniversityId());
+        ckCond.setExamineeTypes(ExamType.parse(plan.getExamineeType()).name());
+        ckCond.setMatchYear(plan.getMatchYear());
+        return getLearnCultureKnowledgeList(plan, ckCond);
+    }
+
+    public List<LearnCultureKnowledge> getLearnCultureKnowledgeList(AMarjorPlan plan, LearnCultureKnowledge ckCond) {
+        List<LearnCultureKnowledge> list = Lists.newArrayList();
+        String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
+        String majorName = StringUtils.trimToEmpty(plan.getMajorName());
+
+        for(LearnCultureKnowledge ck : learnCultureKnowledgeMapper.selectLearnCultureKnowledgeList(ckCond)) {
+            String directKey = StringUtils.trimToEmpty(ck.getDirectKey());
+            if(StringUtils.isNotBlank(directKey)) {
+                String[] groupMajors = directKey.split("_");
+                if(StringUtils.isNotBlank(groupMajors[0]) && (StringUtils.isBlank(groupName) ||
+                        !Arrays.stream(groupMajors[0].split("_|、")).filter(t -> !t.isEmpty()).collect(Collectors.toSet()).contains(groupName))) {
+                    continue;
+                }
+                if(groupMajors.length > 1 && (StringUtils.isBlank(majorName) ||
+                        !Arrays.stream(groupMajors[1].split("_|、")).filter(t -> !t.isEmpty()).collect(Collectors.toSet()).contains(majorName))) {
+                    continue;
+                }
+            }
+            list.add(ck);
+        }
+        return list;
+    }
 
     private LearnDirectedKnowledge getBestLearnDirectedKnowledge(AMarjorPlan plan, Map<String, LearnDirectedKnowledge> directedKnowledgeMap) {
         return getBestLearnDirectedKnowledge(plan.getMajorGroup(), plan.getMajorName(), directedKnowledgeMap);
@@ -617,7 +651,7 @@ public class LearnTeacherService {
                 if(null != subjectId) {
                     ckCond.setSubjects(subjectId.toString());
                 }
-                learnCultureKnowledgeMapper.selectLearnCultureKnowledgeList(ckCond).stream().filter(t -> StringUtils.isNotBlank(t.getKnowledges())).forEach(t -> {
+                getLearnCultureKnowledgeList(plan, ckCond).stream().filter(t -> StringUtils.isNotBlank(t.getKnowledges())).forEach(t -> {
                     idSet.addAll(Stream.of(t.getKnowledges().split(",")).map(Long::parseLong).collect(Collectors.toList()));
                 });
             }

+ 18 - 0
ie-common/src/main/java/com/ruoyi/common/enums/ExamType.java

@@ -1,7 +1,11 @@
 package com.ruoyi.common.enums;
 
+import com.google.common.collect.Maps;
 import lombok.AllArgsConstructor;
 
+import java.util.Arrays;
+import java.util.Map;
+
 @AllArgsConstructor
 public enum ExamType {
     OHS(1, "单招(应届普高)", "Ordinary High School"),
@@ -23,4 +27,18 @@ public enum ExamType {
     private final Integer code;
     private final String title;
     private final String nameEn;
+
+    public static ExamType parse(String name) {
+        return valMap.get(name);
+    }
+
+    private static Map<String, ExamType> valMap = Maps.newHashMap();
+    static {
+        Arrays.stream(ExamType.values()).forEach(t -> {
+            valMap.put(t.name(), t);
+            valMap.put(t.nameEn, t);
+            valMap.put(String.valueOf(t.code), t);
+            valMap.put(t.title, t);
+        });
+    }
 }

+ 11 - 1
ie-system/src/main/java/com/ruoyi/learn/domain/LearnCultureKnowledge.java

@@ -30,6 +30,8 @@ public class LearnCultureKnowledge extends BaseEntity
     @Excel(name = "院校id")
     private Long universityId;
 
+    private String directKey;
+
     /** 专业科目 */
     @Excel(name = "专业科目")
     private String subjects;
@@ -100,7 +102,15 @@ public class LearnCultureKnowledge extends BaseEntity
         return universityId;
     }
 
-    public void setSubjects(String subjects) 
+    public String getDirectKey() {
+        return directKey;
+    }
+
+    public void setDirectKey(String directKey) {
+        this.directKey = directKey;
+    }
+
+    public void setSubjects(String subjects)
     {
         this.subjects = subjects;
     }

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

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="year"    column="year"    />
         <result property="universityId"    column="university_id"    />
+        <result property="directKey"    column="direct_key"    />
         <result property="subjects"    column="subjects"    />
         <result property="questionTypes"    column="question_types"    />
         <result property="knowledges"    column="knowledges"    />
@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectLearnCultureKnowledgeVo">
-        select id, year, university_id, subjects, question_types, knowledges, locations, examinee_types, score, time, conditions from learn_culture_knowledge
+        select id, year, university_id, direct_key, subjects, question_types, knowledges, locations, examinee_types, score, time, conditions from learn_culture_knowledge
     </sql>
 
     <select id="selectLearnCultureKnowledgeList" parameterType="LearnCultureKnowledge" resultMap="LearnCultureKnowledgeResult">
@@ -77,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="SET" suffixOverrides=",">
             <if test="year != null">year = #{year},</if>
             <if test="universityId != null">university_id = #{universityId},</if>
+            <if test="directKey != null">direct_key = #{directKey},</if>
             <if test="subjects != null">subjects = #{subjects},</if>
             <if test="questionTypes != null">question_types = #{questionTypes},</if>
             <if test="knowledges != null">knowledges = #{knowledges},</if>

+ 3 - 3
ie-system/src/main/resources/mapper/learn/LearnPaperMapper.xml

@@ -65,9 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="number != null  and number != ''"> and number = #{number}</if>
             <if test="fenshu != null "> and fenshu = #{fenshu}</if>
             <if test="paperSource != null "> and paperSource = #{paperSource}</if>
-            <if test="directKey == null or directKey == ''"> and (direct_key is null or direct_key = '')</if>
-            <if test="directKey != null  and directKey != ''"> and direct_key like concat(#{directKey}, '%')</if>
-            <if test="paperInfo != null  and paperInfo != ''"> and paper_info = #{paperInfo}</if>
+            <if test="directKey != null and directKey == ''"> and (direct_key is null or direct_key = '')</if>
+            <if test="directKey != null and directKey != ''"> and direct_key like concat(#{directKey}, '%')</if>
+            <if test="paperInfo != null and paperInfo != ''"> and paper_info = #{paperInfo}</if>
             <if test="tiid != null  and tiid != ''"> and tiid = #{tiid}</if>
             <if test="osspath != null  and osspath != ''"> and osspath = #{osspath}</if>
             <if test="filename != null  and filename != ''"> and filename like concat('%', #{filename}, '%')</if>