|
@@ -131,26 +131,35 @@ public class ExtraService {
|
|
|
public JSONArray getExamList() {
|
|
|
List<Exam> result = examDao.findAll();
|
|
|
JSONArray array = new JSONArray();
|
|
|
- Set<String> ids = bugDao.findAllids();
|
|
|
+// Set<String> ids = bugDao.findAllids();
|
|
|
Map<String, Exam> exams = new HashMap<>();
|
|
|
|
|
|
- for(Exam exam: result) { exams.put(exam.getId(), exam); }
|
|
|
- for(String id: ids) {
|
|
|
- if(id == null || id.length() <= 0) { continue; }
|
|
|
- String[] strs = id.split("-");
|
|
|
- String case_id = strs[0];
|
|
|
- String task_id = strs[1];
|
|
|
- if(exams.containsKey(case_id)) {
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- Exam exam = exams.get(case_id);
|
|
|
- object.put("name", exam.getName());
|
|
|
- object.put("description", exam.getDescription());
|
|
|
- object.put("testType", exam.getTest_type());
|
|
|
- object.put("case_id", case_id);
|
|
|
- object.put("task_id", task_id);
|
|
|
- array.put(object);
|
|
|
- }
|
|
|
+ for(Exam exam: result) {
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ exams.put(exam.getId(), exam);
|
|
|
+ object.put("name", exam.getName());
|
|
|
+ object.put("description", exam.getDescription());
|
|
|
+ object.put("testType", exam.getTest_type());
|
|
|
+ object.put("case_id", exam.getId());
|
|
|
+ object.put("task_id", exam.getId()); //这里是私有云特有的,一次case对应一次task
|
|
|
+ array.put(object);
|
|
|
}
|
|
|
+// for(String id: ids) {
|
|
|
+// if(id == null || id.length() <= 0) { continue; }
|
|
|
+// String[] strs = id.split("-");
|
|
|
+// String case_id = strs[0];
|
|
|
+// String task_id = strs[1];
|
|
|
+// if(exams.containsKey(case_id)) {
|
|
|
+// JSONObject object = new JSONObject();
|
|
|
+// Exam exam = exams.get(case_id);
|
|
|
+// object.put("name", exam.getName());
|
|
|
+// object.put("description", exam.getDescription());
|
|
|
+// object.put("testType", exam.getTest_type());
|
|
|
+// object.put("case_id", case_id);
|
|
|
+// object.put("task_id", task_id);
|
|
|
+// array.put(object);
|
|
|
+// }
|
|
|
+// }
|
|
|
return array;
|
|
|
}
|
|
|
|