java110 лет назад: 5
Родитель
Сommit
f23d549806
16 измененных файлов с 382 добавлено и 353 удалено
  1. 5 0
      CommunityService/src/main/java/com/java110/community/listener/AbstractCommunityBusinessServiceDataFlowListener.java
  2. 5 0
      StoreService/src/main/java/com/java110/store/listener/AbstractStoreBusinessServiceDataFlowListener.java
  3. 2 2
      StoreService/src/main/java/com/java110/store/listener/DeleteStoreInfoListener.java
  4. 1 1
      StoreService/src/main/java/com/java110/store/listener/SaveStoreInfoListener.java
  5. 32 28
      StoreService/src/main/java/com/java110/store/listener/SaveStoreUserListener.java
  6. 87 82
      StoreService/src/main/java/com/java110/store/listener/UpdateStoreInfoListener.java
  7. 6 0
      StoreService/src/main/java/com/java110/store/listener/businesstype/AbstractCbusinesstypeBusinessServiceDataFlowListener.java
  8. 50 49
      StoreService/src/main/java/com/java110/store/listener/businesstype/DeleteCbusinesstypeInfoListener.java
  9. 2 2
      StoreService/src/main/java/com/java110/store/listener/businesstype/SaveCbusinesstypeInfoListener.java
  10. 51 53
      StoreService/src/main/java/com/java110/store/listener/businesstype/UpdateCbusinesstypeInfoListener.java
  11. 34 29
      StoreService/src/main/java/com/java110/store/listener/demo/AbstractDemoBusinessServiceDataFlowListener.java
  12. 51 49
      StoreService/src/main/java/com/java110/store/listener/demo/DeleteDemoInfoListener.java
  13. 2 2
      StoreService/src/main/java/com/java110/store/listener/demo/SaveDemoInfoListener.java
  14. 51 53
      StoreService/src/main/java/com/java110/store/listener/demo/UpdateDemoInfoListener.java
  15. 1 1
      StoreService/src/main/java/com/java110/store/listener/memberJoinedStoreListener.java
  16. 2 2
      StoreService/src/main/java/com/java110/store/listener/memberQuitStoreListener.java

+ 5 - 0
CommunityService/src/main/java/com/java110/community/listener/AbstractCommunityBusinessServiceDataFlowListener.java

@@ -175,6 +175,11 @@ public abstract class AbstractCommunityBusinessServiceDataFlowListener extends A
         currentCommunityPhoto.put("communityPhotoTypeCd", currentCommunityPhoto.get("community_photo_type_cd"));
         currentCommunityPhoto.put("operate", StatusConstant.OPERATE_DEL);
         getCommunityServiceDaoImpl().saveBusinessCommunityPhoto(currentCommunityPhoto);
+        for(Object key : currentCommunityPhoto.keySet()) {
+            if(businessCommunityPhoto.get(key) == null) {
+                businessCommunityPhoto.put(key.toString(), currentCommunityPhoto.get(key));
+            }
+        }
     }
 
 

+ 5 - 0
StoreService/src/main/java/com/java110/store/listener/AbstractStoreBusinessServiceDataFlowListener.java

@@ -180,6 +180,11 @@ public abstract class AbstractStoreBusinessServiceDataFlowListener extends Abstr
         currentStorePhoto.put("storePhotoTypeCd",currentStorePhoto.get("store_photo_type_cd"));
         currentStorePhoto.put("operate",StatusConstant.OPERATE_DEL);
         getStoreServiceDaoImpl().saveBusinessStorePhoto(currentStorePhoto);
+        for (Object key : currentStorePhoto.keySet()) {
+            if (businessStorePhoto.get(key) == null) {
+                businessStorePhoto.put(key.toString(), currentStorePhoto.get(key));
+            }
+        }
     }
 
     /**

+ 2 - 2
StoreService/src/main/java/com/java110/store/listener/DeleteStoreInfoListener.java

@@ -61,8 +61,8 @@ public class DeleteStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
         //处理 businessStore 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessStore")){
-            JSONObject businessStore = data.getJSONObject("businessStore");
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_DELETE_STORE_INFO)){
+            JSONObject businessStore = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_DELETE_STORE_INFO);
             doBusinessStore(business,businessStore);
             dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
         }

+ 1 - 1
StoreService/src/main/java/com/java110/store/listener/SaveStoreInfoListener.java

@@ -59,7 +59,7 @@ public class SaveStoreInfoListener extends AbstractStoreBusinessServiceDataFlowL
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
         //处理 businessStore 节点
-        if(data.containsKey("businessStore")){
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_INFO)){
             JSONObject businessStore = data.getJSONObject("businessStore");
             doBusinessStore(business,businessStore);
             dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));

+ 32 - 28
StoreService/src/main/java/com/java110/store/listener/SaveStoreUserListener.java

@@ -2,16 +2,16 @@ package com.java110.store.listener;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.BusinessTypeConstant;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.constant.StatusConstant;
-import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.utils.util.Assert;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.entity.center.Business;
 import com.java110.store.dao.IStoreServiceDao;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +27,7 @@ import java.util.Map;
 
 @Java110Listener("saveStoreUserListener")
 @Transactional
-public class SaveStoreUserListener extends AbstractStoreBusinessServiceDataFlowListener{
+public class SaveStoreUserListener extends AbstractStoreBusinessServiceDataFlowListener {
     private final static Logger logger = LoggerFactory.getLogger(SaveStoreUserListener.class);
 
     @Autowired
@@ -45,62 +45,65 @@ public class SaveStoreUserListener extends AbstractStoreBusinessServiceDataFlowL
 
     /**
      * 保存物业信息 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 节点,或没有子节点需要处理");
 
         //处理 businessStore 节点
-        if(!data.containsKey("businessStoreUser")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"没有businessStoreUser节点");
+        if (!data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_USER)) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "没有" + BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_USER + "节点");
         }
 
 
-        JSONArray businessStoreUsers = data.getJSONArray("businessStoreUser");
-        doBusinessStoreUser(business,businessStoreUsers);
+        JSONArray businessStoreUsers = data.getJSONArray(BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_USER);
+        doBusinessStoreUser(business, businessStoreUsers);
     }
 
     /**
      * business 数据转移到 instance
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
         JSONObject data = business.getDatas();
 
         Map info = new HashMap();
-        info.put("bId",business.getbId());
+        info.put("bId", business.getbId());
         info.put("operate", StatusConstant.OPERATE_ADD);
 
         //物业用户
         List<Map> businessStoreUsers = storeServiceDaoImpl.getBusinessStoreUser(info);
-        if(businessStoreUsers != null && businessStoreUsers.size() >0){
+        if (businessStoreUsers != null && businessStoreUsers.size() > 0) {
             storeServiceDaoImpl.saveStoreUserInstance(info);
         }
     }
 
     /**
      * 撤单
+     *
      * @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_VALID);
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
         Map paramIn = new HashMap();
-        paramIn.put("bId",bId);
-        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        paramIn.put("bId", bId);
+        paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID);
         //物业照片
         List<Map> storeUsers = storeServiceDaoImpl.getStoreUser(info);
-        if(storeUsers != null && storeUsers.size()>0){
+        if (storeUsers != null && storeUsers.size() > 0) {
             storeServiceDaoImpl.updateStoreUserInstance(paramIn);
         }
     }
@@ -108,22 +111,23 @@ public class SaveStoreUserListener extends AbstractStoreBusinessServiceDataFlowL
 
     /**
      * 处理 businessStore 节点
-     * @param business 总的数据节点
+     *
+     * @param business           总的数据节点
      * @param businessStoreUsers 物业用户节点
      */
-    private void doBusinessStoreUser(Business business,JSONArray businessStoreUsers){
+    private void doBusinessStoreUser(Business business, JSONArray businessStoreUsers) {
 
 
-        for(int businessStoreUserIndex = 0 ;businessStoreUserIndex < businessStoreUsers.size();businessStoreUserIndex++) {
+        for (int businessStoreUserIndex = 0; businessStoreUserIndex < businessStoreUsers.size(); businessStoreUserIndex++) {
             JSONObject businessStoreUser = businessStoreUsers.getJSONObject(businessStoreUserIndex);
-            Assert.jsonObjectHaveKey(businessStoreUser,"storeId","businessStoreUser 节点下没有包含 storeId 节点");
-            Assert.jsonObjectHaveKey(businessStoreUser,"userId","businessStoreUser 节点下没有包含 userId 节点");
+            Assert.jsonObjectHaveKey(businessStoreUser, "storeId", "businessStoreUser 节点下没有包含 storeId 节点");
+            Assert.jsonObjectHaveKey(businessStoreUser, "userId", "businessStoreUser 节点下没有包含 userId 节点");
 
-            if(businessStoreUser.getString("storeUserId").startsWith("-")){
+            if (businessStoreUser.getString("storeUserId").startsWith("-")) {
                 String storeUserId = GenerateCodeFactory.getStoreUserId();
                 businessStoreUser.put("storeUserId", storeUserId);
             }
-            businessStoreUser.put("bId",business.getbId());
+            businessStoreUser.put("bId", business.getbId());
             businessStoreUser.put("operate", StatusConstant.OPERATE_ADD);
             //保存物业信息
             storeServiceDaoImpl.saveBusinessStoreUser(businessStoreUser);

+ 87 - 82
StoreService/src/main/java/com/java110/store/listener/UpdateStoreInfoListener.java

@@ -2,15 +2,15 @@ package com.java110.store.listener;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStoreServiceDao;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.store.dao.IStoreServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.Map;
 
 /**
  * 修改商户信息 侦听
- *
+ * <p>
  * 处理节点
  * 1、businessStore:{} 商户基本信息节点
  * 2、businessStoreAttr:[{}] 商户属性信息节点
@@ -51,6 +51,7 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
     /**
      * business过程
+     *
      * @param dataFlowContext
      * @param business
      */
@@ -59,36 +60,37 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
         JSONObject data = business.getDatas();
 
-        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
 
         //处理 businessStore 节点
-        if(data.containsKey("businessStore")){
-            JSONObject businessStore = data.getJSONObject("businessStore");
-            doBusinessStore(business,businessStore);
-            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_STORE_INFO)) {
+            JSONObject businessStore = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_STORE_INFO);
+            doBusinessStore(business, businessStore);
+            dataFlowContext.addParamOut("storeId", businessStore.getString("storeId"));
         }
 
-        if(data.containsKey("businessStoreAttr")){
+        if (data.containsKey("businessStoreAttr")) {
             JSONArray businessStoreAttrs = data.getJSONArray("businessStoreAttr");
-            doSaveBusinessStoreAttrs(business,businessStoreAttrs);
+            doSaveBusinessStoreAttrs(business, businessStoreAttrs);
         }
 
-        if(data.containsKey("businessStorePhoto")){
+        if (data.containsKey("businessStorePhoto")) {
             JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
-            doBusinessStorePhoto(business,businessStorePhotos);
+            doBusinessStorePhoto(business, businessStorePhotos);
         }
 
-        if(data.containsKey("businessStoreCerdentials")){
+        if (data.containsKey("businessStoreCerdentials")) {
             JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
-            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
+            doBusinessStoreCerdentials(business, businessStoreCerdentialses);
         }
     }
 
 
     /**
      * business to instance 过程
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -96,37 +98,37 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
         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);
 
         //商户信息
         Map businessStoreInfo = storeServiceDaoImpl.getBusinessStoreInfo(info);
-        if( businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
-            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_VALID);
+        if (businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
+            flushBusinessStoreInfo(businessStoreInfo, StatusConstant.STATUS_CD_VALID);
             storeServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
-            dataFlowContext.addParamOut("storeId",businessStoreInfo.get("store_id"));
+            dataFlowContext.addParamOut("storeId", businessStoreInfo.get("store_id"));
         }
         //商户属性
         List<Map> businessStoreAttrs = storeServiceDaoImpl.getBusinessStoreAttrs(info);
-        if(businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
-            for(Map businessStoreAttr : businessStoreAttrs) {
-                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_VALID);
+        if (businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
+            for (Map businessStoreAttr : businessStoreAttrs) {
+                flushBusinessStoreAttr(businessStoreAttr, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
             }
         }
         //商户照片
         List<Map> businessStorePhotos = storeServiceDaoImpl.getBusinessStorePhoto(info);
-        if(businessStorePhotos != null && businessStorePhotos.size() >0){
-            for(Map businessStorePhoto : businessStorePhotos) {
-                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_VALID);
+        if (businessStorePhotos != null && businessStorePhotos.size() > 0) {
+            for (Map businessStorePhoto : businessStorePhotos) {
+                flushBusinessStorePhoto(businessStorePhoto, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
             }
         }
         //商户证件
         List<Map> businessStoreCerdentialses = storeServiceDaoImpl.getBusinessStoreCerdentials(info);
-        if(businessStoreCerdentialses != null && businessStoreCerdentialses.size()>0){
-            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
-                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_VALID);
+        if (businessStoreCerdentialses != null && businessStoreCerdentialses.size() > 0) {
+            for (Map businessStoreCerdentials : businessStoreCerdentialses) {
+                flushBusinessStoreCredentials(businessStoreCerdentials, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
             }
         }
@@ -134,8 +136,9 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
     /**
      * 撤单
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doRecover(DataFlowContext dataFlowContext, Business business) {
@@ -143,66 +146,66 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
         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);
         //商户信息
         Map storeInfo = storeServiceDaoImpl.getStoreInfo(info);
-        if(storeInfo != null && !storeInfo.isEmpty()){
+        if (storeInfo != null && !storeInfo.isEmpty()) {
 
             //商户信息
             Map businessStoreInfo = storeServiceDaoImpl.getBusinessStoreInfo(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessStoreInfo == null || businessStoreInfo.isEmpty()){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store),程序内部异常,请检查! "+delInfo);
+            if (businessStoreInfo == null || businessStoreInfo.isEmpty()) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(store),程序内部异常,请检查! " + delInfo);
             }
 
-            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_VALID);
+            flushBusinessStoreInfo(businessStoreInfo, StatusConstant.STATUS_CD_VALID);
             storeServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
-            dataFlowContext.addParamOut("storeId",storeInfo.get("store_id"));
+            dataFlowContext.addParamOut("storeId", storeInfo.get("store_id"));
         }
 
         //商户属性
         List<Map> storeAttrs = storeServiceDaoImpl.getStoreAttrs(info);
-        if(storeAttrs != null && storeAttrs.size()>0){
+        if (storeAttrs != null && storeAttrs.size() > 0) {
 
             List<Map> businessStoreAttrs = storeServiceDaoImpl.getBusinessStoreAttrs(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessStoreAttrs == null || businessStoreAttrs.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_attr),程序内部异常,请检查! "+delInfo);
+            if (businessStoreAttrs == null || businessStoreAttrs.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(store_attr),程序内部异常,请检查! " + delInfo);
             }
-            for(Map businessStoreAttr : businessStoreAttrs) {
-                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_VALID);
+            for (Map businessStoreAttr : businessStoreAttrs) {
+                flushBusinessStoreAttr(businessStoreAttr, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
             }
         }
 
         //商户照片
         List<Map> storePhotos = storeServiceDaoImpl.getStorePhoto(info);
-        if(storePhotos != null && storePhotos.size()>0){
+        if (storePhotos != null && storePhotos.size() > 0) {
             List<Map> businessStorePhotos = storeServiceDaoImpl.getBusinessStorePhoto(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessStorePhotos == null || businessStorePhotos.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_photo),程序内部异常,请检查! "+delInfo);
+            if (businessStorePhotos == null || businessStorePhotos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(store_photo),程序内部异常,请检查! " + delInfo);
             }
-            for(Map businessStorePhoto : businessStorePhotos) {
-                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_VALID);
+            for (Map businessStorePhoto : businessStorePhotos) {
+                flushBusinessStorePhoto(businessStorePhoto, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
             }
         }
 
         //商户属性
         List<Map> storeCerdentialses = storeServiceDaoImpl.getStoreCerdentials(info);
-        if(storeCerdentialses != null && storeCerdentialses.size()>0){
+        if (storeCerdentialses != null && storeCerdentialses.size() > 0) {
             List<Map> businessStoreCerdentialses = storeServiceDaoImpl.getBusinessStoreCerdentials(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessStoreCerdentialses == null || businessStoreCerdentialses.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_cerdentials),程序内部异常,请检查! "+delInfo);
+            if (businessStoreCerdentialses == null || businessStoreCerdentialses.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(store_cerdentials),程序内部异常,请检查! " + delInfo);
             }
-            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
-                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_VALID);
+            for (Map businessStoreCerdentials : businessStoreCerdentialses) {
+                flushBusinessStoreCredentials(businessStoreCerdentials, StatusConstant.STATUS_CD_VALID);
                 storeServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
             }
         }
@@ -210,22 +213,23 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
     /**
      * 保存商户照片
-     * @param business 业务对象
+     *
+     * @param business            业务对象
      * @param businessStorePhotos 商户照片
      */
     private void doBusinessStorePhoto(Business business, JSONArray businessStorePhotos) {
 
 
-        for(int businessStorePhotoIndex = 0 ;businessStorePhotoIndex < businessStorePhotos.size();businessStorePhotoIndex++) {
+        for (int businessStorePhotoIndex = 0; businessStorePhotoIndex < businessStorePhotos.size(); businessStorePhotoIndex++) {
             JSONObject businessStorePhoto = businessStorePhotos.getJSONObject(businessStorePhotoIndex);
             Assert.jsonObjectHaveKey(businessStorePhoto, "storeId", "businessStorePhoto 节点下没有包含 storeId 节点");
 
             if (businessStorePhoto.getString("storePhotoId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStorePhoto);
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)" + businessStorePhoto);
             }
 
             //自动保存DEL信息
-            autoSaveDelBusinessStorePhoto(business,businessStorePhoto);
+            autoSaveDelBusinessStorePhoto(business, businessStorePhoto);
 
             businessStorePhoto.put("bId", business.getbId());
             businessStorePhoto.put("operate", StatusConstant.OPERATE_ADD);
@@ -236,20 +240,21 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
     /**
      * 处理 businessStore 节点
-     * @param business 总的数据节点
+     *
+     * @param business      总的数据节点
      * @param businessStore 商户节点
      */
-    private void doBusinessStore(Business business,JSONObject businessStore){
+    private void doBusinessStore(Business business, JSONObject businessStore) {
 
-        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
+        Assert.jsonObjectHaveKey(businessStore, "storeId", "businessStore 节点下没有包含 storeId 节点");
 
-        if(businessStore.getString("storeId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storeId 错误,不能自动生成(必须已经存在的storeId)"+businessStore);
+        if (businessStore.getString("storeId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "storeId 错误,不能自动生成(必须已经存在的storeId)" + businessStore);
         }
         //自动保存DEL
-        autoSaveDelBusinessStore(business,businessStore);
+        autoSaveDelBusinessStore(business, businessStore);
 
-        businessStore.put("bId",business.getbId());
+        businessStore.put("bId", business.getbId());
         businessStore.put("operate", StatusConstant.OPERATE_ADD);
         //保存商户信息
         storeServiceDaoImpl.saveBusinessStoreInfo(businessStore);
@@ -257,27 +262,27 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
     }
 
 
-
     /**
      * 保存商户属性信息
-     * @param business 当前业务
+     *
+     * @param business           当前业务
      * @param businessStoreAttrs 商户属性
      */
-    private void doSaveBusinessStoreAttrs(Business business,JSONArray businessStoreAttrs){
+    private void doSaveBusinessStoreAttrs(Business business, JSONArray businessStoreAttrs) {
         JSONObject data = business.getDatas();
 
 
-        for(int storeAttrIndex = 0 ; storeAttrIndex < businessStoreAttrs.size();storeAttrIndex ++){
+        for (int storeAttrIndex = 0; storeAttrIndex < businessStoreAttrs.size(); storeAttrIndex++) {
             JSONObject storeAttr = businessStoreAttrs.getJSONObject(storeAttrIndex);
-            Assert.jsonObjectHaveKey(storeAttr,"attrId","businessStoreAttr 节点下没有包含 attrId 节点");
-            if(storeAttr.getString("attrId").startsWith("-")){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+storeAttr);
+            Assert.jsonObjectHaveKey(storeAttr, "attrId", "businessStoreAttr 节点下没有包含 attrId 节点");
+            if (storeAttr.getString("attrId").startsWith("-")) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "attrId 错误,不能自动生成(必须已经存在的attrId)" + storeAttr);
             }
             //自动保存DEL数据
-            autoSaveDelBusinessStoreAttr(business,storeAttr);
+            autoSaveDelBusinessStoreAttr(business, storeAttr);
 
-            storeAttr.put("bId",business.getbId());
-            storeAttr.put("storeId",storeAttr.getString("storeId"));
+            storeAttr.put("bId", business.getbId());
+            storeAttr.put("storeId", storeAttr.getString("storeId"));
             storeAttr.put("operate", StatusConstant.OPERATE_ADD);
 
             storeServiceDaoImpl.saveBusinessStoreAttr(storeAttr);
@@ -287,20 +292,21 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
 
     /**
      * 保存 商户证件 信息
-     * @param business 当前业务
+     *
+     * @param business                   当前业务
      * @param businessStoreCerdentialses 商户证件
      */
     private void doBusinessStoreCerdentials(Business business, JSONArray businessStoreCerdentialses) {
 
-        for(int businessStoreCerdentialsIndex = 0 ; businessStoreCerdentialsIndex < businessStoreCerdentialses.size() ; businessStoreCerdentialsIndex ++) {
+        for (int businessStoreCerdentialsIndex = 0; businessStoreCerdentialsIndex < businessStoreCerdentialses.size(); businessStoreCerdentialsIndex++) {
             JSONObject businessStoreCerdentials = businessStoreCerdentialses.getJSONObject(businessStoreCerdentialsIndex);
             Assert.jsonObjectHaveKey(businessStoreCerdentials, "storeId", "businessStorePhoto 节点下没有包含 storeId 节点");
 
             if (businessStoreCerdentials.getString("storeCerdentialsId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStoreCerdentials);
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)" + businessStoreCerdentials);
             }
 
-            autoSaveDelBusinessStoreCerdentials(business,businessStoreCerdentials);
+            autoSaveDelBusinessStoreCerdentials(business, businessStoreCerdentials);
 
             businessStoreCerdentials.put("bId", business.getbId());
             businessStoreCerdentials.put("operate", StatusConstant.OPERATE_ADD);
@@ -318,5 +324,4 @@ public class UpdateStoreInfoListener extends AbstractStoreBusinessServiceDataFlo
     }
 
 
-
 }

+ 6 - 0
StoreService/src/main/java/com/java110/store/listener/businesstype/AbstractCbusinesstypeBusinessServiceDataFlowListener.java

@@ -74,6 +74,12 @@ public abstract class AbstractCbusinesstypeBusinessServiceDataFlowListener exten
         currentCbusinesstypeInfo.put("operate", StatusConstant.OPERATE_DEL);
         getCbusinesstypeServiceDaoImpl().saveBusinessCbusinesstypeInfo(currentCbusinesstypeInfo);
 
+        for(Object key : currentCbusinesstypeInfo.keySet()) {
+            if(businessCbusinesstype.get(key) == null) {
+                businessCbusinesstype.put(key.toString(), currentCbusinesstypeInfo.get(key));
+            }
+        }
+
     }
 
 

+ 50 - 49
StoreService/src/main/java/com/java110/store/listener/businesstype/DeleteCbusinesstypeInfoListener.java

@@ -2,15 +2,15 @@ package com.java110.store.listener.businesstype;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.ICbusinesstypeServiceDao;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.store.dao.ICbusinesstypeServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.Map;
 
 /**
  * 删除cbusinesstype信息 侦听
- *
+ * <p>
  * 处理节点
  * 1、businessCbusinesstype:{} cbusinesstype基本信息节点
  * 2、businessCbusinesstypeAttr:[{}] cbusinesstype属性信息节点
@@ -51,36 +51,35 @@ public class DeleteCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
 
     /**
      * 根据删除信息 查出Instance表中数据 保存至business表 (状态写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 节点,或没有子节点需要处理");
 
         //处理 businessCbusinesstype 节点
-        if(data.containsKey("businessCbusinesstype")){
-            //处理 businessCbusinesstype 节点
-            if(data.containsKey("businessCbusinesstype")){
-                Object _obj = data.get("businessCbusinesstype");
-                JSONArray businessCbusinesstypes = null;
-                if(_obj instanceof JSONObject){
-                    businessCbusinesstypes = new JSONArray();
-                    businessCbusinesstypes.add(_obj);
-                }else {
-                    businessCbusinesstypes = (JSONArray)_obj;
-                }
-                //JSONObject businessCbusinesstype = data.getJSONObject("businessCbusinesstype");
-                for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypes.size();_cbusinesstypeIndex++) {
-                    JSONObject businessCbusinesstype = businessCbusinesstypes.getJSONObject(_cbusinesstypeIndex);
-                    doBusinessCbusinesstype(business, businessCbusinesstype);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("id", businessCbusinesstype.getString("id"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_DELETE_BUSINESSTYPE_INFO)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_DELETE_BUSINESSTYPE_INFO);
+            JSONArray businessCbusinesstypes = null;
+            if (_obj instanceof JSONObject) {
+                businessCbusinesstypes = new JSONArray();
+                businessCbusinesstypes.add(_obj);
+            } else {
+                businessCbusinesstypes = (JSONArray) _obj;
+            }
+            //JSONObject businessCbusinesstype = data.getJSONObject("businessCbusinesstype");
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypes.size(); _cbusinesstypeIndex++) {
+                JSONObject businessCbusinesstype = businessCbusinesstypes.getJSONObject(_cbusinesstypeIndex);
+                doBusinessCbusinesstype(business, businessCbusinesstype);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("id", businessCbusinesstype.getString("id"));
                 }
             }
+
         }
 
 
@@ -88,8 +87,9 @@ public class DeleteCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
 
     /**
      * 删除 instance数据
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -98,17 +98,17 @@ public class DeleteCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
 
         //cbusinesstype信息
         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);
 
         //cbusinesstype信息
         List<Map> businessCbusinesstypeInfos = cbusinesstypeServiceDaoImpl.getBusinessCbusinesstypeInfo(info);
-        if( businessCbusinesstypeInfos != null && businessCbusinesstypeInfos.size() >0) {
-            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size();_cbusinesstypeIndex++) {
+        if (businessCbusinesstypeInfos != null && businessCbusinesstypeInfos.size() > 0) {
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size(); _cbusinesstypeIndex++) {
                 Map businessCbusinesstypeInfo = businessCbusinesstypeInfos.get(_cbusinesstypeIndex);
-                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo,StatusConstant.STATUS_CD_INVALID);
+                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo, StatusConstant.STATUS_CD_INVALID);
                 cbusinesstypeServiceDaoImpl.updateCbusinesstypeInfoInstance(businessCbusinesstypeInfo);
-                dataFlowContext.addParamOut("id",businessCbusinesstypeInfo.get("id"));
+                dataFlowContext.addParamOut("id", businessCbusinesstypeInfo.get("id"));
             }
         }
 
@@ -117,54 +117,55 @@ public class DeleteCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
     /**
      * 撤单
      * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     *
      * @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);
         //cbusinesstype信息
         List<Map> cbusinesstypeInfo = cbusinesstypeServiceDaoImpl.getCbusinesstypeInfo(info);
-        if(cbusinesstypeInfo != null && cbusinesstypeInfo.size() > 0){
+        if (cbusinesstypeInfo != null && cbusinesstypeInfo.size() > 0) {
 
             //cbusinesstype信息
             List<Map> businessCbusinesstypeInfos = cbusinesstypeServiceDaoImpl.getBusinessCbusinesstypeInfo(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessCbusinesstypeInfos == null ||  businessCbusinesstypeInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(cbusinesstype),程序内部异常,请检查! "+delInfo);
+            if (businessCbusinesstypeInfos == null || businessCbusinesstypeInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(cbusinesstype),程序内部异常,请检查! " + delInfo);
             }
-            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size();_cbusinesstypeIndex++) {
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size(); _cbusinesstypeIndex++) {
                 Map businessCbusinesstypeInfo = businessCbusinesstypeInfos.get(_cbusinesstypeIndex);
-                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo, StatusConstant.STATUS_CD_VALID);
                 cbusinesstypeServiceDaoImpl.updateCbusinesstypeInfoInstance(businessCbusinesstypeInfo);
             }
         }
     }
 
 
-
     /**
      * 处理 businessCbusinesstype 节点
-     * @param business 总的数据节点
+     *
+     * @param business              总的数据节点
      * @param businessCbusinesstype cbusinesstype节点
      */
-    private void doBusinessCbusinesstype(Business business,JSONObject businessCbusinesstype){
+    private void doBusinessCbusinesstype(Business business, JSONObject businessCbusinesstype) {
 
-        Assert.jsonObjectHaveKey(businessCbusinesstype,"id","businessCbusinesstype 节点下没有包含 id 节点");
+        Assert.jsonObjectHaveKey(businessCbusinesstype, "id", "businessCbusinesstype 节点下没有包含 id 节点");
 
-        if(businessCbusinesstype.getString("id").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"id 错误,不能自动生成(必须已经存在的id)"+businessCbusinesstype);
+        if (businessCbusinesstype.getString("id").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "id 错误,不能自动生成(必须已经存在的id)" + businessCbusinesstype);
         }
         //自动插入DEL
-        autoSaveDelBusinessCbusinesstype(business,businessCbusinesstype);
+        autoSaveDelBusinessCbusinesstype(business, businessCbusinesstype);
     }
 
     public ICbusinesstypeServiceDao getCbusinesstypeServiceDaoImpl() {

+ 2 - 2
StoreService/src/main/java/com/java110/store/listener/businesstype/SaveCbusinesstypeInfoListener.java

@@ -53,8 +53,8 @@ public class SaveCbusinesstypeInfoListener extends AbstractCbusinesstypeBusiness
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
         //处理 businessCbusinesstype 节点
-        if(data.containsKey("businessCbusinesstype")){
-            Object bObj = data.get("businessCbusinesstype");
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_BUSINESSTYPE_INFO)){
+            Object bObj = data.get(BusinessTypeConstant.BUSINESS_TYPE_SAVE_BUSINESSTYPE_INFO);
             JSONArray businessCbusinesstypes = null;
             if(bObj instanceof JSONObject){
                 businessCbusinesstypes = new JSONArray();

+ 51 - 53
StoreService/src/main/java/com/java110/store/listener/businesstype/UpdateCbusinesstypeInfoListener.java

@@ -2,15 +2,15 @@ package com.java110.store.listener.businesstype;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.ICbusinesstypeServiceDao;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.store.dao.ICbusinesstypeServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.Map;
 
 /**
  * 修改cbusinesstype信息 侦听
- *
+ * <p>
  * 处理节点
  * 1、businessCbusinesstype:{} cbusinesstype基本信息节点
  * 2、businessCbusinesstypeAttr:[{}] cbusinesstype属性信息节点
@@ -51,45 +51,45 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
 
     /**
      * 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 节点,或没有子节点需要处理");
 
         //处理 businessCbusinesstype 节点
-        if(data.containsKey("businessCbusinesstype")){
-            //处理 businessCbusinesstype 节点
-            if(data.containsKey("businessCbusinesstype")){
-                Object _obj = data.get("businessCbusinesstype");
-                JSONArray businessCbusinesstypes = null;
-                if(_obj instanceof JSONObject){
-                    businessCbusinesstypes = new JSONArray();
-                    businessCbusinesstypes.add(_obj);
-                }else {
-                    businessCbusinesstypes = (JSONArray)_obj;
-                }
-                //JSONObject businessCbusinesstype = data.getJSONObject("businessCbusinesstype");
-                for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypes.size();_cbusinesstypeIndex++) {
-                    JSONObject businessCbusinesstype = businessCbusinesstypes.getJSONObject(_cbusinesstypeIndex);
-                    doBusinessCbusinesstype(business, businessCbusinesstype);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("id", businessCbusinesstype.getString("id"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_BUSINESSTYPE_INFO)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_UPDATE_BUSINESSTYPE_INFO);
+            JSONArray businessCbusinesstypes = null;
+            if (_obj instanceof JSONObject) {
+                businessCbusinesstypes = new JSONArray();
+                businessCbusinesstypes.add(_obj);
+            } else {
+                businessCbusinesstypes = (JSONArray) _obj;
+            }
+            //JSONObject businessCbusinesstype = data.getJSONObject("businessCbusinesstype");
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypes.size(); _cbusinesstypeIndex++) {
+                JSONObject businessCbusinesstype = businessCbusinesstypes.getJSONObject(_cbusinesstypeIndex);
+                doBusinessCbusinesstype(business, businessCbusinesstype);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("id", businessCbusinesstype.getString("id"));
                 }
             }
+
         }
     }
 
 
     /**
      * business to instance 过程
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -97,17 +97,17 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
         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);
 
         //cbusinesstype信息
         List<Map> businessCbusinesstypeInfos = cbusinesstypeServiceDaoImpl.getBusinessCbusinesstypeInfo(info);
-        if( businessCbusinesstypeInfos != null && businessCbusinesstypeInfos.size() >0) {
-            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size();_cbusinesstypeIndex++) {
+        if (businessCbusinesstypeInfos != null && businessCbusinesstypeInfos.size() > 0) {
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size(); _cbusinesstypeIndex++) {
                 Map businessCbusinesstypeInfo = businessCbusinesstypeInfos.get(_cbusinesstypeIndex);
-                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo, StatusConstant.STATUS_CD_VALID);
                 cbusinesstypeServiceDaoImpl.updateCbusinesstypeInfoInstance(businessCbusinesstypeInfo);
-                if(businessCbusinesstypeInfo.size() == 1) {
+                if (businessCbusinesstypeInfo.size() == 1) {
                     dataFlowContext.addParamOut("id", businessCbusinesstypeInfo.get("id"));
                 }
             }
@@ -117,8 +117,9 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
 
     /**
      * 撤单
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doRecover(DataFlowContext dataFlowContext, Business business) {
@@ -126,24 +127,24 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
         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);
         //cbusinesstype信息
         List<Map> cbusinesstypeInfo = cbusinesstypeServiceDaoImpl.getCbusinesstypeInfo(info);
-        if(cbusinesstypeInfo != null && cbusinesstypeInfo.size() > 0){
+        if (cbusinesstypeInfo != null && cbusinesstypeInfo.size() > 0) {
 
             //cbusinesstype信息
             List<Map> businessCbusinesstypeInfos = cbusinesstypeServiceDaoImpl.getBusinessCbusinesstypeInfo(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessCbusinesstypeInfos == null || businessCbusinesstypeInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(cbusinesstype),程序内部异常,请检查! "+delInfo);
+            if (businessCbusinesstypeInfos == null || businessCbusinesstypeInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(cbusinesstype),程序内部异常,请检查! " + delInfo);
             }
-            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size();_cbusinesstypeIndex++) {
+            for (int _cbusinesstypeIndex = 0; _cbusinesstypeIndex < businessCbusinesstypeInfos.size(); _cbusinesstypeIndex++) {
                 Map businessCbusinesstypeInfo = businessCbusinesstypeInfos.get(_cbusinesstypeIndex);
-                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessCbusinesstypeInfo(businessCbusinesstypeInfo, StatusConstant.STATUS_CD_VALID);
                 cbusinesstypeServiceDaoImpl.updateCbusinesstypeInfoInstance(businessCbusinesstypeInfo);
             }
         }
@@ -151,23 +152,23 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
     }
 
 
-
     /**
      * 处理 businessCbusinesstype 节点
-     * @param business 总的数据节点
+     *
+     * @param business              总的数据节点
      * @param businessCbusinesstype cbusinesstype节点
      */
-    private void doBusinessCbusinesstype(Business business,JSONObject businessCbusinesstype){
+    private void doBusinessCbusinesstype(Business business, JSONObject businessCbusinesstype) {
 
-        Assert.jsonObjectHaveKey(businessCbusinesstype,"id","businessCbusinesstype 节点下没有包含 id 节点");
+        Assert.jsonObjectHaveKey(businessCbusinesstype, "id", "businessCbusinesstype 节点下没有包含 id 节点");
 
-        if(businessCbusinesstype.getString("id").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"id 错误,不能自动生成(必须已经存在的id)"+businessCbusinesstype);
+        if (businessCbusinesstype.getString("id").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "id 错误,不能自动生成(必须已经存在的id)" + businessCbusinesstype);
         }
         //自动保存DEL
-        autoSaveDelBusinessCbusinesstype(business,businessCbusinesstype);
+        autoSaveDelBusinessCbusinesstype(business, businessCbusinesstype);
 
-        businessCbusinesstype.put("bId",business.getbId());
+        businessCbusinesstype.put("bId", business.getbId());
         businessCbusinesstype.put("operate", StatusConstant.OPERATE_ADD);
         //保存cbusinesstype信息
         cbusinesstypeServiceDaoImpl.saveBusinessCbusinesstypeInfo(businessCbusinesstype);
@@ -175,8 +176,6 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
     }
 
 
-
-
     public ICbusinesstypeServiceDao getCbusinesstypeServiceDaoImpl() {
         return cbusinesstypeServiceDaoImpl;
     }
@@ -186,5 +185,4 @@ public class UpdateCbusinesstypeInfoListener extends AbstractCbusinesstypeBusine
     }
 
 
-
 }

+ 34 - 29
StoreService/src/main/java/com/java110/store/listener/demo/AbstractDemoBusinessServiceDataFlowListener.java

@@ -1,12 +1,12 @@
 package com.java110.store.listener.demo;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IDemoServiceDao;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.entity.center.Business;
-import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
-import com.java110.store.dao.IDemoServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -15,16 +15,16 @@ import java.util.List;
 import java.util.Map;
 
 /**
- *
  * demo 服务侦听 父类
  * Created by wuxw on 2018/7/4.
  */
-public abstract class AbstractDemoBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener{
+public abstract class AbstractDemoBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
     private static Logger logger = LoggerFactory.getLogger(AbstractDemoBusinessServiceDataFlowListener.class);
 
 
     /**
      * 获取 DAO工具类
+     *
      * @return
      */
     public abstract IDemoServiceDao getDemoServiceDaoImpl();
@@ -32,53 +32,58 @@ public abstract class AbstractDemoBusinessServiceDataFlowListener extends Abstra
     /**
      * 刷新 businessDemoInfo 数据
      * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
      * @param businessDemoInfo
      */
-    protected void flushBusinessDemoInfo(Map businessDemoInfo,String statusCd){
+    protected void flushBusinessDemoInfo(Map businessDemoInfo, String statusCd) {
         businessDemoInfo.put("newBId", businessDemoInfo.get("b_id"));
-        businessDemoInfo.put("demoRemark",businessDemoInfo.get("demo_remark"));
-businessDemoInfo.put("demoName",businessDemoInfo.get("demo_name"));
-businessDemoInfo.put("demoValue",businessDemoInfo.get("demo_value"));
-businessDemoInfo.put("operate",businessDemoInfo.get("operate"));
-businessDemoInfo.put("demoId",businessDemoInfo.get("demo_id"));
-businessDemoInfo.put("userId",businessDemoInfo.get("user_id"));
-businessDemoInfo.remove("bId");
+        businessDemoInfo.put("demoRemark", businessDemoInfo.get("demo_remark"));
+        businessDemoInfo.put("demoName", businessDemoInfo.get("demo_name"));
+        businessDemoInfo.put("demoValue", businessDemoInfo.get("demo_value"));
+        businessDemoInfo.put("operate", businessDemoInfo.get("operate"));
+        businessDemoInfo.put("demoId", businessDemoInfo.get("demo_id"));
+        businessDemoInfo.put("userId", businessDemoInfo.get("user_id"));
+        businessDemoInfo.remove("bId");
         businessDemoInfo.put("statusCd", statusCd);
     }
 
 
     /**
      * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
      * @param businessDemo demo信息
      */
-    protected void autoSaveDelBusinessDemo(Business business, JSONObject businessDemo){
+    protected void autoSaveDelBusinessDemo(Business business, JSONObject businessDemo) {
 //自动插入DEL
         Map info = new HashMap();
-        info.put("demoId",businessDemo.getString("demoId"));
-        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        info.put("demoId", businessDemo.getString("demoId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
         List<Map> currentDemoInfos = getDemoServiceDaoImpl().getDemoInfo(info);
-        if(currentDemoInfos == null || currentDemoInfos.size() != 1){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
+        if (currentDemoInfos == null || currentDemoInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
         }
 
         Map currentDemoInfo = currentDemoInfos.get(0);
 
-        currentDemoInfo.put("bId",business.getbId());
+        currentDemoInfo.put("bId", business.getbId());
 
-        currentDemoInfo.put("demoRemark",currentDemoInfo.get("demo_remark"));
-currentDemoInfo.put("demoName",currentDemoInfo.get("demo_name"));
-currentDemoInfo.put("demoValue",currentDemoInfo.get("demo_value"));
-currentDemoInfo.put("operate",currentDemoInfo.get("operate"));
-currentDemoInfo.put("demoId",currentDemoInfo.get("demo_id"));
-currentDemoInfo.put("userId",currentDemoInfo.get("user_id"));
+        currentDemoInfo.put("demoRemark", currentDemoInfo.get("demo_remark"));
+        currentDemoInfo.put("demoName", currentDemoInfo.get("demo_name"));
+        currentDemoInfo.put("demoValue", currentDemoInfo.get("demo_value"));
+        currentDemoInfo.put("operate", currentDemoInfo.get("operate"));
+        currentDemoInfo.put("demoId", currentDemoInfo.get("demo_id"));
+        currentDemoInfo.put("userId", currentDemoInfo.get("user_id"));
 
 
-        currentDemoInfo.put("operate",StatusConstant.OPERATE_DEL);
+        currentDemoInfo.put("operate", StatusConstant.OPERATE_DEL);
         getDemoServiceDaoImpl().saveBusinessDemoInfo(currentDemoInfo);
-    }
-
-
 
+        for(Object key : currentDemoInfo.keySet()) {
+            if(businessDemo.get(key) == null) {
+                businessDemo.put(key.toString(), currentDemoInfo.get(key));
+            }
+        }
+    }
 
 
 }

+ 51 - 49
StoreService/src/main/java/com/java110/store/listener/demo/DeleteDemoInfoListener.java

@@ -2,15 +2,15 @@ package com.java110.store.listener.demo;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IDemoServiceDao;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.store.dao.IDemoServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.Map;
 
 /**
  * 删除demo信息 侦听
- *
+ * <p>
  * 处理节点
  * 1、businessDemo:{} demo基本信息节点
  * 2、businessDemoAttr:[{}] demo属性信息节点
@@ -51,36 +51,36 @@ public class DeleteDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
 
     /**
      * 根据删除信息 查出Instance表中数据 保存至business表 (状态写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 节点,或没有子节点需要处理");
+
 
         //处理 businessDemo 节点
-        if(data.containsKey("businessDemo")){
-            //处理 businessDemo 节点
-            if(data.containsKey("businessDemo")){
-                Object _obj = data.get("businessDemo");
-                JSONArray businessDemos = null;
-                if(_obj instanceof JSONObject){
-                    businessDemos = new JSONArray();
-                    businessDemos.add(_obj);
-                }else {
-                    businessDemos = (JSONArray)_obj;
-                }
-                //JSONObject businessDemo = data.getJSONObject("businessDemo");
-                for (int _demoIndex = 0; _demoIndex < businessDemos.size();_demoIndex++) {
-                    JSONObject businessDemo = businessDemos.getJSONObject(_demoIndex);
-                    doBusinessDemo(business, businessDemo);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("demoId", businessDemo.getString("demoId"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_DELETE_DEMO_INFO)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_DELETE_DEMO_INFO);
+            JSONArray businessDemos = null;
+            if (_obj instanceof JSONObject) {
+                businessDemos = new JSONArray();
+                businessDemos.add(_obj);
+            } else {
+                businessDemos = (JSONArray) _obj;
+            }
+            //JSONObject businessDemo = data.getJSONObject("businessDemo");
+            for (int _demoIndex = 0; _demoIndex < businessDemos.size(); _demoIndex++) {
+                JSONObject businessDemo = businessDemos.getJSONObject(_demoIndex);
+                doBusinessDemo(business, businessDemo);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("demoId", businessDemo.getString("demoId"));
                 }
             }
+
         }
 
 
@@ -88,8 +88,9 @@ public class DeleteDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
 
     /**
      * 删除 instance数据
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -98,17 +99,17 @@ public class DeleteDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
 
         //demo信息
         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);
 
         //demo信息
         List<Map> businessDemoInfos = demoServiceDaoImpl.getBusinessDemoInfo(info);
-        if( businessDemoInfos != null && businessDemoInfos.size() >0) {
-            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size();_demoIndex++) {
+        if (businessDemoInfos != null && businessDemoInfos.size() > 0) {
+            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size(); _demoIndex++) {
                 Map businessDemoInfo = businessDemoInfos.get(_demoIndex);
-                flushBusinessDemoInfo(businessDemoInfo,StatusConstant.STATUS_CD_INVALID);
+                flushBusinessDemoInfo(businessDemoInfo, StatusConstant.STATUS_CD_INVALID);
                 demoServiceDaoImpl.updateDemoInfoInstance(businessDemoInfo);
-                dataFlowContext.addParamOut("demoId",businessDemoInfo.get("demo_id"));
+                dataFlowContext.addParamOut("demoId", businessDemoInfo.get("demo_id"));
             }
         }
 
@@ -117,54 +118,55 @@ public class DeleteDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
     /**
      * 撤单
      * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     *
      * @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);
         //demo信息
         List<Map> demoInfo = demoServiceDaoImpl.getDemoInfo(info);
-        if(demoInfo != null && demoInfo.size() > 0){
+        if (demoInfo != null && demoInfo.size() > 0) {
 
             //demo信息
             List<Map> businessDemoInfos = demoServiceDaoImpl.getBusinessDemoInfo(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessDemoInfos == null ||  businessDemoInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(demo),程序内部异常,请检查! "+delInfo);
+            if (businessDemoInfos == null || businessDemoInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(demo),程序内部异常,请检查! " + delInfo);
             }
-            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size();_demoIndex++) {
+            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size(); _demoIndex++) {
                 Map businessDemoInfo = businessDemoInfos.get(_demoIndex);
-                flushBusinessDemoInfo(businessDemoInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessDemoInfo(businessDemoInfo, StatusConstant.STATUS_CD_VALID);
                 demoServiceDaoImpl.updateDemoInfoInstance(businessDemoInfo);
             }
         }
     }
 
 
-
     /**
      * 处理 businessDemo 节点
-     * @param business 总的数据节点
+     *
+     * @param business     总的数据节点
      * @param businessDemo demo节点
      */
-    private void doBusinessDemo(Business business,JSONObject businessDemo){
+    private void doBusinessDemo(Business business, JSONObject businessDemo) {
 
-        Assert.jsonObjectHaveKey(businessDemo,"demoId","businessDemo 节点下没有包含 demoId 节点");
+        Assert.jsonObjectHaveKey(businessDemo, "demoId", "businessDemo 节点下没有包含 demoId 节点");
 
-        if(businessDemo.getString("demoId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"demoId 错误,不能自动生成(必须已经存在的demoId)"+businessDemo);
+        if (businessDemo.getString("demoId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "demoId 错误,不能自动生成(必须已经存在的demoId)" + businessDemo);
         }
         //自动插入DEL
-        autoSaveDelBusinessDemo(business,businessDemo);
+        autoSaveDelBusinessDemo(business, businessDemo);
     }
 
     public IDemoServiceDao getDemoServiceDaoImpl() {

+ 2 - 2
StoreService/src/main/java/com/java110/store/listener/demo/SaveDemoInfoListener.java

@@ -53,8 +53,8 @@ public class SaveDemoInfoListener extends AbstractDemoBusinessServiceDataFlowLis
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
         //处理 businessDemo 节点
-        if(data.containsKey("businessDemo")){
-            Object bObj = data.get("businessDemo");
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_DEMO_INFO)){
+            Object bObj = data.get(BusinessTypeConstant.BUSINESS_TYPE_SAVE_DEMO_INFO);
             JSONArray businessDemos = null;
             if(bObj instanceof JSONObject){
                 businessDemos = new JSONArray();

+ 51 - 53
StoreService/src/main/java/com/java110/store/listener/demo/UpdateDemoInfoListener.java

@@ -2,15 +2,15 @@ package com.java110.store.listener.demo;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IDemoServiceDao;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.store.dao.IDemoServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.Map;
 
 /**
  * 修改demo信息 侦听
- *
+ * <p>
  * 处理节点
  * 1、businessDemo:{} demo基本信息节点
  * 2、businessDemoAttr:[{}] demo属性信息节点
@@ -51,45 +51,45 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
 
     /**
      * 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 节点,或没有子节点需要处理");
 
         //处理 businessDemo 节点
-        if(data.containsKey("businessDemo")){
-            //处理 businessDemo 节点
-            if(data.containsKey("businessDemo")){
-                Object _obj = data.get("businessDemo");
-                JSONArray businessDemos = null;
-                if(_obj instanceof JSONObject){
-                    businessDemos = new JSONArray();
-                    businessDemos.add(_obj);
-                }else {
-                    businessDemos = (JSONArray)_obj;
-                }
-                //JSONObject businessDemo = data.getJSONObject("businessDemo");
-                for (int _demoIndex = 0; _demoIndex < businessDemos.size();_demoIndex++) {
-                    JSONObject businessDemo = businessDemos.getJSONObject(_demoIndex);
-                    doBusinessDemo(business, businessDemo);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("demoId", businessDemo.getString("demoId"));
-                    }
+        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_DEMO_INFO)) {
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_SAVE_DEMO_INFO);
+            JSONArray businessDemos = null;
+            if (_obj instanceof JSONObject) {
+                businessDemos = new JSONArray();
+                businessDemos.add(_obj);
+            } else {
+                businessDemos = (JSONArray) _obj;
+            }
+            //JSONObject businessDemo = data.getJSONObject("businessDemo");
+            for (int _demoIndex = 0; _demoIndex < businessDemos.size(); _demoIndex++) {
+                JSONObject businessDemo = businessDemos.getJSONObject(_demoIndex);
+                doBusinessDemo(business, businessDemo);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("demoId", businessDemo.getString("demoId"));
                 }
             }
+
         }
     }
 
 
     /**
      * business to instance 过程
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
@@ -97,17 +97,17 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
         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);
 
         //demo信息
         List<Map> businessDemoInfos = demoServiceDaoImpl.getBusinessDemoInfo(info);
-        if( businessDemoInfos != null && businessDemoInfos.size() >0) {
-            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size();_demoIndex++) {
+        if (businessDemoInfos != null && businessDemoInfos.size() > 0) {
+            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size(); _demoIndex++) {
                 Map businessDemoInfo = businessDemoInfos.get(_demoIndex);
-                flushBusinessDemoInfo(businessDemoInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessDemoInfo(businessDemoInfo, StatusConstant.STATUS_CD_VALID);
                 demoServiceDaoImpl.updateDemoInfoInstance(businessDemoInfo);
-                if(businessDemoInfo.size() == 1) {
+                if (businessDemoInfo.size() == 1) {
                     dataFlowContext.addParamOut("demoId", businessDemoInfo.get("demo_id"));
                 }
             }
@@ -117,8 +117,9 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
 
     /**
      * 撤单
+     *
      * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
+     * @param business        当前业务对象
      */
     @Override
     protected void doRecover(DataFlowContext dataFlowContext, Business business) {
@@ -126,24 +127,24 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
         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);
         //demo信息
         List<Map> demoInfo = demoServiceDaoImpl.getDemoInfo(info);
-        if(demoInfo != null && demoInfo.size() > 0){
+        if (demoInfo != null && demoInfo.size() > 0) {
 
             //demo信息
             List<Map> businessDemoInfos = demoServiceDaoImpl.getBusinessDemoInfo(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessDemoInfos == null || businessDemoInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(demo),程序内部异常,请检查! "+delInfo);
+            if (businessDemoInfos == null || businessDemoInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(demo),程序内部异常,请检查! " + delInfo);
             }
-            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size();_demoIndex++) {
+            for (int _demoIndex = 0; _demoIndex < businessDemoInfos.size(); _demoIndex++) {
                 Map businessDemoInfo = businessDemoInfos.get(_demoIndex);
-                flushBusinessDemoInfo(businessDemoInfo,StatusConstant.STATUS_CD_VALID);
+                flushBusinessDemoInfo(businessDemoInfo, StatusConstant.STATUS_CD_VALID);
                 demoServiceDaoImpl.updateDemoInfoInstance(businessDemoInfo);
             }
         }
@@ -151,23 +152,23 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
     }
 
 
-
     /**
      * 处理 businessDemo 节点
-     * @param business 总的数据节点
+     *
+     * @param business     总的数据节点
      * @param businessDemo demo节点
      */
-    private void doBusinessDemo(Business business,JSONObject businessDemo){
+    private void doBusinessDemo(Business business, JSONObject businessDemo) {
 
-        Assert.jsonObjectHaveKey(businessDemo,"demoId","businessDemo 节点下没有包含 demoId 节点");
+        Assert.jsonObjectHaveKey(businessDemo, "demoId", "businessDemo 节点下没有包含 demoId 节点");
 
-        if(businessDemo.getString("demoId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"demoId 错误,不能自动生成(必须已经存在的demoId)"+businessDemo);
+        if (businessDemo.getString("demoId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "demoId 错误,不能自动生成(必须已经存在的demoId)" + businessDemo);
         }
         //自动保存DEL
-        autoSaveDelBusinessDemo(business,businessDemo);
+        autoSaveDelBusinessDemo(business, businessDemo);
 
-        businessDemo.put("bId",business.getbId());
+        businessDemo.put("bId", business.getbId());
         businessDemo.put("operate", StatusConstant.OPERATE_ADD);
         //保存demo信息
         demoServiceDaoImpl.saveBusinessDemoInfo(businessDemo);
@@ -175,8 +176,6 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
     }
 
 
-
-
     public IDemoServiceDao getDemoServiceDaoImpl() {
         return demoServiceDaoImpl;
     }
@@ -186,5 +185,4 @@ public class UpdateDemoInfoListener extends AbstractDemoBusinessServiceDataFlowL
     }
 
 
-
 }

+ 1 - 1
StoreService/src/main/java/com/java110/store/listener/memberJoinedStoreListener.java

@@ -54,7 +54,7 @@ public class memberJoinedStoreListener extends AbstractStoreBusinessServiceDataF
         JSONObject data = business.getDatas();
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
-        if(data.containsKey("businessMemberStore")){
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_STORE)){
             JSONObject businessMemberStore = data.getJSONObject("businessMemberStore");
             doBusinessMemberStore(business,businessMemberStore);
         }

+ 2 - 2
StoreService/src/main/java/com/java110/store/listener/memberQuitStoreListener.java

@@ -56,8 +56,8 @@ public class memberQuitStoreListener extends AbstractStoreBusinessServiceDataFlo
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
         //处理 businessStore 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessMemberStore")){
-            JSONObject memberStore = data.getJSONObject("businessMemberStore");
+        if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_STORE)){
+            JSONObject memberStore = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_STORE);
             doBusinessMemberStore(business,memberStore);
             dataFlowContext.addParamOut("memberStoreId",memberStore.getString("memberStoreId"));
         }