he2802 před 3 roky
rodič
revize
00693f584a

+ 6 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -1043,6 +1043,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                                 errorLog += "第" + index + "条题目选项错误\n";
                             }
                             if(!hasError){
+                                if (Validator.isEmpty(answerQuestion)) {
+                                    throw new CustomException("正确答案错误");
+                                }
                                 if(type==5){
                                     answerQuestion = null;
                                 }
@@ -1057,10 +1060,6 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                                 bo.setPublishStatus(1);
                                 bo.setBusinessList(businessList);
                                 bo.setCreateTime(nowTime);
-                                answerQuestion = content.replace("正确答案:", "");
-                                if (Validator.isEmpty(answerQuestion)) {
-                                    throw new CustomException("正确答案错误");
-                                }
                                 if(type==1){
                                     list1.add(bo);
                                 }
@@ -1428,6 +1427,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
 
                             }
                             if(!hasError){
+                                if (Validator.isEmpty(answerQuestion)) {
+                                    throw new CustomException("正确答案错误");
+                                }
                                 if(type==5){
                                     answerQuestion = null;
                                 }
@@ -1442,9 +1444,6 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                                 bo.setPublishStatus(1);
                                 bo.setBusinessList(businessList);
                                 bo.setCreateTime(nowTime);
-                                if (Validator.isEmpty(answerQuestion)) {
-                                    throw new CustomException("正确答案错误");
-                                }
                                 if(type==1){
                                     list1.add(bo);
                                 }