|
@@ -15,6 +15,7 @@ import cn.com.qmth.stmms.biz.mark.service.MarkTrackService;
|
|
|
import cn.com.qmth.stmms.biz.utils.OriginTag;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
+
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -25,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -64,20 +68,28 @@ public class MarkTrackController extends BaseExamController {
|
|
|
view.addObject("fileServer", fileService.getFileServer());
|
|
|
ExamStudent student = studentService.findById(studentId);
|
|
|
if (student != null && student.isUpload()) {
|
|
|
- List<String> sliceUrls = fileService
|
|
|
- .getSliceUris(student.getExamId(), student.getSecretNumber(), 1, student.getSliceCount());
|
|
|
+ List<String> sliceUrls = fileService.getSliceUris(student.getExamId(), student.getSecretNumber(), 1,
|
|
|
+ student.getSliceCount());
|
|
|
view.addObject("urls", StringUtils.join(sliceUrls, ","));
|
|
|
|
|
|
- JSONArray result = new JSONArray();
|
|
|
+ // JSONArray result = new JSONArray();
|
|
|
Map<MarkGroup, List<OriginTag>> maps = studentService.getSliceTags(student, false);
|
|
|
+ List<OriginTag> tags = new ArrayList<OriginTag>();
|
|
|
for (Entry<MarkGroup, List<OriginTag>> entry : maps.entrySet()) {
|
|
|
- MarkGroup group = entry.getKey();
|
|
|
- JSONObject item = new JSONObject();
|
|
|
- item.accumulate("config", group.getPictureConfigList());
|
|
|
- item.accumulate("tags", entry.getValue());
|
|
|
- result.add(item);
|
|
|
+ // MarkGroup group = entry.getKey();
|
|
|
+ // JSONObject item = new JSONObject();
|
|
|
+ // item.accumulate("config", group.getPictureConfigList());
|
|
|
+ // item.accumulate("tags", entry.getValue());
|
|
|
+ // result.add(item);
|
|
|
+ tags.addAll(entry.getValue());
|
|
|
+ }
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ try {
|
|
|
+ view.addObject("tags", mapper.writeValueAsString(tags));
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("MarkTrackController-轨迹坐标获取出错", e);
|
|
|
}
|
|
|
- view.addObject("tags", result.toString());
|
|
|
}
|
|
|
return view;
|
|
|
}
|
|
@@ -121,11 +133,10 @@ public class MarkTrackController extends BaseExamController {
|
|
|
private HashMap<String, Object> set(MarkLibrary library, ExamStudent student) {
|
|
|
HashMap<String, Object> groups = new HashMap<String, Object>();
|
|
|
MarkGroup group = groupService.findOne(student.getExamId(), student.getSubjectCode(), library.getGroupNumber());
|
|
|
- group.setQuestionList(questionService
|
|
|
- .findByExamAndSubjectAndObjectiveAndGroupNumber(student.getExamId(), student.getSubjectCode(), false,
|
|
|
- group.getNumber()));
|
|
|
- List<String> picUrls = fileService
|
|
|
- .getSliceUris(student.getExamId(), student.getSecretNumber(), 1, student.getSliceCount());
|
|
|
+ group.setQuestionList(questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(student.getExamId(),
|
|
|
+ student.getSubjectCode(), false, group.getNumber()));
|
|
|
+ List<String> picUrls = fileService.getSliceUris(student.getExamId(), student.getSecretNumber(), 1,
|
|
|
+ student.getSliceCount());
|
|
|
List<MarkTrack> markTracks = markTrackService.findByLibraryId(library.getId());
|
|
|
List<MarkSpecialTag> markSpecialTagList = markSpecialTagService.findByLibraryId(library.getId());
|
|
|
groups.put("picUrls", picUrls);
|