Selaa lähdekoodia

聚合详情页面调整

梅杰 6 vuotta sitten
vanhempi
commit
5162e6b675

+ 10 - 8
src/main/java/com/mooctest/controller/ReportController.java

@@ -53,11 +53,7 @@ public class ReportController {
         return "index";
     }
 
-    @GetMapping(value = "/report_test")
-    public String report(HttpServletRequest request, @RequestParam(value = "name", required = false, defaultValue = "springboot-thymeleaf") String name) {
-        request.setAttribute("name", name);
-        return "agg_report";
-    }
+
 
     @GetMapping(value = "/report")
     public String showAggrReport(@RequestParam("masterId") String masterId,
@@ -73,15 +69,21 @@ public class ReportController {
         List<BugDTO> bugs = new LinkedList<>();
         supplements.forEach(supplementDTO -> bugs.addAll(supplementDTO.getBugs()));
         List<BugDTO> sourceReports = bugs.stream().distinct().collect(Collectors.toList());
-        List<String> categories = sourceReports.stream().map(BugDTO::getBugCategory).distinct().collect(Collectors.toList());
+        Map<String, Long> categoryCounts = sourceReports.stream().collect(Collectors.groupingBy(BugDTO::getBugCategory, Collectors.counting()));
+        Map<String, Long> severityCounts = sourceReports.stream()
+                .map(BugDTO::getSeverity)
+                .map((severityNum) -> ReportUtil.severity2String.get(severityNum))
+                .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 
         List<FinalReportDTO> finalReports = finalReportService.getBySourceId(masterId);
+
         model.addAttribute("wordList", getWordCloudList(sourceReports));
-        model.addAttribute("categories", categories);
+        model.addAttribute("categoryCounts", categoryCounts);
+        model.addAttribute("severityCounts", severityCounts);
         model.addAttribute("aggReportId", "ML-AG-" + masterId.substring(10));
         model.addAttribute("masterReport", masterReport);
+        model.addAttribute("createTime", new Date(Long.parseLong(masterReport.getCreateTimeMillis())));
         model.addAttribute("supplements", supplements);
-//        model.addAttribute("sourceReports", sourceReports);
         model.addAttribute("finalReports", finalReports);
         model.addAttribute("category2String", ReportUtil.category2String);
         model.addAttribute("recurrent2String", ReportUtil.recurrent2String);

+ 2 - 2
src/main/resources/templates/agg_report_list.html

@@ -118,8 +118,8 @@
                                 style="max-height: 161px; min-height: 161px; overflow: scroll;" >
                                 <li class="list-group-item list-group-item-inner" th:each="bugId : ${masterBug.value}" >
                                     <div th:id="'report-title-' + ${bugId}">
-                                        <a href="/report" th:text="${bugId}">{{ report.print_id
-                                            }}</a>
+                                        <span  th:text="${bugId}">{{ report.print_id
+                                            }}</span>
                                     </div>
                                     <div style="margin-top: 5px" th:text="${bugMap.get(bugId).description}">
                                         {{ report.description }}

+ 12 - 7
src/main/resources/templates/agg_report_new.html

@@ -91,9 +91,13 @@
                         <tbody>
                         <tr>
                             <td class="attr-title">创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-                            <td class="dup-create-time">2017-12-01 ~ 2017-12-05</td>
+                            <td class="dup-create-time" th:text="${#dates.format(createTime, 'yyyy-MM-dd')}"></td>
                             <td class="attr-title">Bug 严重性</td>
-                            <td class="dup-severity">一般 ~ 严重
+                            <td class="dup-severity">
+                                <span th:each="severityCount : ${severityCounts}">
+                                    <span th:text="${severityCount.key}"></span>
+                                    <span class="badge" th:text="${severityCount.value}"></span>
+                                </span>
                             </td>
                         </tr>
                         <tr>
@@ -101,9 +105,10 @@
                             <td class="dup-category" colspan="3">
 
                                 <!--<i class="fa fa-square" style="color: {{ category.category_color  }};"></i>-->
-                                <span style="margin-right: 10px;" th:if="${categories == null}">暂无</span>
-                                <span style="margin-right: 10px;" th:if="${categories != null}" th:each="ca : ${categories}" th:text="${ca}"></span>
-
+                                <span th:each="categoryCounts : ${categoryCounts}">
+                                    <span th:text="${categoryCounts.key}"></span>
+                                    <span class="badge" th:text="${categoryCounts.value}"></span>
+                                </span>
                             </td>
                         </tr>
                         <tr>
@@ -141,7 +146,7 @@
                                         th:each="supplement, iterStat : ${supplements}">
 
                                         <p style="border-bottom: 1px solid #ddd; margin: 0 0 1px;">
-                                            <b><a href="#" th:text="'Supplementary ' + ${iterStat.count}"> </a></b>
+                                            <b><a href="#" th:text="'补充点 ' + ${iterStat.count}"> </a></b>
                                             <a th:href="'#sup-' + ${iterStat.count}"
                                                class="glyphicon glyphicon-menu-hamburger pull-right sup-collapse"
                                                data-toggle="collapse" style="color: #000;"></a>
@@ -282,7 +287,7 @@
                             <th:block th:each="finalReport : ${finalReports}">
                                 <li class="list-group-item">
                                     <div style="overflow: auto;">
-                                        <a href="#" th:text="${finalReport.id}"></a>
+                                        <span th:text="${finalReport.id}"></span>
                                         <span class="pull-right">
 
                                             <a th:href="'report?masterId='+${finalReport.sourceId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;finalReportId='+${finalReport.id}">编辑</a>