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/BusinessServiceDataFlowEventPublishing.java | 51 ++++++++++++++++++++++++++-------------------------
1 files changed, 26 insertions(+), 25 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 8846fd6..3dcb909 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,11 +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.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.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;
@@ -55,23 +55,23 @@
/**
* 鏍规嵁鏄惁瀹炵幇浜嗘煇涓帴鍙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(String listenerBeanName : getListeners()){
BusinessServiceDataFlowListener listener = ApplicationContextFactory.getBean(listenerBeanName,BusinessServiceDataFlowListener.class);
- if(serviceCode.equals(listener.getServiceCode())){
+ if(businessTypeCd.equals(listener.getBusinessTypeCd())){
dataFlowListeners.add(listener);
}
}
@@ -80,7 +80,7 @@
DataFlowListenerOrderComparator.sort(dataFlowListeners);
//灏嗘暟鎹斁鍏ョ紦瀛樹腑
- cacheListenersMap.put(serviceCode,dataFlowListeners);
+ cacheListenersMap.put(businessTypeCd,dataFlowListeners);
return dataFlowListeners;
}
@@ -91,31 +91,32 @@
*/
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);
+ logger.error("鍙戝竷渚﹀惉澶辫触",e);
+ throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,e.getMessage());
}
}
@@ -126,8 +127,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)){ //寮傛澶勭悊
@@ -168,7 +169,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