|
@@ -6,9 +6,6 @@ import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import com.google.common.cache.Cache;
|
|
|
|
-import com.google.common.cache.CacheBuilder;
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
|
import edu.nju.algorithm.progress.BugForProgress;
|
|
import edu.nju.algorithm.progress.BugForProgress;
|
|
import edu.nju.algorithm.progress.TaskClosePrediction;
|
|
import edu.nju.algorithm.progress.TaskClosePrediction;
|
|
import edu.nju.dao.*;
|
|
import edu.nju.dao.*;
|
|
@@ -85,11 +82,14 @@ public class AnalyzeService {
|
|
ExtraService extraService;
|
|
ExtraService extraService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
-
|
|
|
|
ShortTokenDao shortTokenDao;
|
|
ShortTokenDao shortTokenDao;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
ExamDao examDao;
|
|
ExamDao examDao;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ CrowdTestDao crowdTestDao;
|
|
|
|
+
|
|
@Value("${server.host}")
|
|
@Value("${server.host}")
|
|
private String serverHost;
|
|
private String serverHost;
|
|
@Value("${report.port}")
|
|
@Value("${report.port}")
|
|
@@ -1092,12 +1092,22 @@ public class AnalyzeService {
|
|
return shortTokenDao.save(shortToken);
|
|
return shortTokenDao.save(shortToken);
|
|
}
|
|
}
|
|
|
|
|
|
- private Double crowdTestProgress(String caseId,String taskId) throws ParseException {
|
|
|
|
|
|
+ public Double crowdTestProgressFromDB(String caseId,String taskId){
|
|
|
|
+ String case_take_id=caseId+"-"+taskId;
|
|
|
|
+ CrowdTest crowdTest=crowdTestDao.findByCaseTakeId(case_take_id);
|
|
|
|
+ if(crowdTest==null){
|
|
|
|
+ return (double) 0;
|
|
|
|
+ }else{
|
|
|
|
+ return crowdTest.getProgress();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Double crowdTestProgress(String caseId,String taskId) {
|
|
SimpleDateFormat formatLine = new SimpleDateFormat ("yyyy/MM/dd HH:mm");
|
|
SimpleDateFormat formatLine = new SimpleDateFormat ("yyyy/MM/dd HH:mm");
|
|
SimpleDateFormat formatCon = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat formatCon = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
|
|
List<BugForProgress> bugForProgressList=new ArrayList<>();
|
|
List<BugForProgress> bugForProgressList=new ArrayList<>();
|
|
- String case_take_id=caseId+"-"+taskId;
|
|
|
|
- List<Report> reportList = reportDao.findByCaseTakeId(case_take_id);
|
|
|
|
|
|
+ String caseTakeId=caseId+"-"+taskId;
|
|
|
|
+ List<Report> reportList = reportDao.findByCaseTakeId(caseTakeId);
|
|
for (Report report : reportList) {
|
|
for (Report report : reportList) {
|
|
String reportId = report.getId();
|
|
String reportId = report.getId();
|
|
List<TestCase> testCaseList = testCaseDao.findByReport(reportId);
|
|
List<TestCase> testCaseList = testCaseDao.findByReport(reportId);
|
|
@@ -1120,15 +1130,17 @@ public class AnalyzeService {
|
|
String time = TransUtil.formatTimeMillis(bug.getCreate_time_millis());
|
|
String time = TransUtil.formatTimeMillis(bug.getCreate_time_millis());
|
|
time = transferString(time);
|
|
time = transferString(time);
|
|
Date submitTime = null;
|
|
Date submitTime = null;
|
|
- if ( time.contains( "-")) {
|
|
|
|
- submitTime = formatCon.parse( time );
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- submitTime = formatLine.parse( time );
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (time.contains("-")) {
|
|
|
|
+ submitTime = formatCon.parse(time);
|
|
|
|
+ } else {
|
|
|
|
+ submitTime = formatLine.parse(time);
|
|
|
|
+ }
|
|
|
|
+ }catch (ParseException e){
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
bugForProgress.setBugCreateTime(submitTime);
|
|
bugForProgress.setBugCreateTime(submitTime);
|
|
bugForProgressList.add(bugForProgress);
|
|
bugForProgressList.add(bugForProgress);
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1148,6 +1160,11 @@ public class AnalyzeService {
|
|
TaskClosePrediction closePrediction = new TaskClosePrediction();
|
|
TaskClosePrediction closePrediction = new TaskClosePrediction();
|
|
Double completeRatio = closePrediction.determineTaskProgressStatus(bugForProgressList);
|
|
Double completeRatio = closePrediction.determineTaskProgressStatus(bugForProgressList);
|
|
completeRatio = completeRatio.intValue() * 1.0;
|
|
completeRatio = completeRatio.intValue() * 1.0;
|
|
|
|
+ CrowdTest crowdTest=new CrowdTest();
|
|
|
|
+ crowdTest.setCaseId(caseId);
|
|
|
|
+ crowdTest.setTaskId(taskId);
|
|
|
|
+ crowdTest.setCaseTakeId(caseTakeId);
|
|
|
|
+ crowdTestDao.save(crowdTest);
|
|
return completeRatio;
|
|
return completeRatio;
|
|
}
|
|
}
|
|
|
|
|