|
@@ -1,5 +1,25 @@
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.PrintWriter;
|
|
|
|
+import java.util.LinkedList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
|
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
+
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.google.gson.GsonBuilder;
|
|
|
|
+
|
|
import cn.com.qmth.stmms.admin.utils.SessionExamUtils;
|
|
import cn.com.qmth.stmms.admin.utils.SessionExamUtils;
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
@@ -9,17 +29,7 @@ import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
|
|
import cn.com.qmth.stmms.common.controller.BaseController;
|
|
import cn.com.qmth.stmms.common.controller.BaseController;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.enums.ExamType;
|
|
import cn.com.qmth.stmms.common.enums.ExamType;
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import java.util.LinkedList;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import net.sf.json.JSONObject;
|
|
|
|
|
|
public class BaseExamController extends BaseController {
|
|
public class BaseExamController extends BaseController {
|
|
|
|
|
|
@@ -34,6 +44,24 @@ public class BaseExamController extends BaseController {
|
|
protected Integer getSessionExamId(HttpServletRequest request) {
|
|
protected Integer getSessionExamId(HttpServletRequest request) {
|
|
return SessionExamUtils.getExamId(request);
|
|
return SessionExamUtils.getExamId(request);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ protected void errMessage(String message, HttpServletResponse response) {
|
|
|
|
+ response.setContentType("application/json;charset=utf-8");
|
|
|
|
+ response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
|
|
|
+ PrintWriter writer = null;
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
+ obj.accumulate("message", message);
|
|
|
|
+ try {
|
|
|
|
+ writer = response.getWriter();
|
|
|
|
+ writer.write(obj.toString());
|
|
|
|
+
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ } finally {
|
|
|
|
+ IOUtils.closeQuietly(writer);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加Flash消息
|
|
* 添加Flash消息
|