Bläddra i källkod

停车位服务端代码开发完成

吴学文 7 år sedan
förälder
incheckning
a50a0adf52
18 ändrade filer med 1810 tillägg och 116 borttagningar
  1. 81 0
      CommunityService/src/main/java/com/java110/community/dao/IParkingSpaceServiceDao.java
  2. 134 0
      CommunityService/src/main/java/com/java110/community/dao/impl/ParkingSpaceServiceDaoImpl.java
  3. 89 0
      CommunityService/src/main/java/com/java110/community/listener/parkingSpace/AbstractParkingSpaceBusinessServiceDataFlowListener.java
  4. 180 0
      CommunityService/src/main/java/com/java110/community/listener/parkingSpace/DeleteParkingSpaceInfoListener.java
  5. 180 0
      CommunityService/src/main/java/com/java110/community/listener/parkingSpace/SaveParkingSpaceInfoListener.java
  6. 190 0
      CommunityService/src/main/java/com/java110/community/listener/parkingSpace/UpdateParkingSpaceInfoListener.java
  7. 112 0
      CommunityService/src/main/java/com/java110/community/smo/impl/ParkingSpaceInnerServiceSMOImpl.java
  8. 3 0
      docs/_sidebar.md
  9. 114 0
      docs/services/parkingSpace/DeleteParkingSpaceInfo.md
  10. 128 0
      docs/services/parkingSpace/SaveParkingSpaceInfo.md
  11. 128 0
      docs/services/parkingSpace/UpdateParkingSpaceInfo.md
  12. 96 0
      java110-bean/src/main/java/com/java110/dto/ParkingSpaceDto.java
  13. 83 0
      java110-code-generator/src/main/java/com/java110/ParkingSpaceGeneratorApplication.java
  14. 16 0
      java110-common/src/main/java/com/java110/common/constant/BusinessTypeConstant.java
  15. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  16. 42 0
      java110-core/src/main/java/com/java110/core/smo/parkingSpace/IParkingSpaceInnerServiceSMO.java
  17. 17 116
      java110-db/db/CommunityService/create_parking_space.sql
  18. 216 0
      java110-db/src/main/resources/mapper/parkingSpace/ParkingSpaceServiceDaoImplMapper.xml

+ 81 - 0
CommunityService/src/main/java/com/java110/community/dao/IParkingSpaceServiceDao.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 IParkingSpaceServiceDao {
+
+    /**
+     * 保存 停车位信息
+     * @param businessParkingSpaceInfo 停车位信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessParkingSpaceInfo(Map businessParkingSpaceInfo) throws DAOException;
+
+
+
+    /**
+     * 查询停车位信息(business过程)
+     * 根据bId 查询停车位信息
+     * @param info bId 信息
+     * @return 停车位信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessParkingSpaceInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 停车位信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveParkingSpaceInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询停车位信息(instance过程)
+     * 根据bId 查询停车位信息
+     * @param info bId 信息
+     * @return 停车位信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getParkingSpaceInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改停车位信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateParkingSpaceInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询停车位总数
+     *
+     * @param info 停车位信息
+     * @return 停车位数量
+     */
+    int queryParkingSpacesCount(Map info);
+
+}

+ 134 - 0
CommunityService/src/main/java/com/java110/community/dao/impl/ParkingSpaceServiceDaoImpl.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.IParkingSpaceServiceDao;
+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("parkingSpaceServiceDaoImpl")
+//@Transactional
+public class ParkingSpaceServiceDaoImpl extends BaseServiceDao implements IParkingSpaceServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(ParkingSpaceServiceDaoImpl.class);
+
+    /**
+     * 停车位信息封装
+     *
+     * @param businessParkingSpaceInfo 停车位信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessParkingSpaceInfo(Map businessParkingSpaceInfo) throws DAOException {
+        businessParkingSpaceInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存停车位信息 入参 businessParkingSpaceInfo : {}", businessParkingSpaceInfo);
+        int saveFlag = sqlSessionTemplate.insert("parkingSpaceServiceDaoImpl.saveBusinessParkingSpaceInfo", businessParkingSpaceInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存停车位数据失败:" + JSONObject.toJSONString(businessParkingSpaceInfo));
+        }
+    }
+
+
+    /**
+     * 查询停车位信息
+     *
+     * @param info bId 信息
+     * @return 停车位信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessParkingSpaceInfo(Map info) throws DAOException {
+
+        logger.debug("查询停车位信息 入参 info : {}", info);
+
+        List<Map> businessParkingSpaceInfos = sqlSessionTemplate.selectList("parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo", info);
+
+        return businessParkingSpaceInfos;
+    }
+
+
+    /**
+     * 保存停车位信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveParkingSpaceInfoInstance(Map info) throws DAOException {
+        logger.debug("保存停车位信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("parkingSpaceServiceDaoImpl.saveParkingSpaceInfoInstance", 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> getParkingSpaceInfo(Map info) throws DAOException {
+        logger.debug("查询停车位信息 入参 info : {}", info);
+
+        List<Map> businessParkingSpaceInfos = sqlSessionTemplate.selectList("parkingSpaceServiceDaoImpl.getParkingSpaceInfo", info);
+
+        return businessParkingSpaceInfos;
+    }
+
+
+    /**
+     * 修改停车位信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateParkingSpaceInfoInstance(Map info) throws DAOException {
+        logger.debug("修改停车位信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改停车位信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询停车位数量
+     *
+     * @param info 停车位信息
+     * @return 停车位数量
+     */
+    @Override
+    public int queryParkingSpacesCount(Map info) {
+        logger.debug("查询停车位数据 入参 info : {}", info);
+
+        List<Map> businessParkingSpaceInfos = sqlSessionTemplate.selectList("parkingSpaceServiceDaoImpl.queryParkingSpacesCount", info);
+        if (businessParkingSpaceInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessParkingSpaceInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
CommunityService/src/main/java/com/java110/community/listener/parkingSpace/AbstractParkingSpaceBusinessServiceDataFlowListener.java

@@ -0,0 +1,89 @@
+package com.java110.community.listener.parkingSpace;
+
+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.IParkingSpaceServiceDao;
+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 AbstractParkingSpaceBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractParkingSpaceBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IParkingSpaceServiceDao getParkingSpaceServiceDaoImpl();
+
+    /**
+     * 刷新 businessParkingSpaceInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessParkingSpaceInfo
+     */
+    protected void flushBusinessParkingSpaceInfo(Map businessParkingSpaceInfo, String statusCd) {
+        businessParkingSpaceInfo.put("newBId", businessParkingSpaceInfo.get("b_id"));
+        businessParkingSpaceInfo.put("area", businessParkingSpaceInfo.get("area"));
+        businessParkingSpaceInfo.put("operate", businessParkingSpaceInfo.get("operate"));
+        businessParkingSpaceInfo.put("typeCd", businessParkingSpaceInfo.get("type_cd"));
+        businessParkingSpaceInfo.put("num", businessParkingSpaceInfo.get("num"));
+        businessParkingSpaceInfo.put("psId", businessParkingSpaceInfo.get("ps_id"));
+        businessParkingSpaceInfo.put("remark", businessParkingSpaceInfo.get("remark"));
+        businessParkingSpaceInfo.put("state", businessParkingSpaceInfo.get("state"));
+        businessParkingSpaceInfo.put("communityId", businessParkingSpaceInfo.get("community_id"));
+        businessParkingSpaceInfo.put("userId", businessParkingSpaceInfo.get("user_id"));
+        businessParkingSpaceInfo.remove("bId");
+        businessParkingSpaceInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessParkingSpace 停车位信息
+     */
+    protected void autoSaveDelBusinessParkingSpace(Business business, JSONObject businessParkingSpace) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("psId", businessParkingSpace.getString("psId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentParkingSpaceInfos = getParkingSpaceServiceDaoImpl().getParkingSpaceInfo(info);
+        if (currentParkingSpaceInfos == null || currentParkingSpaceInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentParkingSpaceInfo = currentParkingSpaceInfos.get(0);
+
+        currentParkingSpaceInfo.put("bId", business.getbId());
+
+        currentParkingSpaceInfo.put("area", currentParkingSpaceInfo.get("area"));
+        currentParkingSpaceInfo.put("operate", currentParkingSpaceInfo.get("operate"));
+        currentParkingSpaceInfo.put("typeCd", currentParkingSpaceInfo.get("type_cd"));
+        currentParkingSpaceInfo.put("num", currentParkingSpaceInfo.get("num"));
+        currentParkingSpaceInfo.put("psId", currentParkingSpaceInfo.get("ps_id"));
+        currentParkingSpaceInfo.put("remark", currentParkingSpaceInfo.get("remark"));
+        currentParkingSpaceInfo.put("state", currentParkingSpaceInfo.get("state"));
+        currentParkingSpaceInfo.put("communityId", currentParkingSpaceInfo.get("community_id"));
+        currentParkingSpaceInfo.put("userId", currentParkingSpaceInfo.get("user_id"));
+
+
+        currentParkingSpaceInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getParkingSpaceServiceDaoImpl().saveBusinessParkingSpaceInfo(currentParkingSpaceInfo);
+    }
+
+
+}

+ 180 - 0
CommunityService/src/main/java/com/java110/community/listener/parkingSpace/DeleteParkingSpaceInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.community.listener.parkingSpace;
+
+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.IParkingSpaceServiceDao;
+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、businessParkingSpace:{} 停车位基本信息节点
+ * 2、businessParkingSpaceAttr:[{}] 停车位属性信息节点
+ * 3、businessParkingSpacePhoto:[{}] 停车位照片信息节点
+ * 4、businessParkingSpaceCerdentials:[{}] 停车位证件信息节点
+ * 协议地址 :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("deleteParkingSpaceInfoListener")
+@Transactional
+public class DeleteParkingSpaceInfoListener extends AbstractParkingSpaceBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(DeleteParkingSpaceInfoListener.class);
+    @Autowired
+    IParkingSpaceServiceDao parkingSpaceServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_PARKING_SPACE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessParkingSpace 节点
+        if (data.containsKey("businessParkingSpace")) {
+            //处理 businessParkingSpace 节点
+            if (data.containsKey("businessParkingSpace")) {
+                Object _obj = data.get("businessParkingSpace");
+                JSONArray businessParkingSpaces = null;
+                if (_obj instanceof JSONObject) {
+                    businessParkingSpaces = new JSONArray();
+                    businessParkingSpaces.add(_obj);
+                } else {
+                    businessParkingSpaces = (JSONArray) _obj;
+                }
+                //JSONObject businessParkingSpace = data.getJSONObject("businessParkingSpace");
+                for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaces.size(); _parkingSpaceIndex++) {
+                    JSONObject businessParkingSpace = businessParkingSpaces.getJSONObject(_parkingSpaceIndex);
+                    doBusinessParkingSpace(business, businessParkingSpace);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("psId", businessParkingSpace.getString("psId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessParkingSpaceInfos = parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo(info);
+        if (businessParkingSpaceInfos != null && businessParkingSpaceInfos.size() > 0) {
+            for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaceInfos.size(); _parkingSpaceIndex++) {
+                Map businessParkingSpaceInfo = businessParkingSpaceInfos.get(_parkingSpaceIndex);
+                flushBusinessParkingSpaceInfo(businessParkingSpaceInfo, StatusConstant.STATUS_CD_INVALID);
+                parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance(businessParkingSpaceInfo);
+                dataFlowContext.addParamOut("psId", businessParkingSpaceInfo.get("ps_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> parkingSpaceInfo = parkingSpaceServiceDaoImpl.getParkingSpaceInfo(info);
+        if (parkingSpaceInfo != null && parkingSpaceInfo.size() > 0) {
+
+            //停车位信息
+            List<Map> businessParkingSpaceInfos = parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessParkingSpaceInfos == null || businessParkingSpaceInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(parkingSpace),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaceInfos.size(); _parkingSpaceIndex++) {
+                Map businessParkingSpaceInfo = businessParkingSpaceInfos.get(_parkingSpaceIndex);
+                flushBusinessParkingSpaceInfo(businessParkingSpaceInfo, StatusConstant.STATUS_CD_VALID);
+                parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance(businessParkingSpaceInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessParkingSpace 节点
+     *
+     * @param business             总的数据节点
+     * @param businessParkingSpace 停车位节点
+     */
+    private void doBusinessParkingSpace(Business business, JSONObject businessParkingSpace) {
+
+        Assert.jsonObjectHaveKey(businessParkingSpace, "psId", "businessParkingSpace 节点下没有包含 psId 节点");
+
+        if (businessParkingSpace.getString("psId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "psId 错误,不能自动生成(必须已经存在的psId)" + businessParkingSpace);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessParkingSpace(business, businessParkingSpace);
+    }
+
+    public IParkingSpaceServiceDao getParkingSpaceServiceDaoImpl() {
+        return parkingSpaceServiceDaoImpl;
+    }
+
+    public void setParkingSpaceServiceDaoImpl(IParkingSpaceServiceDao parkingSpaceServiceDaoImpl) {
+        this.parkingSpaceServiceDaoImpl = parkingSpaceServiceDaoImpl;
+    }
+}

+ 180 - 0
CommunityService/src/main/java/com/java110/community/listener/parkingSpace/SaveParkingSpaceInfoListener.java

@@ -0,0 +1,180 @@
+
+package com.java110.community.listener.parkingSpace;
+
+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.IParkingSpaceServiceDao;
+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("saveParkingSpaceInfoListener")
+@Transactional
+public class SaveParkingSpaceInfoListener extends AbstractParkingSpaceBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveParkingSpaceInfoListener.class);
+
+    @Autowired
+    private IParkingSpaceServiceDao parkingSpaceServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE;
+    }
+
+    /**
+     * 保存停车位信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessParkingSpace 节点
+        if (data.containsKey("businessParkingSpace")) {
+            Object bObj = data.get("businessParkingSpace");
+            JSONArray businessParkingSpaces = null;
+            if (bObj instanceof JSONObject) {
+                businessParkingSpaces = new JSONArray();
+                businessParkingSpaces.add(bObj);
+            } else {
+                businessParkingSpaces = (JSONArray) bObj;
+            }
+            //JSONObject businessParkingSpace = data.getJSONObject("businessParkingSpace");
+            for (int bParkingSpaceIndex = 0; bParkingSpaceIndex < businessParkingSpaces.size(); bParkingSpaceIndex++) {
+                JSONObject businessParkingSpace = businessParkingSpaces.getJSONObject(bParkingSpaceIndex);
+                doBusinessParkingSpace(business, businessParkingSpace);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("psId", businessParkingSpace.getString("psId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessParkingSpaceInfo = parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo(info);
+        if (businessParkingSpaceInfo != null && businessParkingSpaceInfo.size() > 0) {
+            reFreshShareColumn(info, businessParkingSpaceInfo.get(0));
+            parkingSpaceServiceDaoImpl.saveParkingSpaceInfoInstance(info);
+            if (businessParkingSpaceInfo.size() == 1) {
+                dataFlowContext.addParamOut("psId", businessParkingSpaceInfo.get(0).get("ps_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("communityId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("community_id")) {
+            return;
+        }
+
+        info.put("communityId", businessInfo.get("community_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> parkingSpaceInfo = parkingSpaceServiceDaoImpl.getParkingSpaceInfo(info);
+        if (parkingSpaceInfo != null && parkingSpaceInfo.size() > 0) {
+            reFreshShareColumn(paramIn, parkingSpaceInfo.get(0));
+            parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessParkingSpace 节点
+     *
+     * @param business             总的数据节点
+     * @param businessParkingSpace 停车位节点
+     */
+    private void doBusinessParkingSpace(Business business, JSONObject businessParkingSpace) {
+
+        Assert.jsonObjectHaveKey(businessParkingSpace, "psId", "businessParkingSpace 节点下没有包含 psId 节点");
+
+        if (businessParkingSpace.getString("psId").startsWith("-")) {
+            //刷新缓存
+            //flushParkingSpaceId(business.getDatas());
+
+            businessParkingSpace.put("psId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_psId));
+
+        }
+
+        businessParkingSpace.put("bId", business.getbId());
+        businessParkingSpace.put("operate", StatusConstant.OPERATE_ADD);
+        //保存停车位信息
+        parkingSpaceServiceDaoImpl.saveBusinessParkingSpaceInfo(businessParkingSpace);
+
+    }
+
+    public IParkingSpaceServiceDao getParkingSpaceServiceDaoImpl() {
+        return parkingSpaceServiceDaoImpl;
+    }
+
+    public void setParkingSpaceServiceDaoImpl(IParkingSpaceServiceDao parkingSpaceServiceDaoImpl) {
+        this.parkingSpaceServiceDaoImpl = parkingSpaceServiceDaoImpl;
+    }
+}

+ 190 - 0
CommunityService/src/main/java/com/java110/community/listener/parkingSpace/UpdateParkingSpaceInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.community.listener.parkingSpace;
+
+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.IParkingSpaceServiceDao;
+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、businessParkingSpace:{} 停车位基本信息节点
+ * 2、businessParkingSpaceAttr:[{}] 停车位属性信息节点
+ * 3、businessParkingSpacePhoto:[{}] 停车位照片信息节点
+ * 4、businessParkingSpaceCerdentials:[{}] 停车位证件信息节点
+ * 协议地址 :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("updateParkingSpaceInfoListener")
+@Transactional
+public class UpdateParkingSpaceInfoListener extends AbstractParkingSpaceBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateParkingSpaceInfoListener.class);
+    @Autowired
+    private IParkingSpaceServiceDao parkingSpaceServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessParkingSpace 节点
+        if (data.containsKey("businessParkingSpace")) {
+            //处理 businessParkingSpace 节点
+            if (data.containsKey("businessParkingSpace")) {
+                Object _obj = data.get("businessParkingSpace");
+                JSONArray businessParkingSpaces = null;
+                if (_obj instanceof JSONObject) {
+                    businessParkingSpaces = new JSONArray();
+                    businessParkingSpaces.add(_obj);
+                } else {
+                    businessParkingSpaces = (JSONArray) _obj;
+                }
+                //JSONObject businessParkingSpace = data.getJSONObject("businessParkingSpace");
+                for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaces.size(); _parkingSpaceIndex++) {
+                    JSONObject businessParkingSpace = businessParkingSpaces.getJSONObject(_parkingSpaceIndex);
+                    doBusinessParkingSpace(business, businessParkingSpace);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("psId", businessParkingSpace.getString("psId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessParkingSpaceInfos = parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo(info);
+        if (businessParkingSpaceInfos != null && businessParkingSpaceInfos.size() > 0) {
+            for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaceInfos.size(); _parkingSpaceIndex++) {
+                Map businessParkingSpaceInfo = businessParkingSpaceInfos.get(_parkingSpaceIndex);
+                flushBusinessParkingSpaceInfo(businessParkingSpaceInfo, StatusConstant.STATUS_CD_VALID);
+                parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance(businessParkingSpaceInfo);
+                if (businessParkingSpaceInfo.size() == 1) {
+                    dataFlowContext.addParamOut("psId", businessParkingSpaceInfo.get("ps_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> parkingSpaceInfo = parkingSpaceServiceDaoImpl.getParkingSpaceInfo(info);
+        if (parkingSpaceInfo != null && parkingSpaceInfo.size() > 0) {
+
+            //停车位信息
+            List<Map> businessParkingSpaceInfos = parkingSpaceServiceDaoImpl.getBusinessParkingSpaceInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessParkingSpaceInfos == null || businessParkingSpaceInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(parkingSpace),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _parkingSpaceIndex = 0; _parkingSpaceIndex < businessParkingSpaceInfos.size(); _parkingSpaceIndex++) {
+                Map businessParkingSpaceInfo = businessParkingSpaceInfos.get(_parkingSpaceIndex);
+                flushBusinessParkingSpaceInfo(businessParkingSpaceInfo, StatusConstant.STATUS_CD_VALID);
+                parkingSpaceServiceDaoImpl.updateParkingSpaceInfoInstance(businessParkingSpaceInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessParkingSpace 节点
+     *
+     * @param business             总的数据节点
+     * @param businessParkingSpace 停车位节点
+     */
+    private void doBusinessParkingSpace(Business business, JSONObject businessParkingSpace) {
+
+        Assert.jsonObjectHaveKey(businessParkingSpace, "psId", "businessParkingSpace 节点下没有包含 psId 节点");
+
+        if (businessParkingSpace.getString("psId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "psId 错误,不能自动生成(必须已经存在的psId)" + businessParkingSpace);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessParkingSpace(business, businessParkingSpace);
+
+        businessParkingSpace.put("bId", business.getbId());
+        businessParkingSpace.put("operate", StatusConstant.OPERATE_ADD);
+        //保存停车位信息
+        parkingSpaceServiceDaoImpl.saveBusinessParkingSpaceInfo(businessParkingSpace);
+
+    }
+
+
+    public IParkingSpaceServiceDao getParkingSpaceServiceDaoImpl() {
+        return parkingSpaceServiceDaoImpl;
+    }
+
+    public void setParkingSpaceServiceDaoImpl(IParkingSpaceServiceDao parkingSpaceServiceDaoImpl) {
+        this.parkingSpaceServiceDaoImpl = parkingSpaceServiceDaoImpl;
+    }
+
+
+}

+ 112 - 0
CommunityService/src/main/java/com/java110/community/smo/impl/ParkingSpaceInnerServiceSMOImpl.java

@@ -0,0 +1,112 @@
+package com.java110.community.smo.impl;
+
+
+import com.java110.common.util.BeanConvertUtil;
+import com.java110.community.dao.IParkingSpaceServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.parkingSpace.IParkingSpaceInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.ParkingSpaceDto;
+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 ParkingSpaceInnerServiceSMOImpl extends BaseServiceSMO implements IParkingSpaceInnerServiceSMO {
+
+    @Autowired
+    private IParkingSpaceServiceDao parkingSpaceServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<ParkingSpaceDto> queryParkingSpaces(@RequestBody  ParkingSpaceDto parkingSpaceDto) {
+
+        //校验是否传了 分页信息
+
+        int page = parkingSpaceDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            parkingSpaceDto.setPage((page - 1) * parkingSpaceDto.getRow());
+            parkingSpaceDto.setRow(page * parkingSpaceDto.getRow());
+        }
+
+        List<ParkingSpaceDto> parkingSpaces = BeanConvertUtil.covertBeanList(parkingSpaceServiceDaoImpl.getParkingSpaceInfo(BeanConvertUtil.beanCovertMap(parkingSpaceDto)), ParkingSpaceDto.class);
+
+        if (parkingSpaces == null || parkingSpaces.size() == 0) {
+            return parkingSpaces;
+        }
+
+        String[] userIds = getUserIds(parkingSpaces);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (ParkingSpaceDto parkingSpace : parkingSpaces) {
+            refreshParkingSpace(parkingSpace, users);
+        }
+        return parkingSpaces;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param parkingSpace 小区停车位信息
+     * @param users 用户列表
+     */
+    private void refreshParkingSpace(ParkingSpaceDto parkingSpace, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (parkingSpace.getUserId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, parkingSpace);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param parkingSpaces 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<ParkingSpaceDto> parkingSpaces) {
+        List<String> userIds = new ArrayList<String>();
+        for (ParkingSpaceDto parkingSpace : parkingSpaces) {
+            userIds.add(parkingSpace.getUserId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryParkingSpacesCount(@RequestBody ParkingSpaceDto parkingSpaceDto) {
+        return parkingSpaceServiceDaoImpl.queryParkingSpacesCount(BeanConvertUtil.beanCovertMap(parkingSpaceDto));    }
+
+    public IParkingSpaceServiceDao getParkingSpaceServiceDaoImpl() {
+        return parkingSpaceServiceDaoImpl;
+    }
+
+    public void setParkingSpaceServiceDaoImpl(IParkingSpaceServiceDao parkingSpaceServiceDaoImpl) {
+        this.parkingSpaceServiceDaoImpl = parkingSpaceServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 3 - 0
docs/_sidebar.md

@@ -79,6 +79,9 @@
   * [保存费用配置](services/fee/SaveFeeConfigInfo.md)
   * [修改费用配置](services/fee/UpdateFeeConfigInfo.md)
   * [删除费用配置](services/fee/DeleteFeeConfigInfo.md)
+  * [保存停车位](services/parkingSpace/SaveParkingSpaceInfo.md)
+  * [修改停车位](services/parkingSpace/UpdateParkingSpaceInfo.md)
+  * [删除停车位](services/parkingSpace/DeleteParkingSpaceInfo.md)
 
 * 工具类接口
 

+ 114 - 0
docs/services/parkingSpace/DeleteParkingSpaceInfo.md

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

+ 128 - 0
docs/services/parkingSpace/SaveParkingSpaceInfo.md

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

+ 128 - 0
docs/services/parkingSpace/UpdateParkingSpaceInfo.md

@@ -0,0 +1,128 @@
+
+
+**1\. 修改停车位**
+###### 接口功能
+> API服务做修改停车位时调用该接口
+
+###### URL
+> [http://community-service/parkingSpaceApi/service](http://community-service/parkingSpaceApi/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|businessParkingSpace|1|Object|-|小区成员|小区成员|
+|businessParkingSpace|area|1|String|30|-|-|
+|businessParkingSpace|typeCd|1|String|30|-|-|
+|businessParkingSpace|num|1|String|30|-|-|
+|businessParkingSpace|psId|1|String|30|-|-|
+|businessParkingSpace|remark|1|String|30|-|-|
+|businessParkingSpace|state|1|String|30|-|-|
+|businessParkingSpace|communityId|1|String|30|-|-|
+|businessParkingSpace|userId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://community-service/parkingSpaceApi/service](http://community-service/parkingSpaceApi/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": {
+      "businessParkingSpace": {
+                "area":"填写具体值",
+        "typeCd":"填写具体值",
+        "num":"填写具体值",
+        "psId":"填写具体值",
+        "remark":"填写具体值",
+        "state":"填写具体值",
+        "communityId":"填写具体值",
+        "userId":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 96 - 0
java110-bean/src/main/java/com/java110/dto/ParkingSpaceDto.java

@@ -0,0 +1,96 @@
+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 ParkingSpaceDto extends PageDto implements Serializable {
+
+    private String area;
+private String typeCd;
+private String num;
+private String psId;
+private String remark;
+private String state;
+private String communityId;
+private String userId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getArea() {
+        return area;
+    }
+public void setArea(String area) {
+        this.area = area;
+    }
+public String getTypeCd() {
+        return typeCd;
+    }
+public void setTypeCd(String typeCd) {
+        this.typeCd = typeCd;
+    }
+public String getNum() {
+        return num;
+    }
+public void setNum(String num) {
+        this.num = num;
+    }
+public String getPsId() {
+        return psId;
+    }
+public void setPsId(String psId) {
+        this.psId = psId;
+    }
+public String getRemark() {
+        return remark;
+    }
+public void setRemark(String remark) {
+        this.remark = remark;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getCommunityId() {
+        return communityId;
+    }
+public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+public String getUserId() {
+        return userId;
+    }
+public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+
+    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;
+    }
+}

+ 83 - 0
java110-code-generator/src/main/java/com/java110/ParkingSpaceGeneratorApplication.java

@@ -0,0 +1,83 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ */
+public class ParkingSpaceGeneratorApplication {
+
+    protected ParkingSpaceGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * 代码生成器 入口方法
+     *
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("psId");
+        data.setName("parkingSpace");
+        data.setDesc("停车位");
+        data.setShareParam("communityId");
+        data.setShareColumn("community_id");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_PARKING_SPACE");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_PARKING_SPACE");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_PARKING_SPACE");
+        data.setNewBusinessTypeCdValue("540100030001");
+        data.setUpdateBusinessTypeCdValue("540100040001");
+        data.setDeleteBusinessTypeCdValue("540100050001");
+        data.setBusinessTableName("business_parking_space");
+        data.setTableName("p_parking_space");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("psId", "ps_id");
+        param.put("num", "num");
+        param.put("communityId", "community_id");
+        param.put("bId", "b_id");
+        param.put("typeCd", "type_cd");
+        param.put("state", "state");
+        param.put("area", "area");
+        param.put("userId", "user_id");
+        param.put("remark", "remark");
+        param.put("statusCd", "status_cd");
+        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);
+    }
+}

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

@@ -257,6 +257,22 @@ public class BusinessTypeConstant {
      */
     public static final String BUSINESS_TYPE_DELETE_ROOM_INFO = "530100050001";
 
+    /**
+     * 增加车位
+     */
+    public static final String BUSINESS_TYPE_SAVE_PARKING_SPACE = "540100030001";
+
+    /**
+     * 修改车位
+     */
+    public static final String BUSINESS_TYPE_UPDATE_PARKING_SPACE = "540100040001";
+
+
+    /**
+     * 删除车位
+     */
+    public static final String BUSINESS_TYPE_DELETE_PARKING_SPACE = "540100050001";
+
 
 
 

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

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

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/parkingSpace/IParkingSpaceInnerServiceSMO.java

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

+ 17 - 116
java110-db/db/CommunityService/create_parking_space.sql

@@ -2,10 +2,11 @@
 CREATE TABLE business_parking_space(
   ps_id VARCHAR(30) NOT NULL COMMENT '车位ID',
   b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  community_id varchar(30) not null comment '小区ID',
   num VARCHAR(12) NOT NULL COMMENT '车位编号',
-  type_cd VARCHAR(4) NOT NULL COMMENT '车位类型',
-  state VARCHAR(4) NOT NULL COMMENT '车位状态',
-  area VARCHAR(4) NOT NULL COMMENT '车位面积',
+  type_cd VARCHAR(4) NOT NULL COMMENT '车位类型,地上停车位1001 地下停车位 2001',
+  state VARCHAR(4) NOT NULL COMMENT '车位状态 出售 S,出租 H ,空闲 F',
+  area decimal(7,2) NOT NULL COMMENT '车位面积',
   user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
   remark VARCHAR(300) NOT NULL COMMENT '用户ID',
   create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -13,126 +14,24 @@ CREATE TABLE business_parking_space(
 );
 
 
-CREATE INDEX idx_business_floor_id ON business_floor(floor_id);
-CREATE INDEX idx_business_floor_b_id ON business_floor(b_id);
+CREATE INDEX idx_bps_ps_id ON business_parking_space(ps_id);
+CREATE INDEX idx_bps_b_id ON business_parking_space(b_id);
 
-
-CREATE TABLE f_floor(
-  floor_id VARCHAR(30) NOT NULL COMMENT '楼ID',
+-- 楼信息
+CREATE TABLE p_parking_space(
+  ps_id VARCHAR(30) NOT NULL COMMENT '车位ID',
   b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-  floor_num VARCHAR(12) NOT NULL COMMENT '楼编号',
-  `name` VARCHAR(100) NOT NULL COMMENT '小区楼名称',
+  community_id varchar(30) not null comment '小区ID',
+  num VARCHAR(12) NOT NULL COMMENT '车位编号',
+  type_cd VARCHAR(4) NOT NULL COMMENT '车位类型,地上停车位1001 地下停车位 2001',
+  state VARCHAR(4) NOT NULL COMMENT '车位状态 出售 S,出租 H ,空闲 F',
+  area decimal(7,2) NOT NULL COMMENT '车位面积',
   user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
   remark VARCHAR(300) NOT NULL COMMENT '用户ID',
   create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
-  UNIQUE KEY (floor_id)
-);
-CREATE INDEX idx_floor_b_id ON f_floor(b_id);
-CREATE UNIQUE INDEX idx_floor_id ON f_floor(floor_id);
-
-
-CREATE TABLE business_building_unit(
-  unit_id VARCHAR(30) NOT NULL COMMENT '单元ID',
-  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-  unit_num VARCHAR(12) NOT NULL COMMENT '单元编号',
-  floor_id VARCHAR(30) NOT NULL COMMENT '楼ID',
-  layer_count int NOT NULL COMMENT '总层数',
-  lift varchar(4) NOT NULL COMMENT '是否有电梯 1010有 2020 无',
-  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_unit_id ON business_building_unit(unit_id);
-CREATE INDEX idx_business_unit_b_id ON business_building_unit(b_id);
-
-
-CREATE TABLE building_unit(
-  unit_id VARCHAR(30) NOT NULL COMMENT '单元ID',
-  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-  unit_num VARCHAR(12) NOT NULL COMMENT '单元编号',
-  floor_id VARCHAR(30) NOT NULL COMMENT '楼ID',
-  layer_count int NOT NULL COMMENT '总层数',
-  lift varchar(4) NOT NULL COMMENT '是否有电梯 1010有 2020 无',
-  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表,S 保存,0, 在用 1失效',
-  UNIQUE KEY (unit_id)
-);
-CREATE INDEX idx_unit_b_id ON building_unit(b_id);
-CREATE UNIQUE INDEX idx_unit_id ON building_unit(unit_id);
-
-
-
-CREATE TABLE business_building_room(
-  room_id VARCHAR(30) NOT NULL COMMENT '房屋ID',
-  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-  room_num VARCHAR(12) NOT NULL COMMENT '房屋编号',
-  unit_id VARCHAR(30) NOT NULL COMMENT '单元ID',
-  layer int NOT NULL COMMENT '层数',
-  section int NOT NULL COMMENT '室',
-  apartment varchar(4) NOT NULL COMMENT '户型',
-  built_up_area decimal(6,2) NOT NULL COMMENT '建筑面积',
-  unit_price DECIMAL(12,2) 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_room_id ON business_building_room(room_id);
-CREATE INDEX idx_business_room_b_id ON business_building_room(b_id);
-
-
-CREATE TABLE building_room(
-  room_id VARCHAR(30) NOT NULL COMMENT '房屋ID',
-  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-  room_num VARCHAR(12) NOT NULL COMMENT '房屋编号',
-  unit_id VARCHAR(30) NOT NULL COMMENT '单元ID',
-  layer int NOT NULL COMMENT '层数',
-  section int NOT NULL COMMENT '室',
-  apartment varchar(4) NOT NULL COMMENT '户型',
-  built_up_area decimal(6,2) NOT NULL COMMENT '建筑面积',
-  unit_price DECIMAL(12,2) 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表,S 保存,0, 在用 1失效',
-  UNIQUE KEY (room_id)
+  unique key (ps_id)
 );
-CREATE INDEX idx_room_b_id ON building_room(b_id);
-CREATE UNIQUE INDEX idx_room_id ON building_room(room_id);
 
-create table business_building_room_attr(
-    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
-    attr_id VARCHAR(30) NOT NULL COMMENT '属性id',
-    room_id VARCHAR(30) NOT NULL COMMENT '用户ID',
-    spec_cd VARCHAR(12) NOT NULL COMMENT '规格id,参考spec表',
-    `value` VARCHAR(50) NOT NULL COMMENT '属性值',
-    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
-);
-
-CREATE INDEX idx_business_b_room_attr ON business_building_room_attr(room_id);
-CREATE INDEX idx_business_b_room_attr_b_id ON business_building_room_attr(b_id);
-
-
-CREATE TABLE building_room_attr(
-    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
-    attr_id VARCHAR(30) NOT NULL COMMENT '属性id',
-    room_id VARCHAR(30) NOT NULL COMMENT '房屋ID',
-    spec_cd VARCHAR(12) NOT NULL COMMENT '规格id,参考spec表',
-    `value` VARCHAR(50) NOT NULL COMMENT '属性值',
-    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
-    UNIQUE KEY (attr_id)
-);
-CREATE INDEX idx_b_attr_b_id ON building_room_attr(b_id);
-CREATE INDEX idx_attr_room_id ON building_room_attr(room_id);
+CREATE INDEX idx_ps_ps_id ON p_parking_space(ps_id);
+CREATE INDEX idx_ps_b_id ON p_parking_space(b_id);

+ 216 - 0
java110-db/src/main/resources/mapper/parkingSpace/ParkingSpaceServiceDaoImplMapper.xml

@@ -0,0 +1,216 @@
+<?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="parkingSpaceServiceDaoImpl">
+
+    <!-- 保存停车位信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessParkingSpaceInfo" parameterType="Map">
+           insert into business_parking_space(
+area,operate,type_cd,num,ps_id,remark,state,community_id,b_id,user_id
+) values (
+#{area},#{operate},#{typeCd},#{num},#{psId},#{remark},#{state},#{communityId},#{bId},#{userId}
+)
+       </insert>
+
+
+       <!-- 查询停车位信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessParkingSpaceInfo" parameterType="Map" resultType="Map">
+           select  t.area,t.operate,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id psId,t.remark,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId 
+from business_parking_space t 
+where 1 =1 
+<if test="area !=null and area != ''">
+   and t.area= #{area}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="num !=null and num != ''">
+   and t.num= #{num}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</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> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存停车位信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveParkingSpaceInfoInstance" parameterType="Map">
+        insert into p_parking_space(
+area,type_cd,num,ps_id,remark,status_cd,state,community_id,b_id,user_id
+) select t.area,t.type_cd,t.num,t.ps_id,t.remark,'0',t.state,t.community_id,t.b_id,t.user_id from business_parking_space t where 1=1
+<if test="area !=null and area != ''">
+   and t.area= #{area}
+</if> 
+   and t.operate= 'ADD'
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="num !=null and num != ''">
+   and t.num= #{num}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</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> 
+
+    </insert>
+
+
+
+    <!-- 查询停车位信息 add by wuxw 2018-07-03 -->
+    <select id="getParkingSpaceInfo" parameterType="Map" resultType="Map">
+        select  t.area,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId 
+from p_parking_space t 
+where 1 =1 
+<if test="area !=null and area != ''">
+   and t.area= #{area}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="num !=null and num != ''">
+   and t.num= #{num}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</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="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改停车位信息 add by wuxw 2018-07-03 -->
+    <update id="updateParkingSpaceInfoInstance" parameterType="Map">
+        update  p_parking_space t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="area !=null and area != ''">
+, t.area= #{area}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+, t.type_cd= #{typeCd}
+</if> 
+<if test="num !=null and num != ''">
+, t.num= #{num}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="state !=null and state != ''">
+, t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+, t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+ where 1=1 <if test="psId !=null and psId != ''">
+and t.ps_id= #{psId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询停车位数量 add by wuxw 2018-07-03 -->
+     <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from p_parking_space t 
+where 1 =1 
+<if test="area !=null and area != ''">
+   and t.area= #{area}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="num !=null and num != ''">
+   and t.num= #{num}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</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> 
+
+
+     </select>
+
+</mapper>