|
@@ -19,7 +19,7 @@ public class PaperJsonUtils {
|
|
|
public static final String ID = "id";
|
|
|
|
|
|
public static final String[] answerArray = new String[] { "#", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
|
|
|
- "K", "L" };
|
|
|
+ "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
|
|
|
|
|
|
public static Map<Boolean, List<ExamQuestion>> toSubject(ExamSubject subject, String text) {
|
|
|
JSONObject paperJson = JSONObject.fromObject(text);
|
|
@@ -41,7 +41,6 @@ public class PaperJsonUtils {
|
|
|
ExamQuestion q = new ExamQuestion();
|
|
|
q.setExamId(subject.getExamId());
|
|
|
q.setSubjectCode(subject.getCode());
|
|
|
- q.setPaperType("#");
|
|
|
q.setMainNumber(mainNumber);
|
|
|
String subNumber = sub.getString("number") + "-" + question.getString("number");
|
|
|
q.setSubNumber(subNumber);
|
|
@@ -52,17 +51,22 @@ public class PaperJsonUtils {
|
|
|
int structType = question.getInt("structType");
|
|
|
if (structType == 1 || structType == 2 || structType == 3) {
|
|
|
q.setObjective(true);
|
|
|
+ q.setPaperType("#");
|
|
|
String answer = "";
|
|
|
- Object listArray = question.get("answer");
|
|
|
- if (listArray instanceof JSONArray) {
|
|
|
- JSONArray jsonArray = (JSONArray) listArray;
|
|
|
- for (int l = 0; l < jsonArray.size(); l++) {
|
|
|
- int index = jsonArray.getInt(l);
|
|
|
- answer = answer + answerArray[index];
|
|
|
+ if (structType == 3) {
|
|
|
+ answer = question.getBoolean("answer") ? "A" : "B";
|
|
|
+ } else {
|
|
|
+ Object listArray = question.get("answer");
|
|
|
+ if (listArray instanceof JSONArray) {
|
|
|
+ JSONArray jsonArray = (JSONArray) listArray;
|
|
|
+ for (int l = 0; l < jsonArray.size(); l++) {
|
|
|
+ int index = jsonArray.getInt(l);
|
|
|
+ answer = answer + answerArray[index];
|
|
|
+ }
|
|
|
+ } else if (listArray instanceof JSONObject) {
|
|
|
+ int index = question.getInt("answer");
|
|
|
+ answer = answerArray[index];
|
|
|
}
|
|
|
- } else if (listArray instanceof JSONObject) {
|
|
|
- int index = question.getInt("answer");
|
|
|
- answer = answerArray[index];
|
|
|
}
|
|
|
q.setAnswer(answer);
|
|
|
olist.add(q);
|
|
@@ -75,7 +79,6 @@ public class PaperJsonUtils {
|
|
|
ExamQuestion q = new ExamQuestion();
|
|
|
q.setExamId(subject.getExamId());
|
|
|
q.setSubjectCode(subject.getCode());
|
|
|
- q.setPaperType("#");
|
|
|
q.setMainNumber(mainNumber);
|
|
|
String subNumber = sub.getString("number");
|
|
|
q.setSubNumber(subNumber);
|
|
@@ -86,17 +89,22 @@ public class PaperJsonUtils {
|
|
|
int structType = sub.getInt("structType");
|
|
|
if (structType == 1 || structType == 2 || structType == 3) {
|
|
|
q.setObjective(true);
|
|
|
+ q.setPaperType("#");
|
|
|
String answer = "";
|
|
|
- Object listArray = sub.get("answer");
|
|
|
- if (listArray instanceof JSONArray) {
|
|
|
- JSONArray jsonArray = (JSONArray) listArray;
|
|
|
- for (int l = 0; l < jsonArray.size(); l++) {
|
|
|
- int index = jsonArray.getInt(l);
|
|
|
- answer = answer + answerArray[index];
|
|
|
+ if (structType == 3) {
|
|
|
+ answer = sub.getBoolean("answer") ? "A" : "B";
|
|
|
+ } else {
|
|
|
+ Object listArray = sub.get("answer");
|
|
|
+ if (listArray instanceof JSONArray) {
|
|
|
+ JSONArray jsonArray = (JSONArray) listArray;
|
|
|
+ for (int l = 0; l < jsonArray.size(); l++) {
|
|
|
+ int index = jsonArray.getInt(l);
|
|
|
+ answer = answer + answerArray[index];
|
|
|
+ }
|
|
|
+ } else if (listArray instanceof JSONObject) {
|
|
|
+ int index = sub.getInt("answer");
|
|
|
+ answer = answerArray[index];
|
|
|
}
|
|
|
- } else if (listArray instanceof JSONObject) {
|
|
|
- int index = sub.getInt("answer");
|
|
|
- answer = answerArray[index];
|
|
|
}
|
|
|
q.setAnswer(answer);
|
|
|
olist.add(q);
|