From 2ec083f02ede9f14ca1067adebe4196050e37028 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 16 二月 2020 20:30:03 +0800
Subject: [PATCH] 优化编辑出错问题

---
 OrderService/src/main/java/com/java110/order/OrderServiceApplicationStart.java |   50 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/OrderService/src/main/java/com/java110/order/OrderServiceApplicationStart.java b/OrderService/src/main/java/com/java110/order/OrderServiceApplicationStart.java
index 5e9cf0f..4560474 100644
--- a/OrderService/src/main/java/com/java110/order/OrderServiceApplicationStart.java
+++ b/OrderService/src/main/java/com/java110/order/OrderServiceApplicationStart.java
@@ -1,6 +1,8 @@
 package com.java110.order;
 
-import com.java110.common.factory.ApplicationContextFactory;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.factory.ApplicationContextFactory;
+import com.java110.utils.util.StringUtil;
 import com.java110.core.annotation.Java110ListenerDiscovery;
 import com.java110.core.client.RestTemplate;
 import com.java110.event.center.DataFlowEventPublishing;
@@ -13,7 +15,7 @@
 import org.springframework.boot.web.client.RestTemplateBuilder;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
-import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.converter.StringHttpMessageConverter;
@@ -30,12 +32,25 @@
  * @date 2016骞�8鏈�6鏃�
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.order", "com.java110.core", "com.java110.event.order", "com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.order",
+        "com.java110.core", "com.java110.event.order", "com.java110.cache", "com.java110.config.properties.code","com.java110.db"})
 @EnableDiscoveryClient
 //@EnableConfigurationProperties(EventProperties.class)
 @Java110ListenerDiscovery(listenerPublishClass = DataFlowEventPublishing.class,
         basePackages = {"com.java110.order.listener"})
-@EnableFeignClients(basePackages = {"com.java110.core.smo"})
+@EnableFeignClients(basePackages = {
+        "com.java110.core.smo.code",
+        "com.java110.core.smo.user",
+        "com.java110.core.smo.app",
+        "com.java110.core.smo.common",
+        "com.java110.core.smo.community",
+        "com.java110.core.smo.fee",
+        "com.java110.core.smo.floor",
+        "com.java110.core.smo.menu",
+        "com.java110.core.smo.owner",
+        "com.java110.core.smo.room",
+        "com.java110.core.smo.unit",
+})
 public class OrderServiceApplicationStart {
 
     private  static Logger logger = LoggerFactory.getLogger(OrderServiceApplicationStart.class);
@@ -66,16 +81,20 @@
     }
 
     public static void main(String[] args) throws Exception {
-        ApplicationContext context = SpringApplication.run(OrderServiceApplicationStart.class, args);
+        try {
+            ApplicationContext context = SpringApplication.run(OrderServiceApplicationStart.class, args);
 
-        //鏈嶅姟鍚姩鍔犺浇
-        ServiceStartInit.initSystemConfig(context);
+            //鏈嶅姟鍚姩鍔犺浇
+            ServiceStartInit.initSystemConfig(context);
 
-        //鍔犺浇浜嬩欢鏁版嵁
-        //EventConfigInit.initSystemConfig();
+            //鍔犺浇浜嬩欢鏁版嵁
+            //EventConfigInit.initSystemConfig();
 
-        //鍒锋柊缂撳瓨
-        flushMainCache(args);
+            //鍒锋柊缂撳瓨
+            flushMainCache(args);
+        }catch (Throwable e){
+            logger.error("绯荤粺鍚姩澶辫触",e);
+        }
     }
 
 
@@ -87,6 +106,15 @@
     private static void flushMainCache(String[] args) {
 
         logger.debug("鍒ゆ柇鏄惁闇�瑕佸埛鏂版棩蹇楋紝鍙傛暟 args 涓� {}", args);
+
+        //鍥犱负濂藉鏈嬪弸鍚姩鏃� 涓嶅姞 鍙傛暟-Dcache 鎵�浠ュ惎鍔ㄦ椂妫�娴� redis 涓槸鍚﹀瓨鍦� java110_hc_version
+        String mapping = MappingCache.getValue("java110_hc_version");
+        if(StringUtil.isEmpty(mapping)){
+            ICenterServiceCacheSMO centerServiceCacheSMO = (ICenterServiceCacheSMO) ApplicationContextFactory.getBean("centerServiceCacheSMOImpl");
+            centerServiceCacheSMO.startFlush();
+            return ;
+        }
+
         if (args == null || args.length == 0) {
             return;
         }

--
Gitblit v1.8.0