|
@@ -10,6 +10,7 @@ import edu.nju.dao.*;
|
|
|
import edu.nju.entities.*;
|
|
|
import edu.nju.model.*;
|
|
|
import edu.nju.util.HTTP;
|
|
|
+import edu.nju.util.TimeUtil;
|
|
|
import org.apache.commons.lang3.EnumUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
@@ -588,21 +589,54 @@ public class AnalyzeService {
|
|
|
res.setLabels(getUserLabels(workerId));
|
|
|
Report userReport = extraService.findByWorker(caseTakeId,workerId);
|
|
|
List<Bug> bugList = extraService.getBugList(userReport.getId(),caseTakeId);
|
|
|
- long firstActivate = Long.MAX_VALUE ;
|
|
|
- long lastActivate = 0 ;
|
|
|
- long cur ;
|
|
|
+ Collections.sort(bugList, Comparator.comparing(Bug::getCreate_time_millis));
|
|
|
+ JSONArray array=new JSONArray();
|
|
|
+ Map<String,Integer> severityCount = new HashMap<>();
|
|
|
+ int [] severityValueCount = new int[5];
|
|
|
for(Bug bug : bugList){
|
|
|
- cur = Long.parseLong(bug.getCreate_time_millis());
|
|
|
- if(firstActivate>cur)firstActivate = cur;
|
|
|
- if(lastActivate<cur)lastActivate=cur;
|
|
|
- }
|
|
|
- if(firstActivate == Long.MAX_VALUE)firstActivate = 0 ;
|
|
|
- res.setFirstActivate(firstActivate);
|
|
|
- res.setLastActivate(lastActivate);
|
|
|
+ severityValueCount[bug.getSeverity()]++;
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("content",bug.getTitle());
|
|
|
+ object.put("timestamp", TimeUtil.timestamp2DayHour(bug.getCreate_time_millis()));
|
|
|
+ array.put(object);
|
|
|
+ }
|
|
|
+ int severityMax = Arrays.stream(severityValueCount).max().getAsInt();
|
|
|
+ for(int i = 0 ;i<severityValueCount.length;i++){
|
|
|
+ severityCount.put(BugSeverity.getValue(i).toString(),severityValueCount[i]*100/severityMax);
|
|
|
+ }
|
|
|
+ res.setFirstActivate(bugList.size()==0?0:Long.parseLong(bugList.get(0).getCreate_time_millis()));
|
|
|
+ res.setLastActivate(bugList.size()==0?0:Long.parseLong(bugList.get(bugList.size()-1).getCreate_time_millis()));
|
|
|
res.setBugList(bugList);
|
|
|
+ res.setTimeLine(array);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ private void getTimeDistribute(String workerId){
|
|
|
+ List<Report>reports=reportDao.findReportsByWorker(String.valueOf(workerId));
|
|
|
+ reports = reports.stream().filter(e->{
|
|
|
+ return Long.parseLong(e.getCreate_time_millis()) > monthAgoStart(5);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ List<Bug> bugs = new ArrayList<>();
|
|
|
+ for(Report report : reports){
|
|
|
+ bugs.addAll(bdao.findByReport(report.getId(),report.getCase_take_id()));
|
|
|
+ }
|
|
|
+ Map<String,Integer> data = new HashMap<>(6);
|
|
|
+ for(Bug bug : bugs){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private long monthAgoStart(int offset){
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ calendar.add(Calendar.MONTH, -offset);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH,1);
|
|
|
+ return calendar.getTimeInMillis();
|
|
|
+ }
|
|
|
+
|
|
|
public AnalyseVO getReviewAnalyseVO(String caseId, String taskId){
|
|
|
Task task=taskDao.findById(taskId);
|
|
|
long startTime=0;
|