|
@@ -22,6 +22,7 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailUnitExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailUnitExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.export.ExportPaperAbstractService;
|
|
import cn.com.qmth.examcloud.core.questions.service.export.ExportPaperAbstractService;
|
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
|
|
import cn.com.qmth.examcloud.web.support.SpringContextHolder;
|
|
import cn.com.qmth.examcloud.web.support.SpringContextHolder;
|
|
|
|
|
|
public class PaperUtil {
|
|
public class PaperUtil {
|
|
@@ -466,10 +467,23 @@ public class PaperUtil {
|
|
throw new StatusException("500", msg+"不能修改客观题答案");
|
|
throw new StatusException("500", msg+"不能修改客观题答案");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!update.getAnswerType().equals(base.getAnswerType())) {
|
|
|
|
|
|
+ if(!answerTypeEquals(update.getAnswerType(),base.getAnswerType())) {
|
|
throw new StatusException("500", msg+"不能修改作答类型");
|
|
throw new StatusException("500", msg+"不能修改作答类型");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private static boolean answerTypeEquals(AnswerType now,AnswerType old) {
|
|
|
|
+ if(now==null&&old==null) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if(now==null&&old!=null) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if(AnswerType.DIVERSIFIED_TEXT.equals(now)&&old==null) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return now.equals(old);
|
|
|
|
+ }
|
|
|
|
|
|
public static void checkUpdateOption(PaperDetailUnitExp updateUnit,PaperDetailUnit baseUnit,String msg) {
|
|
public static void checkUpdateOption(PaperDetailUnitExp updateUnit,PaperDetailUnit baseUnit,String msg) {
|
|
Question baseQuestion = baseUnit.getQuestion();
|
|
Question baseQuestion = baseUnit.getQuestion();
|
|
@@ -501,7 +515,7 @@ public class PaperUtil {
|
|
throw new StatusException("500", msg+"不能修改选项数量");
|
|
throw new StatusException("500", msg+"不能修改选项数量");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!update.getAnswerType().equals(base.getAnswerType())) {
|
|
|
|
|
|
+ if(!answerTypeEquals(update.getAnswerType(),base.getAnswerType())) {
|
|
throw new StatusException("500", msg+"不能修改作答类型");
|
|
throw new StatusException("500", msg+"不能修改作答类型");
|
|
}
|
|
}
|
|
}
|
|
}
|