Просмотр исходного кода

优化小区成员加入报错

java110 лет назад: 5
Родитель
Сommit
5522f25633

+ 50 - 35
CommunityService/src/main/java/com/java110/community/dao/ICommunityServiceDao.java

@@ -1,8 +1,6 @@
 package com.java110.community.dao;
 
 
-import com.java110.dto.community.CommunityAttrDto;
-import com.java110.dto.community.CommunityDto;
 import com.java110.utils.exception.DAOException;
 
 import java.util.List;
@@ -12,218 +10,236 @@ import java.util.Map;
  * 小区组件内部之间使用,没有给外围系统提供服务能力
  * 小区服务接口类,要求全部以字符串传输,方便微服务化
  * 新建客户,修改客户,删除客户,查询客户等功能
- *
+ * <p>
  * Created by wuxw on 2016/12/27.
  */
 public interface ICommunityServiceDao {
 
     /**
      * 保存 小区信息
+     *
      * @param businessCommunityInfo 小区信息 封装
      * @throws DAOException 操作数据库异常
      */
-     void saveBusinessCommunityInfo(Map businessCommunityInfo) throws DAOException;
+    void saveBusinessCommunityInfo(Map businessCommunityInfo) throws DAOException;
 
     /**
      * 保存小区属性
+     *
      * @param businessCommunityAttr 小区属性信息封装
      * @throws DAOException 操作数据库异常
      */
-     void saveBusinessCommunityAttr(Map businessCommunityAttr) throws DAOException;
+    void saveBusinessCommunityAttr(Map businessCommunityAttr) throws DAOException;
 
 
     /**
      * 保存小区照片信息
+     *
      * @param businessCommunityPhoto 小区照片
      * @throws DAOException 操作数据库异常
      */
-     void saveBusinessCommunityPhoto(Map businessCommunityPhoto) throws DAOException;
+    void saveBusinessCommunityPhoto(Map businessCommunityPhoto) throws DAOException;
 
     /**
      * 保存小区证件信息
+     *
      * @param businessCommunityCerdentials 小区证件
      * @throws DAOException 操作数据库异常
      */
-     void saveBusinessCommunityCerdentials(Map businessCommunityCerdentials) throws DAOException;
+    void saveBusinessCommunityCerdentials(Map businessCommunityCerdentials) throws DAOException;
 
     /**
      * 查询小区信息(business过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     Map getBusinessCommunityInfo(Map info) throws DAOException;
+    Map getBusinessCommunityInfo(Map info) throws DAOException;
 
 
     /**
      * 查询小区属性信息(business过程)
+     *
      * @param info bId 信息
      * @return 小区属性
      * @throws DAOException
      */
-     List<Map> getBusinessCommunityAttrs(Map info) throws DAOException;
+    List<Map> getBusinessCommunityAttrs(Map info) throws DAOException;
 
 
     /**
      * 查询小区照片
+     *
      * @param info bId 信息
      * @return 小区照片
      * @throws DAOException
      */
-     List<Map> getBusinessCommunityPhoto(Map info) throws DAOException;
+    List<Map> getBusinessCommunityPhoto(Map info) throws DAOException;
 
 
     /**
      * 查询小区证件信息
+     *
      * @param info bId 信息
      * @return 小区照片
      * @throws DAOException
      */
-     List<Map> getBusinessCommunityCerdentials(Map info) throws DAOException;
+    List<Map> getBusinessCommunityCerdentials(Map info) throws DAOException;
 
     /**
      * 保存 小区信息 Business数据到 Instance中
+     *
      * @param info
      * @throws DAOException
      */
-     void saveCommunityInfoInstance(Map info) throws DAOException;
+    void saveCommunityInfoInstance(Map info) throws DAOException;
 
 
     /**
      * 保存 小区属性信息 Business数据到 Instance中
+     *
      * @param info
      * @throws DAOException
      */
-     void saveCommunityAttrsInstance(Map info) throws DAOException;
+    void saveCommunityAttrsInstance(Map info) throws DAOException;
 
     /**
      * 保存 小区照片信息 Business数据到 Instance中
+     *
      * @param info
      * @throws DAOException
      */
-     void saveCommunityPhotoInstance(Map info) throws DAOException;
-
-
-
-
+    void saveCommunityPhotoInstance(Map info) throws DAOException;
 
 
     /**
      * 查询小区信息(instance过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     Map getCommunityInfo(Map info) throws DAOException;
+    Map getCommunityInfo(Map info) throws DAOException;
 
 
     /**
      * 查询小区属性信息(instance过程)
+     *
      * @param info bId 信息
      * @return 小区属性
      * @throws DAOException
      */
-     List<Map> getCommunityAttrs(Map info) throws DAOException;
+    List<Map> getCommunityAttrs(Map info) throws DAOException;
 
 
     /**
      * 查询小区照片(instance 过程)
+     *
      * @param info bId 信息
      * @return 小区照片
      * @throws DAOException
      */
-     List<Map> getCommunityPhoto(Map info) throws DAOException;
-
+    List<Map> getCommunityPhoto(Map info) throws DAOException;
 
 
     /**
      * 修改小区信息
+     *
      * @param info 修改信息
      * @throws DAOException
      */
-     void updateCommunityInfoInstance(Map info) throws DAOException;
+    void updateCommunityInfoInstance(Map info) throws DAOException;
 
 
     /**
      * 修改小区属性信息
+     *
      * @param info 修改信息
      * @throws DAOException
      */
-     void updateCommunityAttrInstance(Map info) throws DAOException;
+    void updateCommunityAttrInstance(Map info) throws DAOException;
 
 
     /**
      * 修改小区照片信息
+     *
      * @param info 修改信息
      * @throws DAOException
      */
-     void updateCommunityPhotoInstance(Map info) throws DAOException;
-
-    
+    void updateCommunityPhotoInstance(Map info) throws DAOException;
 
 
     /**
      * 小区成员加入信息
+     *
      * @param businessCommunityMember 小区成员信息 封装
      * @throws DAOException 操作数据库异常
      */
-     void saveBusinessCommunityMember(Map businessCommunityMember) throws DAOException;
+    void saveBusinessCommunityMember(Map businessCommunityMember) throws DAOException;
 
     /**
      * 成员加入 保存信息至instance
+     *
      * @param info
      * @throws DAOException
      */
-     void saveCommunityMemberInstance(Map info) throws DAOException;
+    void saveCommunityMemberInstance(Map info) throws DAOException;
 
     /**
      * 查询小区成员加入信息(business过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     Map getBusinessCommunityMember(Map info) throws DAOException;
+    List<Map> getBusinessCommunityMember(Map info) throws DAOException;
 
     /**
      * 查询小区成员加入信息(instance过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     Map getCommunityMember(Map info) throws DAOException;
+    List<Map> getCommunityMember(Map info) throws DAOException;
 
     /**
      * 修改小区成员加入信息
+     *
      * @param info 修改信息
      * @throws DAOException
      */
-     void updateCommunityMemberInstance(Map info) throws DAOException;
+    void updateCommunityMemberInstance(Map info) throws DAOException;
 
     /**
      * 查询小区成员加入信息(instance过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     List<Map> getCommunityMembers(Map info) throws DAOException;
+    List<Map> getCommunityMembers(Map info) throws DAOException;
 
     /**
      * 查询小区成员个数
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException
      */
-     int getCommunityMemberCount(Map info);
+    int getCommunityMemberCount(Map info);
 
     /**
      * 查询小区信息(instance过程)
      * 根据bId 查询小区信息
+     *
      * @param info bId 信息
      * @return 小区信息
      * @throws DAOException DAO异常
@@ -231,7 +247,6 @@ public interface ICommunityServiceDao {
     List<Map> getCommunityInfoNew(Map info) throws DAOException;
 
 
-
     /**
      * 查询小区总数
      *

+ 12 - 11
CommunityService/src/main/java/com/java110/community/dao/impl/CommunityServiceDaoImpl.java

@@ -1,12 +1,11 @@
 package com.java110.community.dao.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.dto.community.CommunityAttrDto;
+import com.java110.community.dao.ICommunityServiceDao;
+import com.java110.core.base.dao.BaseServiceDao;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.DAOException;
 import com.java110.utils.util.DateUtil;
-import com.java110.community.dao.ICommunityServiceDao;
-import com.java110.core.base.dao.BaseServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -356,7 +355,7 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
      * @return 小区信息
      * @throws DAOException
      */
-    public Map getBusinessCommunityMember(Map info) throws DAOException {
+    public List<Map> getBusinessCommunityMember(Map info) throws DAOException {
         logger.debug("查询小区成员加入信息 入参 info : {}", info);
 
         List<Map> businessCommunityMembers = sqlSessionTemplate.selectList("communityServiceDaoImpl.getBusinessCommunityMember", info);
@@ -367,7 +366,7 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "根据条件查询有多条数据,数据异常,请检查:businessCommunityMember," + JSONObject.toJSONString(info));
         }
 
-        return businessCommunityMembers.get(0);
+        return businessCommunityMembers;
     }
 
     /**
@@ -378,7 +377,7 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
      * @return 小区信息
      * @throws DAOException
      */
-    public Map getCommunityMember(Map info) throws DAOException {
+    public List<Map> getCommunityMember(Map info) throws DAOException {
         logger.debug("查询小区成员加入信息 入参 info : {}", info);
 
         List<Map> memberCommunitys = sqlSessionTemplate.selectList("communityServiceDaoImpl.getCommunityMember", info);
@@ -389,7 +388,7 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "根据条件查询有多条数据,数据异常,请检查:getCommunityMember," + JSONObject.toJSONString(info));
         }
 
-        return memberCommunitys.get(0);
+        return memberCommunitys;
     }
 
     /**
@@ -437,27 +436,29 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
 
     /**
      * 查询小区信息(instance)
+     *
      * @param info bId 信息
      * @return List<Map>
      * @throws DAOException DAO异常
      */
     @Override
     public List<Map> getCommunityInfoNew(Map info) throws DAOException {
-        logger.debug("查询小区信息 入参 info : {}",info);
+        logger.debug("查询小区信息 入参 info : {}", info);
 
-        List<Map> businessCommunityInfos = sqlSessionTemplate.selectList("communityServiceDaoImpl.getCommunityInfoNew",info);
+        List<Map> businessCommunityInfos = sqlSessionTemplate.selectList("communityServiceDaoImpl.getCommunityInfoNew", info);
 
         return businessCommunityInfos;
     }
 
     /**
      * 查询小区数量
+     *
      * @param info 小区信息
      * @return 小区数量
      */
     @Override
     public int queryCommunitysCount(Map info) {
-        logger.debug("查询小区数据 入参 info : {}",info);
+        logger.debug("查询小区数据 入参 info : {}", info);
 
         List<Map> businessCommunityInfos = sqlSessionTemplate.selectList("communityServiceDaoImpl.queryCommunitysCount", info);
         if (businessCommunityInfos.size() < 1) {
@@ -469,7 +470,7 @@ public class CommunityServiceDaoImpl extends BaseServiceDao implements ICommunit
 
     @Override
     public int getCommunityAttrsCount(Map info) {
-        logger.debug("查询小区数据 入参 info : {}",info);
+        logger.debug("查询小区数据 入参 info : {}", info);
 
         List<Map> businessCommunityInfos = sqlSessionTemplate.selectList("communityServiceDaoImpl.getCommunityAttrsCount", info);
         if (businessCommunityInfos.size() < 1) {

+ 8 - 2
CommunityService/src/main/java/com/java110/community/listener/AbstractCommunityBusinessServiceDataFlowListener.java

@@ -193,10 +193,16 @@ public abstract class AbstractCommunityBusinessServiceDataFlowListener extends A
         Map info = new HashMap();
         info.put("communityMemberId", businessCommunityMember.getString("communityMemberId"));
         info.put("statusCd", StatusConstant.STATUS_CD_VALID);
-        Map currentCommunityMember = getCommunityServiceDaoImpl().getCommunityMember(info);
-        if (currentCommunityMember == null || currentCommunityMember.isEmpty()) {
+
+
+        List<Map> currentCommunityMembers = getCommunityServiceDaoImpl().getCommunityMember(info);
+
+        if (currentCommunityMembers == null || currentCommunityMembers.size() != 1) {
             throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
         }
+
+        Map currentCommunityMember = currentCommunityMembers.get(0);
+
         currentCommunityMember.put("bId", business.getbId());
         currentCommunityMember.put("communityId", currentCommunityMember.get("community_id"));
         currentCommunityMember.put("communityMemberId", currentCommunityMember.get("community_member_id"));

+ 45 - 24
CommunityService/src/main/java/com/java110/community/listener/communityMember/AuditCommunityMemberStateListener.java

@@ -1,22 +1,24 @@
 package com.java110.community.listener.communityMember;
 
+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.community.dao.ICommunityServiceDao;
 import com.java110.community.listener.AbstractCommunityBusinessServiceDataFlowListener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.entity.center.Business;
+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;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -57,11 +59,25 @@ public class AuditCommunityMemberStateListener extends AbstractCommunityBusiness
 
         Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
 
+
         //处理 businessCommunity 节点 按理这里不应该处理,程序上支持,以防真有这种业务
         if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_AUDIT_COMMUNITY_MEMBER_STATE)) {
-            JSONObject memberCommunity = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_AUDIT_COMMUNITY_MEMBER_STATE);
-            doBusinessCommunityMember(business, memberCommunity);
-            dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_AUDIT_COMMUNITY_MEMBER_STATE);
+            JSONArray businessMemberCommunitys = null;
+            if (_obj instanceof JSONObject) {
+                businessMemberCommunitys = new JSONArray();
+                businessMemberCommunitys.add(_obj);
+            } else {
+                businessMemberCommunitys = (JSONArray) _obj;
+            }
+            //JSONObject businessFloor = data.getJSONObject("businessFloor");
+            for (int _memberIndex = 0; _memberIndex < businessMemberCommunitys.size(); _memberIndex++) {
+                JSONObject memberCommunity = businessMemberCommunitys.getJSONObject(_memberIndex);
+                doBusinessCommunityMember(business, memberCommunity);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+                }
+            }
         }
 
     }
@@ -83,12 +99,15 @@ public class AuditCommunityMemberStateListener extends AbstractCommunityBusiness
         info.put("operate", StatusConstant.OPERATE_ADD);
 
 
-        //小区信息
-        Map businessCommunityMember = communityServiceDaoImpl.getBusinessCommunityMember(info);
-        if (businessCommunityMember != null && !businessCommunityMember.isEmpty()) {
-            flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_VALID);
-            communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
-            dataFlowContext.addParamOut("communityMemberId", businessCommunityMember.get("member_community_id"));
+        //小区楼信息
+        List<Map> businessCommunityMembers = communityServiceDaoImpl.getBusinessCommunityMember(info);
+        if (businessCommunityMembers != null && businessCommunityMembers.size() > 0) {
+            for (int _memberIndex = 0; _memberIndex < businessCommunityMembers.size(); _memberIndex++) {
+                Map businessCommunityMemberInfo = businessCommunityMembers.get(_memberIndex);
+                flushBusinessCommunityMember(businessCommunityMemberInfo, StatusConstant.STATUS_CD_VALID);
+                communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMemberInfo);
+                dataFlowContext.addParamOut("communityMemberId", businessCommunityMemberInfo.get("member_community_id"));
+            }
         }
     }
 
@@ -111,19 +130,21 @@ public class AuditCommunityMemberStateListener extends AbstractCommunityBusiness
         delInfo.put("bId", business.getbId());
         delInfo.put("operate", StatusConstant.OPERATE_DEL);
         //小区信息
-        Map memberCommunity = communityServiceDaoImpl.getCommunityMember(info);
-        if (memberCommunity != null && !memberCommunity.isEmpty()) {
+        List<Map> memberCommunitys = communityServiceDaoImpl.getCommunityMember(info);
+        if (memberCommunitys != null && !memberCommunitys.isEmpty()) {
+
 
-            //小区信息
-            Map businessCommunityMember = communityServiceDaoImpl.getBusinessCommunityMember(delInfo);
+            //小区信息
+            List<Map> businessCommunityMembers = communityServiceDaoImpl.getBusinessCommunityMember(delInfo);
             //除非程序出错了,这里不会为空
-            if (businessCommunityMember == null || businessCommunityMember.isEmpty()) {
+            if (businessCommunityMembers == null || businessCommunityMembers.size() == 0) {
                 throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(member community),程序内部异常,请检查! " + delInfo);
             }
-
-            flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_VALID);
-            communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
-            dataFlowContext.addParamOut("communityMemberId", memberCommunity.get("member_community_id"));
+            for (int _memberIndex = 0; _memberIndex < businessCommunityMembers.size(); _memberIndex++) {
+                Map businessCommunityMember = businessCommunityMembers.get(_memberIndex);
+                flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_VALID);
+                communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
+            }
         }
     }
 
@@ -141,7 +162,7 @@ public class AuditCommunityMemberStateListener extends AbstractCommunityBusiness
         //自动插入DEL
         autoSaveDelBusinessCommunityMember(business, businessCommunity);
 
-        businessCommunity.put("bId",business.getbId());
+        businessCommunity.put("bId", business.getbId());
         businessCommunity.put("operate", StatusConstant.OPERATE_ADD);
         //保存小区信息
         communityServiceDaoImpl.saveBusinessCommunityMember(businessCommunity);

+ 46 - 18
CommunityService/src/main/java/com/java110/community/listener/communityMember/MemberJoinedCommunityListener.java

@@ -1,23 +1,25 @@
 package com.java110.community.listener.communityMember;
 
+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.community.dao.ICommunityServiceDao;
 import com.java110.community.listener.AbstractCommunityBusinessServiceDataFlowListener;
 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.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;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -58,9 +60,25 @@ public class MemberJoinedCommunityListener extends AbstractCommunityBusinessServ
         JSONObject data = business.getDatas();
         Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
 
+
+        //处理 businessCommunity 节点 按理这里不应该处理,程序上支持,以防真有这种业务
         if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY)) {
-            JSONObject businessCommunityMember = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY);
-            doBusinessCommunityMember(business, businessCommunityMember);
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY);
+            JSONArray businessMemberCommunitys = null;
+            if (_obj instanceof JSONObject) {
+                businessMemberCommunitys = new JSONArray();
+                businessMemberCommunitys.add(_obj);
+            } else {
+                businessMemberCommunitys = (JSONArray) _obj;
+            }
+            //JSONObject businessFloor = data.getJSONObject("businessFloor");
+            for (int _memberIndex = 0; _memberIndex < businessMemberCommunitys.size(); _memberIndex++) {
+                JSONObject memberCommunity = businessMemberCommunitys.getJSONObject(_memberIndex);
+                doBusinessCommunityMember(business, memberCommunity);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+                }
+            }
         }
     }
 
@@ -78,12 +96,16 @@ public class MemberJoinedCommunityListener extends AbstractCommunityBusinessServ
         info.put("bId", business.getbId());
         info.put("operate", StatusConstant.OPERATE_ADD);
 
-        //小区信息
-        Map businessCommunityMember = communityServiceDaoImpl.getBusinessCommunityMember(info);
-        if (businessCommunityMember != null && !businessCommunityMember.isEmpty()) {
-            communityServiceDaoImpl.saveCommunityMemberInstance(info);
-            dataFlowContext.addParamOut("communityId", businessCommunityMember.get("community_id"));
-            dataFlowContext.addParamOut("memberId", businessCommunityMember.get("member_id"));
+
+        //小区楼信息
+        List<Map> businessCommunityMembers = communityServiceDaoImpl.getBusinessCommunityMember(info);
+        if (businessCommunityMembers != null && businessCommunityMembers.size() > 0) {
+            for (int _memberIndex = 0; _memberIndex < businessCommunityMembers.size(); _memberIndex++) {
+                Map businessCommunityMemberInfo = businessCommunityMembers.get(_memberIndex);
+                communityServiceDaoImpl.saveCommunityMemberInstance(info);
+                dataFlowContext.addParamOut("communityId", businessCommunityMemberInfo.get("community_id"));
+                dataFlowContext.addParamOut("memberId", businessCommunityMemberInfo.get("member_id"));
+            }
         }
     }
 
@@ -103,12 +125,18 @@ public class MemberJoinedCommunityListener extends AbstractCommunityBusinessServ
         Map paramIn = new HashMap();
         paramIn.put("bId", bId);
         paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID);
+
+
         //小区信息
-        Map communityMember = communityServiceDaoImpl.getCommunityMember(info);
-        if (communityMember != null && !communityMember.isEmpty()) {
-            paramIn.put("communityMemberId", communityMember.get("member_community_id").toString());
-            communityServiceDaoImpl.updateCommunityMemberInstance(paramIn);
-            dataFlowContext.addParamOut("communityMemberId", communityMember.get("member_community_id"));
+        List<Map> communityMembers = communityServiceDaoImpl.getCommunityMember(info);
+        if (communityMembers != null && !communityMembers.isEmpty()) {
+
+            for (int _memberIndex = 0; _memberIndex < communityMembers.size(); _memberIndex++) {
+                Map businessCommunityMemberInfo = communityMembers.get(_memberIndex);
+                paramIn.put("communityMemberId", businessCommunityMemberInfo.get("member_community_id").toString());
+                communityServiceDaoImpl.updateCommunityMemberInstance(paramIn);
+                dataFlowContext.addParamOut("communityMemberId", businessCommunityMemberInfo.get("member_community_id"));
+            }
         }
     }
 

+ 51 - 24
CommunityService/src/main/java/com/java110/community/listener/communityMember/MemberQuitCommunityListener.java

@@ -1,22 +1,24 @@
 package com.java110.community.listener.communityMember;
 
+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.community.dao.ICommunityServiceDao;
 import com.java110.community.listener.AbstractCommunityBusinessServiceDataFlowListener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.entity.center.Business;
+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;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -59,10 +61,29 @@ public class MemberQuitCommunityListener extends AbstractCommunityBusinessServic
 
         //处理 businessCommunity 节点 按理这里不应该处理,程序上支持,以防真有这种业务
         if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_COMMUNITY)) {
-            JSONObject memberCommunity = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_COMMUNITY);
-            doBusinessCommunityMember(business, memberCommunity);
-            dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+            Object _obj = data.get(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_COMMUNITY);
+            JSONArray businessMemberCommunitys = null;
+            if (_obj instanceof JSONObject) {
+                businessMemberCommunitys = new JSONArray();
+                businessMemberCommunitys.add(_obj);
+            } else {
+                businessMemberCommunitys = (JSONArray) _obj;
+            }
+            //JSONObject businessFloor = data.getJSONObject("businessFloor");
+            for (int _memberIndex = 0; _memberIndex < businessMemberCommunitys.size(); _memberIndex++) {
+                JSONObject memberCommunity = businessMemberCommunitys.getJSONObject(_memberIndex);
+                doBusinessCommunityMember(business, memberCommunity);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+                }
+            }
         }
+//        //处理 businessCommunity 节点 按理这里不应该处理,程序上支持,以防真有这种业务
+//        if (data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_COMMUNITY)) {
+//            JSONObject memberCommunity = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_MEMBER_QUIT_COMMUNITY);
+//            doBusinessCommunityMember(business, memberCommunity);
+//            dataFlowContext.addParamOut("communityMemberId", memberCommunity.getString("communityMemberId"));
+//        }
 
     }
 
@@ -82,12 +103,16 @@ public class MemberQuitCommunityListener extends AbstractCommunityBusinessServic
         info.put("bId", business.getbId());
         info.put("operate", StatusConstant.OPERATE_DEL);
 
-        //小区信息
-        Map businessCommunityMember = communityServiceDaoImpl.getBusinessCommunityMember(info);
-        if (businessCommunityMember != null && !businessCommunityMember.isEmpty()) {
-            flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_INVALID);
-            communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
-            dataFlowContext.addParamOut("communityMemberId", businessCommunityMember.get("member_community_id"));
+
+        //小区楼信息
+        List<Map> businessCommunityMembers = communityServiceDaoImpl.getBusinessCommunityMember(info);
+        if (businessCommunityMembers != null && businessCommunityMembers.size() > 0) {
+            for (int _memberIndex = 0; _memberIndex < businessCommunityMembers.size(); _memberIndex++) {
+                Map businessCommunityMemberInfo = businessCommunityMembers.get(_memberIndex);
+                flushBusinessCommunityMember(businessCommunityMemberInfo, StatusConstant.STATUS_CD_INVALID);
+                communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMemberInfo);
+                dataFlowContext.addParamOut("communityMemberId", businessCommunityMemberInfo.get("member_community_id"));
+            }
         }
     }
 
@@ -110,19 +135,21 @@ public class MemberQuitCommunityListener extends AbstractCommunityBusinessServic
         delInfo.put("bId", business.getbId());
         delInfo.put("operate", StatusConstant.OPERATE_DEL);
         //小区信息
-        Map memberCommunity = communityServiceDaoImpl.getCommunityMember(info);
-        if (memberCommunity != null && !memberCommunity.isEmpty()) {
+        List<Map> memberCommunitys = communityServiceDaoImpl.getCommunityMember(info);
+        if (memberCommunitys != null && !memberCommunitys.isEmpty()) {
+
 
-            //小区信息
-            Map businessCommunityMember = communityServiceDaoImpl.getBusinessCommunityMember(delInfo);
+            //小区信息
+            List<Map> businessCommunityMembers = communityServiceDaoImpl.getBusinessCommunityMember(delInfo);
             //除非程序出错了,这里不会为空
-            if (businessCommunityMember == null || businessCommunityMember.isEmpty()) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(member community),程序内部异常,请检查! " + delInfo);
+            if (businessCommunityMembers == null || businessCommunityMembers.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(community),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _memberIndex = 0; _memberIndex < businessCommunityMembers.size(); _memberIndex++) {
+                Map businessCommunityMember = businessCommunityMembers.get(_memberIndex);
+                flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_VALID);
+                communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
             }
-
-            flushBusinessCommunityMember(businessCommunityMember, StatusConstant.STATUS_CD_VALID);
-            communityServiceDaoImpl.updateCommunityMemberInstance(businessCommunityMember);
-            dataFlowContext.addParamOut("communityMemberId", memberCommunity.get("member_community_id"));
         }
     }
 

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

@@ -60,7 +60,7 @@ public class SaveStoreInfoListener extends AbstractStoreBusinessServiceDataFlowL
 
         //处理 businessStore 节点
         if(data.containsKey(BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_INFO)){
-            JSONObject businessStore = data.getJSONObject("businessStore");
+            JSONObject businessStore = data.getJSONObject(BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_INFO);
             doBusinessStore(business,businessStore);
             dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
         }