Przeglądaj źródła

fix 校验删除

he2802 3 lat temu
rodzic
commit
7207513064

+ 42 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -480,6 +480,26 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             if(Validator.isNotEmpty(question.getBusinessList())){
                 bo.setBusinessList(question.getBusinessList());
             }
+            if(question.getQuestionList().size()>0){
+                QuestionImportContent first = question.getQuestionList().get(0);
+                if(Validator.isEmpty(first.getType())){
+                    question.setCause("题目类型错误");
+                    errorList.add(question);
+                    continue;
+                }
+                if(Validator.isEmpty(first.getContent())){
+                    question.setCause("题目内容错误");
+                    errorList.add(question);
+                    continue;
+                }
+                if(findType(first.getType())==1||findType(first.getType())==2){
+                    if(Validator.isEmpty(first.getAnswer())||Validator.isEmpty(first.getOption())){
+                        question.setCause("选项错误");
+                        errorList.add(question);
+                        continue;
+                    }
+                }
+            }
             for(QuestionImportContent vo : question.getQuestionList()){
                 if(Validator.isNotEmpty(vo.getContent())){
                     type = findType(vo.getType());
@@ -649,6 +669,26 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 bo.setBusinessList(question.getBusinessList());
             }
             boolean hasError = false;
+            if(question.getQuestionList().size()>0){
+                QuestionImportContent first = question.getQuestionList().get(0);
+                if(Validator.isEmpty(first.getType())){
+                    question.setCause("题目类型错误");
+                    errorList.add(question);
+                    continue;
+                }
+                if(Validator.isEmpty(first.getContent())){
+                    question.setCause("题目内容错误");
+                    errorList.add(question);
+                    continue;
+                }
+                if(findType(first.getType())==1||findType(first.getType())==2){
+                    if(Validator.isEmpty(first.getAnswer())||Validator.isEmpty(first.getOption())){
+                        question.setCause("选项错误");
+                        errorList.add(question);
+                        continue;
+                    }
+                }
+            }
             for(QuestionImportContent vo : question.getQuestionList()){
                 if(Validator.isNotEmpty(vo.getContent())){
                     type = findType(vo.getType());
@@ -797,7 +837,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         content = dealTxt(content);
         if (Validator.isNotEmpty(content)) {
             int qIndex = content.indexOf("、");
-            if (qIndex > 0 && qIndex < 5) { //序号支持千位数
+            int dIndex = content.indexOf(".");//避免选项有、号
+            if (qIndex > 0 && qIndex < 5&&(dIndex==-1||dIndex>qIndex)) { //序号支持千位数
                 return true;
             }
         }