Browse Source

Merge remote-tracking branch 'origin/master'

MarkHuang 4 years ago
parent
commit
d6ac80c711
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/main/java/com/diagbot/facade/NeoFacade.java

+ 4 - 1
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -239,7 +239,10 @@ public class NeoFacade {
         List<String> symptomCache = getSymptomCache();
         //取交集
         symptoms.retainAll(symptomCache);
+        long start = System.currentTimeMillis();
         List<String> allDis_bySymptom = pushDis(symptomNameRepository, symptoms);
+        long end = System.currentTimeMillis();
+        System.out.println("并行消耗:"+(end - start) / 1000.0 + "秒");
         return allDis_bySymptom;
         }
 
@@ -254,7 +257,7 @@ public class NeoFacade {
     public List<String> pushDis(SymptomNameRepository symptomNameRepository,List<String> symptoms){
         List<String> allDis = Lists.newArrayList();
         if(ListUtil.isNotEmpty(symptoms)){
-            symptoms.forEach(x ->{
+            symptoms.parallelStream().forEach(x ->{
                 List<Symptom> byNameIs = symptomNameRepository.findByNameIs(x);
                 if(ListUtil.isNotEmpty(byNameIs)){
                     List<String> diseases = byNameIs.stream().filter(z -> z.getDisease() != null && z.getDisease().size() > 0)