|
@@ -1,18 +1,14 @@
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Map.Entry;
|
|
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
-import net.sf.json.JSONArray;
|
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -26,16 +22,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
-import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
import cn.com.qmth.stmms.admin.utils.PageUtil;
|
|
import cn.com.qmth.stmms.admin.utils.PageUtil;
|
|
import cn.com.qmth.stmms.admin.vo.InspectedStudentVO;
|
|
import cn.com.qmth.stmms.admin.vo.InspectedStudentVO;
|
|
-import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ImportQuery;
|
|
import cn.com.qmth.stmms.biz.exam.model.ImportQuery;
|
|
-import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.SubjectiveScore;
|
|
|
|
import cn.com.qmth.stmms.biz.exam.query.ExamStudentSearchQuery;
|
|
import cn.com.qmth.stmms.biz.exam.query.ExamStudentSearchQuery;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
@@ -43,10 +35,8 @@ import cn.com.qmth.stmms.biz.exam.service.ImportQueryService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.SubjectiveScoreService;
|
|
import cn.com.qmth.stmms.biz.exam.service.SubjectiveScoreService;
|
|
import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
-import cn.com.qmth.stmms.biz.mark.service.MarkSpecialTagService;
|
|
|
|
-import cn.com.qmth.stmms.biz.mark.service.MarkTrackService;
|
|
|
|
-import cn.com.qmth.stmms.biz.utils.OriginTag;
|
|
|
|
-import cn.com.qmth.stmms.biz.utils.PictureTag;
|
|
|
|
|
|
+import cn.com.qmth.stmms.biz.mark.model.Task;
|
|
|
|
+import cn.com.qmth.stmms.biz.mark.service.TaskService;
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.enums.ImportType;
|
|
import cn.com.qmth.stmms.common.enums.ImportType;
|
|
@@ -55,8 +45,6 @@ import cn.com.qmth.stmms.common.utils.ExportExcel;
|
|
import cn.com.qmth.stmms.common.utils.ImportExcel;
|
|
import cn.com.qmth.stmms.common.utils.ImportExcel;
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
@Controller("importQueryController")
|
|
@Controller("importQueryController")
|
|
@@ -84,10 +72,7 @@ public class ImportQueryController extends BaseExamController {
|
|
private ExamQuestionService questionService;
|
|
private ExamQuestionService questionService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private MarkTrackService markTrackService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private MarkSpecialTagService markSpecialTagService;
|
|
|
|
|
|
+ private TaskService taskService;
|
|
|
|
|
|
@RequestMapping("/list")
|
|
@RequestMapping("/list")
|
|
public String list(Model model, HttpServletRequest request, ExamStudentSearchQuery query) {
|
|
public String list(Model model, HttpServletRequest request, ExamStudentSearchQuery query) {
|
|
@@ -213,100 +198,60 @@ public class ImportQueryController extends BaseExamController {
|
|
|
|
|
|
@RequestMapping("/start")
|
|
@RequestMapping("/start")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public ModelAndView start(HttpServletRequest request) {
|
|
|
|
|
|
+ public JSONObject start(HttpServletRequest request, @RequestParam(required = false) Integer studentId) {
|
|
int examId = getSessionExamId(request);
|
|
int examId = getSessionExamId(request);
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
- ImportQuery importQuery = queryService.findByExamIdAndUserIdAndType(examId, wu.getId(), ImportType.INSPECTED);
|
|
|
|
- int inspectCount = 0;
|
|
|
|
- if (importQuery != null) {
|
|
|
|
- inspectCount = importQuery.getStudentCodeList().size() > 0 ? 0 : importQuery.getStudentIdList().size();
|
|
|
|
|
|
+ List<Integer> ids = new ArrayList<Integer>();
|
|
|
|
+ if (studentId != null) {
|
|
|
|
+ ids.add(studentId);
|
|
|
|
+ } else {
|
|
|
|
+ ImportQuery importQuery = queryService.findByExamIdAndUserIdAndType(examId, wu.getId(),
|
|
|
|
+ ImportType.INSPECTED);
|
|
|
|
+ ids.addAll(importQuery.getStudentIdList());
|
|
}
|
|
}
|
|
- ModelAndView view = new ModelAndView("modules/exam/inspectedImport");
|
|
|
|
- view.addObject("inspectCount", inspectCount);
|
|
|
|
- view.addObject("fileServer", fileService.getFileServer());
|
|
|
|
- view.addObject("ids", inspectCount > 0 ? importQuery.getStudentIdString() : "");
|
|
|
|
- view.addObject("message", inspectCount > 0 ? "" : "没有待复核的任务");
|
|
|
|
- return view;
|
|
|
|
|
|
+ JSONObject setting = new JSONObject();
|
|
|
|
+ setting.accumulate("inspectCount", ids.size());
|
|
|
|
+ setting.accumulate("fileServer", fileService.getFileServer());
|
|
|
|
+ setting.accumulate("ids", ids);
|
|
|
|
+ setting.accumulate("message", ids.size() > 0 ? "" : "没有待复核的任务");
|
|
|
|
+ return setting;
|
|
}
|
|
}
|
|
|
|
|
|
- @RequestMapping("/startById")
|
|
|
|
- public ModelAndView startById(HttpServletRequest request, RedirectAttributes redirectAttributes,
|
|
|
|
- @RequestParam Integer studentId) {
|
|
|
|
- ModelAndView view = new ModelAndView("modules/exam/inspectedImport");
|
|
|
|
- List<Integer> ids = new ArrayList<Integer>();
|
|
|
|
- ids.add(studentId);
|
|
|
|
- view.addObject("inspectCount", ids.size());
|
|
|
|
- view.addObject("fileServer", fileService.getFileServer());
|
|
|
|
- view.addObject("ids", StringUtils.join(ids, ","));
|
|
|
|
- view.addObject("studentId", studentId);
|
|
|
|
- return view;
|
|
|
|
|
|
+ @RequestMapping("/getTask")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public Task info(HttpServletRequest request, @RequestParam Integer studentId) {
|
|
|
|
+ ExamStudent student = studentService.findById(studentId);
|
|
|
|
+ Task task = null;
|
|
|
|
+ if (student != null) {
|
|
|
|
+ task = taskService.build(student);
|
|
|
|
+ }
|
|
|
|
+ return task;
|
|
}
|
|
}
|
|
|
|
|
|
- @RequestMapping("/info")
|
|
|
|
|
|
+ @RequestMapping("/tag")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public Object info(HttpServletRequest request, @RequestParam Integer studentId) {
|
|
|
|
|
|
+ public Object tag(HttpServletRequest request, @RequestParam Integer studentId, @RequestParam boolean isTag) {
|
|
ExamStudent student = studentService.findById(studentId);
|
|
ExamStudent student = studentService.findById(studentId);
|
|
- JSONObject result = new JSONObject();
|
|
|
|
- result.accumulate("id", student.getId());
|
|
|
|
- result.accumulate("secretNumber", student.getSecretNumber());
|
|
|
|
- result.accumulate("studentCode", student.getStudentCode());
|
|
|
|
- result.accumulate("name", student.getName());
|
|
|
|
- result.accumulate("subjectCode", student.getSubjectCode());
|
|
|
|
- result.accumulate("subjectName", student.getSubjectName());
|
|
|
|
- result.accumulate("totalScore", student.getTotalScore());
|
|
|
|
- result.accumulate("upload", student.isUpload());
|
|
|
|
- result.accumulate("absent", student.isAbsent());
|
|
|
|
- result.accumulate("breach", student.isBreach());
|
|
|
|
- List<MarkGroup> groups = groupService.findByExamAndSubject(student.getExamId(), student.getSubjectCode());
|
|
|
|
- JSONArray groupArray = new JSONArray();
|
|
|
|
- Map<Integer, String> mainTitleMap = new HashMap<Integer, String>();
|
|
|
|
- for (MarkGroup markGroup : groups) {
|
|
|
|
- JSONObject group = new JSONObject();
|
|
|
|
- group.accumulate("groupNumber", markGroup.getNumber());
|
|
|
|
- List<SubjectiveScore> scores = scoreService.findByStudentIdAndGroupNumber(student.getId(),
|
|
|
|
- markGroup.getNumber());
|
|
|
|
- JSONArray array = new JSONArray();
|
|
|
|
- for (SubjectiveScore scoreItem : scores) {
|
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
|
- String mainTitle = mainTitleMap.get(scoreItem.getMainNumber());
|
|
|
|
- if (mainTitle == null) {
|
|
|
|
- ExamQuestion q = questionService.findByExamAndSubjectAndObjectiveAndMainNumberAndSubNumber(
|
|
|
|
- student.getExamId(), student.getSubjectCode(), false, scoreItem.getMainNumber(),
|
|
|
|
- scoreItem.getSubNumber());
|
|
|
|
- mainTitleMap.put(scoreItem.getMainNumber(), mainTitle);
|
|
|
|
- mainTitle = q.getMainTitle();
|
|
|
|
- }
|
|
|
|
- obj.accumulate("mainTitle", mainTitle);
|
|
|
|
- obj.accumulate("questionNumber", scoreItem.getMainNumber() + "-" + scoreItem.getSubNumber());
|
|
|
|
- obj.accumulate("score", scoreItem.getScore());
|
|
|
|
- array.add(obj);
|
|
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
+ if (student != null) {
|
|
|
|
+ int examId = getSessionExamId(request);
|
|
|
|
+ WebUser wu = RequestUtils.getWebUser(request);
|
|
|
|
+ ImportQuery importQuery = queryService.findByExamIdAndUserIdAndType(examId, wu.getId(),
|
|
|
|
+ ImportType.INSPECTED);
|
|
|
|
+ List<Integer> ids = importQuery.getTagIdList();
|
|
|
|
+ if (isTag && !ids.contains(studentId)) {
|
|
|
|
+ ids.add(studentId);
|
|
}
|
|
}
|
|
- group.accumulate("questions", array);
|
|
|
|
- groupArray.add(group);
|
|
|
|
- }
|
|
|
|
- result.accumulate("groups", groupArray);
|
|
|
|
- List<String> picUrls = fileService.getSheetUris(student.getExamId(), student.getExamNumber(), 1,
|
|
|
|
- student.getSheetCount());
|
|
|
|
- result.accumulate("picUrls", picUrls);
|
|
|
|
- Map<Integer, List<PictureTag>> maps = studentService.buildSheetTags(student, false);
|
|
|
|
- List<OriginTag> tags = new ArrayList<OriginTag>();
|
|
|
|
- for (Entry<Integer, List<PictureTag>> entry : maps.entrySet()) {
|
|
|
|
- List<PictureTag> pictureTags = entry.getValue();
|
|
|
|
- for (PictureTag pictureTag : pictureTags) {
|
|
|
|
- if (pictureTag.getContent().length == 1) {
|
|
|
|
- tags.add(new OriginTag(pictureTag.getContent()[0], entry.getKey(), pictureTag.getLeft(), pictureTag
|
|
|
|
- .getTop()));
|
|
|
|
- }
|
|
|
|
|
|
+ if (!isTag && ids.contains(studentId)) {
|
|
|
|
+ ids.remove(studentId);
|
|
}
|
|
}
|
|
|
|
+ importQuery.buildTag(ids);
|
|
|
|
+ queryService.save(importQuery);
|
|
|
|
+ obj.accumulate("success", true);
|
|
|
|
+ } else {
|
|
|
|
+ obj.accumulate("success", false);
|
|
|
|
+ obj.accumulate("message", "无法复核,请刷新页面");
|
|
}
|
|
}
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
|
- try {
|
|
|
|
- result.accumulate("tags", mapper.writeValueAsString(tags));
|
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.error("MarkTrackController-轨迹坐标获取出错", e);
|
|
|
|
- }
|
|
|
|
- result.accumulate("success", true);
|
|
|
|
- return result;
|
|
|
|
|
|
+ return obj;
|
|
}
|
|
}
|
|
}
|
|
}
|