|
@@ -1,15 +1,17 @@
|
|
package com.qmth.cqb.paper.model;
|
|
package com.qmth.cqb.paper.model;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
|
|
-import com.qmth.cqb.question.model.Question;
|
|
|
|
-import org.springframework.data.annotation.Id;
|
|
|
|
-import org.springframework.data.mongodb.core.mapping.DBRef;
|
|
|
|
-
|
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.springframework.data.annotation.Id;
|
|
|
|
+import org.springframework.data.mongodb.core.mapping.DBRef;
|
|
|
|
+
|
|
|
|
+import com.qmth.cqb.question.model.Question;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
|
|
+
|
|
public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit> {
|
|
public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit> {
|
|
|
|
|
|
private static final long serialVersionUID = -8854150484922002075L;
|
|
private static final long serialVersionUID = -8854150484922002075L;
|
|
@@ -26,7 +28,7 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
|
|
|
|
private Double score;// 小题分数
|
|
private Double score;// 小题分数
|
|
|
|
|
|
- private List<Double> subScoreList;//对应套题的情况下,各子题的分数分布
|
|
|
|
|
|
+ private List<Double> subScoreList;// 对应套题的情况下,各子题的分数分布
|
|
|
|
|
|
@DBRef
|
|
@DBRef
|
|
private PaperDetail paperDetail;// 关联的大题
|
|
private PaperDetail paperDetail;// 关联的大题
|
|
@@ -35,11 +37,10 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
|
|
|
|
@DBRef
|
|
@DBRef
|
|
private Question question;// 关联试题
|
|
private Question question;// 关联试题
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 选择题下option的排序,按照number排序
|
|
|
|
- * 一般:4,2,3,1
|
|
|
|
- * 套题下的选择题:1,2,3,4;2,3,4,1;3,2,1,4 题与题之间按分号";"分隔
|
|
|
|
|
|
+ * 选择题下option的排序,按照number排序 一般:4,2,3,1 套题下的选择题:1,2,3,4;2,3,4,1;3,2,1,4
|
|
|
|
+ * 题与题之间按分号";"分隔
|
|
*/
|
|
*/
|
|
private String optionOrder;
|
|
private String optionOrder;
|
|
|
|
|
|
@@ -77,20 +78,20 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
|
|
|
|
public void setScore(Double score) {
|
|
public void setScore(Double score) {
|
|
this.score = score;
|
|
this.score = score;
|
|
- //非套题或试题未设置时,不做额外处理
|
|
|
|
|
|
+ // 非套题或试题未设置时,不做额外处理
|
|
if (questionType != QuesStructType.NESTED_ANSWER_QUESTION || question == null) {
|
|
if (questionType != QuesStructType.NESTED_ANSWER_QUESTION || question == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //当前分数设置为空时,同时设置子题分数为空
|
|
|
|
|
|
+ // 当前分数设置为空时,同时设置子题分数为空
|
|
if (score == null) {
|
|
if (score == null) {
|
|
subScoreList = null;
|
|
subScoreList = null;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //总分与子题分数之和相同,则不做额外处理
|
|
|
|
|
|
+ // 总分与子题分数之和相同,则不做额外处理
|
|
if (subScoreList != null && subScoreList.size() > 0 && getSubScoreSum() == score) {
|
|
if (subScoreList != null && subScoreList.size() > 0 && getSubScoreSum() == score) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //根据试题与总分设置情况重置子题分数
|
|
|
|
|
|
+ // 根据试题与总分设置情况重置子题分数
|
|
if (question.getSubQuestions() != null) {
|
|
if (question.getSubQuestions() != null) {
|
|
initSubScoreList(score, question.getSubQuestions());
|
|
initSubScoreList(score, question.getSubQuestions());
|
|
}
|
|
}
|
|
@@ -118,20 +119,20 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
|
|
|
|
public void setQuestion(Question question) {
|
|
public void setQuestion(Question question) {
|
|
this.question = question;
|
|
this.question = question;
|
|
- //非套题或总分未设置时,不做额外处理
|
|
|
|
|
|
+ // 非套题或总分未设置时,不做额外处理
|
|
if (questionType != QuesStructType.NESTED_ANSWER_QUESTION || score == null) {
|
|
if (questionType != QuesStructType.NESTED_ANSWER_QUESTION || score == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //当前试题或子题列表为空时,同时设置子题分数为空
|
|
|
|
|
|
+ // 当前试题或子题列表为空时,同时设置子题分数为空
|
|
if (question == null || question.getSubQuestions() == null) {
|
|
if (question == null || question.getSubQuestions() == null) {
|
|
subScoreList = null;
|
|
subScoreList = null;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //当前试题子题数量与子题分数数量相同,不做额外处理
|
|
|
|
|
|
+ // 当前试题子题数量与子题分数数量相同,不做额外处理
|
|
if (subScoreList != null && subScoreList.size() == question.getSubQuestions().size()) {
|
|
if (subScoreList != null && subScoreList.size() == question.getSubQuestions().size()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //根据试题与总分设置情况重置子题分数
|
|
|
|
|
|
+ // 根据试题与总分设置情况重置子题分数
|
|
initSubScoreList(score, question.getSubQuestions());
|
|
initSubScoreList(score, question.getSubQuestions());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -155,19 +156,22 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
return subScoreList;
|
|
return subScoreList;
|
|
}
|
|
}
|
|
|
|
|
|
- public String getOptionOrder() {
|
|
|
|
- return optionOrder;
|
|
|
|
- }
|
|
|
|
|
|
+ public String getOptionOrder() {
|
|
|
|
+ return optionOrder;
|
|
|
|
+ }
|
|
|
|
|
|
- public void setOptionOrder(String optionOrder) {
|
|
|
|
- this.optionOrder = optionOrder;
|
|
|
|
- }
|
|
|
|
|
|
+ public void setOptionOrder(String optionOrder) {
|
|
|
|
+ this.optionOrder = optionOrder;
|
|
|
|
+ }
|
|
|
|
|
|
- public void setSubScoreList(List<Double> subScoreList) {
|
|
|
|
|
|
+ public void setSubScoreList(List<Double> subScoreList) {
|
|
this.subScoreList = subScoreList;
|
|
this.subScoreList = subScoreList;
|
|
if (subScoreList != null) {
|
|
if (subScoreList != null) {
|
|
double totalScore = 0;
|
|
double totalScore = 0;
|
|
for (Double score : subScoreList) {
|
|
for (Double score : subScoreList) {
|
|
|
|
+ if (score == null) {
|
|
|
|
+ score = 0d;
|
|
|
|
+ }
|
|
totalScore += score;
|
|
totalScore += score;
|
|
}
|
|
}
|
|
this.score = totalScore;
|
|
this.score = totalScore;
|
|
@@ -190,8 +194,7 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 根据预设总分自动拆解套题子题的分数分布
|
|
|
|
- * 目前采取均分后累加到最后一题的做法
|
|
|
|
|
|
+ * 根据预设总分自动拆解套题子题的分数分布 目前采取均分后累加到最后一题的做法
|
|
*
|
|
*
|
|
* @param totalScore
|
|
* @param totalScore
|
|
* @param questionList
|
|
* @param questionList
|