From ecdac8a738f254db2b2ea28cbe3248f7a6a7eb2b Mon Sep 17 00:00:00 2001
From: mrzcc <121184950@qq.com>
Date: 星期五, 06 三月 2020 16:18:27 +0800
Subject: [PATCH] 优化采购申请组件

---
 java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java b/java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java
index 6c8cc56..f9e7bc8 100644
--- a/java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java
+++ b/java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java
@@ -1,18 +1,16 @@
 package com.java110.event.service.api;
 
-import com.java110.common.constant.CommonConstant;
-import com.java110.common.constant.ResponseConstant;
-import com.java110.common.constant.ServiceCodeConstant;
-import com.java110.common.exception.BusinessException;
-import com.java110.common.exception.ListenerExecuteException;
-import com.java110.common.factory.ApplicationContextFactory;
-import com.java110.common.log.LoggerEngine;
-import com.java110.common.util.Assert;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.ServiceCodeConstant;
+import com.java110.utils.exception.BusinessException;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.factory.ApplicationContextFactory;
+import com.java110.utils.log.LoggerEngine;
+import com.java110.utils.util.Assert;
 import com.java110.core.context.DataFlowContext;
 import com.java110.entity.center.AppService;
 import com.java110.event.center.DataFlowListenerOrderComparator;
-import com.java110.event.service.BusinessServiceDataFlowEvent;
-import com.java110.event.service.BusinessServiceDataFlowListener;
 import org.springframework.http.HttpMethod;
 
 import java.util.ArrayList;
@@ -31,17 +29,17 @@
     private static Executor taskExecutor;
 
     //榛樿 绾跨▼鏁� 100
-    private final static int DEFAULT_THREAD_NUM = 100;
+    private static final int DEFAULT_THREAD_NUM = 100;
 
     /**
      * 淇濆瓨渚﹀惉瀹炰緥淇℃伅锛屼竴鑸惎鍔ㄦ椂鍔犺浇
      */
-    private final static List<String> listeners = new ArrayList<String>();
+    private static final List<String> listeners = new ArrayList<String>();
 
     /**
      * 鏍规嵁 浜嬩欢绫诲瀷鏌ヨ渚﹀惉
      */
-    private final static Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>();
+    private static final Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>();
 
     /**
      * 娣诲姞 渚﹀惉锛岃繖涓彧鏈夊惎鍔ㄦ椂锛屽崟绾跨▼ 澶勭悊锛屾墍浠ユ槸绾跨▼瀹夊叏鐨�
@@ -95,8 +93,11 @@
         //杩欓噷鎺掑簭
         DataFlowListenerOrderComparator.sort(dataFlowListeners);
 
+
         //灏嗘暟鎹斁鍏ョ紦瀛樹腑
-        cacheListenersMap.put(needCachedServiceCode, dataFlowListeners);
+        if (dataFlowListeners.size() > 0) {
+            cacheListenersMap.put(needCachedServiceCode, dataFlowListeners);
+        }
         return dataFlowListeners;
     }
 
@@ -135,7 +136,7 @@
             multicastEvent(serviceCode, targetDataFlowEvent, asyn);
         } catch (Exception e) {
             logger.error("鍙戝竷渚﹀惉澶辫触锛屽け璐ュ師鍥犱负锛�", e);
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "鍙戝竷渚﹀惉澶辫触锛屽け璐ュ師鍥犱负锛�" + e.getMessage());
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, e.getMessage());
         }
 
     }
@@ -198,7 +199,7 @@
             listener.soService(event);
         } catch (Exception e) {
             LoggerEngine.error("鍙戝竷渚﹀惉澶辫触", e);
-            throw new RuntimeException("鍙戝竷渚﹀惉澶辫触," + listener + event + e);
+            throw new RuntimeException(e.getMessage());
         }
     }
 }

--
Gitblit v1.8.0