Преглед на файлове

加入房屋服务端代码

吴学文 преди 7 години
родител
ревизия
534a77dcb9
променени са 23 файла, в които са добавени 2149 реда и са изтрити 0 реда
  1. 75 0
      CommunityService/src/main/java/com/java110/community/dao/IRoomServiceDao.java
  2. 134 0
      CommunityService/src/main/java/com/java110/community/dao/impl/RoomServiceDaoImpl.java
  3. 93 0
      CommunityService/src/main/java/com/java110/community/listener/room/AbstractRoomBusinessServiceDataFlowListener.java
  4. 180 0
      CommunityService/src/main/java/com/java110/community/listener/room/DeleteRoomInfoListener.java
  5. 157 0
      CommunityService/src/main/java/com/java110/community/listener/room/SaveRoomInfoListener.java
  6. 190 0
      CommunityService/src/main/java/com/java110/community/listener/room/UpdateRoomInfoListener.java
  7. 113 0
      CommunityService/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java
  8. 3 0
      docs/_sidebar.md
  9. 114 0
      docs/services/room/DeleteRoomInfo.md
  10. 132 0
      docs/services/room/SaveRoomInfo.md
  11. 132 0
      docs/services/room/UpdateRoomInfo.md
  12. 129 0
      java110-bean/src/main/java/com/java110/dto/RoomDto.java
  13. 82 0
      java110-code-generator/src/main/java/com/java110/RoomGeneratorApplication.java
  14. 67 0
      java110-code-generator/src/main/java/com/java110/code/GeneratorDtoBean.java
  15. 24 0
      java110-code-generator/src/main/java/com/java110/code/GeneratorIInnerServiceSMO.java
  16. 24 0
      java110-code-generator/src/main/java/com/java110/code/GeneratorInnerServiceSMOImpl.java
  17. 42 0
      java110-code-generator/src/main/resources/template/IInnerServiceSMO.txt
  18. 112 0
      java110-code-generator/src/main/resources/template/InnerServiceSMOImpl.txt
  19. 40 0
      java110-code-generator/src/main/resources/template/dto.txt
  20. 17 0
      java110-common/src/main/java/com/java110/common/constant/BusinessTypeConstant.java
  21. 246 0
      java110-config/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml
  22. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  23. 42 0
      java110-core/src/main/java/com/java110/core/smo/room/IRoomInnerServiceSMO.java

+ 75 - 0
CommunityService/src/main/java/com/java110/community/dao/IRoomServiceDao.java

@@ -0,0 +1,75 @@
+package com.java110.community.dao;
+
+
+import com.java110.common.exception.DAOException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 小区房屋组件内部之间使用,没有给外围系统提供服务能力
+ * 小区房屋服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ * <p>
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IRoomServiceDao {
+
+    /**
+     * 保存 小区房屋信息
+     *
+     * @param businessRoomInfo 小区房屋信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessRoomInfo(Map businessRoomInfo) throws DAOException;
+
+
+    /**
+     * 查询小区房屋信息(business过程)
+     * 根据bId 查询小区房屋信息
+     *
+     * @param info bId 信息
+     * @return 小区房屋信息
+     * @throws DAOException
+     */
+    List<Map> getBusinessRoomInfo(Map info) throws DAOException;
+
+
+    /**
+     * 保存 小区房屋信息 Business数据到 Instance中
+     *
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    void saveRoomInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询小区房屋信息(instance过程)
+     * 根据bId 查询小区房屋信息
+     *
+     * @param info bId 信息
+     * @return 小区房屋信息
+     * @throws DAOException
+     */
+    List<Map> getRoomInfo(Map info) throws DAOException;
+
+
+    /**
+     * 修改小区房屋信息
+     *
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    void updateRoomInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询小区房屋总数
+     *
+     * @param info 小区房屋信息
+     * @return 小区房屋数量
+     */
+    int queryRoomsCount(Map info);
+
+}

+ 134 - 0
CommunityService/src/main/java/com/java110/community/dao/impl/RoomServiceDaoImpl.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.IRoomServiceDao;
+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("roomServiceDaoImpl")
+//@Transactional
+public class RoomServiceDaoImpl extends BaseServiceDao implements IRoomServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(RoomServiceDaoImpl.class);
+
+    /**
+     * 小区房屋信息封装
+     *
+     * @param businessRoomInfo 小区房屋信息 封装
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessRoomInfo(Map businessRoomInfo) throws DAOException {
+        businessRoomInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存小区房屋信息 入参 businessRoomInfo : {}", businessRoomInfo);
+        int saveFlag = sqlSessionTemplate.insert("roomServiceDaoImpl.saveBusinessRoomInfo", businessRoomInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存小区房屋数据失败:" + JSONObject.toJSONString(businessRoomInfo));
+        }
+    }
+
+
+    /**
+     * 查询小区房屋信息
+     *
+     * @param info bId 信息
+     * @return 小区房屋信息
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getBusinessRoomInfo(Map info) throws DAOException {
+
+        logger.debug("查询小区房屋信息 入参 info : {}", info);
+
+        List<Map> businessRoomInfos = sqlSessionTemplate.selectList("roomServiceDaoImpl.getBusinessRoomInfo", info);
+
+        return businessRoomInfos;
+    }
+
+
+    /**
+     * 保存小区房屋信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException
+     */
+    @Override
+    public void saveRoomInfoInstance(Map info) throws DAOException {
+        logger.debug("保存小区房屋信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("roomServiceDaoImpl.saveRoomInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存小区房屋信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询小区房屋信息(instance)
+     *
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getRoomInfo(Map info) throws DAOException {
+        logger.debug("查询小区房屋信息 入参 info : {}", info);
+
+        List<Map> businessRoomInfos = sqlSessionTemplate.selectList("roomServiceDaoImpl.getRoomInfo", info);
+
+        return businessRoomInfos;
+    }
+
+
+    /**
+     * 修改小区房屋信息
+     *
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateRoomInfoInstance(Map info) throws DAOException {
+        logger.debug("修改小区房屋信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("roomServiceDaoImpl.updateRoomInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改小区房屋信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询小区房屋数量
+     *
+     * @param info 小区房屋信息
+     * @return 小区房屋数量
+     */
+    @Override
+    public int queryRoomsCount(Map info) {
+        logger.debug("查询小区房屋数据 入参 info : {}", info);
+
+        List<Map> businessRoomInfos = sqlSessionTemplate.selectList("roomServiceDaoImpl.queryRoomsCount", info);
+        if (businessRoomInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessRoomInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 93 - 0
CommunityService/src/main/java/com/java110/community/listener/room/AbstractRoomBusinessServiceDataFlowListener.java

@@ -0,0 +1,93 @@
+package com.java110.community.listener.room;
+
+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.IRoomServiceDao;
+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 AbstractRoomBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private  static Logger logger = LoggerFactory.getLogger(AbstractRoomBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IRoomServiceDao getRoomServiceDaoImpl();
+
+    /**
+     * 刷新 businessRoomInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessRoomInfo
+     */
+    protected void flushBusinessRoomInfo(Map businessRoomInfo, String statusCd) {
+        businessRoomInfo.put("newBId", businessRoomInfo.get("b_id"));
+        businessRoomInfo.put("unitPrice", businessRoomInfo.get("unit_price"));
+        businessRoomInfo.put("section", businessRoomInfo.get("section"));
+        businessRoomInfo.put("remark", businessRoomInfo.get("remark"));
+        businessRoomInfo.put("userId", businessRoomInfo.get("user_id"));
+        businessRoomInfo.put("roomId", businessRoomInfo.get("room_id"));
+        businessRoomInfo.put("layer", businessRoomInfo.get("layer"));
+        businessRoomInfo.put("builtUpArea", businessRoomInfo.get("built_up_area"));
+        businessRoomInfo.put("operate", businessRoomInfo.get("operate"));
+        businessRoomInfo.put("roomNum", businessRoomInfo.get("room_num"));
+        businessRoomInfo.put("unitId", businessRoomInfo.get("unit_id"));
+        businessRoomInfo.put("apartment", businessRoomInfo.get("apartment"));
+        businessRoomInfo.remove("bId");
+        businessRoomInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessRoom 小区房屋信息
+     */
+    protected void autoSaveDelBusinessRoom(Business business, JSONObject businessRoom) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("roomId", businessRoom.getString("roomId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentRoomInfos = getRoomServiceDaoImpl().getRoomInfo(info);
+        if (currentRoomInfos == null || currentRoomInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentRoomInfo = currentRoomInfos.get(0);
+
+        currentRoomInfo.put("bId", business.getbId());
+
+        currentRoomInfo.put("unitPrice", currentRoomInfo.get("unit_price"));
+        currentRoomInfo.put("section", currentRoomInfo.get("section"));
+        currentRoomInfo.put("remark", currentRoomInfo.get("remark"));
+        currentRoomInfo.put("userId", currentRoomInfo.get("user_id"));
+        currentRoomInfo.put("roomId", currentRoomInfo.get("room_id"));
+        currentRoomInfo.put("layer", currentRoomInfo.get("layer"));
+        currentRoomInfo.put("builtUpArea", currentRoomInfo.get("built_up_area"));
+        currentRoomInfo.put("operate", currentRoomInfo.get("operate"));
+        currentRoomInfo.put("roomNum", currentRoomInfo.get("room_num"));
+        currentRoomInfo.put("unitId", currentRoomInfo.get("unit_id"));
+        currentRoomInfo.put("apartment", currentRoomInfo.get("apartment"));
+
+
+        currentRoomInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getRoomServiceDaoImpl().saveBusinessRoomInfo(currentRoomInfo);
+    }
+
+
+}

+ 180 - 0
CommunityService/src/main/java/com/java110/community/listener/room/DeleteRoomInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.community.listener.room;
+
+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.IRoomServiceDao;
+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、businessRoom:{} 小区房屋基本信息节点
+ * 2、businessRoomAttr:[{}] 小区房屋属性信息节点
+ * 3、businessRoomPhoto:[{}] 小区房屋照片信息节点
+ * 4、businessRoomCerdentials:[{}] 小区房屋证件信息节点
+ * 协议地址 :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("deleteRoomInfoListener")
+@Transactional
+public class DeleteRoomInfoListener extends AbstractRoomBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteRoomInfoListener.class);
+    @Autowired
+    IRoomServiceDao roomServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_ROOM_INFO;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessRoom 节点
+        if (data.containsKey("businessRoom")) {
+            //处理 businessRoom 节点
+            if (data.containsKey("businessRoom")) {
+                Object _obj = data.get("businessRoom");
+                JSONArray businessRooms = null;
+                if (_obj instanceof JSONObject) {
+                    businessRooms = new JSONArray();
+                    businessRooms.add(_obj);
+                } else {
+                    businessRooms = (JSONArray) _obj;
+                }
+                //JSONObject businessRoom = data.getJSONObject("businessRoom");
+                for (int _roomIndex = 0; _roomIndex < businessRooms.size(); _roomIndex++) {
+                    JSONObject businessRoom = businessRooms.getJSONObject(_roomIndex);
+                    doBusinessRoom(business, businessRoom);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("roomId", businessRoom.getString("roomId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessRoomInfos = roomServiceDaoImpl.getBusinessRoomInfo(info);
+        if (businessRoomInfos != null && businessRoomInfos.size() > 0) {
+            for (int _roomIndex = 0; _roomIndex < businessRoomInfos.size(); _roomIndex++) {
+                Map businessRoomInfo = businessRoomInfos.get(_roomIndex);
+                flushBusinessRoomInfo(businessRoomInfo, StatusConstant.STATUS_CD_INVALID);
+                roomServiceDaoImpl.updateRoomInfoInstance(businessRoomInfo);
+                dataFlowContext.addParamOut("roomId", businessRoomInfo.get("room_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> roomInfo = roomServiceDaoImpl.getRoomInfo(info);
+        if (roomInfo != null && roomInfo.size() > 0) {
+
+            //小区房屋信息
+            List<Map> businessRoomInfos = roomServiceDaoImpl.getBusinessRoomInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessRoomInfos == null || businessRoomInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(room),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _roomIndex = 0; _roomIndex < businessRoomInfos.size(); _roomIndex++) {
+                Map businessRoomInfo = businessRoomInfos.get(_roomIndex);
+                flushBusinessRoomInfo(businessRoomInfo, StatusConstant.STATUS_CD_VALID);
+                roomServiceDaoImpl.updateRoomInfoInstance(businessRoomInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessRoom 节点
+     *
+     * @param business     总的数据节点
+     * @param businessRoom 小区房屋节点
+     */
+    private void doBusinessRoom(Business business, JSONObject businessRoom) {
+
+        Assert.jsonObjectHaveKey(businessRoom, "roomId", "businessRoom 节点下没有包含 roomId 节点");
+
+        if (businessRoom.getString("roomId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "roomId 错误,不能自动生成(必须已经存在的roomId)" + businessRoom);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessRoom(business, businessRoom);
+    }
+
+    public IRoomServiceDao getRoomServiceDaoImpl() {
+        return roomServiceDaoImpl;
+    }
+
+    public void setRoomServiceDaoImpl(IRoomServiceDao roomServiceDaoImpl) {
+        this.roomServiceDaoImpl = roomServiceDaoImpl;
+    }
+}

+ 157 - 0
CommunityService/src/main/java/com/java110/community/listener/room/SaveRoomInfoListener.java

@@ -0,0 +1,157 @@
+package com.java110.community.listener.room;
+
+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.IRoomServiceDao;
+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("saveRoomInfoListener")
+@Transactional
+public class SaveRoomInfoListener extends AbstractRoomBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveRoomInfoListener.class);
+
+    @Autowired
+    IRoomServiceDao roomServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_ROOM_INFO;
+    }
+
+    /**
+     * 保存小区房屋信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessRoom 节点
+        if (data.containsKey("businessRoom")) {
+            Object _obj = data.get("businessRoom");
+            JSONArray businessRooms = null;
+            if (_obj instanceof JSONObject) {
+                businessRooms = new JSONArray();
+                businessRooms.add(_obj);
+            } else {
+                businessRooms = (JSONArray) _obj;
+            }
+            //JSONObject businessRoom = data.getJSONObject("businessRoom");
+            for (int _roomIndex = 0; _roomIndex < businessRooms.size(); _roomIndex++) {
+                JSONObject businessRoom = businessRooms.getJSONObject(_roomIndex);
+                doBusinessRoom(business, businessRoom);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("roomId", businessRoom.getString("roomId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessRoomInfo = roomServiceDaoImpl.getBusinessRoomInfo(info);
+        if (businessRoomInfo != null && businessRoomInfo.size() > 0) {
+            roomServiceDaoImpl.saveRoomInfoInstance(info);
+            if (businessRoomInfo.size() == 1) {
+                dataFlowContext.addParamOut("roomId", businessRoomInfo.get(0).get("room_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> roomInfo = roomServiceDaoImpl.getRoomInfo(info);
+        if (roomInfo != null && roomInfo.size() > 0) {
+            roomServiceDaoImpl.updateRoomInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessRoom 节点
+     *
+     * @param business     总的数据节点
+     * @param businessRoom 小区房屋节点
+     */
+    private void doBusinessRoom(Business business, JSONObject businessRoom) {
+
+        Assert.jsonObjectHaveKey(businessRoom, "roomId", "businessRoom 节点下没有包含 roomId 节点");
+
+        if (businessRoom.getString("roomId").startsWith("-")) {
+            //刷新缓存
+            //flushRoomId(business.getDatas());
+
+            businessRoom.put("roomId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_roomId));
+
+        }
+
+        businessRoom.put("bId", business.getbId());
+        businessRoom.put("operate", StatusConstant.OPERATE_ADD);
+        //保存小区房屋信息
+        roomServiceDaoImpl.saveBusinessRoomInfo(businessRoom);
+
+    }
+
+    public IRoomServiceDao getRoomServiceDaoImpl() {
+        return roomServiceDaoImpl;
+    }
+
+    public void setRoomServiceDaoImpl(IRoomServiceDao roomServiceDaoImpl) {
+        this.roomServiceDaoImpl = roomServiceDaoImpl;
+    }
+}

+ 190 - 0
CommunityService/src/main/java/com/java110/community/listener/room/UpdateRoomInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.community.listener.room;
+
+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.IRoomServiceDao;
+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、businessRoom:{} 小区房屋基本信息节点
+ * 2、businessRoomAttr:[{}] 小区房屋属性信息节点
+ * 3、businessRoomPhoto:[{}] 小区房屋照片信息节点
+ * 4、businessRoomCerdentials:[{}] 小区房屋证件信息节点
+ * 协议地址 :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("updateRoomInfoListener")
+@Transactional
+public class UpdateRoomInfoListener extends AbstractRoomBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(UpdateRoomInfoListener.class);
+    @Autowired
+    IRoomServiceDao roomServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ROOM_INFO;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext
+     * @param business
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessRoom 节点
+        if (data.containsKey("businessRoom")) {
+            //处理 businessRoom 节点
+            if (data.containsKey("businessRoom")) {
+                Object _obj = data.get("businessRoom");
+                JSONArray businessRooms = null;
+                if (_obj instanceof JSONObject) {
+                    businessRooms = new JSONArray();
+                    businessRooms.add(_obj);
+                } else {
+                    businessRooms = (JSONArray) _obj;
+                }
+                //JSONObject businessRoom = data.getJSONObject("businessRoom");
+                for (int _roomIndex = 0; _roomIndex < businessRooms.size(); _roomIndex++) {
+                    JSONObject businessRoom = businessRooms.getJSONObject(_roomIndex);
+                    doBusinessRoom(business, businessRoom);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("roomId", businessRoom.getString("roomId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessRoomInfos = roomServiceDaoImpl.getBusinessRoomInfo(info);
+        if (businessRoomInfos != null && businessRoomInfos.size() > 0) {
+            for (int _roomIndex = 0; _roomIndex < businessRoomInfos.size(); _roomIndex++) {
+                Map businessRoomInfo = businessRoomInfos.get(_roomIndex);
+                flushBusinessRoomInfo(businessRoomInfo, StatusConstant.STATUS_CD_VALID);
+                roomServiceDaoImpl.updateRoomInfoInstance(businessRoomInfo);
+                if (businessRoomInfo.size() == 1) {
+                    dataFlowContext.addParamOut("roomId", businessRoomInfo.get("room_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> roomInfo = roomServiceDaoImpl.getRoomInfo(info);
+        if (roomInfo != null && roomInfo.size() > 0) {
+
+            //小区房屋信息
+            List<Map> businessRoomInfos = roomServiceDaoImpl.getBusinessRoomInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessRoomInfos == null || businessRoomInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(room),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _roomIndex = 0; _roomIndex < businessRoomInfos.size(); _roomIndex++) {
+                Map businessRoomInfo = businessRoomInfos.get(_roomIndex);
+                flushBusinessRoomInfo(businessRoomInfo, StatusConstant.STATUS_CD_VALID);
+                roomServiceDaoImpl.updateRoomInfoInstance(businessRoomInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessRoom 节点
+     *
+     * @param business     总的数据节点
+     * @param businessRoom 小区房屋节点
+     */
+    private void doBusinessRoom(Business business, JSONObject businessRoom) {
+
+        Assert.jsonObjectHaveKey(businessRoom, "roomId", "businessRoom 节点下没有包含 roomId 节点");
+
+        if (businessRoom.getString("roomId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "roomId 错误,不能自动生成(必须已经存在的roomId)" + businessRoom);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessRoom(business, businessRoom);
+
+        businessRoom.put("bId", business.getbId());
+        businessRoom.put("operate", StatusConstant.OPERATE_ADD);
+        //保存小区房屋信息
+        roomServiceDaoImpl.saveBusinessRoomInfo(businessRoom);
+
+    }
+
+
+    public IRoomServiceDao getRoomServiceDaoImpl() {
+        return roomServiceDaoImpl;
+    }
+
+    public void setRoomServiceDaoImpl(IRoomServiceDao roomServiceDaoImpl) {
+        this.roomServiceDaoImpl = roomServiceDaoImpl;
+    }
+
+
+}

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

@@ -0,0 +1,113 @@
+package com.java110.community.smo.impl;
+
+
+import com.java110.common.util.BeanConvertUtil;
+import com.java110.community.dao.IRoomServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.room.IRoomInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.RoomDto;
+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 RoomInnerServiceSMOImpl extends BaseServiceSMO implements IRoomInnerServiceSMO {
+
+    @Autowired
+    private IRoomServiceDao roomServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<RoomDto> queryRooms(@RequestBody RoomDto roomDto) {
+
+        //校验是否传了 分页信息
+
+        int page = roomDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            roomDto.setPage((page - 1) * roomDto.getRow());
+            roomDto.setRow(page * roomDto.getRow());
+        }
+
+        List<RoomDto> rooms = BeanConvertUtil.covertBeanList(roomServiceDaoImpl.getRoomInfo(BeanConvertUtil.beanCovertMap(roomDto)), RoomDto.class);
+
+        if (rooms == null || rooms.size() == 0) {
+            return rooms;
+        }
+
+        String[] userIds = getUserIds(rooms);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (RoomDto room : rooms) {
+            refreshRoom(room, users);
+        }
+        return rooms;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param room  小区小区房屋信息
+     * @param users 用户列表
+     */
+    private void refreshRoom(RoomDto room, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (room.getUserId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, room);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param rooms 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<RoomDto> rooms) {
+        List<String> userIds = new ArrayList<String>();
+        for (RoomDto room : rooms) {
+            userIds.add(room.getUserId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryRoomsCount(@RequestBody RoomDto roomDto) {
+        return roomServiceDaoImpl.queryRoomsCount(BeanConvertUtil.beanCovertMap(roomDto));
+    }
+
+    public IRoomServiceDao getRoomServiceDaoImpl() {
+        return roomServiceDaoImpl;
+    }
+
+    public void setRoomServiceDaoImpl(IRoomServiceDao roomServiceDaoImpl) {
+        this.roomServiceDaoImpl = roomServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 3 - 0
docs/_sidebar.md

@@ -50,6 +50,9 @@
   * [保存小区单元](services/unit/SaveUnitInfo.md)
   * [修改小区单元](services/unit/UpdateUnitInfo.md)
   * [删除小区单元](services/unit/DeleteUnitInfo.md)
+  * [保存房屋](services/room/SaveRoomInfo.md)
+  * [修改房屋](services/room/UpdateRoomInfo.md)
+  * [删除房屋](services/room/DeleteRoomInfo.md)
 
 * 工具类接口
 

+ 114 - 0
docs/services/room/DeleteRoomInfo.md

@@ -0,0 +1,114 @@
+
+
+**1\. 删除小区房屋**
+###### 接口功能
+> API服务做删除小区房屋时调用该接口
+
+###### URL
+> [http://community-service/roomApi/service](http://community-service/roomApi/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|businessRoomInfo|1|Object|-|小区成员|小区成员|
+|businessRoomInfo|roomId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/roomApi/service](http://community-service/roomApi/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": "530100050001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessRoomInfo": {
+                "roomId":"填写存在的值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 132 - 0
docs/services/room/SaveRoomInfo.md

@@ -0,0 +1,132 @@
+
+
+**1\. 保存小区房屋**
+###### 接口功能
+> API服务做保存小区房屋时调用该接口
+
+###### URL
+> [http://community-service/roomApi/service](http://community-service/roomApi/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|businessRoomInfo|1|Object|-|小区成员|小区成员|
+|businessRoomInfo|unitPrice|1|String|30|-|-|
+|businessRoomInfo|section|1|String|30|-|-|
+|businessRoomInfo|remark|1|String|30|-|-|
+|businessRoomInfo|userId|1|String|30|-|-|
+|businessRoomInfo|roomId|1|String|30|-|-|
+|businessRoomInfo|layer|1|String|30|-|-|
+|businessRoomInfo|builtUpArea|1|String|30|-|-|
+|businessRoomInfo|roomNum|1|String|30|-|-|
+|businessRoomInfo|unitId|1|String|30|-|-|
+|businessRoomInfo|apartment|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/roomApi/service](http://community-service/roomApi/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": "530100030001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessRoomInfo": {
+                "unitPrice":"填写具体值",
+        "section":"填写具体值",
+        "remark":"填写具体值",
+        "userId":"填写具体值",
+        "roomId":"填写具体值",
+        "layer":"填写具体值",
+        "builtUpArea":"填写具体值",
+        "roomNum":"填写具体值",
+        "unitId":"填写具体值",
+        "apartment":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 132 - 0
docs/services/room/UpdateRoomInfo.md

@@ -0,0 +1,132 @@
+
+
+**1\. 修改小区房屋**
+###### 接口功能
+> API服务做修改小区房屋时调用该接口
+
+###### URL
+> [http://community-service/roomApi/service](http://community-service/roomApi/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|businessRoomInfo|1|Object|-|小区成员|小区成员|
+|businessRoomInfo|unitPrice|1|String|30|-|-|
+|businessRoomInfo|section|1|String|30|-|-|
+|businessRoomInfo|remark|1|String|30|-|-|
+|businessRoomInfo|userId|1|String|30|-|-|
+|businessRoomInfo|roomId|1|String|30|-|-|
+|businessRoomInfo|layer|1|String|30|-|-|
+|businessRoomInfo|builtUpArea|1|String|30|-|-|
+|businessRoomInfo|roomNum|1|String|30|-|-|
+|businessRoomInfo|unitId|1|String|30|-|-|
+|businessRoomInfo|apartment|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/roomApi/service](http://community-service/roomApi/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": "530100040001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessRoomInfo": {
+                "unitPrice":"填写具体值",
+        "section":"填写具体值",
+        "remark":"填写具体值",
+        "userId":"填写具体值",
+        "roomId":"填写具体值",
+        "layer":"填写具体值",
+        "builtUpArea":"填写具体值",
+        "roomNum":"填写具体值",
+        "unitId":"填写具体值",
+        "apartment":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 129 - 0
java110-bean/src/main/java/com/java110/dto/RoomDto.java

@@ -0,0 +1,129 @@
+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 RoomDto extends PageDto implements Serializable {
+
+    private String unitPrice;
+    private String section;
+    private String remark;
+    private String userId;
+    private String roomId;
+    private String layer;
+    private String builtUpArea;
+    private String roomNum;
+    private String unitId;
+    private String apartment;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getUnitPrice() {
+        return unitPrice;
+    }
+
+    public void setUnitPrice(String unitPrice) {
+        this.unitPrice = unitPrice;
+    }
+
+    public String getSection() {
+        return section;
+    }
+
+    public void setSection(String section) {
+        this.section = section;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getRoomId() {
+        return roomId;
+    }
+
+    public void setRoomId(String roomId) {
+        this.roomId = roomId;
+    }
+
+    public String getLayer() {
+        return layer;
+    }
+
+    public void setLayer(String layer) {
+        this.layer = layer;
+    }
+
+    public String getBuiltUpArea() {
+        return builtUpArea;
+    }
+
+    public void setBuiltUpArea(String builtUpArea) {
+        this.builtUpArea = builtUpArea;
+    }
+
+    public String getRoomNum() {
+        return roomNum;
+    }
+
+    public void setRoomNum(String roomNum) {
+        this.roomNum = roomNum;
+    }
+
+    public String getUnitId() {
+        return unitId;
+    }
+
+    public void setUnitId(String unitId) {
+        this.unitId = unitId;
+    }
+
+    public String getApartment() {
+        return apartment;
+    }
+
+    public void setApartment(String apartment) {
+        this.apartment = apartment;
+    }
+
+
+    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;
+    }
+}

+ 82 - 0
java110-code-generator/src/main/java/com/java110/RoomGeneratorApplication.java

@@ -0,0 +1,82 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ *
+ */
+public class RoomGeneratorApplication {
+
+    protected RoomGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+    /**
+     *  代码生成器 入口方法
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("roomId");
+        data.setName("room");
+        data.setDesc("小区房屋");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_ROOM_INFO");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_ROOM_INFO");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_ROOM_INFO");
+        data.setNewBusinessTypeCdValue("530100030001");
+        data.setUpdateBusinessTypeCdValue("530100040001");
+        data.setDeleteBusinessTypeCdValue("530100050001");
+        data.setBusinessTableName("business_building_room");
+        data.setTableName("building_room");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("roomId", "room_id");
+        param.put("bId", "b_id");
+        param.put("roomNum", "room_num");
+        param.put("unitId", "unit_id");
+        param.put("layer", "layer");
+        param.put("section", "section");
+        param.put("builtUpArea", "built_up_area");
+        param.put("unitPrice", "unit_price");
+        param.put("apartment", "apartment");
+        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);
+    }
+}

+ 67 - 0
java110-code-generator/src/main/java/com/java110/code/GeneratorDtoBean.java

@@ -0,0 +1,67 @@
+package com.java110.code;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public class GeneratorDtoBean extends BaseGenerator {
+
+
+    /**
+     * 拼装 查询数量
+     *
+     * @param data        数据
+     * @param fileContext 文件内容
+     * @return filContext 数据
+     */
+    private String dealVariableAndGetSet(Data data, String fileContext) {
+
+        Map<String, String> params = data.getParams();
+
+        String variable = "";
+        String variableGetSet = "";
+
+        for (String key : params.keySet()) {
+            if ("operate".equals(key) || "bId".equals(key) || "statusCd".equals(key)) {
+                continue;
+            }
+            variable += "private String " + key + ";\n";
+
+            variableGetSet += "public String get" + toUpperCaseFirstOne(key) + "() {\n"
+                    + "        return " + key + ";\n"
+                    + "    }\n";
+            variableGetSet += "public void set" + toUpperCaseFirstOne(key) + "(String " + key + ") {\n"
+                    + "        this." + key + " = " + key + ";\n"
+                    + "    }\n";
+
+
+        }
+
+
+        fileContext = fileContext.replace("$beanVariable$", variable);
+        fileContext = fileContext.replace("$beanVariableGetSet$", variableGetSet);
+
+        return fileContext;
+    }
+
+
+    /**
+     * 生成代码
+     *
+     * @param data 数据
+     */
+    public void generator(Data data) {
+        StringBuffer sb = readFile(this.getClass().getResource("/template/dto.txt").getFile());
+        String fileContext = sb.toString();
+        fileContext = fileContext.replace("store", toLowerCaseFirstOne(data.getName()))
+                .replace("Store", toUpperCaseFirstOne(data.getName()))
+                .replace("商户", data.getDesc());
+
+        fileContext = dealVariableAndGetSet(data, fileContext);
+
+        String writePath = this.getClass().getResource("/listener").getPath() + "/" + toUpperCaseFirstOne(data.getName()) + "Dto.java";
+        writeFile(writePath,
+                fileContext);
+    }
+}

+ 24 - 0
java110-code-generator/src/main/java/com/java110/code/GeneratorIInnerServiceSMO.java

@@ -0,0 +1,24 @@
+package com.java110.code;
+
+/**
+ * 内部服务类实现类
+ */
+public class GeneratorIInnerServiceSMO extends BaseGenerator {
+
+    /**
+     * 生成代码
+     *
+     * @param data 数据
+     */
+    public void generator(Data data) {
+        StringBuffer sb = readFile(this.getClass().getResource("/template/IInnerServiceSMO.txt").getFile());
+        String fileContext = sb.toString();
+        fileContext = fileContext.replace("store", toLowerCaseFirstOne(data.getName()))
+                .replace("Store", toUpperCaseFirstOne(data.getName()))
+                .replace("商户", data.getDesc());
+        String writePath = this.getClass().getResource("/listener").getPath() + "/I"
+                + toUpperCaseFirstOne(data.getName()) + "InnerServiceSMO.java";
+        writeFile(writePath,
+                fileContext);
+    }
+}

+ 24 - 0
java110-code-generator/src/main/java/com/java110/code/GeneratorInnerServiceSMOImpl.java

@@ -0,0 +1,24 @@
+package com.java110.code;
+
+/**
+ * 内部服务类实现类
+ */
+public class GeneratorInnerServiceSMOImpl extends BaseGenerator {
+
+    /**
+     * 生成代码
+     *
+     * @param data 数据
+     */
+    public void generator(Data data) {
+        StringBuffer sb = readFile(this.getClass().getResource("/template/InnerServiceSMOImpl.txt").getFile());
+        String fileContext = sb.toString();
+        fileContext = fileContext.replace("store", toLowerCaseFirstOne(data.getName()))
+                .replace("Store", toUpperCaseFirstOne(data.getName()))
+                .replace("商户", data.getDesc());
+        String writePath = this.getClass().getResource("/listener").getPath() + "/"
+                + toUpperCaseFirstOne(data.getName()) + "InnerServiceSMOImpl.java";
+        writeFile(writePath,
+                fileContext);
+    }
+}

+ 42 - 0
java110-code-generator/src/main/resources/template/IInnerServiceSMO.txt

@@ -0,0 +1,42 @@
+package com.java110.core.smo.store;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.StoreDto;
+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 IStoreInnerServiceSMO
+ * @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("/storeApi")
+public interface IStoreInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param storeDto 数据对象分享
+     * @return StoreDto 对象数据
+     */
+    @RequestMapping(value = "/queryStores", method = RequestMethod.POST)
+    List<StoreDto> queryStores(@RequestBody StoreDto storeDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param storeDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryStoresCount", method = RequestMethod.POST)
+    int queryStoresCount(@RequestBody StoreDto storeDto);
+}

+ 112 - 0
java110-code-generator/src/main/resources/template/InnerServiceSMOImpl.txt

@@ -0,0 +1,112 @@
+package com.java110.commstorey.smo.impl;
+
+
+import com.java110.common.util.BeanConvertUtil;
+import com.java110.commstorey.dao.IStoreServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.store.IStoreInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.StoreDto;
+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 StoreInnerServiceSMOImpl extends BaseServiceSMO implements IStoreInnerServiceSMO {
+
+    @Autowired
+    private IStoreServiceDao storeServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<StoreDto> queryStores(@RequestBody  StoreDto storeDto) {
+
+        //校验是否传了 分页信息
+
+        int page = storeDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            storeDto.setPage((page - 1) * storeDto.getRow());
+            storeDto.setRow(page * storeDto.getRow());
+        }
+
+        List<StoreDto> stores = BeanConvertUtil.covertBeanList(storeServiceDaoImpl.getStoreInfo(BeanConvertUtil.beanCovertMap(storeDto)), StoreDto.class);
+
+        if (stores == null || stores.size() == 0) {
+            return stores;
+        }
+
+        String[] userIds = getUserIds(stores);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (StoreDto store : stores) {
+            refreshStore(store, users);
+        }
+        return stores;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param store 小区商户信息
+     * @param users 用户列表
+     */
+    private void refreshStore(StoreDto store, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (store.getUserId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, store);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param stores 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<StoreDto> stores) {
+        List<String> userIds = new ArrayList<String>();
+        for (StoreDto store : stores) {
+            userIds.add(store.getUserId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryStoresCount(@RequestBody StoreDto storeDto) {
+        return storeServiceDaoImpl.queryStoresCount(BeanConvertUtil.beanCovertMap(storeDto));    }
+
+    public IStoreServiceDao getStoreServiceDaoImpl() {
+        return storeServiceDaoImpl;
+    }
+
+    public void setStoreServiceDaoImpl(IStoreServiceDao storeServiceDaoImpl) {
+        this.storeServiceDaoImpl = storeServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 40 - 0
java110-code-generator/src/main/resources/template/dto.txt

@@ -0,0 +1,40 @@
+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 StoreDto extends PageDto implements Serializable {
+
+    $beanVariable$
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    $beanVariableGetSet$
+
+    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;
+    }
+}

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

@@ -207,6 +207,23 @@ public class BusinessTypeConstant {
      */
     public static final String BUSINESS_TYPE_DELETE_UNIT_INFO = "520100050001";
 
+    /**
+     * 增加小区单元
+     */
+    public static final String BUSINESS_TYPE_SAVE_ROOM_INFO = "530100030001";
+
+    /**
+     * 修改小区单元
+     */
+    public static final String BUSINESS_TYPE_UPDATE_ROOM_INFO = "530100040001";
+
+
+    /**
+     * 删除小区单元
+     */
+    public static final String BUSINESS_TYPE_DELETE_ROOM_INFO = "530100050001";
+
+
     /**
      * 保存物业信息
      */

+ 246 - 0
java110-config/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml

@@ -0,0 +1,246 @@
+<?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="roomServiceDaoImpl">
+
+    <!-- 保存小区房屋信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessRoomInfo" parameterType="Map">
+           insert into business_building_room(
+unit_price,section,remark,user_id,room_id,layer,built_up_area,operate,room_num,unit_id,b_id,apartment
+) values (
+#{unitPrice},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment}
+)
+       </insert>
+
+
+       <!-- 查询小区房屋信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessRoomInfo" parameterType="Map" resultType="Map">
+           select  t.unit_price,t.unit_price unitPrice,t.section,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.operate,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment 
+from business_building_room t 
+where 1 =1 
+<if test="unitPrice !=null and unitPrice != ''">
+   and t.unit_price= #{unitPrice}
+</if> 
+<if test="section !=null and section != ''">
+   and t.section= #{section}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="roomId !=null and roomId != ''">
+   and t.room_id= #{roomId}
+</if> 
+<if test="layer !=null and layer != ''">
+   and t.layer= #{layer}
+</if> 
+<if test="builtUpArea !=null and builtUpArea != ''">
+   and t.built_up_area= #{builtUpArea}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="roomNum !=null and roomNum != ''">
+   and t.room_num= #{roomNum}
+</if> 
+<if test="unitId !=null and unitId != ''">
+   and t.unit_id= #{unitId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="apartment !=null and apartment != ''">
+   and t.apartment= #{apartment}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存小区房屋信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveRoomInfoInstance" parameterType="Map">
+        insert into building_room(
+unit_price,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment
+) select t.unit_price,t.section,'0',t.remark,t.user_id,t.room_id,t.layer,t.built_up_area,t.room_num,t.unit_id,t.b_id,t.apartment from business_building_room t where 1=1
+<if test="unitPrice !=null and unitPrice != ''">
+   and t.unit_price= #{unitPrice}
+</if> 
+<if test="section !=null and section != ''">
+   and t.section= #{section}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="roomId !=null and roomId != ''">
+   and t.room_id= #{roomId}
+</if> 
+<if test="layer !=null and layer != ''">
+   and t.layer= #{layer}
+</if> 
+<if test="builtUpArea !=null and builtUpArea != ''">
+   and t.built_up_area= #{builtUpArea}
+</if> 
+   and t.operate= 'ADD'
+<if test="roomNum !=null and roomNum != ''">
+   and t.room_num= #{roomNum}
+</if> 
+<if test="unitId !=null and unitId != ''">
+   and t.unit_id= #{unitId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="apartment !=null and apartment != ''">
+   and t.apartment= #{apartment}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
+    <select id="getRoomInfo" parameterType="Map" resultType="Map">
+        select  t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment 
+from building_room t 
+where 1 =1 
+<if test="unitPrice !=null and unitPrice != ''">
+   and t.unit_price= #{unitPrice}
+</if> 
+<if test="section !=null and section != ''">
+   and t.section= #{section}
+</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="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="roomId !=null and roomId != ''">
+   and t.room_id= #{roomId}
+</if> 
+<if test="layer !=null and layer != ''">
+   and t.layer= #{layer}
+</if> 
+<if test="builtUpArea !=null and builtUpArea != ''">
+   and t.built_up_area= #{builtUpArea}
+</if> 
+<if test="roomNum !=null and roomNum != ''">
+   and t.room_num= #{roomNum}
+</if> 
+<if test="unitId !=null and unitId != ''">
+   and t.unit_id= #{unitId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="apartment !=null and apartment != ''">
+   and t.apartment= #{apartment}
+</if> 
+<if test="page != -1 and page != null and page != ''">
+   limit page,row
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改小区房屋信息 add by wuxw 2018-07-03 -->
+    <update id="updateRoomInfoInstance" parameterType="Map">
+        update  building_room t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="unitPrice !=null and unitPrice != ''">
+, t.unit_price= #{unitPrice}
+</if> 
+<if test="section !=null and section != ''">
+, t.section= #{section}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+<if test="layer !=null and layer != ''">
+, t.layer= #{layer}
+</if> 
+<if test="builtUpArea !=null and builtUpArea != ''">
+, t.built_up_area= #{builtUpArea}
+</if> 
+<if test="roomNum !=null and roomNum != ''">
+, t.room_num= #{roomNum}
+</if> 
+<if test="unitId !=null and unitId != ''">
+, t.unit_id= #{unitId}
+</if> 
+<if test="apartment !=null and apartment != ''">
+, t.apartment= #{apartment}
+</if> 
+ where 1=1 <if test="roomId !=null and roomId != ''">
+and t.room_id= #{roomId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
+     <select id="queryRoomsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from building_room t 
+where 1 =1 
+<if test="unitPrice !=null and unitPrice != ''">
+   and t.unit_price= #{unitPrice}
+</if> 
+<if test="section !=null and section != ''">
+   and t.section= #{section}
+</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="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="roomId !=null and roomId != ''">
+   and t.room_id= #{roomId}
+</if> 
+<if test="layer !=null and layer != ''">
+   and t.layer= #{layer}
+</if> 
+<if test="builtUpArea !=null and builtUpArea != ''">
+   and t.built_up_area= #{builtUpArea}
+</if> 
+<if test="roomNum !=null and roomNum != ''">
+   and t.room_num= #{roomNum}
+</if> 
+<if test="unitId !=null and unitId != ''">
+   and t.unit_id= #{unitId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="apartment !=null and apartment != ''">
+   and t.apartment= #{apartment}
+</if> 
+
+
+     </select>
+
+</mapper>

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

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

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/room/IRoomInnerServiceSMO.java

@@ -0,0 +1,42 @@
+package com.java110.core.smo.room;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.RoomDto;
+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 IRoomInnerServiceSMO
+ * @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("/roomApi")
+public interface IRoomInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param roomDto 数据对象分享
+     * @return RoomDto 对象数据
+     */
+    @RequestMapping(value = "/queryRooms", method = RequestMethod.POST)
+    List<RoomDto> queryRooms(@RequestBody RoomDto roomDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param roomDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryRoomsCount", method = RequestMethod.POST)
+    int queryRoomsCount(@RequestBody RoomDto roomDto);
+}