@RequestMapping(value = "addAnswerSheet4Test", method = RequestMethod.GET) public @ResponseBody Message addAnswerSheet4Test(Model model) throws JsonProcessingException, IOException { Message msg = new Message(); AnswerSheet as = new AnswerSheet(); as.setExamPaperId(2); ObjectMapper om = new ObjectMapper(); qmqpTemplate.convertAndSend(Constants.ANSWERSHEET_DATA_QUEUE, om.writeValueAsBytes(as)); return msg; }
/** * 阅卷 * * @param answerSheet * @return */ @RequestMapping(value = "/admin/exam/answersheet", method = RequestMethod.POST) public @ResponseBody Message submitAnswerSheet(@RequestBody AnswerSheet answerSheet) { Gson gson = new Gson(); float score = 0f; for (AnswerSheetItem item : answerSheet.getAnswerSheetItems()) { score += item.getPoint(); // TO-DO:模拟考试是否要记录主观题的历史? } answerSheet.setPointRaw(score); examService.updateUserExamHist(answerSheet, gson.toJson(answerSheet), 3); return new Message(); }