|
@@ -208,21 +208,11 @@ public class ImportPaperService {
|
|
|
|
|
|
/**
|
|
|
* 清空试卷对象,加速回收
|
|
|
- *
|
|
|
- * @param paper
|
|
|
- * @param paperDetails
|
|
|
- * @param paperDetailUnits
|
|
|
- * @param questions
|
|
|
*/
|
|
|
- public void clearPaper(Paper paper, List<PaperDetail> paperDetails, List<PaperDetailUnit> paperDetailUnits, List<Question> questions) {
|
|
|
- paper = null;
|
|
|
+ public void clearPaper(List<PaperDetail> paperDetails, List<PaperDetailUnit> paperDetailUnits, List<Question> questions) {
|
|
|
paperDetails.clear();
|
|
|
- for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
|
|
|
- paperDetailUnit.setQuestion(null);
|
|
|
- }
|
|
|
paperDetailUnits.clear();
|
|
|
questions.clear();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -361,9 +351,11 @@ public class ImportPaperService {
|
|
|
throw new PaperException("导入文件格式有误!");
|
|
|
}
|
|
|
paper.setPaperDetailCount(mainQuesNum);
|
|
|
+
|
|
|
// 保存导入试卷信息
|
|
|
paper = savePaper(paper, paperDetails, paperDetailUnits, questions, importPaperCheck);
|
|
|
- clearPaper(paper, paperDetails, paperDetailUnits, questions);
|
|
|
+ clearPaper(paperDetails, paperDetailUnits, questions);
|
|
|
+
|
|
|
wordMLPackage = null;
|
|
|
tmpWordMlPackage = null;
|
|
|
FileUtils.deleteQuietly(file);
|
|
@@ -921,7 +913,8 @@ public class ImportPaperService {
|
|
|
} else if (tmpText.startsWith(ImportPaperMsg.difficulty)) {
|
|
|
// 检测到难度开始段落 difficultyDegree
|
|
|
String dif = getContent(tmpText, ImportPaperMsg.difficulty);
|
|
|
- difficulty = checkDiffculty(difficulty, dif, importPaperCheck, errorQuesNum, question);
|
|
|
+
|
|
|
+ difficulty = checkDifficulty(dif, importPaperCheck, errorQuesNum, question);
|
|
|
question.setDifficultyDegree(difficulty);
|
|
|
answerStart = false;
|
|
|
} else if (tmpText.startsWith(ImportPaperMsg.publicity)) {
|
|
@@ -1582,27 +1575,23 @@ public class ImportPaperService {
|
|
|
|
|
|
/**
|
|
|
* 校验试题难度
|
|
|
- *
|
|
|
- * @param difficulty
|
|
|
- * @param tmpText
|
|
|
- * @param importPaperCheck
|
|
|
- * @param subQuesNum
|
|
|
- * @throws Exception
|
|
|
*/
|
|
|
- private Double checkDiffculty(Double difficulty, String tmpText, ImportPaperCheck importPaperCheck, int subQuesNum, Question question) throws Exception {
|
|
|
+ private Double checkDifficulty(String tmpText, ImportPaperCheck importPaperCheck, int subQuesNum, Question question) throws Exception {
|
|
|
+ Double tempDifficulty;
|
|
|
if (StringUtils.isBlank(tmpText)) {
|
|
|
//如果为空,默认难度0.5
|
|
|
- difficulty = 0.5;
|
|
|
+ tempDifficulty = 0.5;
|
|
|
question.setDifficulty("中");
|
|
|
} else if (!isInteger(tmpText) || (Double.parseDouble(tmpText) < 1) || (Double.parseDouble(tmpText) > 10)) {
|
|
|
//如果不是整数,或者在1到10之间,就报错
|
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.getQuesName(), subQuesNum) + "中,试题难度只能是1到10之间整数");
|
|
|
throw new PaperException(importPaperCheck.getErrorInfo());
|
|
|
} else {
|
|
|
- difficulty = Double.parseDouble(tmpText) / 10;
|
|
|
- question.setDifficulty(setDiff(difficulty));
|
|
|
+ tempDifficulty = Double.parseDouble(tmpText) / 10;
|
|
|
+ question.setDifficulty(setDiff(tempDifficulty));
|
|
|
}
|
|
|
- return difficulty;
|
|
|
+
|
|
|
+ return tempDifficulty;
|
|
|
}
|
|
|
|
|
|
private String setDiff(Double difficulty) {
|