فهرست منبع

将全部报告和聚状报告移动到同一页面,访问路径为agg_report_list

insomniaLee 6 سال پیش
والد
کامیت
2231131da4

+ 48 - 43
src/main/java/com/mooctest/controller/ReportController.java

@@ -112,14 +112,13 @@ public class ReportController {
         return "agg_report_new";
     }
 
-    @GetMapping(value = "/reporttest/{id}")
+    @GetMapping(value = "/report/{id}")
     public String showAggrReportTest(@PathVariable("id") String   id,
                                  @RequestParam("examId") long examId,
                                  @RequestParam("caseId") long caseId,
                                  Model model) {
 
         BugDTO singleReport = bugReportService.getBugById(id,examId, caseId); // 具体的bug的DTO
-
         MasterReport masterReportSource = masterReportService.getByBugId(id+""); // 找到该报告的master报告报告;
         String masterId = masterReportSource.getMasterId();
         Map<String, BugDTO> bugMap = bugReportService.getAllBugsMap(examId, caseId);
@@ -139,49 +138,8 @@ public class ReportController {
         return "single_report";
     }
 
-    @GetMapping(value = "/report/{id}")
-    public String showSingleReport(@PathVariable("id") String   id,
-                                   @RequestParam("examId") long examId,
-                                   @RequestParam("caseId") long caseId,Model model) {
-        BugDTO bug = bugReportService.getBugById(id,examId, caseId); // 具体的bug的DTO
 
 
-        List<BugDTO> bugs = new LinkedList<>();
-        List<BugDTO> sourceReports = bugs.stream().distinct().collect(Collectors.toList());
-        Map<String, Long> categoryCounts = sourceReports.stream().collect(Collectors.groupingBy(BugDTO::getBugCategory, Collectors.counting()));
-        Map<String, Long> pageCounts =  sourceReports.stream().collect(Collectors.groupingBy(BugDTO::getBug_page,Collectors.counting()));
-        Map<String, Long> recurrentCounts = sourceReports.stream()
-                .map(BugDTO::getRecurrent)
-                .map((recurrentNum) -> ReportUtil.recurrent2String.get(recurrentNum))
-                .collect(Collectors.groupingBy(Function.identity(), 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("reportId",id);
-        model.addAttribute("report",bug);
-        model.addAttribute("createTime", new Date(Long.parseLong(bug.getCreateTimeMillis())));
-//        model.addAttribute("finalReports", finalReports);
-        model.addAttribute("category2String", ReportUtil.category2String);
-        model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
-        model.addAttribute("severity2String", ReportUtil.severity2String);
-        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 "single_report";
-    }
-
     @GetMapping("editReportData")
     @ResponseBody
     public FinalReportDTO getEditReportData(@RequestParam("masterId") String masterId,
@@ -296,4 +254,51 @@ public class ReportController {
         model.addAttribute("aggNum", masterReportService.getAggNum(examId, caseId));
         return "agg_report_list";
     }
+
+
+    @GetMapping(value = "agg_report_list_test")
+    public String showAggReportLisst(@RequestParam("examId") long examId,
+                                    @RequestParam("caseId") long caseId,
+                                    @RequestParam(value = "status", required = false, defaultValue = "-1") int status,
+                                    Model model) {
+        boolean aggregated = masterReportService.isAggregated(examId, caseId);
+        List<BugDTO> allReports = bugReportService.getAllBugs(examId, caseId);
+        TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
+
+        if (aggregated) { // 如果报告已经是聚合过的。
+            List<String> bugIds = allReports.stream().map(BugDTO::getId).collect(Collectors.toList());
+            List<MasterReport> mrs = masterReportService.getByBugIds(bugIds);
+            Map<String, MasterReport> mrMap = mrs.stream().collect(toMap(MasterReport::getBugId, Function.identity()));
+            allReports.forEach(bug -> {
+                MasterReport mr = mrMap.get(bug.getId());
+                bug.setStatus(mr.getStatus());
+                bug.setReviewerId(mr.getReviewerId());
+                bug.setMasterId(mr.getMasterId());
+            });
+            List<String> masterIds = masterReportService.getAllMasterIdByExamIdAndCaseId(examId, caseId);
+            List<MasterReport> mrs0 = masterReportService.getByBugIds(masterIds);
+            Map<String, MasterReport> mrMap0 = mrs0.stream().collect(toMap(MasterReport::getBugId, Function.identity()));
+            if (status >= 0) {
+                masterIds = masterIds.stream().filter(masterId -> mrMap0.get(masterId).getStatus() == status).collect(Collectors.toList());
+            }
+            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("bugMap", bugsMap);// 聚合才有de
+            model.addAttribute("aggNum", masterReportService.getAggNum(examId, caseId)); // 聚合才有的
+        }
+        model.addAttribute("aggregated", aggregated);
+        model.addAttribute("allReports", allReports);
+        model.addAttribute("severity2String", ReportUtil.severity2String);
+        model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
+        model.addAttribute("reviewMap", ReportUtil.reviewerMap);
+        model.addAttribute("task", task);
+        model.addAttribute("examId", examId);
+        model.addAttribute("caseId", caseId);
+        return "test";
+    }
 }

+ 0 - 2
src/main/java/com/mooctest/controller/TaskController.java

@@ -52,7 +52,6 @@ public class TaskController {
         boolean aggregated = masterReportService.isAggregated(examId, caseId);
         List<BugDTO> allReports = bugReportService.getAllBugs(examId, caseId);
         if (aggregated) {
-
             List<String> bugIds = allReports.stream().map(BugDTO::getId).collect(Collectors.toList());
             List<MasterReport> mrs = masterReportService.getByBugIds(bugIds);
             Map<String, MasterReport> mrMap = mrs.stream().collect(toMap(MasterReport::getBugId, Function.identity()));
@@ -63,7 +62,6 @@ public class TaskController {
                 bug.setMasterId(mr.getMasterId());
             });
         }
-
         TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
         model.addAttribute("aggregated", aggregated);
         model.addAttribute("allReports", allReports);

+ 5 - 0
src/main/java/com/mooctest/controller/TestController.java

@@ -80,6 +80,11 @@ public class TestController {
         return "ok";
     }
 
+//    @GetMapping("/testt")
+//    public String gettest (){
+//        return "test";
+//    }
+
 
 
     public void showClusterResult(Map<String, Set<String>> masterClusterMap, Map<String, BugDTO> bugMap) {

+ 1 - 0
src/main/resources/templates/task_detail.html

@@ -189,6 +189,7 @@
                     </td>
                     <td class="report-aggregator">
                         <span th:if="${!aggregated}">暂无</span>
+<!--                        是否已经聚合-->
                         <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>

+ 277 - 0
src/main/resources/templates/test.html

@@ -0,0 +1,277 @@
+<!DOCTYPE html>
+<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
+      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
+      layout:decorator="main">
+<head>
+    <link rel="stylesheet" type="text/css" href="/static/css/main.css" />
+    <link rel="stylesheet" type="text/css" href="/static/css/all_reports.css" />
+
+    <!-- dataTables -->
+    <link rel="stylesheet" type="text/css"
+          href="/static/AdminLTE/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css" />
+</head>
+<body>
+<th:block layout:fragment="sidebar">
+    <li>
+        <a th:href="'/final_reports?examId=' + ${examId} + '&amp;caseId=' + ${caseId}">
+            <i class="fa fa-calendar-check-o"></i>
+            <span>预交付报告</span>
+        </a>
+    </li>
+    <li class="treeview">
+        <a href="#">
+            <i class="fa fa-list"></i>
+            <span>Reports</span>
+            <span class="pull-right-container">
+			<i class="fa fa-angle-left pull-right"></i>
+		</span>
+        </a>
+        <ul class="treeview-menu" style="display: block;">
+            <li class="active">
+                <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">
+                    <i class="fa fa-circle-o"></i>
+                    <span>全部报告</span>
+                    <span class="badge pull-right all-number" th:text="${task.numOfTotalBug}">199</span>
+                </a>
+            </li>
+            <li>
+                <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;status=1'">
+                    <i class="fa fa-check-circle-o text-success"></i>
+                    <span>已审核报告</span>
+                    <span class="badge badge-success pull-right assigned-number" th:text="${task.numOfTotalBug - task.numOfUndeal}">50</span>
+                </a>
+            </li>
+            <li>
+                <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;status=0'">
+                    <i class="fa fa-clock-o text-danger"></i>
+                    <span>未审核报告</span>
+                    <span class="badge badge-danger pull-right unassign-number" th:text="${task.numOfUndeal}">149</span>
+                </a>
+            </li>
+        </ul>
+    </li>
+</th:block>
+
+<th:block layout:fragment="maincontent">
+    <section class="content-header">
+
+        <ul id="myTab" class="nav nav-tabs">
+            <li class="active">
+                <a href="#allReport" data-toggle="tab">全部报告</a>
+            </li>
+            <li>
+                <a href="#masterReport" data-toggle="tab">聚类报告</a>
+            </li>
+            <li>
+                <a href="#allReport" data-toggle="tab">树状报告</a>
+            </li>
+        </ul>
+
+        <ol class="breadcrumb">
+            <li>
+                <a href="/home">
+                    <i class="fa fa-dashboard"></i>
+                    全部任务
+                </a>
+            </li>
+            <li class="active" th:text="|${task.name} 审核列表|">
+            </li>
+        </ol>
+    </section>
+
+    <div id="myTabContent" class="tab-content">
+        <div class="tab-pane fade in active" id="allReport">
+            <section class="content container-fluid">
+
+                <table id="report-list" class="table table-striped table-bordered" cellpadding="0" width="100%">
+                    <thead>
+                    <tr>
+                        <th>ID</th>
+                        <th>可复现程度</th>
+                        <th>分类</th>
+                        <th>严重程度</th>
+                        <th>描述</th>
+                        <th>审核状态</th>
+                        <th>审核人</th>
+                        <th>所属聚合报告</th>
+                        <th>所属树状报告</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <th:block th:each="report : ${allReports}">
+
+                        <tr th:class="|row-${report.getId()}|">
+                            <td class="report-id" th:value="${report.getId()}" th:text="|ML-${report.getId().substring(10)}|"></td>
+                            <td>
+                                <span th:text="${recurrent2String.get(report.recurrent)}"></span>
+                            </td>
+                            <td>
+                                <!--<i class="fa fa-square" style="color: {{ report.print_bug_category_color  }};"></i>-->
+                                <span th:text="${report.bugCategory}"></span>
+                            </td>
+                            <td>
+                                <img th:alt="|${severity2String.get(report.severity)} Image|" height="14" th:src="'/static/images/icons/priorities/' + ${report.severity} + '.png'" />
+                                <span th:text="${severity2String.get(report.severity)}"></span>
+                            </td>
+                            <td style="width: 300px;">
+                                <div th:id="'ab-content-' + ${report.id}" data-toggle="collapse" th:attr="data-target='#full-content-' + ${report.id}" class="trunc collapse in" th:text="${report.description}">
+                                </div>
+                                <div th:id="'full-content-' + ${report.id}" data-toggle="collapse" th:attr="data-target='#ab-content-' + ${report.id}" class="full-content collapse">
+                                    <span th:text="${report.description}"></span>
+                                    <br/>
+                                    <!--<img class="my-img-thumbnail pointer" th:src="${imgUrl}"-->
+                                    <!--th:each="imgUrl,iterStat : ${report.getImgUrls()}"-->
+                                    <!--th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>-->
+
+                                </div>
+                            </td>
+                            <td>
+                                <label class="label label-warning" th:if="${report.status == 0}">待审核</label>
+                                <label class="label label-success" th:if="${report.status == 1}">已审核</label>
+                            </td>
+
+                            <td class="report-assignee">
+                                <span th:if="${report.reviewerId != null}" th:text="${reviewMap.get(report.reviewerId)}"></span>
+                            </td>
+                            <td class="report-aggregator">
+                                <span th:if="${!aggregated}">暂无</span>
+                                <!--                        是否已经聚合-->
+                                <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>
+                        </tr>
+                    </th:block>
+                    </tbody>
+                </table>
+            </section>
+        </div>
+
+        <div class="tab-pane fade" id="masterReport">
+            <section class="content container-fluid">
+                <div class="box">
+                    <div class="box-header with-border">
+                        <h3 class="box-title">聚合视图 <span class="badge badge-info" th:text="${aggNum}"></span></h3>
+                        <div class="box-tools pull-right">
+                            <a class="btn btn-sm btn-primary" th:href="'/task_detail?examId='+${examId}+'&amp;caseId='+${caseId}">
+                                <i class="fa fa-list-alt" style="margin-right: 5px;"></i>
+                                默认视图
+                            </a>
+                        </div>
+                    </div><!-- /.box-header -->
+
+                    <div class="box-body agg-report-list">
+
+                        <th:block th:each="masterBug : ${master2BugIdsMap}">
+                            <div class="col-md-4">
+                                <div class="box box-solid box-default">
+
+                                    <div class="box-header" id="agg-title-{{aggReport.dup_tag}}">
+                                        <div style="overflow: auto;">
+                                            <a th:href="@{'/report?masterId=' + ${masterBug.key} + '&amp;examId=' + ${examId} + '&amp;caseId=' + ${caseId}}"
+                                               class="pull-left agg-title" th:text="|ML-AG-${masterBug.key.substring(10)}|"></a>
+                                            <a th:href="'#dup-list-'+${masterBug.key}"
+                                               class="glyphicon glyphicon-menu-hamburger pull-right agg-title"
+                                               data-toggle="collapse"></a>
+                                            <span class="pull-right" style="margin-right: 5px;">
+
+                                        <label class="badge badge-success" th:if="${bugMap.get(masterBug.key).status == 1}">已审核</label>
+                                        <label class="badge badge-warning" th:if="${bugMap.get(masterBug.key).status == 0}">未审核</label>
+                                    </span>
+                                            <br/>
+                                        </div>
+                                        <div style="margin-top: 5px;">
+                                            <span class="agg-title">聚合报告数<span class="badge badge-default agg-badge" th:text="${masterBug.value.size()}">10</span></span>
+
+                                        </div>
+                                    </div>
+                                    <div class="sup-title" style="padding: 15px 15px; min-height: 181px;overflow: scroll; max-height: 181px;"
+                                    >
+                                        <span th:text="${bugMap.get(masterBug.key).description}"></span><br/>
+                                        <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
+                                             th:each="imgUrl,iterStat : ${bugMap.get(masterBug.key).getImgUrls()}"
+                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                    </div>
+                                    <ul class="list-group collapse" th:id="'dup-list-' + ${masterBug.key}"
+                                        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}">
+                                        <span  th:text="${bugId}">{{ report.print_id
+                                            }}</span>
+                                            </div>
+                                            <div style="margin-top: 5px" th:text="${bugMap.get(bugId).description}">
+                                                {{ report.description }}
+                                            </div>
+                                        </li>
+                                    </ul>
+                                </div>
+                            </div>
+                        </th:block>
+
+
+                    </div><!-- /.box-body -->
+                </div>
+            </section>
+        </div>
+
+        <div class="tab-pane fade" id="treeReport">
+            <p>iOS 是一个由苹果公司开发和发布的手机操作系统。最初是于 2007 年首次发布 iPhone、iPod Touch 和 Apple
+                TV。iOS 派生自 OS X,它们共享 Darwin 基础。OS X 操作系统是用在苹果电脑上,iOS 是苹果的移动版本。</p>
+        </div>
+
+    </div>
+    
+
+</th:block>
+</body>
+</html>
+<div class="modal fade bs-example-modal-lg text-center" id="imgModal" tabindex="-1" role="dialog"
+     aria-labelledby="myLargeModalLabel">
+
+    <div class="modal-dialog modal-lg" style="display: inline-block; max-width: 900px; max-height: 600px">
+        <div class="modal-content" style="background:  transparent">
+            <center>
+                <img id="imgInModalID"
+                     class="carousel-inner img-responsive "
+                     onclick="closeImageViewer()"
+                     onmouseover="this.style.cursor='pointer';this.style.cursor='hand'"
+                     onmouseout="this.style.cursor='default'"
+                     style="max-height: 90vh;
+                     max-width: 90vw;
+                     object-fit: contain;"
+                />
+            </center>
+        </div>
+    </div>
+</div>
+
+<!-- section howModal -->
+<div id="howModal" class="modal fade" tabindex="-1" role="dialog">
+    <div class="modal-dialog">
+        <div class="modal-content">
+            <div class="modal-header" style="background-color: #3c8dbc;">
+                <span style="color: #fff;" class="pull-left"><b>How does system aggregate report <span id="reportId"></span> to <span id="aggReportId"></span>?</b></span>
+                <button class="close pull-right" data-dismiss="modal">&times;</button>
+            </div>
+            <div class="modal-body">
+                <img src="" class="img-responsive" />
+            </div>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">
+    //显示大图
+    function showimage(source) {
+        $("#imgModal").find("#imgInModalID").attr("src", source);
+        $("#imgModal").modal();
+    }
+
+    //关闭
+    function closeImageViewer() {
+        $("#imgModal").modal('hide');
+    }
+</script>
+<script src="/static/AdminLTE/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
+<script src="/static/AdminLTE/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
+<script src="/static/js/all_reports.js"></script>
+
+<!--<script src="/static/js/app_info.js"></script>-->