Эх сурвалжийг харах

Merge branch 'dev-v5.2' into dev

he2802 3 жил өмнө
parent
commit
b23ef4953c

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

@@ -510,7 +510,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                         bo.setContent(vo.getContent());
                         bo.setAnalysisContent(vo.getAnalysisContent());
                         if(type==1||type==2){ //单选或多选
-                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList());
+                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList(),type);
                             bo.setOptionsList((List<QuestionChildAddBo>)rs.get("optionsList"));
                             bo.setAnswerQuestion((String) rs.get("answerStr"));
                         }
@@ -535,7 +535,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                         childAddBo.setContent(vo.getContent());
                         childAddBo.setAnalysisContent(vo.getAnalysisContent());
                         if(type==1||type==2){ //单选或多选
-                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList());
+                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList(),type);
                             childAddBo.setOptionsList((List<QuestionChildAddBo>)rs.get("optionsList"));
                             childAddBo.setAnswerQuestion((String) rs.get("answerStr"));
                         }
@@ -705,7 +705,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                             break;
                         }
                         if(type==1||type==2){ //单选或多选
-                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList());
+                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList(),type);
                             bo.setOptionsList((List<QuestionChildAddBo>)rs.get("optionsList"));
                             bo.setAnswerQuestion((String) rs.get("answerStr"));
                         }
@@ -730,7 +730,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                         childAddBo.setContent(vo.getContent());
                         childAddBo.setAnalysisContent(vo.getAnalysisContent());
                         if(type==1||type==2){ //单选或多选
-                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList());
+                            Map<String,Object> rs = getOptionsList(startIndex,question.getQuestionList(),type);
                             childAddBo.setOptionsList((List<QuestionChildAddBo>)rs.get("optionsList"));
                             childAddBo.setAnswerQuestion((String) rs.get("answerStr"));
                         }
@@ -774,7 +774,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return map;
     }
 
-    private Map<String,Object> getOptionsList(int startIndex,List<QuestionImportContent> list){
+    private Map<String,Object> getOptionsList(int startIndex,List<QuestionImportContent> list,int type){
         Map<String,Object> map = new HashMap<>();
         String answerQuestion = "";
         List<QuestionChildAddBo> optionsList = new ArrayList<>(); //题目选项
@@ -790,7 +790,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             addBo.setOptionsId(j);
             optionsList.add(addBo);
             if("是".equals(entity.getAnswer())){
-                answerList.add(j);
+                if(type==1){ //单选
+                    answerList.add(j);
+                    break;
+                }
             }
             j++;
         }