From cbc1f9db3d796683d88d6d30df3659984dfbeda3 Mon Sep 17 00:00:00 2001
From: webapp <webapp@home-server.attdns.com>
Date: 星期一, 30 九月 2019 22:56:12 +0800
Subject: [PATCH] 取消java110-common jar包,提升为CommonService服务,将之前的Java110-common内容变更为Java110-utils包

---
 java110-event/src/main/java/com/java110/event/service/BusinessServiceDataFlowEventPublishing.java |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/java110-event/src/main/java/com/java110/event/service/BusinessServiceDataFlowEventPublishing.java b/java110-event/src/main/java/com/java110/event/service/BusinessServiceDataFlowEventPublishing.java
index d125ea3..33241a9 100644
--- a/java110-event/src/main/java/com/java110/event/service/BusinessServiceDataFlowEventPublishing.java
+++ b/java110-event/src/main/java/com/java110/event/service/BusinessServiceDataFlowEventPublishing.java
@@ -1,10 +1,11 @@
 package com.java110.event.service;
 
-import com.java110.common.constant.CommonConstant;
-import com.java110.common.constant.ResponseConstant;
-import com.java110.common.exception.BusinessException;
-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.exception.BusinessException;
+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.event.center.DataFlowListenerOrderComparator;
 
@@ -29,7 +30,7 @@
     /**
      * 淇濆瓨渚﹀惉瀹炰緥淇℃伅锛屼竴鑸惎鍔ㄦ椂鍔犺浇
      */
-    private final static List<BusinessServiceDataFlowListener> listeners = new ArrayList<BusinessServiceDataFlowListener>();
+    private final static List<String> listeners = new ArrayList<String>();
 
     /**
      * 鏍规嵁 浜嬩欢绫诲瀷鏌ヨ渚﹀惉
@@ -40,7 +41,7 @@
      * 娣诲姞 渚﹀惉锛岃繖涓彧鏈夊惎鍔ㄦ椂锛屽崟绾跨▼ 澶勭悊锛屾墍浠ユ槸绾跨▼瀹夊叏鐨�
      * @param listener
      */
-    public static void addListenner(BusinessServiceDataFlowListener listener){
+    public static void addListener(String listener){
         listeners.add(listener);
     }
 
@@ -48,28 +49,29 @@
      * 鑾峰彇渚﹀惉锛堝叏閮ㄤ睛鍚級
      * @return
      */
-    public static List<BusinessServiceDataFlowListener> getListeners(){
+    public static List<String> getListeners(){
         return listeners;
     }
 
     /**
      * 鏍规嵁鏄惁瀹炵幇浜嗘煇涓帴鍙o紝杩斿洖渚﹀惉
-     * @param serviceCode
+     * @param businessTypeCd
      * @since 1.8
      * @return
      */
-    public static List<BusinessServiceDataFlowListener> getListeners(String serviceCode){
+    public static List<BusinessServiceDataFlowListener> getListeners(String businessTypeCd){
 
-        Assert.hasLength(serviceCode,"鑾峰彇闇�瑕佸彂甯冪殑浜嬩欢澶勭悊渚﹀惉鏃讹紝浼犻�掍簨浠朵负绌猴紝璇锋鏌�");
+        Assert.hasLength(businessTypeCd,"鑾峰彇闇�瑕佸彂甯冪殑浜嬩欢澶勭悊渚﹀惉鏃讹紝浼犻�掍簨浠朵负绌猴紝璇锋鏌�");
 
         //鍏堜粠缂撳瓨涓幏鍙栵紝涓轰簡鎻愬崌鏁堢巼
-        if(cacheListenersMap.containsKey(serviceCode)){
-            return cacheListenersMap.get(serviceCode);
+        if(cacheListenersMap.containsKey(businessTypeCd)){
+            return cacheListenersMap.get(businessTypeCd);
         }
 
         List<BusinessServiceDataFlowListener> dataFlowListeners = new ArrayList<BusinessServiceDataFlowListener>();
-        for(BusinessServiceDataFlowListener listener : getListeners()){
-            if(serviceCode.equals(listener.getServiceCode())){
+        for(String listenerBeanName : getListeners()){
+            BusinessServiceDataFlowListener listener = ApplicationContextFactory.getBean(listenerBeanName,BusinessServiceDataFlowListener.class);
+            if(businessTypeCd.equals(listener.getBusinessTypeCd())){
                 dataFlowListeners.add(listener);
             }
         }
@@ -78,7 +80,7 @@
         DataFlowListenerOrderComparator.sort(dataFlowListeners);
 
         //灏嗘暟鎹斁鍏ョ紦瀛樹腑
-        cacheListenersMap.put(serviceCode,dataFlowListeners);
+        cacheListenersMap.put(businessTypeCd,dataFlowListeners);
         return dataFlowListeners;
     }
 
@@ -89,29 +91,29 @@
      */
     public static void multicastEvent(DataFlowContext dataFlowContext) throws BusinessException{
         Assert.notNull(dataFlowContext.getCurrentBusiness(),"褰撳墠娌℃湁鍙鐞嗙殑涓氬姟淇℃伅锛�");
-        multicastEvent(dataFlowContext.getCurrentBusiness().getServiceCode(),dataFlowContext,null);
+        multicastEvent(dataFlowContext.getCurrentBusiness().getBusinessTypeCd(),dataFlowContext,null);
     }
 
 
     /**
      * 鍙戝竷浜嬩欢
-     * @param serviceCode
+     * @param businessTypeCd
      * @param dataFlowContext
      */
-    public static void multicastEvent(String serviceCode,DataFlowContext dataFlowContext) throws BusinessException{
-        multicastEvent(serviceCode,dataFlowContext,null);
+    public static void multicastEvent(String businessTypeCd,DataFlowContext dataFlowContext) throws BusinessException{
+        multicastEvent(businessTypeCd,dataFlowContext,null);
     }
 
     /**
      * 鍙戝竷浜嬩欢
-     * @param serviceCode
+     * @param businessTypeCd
      * @param dataFlowContext 杩欎釜璁㈠崟淇℃伅锛屼互渚夸簬 渚﹀惉閭h竟闇�瑕佺敤
      */
-    public static void multicastEvent(String serviceCode,DataFlowContext dataFlowContext,String asyn) throws  BusinessException{
+    public static void multicastEvent(String businessTypeCd,DataFlowContext dataFlowContext,String asyn) throws  BusinessException{
         try {
-            BusinessServiceDataFlowEvent targetDataFlowEvent = new BusinessServiceDataFlowEvent(serviceCode,dataFlowContext);
+            BusinessServiceDataFlowEvent targetDataFlowEvent = new BusinessServiceDataFlowEvent(businessTypeCd,dataFlowContext);
 
-            multicastEvent(serviceCode,targetDataFlowEvent, asyn);
+            multicastEvent(businessTypeCd,targetDataFlowEvent, asyn);
         }catch (Exception e){
             throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"鍙戝竷渚﹀惉澶辫触锛屽け璐ュ師鍥犱负锛�"+e);
         }
@@ -124,8 +126,8 @@
      * @param event
      * @param asyn A 琛ㄧず寮傛澶勭悊
      */
-    public static void multicastEvent(String serviceCode,final BusinessServiceDataFlowEvent event, String asyn) {
-        for (final BusinessServiceDataFlowListener listener : getListeners(serviceCode)) {
+    public static void multicastEvent(String businessTypeCd,final BusinessServiceDataFlowEvent event, String asyn) {
+        for (final BusinessServiceDataFlowListener listener : getListeners(businessTypeCd)) {
 
             if(CommonConstant.PROCESS_ORDER_ASYNCHRONOUS.equals(asyn)){ //寮傛澶勭悊
 

--
Gitblit v1.8.0