|
@@ -161,9 +161,8 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
|
|
|
return ;
|
|
|
}
|
|
|
try {
|
|
|
- String structJson = new String(ossUtil.download(false, ep.getStructPath()), StandardCharsets.UTF_8);
|
|
|
String answerjson = new String(ossUtil.download(false, ep.getAnswerPath()), StandardCharsets.UTF_8);
|
|
|
- Map<String, ObjectiveAnswerCacheBean> map=buildObjectiveAnswerCache(structJson, answerjson);
|
|
|
+ Map<String, ObjectiveAnswerCacheBean> map=buildObjectiveAnswerCache(answerjson);
|
|
|
ObjectiveAnswerCacheUtil.saveObjectiveAnswerCache(examId, paperId, map);
|
|
|
ObjectiveAnswerCacheUtil.expireObjectiveAnswerCache(examId, timeOutHours);
|
|
|
} catch (Exception e) {
|
|
@@ -187,9 +186,8 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
|
|
|
return map;
|
|
|
}
|
|
|
try {
|
|
|
- String structJson = new String(ossUtil.download(false, ep.getStructPath()), StandardCharsets.UTF_8);
|
|
|
String answerjson = new String(ossUtil.download(false, ep.getAnswerPath()), StandardCharsets.UTF_8);
|
|
|
- map=buildObjectiveAnswerCache(structJson, answerjson);
|
|
|
+ map=buildObjectiveAnswerCache(answerjson);
|
|
|
ObjectiveAnswerCacheUtil.saveObjectiveAnswerCache(examId, paperId, map);
|
|
|
ObjectiveAnswerCacheUtil.expireObjectiveAnswerCache(examId, objectiveAnswerCacheTimeOutHours);
|
|
|
return map;
|
|
@@ -199,22 +197,18 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Map<String, ObjectiveAnswerCacheBean> buildObjectiveAnswerCache(String structStr, String answerStr) {
|
|
|
+ private Map<String, ObjectiveAnswerCacheBean> buildObjectiveAnswerCache(String answerStr) {
|
|
|
Map<String, ObjectiveAnswerCacheBean> map = new HashMap<String, ObjectiveAnswerCacheBean>();
|
|
|
JSONObject answerJson = JSONObject.parseObject(answerStr);
|
|
|
JSONArray answerdetails = answerJson.getJSONArray("details");
|
|
|
- JSONObject structJson = JSONObject.parseObject(structStr);
|
|
|
- JSONArray structdetails = structJson.getJSONArray("details");
|
|
|
for (int i = 0; i < answerdetails.size(); i++) {
|
|
|
Integer mainNum = answerdetails.getJSONObject(i).getInteger("number");
|
|
|
JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
|
|
|
- JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
|
|
|
for (int j = 0; j < answerdetailquestions.size(); j++) {
|
|
|
JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
|
|
|
- JSONObject structquestion = structdetailquestions.getJSONObject(j);
|
|
|
- Integer subNum = structquestion.getInteger("number");
|
|
|
- Double score = structquestion.getDouble("score");
|
|
|
- Integer structType = structquestion.getInteger("structType");
|
|
|
+ Integer subNum = answerquestion.getInteger("number");
|
|
|
+ Double score = answerquestion.getDouble("score");
|
|
|
+ Integer structType = answerquestion.getInteger("structType");
|
|
|
if (structType.intValue() == 1 || structType.intValue() == 2 || structType.intValue() == 3) {
|
|
|
ObjectiveAnswerCacheBean bean = new ObjectiveAnswerCacheBean();
|
|
|
bean.setScore(score);
|
|
@@ -231,13 +225,11 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
|
|
|
}
|
|
|
if (structType.intValue() == 6) {
|
|
|
JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
|
|
|
- JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
|
|
|
for (int k = 0; k < answersubQuestions.size(); k++) {
|
|
|
JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
|
|
|
- JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
|
|
|
- Integer subIndex = structsubquestion.getInteger("number");
|
|
|
- Double subScore = structsubquestion.getDouble("score");
|
|
|
- Integer subStructType = structsubquestion.getInteger("structType");
|
|
|
+ Integer subIndex = answersubquestion.getInteger("number");
|
|
|
+ Double subScore = answersubquestion.getDouble("score");
|
|
|
+ Integer subStructType = answersubquestion.getInteger("structType");
|
|
|
|
|
|
if (subStructType.intValue() == 1 || subStructType.intValue() == 2
|
|
|
|| subStructType.intValue() == 3) {
|