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/detail/UpdateFeeDetailInfoListener.java |   96 +++++++++++++++++++++++------------------------
 1 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/FeeService/src/main/java/com/java110/fee/listener/detail/UpdateFeeDetailInfoListener.java b/FeeService/src/main/java/com/java110/fee/listener/detail/UpdateFeeDetailInfoListener.java
index 31d55e2..7dc7453 100644
--- a/FeeService/src/main/java/com/java110/fee/listener/detail/UpdateFeeDetailInfoListener.java
+++ b/FeeService/src/main/java/com/java110/fee/listener/detail/UpdateFeeDetailInfoListener.java
@@ -22,7 +22,7 @@
 
 /**
  * 淇敼璐圭敤鏄庣粏淇℃伅 渚﹀惉
- *
+ * <p>
  * 澶勭悊鑺傜偣
  * 1銆乥usinessFeeDetail:{} 璐圭敤鏄庣粏鍩烘湰淇℃伅鑺傜偣
  * 2銆乥usinessFeeDetailAttr:[{}] 璐圭敤鏄庣粏灞炴�т俊鎭妭鐐�
@@ -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 鑺傜偣锛屾垨娌℃湁瀛愯妭鐐归渶瑕佸鐞�");
 
         //澶勭悊 businessFeeDetail 鑺傜偣
-        if(data.containsKey("businessFeeDetail")){
-            //澶勭悊 businessFeeDetail 鑺傜偣
-            if(data.containsKey("businessFeeDetail")){
-                Object _obj = data.get("businessFeeDetail");
-                JSONArray businessFeeDetails = null;
-                if(_obj instanceof JSONObject){
-                    businessFeeDetails = new JSONArray();
-                    businessFeeDetails.add(_obj);
-                }else {
-                    businessFeeDetails = (JSONArray)_obj;
-                }
-                //JSONObject businessFeeDetail = data.getJSONObject("businessFeeDetail");
-                for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetails.size();_feeDetailIndex++) {
-                    JSONObject businessFeeDetail = businessFeeDetails.getJSONObject(_feeDetailIndex);
-                    doBusinessFeeDetail(business, businessFeeDetail);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("detailId", businessFeeDetail.getString("detailId"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_DETAIL)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_DETAIL);
+            JSONArray businessFeeDetails = null;
+            if (_obj instanceof JSONObject) {
+                businessFeeDetails = new JSONArray();
+                businessFeeDetails.add(_obj);
+            } else {
+                businessFeeDetails = (JSONArray) _obj;
+            }
+            //JSONObject businessFeeDetail = data.getJSONObject("businessFeeDetail");
+            for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetails.size(); _feeDetailIndex++) {
+                JSONObject businessFeeDetail = businessFeeDetails.getJSONObject(_feeDetailIndex);
+                doBusinessFeeDetail(business, businessFeeDetail);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("detailId", businessFeeDetail.getString("detailId"));
                 }
             }
+
         }
     }
 
 
     /**
      * 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> businessFeeDetailInfos = feeDetailServiceDaoImpl.getBusinessFeeDetailInfo(info);
-        if( businessFeeDetailInfos != null && businessFeeDetailInfos.size() >0) {
-            for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetailInfos.size();_feeDetailIndex++) {
+        if (businessFeeDetailInfos != null && businessFeeDetailInfos.size() > 0) {
+            for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetailInfos.size(); _feeDetailIndex++) {
                 Map businessFeeDetailInfo = businessFeeDetailInfos.get(_feeDetailIndex);
-                flushBusinessFeeDetailInfo(businessFeeDetailInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessFeeDetailInfo(businessFeeDetailInfo, StatusConstant.STATUS_CD_VALID);
                 feeDetailServiceDaoImpl.updateFeeDetailInfoInstance(businessFeeDetailInfo);
-                if(businessFeeDetailInfo.size() == 1) {
+                if (businessFeeDetailInfo.size() == 1) {
                     dataFlowContext.addParamOut("detailId", businessFeeDetailInfo.get("detail_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> feeDetailInfo = feeDetailServiceDaoImpl.getFeeDetailInfo(info);
-        if(feeDetailInfo != null && feeDetailInfo.size() > 0){
+        if (feeDetailInfo != null && feeDetailInfo.size() > 0) {
 
             //璐圭敤鏄庣粏淇℃伅
             List<Map> businessFeeDetailInfos = feeDetailServiceDaoImpl.getBusinessFeeDetailInfo(delInfo);
             //闄ら潪绋嬪簭鍑洪敊浜嗭紝杩欓噷涓嶄細涓虹┖
-            if(businessFeeDetailInfos == null || businessFeeDetailInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"鎾ゅ崟澶辫触锛坒eeDetail锛夛紝绋嬪簭鍐呴儴寮傚父,璇锋鏌ワ紒 "+delInfo);
+            if (businessFeeDetailInfos == null || businessFeeDetailInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "鎾ゅ崟澶辫触锛坒eeDetail锛夛紝绋嬪簭鍐呴儴寮傚父,璇锋鏌ワ紒 " + delInfo);
             }
-            for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetailInfos.size();_feeDetailIndex++) {
+            for (int _feeDetailIndex = 0; _feeDetailIndex < businessFeeDetailInfos.size(); _feeDetailIndex++) {
                 Map businessFeeDetailInfo = businessFeeDetailInfos.get(_feeDetailIndex);
-                flushBusinessFeeDetailInfo(businessFeeDetailInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessFeeDetailInfo(businessFeeDetailInfo, StatusConstant.STATUS_CD_VALID);
                 feeDetailServiceDaoImpl.updateFeeDetailInfoInstance(businessFeeDetailInfo);
             }
         }
@@ -151,30 +152,28 @@
     }
 
 
-
     /**
      * 澶勭悊 businessFeeDetail 鑺傜偣
-     * @param business 鎬荤殑鏁版嵁鑺傜偣
+     *
+     * @param business          鎬荤殑鏁版嵁鑺傜偣
      * @param businessFeeDetail 璐圭敤鏄庣粏鑺傜偣
      */
-    private void doBusinessFeeDetail(Business business,JSONObject businessFeeDetail){
+    private void doBusinessFeeDetail(Business business, JSONObject businessFeeDetail) {
 
-        Assert.jsonObjectHaveKey(businessFeeDetail,"detailId","businessFeeDetail 鑺傜偣涓嬫病鏈夊寘鍚� detailId 鑺傜偣");
+        Assert.jsonObjectHaveKey(businessFeeDetail, "detailId", "businessFeeDetail 鑺傜偣涓嬫病鏈夊寘鍚� detailId 鑺傜偣");
 
-        if(businessFeeDetail.getString("detailId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"detailId 閿欒锛屼笉鑳借嚜鍔ㄧ敓鎴愶紙蹇呴』宸茬粡瀛樺湪鐨刣etailId锛�"+businessFeeDetail);
+        if (businessFeeDetail.getString("detailId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "detailId 閿欒锛屼笉鑳借嚜鍔ㄧ敓鎴愶紙蹇呴』宸茬粡瀛樺湪鐨刣etailId锛�" + businessFeeDetail);
         }
         //鑷姩淇濆瓨DEL
-        autoSaveDelBusinessFeeDetail(business,businessFeeDetail);
+        autoSaveDelBusinessFeeDetail(business, businessFeeDetail);
 
-        businessFeeDetail.put("bId",business.getbId());
+        businessFeeDetail.put("bId", business.getbId());
         businessFeeDetail.put("operate", StatusConstant.OPERATE_ADD);
         //淇濆瓨璐圭敤鏄庣粏淇℃伅
         feeDetailServiceDaoImpl.saveBusinessFeeDetailInfo(businessFeeDetail);
 
     }
-
-
 
 
     public IFeeDetailServiceDao getFeeDetailServiceDaoImpl() {
@@ -184,7 +183,6 @@
     public void setFeeDetailServiceDaoImpl(IFeeDetailServiceDao feeDetailServiceDaoImpl) {
         this.feeDetailServiceDaoImpl = feeDetailServiceDaoImpl;
     }
-
 
 
 }

--
Gitblit v1.8.0