From 259530d8ee76c61e8520e254fa8c3da74ee94505 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 14 十一月 2019 22:41:38 +0800
Subject: [PATCH] 加入线程同步

---
 OrderService/src/main/java/com/java110/order/smo/impl/OrderServiceSMOImpl.java |  476 ++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 262 insertions(+), 214 deletions(-)

diff --git a/OrderService/src/main/java/com/java110/order/smo/impl/OrderServiceSMOImpl.java b/OrderService/src/main/java/com/java110/order/smo/impl/OrderServiceSMOImpl.java
index 9ba946f..1948f6d 100644
--- a/OrderService/src/main/java/com/java110/order/smo/impl/OrderServiceSMOImpl.java
+++ b/OrderService/src/main/java/com/java110/order/smo/impl/OrderServiceSMOImpl.java
@@ -2,20 +2,41 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.java110.common.cache.AppRouteCache;
-import com.java110.common.cache.MappingCache;
-import com.java110.common.constant.*;
-import com.java110.common.exception.*;
-import com.java110.common.factory.ApplicationContextFactory;
-import com.java110.common.kafka.KafkaFactory;
-import com.java110.common.log.LoggerEngine;
-import com.java110.common.util.*;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.KafkaConstant;
+import com.java110.utils.constant.MappingConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.ServiceBusinessConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.BusinessException;
+import com.java110.utils.exception.BusinessStatusException;
+import com.java110.utils.exception.ConfigDataException;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.exception.DecryptException;
+import com.java110.utils.exception.InitConfigDataException;
+import com.java110.utils.exception.NoAuthorityException;
+import com.java110.utils.exception.NoSupportException;
+import com.java110.utils.exception.OrdersException;
+import com.java110.utils.exception.RuleException;
+import com.java110.utils.exception.SMOException;
+import com.java110.utils.factory.ApplicationContextFactory;
+import com.java110.utils.kafka.KafkaFactory;
+import com.java110.utils.log.LoggerEngine;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ServiceBusinessUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.utils.util.WebServiceAxisClient;
 import com.java110.core.client.RestTemplate;
-import com.java110.core.context.*;
+import com.java110.core.context.DataFlow;
+import com.java110.core.context.IOrderDataFlowContext;
+import com.java110.core.context.IOrderNotifyDataFlowContext;
+import com.java110.core.context.IOrderResponse;
+import com.java110.core.context.OrderDataFlow;
+import com.java110.core.context.OrderNotifyDataFlow;
 import com.java110.core.factory.AuthenticationFactory;
 import com.java110.core.factory.OrderDataFlowContextFactory;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.entity.center.AppRoute;
 import com.java110.entity.center.AppService;
 import com.java110.entity.center.DataFlowLinksCost;
 import com.java110.entity.order.Business;
@@ -36,7 +57,11 @@
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -47,7 +72,7 @@
 //@Transactional
 public class OrderServiceSMOImpl implements IOrderServiceSMO {
 
-    private final static Logger logger = LoggerFactory.getLogger(OrderServiceSMOImpl.class);
+    private static Logger logger = LoggerFactory.getLogger(OrderServiceSMOImpl.class);
 
 
     @Autowired
@@ -65,10 +90,11 @@
 
     /**
      * 涓氬姟缁熶竴澶勭悊鏈嶅姟鏂规硶
+     *
      * @param reqJson 璇锋眰鎶ユ枃json
      * @return
      */
-    public ResponseEntity<String> service(String reqJson, Map<String,String> headers) throws SMOException{
+    public ResponseEntity<String> service(String reqJson, Map<String, String> headers) throws SMOException {
         IOrderDataFlowContext dataFlow = null;
 
         JSONObject responseJson = null;
@@ -76,7 +102,7 @@
         ResponseEntity<String> responseEntity = null;
 
         try {
-            DataFlowEventPublishing.preValidateData(reqJson,headers);
+            DataFlowEventPublishing.preValidateData(reqJson, headers);
             //1.0 鍒涘缓鏁版嵁娴�
             dataFlow = OrderDataFlowContextFactory.newInstance(OrderDataFlow.class).builder(reqJson, headers);
             DataFlowEventPublishing.initDataFlowComplete(dataFlow);
@@ -95,25 +121,25 @@
             //鑳藉鎵ц鍒拌繖涓�姝� 璁や负鏄兘鎴愬姛浜�
             refreshOrderDataFlowResJson(dataFlow);
 
-        }catch (BusinessException e) {
-            responseEntity = new ResponseEntity<String>(e.getMessage() , OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.INTERNAL_SERVER_ERROR);
+        } catch (BusinessException e) {
+            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.INTERNAL_SERVER_ERROR);
         } catch (OrdersException e) {
-            responseEntity = new ResponseEntity<String>(e.getMessage() , OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.INTERNAL_SERVER_ERROR);
+            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.INTERNAL_SERVER_ERROR);
         } catch (RuleException e) {
-            responseEntity = new ResponseEntity<String>(e.getMessage(),OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.NETWORK_AUTHENTICATION_REQUIRED);
+            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.NETWORK_AUTHENTICATION_REQUIRED);
         } catch (NoAuthorityException e) {
-            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.UNAUTHORIZED);
-        } catch (InitConfigDataException e){
-            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.INTERNAL_SERVER_ERROR);
-        }catch (Exception e) {
-            logger.error("鍐呴儴寮傚父浜嗭細",e);
-            responseEntity = new ResponseEntity<String>("鍐呴儴寮傚父浜嗭細"+e.getMessage() + e.getLocalizedMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.INTERNAL_SERVER_ERROR);
+            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.UNAUTHORIZED);
+        } catch (InitConfigDataException e) {
+            responseEntity = new ResponseEntity<String>(e.getMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.INTERNAL_SERVER_ERROR);
+        } catch (Exception e) {
+            logger.error("鍐呴儴寮傚父浜嗭細", e);
+            responseEntity = new ResponseEntity<String>("鍐呴儴寮傚父浜嗭細" + e.getMessage() + e.getLocalizedMessage(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.INTERNAL_SERVER_ERROR);
         } finally {
 
-            if(responseEntity == null){
-                responseEntity = new ResponseEntity<String>(dataFlow.getResJson().getJSONArray("msg").toJSONString(),OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()),HttpStatus.OK);
+            if (responseEntity == null) {
+                responseEntity = new ResponseEntity<String>(dataFlow.getResJson().getJSONArray("msg").toJSONString(), OrderDataFlowContextFactory.hashMap2MultiValueMap(dataFlow.getResHeaders()), HttpStatus.OK);
             }
-            if(dataFlow != null) {
+            if (dataFlow != null) {
                 //娣诲姞鑰楁椂
                 //OrderDataFlowContextFactory.addCostTime(dataFlow, "service", "涓氬姟澶勭悊鎬昏�楁椂", dataFlow.getStartDate(), dataFlow.getEndDate());
                 //淇濆瓨鑰楁椂
@@ -125,16 +151,17 @@
 
 
             //杩欓噷淇濆瓨鑰楁椂锛屼互鍙婃棩蹇�
-            return responseEntity ;
+            return responseEntity;
 
         }
     }
 
     /**
      * 鍒疯繑鍥炲��
+     *
      * @param dataFlow
      */
-    private void refreshOrderDataFlowResJson(IOrderDataFlowContext dataFlow){
+    private void refreshOrderDataFlowResJson(IOrderDataFlowContext dataFlow) {
 
 //        if(dataFlow.getResJson() == null || dataFlow.getResJson().isEmpty()){
 //            JSONObject resJson = new JSONObject();
@@ -146,29 +173,31 @@
 
     /**
      * 鎶掑啓杩斿洖澶翠俊鎭�
+     *
      * @param dataFlow
      */
-    private void putResponseHeader(DataFlow dataFlow,Map<String,String> headers) {
+    private void putResponseHeader(DataFlow dataFlow, Map<String, String> headers) {
         headers.put("responseTime", DateUtil.getDefaultFormateTimeString(new Date()));
-        headers.put("transactionId",dataFlow.getTransactionId());
+        headers.put("transactionId", dataFlow.getTransactionId());
     }
 
     /**
      * 瑙e瘑
+     *
      * @param reqJson
      * @return
      */
-    private String decrypt(String reqJson,Map<String,String> headers) throws DecryptException{
+    private String decrypt(String reqJson, Map<String, String> headers) throws DecryptException {
         try {
             if (MappingConstant.VALUE_ON.equals(headers.get(CommonConstant.ENCRYPT))) {
                 logger.debug("瑙e瘑鍓嶅瓧绗︼細" + reqJson);
                 reqJson = new String(AuthenticationFactory.decrypt(reqJson.getBytes("UTF-8"), AuthenticationFactory.loadPrivateKey(MappingConstant.KEY_PRIVATE_STRING)
                         , NumberUtils.isNumber(headers.get(CommonConstant.ENCRYPT_KEY_SIZE)) ? Integer.parseInt(headers.get(CommonConstant.ENCRYPT_KEY_SIZE)) :
-                                Integer.parseInt(MappingCache.getValue(MappingConstant.KEY_DEFAULT_DECRYPT_KEY_SIZE))),"UTF-8");
+                                Integer.parseInt(MappingCache.getValue(MappingConstant.KEY_DEFAULT_DECRYPT_KEY_SIZE))), "UTF-8");
                 logger.debug("瑙e瘑鍚庡瓧绗︼細" + reqJson);
             }
-        }catch (Exception e){
-            throw new DecryptException(ResponseConstant.RESULT_CODE_NO_AUTHORITY_ERROR,"瑙e瘑澶辫触");
+        } catch (Exception e) {
+            throw new DecryptException(ResponseConstant.RESULT_CODE_NO_AUTHORITY_ERROR, "瑙e瘑澶辫触");
         }
 
         return reqJson;
@@ -176,25 +205,25 @@
 
     /**
      * 鍔犲瘑
+     *
      * @param resJson
      * @param headers
      * @return
      */
-    private String encrypt(String resJson,Map<String,String> headers){
+    private String encrypt(String resJson, Map<String, String> headers) {
         try {
             if (MappingConstant.VALUE_ON.equals(headers.get(CommonConstant.ENCRYPT))) {
                 logger.debug("鍔犲瘑鍓嶅瓧绗︼細" + resJson);
                 resJson = new String(AuthenticationFactory.encrypt(resJson.getBytes("UTF-8"), AuthenticationFactory.loadPubKey(MappingConstant.KEY_PUBLIC_STRING)
                         , NumberUtils.isNumber(headers.get(CommonConstant.ENCRYPT_KEY_SIZE)) ? Integer.parseInt(headers.get(CommonConstant.ENCRYPT_KEY_SIZE)) :
-                                Integer.parseInt(MappingCache.getValue(MappingConstant.KEY_DEFAULT_DECRYPT_KEY_SIZE))),"UTF-8");
+                                Integer.parseInt(MappingCache.getValue(MappingConstant.KEY_DEFAULT_DECRYPT_KEY_SIZE))), "UTF-8");
                 logger.debug("鍔犲瘑鍚庡瓧绗︼細" + resJson);
             }
-        }catch (Exception e){
-            logger.error("鍔犲瘑澶辫触锛�",e);
+        } catch (Exception e) {
+            logger.error("鍔犲瘑澶辫触锛�", e);
         }
         return resJson;
     }
-
 
 
     /**
@@ -222,7 +251,7 @@
                 //涓嶅仛鏍¢獙
                 //娣诲姞鑰楁椂
                 OrderDataFlowContextFactory.addCostTime(dataFlow, "ruleValidate", "瑙勫垯鏍¢獙鑰楁椂", startDate);
-                return ;
+                return;
             }
 
             //璋冪敤瑙勫垯
@@ -245,11 +274,11 @@
      */
     private void saveOrdersAndBusiness(IOrderDataFlowContext dataFlow) throws OrdersException {
         Date startDate = DateUtil.getCurrentDate();
-        if(MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
-                &&MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrders().getOrderTypeCd())){
+        if (MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
+                && MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrders().getOrderTypeCd())) {
             //涓嶄繚瀛樿鍗曚俊鎭�
             OrderDataFlowContextFactory.addCostTime(dataFlow, "saveOrdersAndBusiness", "淇濆瓨璁㈠崟鍜屼笟鍔¢」鑰楁椂", startDate);
-            return ;
+            return;
         }
 
 
@@ -295,20 +324,20 @@
      */
     private void invalidOrderAndBusiness(IOrderNotifyDataFlowContext dataFlow) {
         Date startDate = DateUtil.getCurrentDate();
-        if(MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
-                &&MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrderTypeCd())){
+        if (MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
+                && MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrderTypeCd())) {
             //涓嶇敤浣滃簾璁㈠崟淇℃伅
-           // OrderDataFlowContextFactory.addCostTime(dataFlow, "invalidOrderAndBusiness", "浣滃簾璁㈠崟鍜屼笟鍔¢」鑰楁椂", startDate);
-            return ;
+            // OrderDataFlowContextFactory.addCostTime(dataFlow, "invalidOrderAndBusiness", "浣滃簾璁㈠崟鍜屼笟鍔¢」鑰楁椂", startDate);
+            return;
         }
 
         //濡傛灉宸茬粡浣滃簾 涓嶅瓨鍦� 鎴栧け璐ワ紝鍒欎笉鍋氬鐞�
 
         Map order = centerServiceDaoImpl.getOrderInfoByBId(dataFlow.getbId());
 
-        if(order == null || !order.containsKey("status_cd") || StatusConstant.STATUS_CD_DELETE.equals(order.get("status_cd"))
-                || StatusConstant.STATUS_CD_ERROR.equals(order.get("status_cd"))){
-            return ;
+        if (order == null || !order.containsKey("status_cd") || StatusConstant.STATUS_CD_DELETE.equals(order.get("status_cd"))
+                || StatusConstant.STATUS_CD_ERROR.equals(order.get("status_cd"))) {
+            return;
         }
 
         //浣滃簾 璁㈠崟
@@ -331,30 +360,30 @@
      *
      * @param dataFlow
      */
-    private void invalidCompletedBusinessSystem(IOrderNotifyDataFlowContext dataFlow) throws Exception{
+    private void invalidCompletedBusinessSystem(IOrderNotifyDataFlowContext dataFlow) throws Exception {
 
-        if(!StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
-            return ;
+        if (!StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
+            return;
         }
 
         //鍒ゆ柇 璁㈠崟instance 鏄惁閮藉彉鎴愪簡鎾ゅ崟鐘舵��
-        if(centerServiceDaoImpl.judgeAllBusinessDeleteOrder(dataFlow.getoId(),StatusConstant.STATUS_CD_DELETE_ORDER) < 1){
-            return ;
+        if (centerServiceDaoImpl.judgeAllBusinessDeleteOrder(dataFlow.getoId(), StatusConstant.STATUS_CD_DELETE_ORDER) < 1) {
+            return;
         }
 
         // 鏍规嵁 c_business 琛ㄤ腑鐨勫瓧娈礲usiness_type_cd 鎵惧埌瀵瑰簲鐨勬秷鎭槦鍒楀悕绉�
         Map paramIn = new HashMap();
-        paramIn.put("oId",dataFlow.getoId());
-        paramIn.put("statusCd",StatusConstant.STATUS_CD_DELETE_ORDER);
+        paramIn.put("oId", dataFlow.getoId());
+        paramIn.put("statusCd", StatusConstant.STATUS_CD_DELETE_ORDER);
         List<Map> completedBusinesses = centerServiceDaoImpl.getBusinessByOId(paramIn);
-            for(Map completedBusiness : completedBusinesses){
-                ServiceBusiness serviceBusiness = ServiceBusinessUtil.getServiceBusiness(completedBusiness.get("business_type_cd").toString());
-                    long startTime = DateUtil.getCurrentDate().getTime();
-                    //鍙戣捣鎾ゅ崟
-                    KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(),"",
-                            OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow,completedBusiness).toJSONString());
-                    //saveLogMessage(OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow,completedBusiness,appRoute.getAppService()),null);
-                }
+        for (Map completedBusiness : completedBusinesses) {
+            ServiceBusiness serviceBusiness = ServiceBusinessUtil.getServiceBusiness(completedBusiness.get("business_type_cd").toString());
+            long startTime = DateUtil.getCurrentDate().getTime();
+            //鍙戣捣鎾ゅ崟
+            KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(), "",
+                    OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow, completedBusiness).toJSONString());
+            //saveLogMessage(OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow,completedBusiness,appRoute.getAppService()),null);
+        }
     }
 
     /**
@@ -397,6 +426,7 @@
         //OrderDataFlowContextFactory.addCostTime(dataFlow, "updateOrderAndBusinessError", "璁㈠崟鐘舵�佹敼涓哄け璐ヨ�楁椂", startDate);
 
     }
+
     /**
      * 灏嗚鍗曠姸鎬佹敼涓轰綔搴熺姸鎬併��
      *
@@ -416,58 +446,59 @@
         //doAddDeleteOrderBusinessData(dataFlow);
 
 
-
         OrderDataFlowContextFactory.addCostTime(dataFlow, "updateOrderAndBusinessError", "璁㈠崟鐘舵�佹敼涓哄け璐ヨ�楁椂", startDate);
 
     }
 
     /**
      * 鍔犲叆鎾ゅ崟璁板綍
+     *
      * @param dataFlow
      */
-    private void doAddDeleteOrderBusinessData(IOrderDataFlowContext dataFlow){
+    private void doAddDeleteOrderBusinessData(IOrderDataFlowContext dataFlow) {
        /* Map business = new HashMap();
         business.put("bId",SequenceUtil.getBId());
         business.put("oId",dataFlow.getoId());
         business.put("businessTypeCd",StatusConstant.REQUEST_BUSINESS_TYPE_DELETE);
         business.put("remark","鍙戣捣鎾ゅ崟");
         business.put("statusCd",StatusConstant.STATUS_CD_DELETE_ORDER);*/
-        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow,"璁㈠崟澶辫触锛屽姞鍏ユ挙鍗�"));
+        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow, "璁㈠崟澶辫触锛屽姞鍏ユ挙鍗�"));
     }
 
     /**
      * 鍔犲叆鎾ゅ崟璁板綍
+     *
      * @param dataFlow
      */
-    private void doAddDeleteOrderBusinessData(IOrderNotifyDataFlowContext dataFlow){
+    private void doAddDeleteOrderBusinessData(IOrderNotifyDataFlowContext dataFlow) {
        /* Map business = new HashMap();
         business.put("bId",SequenceUtil.getBId());
         business.put("oId",dataFlow.getoId());
         business.put("businessTypeCd",StatusConstant.REQUEST_BUSINESS_TYPE_DELETE);
         business.put("remark","鍙戣捣鎾ゅ崟");
         business.put("statusCd",StatusConstant.STATUS_CD_DELETE_ORDER);*/
-        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow,"璁㈠崟澶辫触锛屽姞鍏ユ挙鍗�"));
+        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow, "璁㈠崟澶辫触锛屽姞鍏ユ挙鍗�"));
     }
-
 
 
     /**
      * 鎺ュ彈涓氬姟绯荤粺閫氱煡娑堟伅
+     *
      * @param receiveJson 鎺ュ彈鎶ユ枃
      * @throws SMOException
      */
     @Override
-    public void receiveBusinessSystemNotifyMessage(String receiveJson) throws SMOException{
+    public void receiveBusinessSystemNotifyMessage(String receiveJson) throws SMOException {
         Date startDate = DateUtil.getCurrentDate();
         IOrderNotifyDataFlowContext dataFlow = null;
         try {
             //1.0 鍒涘缓鏁版嵁娴�
-            dataFlow = OrderDataFlowContextFactory.newInstance(OrderNotifyDataFlow.class).builder(receiveJson,null);
+            dataFlow = OrderDataFlowContextFactory.newInstance(OrderNotifyDataFlow.class).builder(receiveJson, null);
             //濡傛灉璁㈠崟閮芥病鏈変繚瀛橈紝鍒欏啀涓嶈澶勭悊
-            if(MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
-                    &&MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrderTypeCd())){
+            if (MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER) != null
+                    && MappingCache.getValue(MappingConstant.KEY_NO_SAVE_ORDER).contains(dataFlow.getOrderTypeCd())) {
                 //涓嶄繚瀛樿鍗曚俊鎭�
-                return ;
+                return;
             }
 
             //濡傛灉涓嶆槸 business 鍜宨nstance 杩囩▼ 鍒欑洿鎺ヨ烦鍑�
@@ -488,16 +519,16 @@
             //7.0 鍒ゆ柇鎾ゅ崟鏉′欢鏄惁婊¤冻锛屽鏋滄弧瓒冲彂璧锋挙鍗�
             invalidCompletedBusinessSystem(dataFlow);
 
-        }catch (BusinessStatusException e){
+        } catch (BusinessStatusException e) {
 
-            logger.error("璁㈠崟澶辫触:" ,e);
+            logger.error("璁㈠崟澶辫触:", e);
             //8.0 灏嗚鍗曠姸鎬佹敼涓哄け璐ワ紝浜哄伐澶勭悊銆�
             updateOrderAndBusinessError(dataFlow);
 
-        }catch (BusinessException e) {
+        } catch (BusinessException e) {
             //9.0璇存槑杩欎釜璁㈠崟宸茬粡澶辫触浜嗭紝鍐嶄笉闇�瑕�
             //鎯虫硶锛岃繖閲屽箍鎾綋鍓嶅け璐ヤ笟鍔�
-            logger.error("淇敼涓氬姟鏁版嵁澶辫触",e);
+            logger.error("淇敼涓氬姟鏁版嵁澶辫触", e);
         }/*catch (InitConfigDataException e){ //杩欑涓�鑸笉浼氬嚭鐜帮紝闄ら潪浜哄伐鏀逛簡鏁版嵁
             LoggerEngine.error("鍔犺浇閰嶇疆鏁版嵁鍑洪敊", e);
             try {
@@ -513,13 +544,13 @@
                 updateOrderAndBusinessError(dataFlow);
             }
 
-        }*/catch (NoSupportException e){
+        }*/ catch (NoSupportException e) {
             LoggerEngine.error("褰撳墠涓氬姟涓嶆敮鎸�", e);
-        }catch (Exception e){
+        } catch (Exception e) {
             LoggerEngine.error("浣滃簾璁㈠崟澶辫触", e);
             //10.0 鎴愬姛鐨勬儏鍐典笅閫氱煡涓嬫父绯荤粺澶辫触灏嗙姸鎬佹敼涓篘E锛屼汉宸ュ鐞嗐��
             updateBusinessNotifyError(dataFlow);
-        }finally{
+        } finally {
             /*OrderDataFlowContextFactory.addCostTime(dataFlow, "receiveBusinessSystemNotifyMessage", "鎺ュ彈涓氬姟绯荤粺閫氱煡娑堟伅鑰楁椂", startDate);
             saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),dataFlow.getReqJson().toJSONString()),
                     LogAgent.createLogMessage(dataFlow.getResponseCurrentHeaders(),ResponseConstant.RESULT_CODE_SUCCESS),
@@ -529,17 +560,18 @@
 
     /**
      * Instance杩囩▼
+     *
      * @param dataFlow
      */
     private void doSendInstance(IOrderNotifyDataFlowContext dataFlow) {
-        if(dataFlow == null || !StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType())){
-            return ;
+        if (dataFlow == null || !StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType())) {
+            return;
         }
         try {
             ServiceBusiness serviceBusiness = ServiceBusinessUtil.getServiceBusiness(dataFlow.getBusinessTypeCd());
             KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(), "",
                     OrderDataFlowContextFactory.getBusinessTableDataInfoToInstanceTableJson(dataFlow).toJSONString());
-        }catch (Exception e){
+        } catch (Exception e) {
 
         }
 
@@ -547,17 +579,18 @@
 
     /**
      * 鍒ゆ柇鏄惁鏄� business 鎴栬�� instance杩囩▼
+     *
      * @param dataFlow
      * @throws NoSupportException
      */
-    private void judgeBusinessOrInstance(IOrderNotifyDataFlowContext dataFlow) throws  NoSupportException{
+    private void judgeBusinessOrInstance(IOrderNotifyDataFlowContext dataFlow) throws NoSupportException {
 
-        if(dataFlow == null || StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType()) ||
-                StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())){
-            return ;
+        if (dataFlow == null || StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType()) ||
+                StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
+            return;
         }
 
-        throw new NoSupportException(ResponseConstant.RESULT_PARAM_ERROR,"褰撳墠鍙敮鎸� Business 鍜� Instance杩囩▼");
+        throw new NoSupportException(ResponseConstant.RESULT_PARAM_ERROR, "褰撳墠鍙敮鎸� Business 鍜� Instance杩囩▼");
     }
 
 
@@ -571,13 +604,13 @@
         Map order = centerServiceDaoImpl.getOrderInfoByBId(dataFlow.getBusinesses().get(0).getbId());
         dataFlow.setoId(order.get("o_id").toString());
         dataFlow.setAppId(order.get("app_id").toString());
-        if("-1".equals(dataFlow.getDataFlowId()) || StringUtil.isNullOrNone(dataFlow.getDataFlowId())){
-            throw new InitConfigDataException(ResponseConstant.RESULT_CODE_ERROR,"璇锋眰鎶ユ枃涓病鏈夊寘鍚� dataFlowId 鑺傜偣");
+        if ("-1".equals(dataFlow.getDataFlowId()) || StringUtil.isNullOrNone(dataFlow.getDataFlowId())) {
+            throw new InitConfigDataException(ResponseConstant.RESULT_CODE_ERROR, "璇锋眰鎶ユ枃涓病鏈夊寘鍚� dataFlowId 鑺傜偣");
         }
         //閲嶆柊鍒风鍙d俊鎭�
-        ServiceInfoListener serviceInfoListener =  ApplicationContextFactory.getBean("serviceInfoListener",ServiceInfoListener.class);
-        if(serviceInfoListener != null){
-            dataFlow.setPort(serviceInfoListener.getServerPort()+"");
+        ServiceInfoListener serviceInfoListener = ApplicationContextFactory.getBean("serviceInfoListener", ServiceInfoListener.class);
+        if (serviceInfoListener != null) {
+            dataFlow.setPort(serviceInfoListener.getServerPort() + "");
         }
         //閲嶆柊鍔犺浇閰嶇疆
         //initConfigData(dataFlow);
@@ -593,8 +626,8 @@
 
         Map order = centerServiceDaoImpl.getOrderInfoByBId(dataFlow.getbId());
         dataFlow.setoId(order.get("o_id").toString());
-        if("-1".equals(dataFlow.getDataFlowId()) || StringUtil.isNullOrNone(dataFlow.getDataFlowId())){
-            throw new InitConfigDataException(ResponseConstant.RESULT_CODE_ERROR,"璇锋眰鎶ユ枃涓病鏈夊寘鍚� dataFlowId 鑺傜偣");
+        if ("-1".equals(dataFlow.getDataFlowId()) || StringUtil.isNullOrNone(dataFlow.getDataFlowId())) {
+            throw new InitConfigDataException(ResponseConstant.RESULT_CODE_ERROR, "璇锋眰鎶ユ枃涓病鏈夊寘鍚� dataFlowId 鑺傜偣");
         }
     }
 
@@ -606,36 +639,37 @@
     private void updateBusinessNotifyError(IOrderNotifyDataFlowContext dataFlow) {
 
         Date startDate = DateUtil.getCurrentDate();
-            //瀹屾垚璁㈠崟椤�
+        //瀹屾垚璁㈠崟椤�
         centerServiceDaoImpl.updateBusinessByBId(OrderDataFlowContextFactory.getNeedNotifyErrorBusiness(dataFlow));
 
-       // OrderDataFlowContextFactory.addCostTime(dataFlow, "updateBusinessNotifyError", "璁㈠崟鐘舵�佹敼涓哄け璐ヨ�楁椂", startDate);
+        // OrderDataFlowContextFactory.addCostTime(dataFlow, "updateBusinessNotifyError", "璁㈠崟鐘舵�佹敼涓哄け璐ヨ�楁椂", startDate);
 
     }
 
     /**
      * 鍒ゆ柇鏄惁閮芥垚鍔熶簡
+     *
      * @param dataFlow
      */
-    private void judgeBusinessStatusAndCompleteBusiness(IOrderNotifyDataFlowContext dataFlow) throws BusinessStatusException{
+    private void judgeBusinessStatusAndCompleteBusiness(IOrderNotifyDataFlowContext dataFlow) throws BusinessStatusException {
 
         //List<Business> businesses = dataFlow.getBusinesses();
 
         //1.0 鍒ゆ柇鏄惁瀛樺湪鎾ゅ崟锛屽鏋滄槸鎾ゅ崟鍒欏皢褰撳墠 bId 鏍囪涓烘挙鍗曠姸鎬�
-        if(StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
+        if (StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
             Map businessMap = centerServiceDaoImpl.getDeleteOrderBusinessByOId(dataFlow.getoId());
-            if(businessMap != null && !businessMap.isEmpty()){
+            if (businessMap != null && !businessMap.isEmpty()) {
                 centerServiceDaoImpl.updateBusinessByBId(OrderDataFlowContextFactory.getNeedDeleteBusiness(dataFlow));
-                return ;
+                return;
             }
         }
 
         //Business business = dataFlow.getCurrentBusiness();
-        if(!ResponseConstant.RESULT_CODE_SUCCESS.equals(((IOrderResponse)dataFlow).getCode())){
+        if (!ResponseConstant.RESULT_CODE_SUCCESS.equals(((IOrderResponse) dataFlow).getCode())) {
             //throw new BusinessStatusException(business.getCode(),"涓氬姟bId= "+business.getbId() + " 澶勭悊澶辫触锛岄渶瑕佷綔搴熻鍗�");
             //浣滃簾璁㈠崟鍜屼笟鍔¢」 鎻掑叆鎾ゅ崟璁板綍 绛夊緟鎾ゅ崟
             invalidOrderAndBusiness(dataFlow);
-        }else{
+        } else {
             completeBusiness(dataFlow);
         }
 
@@ -646,36 +680,37 @@
      *
      * @param dataFlow
      */
-    private void completeBusiness(IOrderNotifyDataFlowContext dataFlow) throws BusinessException{
+    private void completeBusiness(IOrderNotifyDataFlowContext dataFlow) throws BusinessException {
         try {
-            if(StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
+            if (StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(dataFlow.getBusinessType())) {
                 //瀹屾垚璁㈠崟椤�
                 centerServiceDaoImpl.updateBusinessByBId(OrderDataFlowContextFactory.getNeedCompleteBusiness(dataFlow));
 
                 //濡傛灉涓氬姟閮藉畬鎴愶紝鍒欏皢 璁㈠崟鏀逛负瀹屾垚鐘舵��
                 centerServiceDaoImpl.completeOrderByBId(dataFlow.getbId());
-            }else if(StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType())) {
+            } else if (StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(dataFlow.getBusinessType())) {
                 centerServiceDaoImpl.updateBusinessByBId(OrderDataFlowContextFactory.getNeedBusinessComplete(dataFlow));
-            }else{ //杩欓噷鍒颁笉浜嗭紝鍓嶉潰鍋氫簡鏍¢獙
-                throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,"褰撳墠涓嶆敮鎸� 涓氬姟绫诲瀷涓� businessType" +dataFlow.getBusinessType());
+            } else { //杩欓噷鍒颁笉浜嗭紝鍓嶉潰鍋氫簡鏍¢獙
+                throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR, "褰撳墠涓嶆敮鎸� 涓氬姟绫诲瀷涓� businessType" + dataFlow.getBusinessType());
             }
 
-        }catch (DAOException e){
-            throw new BusinessException(e.getResult(),e);
+        } catch (DAOException e) {
+            throw new BusinessException(e.getResult(), e);
         }
     }
 
     /**
      * //4.0褰撴墍鏈変笟鍔″姩浣滄槸鍚﹂兘鏄疌锛屽皢璁㈠崟淇℃伅鏀逛负 C 骞朵笖鍙戝竷绔e伐娑堟伅锛岃繖閲屽湪骞挎挱涔嬪墠纭
+     *
      * @param dataFlow
      */
-    private void judgeSendToInstance(IOrderNotifyDataFlowContext dataFlow) throws Exception{
+    private void judgeSendToInstance(IOrderNotifyDataFlowContext dataFlow) throws Exception {
         try {
-            if(centerServiceDaoImpl.judgeAllBusinessCompleted(dataFlow.getoId(),StatusConstant.STATUS_CD_BUSINESS_COMPLETE) > 0) {
+            if (centerServiceDaoImpl.judgeAllBusinessCompleted(dataFlow.getoId(), StatusConstant.STATUS_CD_BUSINESS_COMPLETE) > 0) {
                 //閫氱煡鎴愬姛娑堟伅
                 doSendInstance(dataFlow);
             }
-        }catch (DAOException e){
+        } catch (DAOException e) {
             //杩欓噷浠�涔堥兘涓嶅仛锛岃鏄庤鍗曟病鏈夊畬鎴�
         }
 
@@ -684,15 +719,16 @@
 
     /**
      * 閫氱煡 璁㈠崟宸茬粡瀹屾垚锛屽悗绔渶瑕佸畬鎴愭暟鎹�
+     *
      * @param dataFlow
      */
-    private void notifyBusinessSystemSuccessMessage(IOrderNotifyDataFlowContext dataFlow) throws Exception{
+    private void notifyBusinessSystemSuccessMessage(IOrderNotifyDataFlowContext dataFlow) throws Exception {
 
         long startTime = DateUtil.getCurrentDate().getTime();
 
         ServiceBusiness serviceBusiness = ServiceBusinessUtil.getServiceBusiness(dataFlow.getBusinessTypeCd());
         //鎷艰鎶ユ枃閫氱煡涓氬姟绯荤粺
-        KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(),"",
+        KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(), "",
                 OrderDataFlowContextFactory.getNotifyBusinessSuccessJson(dataFlow).toJSONString());
 
         /*saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),OrderDataFlowContextFactory.getNotifyBusinessSuccessJson(dataFlow).toJSONString()),
@@ -705,13 +741,13 @@
      *
      * @param dataFlow
      */
-    private void notifyBusinessSystemErrorMessage(IOrderNotifyDataFlowContext dataFlow) throws Exception{
+    private void notifyBusinessSystemErrorMessage(IOrderNotifyDataFlowContext dataFlow) throws Exception {
         long startTime = DateUtil.getCurrentDate().getTime();
 
         ServiceBusiness serviceBusiness = ServiceBusinessUtil.getServiceBusiness(dataFlow.getBusinessTypeCd());
 
         //鎷艰鎶ユ枃閫氱煡涓氬姟绯荤粺
-        KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(),"",
+        KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(), "",
                 OrderDataFlowContextFactory.getNotifyBusinessErrorJson(dataFlow).toJSONString());
         /*saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),OrderDataFlowContextFactory.getNotifyBusinessErrorJson(dataFlow).toJSONString()),
                 LogAgent.createLogMessage(dataFlow.getResponseCurrentHeaders(),ResponseConstant.RESULT_CODE_ERROR),
@@ -720,16 +756,17 @@
 
     /**
      * 澶勭悊鍚屾涓氬姟
+     *
      * @param dataFlow
      */
-    private void doSynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException{
+    private void doSynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException {
         Date startDate = DateUtil.getCurrentDate();
         List<Business> synchronousBusinesses = OrderDataFlowContextFactory.getSynchronousBusinesses(dataFlow);
 
         List<Business> deleteBusinesses = new ArrayList<Business>();
 
-        if(synchronousBusinesses == null || synchronousBusinesses.size() == 0){
-            return ;
+        if (synchronousBusinesses == null || synchronousBusinesses.size() == 0) {
+            return;
         }
         JSONArray responseBusinesses = new JSONArray();
 
@@ -738,16 +775,16 @@
 
         try {
             //6.2鍙戣捣Instance
-            doBusinessTableDataInfoToInstanceTable(dataFlow, synchronousBusinesses,deleteBusinesses);
-        }catch (Exception e){
+            doBusinessTableDataInfoToInstanceTable(dataFlow, synchronousBusinesses, deleteBusinesses);
+        } catch (Exception e) {
             try {
                 //杩欓噷鍙戣捣鎾ゅ崟閫昏緫
                 doDeleteOrderAndInstanceData(dataFlow, deleteBusinesses);
-            }catch (Exception e1){
-                logger.error("鎾ゅ崟澶辫触",e1);
+            } catch (Exception e1) {
+                logger.error("鎾ゅ崟澶辫触", e1);
                 //杩欓噷璁板綍鎾ゅ崟澶辫触鐨勪俊鎭�
             }
-            throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,e.getMessage());
+            throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR, e.getMessage());
         }
         //6.3 c_business 鏁版嵁淇敼涓哄畬鎴�
         /*List<Business> asynchronousBusinesses = OrderDataFlowContextFactory.getAsynchronousBusinesses(dataFlow);
@@ -755,25 +792,26 @@
             doComplateOrderAndBusiness(dataFlow,synchronousBusinesses);
         }*/
         OrderDataFlowContextFactory.addCostTime(dataFlow, "doSynchronousBusinesses", "鍚屾璋冪敤涓氬姟绯荤粺鎬昏�楁椂", startDate);
-}
+    }
 
     /**
      * 鍙戣捣鎾ゅ崟涓氬姟
+     *
      * @param dataFlow
      * @param deleteBusinesses
      */
     private void doDeleteOrderAndInstanceData(IOrderDataFlowContext dataFlow, List<Business> deleteBusinesses) {
 
-        if(deleteBusinesses == null || deleteBusinesses.size() == 0){
-            return ;
+        if (deleteBusinesses == null || deleteBusinesses.size() == 0) {
+            return;
         }
 
         //1.0 鍦╟_business 琛ㄤ腑鍔犲叆 鎾ゅ崟璁板綍
-        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow,"涓氬姟绯荤粺瀹炰緥澶辫触锛屽彂璧锋挙鍗�"));
+        centerServiceDaoImpl.saveBusiness(OrderDataFlowContextFactory.getDeleteOrderBusiness(dataFlow, "涓氬姟绯荤粺瀹炰緥澶辫触锛屽彂璧锋挙鍗�"));
         //2.0 浣滃簾 c_orders 鍜� c_business 鏁版嵁
         updateOrderAndBusinessDelete(dataFlow);
         //3.0 鍙戣捣 鎾ゅ崟涓氬姟
-        doDeleteBusinessSystemInstanceData(dataFlow,deleteBusinesses);
+        doDeleteBusinessSystemInstanceData(dataFlow, deleteBusinesses);
     }
 
     /**
@@ -811,25 +849,26 @@
 
     /**
      * 灏咮usinessTable 涓殑鏁版嵁淇濆瓨鍒� InstanceTable
+     *
      * @param dataFlow
      * @param synchronousBusinesses
      */
-    private void doBusinessTableDataInfoToInstanceTable(IOrderDataFlowContext dataFlow, List<Business> synchronousBusinesses,List<Business> deleteBusinesses) {
+    private void doBusinessTableDataInfoToInstanceTable(IOrderDataFlowContext dataFlow, List<Business> synchronousBusinesses, List<Business> deleteBusinesses) {
         Date businessStartDate;
         ServiceBusiness serviceBusiness;
         JSONObject requestBusinessJson;
-        for(Business business : synchronousBusinesses){
+        for (Business business : synchronousBusinesses) {
             businessStartDate = DateUtil.getCurrentDate();
             serviceBusiness = ServiceBusinessUtil.getServiceBusiness(business.getBusinessTypeCd());
             //娣诲姞闇�瑕佹挙鍗曠殑涓氬姟淇℃伅
             deleteBusinesses.add(business);
 
-            requestBusinessJson = OrderDataFlowContextFactory.getBusinessTableDataInfoToInstanceTableJson(dataFlow,business);
+            requestBusinessJson = OrderDataFlowContextFactory.getBusinessTableDataInfoToInstanceTableJson(dataFlow, business);
             JSONObject responseJson = doRequestBusinessSystem(dataFlow, serviceBusiness, requestBusinessJson);
             //鍙戝竷浜嬩欢
-            DataFlowEventPublishing.invokeBusinessISuccess(dataFlow,business);
-            updateBusinessStatusCdByBId(business.getbId(),StatusConstant.STATUS_CD_COMPLETE);
-            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤"+business.getBusinessTypeCd()+"鑰楁椂", businessStartDate);
+            DataFlowEventPublishing.invokeBusinessISuccess(dataFlow, business);
+            updateBusinessStatusCdByBId(business.getbId(), StatusConstant.STATUS_CD_COMPLETE);
+            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤" + business.getBusinessTypeCd() + "鑰楁椂", businessStartDate);
           /*  saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),requestBusinessJson.toJSONString()),
                     LogAgent.createLogMessage(dataFlow.getResponseCurrentHeaders(),responseJson.toJSONString()),
                     DateUtil.getCurrentDate().getTime() - businessStartDate.getTime());*/
@@ -839,13 +878,14 @@
             return ;
         }*/
 
-            //鍒ゆ柇涓氬姟鍔ㄤ綔鏄惁閮界宸ワ紝涓昏鑰冭檻 璇锋眰鎶ユ枃涓� 鏈夊紓姝ヤ篃鏈夊悓姝ョ殑鎯呭喌
-            //濡傛灉涓氬姟閮藉畬鎴愶紝鍒欏皢 璁㈠崟鏀逛负瀹屾垚鐘舵��
-            centerServiceDaoImpl.completeOrderByOId(dataFlow.getOrders().getoId());
+        //鍒ゆ柇涓氬姟鍔ㄤ綔鏄惁閮界宸ワ紝涓昏鑰冭檻 璇锋眰鎶ユ枃涓� 鏈夊紓姝ヤ篃鏈夊悓姝ョ殑鎯呭喌
+        //濡傛灉涓氬姟閮藉畬鎴愶紝鍒欏皢 璁㈠崟鏀逛负瀹屾垚鐘舵��
+        centerServiceDaoImpl.completeOrderByOId(dataFlow.getOrders().getoId());
     }
 
     /**
      * 涓氬姟绯荤粺鎾ゅ崟
+     *
      * @param dataFlow
      * @param deleteBusinesses
      */
@@ -853,12 +893,12 @@
         Date businessStartDate;
         JSONObject requestBusinessJson;
         ServiceBusiness serviceBusiness;
-        for(Business business : deleteBusinesses){
+        for (Business business : deleteBusinesses) {
             businessStartDate = DateUtil.getCurrentDate();
-            requestBusinessJson = OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow,business);
+            requestBusinessJson = OrderDataFlowContextFactory.getDeleteInstanceTableJson(dataFlow, business);
             serviceBusiness = ServiceBusinessUtil.getServiceBusiness(business.getBusinessTypeCd());
             JSONObject responseJson = doRequestBusinessSystem(dataFlow, serviceBusiness, requestBusinessJson);
-            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤"+business.getBusinessTypeCd()+"-鎾ゅ崟 鑰楁椂", businessStartDate);
+            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤" + business.getBusinessTypeCd() + "-鎾ゅ崟 鑰楁椂", businessStartDate);
 //            saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),requestBusinessJson.toJSONString()),
 //                    LogAgent.createLogMessage(dataFlow.getResponseCurrentHeaders(),responseJson.toJSONString()),
 //                    DateUtil.getCurrentDate().getTime() - businessStartDate.getTime());
@@ -867,6 +907,7 @@
 
     /**
      * 璋冪敤涓嬫父绯荤粺
+     *
      * @param dataFlow
      * @param serviceBusiness
      * @param requestBusinessJson 璇锋眰鎶ユ枃
@@ -875,63 +916,65 @@
     private JSONObject doRequestBusinessSystem(IOrderDataFlowContext dataFlow, ServiceBusiness serviceBusiness, JSONObject requestBusinessJson) {
         String responseMessage;
 
-        Assert.hasLength(serviceBusiness.getInvokeType(),"c_service_business琛ㄩ厤缃嚭閿欙紝invoke_type 涓嶈兘涓虹┖"+ serviceBusiness.getBusinessTypeCd());
-        if(ServiceBusinessConstant.INVOKE_TYPE_WEBSERVICE.equals(serviceBusiness.getInvokeType())) {//webservice鏂瑰紡
+        Assert.notNull(serviceBusiness, "鍦ㄨ〃c_service_business涓湭閰嶇疆褰撳墠涓氬姟绫诲瀷");
+
+        Assert.hasLength(serviceBusiness.getInvokeType(), "c_service_business琛ㄩ厤缃嚭閿欙紝invoke_type 涓嶈兘涓虹┖" + serviceBusiness.getBusinessTypeCd());
+        String httpUrl = "";
+        if (ServiceBusinessConstant.INVOKE_TYPE_WEBSERVICE.equals(serviceBusiness.getInvokeType())) {//webservice鏂瑰紡
             String url = serviceBusiness.getUrl();
             String[] urls = url.split("#");
 
-            if(urls.length != 2){
-                throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR,"閰嶇疆閿欒锛歝_service_business閰嶇疆url瀛楁閿欒"+serviceBusiness.getBusinessTypeCd());
+            if (urls.length != 2) {
+                throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR, "閰嶇疆閿欒锛歝_service_business閰嶇疆url瀛楁閿欒" + serviceBusiness.getBusinessTypeCd());
             }
-            String webserviceUrl = MappingCache.getValue(urls[0]);
+            httpUrl = MappingCache.getValue(urls[0]);
             String method = MappingCache.getValue(urls[1]);
-            responseMessage = (String) WebServiceAxisClient.callWebService(webserviceUrl,method,
+            responseMessage = (String) WebServiceAxisClient.callWebService(httpUrl, method,
                     new Object[]{requestBusinessJson.toJSONString()},
                     serviceBusiness.getTimeout());
-        }else if(ServiceBusinessConstant.INVOKE_TYPE_HTTP_POST.equals(serviceBusiness.getInvokeType())){
+        } else if (ServiceBusinessConstant.INVOKE_TYPE_HTTP_POST.equals(serviceBusiness.getInvokeType())) {
             //http://user-service/test/sayHello
-            String httpPostUrl = MappingCache.getValue(serviceBusiness.getUrl());
-            responseMessage = restTemplate.postForObject(httpPostUrl,requestBusinessJson.toJSONString(),String.class);
-        }else if(ServiceBusinessConstant.INVOKE_TYPE_OUT_HTTP_POST.equals(serviceBusiness.getInvokeType())){
-            String httpPostUrl = MappingCache.getValue(serviceBusiness.getUrl());
-            responseMessage = restTemplateNoLoadBalanced.postForObject(httpPostUrl,requestBusinessJson.toJSONString(),String.class);
-        }
-        else {//post鏂瑰紡
-            throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR,"閰嶇疆閿欒锛歝_service_business閰嶇疆url瀛楁閿欒,褰撳墠鏃犳硶璇嗗埆"+serviceBusiness.getBusinessTypeCd());
+            httpUrl = MappingCache.getValue(serviceBusiness.getUrl());
+            responseMessage = restTemplate.postForObject(httpUrl, requestBusinessJson.toJSONString(), String.class);
+        } else if (ServiceBusinessConstant.INVOKE_TYPE_OUT_HTTP_POST.equals(serviceBusiness.getInvokeType())) {
+            httpUrl = MappingCache.getValue(serviceBusiness.getUrl());
+            responseMessage = restTemplateNoLoadBalanced.postForObject(httpUrl, requestBusinessJson.toJSONString(), String.class);
+        } else {//post鏂瑰紡
+            throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR, "閰嶇疆閿欒锛歝_service_business閰嶇疆url瀛楁閿欒,褰撳墠鏃犳硶璇嗗埆" + serviceBusiness.getBusinessTypeCd());
         }
 
 
-        logger.debug("璁㈠崟鏈嶅姟璋冪敤涓嬫父鏈嶅姟璇锋眰鎶ユ枃锛歿}锛岃繑鍥炴姤鏂囷細{}",requestBusinessJson,responseMessage);
+        logger.debug("璋冪敤鍦板潃锛歿}, 璁㈠崟鏈嶅姟璋冪敤涓嬫父鏈嶅姟璇锋眰鎶ユ枃锛歿}锛岃繑鍥炴姤鏂囷細{}", httpUrl, requestBusinessJson, responseMessage);
 
-        if(StringUtil.isNullOrNone(responseMessage) || !Assert.isJsonObject(responseMessage)){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"涓嬫父绯荤粺杩斿洖鏍煎紡涓嶆纭紝璇锋寜鍗忚瑙勮寖澶勭悊");
+        if (StringUtil.isNullOrNone(responseMessage) || !Assert.isJsonObject(responseMessage)) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "涓嬫父绯荤粺杩斿洖鏍煎紡涓嶆纭紝璇锋寜鍗忚瑙勮寖澶勭悊");
         }
         JSONObject responseJson = JSONObject.parseObject(responseMessage);
 
-        Assert.jsonObjectHaveKey(responseJson,"response","涓嬫父杩斿洖鎶ユ枃鏍煎紡閿欒锛屾病鏈夊寘鍚玶esponseJson鑺傜偣銆�"+serviceBusiness.getBusinessTypeCd()+"銆�");
+        Assert.jsonObjectHaveKey(responseJson, "response", "涓嬫父杩斿洖鎶ユ枃鏍煎紡閿欒锛屾病鏈夊寘鍚玶esponseJson鑺傜偣銆�" + serviceBusiness.getBusinessTypeCd() + "銆�");
 
         JSONObject responseInfo = responseJson.getJSONObject("response");
 
-        Assert.jsonObjectHaveKey(responseInfo,"code","涓嬫父杩斿洖鎶ユ枃鏍煎紡閿欒锛宺esponse 鑺傜偣涓病鏈夊寘鍚玞ode鑺傜偣銆�"+serviceBusiness.getBusinessTypeCd()+"銆�");
+        Assert.jsonObjectHaveKey(responseInfo, "code", "涓嬫父杩斿洖鎶ユ枃鏍煎紡閿欒锛宺esponse 鑺傜偣涓病鏈夊寘鍚玞ode鑺傜偣銆�" + serviceBusiness.getBusinessTypeCd() + "銆�");
 
-        if(!ResponseConstant.RESULT_CODE_SUCCESS.equals(responseInfo.getString("code"))){
-            throw  new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,"涓氬姟绯荤粺澶勭悊澶辫触锛�"+responseInfo.getString("message"));
+        if (!ResponseConstant.RESULT_CODE_SUCCESS.equals(responseInfo.getString("code"))) {
+            throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR, "涓氬姟绯荤粺澶勭悊澶辫触锛�" + responseInfo.getString("message"));
         }
         return responseJson;
     }
 
     private String doTransferRequestBusinessSystem(DataFlow dataFlow, AppService service, String reqData) {
         String responseMessage;
-        if(service.getMethod() == null || "".equals(service.getMethod())) {//post鏂瑰紡
+        if (service.getMethod() == null || "".equals(service.getMethod())) {//post鏂瑰紡
             //http://user-service/test/sayHello
             HttpHeaders header = new HttpHeaders();
-            for(String key : dataFlow.getRequestCurrentHeaders().keySet()){
-                header.add(key,dataFlow.getRequestCurrentHeaders().get(key));
+            for (String key : dataFlow.getRequestCurrentHeaders().keySet()) {
+                header.add(key, dataFlow.getRequestCurrentHeaders().get(key));
             }
             HttpEntity<String> httpEntity = new HttpEntity<String>(reqData, header);
-            responseMessage = restTemplateNoLoadBalanced.postForObject(service.getUrl(),httpEntity,String.class);
-        }else{//webservice鏂瑰紡
-            responseMessage = (String) WebServiceAxisClient.callWebService(service.getUrl(),service.getMethod(),
+            responseMessage = restTemplateNoLoadBalanced.postForObject(service.getUrl(), httpEntity, String.class);
+        } else {//webservice鏂瑰紡
+            responseMessage = (String) WebServiceAxisClient.callWebService(service.getUrl(), service.getMethod(),
                     new Object[]{dataFlow.getRequestBusinessJson().toJSONString()},
                     service.getTimeOut());
         }
@@ -940,6 +983,7 @@
 
     /**
      * 鏁版嵁淇濆瓨鍒癇usinessTable 涓�
+     *
      * @param dataFlow
      * @param synchronousBusinesses
      * @param responseBusinesses
@@ -948,22 +992,22 @@
         Date businessStartDate;
         ServiceBusiness serviceBusiness;
         JSONObject requestBusinessJson;
-        for(Business business : synchronousBusinesses) {
+        for (Business business : synchronousBusinesses) {
             businessStartDate = DateUtil.getCurrentDate();
             //鍙戣捣Business杩囩▼
-            updateBusinessStatusCdByBId(business.getbId(),StatusConstant.STATUS_CD_BUSINESS);
+            updateBusinessStatusCdByBId(business.getbId(), StatusConstant.STATUS_CD_BUSINESS);
 
             serviceBusiness = ServiceBusinessUtil.getServiceBusiness(business.getBusinessTypeCd());
-            requestBusinessJson = OrderDataFlowContextFactory.getRequestBusinessJson(dataFlow,business);
+            requestBusinessJson = OrderDataFlowContextFactory.getRequestBusinessJson(dataFlow, business);
 
             JSONObject responseJson = doRequestBusinessSystem(dataFlow, serviceBusiness, requestBusinessJson);
 
             //鍙戝竷浜嬩欢
-            DataFlowEventPublishing.invokeBusinessBSuccess(dataFlow,business,responseJson);
+            DataFlowEventPublishing.invokeBusinessBSuccess(dataFlow, business, responseJson);
 
             responseBusinesses.add(responseJson);
 
-            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤"+business.getBusinessTypeCd()+"鑰楁椂", businessStartDate);
+            OrderDataFlowContextFactory.addCostTime(dataFlow, business.getBusinessTypeCd(), "璋冪敤" + business.getBusinessTypeCd() + "鑰楁椂", businessStartDate);
    /*         saveLogMessage(null,LogAgent.createLogMessage(dataFlow.getRequestCurrentHeaders(),requestBusinessJson.toJSONString()),
                     LogAgent.createLogMessage(dataFlow.getResponseCurrentHeaders(),responseJson.toJSONString()),
                     DateUtil.getCurrentDate().getTime()-businessStartDate.getTime());*/
@@ -972,25 +1016,26 @@
 
     /**
      * 澶勭悊寮傛涓氬姟
+     *
      * @param
      */
-    private void doAsynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException{
+    private void doAsynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException {
         Date startDate = DateUtil.getCurrentDate();
         //6.3 澶勭悊寮傛锛屾寜娑堟伅闃熼噷澶勭悊
         List<Business> asynchronousBusinesses = OrderDataFlowContextFactory.getAsynchronousBusinesses(dataFlow);
 
-        if(asynchronousBusinesses == null || asynchronousBusinesses.size() == 0){
-            return ;
+        if (asynchronousBusinesses == null || asynchronousBusinesses.size() == 0) {
+            return;
         }
         ServiceBusiness serviceBusiness;
         try {
             for (Business business : asynchronousBusinesses) {
                 serviceBusiness = ServiceBusinessUtil.getServiceBusiness(business.getBusinessTypeCd());
                 KafkaFactory.sendKafkaMessage(serviceBusiness.getMessageTopic(), "",
-                        OrderDataFlowContextFactory.getRequestBusinessJson(dataFlow,business).toJSONString());
+                        OrderDataFlowContextFactory.getRequestBusinessJson(dataFlow, business).toJSONString());
             }
-        }catch (Exception e){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,e.getMessage());
+        } catch (Exception e) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, e.getMessage());
         }
 
         OrderDataFlowContextFactory.addCostTime(dataFlow, "doSynchronousBusinesses", "寮傛璋冪敤涓氬姟绯荤粺鎬昏�楁椂", startDate);
@@ -1002,75 +1047,78 @@
 
     /**
      * 淇濆瓨鏃ュ織淇℃伅
-     * @param dataFlow 鏁版嵁娴佸璞� 灏佽鐢ㄦ埛璇锋眰鐨勪俊鎭�
      *
-     * @param requestJson 璇锋眰鎶ユ枃 鏍煎紡涓�
-     *                    {"headers":"",
+     * @param dataFlow     鏁版嵁娴佸璞� 灏佽鐢ㄦ埛璇锋眰鐨勪俊鎭�
+     * @param requestJson  璇锋眰鎶ユ枃 鏍煎紡涓�
+     *                     {"headers":"",
      *                     "body":""
      *                     }
      * @param responseJson 璇锋眰鎶ユ枃 鏍煎紡涓�
-     *                    {"headers":"",
+     *                     {"headers":"",
      *                     "body":""
      *                     }
      */
-    private void saveLogMessage(DataFlow dataFlow,JSONObject requestJson,JSONObject responseJson,long costTime){
-            LogAgent.sendLog(dataFlow,requestJson,responseJson,costTime);
+    private void saveLogMessage(DataFlow dataFlow, JSONObject requestJson, JSONObject responseJson, long costTime) {
+        LogAgent.sendLog(dataFlow, requestJson, responseJson, costTime);
     }
 
     /**
      * 淇濆瓨鏃ュ織淇℃伅
+     *
      * @param requestJson
      */
-    private void saveLogMessage(String requestJson,String responseJson){
+    private void saveLogMessage(String requestJson, String responseJson) {
 
-        try{
-            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))){
+        try {
+            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))) {
                 JSONObject log = new JSONObject();
-                log.put("request",requestJson);
-                log.put("response",responseJson);
-                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME,"",log.toJSONString());
+                log.put("request", requestJson);
+                log.put("response", responseJson);
+                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME, "", log.toJSONString());
             }
-        }catch (Exception e){
-            logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝",e);
+        } catch (Exception e) {
+            logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝", e);
         }
     }
 
     /**
      * 淇濆瓨鑰楁椂淇℃伅
+     *
      * @param dataFlow
      */
-    private void saveCostTimeLogMessage(DataFlow dataFlow){
-        try{
-            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))){
+    private void saveCostTimeLogMessage(DataFlow dataFlow) {
+        try {
+            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
                 List<DataFlowLinksCost> dataFlowLinksCosts = dataFlow.getLinksCostDates();
                 JSONObject costDate = new JSONObject();
                 JSONArray costDates = new JSONArray();
                 JSONObject newObj = null;
-                for(DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts){
+                for (DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts) {
                     newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
-                    newObj.put("dataFlowId",dataFlow.getDataFlowId());
-                    newObj.put("transactionId",dataFlow.getTransactionId());
+                    newObj.put("dataFlowId", dataFlow.getDataFlowId());
+                    newObj.put("transactionId", dataFlow.getTransactionId());
                     costDates.add(newObj);
                 }
-                costDate.put("costDates",costDates);
+                costDate.put("costDates", costDates);
 
-                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME,"",costDate.toJSONString());
+                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME, "", costDate.toJSONString());
             }
-        }catch (Exception e){
-            logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝",e);
+        } catch (Exception e) {
+            logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝", e);
         }
     }
 
     /**
      * 淇敼c_business鐘舵��
+     *
      * @param bId
      * @param statusCd
      */
-    private void updateBusinessStatusCdByBId(String bId,String statusCd){
+    private void updateBusinessStatusCdByBId(String bId, String statusCd) {
         Map business = new HashMap();
-        business.put("bId",bId);
-        business.put("statusCd",statusCd);
-        business.put("finishTime",DateUtil.getCurrentDate());
+        business.put("bId", bId);
+        business.put("statusCd", statusCd);
+        business.put("finishTime", DateUtil.getCurrentDate());
         centerServiceDaoImpl.updateBusinessByBId(business);
     }
 

--
Gitblit v1.8.0