|
@@ -93,7 +93,38 @@ public class HistoryController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ //学生获取所有形成树状结构的bug根节点
|
|
|
+ @RequestMapping(value = "/getTreesStu")
|
|
|
+ @ResponseBody
|
|
|
+ public void getTreesStu(String case_take_id, String start, String count, String page, HttpSession session, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+
|
|
|
+ List<String> all = hisservice.getTreeRoots(case_take_id);
|
|
|
+
|
|
|
+ hisservice.pageFilter(all, page);
|
|
|
+
|
|
|
+ hisservice.hotSortTree(all);
|
|
|
+
|
|
|
+ List<String> ids = all.subList(Integer.parseInt(start), Math.min(all.size(), Integer.parseInt(start) + Integer.parseInt(count)));
|
|
|
+ List<List<String>> list = new ArrayList<List<String>>();
|
|
|
+ for(String id: ids) {
|
|
|
+ list.add(hisservice.getDetail(id));
|
|
|
+ }
|
|
|
+ result.put("Count", all.size());
|
|
|
+ result.put("TreeRoot", new JSONArray(list));
|
|
|
+ out.print(result);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取所有单个节点的数据
|
|
|
@RequestMapping(value = "/getSingle")
|
|
|
@ResponseBody
|
|
@@ -102,16 +133,18 @@ public class HistoryController {
|
|
|
PrintWriter out = response.getWriter();
|
|
|
JSONObject result = new JSONObject();
|
|
|
List<String> all = new ArrayList<String>();
|
|
|
+ //获取所有root
|
|
|
for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
if(hisservice.getHistory(id).getChildren().size() == 0) {all.add(id);}
|
|
|
}
|
|
|
+ //根据三级页面筛选
|
|
|
hisservice.pageFilter(all, page);
|
|
|
+ //分页
|
|
|
List<String> ids = all.subList(Integer.parseInt(start), Math.min(all.size(), Integer.parseInt(start) + Integer.parseInt(count)));
|
|
|
List<String> invalid = hisservice.getInvalid(ids);
|
|
|
for(String id: invalid) {
|
|
|
if(ids.contains(id)) {ids.remove(id);}
|
|
|
}
|
|
|
-
|
|
|
List<List<String>> list = new ArrayList<List<String>>();
|
|
|
for(String id : ids) {
|
|
|
List<String> temp = new ArrayList<String>();
|
|
@@ -132,6 +165,51 @@ public class HistoryController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //学生获取所有单个节点的数据
|
|
|
+ @RequestMapping(value = "/getSingleStu")
|
|
|
+ @ResponseBody
|
|
|
+ public void getSingleStu(String case_take_id, String start, String count, String page, HttpSession session, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ List<String> all = new ArrayList<String>();
|
|
|
+ //获取所有root
|
|
|
+ for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
+ if(hisservice.getHistory(id).getChildren().size() == 0) {all.add(id);}
|
|
|
+ }
|
|
|
+ //根据三级页面筛选
|
|
|
+ hisservice.pageFilter(all, page);
|
|
|
+
|
|
|
+ //根据热度排序
|
|
|
+ hisservice.hotSortSingle(all);
|
|
|
+
|
|
|
+ //分页
|
|
|
+ List<String> ids = all.subList(Integer.parseInt(start), Math.min(all.size(), Integer.parseInt(start) + Integer.parseInt(count)));
|
|
|
+ List<String> invalid = hisservice.getInvalid(ids);
|
|
|
+ for(String id: invalid) {
|
|
|
+ if(ids.contains(id)) {ids.remove(id);}
|
|
|
+ }
|
|
|
+ //判断是否已被评分
|
|
|
+ List<List<String>> list = new ArrayList<List<String>>();
|
|
|
+ for(String id : ids) {
|
|
|
+ List<String> temp = new ArrayList<String>();
|
|
|
+ temp.add(id);
|
|
|
+ int score = aservice.getGrade(id);
|
|
|
+ if(score != -1) {temp.add("true");}
|
|
|
+ else {temp.add("false");}
|
|
|
+ temp.add(recservice.getTitle(id));
|
|
|
+ list.add(temp);
|
|
|
+ }
|
|
|
+ result.put("Count", all.size());
|
|
|
+ result.put("TreeRoot", new JSONArray(list));
|
|
|
+ out.print(result);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//获取指定bug的所有路径
|
|
|
@RequestMapping(value = "/getPath")
|