|
@@ -6,6 +6,7 @@ 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.dao.*;
|
|
|
import edu.nju.entities.*;
|
|
|
import edu.nju.model.*;
|
|
@@ -17,6 +18,7 @@ import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
@@ -76,8 +78,17 @@ public class AnalyzeService {
|
|
|
@Autowired
|
|
|
ExtraService extraService;
|
|
|
|
|
|
+ @Value("${server.host}")
|
|
|
+ private String serverHost;
|
|
|
+ @Value("${report.port}")
|
|
|
+ private String serverPort;
|
|
|
+
|
|
|
private static String[] radarInfo = {"发现bug能力","描述bug能力","经验值","bug有效率","众测平均得分"};
|
|
|
private static int[] radarValueStart = {70,80,60,50,70};
|
|
|
+ private static List<String> mockLabels = Arrays.asList("移动应用","Android","ios","鸿蒙os","华为","MacOS","Windows10",
|
|
|
+ "小米","Web测试","发现bug能力强","页面覆盖率高","互动性强",
|
|
|
+ "社交类app","江苏省南京市");
|
|
|
+
|
|
|
|
|
|
Logger logger= LoggerFactory.getLogger(RecommendService.class);
|
|
|
|
|
@@ -599,7 +610,7 @@ public class AnalyzeService {
|
|
|
// severityValueCount[bug.getSeverity()]++;
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("content",bug.getTitle());
|
|
|
- object.put("timestamp", TimeUtil.timestamp2DayHour(bug.getCreate_time_millis()));
|
|
|
+ object.put("timestamp", TimeUtil.timestamp2MonthDayHour(bug.getCreate_time_millis(),8));
|
|
|
array.put(object);
|
|
|
}
|
|
|
// int severityMax = Arrays.stream(severityValueCount).max().getAsInt();
|
|
@@ -795,7 +806,9 @@ public class AnalyzeService {
|
|
|
*/
|
|
|
private List<String> getUserLabels(String wordkId){
|
|
|
List<UserLabel> labels = userLabelDao.findLabelsByWorkerId(wordkId);
|
|
|
- return labels.stream().map(UserLabel::getLabel).collect(Collectors.toList());
|
|
|
+ List<String> userLabels = labels.stream().map(UserLabel::getLabel).collect(Collectors.toList());
|
|
|
+ userLabels.addAll(mockLabels);
|
|
|
+ return userLabels;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -936,7 +949,20 @@ public class AnalyzeService {
|
|
|
jsonObject.put("value",mapValue);
|
|
|
workerDistribute.put(jsonObject);
|
|
|
}
|
|
|
- AnalyseVO2 analyseVO=new AnalyseVO2(likeNum,dislikeNum,forkNum,reportNum,testCaseNum,bugNum,startTime,endTime,reportNum,taskName,workerDistribute,workerRank,gradeDistribution);
|
|
|
+ Map<String,Integer>coverMap=getPageCover(taskId,caseId);
|
|
|
+ int size=coverMap.size();
|
|
|
+ int noBugPage=0;
|
|
|
+ for (Map.Entry<String, Integer> entry : coverMap.entrySet()) {
|
|
|
+ if(entry.getValue()==0){
|
|
|
+ noBugPage++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double pageCover=noBugPage*1.0/size;
|
|
|
+ AnalyseVO2 analyseVO=new AnalyseVO2(likeNum,dislikeNum,forkNum,reportNum,testCaseNum,bugNum,startTime,endTime,reportNum,taskName,workerDistribute,workerRank,gradeDistribution,pageCover);
|
|
|
+ StringBuffer managerCheckUrl = new StringBuffer("http://");
|
|
|
+ managerCheckUrl.append(serverHost).append(":").append(serverPort).append("/report/managerCheck/")
|
|
|
+ .append(taskId).append("/").append(caseId);
|
|
|
+ analyseVO.setManagerCheck(managerCheckUrl.toString());
|
|
|
return analyseVO;
|
|
|
}
|
|
|
|
|
@@ -999,9 +1025,11 @@ public class AnalyzeService {
|
|
|
return bugInfo;
|
|
|
}
|
|
|
|
|
|
- public Map<Integer,Integer> getBugSubmitInfo(String taskId,String caseId,int piece){
|
|
|
+ public Map<String,Integer> getBugSubmitInfo(String taskId,String caseId,int piece){
|
|
|
+ Map<Integer,Integer>map=new HashMap<>(piece);
|
|
|
+ Map<String,Integer> res = new HashMap<>(piece);
|
|
|
+ if(piece<=0)return res;
|
|
|
Task task=taskDao.findById(taskId);
|
|
|
- Map<Integer,Integer>map=new HashMap<>();
|
|
|
long startTime=0;
|
|
|
long endTime=0;
|
|
|
if(task!=null) {
|
|
@@ -1011,9 +1039,10 @@ public class AnalyzeService {
|
|
|
long pieceTime=(endTime-startTime)/piece;
|
|
|
String caseTakeId=caseId+"-"+taskId;
|
|
|
List<Bug>bugs=bdao.findByCaseid(caseTakeId);
|
|
|
+ map.put(0,0);
|
|
|
for(Bug bug:bugs){
|
|
|
long time=Long.parseLong(bug.getCreate_time_millis());
|
|
|
- int index=(int)((time-startTime)/pieceTime);
|
|
|
+ int index=(int)((time-startTime)/pieceTime)+1;
|
|
|
if(map.containsKey(index)){
|
|
|
map.replace(index,map.get(index)+1);
|
|
|
}
|
|
@@ -1021,7 +1050,10 @@ public class AnalyzeService {
|
|
|
map.put(index,1);
|
|
|
}
|
|
|
}
|
|
|
- return map;
|
|
|
+ for(Map.Entry<Integer,Integer> e : map.entrySet()){
|
|
|
+ res.put(TimeUtil.timestamp2DayHour(startTime+e.getKey()*pieceTime,8),e.getValue());
|
|
|
+ }
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
|