|
@@ -32,25 +32,25 @@ import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
@Service
|
|
|
public class AnalyzeService {
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
CTBDao ctbdao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
BugScoreDao bsdao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
BugHistoryDao hdao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
BugMirrorDao mdao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
StuInfoDao studao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
BugDao bdao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
HistoryService hservice;
|
|
|
|
|
@@ -91,7 +91,7 @@ public class AnalyzeService {
|
|
|
CrowdTestDao crowdTestDao;
|
|
|
|
|
|
|
|
|
- private String serverHost="121.196.124.158";
|
|
|
+ private String serverHost="121.40.93.243";
|
|
|
|
|
|
private String serverPort="8090";
|
|
|
|
|
@@ -111,7 +111,7 @@ public class AnalyzeService {
|
|
|
|
|
|
|
|
|
Logger logger= LoggerFactory.getLogger(RecommendService.class);
|
|
|
-
|
|
|
+
|
|
|
//获取所有bug
|
|
|
public List<String> getValid(String case_take_id) {
|
|
|
List<String> result = new ArrayList<String>();
|
|
@@ -132,7 +132,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//获取所有有测试用例的bug
|
|
|
public List<String> getValidTwo(String case_take_id) {
|
|
|
List<String> result = new ArrayList<String>();
|
|
@@ -173,7 +173,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public List<String> getReports(String case_take_id) {
|
|
|
List<String> result = new ArrayList<String>();
|
|
|
List<CaseToBug> lists = ctbdao.findByCase(case_take_id);
|
|
@@ -195,13 +195,13 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int getGrade(String id) {
|
|
|
BugScore bs = bsdao.findById(id);
|
|
|
if(bs != null) {return bs.getGrade();}
|
|
|
return -1;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public boolean saveGrade(String id, int grade) {
|
|
|
try {
|
|
|
bsdao.save(new BugScore(id, grade, 0));
|
|
@@ -233,12 +233,12 @@ public class AnalyzeService {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int mark(String id, Map<String, Integer> grades, BugMirror mirror) {
|
|
|
int mark = 0;
|
|
|
int grade = grades.get(id);
|
|
|
BugHistory history = hdao.findByid(id);
|
|
|
-
|
|
|
+
|
|
|
int parent = 0;
|
|
|
if(!history.getParent().equals("null")) {
|
|
|
parent = grades.getOrDefault(history.getParent(), 0);
|
|
@@ -247,7 +247,7 @@ public class AnalyzeService {
|
|
|
for(String child : history.getChildren()) {
|
|
|
if(grades.getOrDefault(child, 3) <= 2) {count ++;}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
switch(grade) {
|
|
|
case 1:
|
|
|
if(parent == 1) {mark += 40;}
|
|
@@ -264,11 +264,11 @@ public class AnalyzeService {
|
|
|
mark += count;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(grade <= 2) {
|
|
|
mark += 2 * (mirror.getGood().size() - mirror.getBad().size());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return mark;
|
|
|
}
|
|
|
|
|
@@ -423,7 +423,7 @@ public class AnalyzeService {
|
|
|
result.put(report, result.getOrDefault(report, 0) - grade);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public Map<String, String> getThums(String case_take_id) {
|
|
|
Map<String, String> result = new HashMap<String, String>();
|
|
|
List<String> bugs = getValid(case_take_id);
|
|
@@ -435,7 +435,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public Map<String, Integer> getBugDetail(String case_take_id) {
|
|
|
Map<String, Integer> page = new HashMap<String, Integer>();
|
|
|
List<String> bugs = getValid(case_take_id);
|
|
@@ -445,7 +445,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return page;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public JSONObject getCaseDetail(String case_take_id) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Map<String, Integer> kind = new HashMap<String, Integer>();
|
|
@@ -458,7 +458,7 @@ public class AnalyzeService {
|
|
|
result.put("category", new JSONObject(kind));
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public Map<String, Integer> getAllGrades(String case_take_id) {
|
|
|
Map<String, Integer> result = new HashMap<String, Integer>();
|
|
|
List<BugMirror> mlist = mdao.findByCase(case_take_id);
|
|
@@ -472,7 +472,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public List<String> getDiff(String case_take_id) {
|
|
|
List<String> bugs = getValid(case_take_id);
|
|
|
bugs.add("split");
|
|
@@ -482,7 +482,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return bugs;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//评价页面获取评分
|
|
|
public List<List<String>> getScores(List<String> ids) {
|
|
|
List<List<String>> result = new ArrayList<List<String>>();
|
|
@@ -495,7 +495,7 @@ public class AnalyzeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//根据树状结构计算分数,会根据fork关系减去父节点的分数
|
|
|
public void countScore(String case_take_id, Map<String, Integer> result, Map<String, Integer> grades) {
|
|
|
List<String> roots = hservice.getRoots(case_take_id);
|