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/DeleteFeeConfigInfoListener.java |   92 +++++++++++++++++++++++----------------------
 1 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/FeeService/src/main/java/com/java110/fee/listener/config/DeleteFeeConfigInfoListener.java b/FeeService/src/main/java/com/java110/fee/listener/config/DeleteFeeConfigInfoListener.java
index e80b59e..33e0f0d 100644
--- a/FeeService/src/main/java/com/java110/fee/listener/config/DeleteFeeConfigInfoListener.java
+++ b/FeeService/src/main/java/com/java110/fee/listener/config/DeleteFeeConfigInfoListener.java
@@ -22,7 +22,7 @@
 
 /**
  * 鍒犻櫎璐圭敤閰嶇疆淇℃伅 渚﹀惉
- *
+ * <p>
  * 澶勭悊鑺傜偣
  * 1銆乥usinessFeeConfig:{} 璐圭敤閰嶇疆鍩烘湰淇℃伅鑺傜偣
  * 2銆乥usinessFeeConfigAttr:[{}] 璐圭敤閰嶇疆灞炴�т俊鎭妭鐐�
@@ -51,36 +51,36 @@
 
     /**
      * 鏍规嵁鍒犻櫎淇℃伅 鏌ュ嚭Instance琛ㄤ腑鏁版嵁 淇濆瓨鑷砨usiness琛� 锛堢姸鎬佸啓DEL锛� 鏂逛究鎾ゅ崟鏃剁洿鎺ユ洿鏂板洖鍘�
+     *
      * @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"));
                 }
             }
+
         }
 
 
@@ -88,8 +88,9 @@
 
     /**
      * 鍒犻櫎 instance鏁版嵁
+     *
      * @param dataFlowContext 鏁版嵁瀵硅薄
-     * @param business 褰撳墠涓氬姟瀵硅薄
+     * @param business        褰撳墠涓氬姟瀵硅薄
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -98,17 +99,17 @@
 
         //璐圭敤閰嶇疆淇℃伅
         Map info = new HashMap();
-        info.put("bId",business.getbId());
-        info.put("operate",StatusConstant.OPERATE_DEL);
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_DEL);
 
         //璐圭敤閰嶇疆淇℃伅
         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_INVALID);
+                flushBusinessFeeConfigInfo(businessFeeConfigInfo, StatusConstant.STATUS_CD_INVALID);
                 feeConfigServiceDaoImpl.updateFeeConfigInfoInstance(businessFeeConfigInfo);
-                dataFlowContext.addParamOut("configId",businessFeeConfigInfo.get("config_id"));
+                dataFlowContext.addParamOut("configId", businessFeeConfigInfo.get("config_id"));
             }
         }
 
@@ -117,54 +118,55 @@
     /**
      * 鎾ゅ崟
      * 浠巄usiness琛ㄤ腑鏌ヨ鍒癉EL鐨勬暟鎹� 灏唅nstance涓殑鏁版嵁鏇存柊鍥炴潵
+     *
      * @param dataFlowContext 鏁版嵁瀵硅薄
-     * @param business 褰撳墠涓氬姟瀵硅薄
+     * @param business        褰撳墠涓氬姟瀵硅薄
      */
     @Override
     protected void doRecover(DataFlowContext dataFlowContext, Business business) {
         String bId = business.getbId();
         //Assert.hasLength(bId,"璇锋眰鎶ユ枃涓病鏈夊寘鍚� bId");
         Map info = new HashMap();
-        info.put("bId",bId);
-        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_INVALID);
 
         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);
             }
         }
     }
 
 
-
     /**
      * 澶勭悊 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);
     }
 
     public IFeeConfigServiceDao getFeeConfigServiceDaoImpl() {

--
Gitblit v1.8.0