Explorar el Código

加入仓库管理

java110 hace 5 años
padre
commit
43617dc9f5
Se han modificado 25 ficheros con 2290 adiciones y 66 borrados
  1. 175 0
      docs/document/services/storehouse/DeleteStorehouseInfo.md
  2. 175 0
      docs/document/services/storehouse/SaveStorehouseInfo.md
  3. 188 0
      docs/document/services/storehouse/UpdateStorehouseInfo.md
  4. 83 0
      java110-bean/src/main/java/com/java110/dto/storehouse/StorehouseDto.java
  5. 53 0
      java110-bean/src/main/java/com/java110/po/storehouse/StorehousePo.java
  6. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  7. 187 0
      java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml
  8. 30 22
      java110-generator/src/main/resources/back/template_1.json
  9. 34 44
      java110-generator/src/main/resources/web/template_1.json
  10. 42 0
      java110-interface/src/main/java/com/java110/intf/store/IStorehouseInnerServiceSMO.java
  11. 20 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  12. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeStorehouseConstant.java
  13. 38 0
      service-api/src/main/java/com/java110/api/bmo/storehouse/IStorehouseBMO.java
  14. 61 0
      service-api/src/main/java/com/java110/api/bmo/storehouse/impl/StorehouseBMOImpl.java
  15. 49 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/DeleteStorehouseListener.java
  16. 82 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/ListStorehousesListener.java
  17. 49 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/SaveStorehouseListener.java
  18. 49 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/UpdateStorehouseListener.java
  19. 81 0
      service-store/src/main/java/com/java110/store/dao/IStorehouseServiceDao.java
  20. 130 0
      service-store/src/main/java/com/java110/store/dao/impl/StorehouseServiceDaoImpl.java
  21. 90 0
      service-store/src/main/java/com/java110/store/listener/storehouse/AbstractStorehouseBusinessServiceDataFlowListener.java
  22. 176 0
      service-store/src/main/java/com/java110/store/listener/storehouse/DeleteStorehouseInfoListener.java
  23. 176 0
      service-store/src/main/java/com/java110/store/listener/storehouse/SaveStorehouseInfoListener.java
  24. 189 0
      service-store/src/main/java/com/java110/store/listener/storehouse/UpdateStorehouseInfoListener.java
  25. 101 0
      service-store/src/main/java/com/java110/store/smo/impl/StorehouseInnerServiceSMOImpl.java

+ 175 - 0
docs/document/services/storehouse/DeleteStorehouseInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStorehouseServiceDao;
+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;
+
+/**
+ * 删除仓库信息 侦听
+ *
+ * 处理节点
+ * 1、businessStorehouse:{} 仓库基本信息节点
+ * 2、businessStorehouseAttr:[{}] 仓库属性信息节点
+ * 3、businessStorehousePhoto:[{}] 仓库照片信息节点
+ * 4、businessStorehouseCerdentials:[{}] 仓库证件信息节点
+ * 协议地址 :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("deleteStorehouseInfoListener")
+@Transactional
+public class DeleteStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteStorehouseInfoListener.class);
+    @Autowired
+    IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_STOREHOUSE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessStorehouse 节点
+            if(data.containsKey(StorehousePo.class.getSimpleName())){
+                Object _obj = data.get(StorehousePo.class.getSimpleName());
+                JSONArray businessStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessStorehouses = new JSONArray();
+                    businessStorehouses.add(_obj);
+                }else {
+                    businessStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+                for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouses.size();_storehouseIndex++) {
+                    JSONObject businessStorehouse = businessStorehouses.getJSONObject(_storehouseIndex);
+                    doBusinessStorehouse(business, businessStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                    }
+                }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfos != null && businessStorehouseInfos.size() >0) {
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_INVALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+                dataFlowContext.addParamOut("shId",businessStorehouseInfo.get("sh_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+
+            //仓库信息
+            List<Map> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessStorehouseInfos == null ||  businessStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(storehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shId 错误,不能自动生成(必须已经存在的shId)"+businessStorehouse);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessStorehouse(business,businessStorehouse);
+    }
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+}

+ 175 - 0
docs/document/services/storehouse/SaveStorehouseInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import com.java110.store.dao.IStorehouseServiceDao;
+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("saveStorehouseInfoListener")
+@Transactional
+public class SaveStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveStorehouseInfoListener.class);
+
+    @Autowired
+    private IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_STOREHOUSE;
+    }
+
+    /**
+     * 保存仓库信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessStorehouse 节点
+        if(data.containsKey(StorehousePo.class.getSimpleName())){
+            Object bObj = data.get(StorehousePo.class.getSimpleName());
+            JSONArray businessStorehouses = null;
+            if(bObj instanceof JSONObject){
+                businessStorehouses = new JSONArray();
+                businessStorehouses.add(bObj);
+            }else {
+                businessStorehouses = (JSONArray)bObj;
+            }
+            //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+            for (int bStorehouseIndex = 0; bStorehouseIndex < businessStorehouses.size();bStorehouseIndex++) {
+                JSONObject businessStorehouse = businessStorehouses.getJSONObject(bStorehouseIndex);
+                doBusinessStorehouse(business, businessStorehouse);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessStorehouseInfo = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfo != null && businessStorehouseInfo.size() >0) {
+            reFreshShareColumn(info, businessStorehouseInfo.get(0));
+            storehouseServiceDaoImpl.saveStorehouseInfoInstance(info);
+            if(businessStorehouseInfo.size() == 1) {
+                dataFlowContext.addParamOut("shId", businessStorehouseInfo.get(0).get("sh_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("storeId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("store_id")) {
+            return;
+        }
+
+        info.put("storeId", businessInfo.get("store_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+            reFreshShareColumn(paramIn, storehouseInfo.get(0));
+            storehouseServiceDaoImpl.updateStorehouseInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            //刷新缓存
+            //flushStorehouseId(business.getDatas());
+
+            businessStorehouse.put("shId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_shId));
+
+        }
+
+        businessStorehouse.put("bId",business.getbId());
+        businessStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库信息
+        storehouseServiceDaoImpl.saveBusinessStorehouseInfo(businessStorehouse);
+
+    }
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+}

+ 188 - 0
docs/document/services/storehouse/UpdateStorehouseInfo.md

@@ -0,0 +1,188 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStorehouseServiceDao;
+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;
+
+/**
+ * 修改仓库信息 侦听
+ *
+ * 处理节点
+ * 1、businessStorehouse:{} 仓库基本信息节点
+ * 2、businessStorehouseAttr:[{}] 仓库属性信息节点
+ * 3、businessStorehousePhoto:[{}] 仓库照片信息节点
+ * 4、businessStorehouseCerdentials:[{}] 仓库证件信息节点
+ * 协议地址 :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("updateStorehouseInfoListener")
+@Transactional
+public class UpdateStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateStorehouseInfoListener.class);
+    @Autowired
+    private IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_STOREHOUSE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessStorehouse 节点
+            if(data.containsKey(StorehousePo.class.getSimpleName())){
+                Object _obj = data.get(StorehousePo.class.getSimpleName());
+                JSONArray businessStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessStorehouses = new JSONArray();
+                    businessStorehouses.add(_obj);
+                }else {
+                    businessStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+                for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouses.size();_storehouseIndex++) {
+                    JSONObject businessStorehouse = businessStorehouses.getJSONObject(_storehouseIndex);
+                    doBusinessStorehouse(business, businessStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                    }
+                }
+            }
+    }
+
+
+    /**
+     * 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> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfos != null && businessStorehouseInfos.size() >0) {
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+                if(businessStorehouseInfo.size() == 1) {
+                    dataFlowContext.addParamOut("shId", businessStorehouseInfo.get("sh_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+
+            //仓库信息
+            List<Map> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessStorehouseInfos == null || businessStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(storehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shId 错误,不能自动生成(必须已经存在的shId)"+businessStorehouse);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessStorehouse(business,businessStorehouse);
+
+        businessStorehouse.put("bId",business.getbId());
+        businessStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库信息
+        storehouseServiceDaoImpl.saveBusinessStorehouseInfo(businessStorehouse);
+
+    }
+
+
+
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+
+
+
+}

+ 83 - 0
java110-bean/src/main/java/com/java110/dto/storehouse/StorehouseDto.java

@@ -0,0 +1,83 @@
+package com.java110.dto.storehouse;
+
+import com.java110.dto.PageDto;
+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 StorehouseDto extends PageDto implements Serializable {
+
+    private String shDesc;
+private String shType;
+private String shObjId;
+private String shId;
+private String shName;
+private String storeId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getShDesc() {
+        return shDesc;
+    }
+public void setShDesc(String shDesc) {
+        this.shDesc = shDesc;
+    }
+public String getShType() {
+        return shType;
+    }
+public void setShType(String shType) {
+        this.shType = shType;
+    }
+public String getShObjId() {
+        return shObjId;
+    }
+public void setShObjId(String shObjId) {
+        this.shObjId = shObjId;
+    }
+public String getShId() {
+        return shId;
+    }
+public void setShId(String shId) {
+        this.shId = shId;
+    }
+public String getShName() {
+        return shName;
+    }
+public void setShName(String shName) {
+        this.shName = shName;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+
+    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;
+    }
+}

+ 53 - 0
java110-bean/src/main/java/com/java110/po/storehouse/StorehousePo.java

@@ -0,0 +1,53 @@
+package com.java110.po.storehouse;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class StorehousePo implements Serializable {
+
+    private String shDesc;
+private String shType;
+private String shObjId;
+private String shId;
+private String shName;
+private String storeId;
+public String getShDesc() {
+        return shDesc;
+    }
+public void setShDesc(String shDesc) {
+        this.shDesc = shDesc;
+    }
+public String getShType() {
+        return shType;
+    }
+public void setShType(String shType) {
+        this.shType = shType;
+    }
+public String getShObjId() {
+        return shObjId;
+    }
+public void setShObjId(String shObjId) {
+        this.shObjId = shObjId;
+    }
+public String getShId() {
+        return shId;
+    }
+public void setShId(String shId) {
+        this.shId = shId;
+    }
+public String getShName() {
+        return shName;
+    }
+public void setShName(String shName) {
+        this.shName = shName;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+
+
+}

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

@@ -189,6 +189,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_authId = "23";
     public static final String CODE_PREFIX_planId = "24";
     public static final String CODE_PREFIX_visitId = "24";
+    public static final String CODE_PREFIX_shId = "25";
 
 
     /**

+ 187 - 0
java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml

@@ -0,0 +1,187 @@
+<?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="storehouseServiceDaoImpl">
+
+    <!-- 保存仓库信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessStorehouseInfo" parameterType="Map">
+           insert into business_storehouse(
+sh_desc,sh_type,sh_obj_id,operate,sh_id,sh_name,b_id,store_id
+) values (
+#{shDesc},#{shType},#{shObjId},#{operate},#{shId},#{shName},#{bId},#{storeId}
+)
+       </insert>
+
+
+       <!-- 查询仓库信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessStorehouseInfo" parameterType="Map" resultType="Map">
+           select  t.sh_desc,t.sh_desc shDesc,t.sh_type,t.sh_type shType,t.sh_obj_id,t.sh_obj_id shObjId,t.operate,t.sh_id,t.sh_id shId,t.sh_name,t.sh_name shName,t.b_id,t.b_id bId,t.store_id,t.store_id storeId 
+from business_storehouse t 
+where 1 =1 
+<if test="shDesc !=null and shDesc != ''">
+   and t.sh_desc= #{shDesc}
+</if> 
+<if test="shType !=null and shType != ''">
+   and t.sh_type= #{shType}
+</if> 
+<if test="shObjId !=null and shObjId != ''">
+   and t.sh_obj_id= #{shObjId}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="shId !=null and shId != ''">
+   and t.sh_id= #{shId}
+</if> 
+<if test="shName !=null and shName != ''">
+   and t.sh_name= #{shName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存仓库信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveStorehouseInfoInstance" parameterType="Map">
+        insert into storehouse(
+sh_desc,sh_type,sh_obj_id,sh_id,status_cd,sh_name,b_id,store_id
+) select t.sh_desc,t.sh_type,t.sh_obj_id,t.sh_id,'0',t.sh_name,t.b_id,t.store_id from business_storehouse t where 1=1
+<if test="shDesc !=null and shDesc != ''">
+   and t.sh_desc= #{shDesc}
+</if> 
+<if test="shType !=null and shType != ''">
+   and t.sh_type= #{shType}
+</if> 
+<if test="shObjId !=null and shObjId != ''">
+   and t.sh_obj_id= #{shObjId}
+</if> 
+   and t.operate= 'ADD'
+<if test="shId !=null and shId != ''">
+   and t.sh_id= #{shId}
+</if> 
+<if test="shName !=null and shName != ''">
+   and t.sh_name= #{shName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询仓库信息 add by wuxw 2018-07-03 -->
+    <select id="getStorehouseInfo" parameterType="Map" resultType="Map">
+        select  t.sh_desc,t.sh_desc shDesc,t.sh_type,t.sh_type shType,t.sh_obj_id,t.sh_obj_id shObjId,t.sh_id,t.sh_id shId,t.status_cd,t.status_cd statusCd,t.sh_name,t.sh_name shName,t.b_id,t.b_id bId,t.store_id,t.store_id storeId 
+from storehouse t 
+where 1 =1 
+<if test="shDesc !=null and shDesc != ''">
+   and t.sh_desc= #{shDesc}
+</if> 
+<if test="shType !=null and shType != ''">
+   and t.sh_type= #{shType}
+</if> 
+<if test="shObjId !=null and shObjId != ''">
+   and t.sh_obj_id= #{shObjId}
+</if> 
+<if test="shId !=null and shId != ''">
+   and t.sh_id= #{shId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="shName !=null and shName != ''">
+   and t.sh_name= #{shName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改仓库信息 add by wuxw 2018-07-03 -->
+    <update id="updateStorehouseInfoInstance" parameterType="Map">
+        update  storehouse t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="shDesc !=null and shDesc != ''">
+, t.sh_desc= #{shDesc}
+</if> 
+<if test="shType !=null and shType != ''">
+, t.sh_type= #{shType}
+</if> 
+<if test="shObjId !=null and shObjId != ''">
+, t.sh_obj_id= #{shObjId}
+</if> 
+<if test="shName !=null and shName != ''">
+, t.sh_name= #{shName}
+</if> 
+<if test="storeId !=null and storeId != ''">
+, t.store_id= #{storeId}
+</if> 
+ where 1=1 <if test="shId !=null and shId != ''">
+and t.sh_id= #{shId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询仓库数量 add by wuxw 2018-07-03 -->
+     <select id="queryStorehousesCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from storehouse t 
+where 1 =1 
+<if test="shDesc !=null and shDesc != ''">
+   and t.sh_desc= #{shDesc}
+</if> 
+<if test="shType !=null and shType != ''">
+   and t.sh_type= #{shType}
+</if> 
+<if test="shObjId !=null and shObjId != ''">
+   and t.sh_obj_id= #{shObjId}
+</if> 
+<if test="shId !=null and shId != ''">
+   and t.sh_id= #{shId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="shName !=null and shName != ''">
+   and t.sh_name= #{shName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 30 - 22
java110-generator/src/main/resources/back/template_1.json

@@ -1,34 +1,42 @@
 {
   "autoMove": true,
-  "id": "attrId",
-  "name": "communityLocationAttr",
-  "desc": "位置属性",
-  "shareParam": "communityId",
-  "shareColumn": "community_id",
-  "shareName": "community",
-  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_LOCATION_ATTR",
-  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_LOCATION_ATTR",
-  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_LOCATION_ATTR",
-  "newBusinessTypeCdValue": "570100030002",
-  "updateBusinessTypeCdValue": "570100040002",
-  "deleteBusinessTypeCdValue": "570100050002",
-  "businessTableName": "business_community_location_attr",
-  "tableName": "community_location_attr",
+  "id": "shId",
+  "name": "storehouse",
+  "desc": "仓库",
+  "shareParam": "storeId",
+  "shareColumn": "store_id",
+  "shareName": "store",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_STOREHOUSE",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_STOREHOUSE",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_STOREHOUSE",
+  "newBusinessTypeCdValue": "671100030004",
+  "updateBusinessTypeCdValue": "671100040004",
+  "deleteBusinessTypeCdValue": "671100050004",
+  "businessTableName": "business_storehouse",
+  "tableName": "storehouse",
   "param": {
-    "communityId": "community_id",
-    "locationId": "location_id",
+    "shId": "sh_id",
+    "shName": "sh_name",
+    "shDesc": "sh_desc",
     "bId": "b_id",
-    "attrId": "attr_id",
-    "specCd": "spec_cd",
-    "value": "value",
-    "createTime": "create_time",
+    "shType": "sh_type",
+    "shObjId": "sh_obj_id",
+    "storeId": "store_id",
     "statusCd": "status_cd",
     "operate": "operate"
   },
   "required": [
     {
-      "code": "specCd",
-      "msg": "属性不能为空"
+      "code": "shName",
+      "msg": "名称不能为空"
+    },
+    {
+      "code": "shType",
+      "msg": "类型不能为空"
+    },
+    {
+      "code": "storeId",
+      "msg": "商户不能为空"
     }
   ]
 }

+ 34 - 44
java110-generator/src/main/resources/web/template_1.json

@@ -1,80 +1,70 @@
 {
-  "templateName": "收款计划",
-  "directories": "admin",
-  "templateCode": "contractCollectionPlan",
-  "templateKey": "planId",
-  "templateKeyName": "计划ID",
-  "searchCode": "planId",
-  "searchName": "计划ID",
+  "templateName": "仓库",
+  "directories": "property",
+  "templateCode": "storehouse",
+  "templateKey": "shId",
+  "templateKeyName": "仓库编号",
+  "searchCode": "shId",
+  "searchName": "仓库编号",
   "conditions": [
     {
-      "name": "计划名称",
+      "name": "仓库名称",
       "inputType": "input",
-      "code": "planName",
+      "code": "shName",
       "whereCondition": "equal"
     },
     {
-      "name": "费用名称",
-      "inputType": "input",
-      "code": "feeName",
+      "name": "仓库类型",
+      "inputType": "select",
+      "selectValue": "2806,2807",
+      "selectValueName": "集团仓库,小区仓库",
+      "code": "shType",
       "whereCondition": "equal"
     },
     {
-      "name": "合同编号",
+      "name": "仓库编号",
       "inputType": "input",
-      "code": "contractCode",
+      "code": "shId",
       "whereCondition": "equal"
     }
   ],
   "columns": [
     {
-      "code": "planName",
-      "cnCode": "计划名称",
-      "desc": "必填,请填写计划名称",
+      "code": "shName",
+      "cnCode": "仓库名称",
+      "desc": "必填,请填写仓库名称",
       "required": true,
       "hasDefaultValue": false,
       "inputType": "input",
       "limit": "maxLength",
-      "limitParam": "128",
-      "limitErrInfo": "计划名称太长",
+      "limitParam": "64",
+      "limitErrInfo": "仓库名称太长",
       "show": true
     },
     {
-      "code": "contractCode",
-      "cnCode": "合同号",
-      "desc": "必填,请填写合同号",
-      "required": true,
-      "hasDefaultValue": false,
-      "inputType": "input",
-      "limit": "maxLength",
-      "limitParam": "30",
-      "limitErrInfo": "合同号格式错误",
-      "show": true
-    },
-    {
-      "code": "feeName",
-      "cnCode": "费用",
-      "desc": "必填,请选择费用",
+      "code": "shType",
+      "cnCode": "仓库类型",
+      "desc": "必填,请选择仓库类型",
       "required": true,
       "hasDefaultValue": false,
       "inputType": "select",
-      "selectValue": "111",
-      "selectValueName": "计划费用",
-      "limit": "maxLength",
-      "limitParam": "128",
-      "limitErrInfo": "费用不正确",
+      "selectValue": "2806,2807",
+      "selectValueName": "集团仓库,小区仓库",
+      "limit": "num",
+      "limitParam": "",
+      "limitErrInfo": "仓库类型格式错误",
       "show": true
     },
     {
-      "code": "remark",
-      "cnCode": "备注",
-      "desc": "选填,请填写备注",
-      "required": false,
+      "code": "shDesc",
+      "cnCode": "描述",
+      "desc": "必填,请填写描述",
+      "required": true,
       "hasDefaultValue": false,
       "inputType": "input",
       "limit": "maxLength",
       "limitParam": "512",
-      "limitErrInfo": "备注太长",
+      "limitErrInfo": "描述太长",
       "show": true
     }
   ]

+ 42 - 0
java110-interface/src/main/java/com/java110/intf/store/IStorehouseInnerServiceSMO.java

@@ -0,0 +1,42 @@
+package com.java110.intf.store;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.storehouse.StorehouseDto;
+import org.springframework.cloud.openfeign.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 IStorehouseInnerServiceSMO
+ * @Description 仓库接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "store-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/storehouseApi")
+public interface IStorehouseInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param storehouseDto 数据对象分享
+     * @return StorehouseDto 对象数据
+     */
+    @RequestMapping(value = "/queryStorehouses", method = RequestMethod.POST)
+    List<StorehouseDto> queryStorehouses(@RequestBody StorehouseDto storehouseDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param storehouseDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryStorehousesCount", method = RequestMethod.POST)
+    int queryStorehousesCount(@RequestBody StorehouseDto storehouseDto);
+}

+ 20 - 0
java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

@@ -1432,4 +1432,24 @@ public class BusinessTypeConstant {
      */
     public static final String BUSINESS_TYPE_DATABUS_SEND_OPEN_LOG = "990000060001";
 
+
+
+    /**
+     *  修改工作流节点 处理员工
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_SAVE_STOREHOUSE="671100030004";
+
+    /**
+     *  修改工作流节点 处理员工
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_UPDATE_STOREHOUSE="671100040004";
+
+    /**
+     * 删除工作流节点 处理员工
+     */
+    public static final String BUSINESS_TYPE_DELETE_STOREHOUSE="671100050004";
+
+
 }

+ 31 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeStorehouseConstant.java

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 仓库常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeStorehouseConstant {
+
+    /**
+     * 添加 仓库
+     */
+    public static final String ADD_STOREHOUSE = "storehouse.saveStorehouse";
+
+
+    /**
+     * 修改 仓库
+     */
+    public static final String UPDATE_STOREHOUSE = "storehouse.updateStorehouse";
+    /**
+     * 删除 仓库
+     */
+    public static final String DELETE_STOREHOUSE = "storehouse.deleteStorehouse";
+
+
+    /**
+     * 查询 仓库
+     */
+    public static final String LIST_STOREHOUSES = "storehouse.listStorehouses";
+
+
+}

+ 38 - 0
service-api/src/main/java/com/java110/api/bmo/storehouse/IStorehouseBMO.java

@@ -0,0 +1,38 @@
+package com.java110.api.bmo.storehouse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.IApiBaseBMO;
+import com.java110.core.context.DataFlowContext;
+
+public interface IStorehouseBMO extends IApiBaseBMO {
+
+
+    /**
+     * 添加仓库
+     * @param paramInJson
+     * @param dataFlowContext
+     * @return
+     */
+     void addStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 添加仓库信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     void updateStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 删除仓库
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     void deleteStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+
+
+}

+ 61 - 0
service-api/src/main/java/com/java110/api/bmo/storehouse/impl/StorehouseBMOImpl.java

@@ -0,0 +1,61 @@
+package com.java110.api.bmo.storehouse.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.storehouse.IStorehouseBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.intf.store.IStorehouseInnerServiceSMO;
+import com.java110.po.storehouse.StorehousePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service("storehouseBMOImpl")
+public class StorehouseBMOImpl extends ApiBaseBMO implements IStorehouseBMO {
+
+    @Autowired
+    private IStorehouseInnerServiceSMO storehouseInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void addStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        paramInJson.put("shId", "-1");
+        StorehousePo storehousePo = BeanConvertUtil.covertBean(paramInJson, StorehousePo.class);
+        super.insert(dataFlowContext, storehousePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_STOREHOUSE);
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void updateStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        StorehousePo storehousePo = BeanConvertUtil.covertBean(paramInJson, StorehousePo.class);
+        super.update(dataFlowContext, storehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_STOREHOUSE);
+    }
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void deleteStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        StorehousePo storehousePo = BeanConvertUtil.covertBean(paramInJson, StorehousePo.class);
+        super.update(dataFlowContext, storehousePo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_STOREHOUSE);
+    }
+
+}

+ 49 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/DeleteStorehouseListener.java

@@ -0,0 +1,49 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.storehouse.IStorehouseBMO;
+import com.java110.api.listener.AbstractServiceApiPlusListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeStorehouseConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+
+
+/**
+ * 保存小区侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("deleteStorehouseListener")
+public class DeleteStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IStorehouseBMO storehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "shId", "shId不能为空");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        storehouseBMOImpl.deleteStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeStorehouseConstant.DELETE_STOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 82 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/ListStorehousesListener.java

@@ -0,0 +1,82 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.dto.storehouse.StorehouseDto;
+import com.java110.intf.store.IStorehouseInnerServiceSMO;
+import com.java110.utils.constant.ServiceCodeStorehouseConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 查询小区侦听类
+ */
+@Java110Listener("listStorehousesListener")
+public class ListStorehousesListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IStorehouseInnerServiceSMO storehouseInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeStorehouseConstant.LIST_STOREHOUSES;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IStorehouseInnerServiceSMO getStorehouseInnerServiceSMOImpl() {
+        return storehouseInnerServiceSMOImpl;
+    }
+
+    public void setStorehouseInnerServiceSMOImpl(IStorehouseInnerServiceSMO storehouseInnerServiceSMOImpl) {
+        this.storehouseInnerServiceSMOImpl = storehouseInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        StorehouseDto storehouseDto = BeanConvertUtil.covertBean(reqJson, StorehouseDto.class);
+
+        int count = storehouseInnerServiceSMOImpl.queryStorehousesCount(storehouseDto);
+
+        List<StorehouseDto> storehouseDtos = null;
+
+        if (count > 0) {
+            storehouseDtos = storehouseInnerServiceSMOImpl.queryStorehouses(storehouseDto);
+        } else {
+            storehouseDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, storehouseDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 49 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/SaveStorehouseListener.java

@@ -0,0 +1,49 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.storehouse.IStorehouseBMO;
+import com.java110.api.listener.AbstractServiceApiPlusListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeStorehouseConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+
+/**
+ * 保存商户侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("saveStorehouseListener")
+public class SaveStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IStorehouseBMO storehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "shName", "请求报文中未包含shName");
+        Assert.hasKeyAndValue(reqJson, "shType", "请求报文中未包含shType");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        storehouseBMOImpl.addStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeStorehouseConstant.ADD_STOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 49 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/UpdateStorehouseListener.java

@@ -0,0 +1,49 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.storehouse.IStorehouseBMO;
+import com.java110.api.listener.AbstractServiceApiPlusListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeStorehouseConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+
+/**
+ * 保存仓库侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("updateStorehouseListener")
+public class UpdateStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IStorehouseBMO storehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "shId", "shId不能为空");
+        Assert.hasKeyAndValue(reqJson, "shName", "请求报文中未包含shName");
+        Assert.hasKeyAndValue(reqJson, "shType", "请求报文中未包含shType");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        storehouseBMOImpl.updateStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeStorehouseConstant.UPDATE_STOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+}

+ 81 - 0
service-store/src/main/java/com/java110/store/dao/IStorehouseServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.store.dao;
+
+
+import com.java110.utils.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 IStorehouseServiceDao {
+
+    /**
+     * 保存 仓库信息
+     * @param businessStorehouseInfo 仓库信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessStorehouseInfo(Map businessStorehouseInfo) throws DAOException;
+
+
+
+    /**
+     * 查询仓库信息(business过程)
+     * 根据bId 查询仓库信息
+     * @param info bId 信息
+     * @return 仓库信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessStorehouseInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 仓库信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveStorehouseInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询仓库信息(instance过程)
+     * 根据bId 查询仓库信息
+     * @param info bId 信息
+     * @return 仓库信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getStorehouseInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改仓库信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateStorehouseInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询仓库总数
+     *
+     * @param info 仓库信息
+     * @return 仓库数量
+     */
+    int queryStorehousesCount(Map info);
+
+}

+ 130 - 0
service-store/src/main/java/com/java110/store/dao/impl/StorehouseServiceDaoImpl.java

@@ -0,0 +1,130 @@
+package com.java110.store.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.store.dao.IStorehouseServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 仓库服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("storehouseServiceDaoImpl")
+//@Transactional
+public class StorehouseServiceDaoImpl extends BaseServiceDao implements IStorehouseServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(StorehouseServiceDaoImpl.class);
+
+    /**
+     * 仓库信息封装
+     * @param businessStorehouseInfo 仓库信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessStorehouseInfo(Map businessStorehouseInfo) throws DAOException {
+        businessStorehouseInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存仓库信息 入参 businessStorehouseInfo : {}",businessStorehouseInfo);
+        int saveFlag = sqlSessionTemplate.insert("storehouseServiceDaoImpl.saveBusinessStorehouseInfo",businessStorehouseInfo);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存仓库数据失败:"+ JSONObject.toJSONString(businessStorehouseInfo));
+        }
+    }
+
+
+    /**
+     * 查询仓库信息
+     * @param info bId 信息
+     * @return 仓库信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessStorehouseInfo(Map info) throws DAOException {
+
+        logger.debug("查询仓库信息 入参 info : {}",info);
+
+        List<Map> businessStorehouseInfos = sqlSessionTemplate.selectList("storehouseServiceDaoImpl.getBusinessStorehouseInfo",info);
+
+        return businessStorehouseInfos;
+    }
+
+
+
+    /**
+     * 保存仓库信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveStorehouseInfoInstance(Map info) throws DAOException {
+        logger.debug("保存仓库信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("storehouseServiceDaoImpl.saveStorehouseInfoInstance",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> getStorehouseInfo(Map info) throws DAOException {
+        logger.debug("查询仓库信息 入参 info : {}",info);
+
+        List<Map> businessStorehouseInfos = sqlSessionTemplate.selectList("storehouseServiceDaoImpl.getStorehouseInfo",info);
+
+        return businessStorehouseInfos;
+    }
+
+
+    /**
+     * 修改仓库信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateStorehouseInfoInstance(Map info) throws DAOException {
+        logger.debug("修改仓库信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("storehouseServiceDaoImpl.updateStorehouseInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改仓库信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询仓库数量
+     * @param info 仓库信息
+     * @return 仓库数量
+     */
+    @Override
+    public int queryStorehousesCount(Map info) {
+        logger.debug("查询仓库数据 入参 info : {}",info);
+
+        List<Map> businessStorehouseInfos = sqlSessionTemplate.selectList("storehouseServiceDaoImpl.queryStorehousesCount", info);
+        if (businessStorehouseInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessStorehouseInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 90 - 0
service-store/src/main/java/com/java110/store/listener/storehouse/AbstractStorehouseBusinessServiceDataFlowListener.java

@@ -0,0 +1,90 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStorehouseServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+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 AbstractStorehouseBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractStorehouseBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IStorehouseServiceDao getStorehouseServiceDaoImpl();
+
+    /**
+     * 刷新 businessStorehouseInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessStorehouseInfo
+     */
+    protected void flushBusinessStorehouseInfo(Map businessStorehouseInfo, String statusCd) {
+        businessStorehouseInfo.put("newBId", businessStorehouseInfo.get("b_id"));
+        businessStorehouseInfo.put("shDesc", businessStorehouseInfo.get("sh_desc"));
+        businessStorehouseInfo.put("shType", businessStorehouseInfo.get("sh_type"));
+        businessStorehouseInfo.put("shObjId", businessStorehouseInfo.get("sh_obj_id"));
+        businessStorehouseInfo.put("operate", businessStorehouseInfo.get("operate"));
+        businessStorehouseInfo.put("shId", businessStorehouseInfo.get("sh_id"));
+        businessStorehouseInfo.put("shName", businessStorehouseInfo.get("sh_name"));
+        businessStorehouseInfo.put("storeId", businessStorehouseInfo.get("store_id"));
+        businessStorehouseInfo.remove("bId");
+        businessStorehouseInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessStorehouse 仓库信息
+     */
+    protected void autoSaveDelBusinessStorehouse(Business business, JSONObject businessStorehouse) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("shId", businessStorehouse.getString("shId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentStorehouseInfos = getStorehouseServiceDaoImpl().getStorehouseInfo(info);
+        if (currentStorehouseInfos == null || currentStorehouseInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentStorehouseInfo = currentStorehouseInfos.get(0);
+
+        currentStorehouseInfo.put("bId", business.getbId());
+
+        currentStorehouseInfo.put("shDesc", currentStorehouseInfo.get("sh_desc"));
+        currentStorehouseInfo.put("shType", currentStorehouseInfo.get("sh_type"));
+        currentStorehouseInfo.put("shObjId", currentStorehouseInfo.get("sh_obj_id"));
+        currentStorehouseInfo.put("operate", currentStorehouseInfo.get("operate"));
+        currentStorehouseInfo.put("shId", currentStorehouseInfo.get("sh_id"));
+        currentStorehouseInfo.put("shName", currentStorehouseInfo.get("sh_name"));
+        currentStorehouseInfo.put("storeId", currentStorehouseInfo.get("store_id"));
+
+
+        currentStorehouseInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getStorehouseServiceDaoImpl().saveBusinessStorehouseInfo(currentStorehouseInfo);
+        for (Object key : currentStorehouseInfo.keySet()) {
+            if (businessStorehouse.get(key) == null) {
+                businessStorehouse.put(key.toString(), currentStorehouseInfo.get(key));
+            }
+        }
+    }
+
+
+}

+ 176 - 0
service-store/src/main/java/com/java110/store/listener/storehouse/DeleteStorehouseInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.storehouse.StorehousePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStorehouseServiceDao;
+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;
+
+/**
+ * 删除仓库信息 侦听
+ *
+ * 处理节点
+ * 1、businessStorehouse:{} 仓库基本信息节点
+ * 2、businessStorehouseAttr:[{}] 仓库属性信息节点
+ * 3、businessStorehousePhoto:[{}] 仓库照片信息节点
+ * 4、businessStorehouseCerdentials:[{}] 仓库证件信息节点
+ * 协议地址 :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("deleteStorehouseInfoListener")
+@Transactional
+public class DeleteStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteStorehouseInfoListener.class);
+    @Autowired
+    IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_STOREHOUSE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessStorehouse 节点
+            if(data.containsKey(StorehousePo.class.getSimpleName())){
+                Object _obj = data.get(StorehousePo.class.getSimpleName());
+                JSONArray businessStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessStorehouses = new JSONArray();
+                    businessStorehouses.add(_obj);
+                }else {
+                    businessStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+                for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouses.size();_storehouseIndex++) {
+                    JSONObject businessStorehouse = businessStorehouses.getJSONObject(_storehouseIndex);
+                    doBusinessStorehouse(business, businessStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                    }
+                }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfos != null && businessStorehouseInfos.size() >0) {
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_INVALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+                dataFlowContext.addParamOut("shId",businessStorehouseInfo.get("sh_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+
+            //仓库信息
+            List<Map> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessStorehouseInfos == null ||  businessStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(storehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shId 错误,不能自动生成(必须已经存在的shId)"+businessStorehouse);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessStorehouse(business,businessStorehouse);
+    }
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+}

+ 176 - 0
service-store/src/main/java/com/java110/store/listener/storehouse/SaveStorehouseInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.storehouse.StorehousePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import com.java110.store.dao.IStorehouseServiceDao;
+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("saveStorehouseInfoListener")
+@Transactional
+public class SaveStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveStorehouseInfoListener.class);
+
+    @Autowired
+    private IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_STOREHOUSE;
+    }
+
+    /**
+     * 保存仓库信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessStorehouse 节点
+        if(data.containsKey(StorehousePo.class.getSimpleName())){
+            Object bObj = data.get(StorehousePo.class.getSimpleName());
+            JSONArray businessStorehouses = null;
+            if(bObj instanceof JSONObject){
+                businessStorehouses = new JSONArray();
+                businessStorehouses.add(bObj);
+            }else {
+                businessStorehouses = (JSONArray)bObj;
+            }
+            //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+            for (int bStorehouseIndex = 0; bStorehouseIndex < businessStorehouses.size();bStorehouseIndex++) {
+                JSONObject businessStorehouse = businessStorehouses.getJSONObject(bStorehouseIndex);
+                doBusinessStorehouse(business, businessStorehouse);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessStorehouseInfo = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfo != null && businessStorehouseInfo.size() >0) {
+            reFreshShareColumn(info, businessStorehouseInfo.get(0));
+            storehouseServiceDaoImpl.saveStorehouseInfoInstance(info);
+            if(businessStorehouseInfo.size() == 1) {
+                dataFlowContext.addParamOut("shId", businessStorehouseInfo.get(0).get("sh_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("storeId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("store_id")) {
+            return;
+        }
+
+        info.put("storeId", businessInfo.get("store_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+            reFreshShareColumn(paramIn, storehouseInfo.get(0));
+            storehouseServiceDaoImpl.updateStorehouseInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            //刷新缓存
+            //flushStorehouseId(business.getDatas());
+
+            businessStorehouse.put("shId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_shId));
+
+        }
+
+        businessStorehouse.put("bId",business.getbId());
+        businessStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库信息
+        storehouseServiceDaoImpl.saveBusinessStorehouseInfo(businessStorehouse);
+
+    }
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+}

+ 189 - 0
service-store/src/main/java/com/java110/store/listener/storehouse/UpdateStorehouseInfoListener.java

@@ -0,0 +1,189 @@
+package com.java110.store.listener.storehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.storehouse.StorehousePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IStorehouseServiceDao;
+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;
+
+/**
+ * 修改仓库信息 侦听
+ *
+ * 处理节点
+ * 1、businessStorehouse:{} 仓库基本信息节点
+ * 2、businessStorehouseAttr:[{}] 仓库属性信息节点
+ * 3、businessStorehousePhoto:[{}] 仓库照片信息节点
+ * 4、businessStorehouseCerdentials:[{}] 仓库证件信息节点
+ * 协议地址 :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("updateStorehouseInfoListener")
+@Transactional
+public class UpdateStorehouseInfoListener extends AbstractStorehouseBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateStorehouseInfoListener.class);
+    @Autowired
+    private IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_STOREHOUSE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessStorehouse 节点
+            if(data.containsKey(StorehousePo.class.getSimpleName())){
+                Object _obj = data.get(StorehousePo.class.getSimpleName());
+                JSONArray businessStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessStorehouses = new JSONArray();
+                    businessStorehouses.add(_obj);
+                }else {
+                    businessStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessStorehouse = data.getJSONObject(StorehousePo.class.getSimpleName());
+                for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouses.size();_storehouseIndex++) {
+                    JSONObject businessStorehouse = businessStorehouses.getJSONObject(_storehouseIndex);
+                    doBusinessStorehouse(business, businessStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("shId", businessStorehouse.getString("shId"));
+                    }
+                }
+            }
+    }
+
+
+    /**
+     * 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> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(info);
+        if( businessStorehouseInfos != null && businessStorehouseInfos.size() >0) {
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+                if(businessStorehouseInfo.size() == 1) {
+                    dataFlowContext.addParamOut("shId", businessStorehouseInfo.get("sh_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> storehouseInfo = storehouseServiceDaoImpl.getStorehouseInfo(info);
+        if(storehouseInfo != null && storehouseInfo.size() > 0){
+
+            //仓库信息
+            List<Map> businessStorehouseInfos = storehouseServiceDaoImpl.getBusinessStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessStorehouseInfos == null || businessStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(storehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _storehouseIndex = 0; _storehouseIndex < businessStorehouseInfos.size();_storehouseIndex++) {
+                Map businessStorehouseInfo = businessStorehouseInfos.get(_storehouseIndex);
+                flushBusinessStorehouseInfo(businessStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                storehouseServiceDaoImpl.updateStorehouseInfoInstance(businessStorehouseInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessStorehouse 仓库节点
+     */
+    private void doBusinessStorehouse(Business business,JSONObject businessStorehouse){
+
+        Assert.jsonObjectHaveKey(businessStorehouse,"shId","businessStorehouse 节点下没有包含 shId 节点");
+
+        if(businessStorehouse.getString("shId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shId 错误,不能自动生成(必须已经存在的shId)"+businessStorehouse);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessStorehouse(business,businessStorehouse);
+
+        businessStorehouse.put("bId",business.getbId());
+        businessStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库信息
+        storehouseServiceDaoImpl.saveBusinessStorehouseInfo(businessStorehouse);
+
+    }
+
+
+
+    @Override
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+
+
+
+}

+ 101 - 0
service-store/src/main/java/com/java110/store/smo/impl/StorehouseInnerServiceSMOImpl.java

@@ -0,0 +1,101 @@
+package com.java110.store.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.storehouse.StorehouseDto;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.store.IStorehouseInnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.store.dao.IStorehouseServiceDao;
+import com.java110.utils.util.BeanConvertUtil;
+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 StorehouseInnerServiceSMOImpl extends BaseServiceSMO implements IStorehouseInnerServiceSMO {
+
+    @Autowired
+    private IStorehouseServiceDao storehouseServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<StorehouseDto> queryStorehouses(@RequestBody StorehouseDto storehouseDto) {
+
+        //校验是否传了 分页信息
+
+        int page = storehouseDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            storehouseDto.setPage((page - 1) * storehouseDto.getRow());
+        }
+
+        List<StorehouseDto> storehouses = BeanConvertUtil.covertBeanList(storehouseServiceDaoImpl.getStorehouseInfo(BeanConvertUtil.beanCovertMap(storehouseDto)), StorehouseDto.class);
+
+        return storehouses;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param storehouse 小区仓库信息
+     * @param users      用户列表
+     */
+    private void refreshStorehouse(StorehouseDto storehouse, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (storehouse.getShId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, storehouse);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param storehouses 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<StorehouseDto> storehouses) {
+        List<String> userIds = new ArrayList<String>();
+        for (StorehouseDto storehouse : storehouses) {
+            userIds.add(storehouse.getShId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryStorehousesCount(@RequestBody StorehouseDto storehouseDto) {
+        return storehouseServiceDaoImpl.queryStorehousesCount(BeanConvertUtil.beanCovertMap(storehouseDto));
+    }
+
+    public IStorehouseServiceDao getStorehouseServiceDaoImpl() {
+        return storehouseServiceDaoImpl;
+    }
+
+    public void setStorehouseServiceDaoImpl(IStorehouseServiceDao storehouseServiceDaoImpl) {
+        this.storehouseServiceDaoImpl = storehouseServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}