Browse Source

新疆沙雅代码更新

wangsy 3 months ago
parent
commit
400c6a1c5f

+ 2 - 1
src/main/java/com/diagbot/aggregate/RuleAggregate.java

@@ -294,7 +294,8 @@ public class RuleAggregate {
     public Boolean setRuleDTOMap(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
         //加载有效规则Map
         if (MapUtils.isNotEmpty(allRulesDTO.getRuleDTOMap())) {
-            redisUtil.multiSet(allRulesDTO.getRuleDTOMap());
+//            redisUtil.multiSet(allRulesDTO.getRuleDTOMap()); //原逻辑
+            redisUtil.batchInsert(allRulesDTO.getRuleDTOMap());
         }
         return true;
     }

+ 1 - 1
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -63,7 +63,7 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.loadAllBaseDiagnoseCache();
         log.info("CDSS-CORE服务启动加载诊断依据缓存成功!");
 
-        cacheFacade.loadAllRuleCache();
+//        cacheFacade.loadAllRuleCache();
         log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
 
         log.info("CDSS-CORE初始化完成!");

+ 26 - 5
src/main/java/com/diagbot/util/RedisUtil.java

@@ -1,5 +1,6 @@
 package com.diagbot.util;
 
+import com.diagbot.dto.RuleDTO;
 import com.diagbot.enums.RedisEnum;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
@@ -9,13 +10,10 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.data.redis.core.RedisOperations;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.SessionCallback;
+import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Component;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -31,6 +29,29 @@ public class RedisUtil {
     @Qualifier("redisTemplateForSimilar")
     RedisTemplate redisTemplate;
 
+    private int batchSize = 1000; // 每批插入的键值对数量
+
+    public void batchInsert(Map<String, RuleDTO> largeMap) {
+        ValueOperations<String, RuleDTO> valueOps = redisTemplate.opsForValue();
+        Map<String, RuleDTO> batchMap = new HashMap<>(batchSize);
+
+        Iterator<Map.Entry<String, RuleDTO>> iterator = largeMap.entrySet().iterator();
+        int count = 0;
+
+        while (iterator.hasNext()) {
+            Map.Entry<String, RuleDTO> entry = iterator.next();
+            batchMap.put(entry.getKey(), entry.getValue());
+            count++;
+
+            if (count == batchSize || !iterator.hasNext()) {
+                valueOps.multiSet(batchMap);
+                batchMap.clear(); // 清空batchMap为下一批做准备
+                count = 0;
+            }
+        }
+    }
+
+
     /**
      * 更新指定的数据
      *

+ 14 - 14
src/main/resources/application-pre.yml

@@ -92,17 +92,17 @@ spring:
         cdss:
           driver-class-name: com.mysql.cj.jdbc.Driver
           platform: mysql
-          url: jdbc:mysql://192.168.2.121:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
-          username: teamback
-          password: goTulmLeon
+          url: jdbc:mysql://173.18.12.194:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
+          username: root
+          password: dsYun8!@#
           druid:
             initial-size: 5
         med:
           driver-class-name: com.mysql.cj.jdbc.Driver
           platform: mysql
-          url: jdbc:mysql://192.168.2.121:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
-          username: teamback
-          password: goTulmLeon
+          url: jdbc:mysql://173.18.12.194:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
+          username: root
+          password: dsYun8!@#
           druid:
             initial-size: 5
 
@@ -115,16 +115,16 @@ spring:
     database:
       cache: 11 # cache索引
       similar: 11 # similar索引
-    host: 192.168.2.121  #Redis服务器地址
+    host: 173.18.12.194  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
-    password: lantone # Redis服务器连接密码(默认为空)
+    password: # Redis服务器连接密码(默认为空)
     lettuce:
       pool:
-        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-active: 10 # 连接池最大连接数(使用负值表示没有限制)
         max-idle: 5 # 连接池中的最大空闲连接
         max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
         min-idle: 0 # 连接池中的最小空闲连接
-    timeout: 200000 # 连接超时时间(毫秒)
+    timeout: 2000000 # 连接超时时间(毫秒)
 
   servlet:
     multipart:
@@ -168,10 +168,10 @@ swagger:
   enable: true
 
 CRF:
-  url: http://192.168.2.234:3456
+  url: http://173.18.12.190:3456
 
 StandConvert:
-  url: http://192.168.2.234:23232
+  url: http://173.18.12.190:23232
   rate: 0.9
 
 StandConvertNew:
@@ -179,10 +179,10 @@ StandConvertNew:
   rate: 0.9
 
 IcssPush:
-  url: http://192.168.2.186:5008
+  url: http://173.18.12.192:5008
 
 # 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
-  url: http://192.168.2.234:9210
+  url: http://173.18.12.193:9210
 
 debugFlag: true

+ 13 - 13
src/main/resources/application-test.yml

@@ -92,17 +92,17 @@ spring:
         cdss:
           driver-class-name: com.mysql.cj.jdbc.Driver
           platform: mysql
-          url: jdbc:mysql://192.168.2.241:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
+          url: jdbc:mysql://192.168.8.29:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
           username: root
-          password: lantone
+          password: Dl1-GfaNxtPg
           druid:
             initial-size: 5
         med:
           driver-class-name: com.mysql.cj.jdbc.Driver
           platform: mysql
-          url: jdbc:mysql://192.168.2.241:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
+          url: jdbc:mysql://192.168.8.29:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
           username: root
-          password: lantone
+          password: Dl1-GfaNxtPg
           druid:
             initial-size: 5
 
@@ -115,16 +115,16 @@ spring:
     database:
       cache: 11 # cache索引
       similar: 11 # similar索引
-    host: 192.168.2.241  #Redis服务器地址
+    host: 192.168.8.29  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
-    password: lantone # Redis服务器连接密码(默认为空)
+    password: Lhis999@123 # Redis服务器连接密码(默认为空)
     lettuce:
       pool:
-        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
         max-idle: 5 # 连接池中的最大空闲连接
         max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
         min-idle: 0 # 连接池中的最小空闲连接
-    timeout: 200000 # 连接超时时间(毫秒)
+    timeout: 20000000 # 连接超时时间(毫秒)
 
   servlet:
     multipart:
@@ -168,21 +168,21 @@ swagger:
   enable: true
 
 CRF:
-  url: http://192.168.2.234:3456
+  url: http://192.168.8.29:3456
 
 StandConvert:
-  url: http://192.168.2.234:23232
+  url: http://192.168.8.29:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:7000
+  url: http://192.168.8.29:7000
   rate: 0.9
 
 IcssPush:
-  url: http://192.168.2.241:5008
+  url: http://192.168.8.29:5008
 
 # 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
-  url: http://192.168.2.234:9211
+  url: http://192.168.8.29:9210
 
 debugFlag: true

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -2,7 +2,7 @@ spring:
   application:
     name: cdss-core
   profiles:
-    active: local
+    active: pre
   main:
     allow-bean-definition-overriding: true
 

+ 1 - 1
src/test/java/com/diagbot/CdssCoreApplicationTests.java

@@ -5,7 +5,7 @@ import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-@RunWith(SpringRunner.class)
+//@RunWith(SpringRunner.class)
 @SpringBootTest
 public class CdssCoreApplicationTests {