Explorar el Código

生成业主代码信息

吴学文 hace 7 años
padre
commit
8396755bb7
Se han modificado 18 ficheros con 1776 adiciones y 0 borrados
  1. 81 0
      CommunityService/src/main/java/com/java110/community/dao/IOwnerServiceDao.java
  2. 134 0
      CommunityService/src/main/java/com/java110/community/dao/impl/OwnerServiceDaoImpl.java
  3. 87 0
      CommunityService/src/main/java/com/java110/community/listener/owner/AbstractOwnerBusinessServiceDataFlowListener.java
  4. 180 0
      CommunityService/src/main/java/com/java110/community/listener/owner/DeleteOwnerInfoListener.java
  5. 157 0
      CommunityService/src/main/java/com/java110/community/listener/owner/SaveOwnerInfoListener.java
  6. 190 0
      CommunityService/src/main/java/com/java110/community/listener/owner/UpdateOwnerInfoListener.java
  7. 113 0
      CommunityService/src/main/java/com/java110/community/smo/impl/OwnerInnerServiceSMOImpl.java
  8. 3 0
      docs/_sidebar.md
  9. 114 0
      docs/services/owner/DeleteOwnerInfo.md
  10. 125 0
      docs/services/owner/SaveOwnerInfo.md
  11. 126 0
      docs/services/owner/UpdateOwnerInfo.md
  12. 89 0
      java110-bean/src/main/java/com/java110/dto/OwnerDto.java
  13. 79 0
      java110-code-generator/src/main/java/com/java110/OwnerGeneratorApplication.java
  14. 19 0
      java110-common/src/main/java/com/java110/common/constant/BusinessTypeConstant.java
  15. 35 0
      java110-config/db/CommunityService/create_owner.sql
  16. 201 0
      java110-config/src/main/resources/mapper/owner/OwnerServiceDaoImplMapper.xml
  17. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  18. 42 0
      java110-core/src/main/java/com/java110/core/smo/owner/IOwnerInnerServiceSMO.java

+ 81 - 0
CommunityService/src/main/java/com/java110/community/dao/IOwnerServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.community.dao;
+
+
+import com.java110.common.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 业主组件内部之间使用,没有给外围系统提供服务能力
+ * 业主服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IOwnerServiceDao {
+
+    /**
+     * 保存 业主信息
+     * @param businessOwnerInfo 业主信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessOwnerInfo(Map businessOwnerInfo) throws DAOException;
+
+
+
+    /**
+     * 查询业主信息(business过程)
+     * 根据bId 查询业主信息
+     * @param info bId 信息
+     * @return 业主信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessOwnerInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 业主信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveOwnerInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询业主信息(instance过程)
+     * 根据bId 查询业主信息
+     * @param info bId 信息
+     * @return 业主信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getOwnerInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改业主信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateOwnerInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询业主总数
+     *
+     * @param info 业主信息
+     * @return 业主数量
+     */
+    int queryOwnersCount(Map info);
+
+}

+ 134 - 0
CommunityService/src/main/java/com/java110/community/dao/impl/OwnerServiceDaoImpl.java

@@ -0,0 +1,134 @@
+package com.java110.community.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.DAOException;
+import com.java110.common.util.DateUtil;
+import com.java110.community.dao.IOwnerServiceDao;
+import com.java110.core.base.dao.BaseServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 业主服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("ownerServiceDaoImpl")
+//@Transactional
+public class OwnerServiceDaoImpl extends BaseServiceDao implements IOwnerServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(OwnerServiceDaoImpl.class);
+
+    /**
+     * 业主信息封装
+     *
+     * @param businessOwnerInfo 业主信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessOwnerInfo(Map businessOwnerInfo) throws DAOException {
+        businessOwnerInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存业主信息 入参 businessOwnerInfo : {}", businessOwnerInfo);
+        int saveFlag = sqlSessionTemplate.insert("ownerServiceDaoImpl.saveBusinessOwnerInfo", businessOwnerInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存业主数据失败:" + JSONObject.toJSONString(businessOwnerInfo));
+        }
+    }
+
+
+    /**
+     * 查询业主信息
+     *
+     * @param info bId 信息
+     * @return 业主信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessOwnerInfo(Map info) throws DAOException {
+
+        logger.debug("查询业主信息 入参 info : {}", info);
+
+        List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.getBusinessOwnerInfo", info);
+
+        return businessOwnerInfos;
+    }
+
+
+    /**
+     * 保存业主信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveOwnerInfoInstance(Map info) throws DAOException {
+        logger.debug("保存业主信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("ownerServiceDaoImpl.saveOwnerInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存业主信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询业主信息(instance)
+     *
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getOwnerInfo(Map info) throws DAOException {
+        logger.debug("查询业主信息 入参 info : {}", info);
+
+        List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.getOwnerInfo", info);
+
+        return businessOwnerInfos;
+    }
+
+
+    /**
+     * 修改业主信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateOwnerInfoInstance(Map info) throws DAOException {
+        logger.debug("修改业主信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("ownerServiceDaoImpl.updateOwnerInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改业主信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询业主数量
+     *
+     * @param info 业主信息
+     * @return 业主数量
+     */
+    @Override
+    public int queryOwnersCount(Map info) {
+        logger.debug("查询业主数据 入参 info : {}", info);
+
+        List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.queryOwnersCount", info);
+        if (businessOwnerInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 87 - 0
CommunityService/src/main/java/com/java110/community/listener/owner/AbstractOwnerBusinessServiceDataFlowListener.java

@@ -0,0 +1,87 @@
+package com.java110.community.listener.owner;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.community.dao.IOwnerServiceDao;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 业主 服务侦听 父类
+ * Created by wuxw on 2018/7/4.
+ */
+public abstract class AbstractOwnerBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractOwnerBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IOwnerServiceDao getOwnerServiceDaoImpl();
+
+    /**
+     * 刷新 businessOwnerInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessOwnerInfo
+     */
+    protected void flushBusinessOwnerInfo(Map businessOwnerInfo, String statusCd) {
+        businessOwnerInfo.put("newBId", businessOwnerInfo.get("b_id"));
+        businessOwnerInfo.put("operate", businessOwnerInfo.get("operate"));
+        businessOwnerInfo.put("sex", businessOwnerInfo.get("sex"));
+        businessOwnerInfo.put("name", businessOwnerInfo.get("name"));
+        businessOwnerInfo.put("link", businessOwnerInfo.get("link"));
+        businessOwnerInfo.put("remark", businessOwnerInfo.get("remark"));
+        businessOwnerInfo.put("ownerId", businessOwnerInfo.get("owner_id"));
+        businessOwnerInfo.put("userId", businessOwnerInfo.get("user_id"));
+        businessOwnerInfo.put("age", businessOwnerInfo.get("age"));
+        businessOwnerInfo.remove("bId");
+        businessOwnerInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessOwner 业主信息
+     */
+    protected void autoSaveDelBusinessOwner(Business business, JSONObject businessOwner) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("ownerId", businessOwner.getString("ownerId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentOwnerInfos = getOwnerServiceDaoImpl().getOwnerInfo(info);
+        if (currentOwnerInfos == null || currentOwnerInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentOwnerInfo = currentOwnerInfos.get(0);
+
+        currentOwnerInfo.put("bId", business.getbId());
+
+        currentOwnerInfo.put("operate", currentOwnerInfo.get("operate"));
+        currentOwnerInfo.put("sex", currentOwnerInfo.get("sex"));
+        currentOwnerInfo.put("name", currentOwnerInfo.get("name"));
+        currentOwnerInfo.put("link", currentOwnerInfo.get("link"));
+        currentOwnerInfo.put("remark", currentOwnerInfo.get("remark"));
+        currentOwnerInfo.put("ownerId", currentOwnerInfo.get("owner_id"));
+        currentOwnerInfo.put("userId", currentOwnerInfo.get("user_id"));
+        currentOwnerInfo.put("age", currentOwnerInfo.get("age"));
+
+
+        currentOwnerInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getOwnerServiceDaoImpl().saveBusinessOwnerInfo(currentOwnerInfo);
+    }
+
+
+}

+ 180 - 0
CommunityService/src/main/java/com/java110/community/listener/owner/DeleteOwnerInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.community.listener.owner;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.util.Assert;
+import com.java110.community.dao.IOwnerServiceDao;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+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;
+
+/**
+ * 删除业主信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessOwner:{} 业主基本信息节点
+ * 2、businessOwnerAttr:[{}] 业主属性信息节点
+ * 3、businessOwnerPhoto:[{}] 业主照片信息节点
+ * 4、businessOwnerCerdentials:[{}] 业主证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("deleteOwnerInfoListener")
+@Transactional
+public class DeleteOwnerInfoListener extends AbstractOwnerBusinessServiceDataFlowListener {
+
+    private  static Logger logger = LoggerFactory.getLogger(DeleteOwnerInfoListener.class);
+    @Autowired
+    IOwnerServiceDao ownerServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_INFO;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwner 节点
+        if (data.containsKey("businessOwner")) {
+            //处理 businessOwner 节点
+            if (data.containsKey("businessOwner")) {
+                Object _obj = data.get("businessOwner");
+                JSONArray businessOwners = null;
+                if (_obj instanceof JSONObject) {
+                    businessOwners = new JSONArray();
+                    businessOwners.add(_obj);
+                } else {
+                    businessOwners = (JSONArray) _obj;
+                }
+                //JSONObject businessOwner = data.getJSONObject("businessOwner");
+                for (int _ownerIndex = 0; _ownerIndex < businessOwners.size(); _ownerIndex++) {
+                    JSONObject businessOwner = businessOwners.getJSONObject(_ownerIndex);
+                    doBusinessOwner(business, businessOwner);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("ownerId", businessOwner.getString("ownerId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 instance数据
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+
+        //业主信息
+        Map info = new HashMap();
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_DEL);
+
+        //业主信息
+        List<Map> businessOwnerInfos = ownerServiceDaoImpl.getBusinessOwnerInfo(info);
+        if (businessOwnerInfos != null && businessOwnerInfos.size() > 0) {
+            for (int _ownerIndex = 0; _ownerIndex < businessOwnerInfos.size(); _ownerIndex++) {
+                Map businessOwnerInfo = businessOwnerInfos.get(_ownerIndex);
+                flushBusinessOwnerInfo(businessOwnerInfo, StatusConstant.STATUS_CD_INVALID);
+                ownerServiceDaoImpl.updateOwnerInfoInstance(businessOwnerInfo);
+                dataFlowContext.addParamOut("ownerId", businessOwnerInfo.get("owner_id"));
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     *
+     * @param dataFlowContext 数据对象
+     * @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);
+
+        Map delInfo = new HashMap();
+        delInfo.put("bId", business.getbId());
+        delInfo.put("operate", StatusConstant.OPERATE_DEL);
+        //业主信息
+        List<Map> ownerInfo = ownerServiceDaoImpl.getOwnerInfo(info);
+        if (ownerInfo != null && ownerInfo.size() > 0) {
+
+            //业主信息
+            List<Map> businessOwnerInfos = ownerServiceDaoImpl.getBusinessOwnerInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessOwnerInfos == null || businessOwnerInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(owner),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _ownerIndex = 0; _ownerIndex < businessOwnerInfos.size(); _ownerIndex++) {
+                Map businessOwnerInfo = businessOwnerInfos.get(_ownerIndex);
+                flushBusinessOwnerInfo(businessOwnerInfo, StatusConstant.STATUS_CD_VALID);
+                ownerServiceDaoImpl.updateOwnerInfoInstance(businessOwnerInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessOwner 节点
+     *
+     * @param business      总的数据节点
+     * @param businessOwner 业主节点
+     */
+    private void doBusinessOwner(Business business, JSONObject businessOwner) {
+
+        Assert.jsonObjectHaveKey(businessOwner, "ownerId", "businessOwner 节点下没有包含 ownerId 节点");
+
+        if (businessOwner.getString("ownerId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "ownerId 错误,不能自动生成(必须已经存在的ownerId)" + businessOwner);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessOwner(business, businessOwner);
+    }
+
+    public IOwnerServiceDao getOwnerServiceDaoImpl() {
+        return ownerServiceDaoImpl;
+    }
+
+    public void setOwnerServiceDaoImpl(IOwnerServiceDao ownerServiceDaoImpl) {
+        this.ownerServiceDaoImpl = ownerServiceDaoImpl;
+    }
+}

+ 157 - 0
CommunityService/src/main/java/com/java110/community/listener/owner/SaveOwnerInfoListener.java

@@ -0,0 +1,157 @@
+package com.java110.community.listener.owner;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.util.Assert;
+import com.java110.community.dao.IOwnerServiceDao;
+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 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;
+
+/**
+ * 保存 业主信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("saveOwnerInfoListener")
+@Transactional
+public class SaveOwnerInfoListener extends AbstractOwnerBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveOwnerInfoListener.class);
+
+    @Autowired
+    private IOwnerServiceDao ownerServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_INFO;
+    }
+
+    /**
+     * 保存业主信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwner 节点
+        if (data.containsKey("businessOwner")) {
+            Object bObj = data.get("businessOwner");
+            JSONArray businessOwners = null;
+            if (bObj instanceof JSONObject) {
+                businessOwners = new JSONArray();
+                businessOwners.add(bObj);
+            } else {
+                businessOwners = (JSONArray) bObj;
+            }
+            //JSONObject businessOwner = data.getJSONObject("businessOwner");
+            for (int bOwnerIndex = 0; bOwnerIndex < businessOwners.size(); bOwnerIndex++) {
+                JSONObject businessOwner = businessOwners.getJSONObject(bOwnerIndex);
+                doBusinessOwner(business, businessOwner);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("ownerId", businessOwner.getString("ownerId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     *
+     * @param dataFlowContext 数据对象
+     * @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("operate", StatusConstant.OPERATE_ADD);
+
+        //业主信息
+        List<Map> businessOwnerInfo = ownerServiceDaoImpl.getBusinessOwnerInfo(info);
+        if (businessOwnerInfo != null && businessOwnerInfo.size() > 0) {
+            ownerServiceDaoImpl.saveOwnerInfoInstance(info);
+            if (businessOwnerInfo.size() == 1) {
+                dataFlowContext.addParamOut("ownerId", businessOwnerInfo.get(0).get("owner_id"));
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     *
+     * @param dataFlowContext 数据对象
+     * @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);
+        Map paramIn = new HashMap();
+        paramIn.put("bId", bId);
+        paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID);
+        //业主信息
+        List<Map> ownerInfo = ownerServiceDaoImpl.getOwnerInfo(info);
+        if (ownerInfo != null && ownerInfo.size() > 0) {
+            ownerServiceDaoImpl.updateOwnerInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessOwner 节点
+     *
+     * @param business      总的数据节点
+     * @param businessOwner 业主节点
+     */
+    private void doBusinessOwner(Business business, JSONObject businessOwner) {
+
+        Assert.jsonObjectHaveKey(businessOwner, "ownerId", "businessOwner 节点下没有包含 ownerId 节点");
+
+        if (businessOwner.getString("ownerId").startsWith("-")) {
+            //刷新缓存
+            //flushOwnerId(business.getDatas());
+
+            businessOwner.put("ownerId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId));
+
+        }
+
+        businessOwner.put("bId", business.getbId());
+        businessOwner.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主信息
+        ownerServiceDaoImpl.saveBusinessOwnerInfo(businessOwner);
+
+    }
+
+    public IOwnerServiceDao getOwnerServiceDaoImpl() {
+        return ownerServiceDaoImpl;
+    }
+
+    public void setOwnerServiceDaoImpl(IOwnerServiceDao ownerServiceDaoImpl) {
+        this.ownerServiceDaoImpl = ownerServiceDaoImpl;
+    }
+}

+ 190 - 0
CommunityService/src/main/java/com/java110/community/listener/owner/UpdateOwnerInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.community.listener.owner;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.util.Assert;
+import com.java110.community.dao.IOwnerServiceDao;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+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;
+
+/**
+ * 修改业主信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessOwner:{} 业主基本信息节点
+ * 2、businessOwnerAttr:[{}] 业主属性信息节点
+ * 3、businessOwnerPhoto:[{}] 业主照片信息节点
+ * 4、businessOwnerCerdentials:[{}] 业主证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("updateOwnerInfoListener")
+@Transactional
+public class UpdateOwnerInfoListener extends AbstractOwnerBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateOwnerInfoListener.class);
+    @Autowired
+    private IOwnerServiceDao ownerServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_INFO;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwner 节点
+        if (data.containsKey("businessOwner")) {
+            //处理 businessOwner 节点
+            if (data.containsKey("businessOwner")) {
+                Object _obj = data.get("businessOwner");
+                JSONArray businessOwners = null;
+                if (_obj instanceof JSONObject) {
+                    businessOwners = new JSONArray();
+                    businessOwners.add(_obj);
+                } else {
+                    businessOwners = (JSONArray) _obj;
+                }
+                //JSONObject businessOwner = data.getJSONObject("businessOwner");
+                for (int _ownerIndex = 0; _ownerIndex < businessOwners.size(); _ownerIndex++) {
+                    JSONObject businessOwner = businessOwners.getJSONObject(_ownerIndex);
+                    doBusinessOwner(business, businessOwner);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("ownerId", businessOwner.getString("ownerId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     *
+     * @param dataFlowContext 数据对象
+     * @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("operate", StatusConstant.OPERATE_ADD);
+
+        //业主信息
+        List<Map> businessOwnerInfos = ownerServiceDaoImpl.getBusinessOwnerInfo(info);
+        if (businessOwnerInfos != null && businessOwnerInfos.size() > 0) {
+            for (int _ownerIndex = 0; _ownerIndex < businessOwnerInfos.size(); _ownerIndex++) {
+                Map businessOwnerInfo = businessOwnerInfos.get(_ownerIndex);
+                flushBusinessOwnerInfo(businessOwnerInfo, StatusConstant.STATUS_CD_VALID);
+                ownerServiceDaoImpl.updateOwnerInfoInstance(businessOwnerInfo);
+                if (businessOwnerInfo.size() == 1) {
+                    dataFlowContext.addParamOut("ownerId", businessOwnerInfo.get("owner_id"));
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     *
+     * @param dataFlowContext 数据对象
+     * @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);
+        Map delInfo = new HashMap();
+        delInfo.put("bId", business.getbId());
+        delInfo.put("operate", StatusConstant.OPERATE_DEL);
+        //业主信息
+        List<Map> ownerInfo = ownerServiceDaoImpl.getOwnerInfo(info);
+        if (ownerInfo != null && ownerInfo.size() > 0) {
+
+            //业主信息
+            List<Map> businessOwnerInfos = ownerServiceDaoImpl.getBusinessOwnerInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessOwnerInfos == null || businessOwnerInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(owner),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _ownerIndex = 0; _ownerIndex < businessOwnerInfos.size(); _ownerIndex++) {
+                Map businessOwnerInfo = businessOwnerInfos.get(_ownerIndex);
+                flushBusinessOwnerInfo(businessOwnerInfo, StatusConstant.STATUS_CD_VALID);
+                ownerServiceDaoImpl.updateOwnerInfoInstance(businessOwnerInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessOwner 节点
+     *
+     * @param business      总的数据节点
+     * @param businessOwner 业主节点
+     */
+    private void doBusinessOwner(Business business, JSONObject businessOwner) {
+
+        Assert.jsonObjectHaveKey(businessOwner, "ownerId", "businessOwner 节点下没有包含 ownerId 节点");
+
+        if (businessOwner.getString("ownerId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "ownerId 错误,不能自动生成(必须已经存在的ownerId)" + businessOwner);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessOwner(business, businessOwner);
+
+        businessOwner.put("bId", business.getbId());
+        businessOwner.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主信息
+        ownerServiceDaoImpl.saveBusinessOwnerInfo(businessOwner);
+
+    }
+
+
+    public IOwnerServiceDao getOwnerServiceDaoImpl() {
+        return ownerServiceDaoImpl;
+    }
+
+    public void setOwnerServiceDaoImpl(IOwnerServiceDao ownerServiceDaoImpl) {
+        this.ownerServiceDaoImpl = ownerServiceDaoImpl;
+    }
+
+
+}

+ 113 - 0
CommunityService/src/main/java/com/java110/community/smo/impl/OwnerInnerServiceSMOImpl.java

@@ -0,0 +1,113 @@
+package com.java110.community.smo.impl;
+
+
+import com.java110.common.util.BeanConvertUtil;
+import com.java110.community.dao.IOwnerServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.owner.IOwnerInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.OwnerDto;
+import com.java110.dto.PageDto;
+import com.java110.dto.UserDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 业主内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class OwnerInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerInnerServiceSMO {
+
+    @Autowired
+    private IOwnerServiceDao ownerServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<OwnerDto> queryOwners(@RequestBody OwnerDto ownerDto) {
+
+        //校验是否传了 分页信息
+
+        int page = ownerDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerDto.setPage((page - 1) * ownerDto.getRow());
+            ownerDto.setRow(page * ownerDto.getRow());
+        }
+
+        List<OwnerDto> owners = BeanConvertUtil.covertBeanList(ownerServiceDaoImpl.getOwnerInfo(BeanConvertUtil.beanCovertMap(ownerDto)), OwnerDto.class);
+
+        if (owners == null || owners.size() == 0) {
+            return owners;
+        }
+
+        String[] userIds = getUserIds(owners);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (OwnerDto owner : owners) {
+            refreshOwner(owner, users);
+        }
+        return owners;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param owner 小区业主信息
+     * @param users 用户列表
+     */
+    private void refreshOwner(OwnerDto owner, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (owner.getUserId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, owner);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param owners 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<OwnerDto> owners) {
+        List<String> userIds = new ArrayList<String>();
+        for (OwnerDto owner : owners) {
+            userIds.add(owner.getUserId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryOwnersCount(@RequestBody OwnerDto ownerDto) {
+        return ownerServiceDaoImpl.queryOwnersCount(BeanConvertUtil.beanCovertMap(ownerDto));
+    }
+
+    public IOwnerServiceDao getOwnerServiceDaoImpl() {
+        return ownerServiceDaoImpl;
+    }
+
+    public void setOwnerServiceDaoImpl(IOwnerServiceDao ownerServiceDaoImpl) {
+        this.ownerServiceDaoImpl = ownerServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 3 - 0
docs/_sidebar.md

@@ -56,6 +56,9 @@
   * [保存房屋](services/room/SaveRoomInfo.md)
   * [修改房屋](services/room/UpdateRoomInfo.md)
   * [删除房屋](services/room/DeleteRoomInfo.md)
+  * [保存业主](services/owner/SaveOwnerInfo.md)
+  * [修改业主](services/owner/UpdateOwnerInfo.md)
+  * [删除业主](services/owner/DeleteOwnerInfo.md)
 
 * 工具类接口
 

+ 114 - 0
docs/services/owner/DeleteOwnerInfo.md

@@ -0,0 +1,114 @@
+
+
+**1\. 删除业主**
+###### 接口功能
+> API服务做删除业主时调用该接口
+
+###### URL
+> [http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerInfo|ownerId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "540100050001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerInfo": {
+                "ownerId":"填写存在的值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 125 - 0
docs/services/owner/SaveOwnerInfo.md

@@ -0,0 +1,125 @@
+
+
+**1\. 保存业主**
+###### 接口功能
+> API服务做保存业主时调用该接口
+
+###### URL
+> [http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerInfo|sex|1|String|30|-|-|
+|businessOwnerInfo|name|1|String|30|-|-|
+|businessOwnerInfo|link|1|String|30|-|-|
+|businessOwnerInfo|remark|1|String|30|-|-|
+|businessOwnerInfo|ownerId|1|String|30|-|-|
+|businessOwnerInfo|userId|1|String|30|-|-|
+|businessOwnerInfo|age|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "540100030001",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerInfo": {
+                "sex":"填写具体值",
+        "name":"填写具体值",
+        "link":"填写具体值",
+        "remark":"填写具体值",
+        "ownerId":"-1",
+        "userId":"填写具体值",
+        "age":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 126 - 0
docs/services/owner/UpdateOwnerInfo.md

@@ -0,0 +1,126 @@
+
+
+**1\. 修改业主**
+###### 接口功能
+> API服务做修改业主时调用该接口
+
+###### URL
+> [http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerInfo|sex|1|String|30|-|-|
+|businessOwnerInfo|name|1|String|30|-|-|
+|businessOwnerInfo|link|1|String|30|-|-|
+|businessOwnerInfo|remark|1|String|30|-|-|
+|businessOwnerInfo|ownerId|1|String|30|-|-|
+|businessOwnerInfo|userId|1|String|30|-|-|
+|businessOwnerInfo|age|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/ownerApi/service](http://community-service/ownerApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "540100040001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerInfo": {
+                "sex":"填写具体值",
+        "name":"填写具体值",
+        "link":"填写具体值",
+        "remark":"填写具体值",
+        "ownerId":"填写具体值",
+        "userId":"填写具体值",
+        "age":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 89 - 0
java110-bean/src/main/java/com/java110/dto/OwnerDto.java

@@ -0,0 +1,89 @@
+package com.java110.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 业主数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class OwnerDto extends PageDto implements Serializable {
+
+    private String sex;
+private String name;
+private String link;
+private String remark;
+private String ownerId;
+private String userId;
+private String age;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getSex() {
+        return sex;
+    }
+public void setSex(String sex) {
+        this.sex = sex;
+    }
+public String getName() {
+        return name;
+    }
+public void setName(String name) {
+        this.name = name;
+    }
+public String getLink() {
+        return link;
+    }
+public void setLink(String link) {
+        this.link = link;
+    }
+public String getRemark() {
+        return remark;
+    }
+public void setRemark(String remark) {
+        this.remark = remark;
+    }
+public String getOwnerId() {
+        return ownerId;
+    }
+public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+public String getUserId() {
+        return userId;
+    }
+public void setUserId(String userId) {
+        this.userId = userId;
+    }
+public String getAge() {
+        return age;
+    }
+public void setAge(String age) {
+        this.age = age;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 79 - 0
java110-code-generator/src/main/java/com/java110/OwnerGeneratorApplication.java

@@ -0,0 +1,79 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ *
+ */
+public class OwnerGeneratorApplication {
+
+    protected OwnerGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+    /**
+     *  代码生成器 入口方法
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("ownerId");
+        data.setName("owner");
+        data.setDesc("业主");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_OWNER_INFO");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_OWNER_INFO");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_OWNER_INFO");
+        data.setNewBusinessTypeCdValue("540100030001");
+        data.setUpdateBusinessTypeCdValue("540100040001");
+        data.setDeleteBusinessTypeCdValue("540100050001");
+        data.setBusinessTableName("business_building_owner");
+        data.setTableName("building_owner");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("ownerId", "owner_id");
+        param.put("bId", "b_id");
+        param.put("name", "name");
+        param.put("sex", "sex");
+        param.put("age", "age");
+        param.put("link", "link");
+        param.put("userId", "user_id");
+        param.put("statusCd", "status_cd");
+        param.put("remark", "remark");
+        param.put("operate", "operate");
+        data.setParams(param);
+        GeneratorSaveInfoListener generatorSaveInfoListener = new GeneratorSaveInfoListener();
+        generatorSaveInfoListener.generator(data);
+
+        GeneratorAbstractBussiness generatorAbstractBussiness = new GeneratorAbstractBussiness();
+        generatorAbstractBussiness.generator(data);
+
+        GeneratorIServiceDaoListener generatorIServiceDaoListener = new GeneratorIServiceDaoListener();
+        generatorIServiceDaoListener.generator(data);
+
+        GeneratorServiceDaoImplListener generatorServiceDaoImplListener = new GeneratorServiceDaoImplListener();
+        generatorServiceDaoImplListener.generator(data);
+
+        GeneratorServiceDaoImplMapperListener generatorServiceDaoImplMapperListener = null;
+        generatorServiceDaoImplMapperListener = new GeneratorServiceDaoImplMapperListener();
+        generatorServiceDaoImplMapperListener.generator(data);
+
+        GeneratorUpdateInfoListener generatorUpdateInfoListener = new GeneratorUpdateInfoListener();
+        generatorUpdateInfoListener.generator(data);
+
+        GeneratorDeleteInfoListener generatorDeleteInfoListener = new GeneratorDeleteInfoListener();
+        generatorDeleteInfoListener.generator(data);
+
+        GeneratorInnerServiceSMOImpl generatorInnerServiceSMOImpl = new GeneratorInnerServiceSMOImpl();
+        generatorInnerServiceSMOImpl.generator(data);
+
+        GeneratorDtoBean generatorDtoBean = new GeneratorDtoBean();
+        generatorDtoBean.generator(data);
+
+        GeneratorIInnerServiceSMO generatorIInnerServiceSMO = new GeneratorIInnerServiceSMO();
+        generatorIInnerServiceSMO.generator(data);
+    }
+}

+ 19 - 0
java110-common/src/main/java/com/java110/common/constant/BusinessTypeConstant.java

@@ -224,6 +224,25 @@ public class BusinessTypeConstant {
     public static final String BUSINESS_TYPE_DELETE_ROOM_INFO = "530100050001";
 
 
+    /**
+     * 增加业主
+     */
+    public static final String BUSINESS_TYPE_SAVE_OWNER_INFO = "540100030001";
+
+    /**
+     * 修改业主
+     */
+    public static final String BUSINESS_TYPE_UPDATE_OWNER_INFO = "540100040001";
+
+
+    /**
+     * 删除业主
+     */
+    public static final String BUSINESS_TYPE_DELETE_OWNER_INFO = "540100050001";
+
+
+
+
     /**
      * 保存物业信息
      */

+ 35 - 0
java110-config/db/CommunityService/create_owner.sql

@@ -0,0 +1,35 @@
+
+-- 单元信息 building 楼宇管理
+CREATE TABLE business_building_owner(
+  owner_id VARCHAR(30) NOT NULL COMMENT '业主ID',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  name VARCHAR(12) NOT NULL COMMENT '业主名称',
+  sex int NOT NULL COMMENT '性别',
+  age int NOT NULL COMMENT '年龄',
+  link varchar(11) NOT NULL COMMENT '联系人手机号',
+  user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
+  remark VARCHAR(200) NOT NULL COMMENT '备注',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  operate VARCHAR(4) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+
+
+CREATE INDEX idx_business_owner_id ON business_building_owner(owner_id);
+CREATE INDEX idx_business_owner_b_id ON business_building_owner(b_id);
+
+
+CREATE TABLE building_owner(
+  owner_id VARCHAR(30) NOT NULL COMMENT '业主ID',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  name VARCHAR(12) NOT NULL COMMENT '业主名称',
+  sex int NOT NULL COMMENT '性别',
+  age int NOT NULL COMMENT '年龄',
+  link varchar(11) NOT NULL COMMENT '联系人手机号',
+  user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
+  remark VARCHAR(200) NOT NULL COMMENT '备注',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0, 在用 1失效',
+  UNIQUE KEY (owner_id)
+);
+CREATE INDEX idx_owner_b_id ON building_owner(b_id);
+CREATE UNIQUE INDEX idx_owner_id ON building_owner(room_id);

+ 201 - 0
java110-config/src/main/resources/mapper/owner/OwnerServiceDaoImplMapper.xml

@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="ownerServiceDaoImpl">
+
+    <!-- 保存业主信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessOwnerInfo" parameterType="Map">
+           insert into business_building_owner(
+operate,sex,name,link,remark,owner_id,b_id,user_id,age
+) values (
+#{operate},#{sex},#{name},#{link},#{remark},#{ownerId},#{bId},#{userId},#{age}
+)
+       </insert>
+
+
+       <!-- 查询业主信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessOwnerInfo" parameterType="Map" resultType="Map">
+           select  t.operate,t.sex,t.name,t.link,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.age 
+from business_building_owner t 
+where 1 =1 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="link !=null and link != ''">
+   and t.link= #{link}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存业主信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveOwnerInfoInstance" parameterType="Map">
+        insert into building_owner(
+sex,name,link,status_cd,remark,owner_id,b_id,user_id,age
+) select t.sex,t.name,t.link,'0',t.remark,t.owner_id,t.b_id,t.user_id,t.age from business_building_owner t where 1=1
+   and t.operate= 'ADD'
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="link !=null and link != ''">
+   and t.link= #{link}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询业主信息 add by wuxw 2018-07-03 -->
+    <select id="getOwnerInfo" parameterType="Map" resultType="Map">
+        select  t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.age 
+from building_owner t 
+where 1 =1 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="link !=null and link != ''">
+   and t.link= #{link}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改业主信息 add by wuxw 2018-07-03 -->
+    <update id="updateOwnerInfoInstance" parameterType="Map">
+        update  building_owner t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="sex !=null and sex != ''">
+, t.sex= #{sex}
+</if> 
+<if test="name !=null and name != ''">
+, t.name= #{name}
+</if> 
+<if test="link !=null and link != ''">
+, t.link= #{link}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+<if test="age !=null and age != ''">
+, t.age= #{age}
+</if> 
+ where 1=1 <if test="ownerId !=null and ownerId != ''">
+and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询业主数量 add by wuxw 2018-07-03 -->
+     <select id="queryOwnersCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from building_owner t 
+where 1 =1 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="link !=null and link != ''">
+   and t.link= #{link}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 1 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -78,6 +78,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_unitId = "74";
     public static final String CODE_PREFIX_roomId = "75";
     public static final String CODE_PREFIX_roomAttrId = "76";
+    public static final String CODE_PREFIX_ownerId = "77";
 
     /**
      * 只有在不调用服务生成ID时有用

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/owner/IOwnerInnerServiceSMO.java

@@ -0,0 +1,42 @@
+package com.java110.core.smo.owner;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.OwnerDto;
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * @ClassName IOwnerInnerServiceSMO
+ * @Description 业主接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "community-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/ownerApi")
+public interface IOwnerInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param ownerDto 数据对象分享
+     * @return OwnerDto 对象数据
+     */
+    @RequestMapping(value = "/queryOwners", method = RequestMethod.POST)
+    List<OwnerDto> queryOwners(@RequestBody OwnerDto ownerDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param ownerDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryOwnersCount", method = RequestMethod.POST)
+    int queryOwnersCount(@RequestBody OwnerDto ownerDto);
+}