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

Merge branch 'dev' of http://192.168.1.245:11111/jinjilong/onlineEducation-fwd into dev

honorfire 7 месяцев назад
Родитель
Сommit
4ecaf34c22

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/Question.java

@@ -51,7 +51,7 @@ public class Question implements Serializable {
     private Integer infoTextContentId;
 
     /**
-     * 题库类型 1练习题目库  2问卷题目库
+     * 题库类型 1练习题目库  2问卷题目库 3 考试题目库
      */
     private String bankType;
 

+ 6 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/TExam.java

@@ -62,8 +62,8 @@ public class TExam {
     @TableField(fill = FieldFill.UPDATE)
     private Date updateTime;
 
-    /** 章节ID ,有此则为章节测 */
-    @ApiModelProperty(value = "章节ID ,有此则为章节测", position = 8)
+    /** 章节ID ,有此则为章节测 */
+    @ApiModelProperty(value = "章节ID ,有此则为章节测", position = 8)
     private String chapterId;
 
     /** 开始时间 */
@@ -87,4 +87,8 @@ public class TExam {
 
     @ApiModelProperty(value = "结束任务ID", position = 14)
     private String endJobId;
+
+    /** 考试类型 1 考试 2 章节测验 3 调查问卷  */
+    @ApiModelProperty(value = "考试类型", position = 15)
+    private String examType;
 }

+ 3 - 6
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/exam/TExamAddParam.java

@@ -65,10 +65,7 @@ public class TExamAddParam {
     @ApiModelProperty(value = "试卷ID", position = 11)
     private String paperId;
 
-    /** 软删除 */
-    @ApiModelProperty(value = "软删除", position = 12)
-    private Integer deleted;
-
-    @ApiModelProperty(value = "任务ID", position = 13)
-    private String jobId;
+    /** 考试类型 1 考试 2 章节测验 3 调查问卷  */
+    @ApiModelProperty(value = "考试类型", position = 12)
+    private String examType;
 }

+ 4 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/exam/TExamPageParam.java

@@ -79,4 +79,8 @@ public class TExamPageParam {
 
     /** 学生ID **/
     private String userId;
+
+    /** 考试类型 1 考试 2 章节测验 3 调查问卷  */
+    @ApiModelProperty(value = "考试类型", position = 12)
+    private String examType;
 }

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/question/QuestionExcel.java

@@ -21,7 +21,7 @@ public class QuestionExcel {
     @ExcelProperty("题目序号")
     private String id;
     /**
-     * 题库类型 1练习题目库  2问卷题目库
+     * 题库类型 1练习题目库  2问卷题目库 3考试题目库
      */
     @ExcelProperty("所属题库")
     private String bankType;

+ 29 - 22
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/QuestionServiceImpl.java

@@ -389,7 +389,8 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
                     /////////////////////////////////////////////////////////////////////////////////////////////////////
                     if(okExcel.getIsContent()){
                         String questionType = questionList.get(i).getQuestionType();
-                        if(questionType ==null || !questionType.equals("填空题")){
+                        String bankType = questionList.get(i).getBankType();
+                        if(bankType != null && !bankType.equals("问卷题目库") && questionType != null && !questionType.equals("填空题")){
                             String correctContent = questionList.get(i).getCorrectContent();
                             if(correctContent == null || correctContent.trim().isEmpty()){
                                 errorQuestionList.add("题目序号: "+questionId+" , 答案内容为空请检查.");
@@ -401,24 +402,30 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
                     }
                     /////////////////////////////////////////////////////////////////////////////////////////////////////
                     if(okExcel.getIsContent()){
-                        String itemScore = questionList.get(i).getItemScore();
-                        boolean isItemScore = positiveInteger(itemScore);
-                        if(!isItemScore){
-                            errorQuestionList.add("题目序号: "+questionId+" , 题目分数数据格式错误请检查.");
-                            errorIdSet.add(questionId);
-                        }else{
-                            okExcel.setItemScore(itemScore);
+                        String bankType = questionList.get(i).getBankType();
+                        if(bankType != null && !bankType.equals("问卷题目库")){
+                            String itemScore = questionList.get(i).getItemScore();
+                            boolean isItemScore = positiveInteger(itemScore);
+                            if(!isItemScore){
+                                errorQuestionList.add("题目序号: "+questionId+" , 题目分数数据格式错误请检查.");
+                                errorIdSet.add(questionId);
+                            }else{
+                                okExcel.setItemScore(itemScore);
+                            }
                         }
                     }
                     /////////////////////////////////////////////////////////////////////////////////////////////////////
                     if(okExcel.getIsContent()){
-                        String difficult = questionList.get(i).getDifficult();
-                        boolean isDifficult = positiveInteger(difficult);
-                        if(!isDifficult){
-                            errorQuestionList.add("题目序号: "+questionId+" , 题目难度数据格式错误请检查.");
-                            errorIdSet.add(questionId);
-                        }else{
-                            okExcel.setDifficult(difficult);
+                        String bankType = questionList.get(i).getBankType();
+                        if(bankType != null && !bankType.equals("问卷题目库")){
+                            String difficult = questionList.get(i).getDifficult();
+                            boolean isDifficult = positiveInteger(difficult);
+                            if(!isDifficult){
+                                errorQuestionList.add("题目序号: "+questionId+" , 题目难度数据格式错误请检查.");
+                                errorIdSet.add(questionId);
+                            }else{
+                                okExcel.setDifficult(difficult);
+                            }
                         }
                     }
                     /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -447,15 +454,18 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
 
     @Transactional(rollbackFor = Exception.class)
     public JSONObject saveFromLoad(List<QuestionExcel> questionOKList, String userId, JSONObject result) {
-        List<String> saveIds = new ArrayList<>(); // 保存成功的序号ID
         for(QuestionExcel okExcel : questionOKList){
-            if(okExcel.getIsContent() && !saveIds.contains(okExcel.getId())){
+            if(okExcel.getIsContent()){
                 // 题目内容 条
                 List<QuestionExcel> itemList = questionOKList.stream().filter(item -> item.getId().equals(okExcel.getId())).collect(Collectors.toList());
                 List<String> correct = itemList.stream().map(QuestionExcel::getCorrectContent).filter(Objects::nonNull).collect(Collectors.toList());
                 int questionType = Integer.parseInt(okExcel.getQuestionType());
-                int score = Integer.parseInt(okExcel.getItemScore());
-                int difficult = Integer.parseInt(okExcel.getDifficult());
+                int score = 0, difficult = 0;
+                if(!"3".equals(okExcel.getBankType())){
+                    score = Integer.parseInt(okExcel.getItemScore());
+                    difficult = Integer.parseInt(okExcel.getDifficult());
+                }
+
                 Question question = new Question();
                 question.setBankType(okExcel.getBankType());
                 question.setQuestionType(questionType);
@@ -466,9 +476,6 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
                 question.setCreateTime(now());
                 question.setDeleted(false);
 
-
-
-
                 if(QuestionTypeEnum.GapFilling.getCode() == questionType){ // 填空题
                    int count = checkEmptyCount(okExcel.getTitleContent());
                    if(count == 0){

+ 12 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TExamServiceImpl.java

@@ -84,6 +84,9 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
         if(ObjectUtil.isNotEmpty(tExamPageParam.getPaperId())) {
             queryWrapper.lambda().eq(TExam::getPaperId, tExamPageParam.getPaperId());
         }
+        if(ObjectUtil.isNotEmpty(tExamPageParam.getExamType())) {
+            queryWrapper.lambda().eq(TExam::getExamType, tExamPageParam.getExamType());
+        }
         if(ObjectUtil.isNotEmpty(tExamPageParam.getUserId())){
             queryWrapper.lambda().like(TExam::getStudentIds, tExamPageParam.getUserId());
         }
@@ -107,6 +110,15 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
         }
         TExam tExam = BeanUtil.toBean(tExamAddParam, TExam.class);
         tExam.setStudentIds("1935565895337304066");
+        if(tExam.getExamType() == null){
+            if(examPaper.getPaperType() == ExamPaperTypeEnum.Survey.getCode()){
+                tExam.setExamType("3"); // 调查问卷
+            }else if(tExamAddParam.getChapterId() != null){
+                tExam.setExamType("2"); // 章节测验
+            }else{
+                tExam.setExamType("1"); // 普通考试
+            }
+        }
         this.save(tExam);
         if(tExamAddParam.getChapterId() != null && !tExamAddParam.getChapterId().isEmpty()){
             CourseChapterPaper cp = new CourseChapterPaper();