Browse Source

修改页面样式

insomniaLee 6 years ago
parent
commit
b613a99995

+ 0 - 14
src/main/java/com/mooctest/controller/HistoryController.java

@@ -139,11 +139,6 @@ public class HistoryController {
 		List<FinalReportDTO> finalReports = new ArrayList<>();// 暂时还没有finalreport的数据
 
 
-//        List<BugDTO> bugs = new LinkedList<>();
-//        supplements.forEach(supplementDTO -> bugs.addAll(supplementDTO.getBugs()));
-
-
-
         model.addAttribute("categoryCounts", categoryCounts);
         model.addAttribute("severityCounts", severityCounts);
         model.addAttribute("pageCounts",pageCounts);
@@ -159,15 +154,6 @@ public class HistoryController {
         model.addAttribute("reviewed",false);
         model.addAttribute("examId", examId);
         model.addAttribute("caseId", caseId);
-//
-//        boolean bugReviewed = bugReviewService.isBugReviewed(masterId);
-//        model.addAttribute("reviewed", bugReviewed);
-//        if (finalReportId != null) {
-//            Optional<FinalReportDTO> finalReportDTO = finalReports.stream().filter(finalReport -> finalReport.getId()==finalReportId).findFirst();
-//            model.addAttribute("finalReportId", finalReportId);
-//            model.addAttribute("editReport", finalReportDTO.get());
-//
-//        }
         return "tree_report_new";
     }
 

+ 5 - 1
src/main/java/com/mooctest/controller/ReportController.java

@@ -85,7 +85,8 @@ public class ReportController {
                 .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 
         List<FinalReportDTO> finalReports = finalReportService.getBySourceId(masterId);
-
+        Map<String,String> single2rootMap = historyService.getSingle2Root(caseId, examId);
+        model.addAttribute("single2root",single2rootMap);
         model.addAttribute("wordList", getWordCloudList(sourceReports));
         model.addAttribute("categoryCounts", categoryCounts);
         model.addAttribute("severityCounts", severityCounts);
@@ -261,6 +262,7 @@ public class ReportController {
         TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
         List<String> treeRootids = historyService.getTreeRoots(caseId+"-"+examId);
         Map<String,List<String>> tree2BugIdsMap = historyService.getTree2BugIdsMap(treeRootids);
+        Map<String,String> single2rootMap = historyService.getSingle2Root(caseId, examId);
         if (aggregated) { // 如果报告已经是聚合过的。
             List<String> bugIds = allReports.stream().map(BugDTO::getId).collect(Collectors.toList());
             List<MasterReport> mrs = masterReportService.getByBugIds(bugIds);
@@ -270,6 +272,8 @@ public class ReportController {
                 bug.setStatus(mr.getStatus());
                 bug.setReviewerId(mr.getReviewerId());
                 bug.setMasterId(mr.getMasterId());
+                String te = single2rootMap.get(bug.getId());
+                bug.setTreeId(te==null?"null":te);
             });
             List<String> masterIds = masterReportService.getAllMasterIdByExamIdAndCaseId(examId, caseId);
             List<MasterReport> mrs0 = masterReportService.getByBugIds(masterIds);

+ 1 - 0
src/main/java/com/mooctest/data/BugDTO.java

@@ -26,5 +26,6 @@ public class BugDTO{
     private int status = 0;
     private Long reviewerId;
     private String masterId;
+    private String treeId;
     private String bug_page;
 }

+ 14 - 0
src/main/java/com/mooctest/service/HistoryService.java

@@ -6,6 +6,7 @@ import com.mooctest.dao3.BugPageDao;
 import com.mooctest.model.BugHistory;
 import com.mooctest.model.BugMirror;
 import com.mooctest.model.BugPage;
+import org.apache.commons.collections4.map.HashedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -30,6 +31,19 @@ public class HistoryService {
 	
 	@Autowired
 	AnalyzeService aservice;
+
+	//获得 单一报告对树状报告的map
+	public Map<String,String> getSingle2Root(long caseId,long examId){
+		List<String> treeRootids = getTreeRoots(caseId+"-"+examId); // 获得所有的根结点的id
+		Map<String , List<String >> tree2BugIdsMap = getTree2BugIdsMap(treeRootids);
+		Map<String ,String > res = new HashedMap<>();
+		tree2BugIdsMap.forEach((k,v)->{
+			v.forEach(s->{
+				res.put(s,k);
+			});
+		});
+		return res;
+	}
 	
 	public BugHistory getHistory(String id) {
 		return historydao.findByid(id);

+ 4 - 2
src/main/resources/templates/agg_report_new.html

@@ -204,9 +204,11 @@
                                                     th:each="report : ${supplement.bugs}">
                                                 <span class="glyphicon glyphicon-file"
                                                       style="color: #3c8dbc; margin-right: 5px;"></span>
-                                                    <a href="#" style="margin-right: 5px;" th:text="${report.id}"></a>
+                                                    <a th:href="'/report/'+${report.id}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" style="margin-right: 5px;" th:text="${report.id}"></a>
                                                     <!--查看树状报告-->
-                                                    <span class="glyphicon glyphicon-tree-conifer"
+                                                    <span th:if="${single2root.get(report.id)!=null}"
+                                                          th:href="'/history/report?treeId='+${single2root.get(report.id)}+'&amp;examId='+ ${examId} + '&amp;caseId=' + ${caseId}"
+                                                          class="glyphicon glyphicon-tree-conifer"
                                                            style="color: #07b309; margin-right: 5px;" >
                                                     </span>
 

+ 4 - 1
src/main/resources/templates/test.html

@@ -138,7 +138,10 @@
                                 <!--                        是否已经聚合-->
                                 <a th:if="${aggregated}" th:text="|ML-AG-${report.masterId.substring(10)}|" th:href="'/report?masterId='+${report.masterId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}"></a>
                             </td>
-                            <td>暂无</td>
+                            <td>
+                                <span th:if="${report.getTreeId().length()==4}">暂无</span>
+                                <a th:if="${report.getTreeId().length()!=4}" th:text="|ML-TR-${report.treeId.substring(10)}|" th:href="'/history/report?treeId='+${report.treeId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}"></a>
+                            </td>
                         </tr>
                     </th:block>
                     </tbody>