xiatian vor 1 Jahr
Ursprung
Commit
aa961c49ec

+ 7 - 0
src/main/java/cn/com/qmth/export/KdPaper.java

@@ -8,6 +8,7 @@ public class KdPaper {
 	private String name;
 	private Double totalScore;
 	private Integer detailCount;
+	private Integer unitCount;
 	private List<KdDetail> details;
 	public String getCourseCode() {
 		return courseCode;
@@ -45,5 +46,11 @@ public class KdPaper {
 	public void setCourseName(String courseName) {
 		this.courseName = courseName;
 	}
+	public Integer getUnitCount() {
+		return unitCount;
+	}
+	public void setUnitCount(Integer unitCount) {
+		this.unitCount = unitCount;
+	}
 	
 }

+ 35 - 1
src/main/java/cn/com/qmth/export/KdQuestion.java

@@ -6,6 +6,7 @@ public class KdQuestion {
 	private Long id;
 	private Integer number;
 	private YunkaiQuesStructType qst;
+	private QuesStructType quesStructType;
 	private Integer structType;
 	private Boolean objective;
 	private YunkaiDifficulty difficulty;
@@ -16,6 +17,9 @@ public class KdQuestion {
 	private List<KdQuesOption> options;
 	private List<Long> propIds;
 	private Boolean valid;
+	private Double score;
+	private List<Double> subScores;
+	private List<KdQuestion> subQuestions;
 
 	public Integer getNumber() {
 		return number;
@@ -97,7 +101,6 @@ public class KdQuestion {
 		this.valid = valid;
 	}
 
-
 	public List<Long> getPropIds() {
 		return propIds;
 	}
@@ -122,5 +125,36 @@ public class KdQuestion {
 		this.difficulty = difficulty;
 	}
 
+	public QuesStructType getQuesStructType() {
+		return quesStructType;
+	}
+
+	public void setQuesStructType(QuesStructType quesStructType) {
+		this.quesStructType = quesStructType;
+	}
+
+	public List<Double> getSubScores() {
+		return subScores;
+	}
+
+	public void setSubScores(List<Double> subScores) {
+		this.subScores = subScores;
+	}
+
+	public List<KdQuestion> getSubQuestions() {
+		return subQuestions;
+	}
+
+	public void setSubQuestions(List<KdQuestion> subQuestions) {
+		this.subQuestions = subQuestions;
+	}
+
+	public Double getScore() {
+		return score;
+	}
+
+	public void setScore(Double score) {
+		this.score = score;
+	}
 
 }

+ 7 - 0
src/main/java/cn/com/qmth/export/MyConsumer.java

@@ -77,9 +77,12 @@ public class MyConsumer extends Consumer<PaperExportDto> {
 
 			while (resultSet.next()) {
 				KdQuestion q = new KdQuestion();
+				q.setScore(1.0);
+				q.setHaveAudio(false);
 				q.setId(resultSet.getLong("id"));
 				q.setBody(disposeImg(resultSet.getString("topic"), courseCode));
 				q.setQst(YunkaiQuesStructType.getByYunKaiType(resultSet.getInt("question_type")));
+				q.setQuesStructType(QuesStructType.getQuesStructTypeById(q.getQst().getType()));
 				q.setDifficulty(YunkaiDifficulty.getByYunKaiType(resultSet.getInt("difficulty")));
 //				if (!q.getQst().isObjective()) {
 //					continue;
@@ -212,6 +215,7 @@ public class MyConsumer extends Consumer<PaperExportDto> {
 		}
 
 		for (KdQuestion q : qs) {
+			q.setQuesStructType(QuesStructType.getQuesStructTypeById(q.getQst().getType()));
 			if (YunkaiQuesStructType.DANXUAN.equals(q.getQst())) {
 				List<KdQuesOption> ops = new ArrayList<>();
 				q.setOptions(ops);
@@ -406,6 +410,8 @@ public class MyConsumer extends Consumer<PaperExportDto> {
 		}
 		String detailName = qt.getYunKaiDesc();
 		KdPaper paper = new KdPaper();
+		paper.setDetailCount(1);
+		paper.setUnitCount(qs.size());
 		paper.setTotalScore((double) qs.size());
 		paper.setName(dto.getPaperSuff() + detailName + "_" + indx);
 		paper.setCourseCode(dto.getCourseCode());
@@ -419,6 +425,7 @@ public class MyConsumer extends Consumer<PaperExportDto> {
 		des.add(d);
 		paper.setDetails(des);
 		paper.setDetailCount(1);
+		paper.setUnitCount(qs.size());
 		File paperdir = new File(paperDir + dto.getCourseCode() + "/" + qt.getYunKaiType() + "/");
 		paperdir.mkdirs();
 		try {

+ 77 - 0
src/main/java/cn/com/qmth/export/QuesStructType.java

@@ -0,0 +1,77 @@
+package cn.com.qmth.export;
+
+public enum QuesStructType {
+
+    /**
+     * 单选
+     */
+    SINGLE_ANSWER_QUESTION(1, "单选", true, false),
+    /**
+     * 多选
+     */
+    MULTIPLE_ANSWER_QUESTION(2, "多选", true, false),
+    /**
+     * 判断
+     */
+    BOOL_ANSWER_QUESTION(3, "判断", true, false),
+    /**
+     * 填空
+     */
+    FILL_BLANK_QUESTION(4, "填空", false, false),
+    /**
+     * 问答
+     */
+    TEXT_ANSWER_QUESTION(5, "问答", false, false),
+    /**
+     * 套题
+     */
+    NESTED_ANSWER_QUESTION(6, "套题", false, true);
+
+    private Integer id;
+    private String name;
+    private boolean objective;//是否是客观题
+    private boolean combline;//是否是组合题
+
+    QuesStructType(Integer id, String name, boolean objective, boolean combline) {
+        this.id = id;
+        this.name = name;
+        this.objective = objective;
+        this.combline = combline;
+    }
+
+    /**
+     * 通过ID获取试题类型
+     *
+     * @param id
+     * @return
+     */
+    public static QuesStructType getQuesStructTypeById(Integer id) {
+        for (QuesStructType type : QuesStructType.values()) {
+            if (id.equals(type.getId())) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean isObjective() {
+        return objective;
+    }
+
+    public boolean isCombline() {
+        return combline;
+    }
+
+    public String toString() {
+        return getName();
+    }
+
+}