|
@@ -9,6 +9,7 @@ import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.bson.types.ObjectId;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
@@ -77,6 +78,18 @@ public class PaperDetailUnitServiceImpl implements PaperDetailUnitService {
|
|
|
return Model.of(paperDetailUnitRepo.findById(id));
|
|
|
}
|
|
|
|
|
|
+ private void formatSelectQuestionAnswer(Question question) {
|
|
|
+ if(question.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION) {
|
|
|
+ if(StringUtils.isNotBlank(question.getQuesAnswer())&&question.getQuesAnswer().indexOf(",")==-1) {
|
|
|
+ String[] sarr=new String[question.getQuesAnswer().length()];
|
|
|
+ for(int i=0;i<sarr.length;i++) {
|
|
|
+ sarr[i]=String.valueOf(question.getQuesAnswer().charAt(i));
|
|
|
+ }
|
|
|
+ question.setQuesAnswer((StringUtils.join(sarr, ",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* 保存小题
|
|
|
*/
|
|
@@ -88,6 +101,7 @@ public class PaperDetailUnitServiceImpl implements PaperDetailUnitService {
|
|
|
if (baseUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION) {
|
|
|
if (updateQuestion.getId().equals(baseQuestion.getId())) {
|
|
|
// 更新对象为套题本身
|
|
|
+ formatSelectQuestionAnswer(updateQuestion);
|
|
|
quesService.saveQues(updateQuestion);
|
|
|
baseUnit.setQuestion(updateQuestion);
|
|
|
} else {
|
|
@@ -142,6 +156,7 @@ public class PaperDetailUnitServiceImpl implements PaperDetailUnitService {
|
|
|
}
|
|
|
|
|
|
if (match) {
|
|
|
+ formatSelectQuestionAnswer(baseQuestion);
|
|
|
quesService.saveQues(baseQuestion);
|
|
|
baseUnit.setQuestion(baseQuestion);
|
|
|
}
|
|
@@ -150,6 +165,7 @@ public class PaperDetailUnitServiceImpl implements PaperDetailUnitService {
|
|
|
baseUnit.setSubScoreList(subScoreList);
|
|
|
}
|
|
|
} else {
|
|
|
+ formatSelectQuestionAnswer(updateQuestion);
|
|
|
quesService.saveQues(updateQuestion);
|
|
|
baseUnit.setQuestion(updateQuestion);
|
|
|
baseUnit.setScore(updateUnit.getScore());
|