|
@@ -5,12 +5,15 @@ import java.io.PrintWriter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
import edu.nju.entities.Bug;
|
|
|
import edu.nju.entities.BugHistory;
|
|
|
+import edu.nju.service.ReportService;
|
|
|
+import edu.nju.util.TimeUtil;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -34,6 +37,9 @@ public class HistoryController {
|
|
|
|
|
|
@Autowired
|
|
|
RecommendService recservice;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ReportService reportService;
|
|
|
|
|
|
//获取指定节点的历史信息
|
|
|
@RequestMapping(value = "/getHistory")
|
|
@@ -148,7 +154,7 @@ public class HistoryController {
|
|
|
//三级页面筛选,单个节点筛选(没有parent,也没有children)
|
|
|
for(String id : hisservice.getBugIdListByPage(case_take_id,page,start,count)) {
|
|
|
BugHistory bugHistory=hisservice.getHistory(id);
|
|
|
- if(bugHistory.getChildren().size() == 0&&bugHistory.getParent().equals("null")) {all.add(id);}
|
|
|
+ if(bugHistory==null || bugHistory.getChildren().size() == 0&&bugHistory.getParent().equals("null")) {all.add(id);}
|
|
|
}
|
|
|
//根据三级页面筛选
|
|
|
//分页
|
|
@@ -179,6 +185,44 @@ public class HistoryController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //获取所有单个节点的数据
|
|
|
+ @RequestMapping(value = "/getAll")
|
|
|
+ @ResponseBody
|
|
|
+ public void getAll(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.getBugIdListByPage(case_take_id,page,start,count).stream().collect(Collectors.toList());
|
|
|
+ //分页
|
|
|
+ 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");}
|
|
|
+ Bug bug = reportService.findBugById(id);
|
|
|
+ temp.add(bug.getTitle());
|
|
|
+ temp.add(TimeUtil.timeStamp2Date(bug.getCreate_time_millis()));
|
|
|
+ list.add(temp);
|
|
|
+ }
|
|
|
+ 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 = "/getSingleStu")
|
|
|
@ResponseBody
|