|
@@ -1,11 +1,15 @@
|
|
|
package cn.com.qmth.stmms.api.controller;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
@@ -24,11 +28,10 @@ import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
|
import cn.com.qmth.stmms.biz.exam.query.ExamSearchQuery;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
|
+import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
|
|
|
import cn.com.qmth.stmms.biz.user.model.User;
|
|
|
import cn.com.qmth.stmms.common.utils.DateUtils;
|
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
|
|
|
@Controller("examInfoApiController")
|
|
|
@RequestMapping("/api")
|
|
@@ -139,4 +142,25 @@ public class ExamInfoController extends BaseApiController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @AuthValidate("adminUser")
|
|
|
+ @RequestMapping(value = "/sliceConfig/{examId}", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public boolean updateSliceConfig(HttpServletRequest request, @PathVariable Integer examId,
|
|
|
+ @RequestBody PictureConfigItem[] configs) {
|
|
|
+ User user = RequestUtils.getApiUser(request);
|
|
|
+ Exam exam = examService.findById(examId);
|
|
|
+ boolean success = false;
|
|
|
+ if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
|
+ if (configs != null && configs.length > 0) {
|
|
|
+ examService.updateSliceConfig(examId, Arrays.asList(configs));
|
|
|
+ success = true;
|
|
|
+ } else {
|
|
|
+ success = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
|
+ }
|
|
|
+ return success;
|
|
|
+ }
|
|
|
}
|