From f7b32b8f0143ea03f81ff5a54a5fd1fd208b921b Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 28 五月 2020 15:33:50 +0800
Subject: [PATCH] 优化完成巡检计划

---
 FeeService/src/main/java/com/java110/fee/listener/config/UpdateFeeConfigInfoListener.java |   96 +++++++++++++++++++++++------------------------
 1 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/FeeService/src/main/java/com/java110/fee/listener/config/UpdateFeeConfigInfoListener.java b/FeeService/src/main/java/com/java110/fee/listener/config/UpdateFeeConfigInfoListener.java
index f767403..0d98be1 100644
--- a/FeeService/src/main/java/com/java110/fee/listener/config/UpdateFeeConfigInfoListener.java
+++ b/FeeService/src/main/java/com/java110/fee/listener/config/UpdateFeeConfigInfoListener.java
@@ -22,7 +22,7 @@
 
 /**
  * 淇敼璐圭敤閰嶇疆淇℃伅 渚﹀惉
- *
+ * <p>
  * 澶勭悊鑺傜偣
  * 1銆乥usinessFeeConfig:{} 璐圭敤閰嶇疆鍩烘湰淇℃伅鑺傜偣
  * 2銆乥usinessFeeConfigAttr:[{}] 璐圭敤閰嶇疆灞炴�т俊鎭妭鐐�
@@ -51,45 +51,45 @@
 
     /**
      * business杩囩▼
+     *
      * @param dataFlowContext 涓婁笅鏂囧璞�
-     * @param business 涓氬姟瀵硅薄
+     * @param business        涓氬姟瀵硅薄
      */
     @Override
     protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
 
         JSONObject data = business.getDatas();
 
-        Assert.notEmpty(data,"娌℃湁datas 鑺傜偣锛屾垨娌℃湁瀛愯妭鐐归渶瑕佸鐞�");
+        Assert.notEmpty(data, "娌℃湁datas 鑺傜偣锛屾垨娌℃湁瀛愯妭鐐归渶瑕佸鐞�");
 
         //澶勭悊 businessFeeConfig 鑺傜偣
-        if(data.containsKey("businessFeeConfig")){
-            //澶勭悊 businessFeeConfig 鑺傜偣
-            if(data.containsKey("businessFeeConfig")){
-                Object _obj = data.get("businessFeeConfig");
-                JSONArray businessFeeConfigs = null;
-                if(_obj instanceof JSONObject){
-                    businessFeeConfigs = new JSONArray();
-                    businessFeeConfigs.add(_obj);
-                }else {
-                    businessFeeConfigs = (JSONArray)_obj;
-                }
-                //JSONObject businessFeeConfig = data.getJSONObject("businessFeeConfig");
-                for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigs.size();_feeConfigIndex++) {
-                    JSONObject businessFeeConfig = businessFeeConfigs.getJSONObject(_feeConfigIndex);
-                    doBusinessFeeConfig(business, businessFeeConfig);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("configId", businessFeeConfig.getString("configId"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_CONFIG)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_CONFIG);
+            JSONArray businessFeeConfigs = null;
+            if (_obj instanceof JSONObject) {
+                businessFeeConfigs = new JSONArray();
+                businessFeeConfigs.add(_obj);
+            } else {
+                businessFeeConfigs = (JSONArray) _obj;
+            }
+            //JSONObject businessFeeConfig = data.getJSONObject("businessFeeConfig");
+            for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigs.size(); _feeConfigIndex++) {
+                JSONObject businessFeeConfig = businessFeeConfigs.getJSONObject(_feeConfigIndex);
+                doBusinessFeeConfig(business, businessFeeConfig);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("configId", businessFeeConfig.getString("configId"));
                 }
             }
         }
+
     }
 
 
     /**
      * business to instance 杩囩▼
+     *
      * @param dataFlowContext 鏁版嵁瀵硅薄
-     * @param business 褰撳墠涓氬姟瀵硅薄
+     * @param business        褰撳墠涓氬姟瀵硅薄
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -97,17 +97,17 @@
         JSONObject data = business.getDatas();
 
         Map info = new HashMap();
-        info.put("bId",business.getbId());
-        info.put("operate",StatusConstant.OPERATE_ADD);
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_ADD);
 
         //璐圭敤閰嶇疆淇℃伅
         List<Map> businessFeeConfigInfos = feeConfigServiceDaoImpl.getBusinessFeeConfigInfo(info);
-        if( businessFeeConfigInfos != null && businessFeeConfigInfos.size() >0) {
-            for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigInfos.size();_feeConfigIndex++) {
+        if (businessFeeConfigInfos != null && businessFeeConfigInfos.size() > 0) {
+            for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigInfos.size(); _feeConfigIndex++) {
                 Map businessFeeConfigInfo = businessFeeConfigInfos.get(_feeConfigIndex);
-                flushBusinessFeeConfigInfo(businessFeeConfigInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessFeeConfigInfo(businessFeeConfigInfo, StatusConstant.STATUS_CD_VALID);
                 feeConfigServiceDaoImpl.updateFeeConfigInfoInstance(businessFeeConfigInfo);
-                if(businessFeeConfigInfo.size() == 1) {
+                if (businessFeeConfigInfo.size() == 1) {
                     dataFlowContext.addParamOut("configId", businessFeeConfigInfo.get("config_id"));
                 }
             }
@@ -117,8 +117,9 @@
 
     /**
      * 鎾ゅ崟
+     *
      * @param dataFlowContext 鏁版嵁瀵硅薄
-     * @param business 褰撳墠涓氬姟瀵硅薄
+     * @param business        褰撳墠涓氬姟瀵硅薄
      */
     @Override
     protected void doRecover(DataFlowContext dataFlowContext, Business business) {
@@ -126,24 +127,24 @@
         String bId = business.getbId();
         //Assert.hasLength(bId,"璇锋眰鎶ユ枃涓病鏈夊寘鍚� bId");
         Map info = new HashMap();
-        info.put("bId",bId);
-        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
         Map delInfo = new HashMap();
-        delInfo.put("bId",business.getbId());
-        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+        delInfo.put("bId", business.getbId());
+        delInfo.put("operate", StatusConstant.OPERATE_DEL);
         //璐圭敤閰嶇疆淇℃伅
         List<Map> feeConfigInfo = feeConfigServiceDaoImpl.getFeeConfigInfo(info);
-        if(feeConfigInfo != null && feeConfigInfo.size() > 0){
+        if (feeConfigInfo != null && feeConfigInfo.size() > 0) {
 
             //璐圭敤閰嶇疆淇℃伅
             List<Map> businessFeeConfigInfos = feeConfigServiceDaoImpl.getBusinessFeeConfigInfo(delInfo);
             //闄ら潪绋嬪簭鍑洪敊浜嗭紝杩欓噷涓嶄細涓虹┖
-            if(businessFeeConfigInfos == null || businessFeeConfigInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"鎾ゅ崟澶辫触锛坒eeConfig锛夛紝绋嬪簭鍐呴儴寮傚父,璇锋鏌ワ紒 "+delInfo);
+            if (businessFeeConfigInfos == null || businessFeeConfigInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "鎾ゅ崟澶辫触锛坒eeConfig锛夛紝绋嬪簭鍐呴儴寮傚父,璇锋鏌ワ紒 " + delInfo);
             }
-            for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigInfos.size();_feeConfigIndex++) {
+            for (int _feeConfigIndex = 0; _feeConfigIndex < businessFeeConfigInfos.size(); _feeConfigIndex++) {
                 Map businessFeeConfigInfo = businessFeeConfigInfos.get(_feeConfigIndex);
-                flushBusinessFeeConfigInfo(businessFeeConfigInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessFeeConfigInfo(businessFeeConfigInfo, StatusConstant.STATUS_CD_VALID);
                 feeConfigServiceDaoImpl.updateFeeConfigInfoInstance(businessFeeConfigInfo);
             }
         }
@@ -151,30 +152,28 @@
     }
 
 
-
     /**
      * 澶勭悊 businessFeeConfig 鑺傜偣
-     * @param business 鎬荤殑鏁版嵁鑺傜偣
+     *
+     * @param business          鎬荤殑鏁版嵁鑺傜偣
      * @param businessFeeConfig 璐圭敤閰嶇疆鑺傜偣
      */
-    private void doBusinessFeeConfig(Business business,JSONObject businessFeeConfig){
+    private void doBusinessFeeConfig(Business business, JSONObject businessFeeConfig) {
 
-        Assert.jsonObjectHaveKey(businessFeeConfig,"configId","businessFeeConfig 鑺傜偣涓嬫病鏈夊寘鍚� configId 鑺傜偣");
+        Assert.jsonObjectHaveKey(businessFeeConfig, "configId", "businessFeeConfig 鑺傜偣涓嬫病鏈夊寘鍚� configId 鑺傜偣");
 
-        if(businessFeeConfig.getString("configId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"configId 閿欒锛屼笉鑳借嚜鍔ㄧ敓鎴愶紙蹇呴』宸茬粡瀛樺湪鐨刢onfigId锛�"+businessFeeConfig);
+        if (businessFeeConfig.getString("configId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "configId 閿欒锛屼笉鑳借嚜鍔ㄧ敓鎴愶紙蹇呴』宸茬粡瀛樺湪鐨刢onfigId锛�" + businessFeeConfig);
         }
         //鑷姩淇濆瓨DEL
-        autoSaveDelBusinessFeeConfig(business,businessFeeConfig);
+        autoSaveDelBusinessFeeConfig(business, businessFeeConfig);
 
-        businessFeeConfig.put("bId",business.getbId());
+        businessFeeConfig.put("bId", business.getbId());
         businessFeeConfig.put("operate", StatusConstant.OPERATE_ADD);
         //淇濆瓨璐圭敤閰嶇疆淇℃伅
         feeConfigServiceDaoImpl.saveBusinessFeeConfigInfo(businessFeeConfig);
 
     }
-
-
 
 
     public IFeeConfigServiceDao getFeeConfigServiceDaoImpl() {
@@ -184,7 +183,6 @@
     public void setFeeConfigServiceDaoImpl(IFeeConfigServiceDao feeConfigServiceDaoImpl) {
         this.feeConfigServiceDaoImpl = feeConfigServiceDaoImpl;
     }
-
 
 
 }

--
Gitblit v1.8.0