|
@@ -9,6 +9,8 @@ import java.util.Set;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
+import edu.nju.entities.Bug;
|
|
|
+import edu.nju.entities.BugHistory;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -133,14 +135,27 @@ 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);}
|
|
|
+//// 获取所有单个节点
|
|
|
+//// for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
+//// if(hisservice.getHistory(id).getChildren().size() == 0) {all.add(id);}
|
|
|
+//// }
|
|
|
+// //三级页面筛选,单个节点筛选
|
|
|
+// for(String id : hisservice.getBugIdListByPage(case_take_id,page,start,count)) {
|
|
|
+// if(hisservice.getHistory(id).getChildren().size() == 0) {all.add(id);}
|
|
|
+// }
|
|
|
+// //根据三级页面筛选
|
|
|
+//// hisservice.pageFilter(all, page);
|
|
|
+////
|
|
|
+
|
|
|
+ //三级页面筛选,单个节点筛选(没有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);}
|
|
|
}
|
|
|
//根据三级页面筛选
|
|
|
- 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);}
|
|
@@ -174,18 +189,32 @@ 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);
|
|
|
+// //获取所有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)));
|
|
|
|
|
|
- //根据热度排序
|
|
|
+
|
|
|
+ //三级页面筛选,单个节点筛选(没有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);}
|
|
|
+ }
|
|
|
+ //根据热度排序,热度低的排在前面
|
|
|
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);}
|
|
@@ -249,23 +278,43 @@ public class HistoryController {
|
|
|
PrintWriter out = response.getWriter();
|
|
|
JSONObject result = new JSONObject();
|
|
|
List<String> all = new ArrayList<String>();
|
|
|
- for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
- //根据是否有子bug判断是否是单节点
|
|
|
- if(hisservice.getHistory(id).getChildren().size() == 0) {
|
|
|
- //判断是否满足条件
|
|
|
- int score = aservice.getGrade(id);
|
|
|
+// for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
+// //根据是否有子bug判断是否是单节点
|
|
|
+// if(hisservice.getHistory(id).getChildren().size() == 0) {
|
|
|
+// //判断是否满足条件
|
|
|
+// int score = aservice.getGrade(id);
|
|
|
+// if(score != -1) {
|
|
|
+// bugCondition="true";
|
|
|
+// }
|
|
|
+// else {bugCondition="false";}
|
|
|
+// if(bugCondition.equals(condition)){
|
|
|
+// all.add(id);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// hisservice.pageFilter(all, page);
|
|
|
+//
|
|
|
+
|
|
|
+ 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")) {
|
|
|
+ int score = aservice.getGrade(id);
|
|
|
if(score != -1) {
|
|
|
bugCondition="true";
|
|
|
}
|
|
|
else {bugCondition="false";}
|
|
|
- if(bugCondition.equals(condition)){
|
|
|
- all.add(id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- hisservice.pageFilter(all, page);
|
|
|
+ if(bugCondition.equals(condition)) {
|
|
|
+ all.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ hisservice.hotSortSingle(all);
|
|
|
+
|
|
|
+ List<String> ids = all.subList(Integer.parseInt(start), Math.min(all.size(), Integer.parseInt(start) + Integer.parseInt(count)));
|
|
|
+
|
|
|
+ //根据热度排序,热度低的排在前面
|
|
|
|
|
|
- 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);}
|
|
@@ -290,4 +339,21 @@ public class HistoryController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping(value = "/test")
|
|
|
+ @ResponseBody
|
|
|
+ public void getBugByPage(String case_take_id, String start, String count, String page, HttpSession session, HttpServletResponse response){
|
|
|
+ List<String> bugList=hisservice.getBugIdListByPage(case_take_id,page,start,count);
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("Count",bugList.size());
|
|
|
+ result.put("TreeRoot", new JSONArray(bugList));
|
|
|
+ out.print(result);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ }catch (IOException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|