Просмотр исходного кода

修正排序和老师id及卷生成调整

mingfu 4 недель назад
Родитель
Сommit
5f3529f4f4

+ 13 - 1
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontExamController.java

@@ -17,6 +17,8 @@ import com.ruoyi.learn.service.ILearnCultureKnowledgeService;
 import com.ruoyi.learn.service.ILearnStudentService;
 import com.ruoyi.mxjb.domain.MxjbContants;
 import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.syzy.domain.BBusiWishUniversities;
+import com.ruoyi.syzy.service.IBBusiWishUniversitiesService;
 import com.ruoyi.web.domain.PaperDto;
 import com.ruoyi.web.service.*;
 import io.swagger.annotations.Api;
@@ -41,8 +43,9 @@ public class FrontExamController {
     private final ISysUserService sysUserService;
     private final ILearnStudentService learnStudentService;
     private final ILearnCultureKnowledgeService learnCultureKnowledgeService;
+    private final IBBusiWishUniversitiesService wishUniversitiesService;
 
-    public FrontExamController(ExamService examService, SyTestMajorService syTestMajorService, CacheService cacheService, IDzSubjectService dzSubjectService, IDzSubjectService dzSubjectService1, StudentService studentService, ISysUserService sysUserService, ILearnStudentService learnStudentService, ILearnCultureKnowledgeService learnCultureKnowledgeService) {
+    public FrontExamController(ExamService examService, SyTestMajorService syTestMajorService, CacheService cacheService, IDzSubjectService dzSubjectService, IDzSubjectService dzSubjectService1, StudentService studentService, ISysUserService sysUserService, ILearnStudentService learnStudentService, ILearnCultureKnowledgeService learnCultureKnowledgeService, IBBusiWishUniversitiesService wishUniversitiesService) {
         this.examService = examService;
         this.syTestMajorService = syTestMajorService;
         this.cacheService = cacheService;
@@ -51,6 +54,7 @@ public class FrontExamController {
         this.sysUserService = sysUserService;
         this.learnStudentService = learnStudentService;
         this.learnCultureKnowledgeService = learnCultureKnowledgeService;
+        this.wishUniversitiesService = wishUniversitiesService;
     }
 
     @GetMapping("/subjects")
@@ -67,6 +71,14 @@ public class FrontExamController {
                 ckCond.setUniversityId(ls.getUniversityId());
                 ckCond.setExamineeTypes(sysUser.getExamType().name());
                 subjectIdSet = learnCultureKnowledgeService.selectLearnCultureKnowledgeList(ckCond).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("民办")) {
+                        subjectIdSet.add(1L);
+                        subjectIdSet.add(2L);
+                        subjectIdSet.add(3L);
+                    }
+                }
             } else {
                 subjectIdSet = Sets.newHashSet();
             }

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

@@ -71,7 +71,7 @@ public class FrontTeacherController extends BaseController {
     @GetMapping("record/simulated")
     public AjaxResult getRecordSimulated()
     {
-        return AjaxResult.success(learnStatService.getSimulatedClassRecord(SecurityUtils.getUserId()));
+        return AjaxResult.success(learnStatService.getSimulatedClassRecord(SecurityUtils.getLoginUser().getUser().getUserTypeId()));
     }
 
     @ApiOperation("记录-模拟卷班级")

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

@@ -607,7 +607,7 @@ public class ExamService {
         if(!subjectId.equals(11L)) {
             List<LearnPaper> paperList = learnPaperService.selectLearnPaperList(paperCond);
             if(paperList.isEmpty()) {
-                paperCond.setDirectKey(null);
+                paperCond.setDirectKey("");
                 paperList = learnPaperService.selectLearnPaperList(paperCond);
             }
             for(LearnPaper paper : paperList) {

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

@@ -61,7 +61,7 @@ public class PaperService {
         this.learnKnowledgeTreeMapper = learnKnowledgeTreeMapper;
         this.learnCultureKnowledgeMapper = learnCultureKnowledgeMapper;
         this.dzSubjectMapper = dzSubjectMapper;
-        // buildAllPapers(2);
+        // buildAllPapers(900);
         // buildSimulatedPaperForUniversity(20950L, 11L, 78L, 2);
         // buildSimulatedPaperForUniversity(20962L, 11L, 156L, 2);
         // test2();
@@ -180,21 +180,33 @@ public class PaperService {
         Map uCond = new HashMap();
         uCond.put("ids", universityDirectedMap.keySet());
         Map<Long, BBusiWishUniversities> universityMap = bBusiWishUniversitiesMapper.selectBBusiWishUniversitiesListSimpleByIds(uCond).stream().collect(Collectors.toMap(BBusiWishUniversities::getId, Function.identity()));
+        List<Long> dkIdList = Lists.newArrayList();
+        Set<Long> validIdSet = Sets.newHashSet(227L,24L,193L);
         for(Long universityId : universityDirectedMap.keySet()) {
             BBusiWishUniversities universities = universityMap.get(universityId);
             if(null == universities) {
                 continue;
             }
             for(LearnDirectedKnowledge dk : universityDirectedMap.get(universityId)) {
-                buildSimulatedPaperForKnowledge(11L, seq, universities, dk);
+                if(validIdSet.size() > 0 && !validIdSet.contains(dk.getId())) {
+                    continue;
+                }
+                try {
+                    buildSimulatedPaperForKnowledge(11L, seq, universities, dk);
+                } catch(Exception e) {
+                    dkIdList.add(dk.getId());
+                    log.error(e.getMessage());
+                }
             }
-
+        }
+        if(dkIdList.size() > 0) {
+            System.out.println(StringUtils.join(dkIdList, ","));
         }
     }
 
     public void testCulture(Integer seq) {
         LearnCultureKnowledge ckCond = new LearnCultureKnowledge();
-        ckCond.setUniversityId(20154L);
+        // ckCond.setUniversityId(20154L);
         List<LearnCultureKnowledge> cultureKnowledgeList = learnCultureKnowledgeMapper.selectLearnCultureKnowledgeList(ckCond);
 
         List<Long> errorIdList = Lists.newArrayList();
@@ -453,13 +465,8 @@ public class PaperService {
         info.setTime(dk.getTime() * 60);
         info.setTypes(paperDef.getTypes().stream().map(t -> new AnswerSheet.PaperCondType(t.getType().getTitle(), t.getCount(), t.getScore())).collect(Collectors.toList()));
         paper.setPaperInfo(JSONObject.toJSONString(info));
-        try {
-            Pair<LearnPaper, List<LearnPaperQuestion>> paperResult = buildPaper2(null, paper, paperDef);
-            savePaper(paperResult.getKey(), paperResult.getValue());
-            return 0;
-        } catch(Exception e) {
-            log.error(e.getMessage());
-        }
+        Pair<LearnPaper, List<LearnPaperQuestion>> paperResult = buildPaper2(null, paper, paperDef);
+        // savePaper(paperResult.getKey(), paperResult.getValue());
         return 0;
     }
 
@@ -540,9 +547,10 @@ public class PaperService {
             }
             newKnownList.addAll(tailKnownList);
             ktd.setKnowledges(newKnownList);
-            Map<String, KnowTypeAssign> knowTypeAssignMap = buildKnowTypeAssignMap(studentId, ktd.getSubType().toString(), ktd.getTypes().get(0).getCount(), ktd.getTypes().stream().map(t -> t.getType().getTitle()).collect(Collectors.toList()), newKnownList, paperDef.getFillExclude());
+            String isSubType = null == ktd.getSubType() ? "0" : ktd.getSubType().toString();
+            Map<String, KnowTypeAssign> knowTypeAssignMap = buildKnowTypeAssignMap(studentId, isSubType, ktd.getTypes().get(0).getCount(), ktd.getTypes().stream().map(t -> t.getType().getTitle()).collect(Collectors.toList()), newKnownList, paperDef.getFillExclude());
             assignTypeFirst(paperDef.getFillExclude(), ktd, knowTypeAssignMap);
-            pqList.addAll(getQuestions2(studentId, ktd.getCount(), pqList.size(), newKnownList, ktd.getSubType().toString(), ktd.getTypes(), knowTypeAssignMap, existQuestionSet));
+            pqList.addAll(getQuestions2(studentId, ktd.getCount(), pqList.size(), newKnownList, isSubType, ktd.getTypes(), knowTypeAssignMap, existQuestionSet));
         }
         reSort(pqList);
         return pqList;

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

@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
          WHERE ls.`class_id` = #{classId}
          GROUP BY ls.`student_id`
-         ORDER BY <choose><when test="sortField='total'">total</when><when test="sortField='time'">`time`</when><otherwise>rate</otherwise></choose> <if test="null != desc and desc">DESC</if>
+         ORDER BY <choose><when test="sortField=='total'">total</when><when test="sortField=='time'">`time`</when><otherwise>rate</otherwise></choose> <if test="null != desc and desc"> DESC</if>
     </select>
 
     <select id="selectQuestionStatsHeader" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">

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

@@ -40,6 +40,7 @@ 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="tiid != null  and tiid != ''"> and tiid = #{tiid}</if>