|
@@ -1,10 +1,8 @@
|
|
|
package com.mooctest.controller;
|
|
|
|
|
|
+import com.mooctest.data.BugDTO;
|
|
|
import com.mooctest.data.TaskDTO;
|
|
|
-import com.mooctest.service.AnalyzeService;
|
|
|
-import com.mooctest.service.HistoryService;
|
|
|
-import com.mooctest.service.RecommendService;
|
|
|
-import com.mooctest.service.TaskService;
|
|
|
+import com.mooctest.service.*;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
@@ -19,6 +17,7 @@ import java.io.IOException;
|
|
|
import java.io.PrintWriter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -39,6 +38,10 @@ public class HistoryController {
|
|
|
@Autowired
|
|
|
RecommendService recservice;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ BugReportService bugReportService;
|
|
|
+
|
|
|
+
|
|
|
//获取指定节点的历史信息
|
|
|
// @RequestMapping(value = "/getHistory")
|
|
|
// @ResponseBody
|
|
@@ -81,47 +84,38 @@ public class HistoryController {
|
|
|
Model model){
|
|
|
String case_take_id = caseId+"-"+examId;
|
|
|
JSONObject result = new JSONObject(); // 用来存放树状结构信息的reuslt;
|
|
|
- List<String> all = hisservice.getTreeRoots(caseId+"-"+examId); // 获得所有的根结点的id
|
|
|
- TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
|
|
|
+ List<String> treeRootids = hisservice.getTreeRoots(caseId+"-"+examId); // 获得所有的根结点的id
|
|
|
+ TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId); // infomation of task
|
|
|
List<List<String>> list = new ArrayList<List<String>>();
|
|
|
- for(String id: all) {
|
|
|
+ for(String id: treeRootids) {
|
|
|
list.add(hisservice.getDetail(id));
|
|
|
} // 获得树的信息。
|
|
|
//获得每份报告的具体信息
|
|
|
|
|
|
-
|
|
|
- List<String> list_bugs = aservice.getValid(case_take_id); // 得到所有的bug报告
|
|
|
- System.out.println("all :"+all.size());
|
|
|
- System.out.println("list:"+list.size());
|
|
|
- System.out.println(list_bugs);
|
|
|
- List<String> res = list_bugs.stream().filter(s->all.contains(s)).collect(Collectors.toList());
|
|
|
- System.out.println(res.size());
|
|
|
- if(all.size()>=0){
|
|
|
- return "error";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- List<List<String>> lists = hisservice.getDepth(all.get(0));
|
|
|
- Set<String> filter = hisservice.filter(lists);
|
|
|
- result.put("path", new JSONArray(lists));
|
|
|
- result.put("invalid", new JSONArray(hisservice.getInvalid(filter)));
|
|
|
- List<String> ids = new ArrayList<String>(filter);
|
|
|
- result.put("score", new JSONArray(aservice.getScores(ids)));
|
|
|
- System.out.println("/getPath path = " + result);
|
|
|
- System.out.println("result.toString() = " + result.toString());
|
|
|
-
|
|
|
-
|
|
|
- model.addAttribute("master2BugIdsMap", all); //
|
|
|
- model.addAttribute("bugMap", all); //
|
|
|
+ //history 报告对应的report列表列
|
|
|
+ Map<String , List<String >> tree2BugIdsMap = hisservice.getTree2BugIdsMap(treeRootids);
|
|
|
+ Map<String, BugDTO> bugsMap = bugReportService.getAllBugsMap(examId, caseId); //得到所有bug的对应map
|
|
|
+
|
|
|
+// List<List<String>> lists = hisservice.getDepth(treeRootids.get(0));
|
|
|
+// Set<String> filter = hisservice.filter(lists);
|
|
|
+// result.put("path", new JSONArray(lists));
|
|
|
+// result.put("invalid", new JSONArray(hisservice.getInvalid(filter)));
|
|
|
+// List<String> ids = new ArrayList<String>(filter);
|
|
|
+// result.put("score", new JSONArray(aservice.getScores(ids)));
|
|
|
+// System.out.println("/getPath path = " + result);
|
|
|
+// System.out.println("result.toString() = " + result.toString());
|
|
|
+
|
|
|
+ model.addAttribute("master2BugIdsMap", tree2BugIdsMap); //
|
|
|
+ model.addAttribute("bugMap", bugsMap); //
|
|
|
model.addAttribute("examId", examId);
|
|
|
model.addAttribute("caseId", caseId);
|
|
|
model.addAttribute("task", task);
|
|
|
- model.addAttribute("aggNum", all.size());
|
|
|
+ model.addAttribute("aggNum", treeRootids.size()); //
|
|
|
return "tree_report_list";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@RequestMapping(value = "/getTrees2")
|
|
|
public String getTrees2(@RequestParam("case_take_id") String case_take_id) {
|
|
|
return "managerCheck";
|