|
@@ -161,4 +161,55 @@ public class HistoryController {
|
|
|
if(session.getAttribute("trees") != null) {session.removeAttribute("trees");}
|
|
|
if(session.getAttribute("single") != null) {session.removeAttribute("single");}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getSingleByCondition")
|
|
|
+ @ResponseBody
|
|
|
+ public void getSingleByCondition(String case_take_id, String start, String count, String page,String condition, HttpSession session, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ String bugCondition="";
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ List<String> all = new ArrayList<String>();
|
|
|
+ for(String id : hisservice.getRoots(case_take_id)) {
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ temp.add(condition);
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|