|
@@ -1623,28 +1623,42 @@ public class ImportPaperService {
|
|
|
* @throws PaperException
|
|
|
*/
|
|
|
private void checkAnswerISfull(List<PaperDetailUnit> paperDetailUnits,ImportPaperCheck importPaperCheck) throws PaperException{
|
|
|
- List<PaperDetailUnit> paperDetailUnitList = new ArrayList<PaperDetailUnit>();
|
|
|
+ Map<Question,PaperDetailUnit> map = new HashMap<Question, PaperDetailUnit>();
|
|
|
for(PaperDetailUnit paperDetailUnit:paperDetailUnits){
|
|
|
Question question = paperDetailUnit.getQuestion();
|
|
|
if(question.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION
|
|
|
|| question.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION
|
|
|
|| question.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION){
|
|
|
- paperDetailUnitList.add(paperDetailUnit);
|
|
|
+ map.put(question, paperDetailUnit);
|
|
|
+ }
|
|
|
+ if(question.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
|
|
|
+ List<Question> subQuestions = question.getSubQuestions();
|
|
|
+ for(Question subQuestion:subQuestions){
|
|
|
+ if(subQuestion.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION
|
|
|
+ || subQuestion.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION
|
|
|
+ || subQuestion.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION){
|
|
|
+ map.put(subQuestion, paperDetailUnit);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boolean isNull = false;
|
|
|
boolean isNotNull = false;
|
|
|
PaperDetailUnit paperDetailUnit = new PaperDetailUnit();
|
|
|
- for(PaperDetailUnit pdu:paperDetailUnitList){
|
|
|
- Question question = pdu.getQuestion();
|
|
|
+ Question subQuestion = new Question();
|
|
|
+ for(Question question:map.keySet()){
|
|
|
+ PaperDetailUnit pdu = map.get(question);
|
|
|
if(StringUtils.isBlank(question.getQuesAnswer())){
|
|
|
isNull = true;
|
|
|
+ if(pdu.getQuestion().getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
|
|
|
+ subQuestion = question;
|
|
|
+ }
|
|
|
paperDetailUnit = pdu;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- for(PaperDetailUnit pdu:paperDetailUnitList){
|
|
|
- Question question = pdu.getQuestion();
|
|
|
+ for(Question question:map.keySet()){
|
|
|
+ //PaperDetailUnit pdu = map.get(question);
|
|
|
if(StringUtils.isNotBlank(question.getQuesAnswer())){
|
|
|
isNotNull = true;
|
|
|
break;
|
|
@@ -1652,6 +1666,16 @@ public class ImportPaperService {
|
|
|
}
|
|
|
//不满足(客观题答案要么全有,要么全没有)条件
|
|
|
if(isNull&&isNotNull){
|
|
|
+ if(paperDetailUnit.getQuestion().getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
|
|
|
+ int number=0;
|
|
|
+ for(int i=0;i<paperDetailUnit.getQuestion().getSubQuestions().size();i++){
|
|
|
+ if(paperDetailUnit.getQuestion().getSubQuestions().get(i).getId().equals(subQuestion.getId())){
|
|
|
+ number = i+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ importPaperCheck.setErrorInfo("第"+paperDetailUnit.getNumber()+"大题套题中"+ number +"小题答案缺失,请检查");
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
+ }
|
|
|
importPaperCheck.setErrorInfo("第"+paperDetailUnit.getNumber()+"小题答案缺失,请检查");
|
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
|
}
|