he2802 2 år sedan
förälder
incheckning
25a7f6046e

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

@@ -786,6 +786,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                             Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList(),type);
                             bo.setOptionsList((List<QuestionChildAddBo>)rs.get("optionsList"));
                             bo.setAnswerQuestion((String) rs.get("answerStr"));
+                            if(Validator.isEmpty(bo.getAnswerQuestion())){
+                                question.setCause("题目答案错误");
+                                errorList.add(question);
+                                continue;
+                            }
                         }
                         if(type==3){ //判断题
                             if(vo.getOption().equals("正确")&&vo.getAnswer().equals("是")){
@@ -797,6 +802,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                             else{
                                 bo.setAnswerQuestion("0");
                             }
+                            if(Validator.isEmpty(bo.getAnswerQuestion())){
+                                question.setCause("题目答案错误");
+                                errorList.add(question);
+                                continue;
+                            }
                         }
                         if(type==4){
                             isAnLi = true;
@@ -955,7 +965,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             addBo.setContent(entity.getOption());
             addBo.setOptionsId(j);
             optionsList.add(addBo);
-            if("是".equals(entity.getAnswer())){
+            if("是".equals(dealTxt(entity.getAnswer()))){
                 answerList.add(j);
                 /*if(type==1){ //单选
                     break;
@@ -1009,6 +1019,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     }
 
     private String dealTxt(String txt) {
+        if(Validator.isEmpty(txt)){
+            return null;
+        }
         txt = txt.trim();
         if (txt.startsWith("\\t")) {
             txt = txt.replace("\\t", "");