|
@@ -8,11 +8,13 @@ import com.mooctest.data.BugDTO;
|
|
import com.mooctest.data.FinalReportDTO;
|
|
import com.mooctest.data.FinalReportDTO;
|
|
import com.mooctest.data.SupplementDTO;
|
|
import com.mooctest.data.SupplementDTO;
|
|
import com.mooctest.data.TaskDTO;
|
|
import com.mooctest.data.TaskDTO;
|
|
|
|
+import com.mooctest.model.BugData;
|
|
import com.mooctest.model.MasterReport;
|
|
import com.mooctest.model.MasterReport;
|
|
import com.mooctest.service.*;
|
|
import com.mooctest.service.*;
|
|
import com.mooctest.util.NLPUtil;
|
|
import com.mooctest.util.NLPUtil;
|
|
import com.mooctest.util.ReportUtil;
|
|
import com.mooctest.util.ReportUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.mongodb.core.aggregation.ArrayOperators;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.util.ResourceUtils;
|
|
import org.springframework.util.ResourceUtils;
|
|
@@ -53,6 +55,9 @@ public class ReportController {
|
|
@Autowired
|
|
@Autowired
|
|
HistoryService historyService;
|
|
HistoryService historyService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ BugDataService bugDataService;
|
|
|
|
+
|
|
@GetMapping(value = "/index")
|
|
@GetMapping(value = "/index")
|
|
public String hello(HttpServletRequest request, @RequestParam(value = "name", required = false, defaultValue = "springboot-thymeleaf") String name) {
|
|
public String hello(HttpServletRequest request, @RequestParam(value = "name", required = false, defaultValue = "springboot-thymeleaf") String name) {
|
|
request.setAttribute("name", name);
|
|
request.setAttribute("name", name);
|
|
@@ -120,10 +125,10 @@ public class ReportController {
|
|
//part of aggreate report
|
|
//part of aggreate report
|
|
@GetMapping(value = "/report_part")
|
|
@GetMapping(value = "/report_part")
|
|
public String showAggrReportPart(@RequestParam("masterId") String masterId,
|
|
public String showAggrReportPart(@RequestParam("masterId") String masterId,
|
|
- @RequestParam("examId") long examId,
|
|
|
|
- @RequestParam("caseId") long caseId,
|
|
|
|
- @RequestParam(value = "finalReportId", required = false) Long finalReportId,
|
|
|
|
- Model model) {
|
|
|
|
|
|
+ @RequestParam("examId") long examId,
|
|
|
|
+ @RequestParam("caseId") long caseId,
|
|
|
|
+ @RequestParam(value = "finalReportId", required = false) Long finalReportId,
|
|
|
|
+ Model model) {
|
|
Map<String, BugDTO> bugMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
Map<String, BugDTO> bugMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
BugDTO masterReport = bugMap.get(masterId);
|
|
BugDTO masterReport = bugMap.get(masterId);
|
|
List<SupplementDTO> supplements = supplementService.getSupplementByMasterId(masterId, bugMap);
|
|
List<SupplementDTO> supplements = supplementService.getSupplementByMasterId(masterId, bugMap);
|
|
@@ -175,37 +180,61 @@ public class ReportController {
|
|
|
|
|
|
@GetMapping(value = "/report/{id}")
|
|
@GetMapping(value = "/report/{id}")
|
|
public String showAggrReportTest(@PathVariable("id") String id,
|
|
public String showAggrReportTest(@PathVariable("id") String id,
|
|
- @RequestParam("examId") long examId,
|
|
|
|
- @RequestParam("caseId") long caseId,
|
|
|
|
- Model model) {
|
|
|
|
-
|
|
|
|
|
|
+ @RequestParam("examId") long examId,
|
|
|
|
+ @RequestParam("caseId") long caseId,
|
|
|
|
+ Model model) {
|
|
|
|
+ //single 的单个的报告展示页面
|
|
BugDTO singleReport = bugReportService.getBugById(id,examId, caseId); // 具体的bug的DTO
|
|
BugDTO singleReport = bugReportService.getBugById(id,examId, caseId); // 具体的bug的DTO
|
|
MasterReport masterReportSource = masterReportService.getByBugId(id+""); // 找到该报告的master报告报告;
|
|
MasterReport masterReportSource = masterReportService.getByBugId(id+""); // 找到该报告的master报告报告;
|
|
- String masterId = masterReportSource.getMasterId();
|
|
|
|
- Map<String, BugDTO> bugMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
|
|
- BugDTO masterReport = bugMap.get(masterId);
|
|
|
|
- List<FinalReportDTO> finalReports = finalReportService.getBySourceId(masterId); // 和这份报告suoshu julei baogao de fincal bgoa
|
|
|
|
|
|
+ List<FinalReportDTO> finalReports =new ArrayList<>();
|
|
|
|
+ Map<String,String> sing2root = historyService.getSingle2Root(caseId, examId);
|
|
|
|
+ String treeReportId = sing2root.get(id);
|
|
|
|
+ if(masterReportSource == null){
|
|
|
|
+ // 如果不存在聚合报告;
|
|
|
|
+ model.addAttribute("hasMaster",false);
|
|
|
|
+ }else{
|
|
|
|
+ model.addAttribute("hasMaster",true);
|
|
|
|
+ String masterId = masterReportSource.getMasterId();
|
|
|
|
+ finalReports.addAll(finalReportService.getBySourceId(masterId)); // 和这份报告suoshu julei baogao de fincal bgoa
|
|
|
|
+ model.addAttribute("masterName","ML-AG-"+masterId.substring(10));
|
|
|
|
+ model.addAttribute("masterUrl","/report?masterId="+masterId+"&examId="+examId+"&caseId="+caseId);
|
|
|
|
+ }
|
|
|
|
+ if(treeReportId == null){
|
|
|
|
+ //如果不存在树状报告
|
|
|
|
+ model.addAttribute("hasTree",false);
|
|
|
|
+ }else{
|
|
|
|
+ model.addAttribute("hasTree",true);
|
|
|
|
+ finalReports.addAll(finalReportService.getBySourceId(treeReportId)); // 和这份报告suoshu julei baogao de fincal bgoa
|
|
|
|
+ model.addAttribute("treeName","ML-TR-"+getShortId(treeReportId));
|
|
|
|
+ model.addAttribute("treeUrl","/history/report?treeId="+treeReportId+"&examId="+examId+"&caseId="+caseId);
|
|
|
|
+ }
|
|
|
|
+// Map<String, BugDTO> bugMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
|
|
+// BugDTO masterReport = bugMap.get(masterId);
|
|
model.addAttribute("singleReport",singleReport);//
|
|
model.addAttribute("singleReport",singleReport);//
|
|
- model.addAttribute("masterReport", masterReport);
|
|
|
|
|
|
+// model.addAttribute("masterReport", masterReport);
|
|
|
|
+ model.addAttribute("reviewed",bugDataService.isReviewed(id));
|
|
model.addAttribute("createTime", new Date(Long.parseLong(singleReport.getCreateTimeMillis())));
|
|
model.addAttribute("createTime", new Date(Long.parseLong(singleReport.getCreateTimeMillis())));
|
|
model.addAttribute("finalReports", finalReports);
|
|
model.addAttribute("finalReports", finalReports);
|
|
model.addAttribute("category2String", ReportUtil.category2String);
|
|
model.addAttribute("category2String", ReportUtil.category2String);
|
|
model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
|
|
model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
|
|
model.addAttribute("severity2String", ReportUtil.severity2String);
|
|
model.addAttribute("severity2String", ReportUtil.severity2String);
|
|
- model.addAttribute("masterName","ML-AG-"+masterId.substring(10));
|
|
|
|
- model.addAttribute("masterUrl","/report?masterId="+masterId+"&examId="+examId+"&caseId="+caseId);
|
|
|
|
model.addAttribute("examId", examId);
|
|
model.addAttribute("examId", examId);
|
|
model.addAttribute("caseId", caseId);
|
|
model.addAttribute("caseId", caseId);
|
|
|
|
+ model.addAttribute("reportId",id);
|
|
return "single_report";
|
|
return "single_report";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ private String getShortId ( String input ){
|
|
|
|
+ return input.length()<10?input:input.substring(input.length()-10);
|
|
|
|
+ }
|
|
|
|
+
|
|
@GetMapping("editReportData")
|
|
@GetMapping("editReportData")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public FinalReportDTO getEditReportData(@RequestParam("masterId") String masterId,
|
|
public FinalReportDTO getEditReportData(@RequestParam("masterId") String masterId,
|
|
- @RequestParam(value = "finalReportId", required = false) Long finalReportId,
|
|
|
|
- Model model){
|
|
|
|
|
|
+ @RequestParam(value = "finalReportId", required = false) Long finalReportId,
|
|
|
|
+ Model model){
|
|
List<FinalReportDTO> finalReports = finalReportService.getBySourceId(masterId);
|
|
List<FinalReportDTO> finalReports = finalReportService.getBySourceId(masterId);
|
|
Optional<FinalReportDTO> finalReportDTO = finalReports.stream().filter(finalReport -> finalReport.getId()==finalReportId).findFirst();
|
|
Optional<FinalReportDTO> finalReportDTO = finalReports.stream().filter(finalReport -> finalReport.getId()==finalReportId).findFirst();
|
|
return finalReportDTO.get();
|
|
return finalReportDTO.get();
|
|
@@ -314,26 +343,23 @@ public class ReportController {
|
|
|
|
|
|
@GetMapping(value = "review_report")
|
|
@GetMapping(value = "review_report")
|
|
public String showAggReportLisst(@RequestParam("examId") long examId,
|
|
public String showAggReportLisst(@RequestParam("examId") long examId,
|
|
- @RequestParam("caseId") long caseId,
|
|
|
|
- @RequestParam(value = "status", required = false, defaultValue = "-1") int status,
|
|
|
|
- Model model) {
|
|
|
|
|
|
+ @RequestParam("caseId") long caseId,
|
|
|
|
+ @RequestParam(value = "status", required = false, defaultValue = "-1") int status,
|
|
|
|
+ Model model) {
|
|
boolean aggregated = masterReportService.isAggregated(examId, caseId);
|
|
boolean aggregated = masterReportService.isAggregated(examId, caseId);
|
|
List<BugDTO> allReports = bugReportService.getAllBugs(examId, caseId);
|
|
List<BugDTO> allReports = bugReportService.getAllBugs(examId, caseId);
|
|
TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
|
|
TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
|
|
List<String> treeRootids = historyService.getTreeRoots(caseId+"-"+examId);
|
|
List<String> treeRootids = historyService.getTreeRoots(caseId+"-"+examId);
|
|
Map<String,List<String>> tree2BugIdsMap = historyService.getTree2BugIdsMap(treeRootids);
|
|
Map<String,List<String>> tree2BugIdsMap = historyService.getTree2BugIdsMap(treeRootids);
|
|
Map<String,String> single2rootMap = historyService.getSingle2Root(caseId, examId);
|
|
Map<String,String> single2rootMap = historyService.getSingle2Root(caseId, examId);
|
|
|
|
+ Map<String , BugData> bugIds2Data = bugDataService.bugId2BugData(examId,caseId) ;
|
|
|
|
+ Map<String, BugDTO> bugsMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
|
|
+ List<String> bugIds = allReports.stream().map(BugDTO::getId).collect(Collectors.toList());
|
|
if (aggregated) { // 如果报告已经是聚合过的。
|
|
if (aggregated) { // 如果报告已经是聚合过的。
|
|
- List<String> bugIds = allReports.stream().map(BugDTO::getId).collect(Collectors.toList());
|
|
|
|
List<MasterReport> mrs = masterReportService.getByBugIds(bugIds);
|
|
List<MasterReport> mrs = masterReportService.getByBugIds(bugIds);
|
|
Map<String, MasterReport> mrMap = mrs.stream().collect(toMap(MasterReport::getBugId, Function.identity()));
|
|
Map<String, MasterReport> mrMap = mrs.stream().collect(toMap(MasterReport::getBugId, Function.identity()));
|
|
allReports.forEach(bug -> {
|
|
allReports.forEach(bug -> {
|
|
- MasterReport mr = mrMap.get(bug.getId());
|
|
|
|
- bug.setStatus(mr.getStatus());
|
|
|
|
- bug.setReviewerId(mr.getReviewerId());
|
|
|
|
- bug.setMasterId(mr.getMasterId());
|
|
|
|
- String te = single2rootMap.get(bug.getId());
|
|
|
|
- bug.setTreeId(te==null?"null":te);
|
|
|
|
|
|
+ bug.setMasterId(mrMap.get(bug.getId()).getMasterId());
|
|
});
|
|
});
|
|
List<String> masterIds = masterReportService.getAllMasterIdByExamIdAndCaseId(examId, caseId);
|
|
List<String> masterIds = masterReportService.getAllMasterIdByExamIdAndCaseId(examId, caseId);
|
|
List<MasterReport> mrs0 = masterReportService.getByBugIds(masterIds);
|
|
List<MasterReport> mrs0 = masterReportService.getByBugIds(masterIds);
|
|
@@ -342,15 +368,19 @@ public class ReportController {
|
|
masterIds = masterIds.stream().filter(masterId -> mrMap0.get(masterId).getStatus() == status).collect(Collectors.toList());
|
|
masterIds = masterIds.stream().filter(masterId -> mrMap0.get(masterId).getStatus() == status).collect(Collectors.toList());
|
|
}
|
|
}
|
|
Map<String, List<String>> master2BugIdsMap = masterReportService.getMaster2BugIdsMap(masterIds);
|
|
Map<String, List<String>> master2BugIdsMap = masterReportService.getMaster2BugIdsMap(masterIds);
|
|
- Map<String, BugDTO> bugsMap = bugReportService.getAllBugsMap(examId, caseId);
|
|
|
|
- masterIds.forEach(masterId -> {
|
|
|
|
- bugsMap.get(masterId).setStatus(mrMap0.get(masterId).getStatus());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
model.addAttribute("master2BugIdsMap", master2BugIdsMap); // 聚合才有的
|
|
model.addAttribute("master2BugIdsMap", master2BugIdsMap); // 聚合才有的
|
|
- model.addAttribute("bugMap", bugsMap);// 聚合才有de
|
|
|
|
model.addAttribute("aggNum", masterReportService.getAggNum(examId, caseId)); // 聚合才有的
|
|
model.addAttribute("aggNum", masterReportService.getAggNum(examId, caseId)); // 聚合才有的
|
|
}
|
|
}
|
|
|
|
+ bugIds.forEach(id -> {
|
|
|
|
+ bugsMap.get(id).setStatus(bugIds2Data.get(id).getStatus());
|
|
|
|
+ });
|
|
|
|
+ allReports.forEach(bug -> {
|
|
|
|
+ bug.setStatus(bugIds2Data.get(bug.getId()).getStatus());
|
|
|
|
+ bug.setReviewerId(bugIds2Data.get(bug.getId()).getReviewerId());
|
|
|
|
+ String te = single2rootMap.get(bug.getId());
|
|
|
|
+ bug.setTreeId(te==null?"null":te);
|
|
|
|
+ });
|
|
|
|
+ model.addAttribute("bugMap", bugsMap);// 聚合才有de
|
|
model.addAttribute("treeNum",treeRootids.size());
|
|
model.addAttribute("treeNum",treeRootids.size());
|
|
model.addAttribute("tree2BugIdsMap",tree2BugIdsMap);
|
|
model.addAttribute("tree2BugIdsMap",tree2BugIdsMap);
|
|
model.addAttribute("aggregated", aggregated);
|
|
model.addAttribute("aggregated", aggregated);
|