Forráskód Böngészése

修复bug严重性数量统计数量问题

insomniaLee 4 éve
szülő
commit
6bdd4e1b55

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

@@ -77,16 +77,18 @@ public class ReportController {
         BugDTO masterReport = bugMap.get(masterId); // 得到主报告
         List<SupplementDTO> supplements = supplementService.getSupplementByMasterId(masterId, bugMap); // 补充点报告
         List<BugDTO> bugs = new LinkedList<>();
+        bugs.add(masterReport);
         supplements.forEach(supplementDTO -> bugs.addAll(supplementDTO.getBugs()));
-        List<BugDTO> sourceReports = bugs.stream().distinct().collect(Collectors.toList());
+        Collection<BugDTO> distinctBugs = bugs.stream().collect(Collectors.toMap(BugDTO::getId,Function.identity(),(v1,v2)->v1)).values();
+//        List<BugDTO> sourceReports = distinctBugs.stream().distinct().collect(Collectors.toList());
         // 各种类型的报告数量的统计,
-        Map<String, Long> categoryCounts = sourceReports.stream().collect(Collectors.groupingBy(BugDTO::getBugCategory, Collectors.counting()));
-        Map<String, Long> pageCounts =  sourceReports.stream().filter(e->e.getBug_page()!=null).collect(Collectors.groupingBy(BugDTO::getBug_page,Collectors.counting()));
-        Map<String, Long> recurrentCounts = sourceReports.stream()
+        Map<String, Long> categoryCounts = distinctBugs.stream().collect(Collectors.groupingBy(BugDTO::getBugCategory, Collectors.counting()));
+        Map<String, Long> pageCounts =  distinctBugs.stream().filter(e->e.getBug_page()!=null).collect(Collectors.groupingBy(BugDTO::getBug_page,Collectors.counting()));
+        Map<String, Long> recurrentCounts = distinctBugs.stream()
                 .map(BugDTO::getRecurrent)
                 .map((recurrentNum) -> ReportUtil.recurrent2String.get(recurrentNum))
                 .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
-        Map<String, Long> severityCounts = sourceReports.stream()
+        Map<String, Long> severityCounts = distinctBugs.stream()
                 .map(BugDTO::getSeverity)
                 .map((severityNum) -> ReportUtil.severity2String.get(severityNum))
                 .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));

+ 1 - 0
src/main/java/com/mooctest/util/Doc2VecUtil.java

@@ -16,6 +16,7 @@ public class Doc2VecUtil {
                 if (docVectorModel == null) {
                     try {
 //                        docVectorModel = new DocVectorModel(new WordVectorModel("D:\\work\\project\\yanbaoronghe\\data\\sgns.wiki.word"));
+//                        docVectorModel = new DocVectorModel(new  WordVectorModel("/Users/insomnialee/Desktop/sgns.wiki.word"));
                         docVectorModel = new DocVectorModel(new  WordVectorModel("/project/sgns.wiki.word"));
                     } catch (IOException e) {
                         e.printStackTrace();