java110 5 lat temu
rodzic
commit
0db231806e
28 zmienionych plików z 2414 dodań i 26 usunięć
  1. 175 0
      docs/document/services/allocationStorehouse/DeleteAllocationStorehouseInfo.md
  2. 175 0
      docs/document/services/allocationStorehouse/SaveAllocationStorehouseInfo.md
  3. 188 0
      docs/document/services/allocationStorehouse/UpdateAllocationStorehouseInfo.md
  4. 111 0
      java110-bean/src/main/java/com/java110/dto/allocationStorehouse/AllocationStorehouseDto.java
  5. 11 0
      java110-bean/src/main/java/com/java110/dto/resourceStore/ResourceStoreDto.java
  6. 81 0
      java110-bean/src/main/java/com/java110/po/allocationStorehouse/AllocationStorehousePo.java
  7. 9 0
      java110-bean/src/main/java/com/java110/po/purchase/ResourceStorePo.java
  8. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  9. 249 0
      java110-db/src/main/resources/mapper/store/AllocationStorehouseServiceDaoImplMapper.xml
  10. 15 6
      java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml
  11. 32 20
      java110-generator/src/main/resources/back/template_1.json
  12. 41 0
      java110-interface/src/main/java/com/java110/intf/store/IAllocationStorehouseInnerServiceSMO.java
  13. 18 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  14. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeAllocationStorehouseConstant.java
  15. 38 0
      service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/IAllocationStorehouseBMO.java
  16. 61 0
      service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java
  17. 49 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/DeleteAllocationStorehouseListener.java
  18. 82 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStorehousesListener.java
  19. 51 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/SaveAllocationStorehouseListener.java
  20. 51 0
      service-api/src/main/java/com/java110/api/listener/resourceStore/UpdateAllocationStorehouseListener.java
  21. 81 0
      service-store/src/main/java/com/java110/store/dao/IAllocationStorehouseServiceDao.java
  22. 130 0
      service-store/src/main/java/com/java110/store/dao/impl/AllocationStorehouseServiceDaoImpl.java
  23. 98 0
      service-store/src/main/java/com/java110/store/listener/allocationStorehouse/AbstractAllocationStorehouseBusinessServiceDataFlowListener.java
  24. 176 0
      service-store/src/main/java/com/java110/store/listener/allocationStorehouse/DeleteAllocationStorehouseInfoListener.java
  25. 176 0
      service-store/src/main/java/com/java110/store/listener/allocationStorehouse/SaveAllocationStorehouseInfoListener.java
  26. 190 0
      service-store/src/main/java/com/java110/store/listener/allocationStorehouse/UpdateAllocationStorehouseInfoListener.java
  27. 2 0
      service-store/src/main/java/com/java110/store/listener/resourceStore/AbstractResourceStoreBusinessServiceDataFlowListener.java
  28. 92 0
      service-store/src/main/java/com/java110/store/smo/impl/AllocationStorehouseInnerServiceSMOImpl.java

+ 175 - 0
docs/document/services/allocationStorehouse/DeleteAllocationStorehouseInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.allocationAllocationStorehousehouse;
+
+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.IAllocationStorehouseServiceDao;
+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、businessAllocationStorehouse:{} 仓库调拨基本信息节点
+ * 2、businessAllocationStorehouseAttr:[{}] 仓库调拨属性信息节点
+ * 3、businessAllocationStorehousePhoto:[{}] 仓库调拨照片信息节点
+ * 4、businessAllocationStorehouseCerdentials:[{}] 仓库调拨证件信息节点
+ * 协议地址 :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("deleteAllocationStorehouseInfoListener")
+@Transactional
+public class DeleteAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteAllocationStorehouseInfoListener.class);
+    @Autowired
+    IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessAllocationStorehouse 节点
+            if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+                Object _obj = data.get(AllocationStorehousePo.class.getSimpleName());
+                JSONArray businessAllocationStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessAllocationStorehouses = new JSONArray();
+                    businessAllocationStorehouses.add(_obj);
+                }else {
+                    businessAllocationStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+                for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouses.size();_allocationAllocationStorehousehouseIndex++) {
+                    JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(_allocationAllocationStorehousehouseIndex);
+                    doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                    }
+                }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfos != null && businessAllocationStorehouseInfos.size() >0) {
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_INVALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+                dataFlowContext.addParamOut("allocationAllocationStorehousehouseId",businessAllocationStorehouseInfo.get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+
+            //仓库调拨信息
+            List<Map> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessAllocationStorehouseInfos == null ||  businessAllocationStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(allocationAllocationStorehousehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"allocationAllocationStorehousehouseId 错误,不能自动生成(必须已经存在的allocationAllocationStorehousehouseId)"+businessAllocationStorehouse);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessAllocationStorehouse(business,businessAllocationStorehouse);
+    }
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+}

+ 175 - 0
docs/document/services/allocationStorehouse/SaveAllocationStorehouseInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.allocationAllocationStorehousehouse;
+
+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.IAllocationStorehouseServiceDao;
+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("saveAllocationStorehouseInfoListener")
+@Transactional
+public class SaveAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveAllocationStorehouseInfoListener.class);
+
+    @Autowired
+    private IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * 保存仓库调拨信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessAllocationStorehouse 节点
+        if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+            Object bObj = data.get(AllocationStorehousePo.class.getSimpleName());
+            JSONArray businessAllocationStorehouses = null;
+            if(bObj instanceof JSONObject){
+                businessAllocationStorehouses = new JSONArray();
+                businessAllocationStorehouses.add(bObj);
+            }else {
+                businessAllocationStorehouses = (JSONArray)bObj;
+            }
+            //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+            for (int bAllocationStorehouseIndex = 0; bAllocationStorehouseIndex < businessAllocationStorehouses.size();bAllocationStorehouseIndex++) {
+                JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(bAllocationStorehouseIndex);
+                doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessAllocationStorehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfo != null && businessAllocationStorehouseInfo.size() >0) {
+            reFreshShareColumn(info, businessAllocationStorehouseInfo.get(0));
+            allocationAllocationStorehousehouseServiceDaoImpl.saveAllocationStorehouseInfoInstance(info);
+            if(businessAllocationStorehouseInfo.size() == 1) {
+                dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouseInfo.get(0).get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+            reFreshShareColumn(paramIn, allocationAllocationStorehousehouseInfo.get(0));
+            allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            //刷新缓存
+            //flushAllocationStorehouseId(business.getDatas());
+
+            businessAllocationStorehouse.put("allocationAllocationStorehousehouseId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationAllocationStorehousehouseId));
+
+        }
+
+        businessAllocationStorehouse.put("bId",business.getbId());
+        businessAllocationStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库调拨信息
+        allocationAllocationStorehousehouseServiceDaoImpl.saveBusinessAllocationStorehouseInfo(businessAllocationStorehouse);
+
+    }
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+}

+ 188 - 0
docs/document/services/allocationStorehouse/UpdateAllocationStorehouseInfo.md

@@ -0,0 +1,188 @@
+package com.java110.store.listener.allocationAllocationStorehousehouse;
+
+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.IAllocationStorehouseServiceDao;
+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、businessAllocationStorehouse:{} 仓库调拨基本信息节点
+ * 2、businessAllocationStorehouseAttr:[{}] 仓库调拨属性信息节点
+ * 3、businessAllocationStorehousePhoto:[{}] 仓库调拨照片信息节点
+ * 4、businessAllocationStorehouseCerdentials:[{}] 仓库调拨证件信息节点
+ * 协议地址 :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("updateAllocationStorehouseInfoListener")
+@Transactional
+public class UpdateAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateAllocationStorehouseInfoListener.class);
+    @Autowired
+    private IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessAllocationStorehouse 节点
+            if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+                Object _obj = data.get(AllocationStorehousePo.class.getSimpleName());
+                JSONArray businessAllocationStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessAllocationStorehouses = new JSONArray();
+                    businessAllocationStorehouses.add(_obj);
+                }else {
+                    businessAllocationStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+                for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouses.size();_allocationAllocationStorehousehouseIndex++) {
+                    JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(_allocationAllocationStorehousehouseIndex);
+                    doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                    }
+                }
+            }
+    }
+
+
+    /**
+     * 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> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfos != null && businessAllocationStorehouseInfos.size() >0) {
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+                if(businessAllocationStorehouseInfo.size() == 1) {
+                    dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouseInfo.get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+
+            //仓库调拨信息
+            List<Map> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessAllocationStorehouseInfos == null || businessAllocationStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(allocationAllocationStorehousehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"allocationAllocationStorehousehouseId 错误,不能自动生成(必须已经存在的allocationAllocationStorehousehouseId)"+businessAllocationStorehouse);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessAllocationStorehouse(business,businessAllocationStorehouse);
+
+        businessAllocationStorehouse.put("bId",business.getbId());
+        businessAllocationStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库调拨信息
+        allocationAllocationStorehousehouseServiceDaoImpl.saveBusinessAllocationStorehouseInfo(businessAllocationStorehouse);
+
+    }
+
+
+
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+
+
+}

+ 111 - 0
java110-bean/src/main/java/com/java110/dto/allocationStorehouse/AllocationStorehouseDto.java

@@ -0,0 +1,111 @@
+package com.java110.dto.allocationStorehouse;
+
+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 AllocationStorehouseDto extends PageDto implements Serializable {
+
+    private String asId;
+private String storeId;
+private String resId;
+private String shIdz;
+private String resName;
+private String startUserId;
+private String shIda;
+private String startUserName;
+private String state;
+private String stock;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAsId() {
+        return asId;
+    }
+public void setAsId(String asId) {
+        this.asId = asId;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getResId() {
+        return resId;
+    }
+public void setResId(String resId) {
+        this.resId = resId;
+    }
+public String getShIdz() {
+        return shIdz;
+    }
+public void setShIdz(String shIdz) {
+        this.shIdz = shIdz;
+    }
+public String getResName() {
+        return resName;
+    }
+public void setResName(String resName) {
+        this.resName = resName;
+    }
+public String getStartUserId() {
+        return startUserId;
+    }
+public void setStartUserId(String startUserId) {
+        this.startUserId = startUserId;
+    }
+public String getShIda() {
+        return shIda;
+    }
+public void setShIda(String shIda) {
+        this.shIda = shIda;
+    }
+public String getStartUserName() {
+        return startUserName;
+    }
+public void setStartUserName(String startUserName) {
+        this.startUserName = startUserName;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getStock() {
+        return stock;
+    }
+public void setStock(String stock) {
+        this.stock = stock;
+    }
+
+
+    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;
+    }
+}

+ 11 - 0
java110-bean/src/main/java/com/java110/dto/resourceStore/ResourceStoreDto.java

@@ -41,6 +41,9 @@ public class ResourceStoreDto extends PageDto implements Serializable {
     private String outPrice;
     //手机端是否显示(N否 Y是)
     private String showMobile;
+
+    private String shId;
+
     private List<String> fileUrls;
     private Date createTime;
 
@@ -199,4 +202,12 @@ public class ResourceStoreDto extends PageDto implements Serializable {
     public void setFileUrls(List<String> fileUrls) {
         this.fileUrls = fileUrls;
     }
+
+    public String getShId() {
+        return shId;
+    }
+
+    public void setShId(String shId) {
+        this.shId = shId;
+    }
 }

+ 81 - 0
java110-bean/src/main/java/com/java110/po/allocationStorehouse/AllocationStorehousePo.java

@@ -0,0 +1,81 @@
+package com.java110.po.allocationStorehouse;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class AllocationStorehousePo implements Serializable {
+
+    private String asId;
+private String storeId;
+private String resId;
+private String shIdz;
+private String resName;
+private String startUserId;
+private String shIda;
+private String startUserName;
+private String state;
+private String stock;
+public String getAsId() {
+        return asId;
+    }
+public void setAsId(String asId) {
+        this.asId = asId;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getResId() {
+        return resId;
+    }
+public void setResId(String resId) {
+        this.resId = resId;
+    }
+public String getShIdz() {
+        return shIdz;
+    }
+public void setShIdz(String shIdz) {
+        this.shIdz = shIdz;
+    }
+public String getResName() {
+        return resName;
+    }
+public void setResName(String resName) {
+        this.resName = resName;
+    }
+public String getStartUserId() {
+        return startUserId;
+    }
+public void setStartUserId(String startUserId) {
+        this.startUserId = startUserId;
+    }
+public String getShIda() {
+        return shIda;
+    }
+public void setShIda(String shIda) {
+        this.shIda = shIda;
+    }
+public String getStartUserName() {
+        return startUserName;
+    }
+public void setStartUserName(String startUserName) {
+        this.startUserName = startUserName;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getStock() {
+        return stock;
+    }
+public void setStock(String stock) {
+        this.stock = stock;
+    }
+
+
+
+}

+ 9 - 0
java110-bean/src/main/java/com/java110/po/purchase/ResourceStorePo.java

@@ -28,6 +28,7 @@ public class ResourceStorePo implements Serializable {
     private String outHighPrice;
     private String showMobile;
     private String createTime;
+    private String shId;
     private String bId;
     private List<String> photos;
     private List<String> fileUrls;
@@ -175,4 +176,12 @@ public class ResourceStorePo implements Serializable {
     public void setFileUrls(List<String> fileUrls) {
         this.fileUrls = fileUrls;
     }
+
+    public String getShId() {
+        return shId;
+    }
+
+    public void setShId(String shId) {
+        this.shId = shId;
+    }
 }

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

@@ -190,6 +190,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_planId = "24";
     public static final String CODE_PREFIX_visitId = "24";
     public static final String CODE_PREFIX_shId = "25";
+    public static final String CODE_PREFIX_allocationStorehouseId = "26";
 
 
     /**

+ 249 - 0
java110-db/src/main/resources/mapper/store/AllocationStorehouseServiceDaoImplMapper.xml

@@ -0,0 +1,249 @@
+<?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="allocationStorehouseServiceDaoImpl">
+
+    <!-- 保存仓库调拨信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessAllocationStorehouseInfo" parameterType="Map">
+        insert into business_allocation_storehouse(
+        as_id,store_id,res_id,sh_id_z,res_name,start_user_id,operate,sh_id_a,start_user_name,state,b_id,stock
+        ) values (
+        #{asId},#{storeId},#{resId},#{shIdz},#{resName},#{startUserId},#{operate},#{shIda},#{startUserName},#{state},#{bId},#{stock}
+        )
+    </insert>
+
+
+    <!-- 查询仓库调拨信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessAllocationStorehouseInfo" parameterType="Map" resultType="Map">
+        select t.as_id,t.as_id asId,t.store_id,t.store_id storeId,t.res_id,t.res_id resId,t.sh_id_z,t.sh_id_z
+        shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id startUserId,t.operate,t.sh_id_a,t.sh_id_a
+        shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id bId,t.stock
+        from business_allocation_storehouse t
+        where 1 =1
+        <if test="asId !=null and asId != ''">
+            and t.as_id= #{asId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="shIdz !=null and shIdz != ''">
+            and t.sh_id_z= #{shIdz}
+        </if>
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="shIda !=null and shIda != ''">
+            and t.sh_id_a= #{shIda}
+        </if>
+        <if test="startUserName !=null and startUserName != ''">
+            and t.start_user_name= #{startUserName}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </if>
+
+    </select>
+
+
+    <!-- 保存仓库调拨信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveAllocationStorehouseInfoInstance" parameterType="Map">
+        insert into allocation_storehouse(
+        as_id,status_cd,store_id,res_id,sh_id_z,res_name,start_user_id,sh_id_a,start_user_name,state,b_id,stock
+        ) select
+        t.as_id,'0',t.store_id,t.res_id,t.sh_id_z,t.res_name,t.start_user_id,t.sh_id_a,t.start_user_name,t.state,t.b_id,t.stock
+        from business_allocation_storehouse t where 1=1
+        <if test="asId !=null and asId != ''">
+            and t.as_id= #{asId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="shIdz !=null and shIdz != ''">
+            and t.sh_id_z= #{shIdz}
+        </if>
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        and t.operate= 'ADD'
+        <if test="shIda !=null and shIda != ''">
+            and t.sh_id_a= #{shIda}
+        </if>
+        <if test="startUserName !=null and startUserName != ''">
+            and t.start_user_name= #{startUserName}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </if>
+
+    </insert>
+
+
+    <!-- 查询仓库调拨信息 add by wuxw 2018-07-03 -->
+    <select id="getAllocationStorehouseInfo" parameterType="Map" resultType="Map">
+        select t.as_id,t.as_id asId,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId,t.res_id,t.res_id
+        resId,t.sh_id_z,t.sh_id_z shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id
+        startUserId,t.sh_id_a,t.sh_id_a shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id
+        bId,t.stock
+        from allocation_storehouse t
+        where 1 =1
+        <if test="asId !=null and asId != ''">
+            and t.as_id= #{asId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="shIdz !=null and shIdz != ''">
+            and t.sh_id_z= #{shIdz}
+        </if>
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        <if test="shIda !=null and shIda != ''">
+            and t.sh_id_a= #{shIda}
+        </if>
+        <if test="startUserName !=null and startUserName != ''">
+            and t.start_user_name= #{startUserName}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </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="updateAllocationStorehouseInfoInstance" parameterType="Map">
+        update allocation_storehouse t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            , t.res_id= #{resId}
+        </if>
+        <if test="shIdz !=null and shIdz != ''">
+            , t.sh_id_z= #{shIdz}
+        </if>
+        <if test="resName !=null and resName != ''">
+            , t.res_name= #{resName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            , t.start_user_id= #{startUserId}
+        </if>
+        <if test="shIda !=null and shIda != ''">
+            , t.sh_id_a= #{shIda}
+        </if>
+        <if test="startUserName !=null and startUserName != ''">
+            , t.start_user_name= #{startUserName}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="stock !=null and stock != ''">
+            , t.stock= #{stock}
+        </if>
+        where 1=1
+        <if test="asId !=null and asId != ''">
+            and t.as_id= #{asId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+
+    </update>
+
+    <!-- 查询仓库调拨数量 add by wuxw 2018-07-03 -->
+    <select id="queryAllocationStorehousesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from allocation_storehouse t
+        where 1 =1
+        <if test="asId !=null and asId != ''">
+            and t.as_id= #{asId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="shIdz !=null and shIdz != ''">
+            and t.sh_id_z= #{shIdz}
+        </if>
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="startUserId !=null and startUserId != ''">
+            and t.start_user_id= #{startUserId}
+        </if>
+        <if test="shIda !=null and shIda != ''">
+            and t.sh_id_a= #{shIda}
+        </if>
+        <if test="startUserName !=null and startUserName != ''">
+            and t.start_user_name= #{startUserName}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 15 - 6
java110-db/src/main/resources/mapper/store/ResourceStoreServiceDaoImplMapper.xml

@@ -8,10 +8,10 @@
     <insert id="saveBusinessResourceStoreInfo" parameterType="Map">
         insert into business_resource_store(
         res_name,operate,price,res_code,description,store_id,stock,b_id,res_id,goods_type,
-        unit_code,remark,out_low_price,out_high_price,show_mobile,create_time
+        unit_code,remark,out_low_price,out_high_price,show_mobile,create_time,sh_id
         ) values (
         #{resName},#{operate},#{price},#{resCode},#{description},#{storeId},#{stock},#{bId},#{resId},
-        #{goodsType},#{unitCode},#{remark},#{outLowPrice},#{outHighPrice},#{showMobile},#{createTime}
+        #{goodsType},#{unitCode},#{remark},#{outLowPrice},#{outHighPrice},#{showMobile},#{createTime},#{shId}
         )
     </insert>
 
@@ -21,7 +21,7 @@
         resCode,t.description,t.store_id,t.store_id storeId,t.stock,t.b_id,t.b_id bId,t.res_id,t.res_id resId,
         t.goods_type,t.goods_type goodsType,t.unit_code,t.unit_code unitCode,t.remark,
         t.out_low_price,t.out_low_price outLowPrice,t.out_high_price,t.out_high_price outHighPrice,
-        t.show_mobile,t.show_mobile showMobile,t.create_time,t.create_time createTime
+        t.show_mobile,t.show_mobile showMobile,t.create_time,t.create_time createTime,t.sh_id,t.sh_id shId
         from business_resource_store t
         where 1 =1
         <if test="resName !=null and resName != ''">
@@ -78,9 +78,9 @@
     <insert id="saveResourceStoreInfoInstance" parameterType="Map">
         insert into resource_store(
         res_name,price,res_code,description,status_cd,store_id,stock,b_id,res_id,goods_type,unit_code,remark,
-        out_low_price,out_high_price,show_mobile,create_time
+        out_low_price,out_high_price,show_mobile,create_time,sh_id
         ) select t.res_name,t.price,t.res_code,t.description,'0',t.store_id,t.stock,t.b_id,t.res_id,t.goods_type,
-        t.unit_code,t.remark,t.out_low_price,t.out_high_price,t.show_mobile,t.create_time from
+        t.unit_code,t.remark,t.out_low_price,t.out_high_price,t.show_mobile,t.create_time,t.sh_id from
         business_resource_store t where 1=1
         <if test="resName !=null and resName != ''">
             and t.res_name= #{resName}
@@ -136,7 +136,7 @@
         statusCd,t.store_id,t.store_id storeId,t.stock,t.b_id,t.b_id bId,t.res_id,t.res_id resId,t.out_low_price,
         t.out_low_price outLowPrice,td.name goodsTypeName,t.out_high_price,t.out_high_price outHighPrice,t.goods_type,
         t.goods_type goodsType,t.unit_code,t.unit_code unitCode,t.remark,t.show_mobile,t.show_mobile showMobile,
-        t.create_time,t.create_time createTime
+        t.create_time,t.create_time createTime,t.sh_id,t.sh_id shId
         from resource_store t
         left join t_dict td on t.goods_type = td.status_cd
         and td.table_name = 'resource_store' and td.table_columns ='goods_type'
@@ -183,6 +183,9 @@
         <if test="resId !=null and resId != ''">
             and t.res_id= #{resId}
         </if>
+        <if test="shId !=null and shId != ''">
+            and t.sh_id= #{shId}
+        </if>
         <if test="showMobile != null and showMobile != ''">
             and t.show_mobile = #{showMobile}
         </if>
@@ -237,6 +240,9 @@
         <if test="stock !=null and stock != ''">
             , t.stock= #{stock}
         </if>
+        <if test="shId !=null and shId != ''">
+            , t.sh_id= #{shId}
+        </if>
         where 1=1
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -296,6 +302,9 @@
         <if test="showMobile !=null and showMobile != ''">
             and t.show_mobile= #{showMobile}
         </if>
+        <if test="shId !=null and shId != ''">
+            and t.sh_id= #{shId}
+        </if>
         <if test="resOrderType == '20000'">
             and t.stock > 0
         </if>

+ 32 - 20
java110-generator/src/main/resources/back/template_1.json

@@ -1,38 +1,50 @@
 {
   "autoMove": true,
-  "id": "shId",
-  "name": "storehouse",
-  "desc": "仓库",
+  "id": "asId",
+  "name": "allocationStorehouse",
+  "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",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE",
+  "newBusinessTypeCdValue": "671100030005",
+  "updateBusinessTypeCdValue": "671100040005",
+  "deleteBusinessTypeCdValue": "671100050005",
+  "businessTableName": "business_allocation_storehouse",
+  "tableName": "allocation_storehouse",
   "param": {
-    "shId": "sh_id",
-    "shName": "sh_name",
-    "shDesc": "sh_desc",
+    "asId": "as_id",
+    "shIda": "sh_id_a",
+    "shIdz": "sh_id_z",
     "bId": "b_id",
-    "shType": "sh_type",
-    "shObjId": "sh_obj_id",
+    "resId": "res_id",
+    "resName": "res_name",
     "storeId": "store_id",
+    "stock": "stock",
+    "state": "state",
+    "startUserId": "start_user_id",
+    "startUserName": "start_user_name",
     "statusCd": "status_cd",
     "operate": "operate"
   },
   "required": [
     {
-      "code": "shName",
-      "msg": "名称不能为空"
+      "code": "shIda",
+      "msg": "a端不能为空"
     },
     {
-      "code": "shType",
-      "msg": "类型不能为空"
+      "code": "shIdz",
+      "msg": "z端不能为空"
+    },
+    {
+      "code": "resId",
+      "msg": "物品不能为空"
+    },
+    {
+      "code": "stock",
+      "msg": "数量不能为空"
     },
     {
       "code": "storeId",

+ 41 - 0
java110-interface/src/main/java/com/java110/intf/store/IAllocationStorehouseInnerServiceSMO.java

@@ -0,0 +1,41 @@
+package com.java110.intf.store;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
+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 IAllocationStorehouseInnerServiceSMO
+ * @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("/allocationStorehouseApi")
+public interface IAllocationStorehouseInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param allocationStorehouseDto 数据对象分享
+     * @return AllocationStorehouseDto 对象数据
+     */
+    @RequestMapping(value = "/queryAllocationStorehouses", method = RequestMethod.POST)
+    List<AllocationStorehouseDto> queryAllocationStorehouses(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param allocationStorehouseDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryAllocationStorehousesCount", method = RequestMethod.POST)
+    int queryAllocationStorehousesCount(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
+}

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

@@ -1452,4 +1452,22 @@ public class BusinessTypeConstant {
     public static final String BUSINESS_TYPE_DELETE_STOREHOUSE="671100050004";
 
 
+    /**
+     *  修改工作流节点 处理员工
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE="671100030005";
+
+    /**
+     *  修改工作流节点 处理员工
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE="671100040005";
+
+    /**
+     * 删除工作流节点 处理员工
+     */
+    public static final String BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE="671100050005";
+
+
 }

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

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 仓库调拨常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeAllocationStorehouseConstant {
+
+    /**
+     * 添加 仓库调拨
+     */
+    public static final String ADD_ALLOCATIONSTOREHOUSE = "allocationStorehouse.saveAllocationStorehouse";
+
+
+    /**
+     * 修改 仓库调拨
+     */
+    public static final String UPDATE_ALLOCATIONSTOREHOUSE = "allocationStorehouse.updateAllocationStorehouse";
+    /**
+     * 删除 仓库调拨
+     */
+    public static final String DELETE_ALLOCATIONSTOREHOUSE = "allocationStorehouse.deleteAllocationStorehouse";
+
+
+    /**
+     * 查询 仓库调拨
+     */
+    public static final String LIST_ALLOCATIONSTOREHOUSES = "allocationStorehouse.listAllocationStorehouses";
+
+
+}

+ 38 - 0
service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/IAllocationStorehouseBMO.java

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

+ 61 - 0
service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java

@@ -0,0 +1,61 @@
+package com.java110.api.bmo.allocationStorehouse.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
+import com.java110.po.allocationStorehouse.AllocationStorehousePo;
+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("allocationStorehouseBMOImpl")
+public class AllocationStorehouseBMOImpl extends ApiBaseBMO implements IAllocationStorehouseBMO {
+
+    @Autowired
+    private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void addAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        paramInJson.put("asId", "-1");
+        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
+        super.insert(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE);
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void updateAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
+        super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE);
+    }
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void deleteAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
+        super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE);
+    }
+
+}

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

@@ -0,0 +1,49 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
+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.ServiceCodeAllocationStorehouseConstant;
+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("deleteAllocationStorehouseListener")
+public class DeleteAllocationStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IAllocationStorehouseBMO allocationStorehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "asId", "asId不能为空");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        allocationStorehouseBMOImpl.deleteAllocationStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeAllocationStorehouseConstant.DELETE_ALLOCATIONSTOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 82 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStorehousesListener.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.allocationStorehouse.AllocationStorehouseDto;
+import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
+import com.java110.utils.constant.ServiceCodeAllocationStorehouseConstant;
+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("listAllocationStorehousesListener")
+public class ListAllocationStorehousesListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeAllocationStorehouseConstant.LIST_ALLOCATIONSTOREHOUSES;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IAllocationStorehouseInnerServiceSMO getAllocationStorehouseInnerServiceSMOImpl() {
+        return allocationStorehouseInnerServiceSMOImpl;
+    }
+
+    public void setAllocationStorehouseInnerServiceSMOImpl(IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl) {
+        this.allocationStorehouseInnerServiceSMOImpl = allocationStorehouseInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        AllocationStorehouseDto allocationStorehouseDto = BeanConvertUtil.covertBean(reqJson, AllocationStorehouseDto.class);
+
+        int count = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehousesCount(allocationStorehouseDto);
+
+        List<AllocationStorehouseDto> allocationStorehouseDtos = null;
+
+        if (count > 0) {
+            allocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
+        } else {
+            allocationStorehouseDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, allocationStorehouseDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 51 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/SaveAllocationStorehouseListener.java

@@ -0,0 +1,51 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
+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.ServiceCodeAllocationStorehouseConstant;
+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("saveAllocationStorehouseListener")
+public class SaveAllocationStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IAllocationStorehouseBMO allocationStorehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "shIda", "请求报文中未包含shIda");
+        Assert.hasKeyAndValue(reqJson, "shIdz", "请求报文中未包含shIdz");
+        Assert.hasKeyAndValue(reqJson, "resId", "请求报文中未包含resId");
+        Assert.hasKeyAndValue(reqJson, "stock", "请求报文中未包含stock");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        allocationStorehouseBMOImpl.addAllocationStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeAllocationStorehouseConstant.ADD_ALLOCATIONSTOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 51 - 0
service-api/src/main/java/com/java110/api/listener/resourceStore/UpdateAllocationStorehouseListener.java

@@ -0,0 +1,51 @@
+package com.java110.api.listener.resourceStore;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
+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.ServiceCodeAllocationStorehouseConstant;
+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("updateAllocationStorehouseListener")
+public class UpdateAllocationStorehouseListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IAllocationStorehouseBMO allocationStorehouseBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "asId", "asId不能为空");
+        Assert.hasKeyAndValue(reqJson, "shIda", "请求报文中未包含shIda");
+        Assert.hasKeyAndValue(reqJson, "shIdz", "请求报文中未包含shIdz");
+        Assert.hasKeyAndValue(reqJson, "resId", "请求报文中未包含resId");
+        Assert.hasKeyAndValue(reqJson, "stock", "请求报文中未包含stock");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        allocationStorehouseBMOImpl.updateAllocationStorehouse(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeAllocationStorehouseConstant.UPDATE_ALLOCATIONSTOREHOUSE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+}

+ 81 - 0
service-store/src/main/java/com/java110/store/dao/IAllocationStorehouseServiceDao.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 IAllocationStorehouseServiceDao {
+
+    /**
+     * 保存 仓库调拨信息
+     * @param businessAllocationStorehouseInfo 仓库调拨信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessAllocationStorehouseInfo(Map businessAllocationStorehouseInfo) throws DAOException;
+
+
+
+    /**
+     * 查询仓库调拨信息(business过程)
+     * 根据bId 查询仓库调拨信息
+     * @param info bId 信息
+     * @return 仓库调拨信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessAllocationStorehouseInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 仓库调拨信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveAllocationStorehouseInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询仓库调拨信息(instance过程)
+     * 根据bId 查询仓库调拨信息
+     * @param info bId 信息
+     * @return 仓库调拨信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getAllocationStorehouseInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改仓库调拨信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateAllocationStorehouseInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询仓库调拨总数
+     *
+     * @param info 仓库调拨信息
+     * @return 仓库调拨数量
+     */
+    int queryAllocationStorehousesCount(Map info);
+
+}

+ 130 - 0
service-store/src/main/java/com/java110/store/dao/impl/AllocationStorehouseServiceDaoImpl.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.IAllocationStorehouseServiceDao;
+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("allocationStorehouseServiceDaoImpl")
+//@Transactional
+public class AllocationStorehouseServiceDaoImpl extends BaseServiceDao implements IAllocationStorehouseServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(AllocationStorehouseServiceDaoImpl.class);
+
+    /**
+     * 仓库调拨信息封装
+     * @param businessAllocationStorehouseInfo 仓库调拨信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessAllocationStorehouseInfo(Map businessAllocationStorehouseInfo) throws DAOException {
+        businessAllocationStorehouseInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存仓库调拨信息 入参 businessAllocationStorehouseInfo : {}",businessAllocationStorehouseInfo);
+        int saveFlag = sqlSessionTemplate.insert("allocationStorehouseServiceDaoImpl.saveBusinessAllocationStorehouseInfo",businessAllocationStorehouseInfo);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存仓库调拨数据失败:"+ JSONObject.toJSONString(businessAllocationStorehouseInfo));
+        }
+    }
+
+
+    /**
+     * 查询仓库调拨信息
+     * @param info bId 信息
+     * @return 仓库调拨信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessAllocationStorehouseInfo(Map info) throws DAOException {
+
+        logger.debug("查询仓库调拨信息 入参 info : {}",info);
+
+        List<Map> businessAllocationStorehouseInfos = sqlSessionTemplate.selectList("allocationStorehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo",info);
+
+        return businessAllocationStorehouseInfos;
+    }
+
+
+
+    /**
+     * 保存仓库调拨信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveAllocationStorehouseInfoInstance(Map info) throws DAOException {
+        logger.debug("保存仓库调拨信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("allocationStorehouseServiceDaoImpl.saveAllocationStorehouseInfoInstance",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> getAllocationStorehouseInfo(Map info) throws DAOException {
+        logger.debug("查询仓库调拨信息 入参 info : {}",info);
+
+        List<Map> businessAllocationStorehouseInfos = sqlSessionTemplate.selectList("allocationStorehouseServiceDaoImpl.getAllocationStorehouseInfo",info);
+
+        return businessAllocationStorehouseInfos;
+    }
+
+
+    /**
+     * 修改仓库调拨信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateAllocationStorehouseInfoInstance(Map info) throws DAOException {
+        logger.debug("修改仓库调拨信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("allocationStorehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改仓库调拨信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询仓库调拨数量
+     * @param info 仓库调拨信息
+     * @return 仓库调拨数量
+     */
+    @Override
+    public int queryAllocationStorehousesCount(Map info) {
+        logger.debug("查询仓库调拨数据 入参 info : {}",info);
+
+        List<Map> businessAllocationStorehouseInfos = sqlSessionTemplate.selectList("allocationStorehouseServiceDaoImpl.queryAllocationStorehousesCount", info);
+        if (businessAllocationStorehouseInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessAllocationStorehouseInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 98 - 0
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/AbstractAllocationStorehouseBusinessServiceDataFlowListener.java

@@ -0,0 +1,98 @@
+package com.java110.store.listener.allocationStorehouse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IAllocationStorehouseServiceDao;
+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 AbstractAllocationStorehouseBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractAllocationStorehouseBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl();
+
+    /**
+     * 刷新 businessAllocationStorehouseInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessAllocationStorehouseInfo
+     */
+    protected void flushBusinessAllocationStorehouseInfo(Map businessAllocationStorehouseInfo, String statusCd) {
+        businessAllocationStorehouseInfo.put("newBId", businessAllocationStorehouseInfo.get("b_id"));
+        businessAllocationStorehouseInfo.put("asId", businessAllocationStorehouseInfo.get("as_id"));
+        businessAllocationStorehouseInfo.put("storeId", businessAllocationStorehouseInfo.get("store_id"));
+        businessAllocationStorehouseInfo.put("resId", businessAllocationStorehouseInfo.get("res_id"));
+        businessAllocationStorehouseInfo.put("shIdz", businessAllocationStorehouseInfo.get("sh_id_z"));
+        businessAllocationStorehouseInfo.put("resName", businessAllocationStorehouseInfo.get("res_name"));
+        businessAllocationStorehouseInfo.put("startUserId", businessAllocationStorehouseInfo.get("start_user_id"));
+        businessAllocationStorehouseInfo.put("operate", businessAllocationStorehouseInfo.get("operate"));
+        businessAllocationStorehouseInfo.put("shIda", businessAllocationStorehouseInfo.get("sh_id_a"));
+        businessAllocationStorehouseInfo.put("startUserName", businessAllocationStorehouseInfo.get("start_user_name"));
+        businessAllocationStorehouseInfo.put("state", businessAllocationStorehouseInfo.get("state"));
+        businessAllocationStorehouseInfo.put("stock", businessAllocationStorehouseInfo.get("stock"));
+        businessAllocationStorehouseInfo.remove("bId");
+        businessAllocationStorehouseInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessAllocationStorehouse 仓库调拨信息
+     */
+    protected void autoSaveDelBusinessAllocationStorehouse(Business business, JSONObject businessAllocationStorehouse) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentAllocationStorehouseInfos = getAllocationStorehouseServiceDaoImpl().getAllocationStorehouseInfo(info);
+        if (currentAllocationStorehouseInfos == null || currentAllocationStorehouseInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentAllocationStorehouseInfo = currentAllocationStorehouseInfos.get(0);
+
+        currentAllocationStorehouseInfo.put("bId", business.getbId());
+
+        currentAllocationStorehouseInfo.put("asId", currentAllocationStorehouseInfo.get("as_id"));
+        currentAllocationStorehouseInfo.put("storeId", currentAllocationStorehouseInfo.get("store_id"));
+        currentAllocationStorehouseInfo.put("resId", currentAllocationStorehouseInfo.get("res_id"));
+        currentAllocationStorehouseInfo.put("shIdz", currentAllocationStorehouseInfo.get("sh_id_z"));
+        currentAllocationStorehouseInfo.put("resName", currentAllocationStorehouseInfo.get("res_name"));
+        currentAllocationStorehouseInfo.put("startUserId", currentAllocationStorehouseInfo.get("start_user_id"));
+        currentAllocationStorehouseInfo.put("operate", currentAllocationStorehouseInfo.get("operate"));
+        currentAllocationStorehouseInfo.put("shIda", currentAllocationStorehouseInfo.get("sh_id_a"));
+        currentAllocationStorehouseInfo.put("startUserName", currentAllocationStorehouseInfo.get("start_user_name"));
+        currentAllocationStorehouseInfo.put("state", currentAllocationStorehouseInfo.get("state"));
+        currentAllocationStorehouseInfo.put("stock", currentAllocationStorehouseInfo.get("stock"));
+
+
+        currentAllocationStorehouseInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getAllocationStorehouseServiceDaoImpl().saveBusinessAllocationStorehouseInfo(currentAllocationStorehouseInfo);
+        for (Object key : currentAllocationStorehouseInfo.keySet()) {
+            if (businessAllocationStorehouse.get(key) == null) {
+                businessAllocationStorehouse.put(key.toString(), currentAllocationStorehouseInfo.get(key));
+            }
+        }
+    }
+
+
+}

+ 176 - 0
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/DeleteAllocationStorehouseInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.store.listener.allocationStorehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.allocationStorehouse.AllocationStorehousePo;
+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.IAllocationStorehouseServiceDao;
+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、businessAllocationStorehouse:{} 仓库调拨基本信息节点
+ * 2、businessAllocationStorehouseAttr:[{}] 仓库调拨属性信息节点
+ * 3、businessAllocationStorehousePhoto:[{}] 仓库调拨照片信息节点
+ * 4、businessAllocationStorehouseCerdentials:[{}] 仓库调拨证件信息节点
+ * 协议地址 :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("deleteAllocationStorehouseInfoListener")
+@Transactional
+public class DeleteAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteAllocationStorehouseInfoListener.class);
+    @Autowired
+    IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessAllocationStorehouse 节点
+            if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+                Object _obj = data.get(AllocationStorehousePo.class.getSimpleName());
+                JSONArray businessAllocationStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessAllocationStorehouses = new JSONArray();
+                    businessAllocationStorehouses.add(_obj);
+                }else {
+                    businessAllocationStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+                for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouses.size();_allocationAllocationStorehousehouseIndex++) {
+                    JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(_allocationAllocationStorehousehouseIndex);
+                    doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                    }
+                }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfos != null && businessAllocationStorehouseInfos.size() >0) {
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_INVALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+                dataFlowContext.addParamOut("allocationAllocationStorehousehouseId",businessAllocationStorehouseInfo.get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+
+            //仓库调拨信息
+            List<Map> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessAllocationStorehouseInfos == null ||  businessAllocationStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(allocationAllocationStorehousehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"allocationAllocationStorehousehouseId 错误,不能自动生成(必须已经存在的allocationAllocationStorehousehouseId)"+businessAllocationStorehouse);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessAllocationStorehouse(business,businessAllocationStorehouse);
+    }
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+}

+ 176 - 0
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/SaveAllocationStorehouseInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.store.listener.allocationStorehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.allocationStorehouse.AllocationStorehousePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import com.java110.store.dao.IAllocationStorehouseServiceDao;
+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("saveAllocationStorehouseInfoListener")
+@Transactional
+public class SaveAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveAllocationStorehouseInfoListener.class);
+
+    @Autowired
+    private IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * 保存仓库调拨信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessAllocationStorehouse 节点
+        if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+            Object bObj = data.get(AllocationStorehousePo.class.getSimpleName());
+            JSONArray businessAllocationStorehouses = null;
+            if(bObj instanceof JSONObject){
+                businessAllocationStorehouses = new JSONArray();
+                businessAllocationStorehouses.add(bObj);
+            }else {
+                businessAllocationStorehouses = (JSONArray)bObj;
+            }
+            //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+            for (int bAllocationStorehouseIndex = 0; bAllocationStorehouseIndex < businessAllocationStorehouses.size();bAllocationStorehouseIndex++) {
+                JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(bAllocationStorehouseIndex);
+                doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessAllocationStorehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfo != null && businessAllocationStorehouseInfo.size() >0) {
+            reFreshShareColumn(info, businessAllocationStorehouseInfo.get(0));
+            allocationAllocationStorehousehouseServiceDaoImpl.saveAllocationStorehouseInfoInstance(info);
+            if(businessAllocationStorehouseInfo.size() == 1) {
+                dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouseInfo.get(0).get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+            reFreshShareColumn(paramIn, allocationAllocationStorehousehouseInfo.get(0));
+            allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            //刷新缓存
+            //flushAllocationStorehouseId(business.getDatas());
+
+            businessAllocationStorehouse.put("allocationAllocationStorehousehouseId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId));
+
+        }
+
+        businessAllocationStorehouse.put("bId",business.getbId());
+        businessAllocationStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库调拨信息
+        allocationAllocationStorehousehouseServiceDaoImpl.saveBusinessAllocationStorehouseInfo(businessAllocationStorehouse);
+
+    }
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+}

+ 190 - 0
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/UpdateAllocationStorehouseInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.store.listener.allocationStorehouse;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.allocationStorehouse.AllocationStorehousePo;
+import com.java110.store.listener.allocationStorehouse.AbstractAllocationStorehouseBusinessServiceDataFlowListener;
+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.IAllocationStorehouseServiceDao;
+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、businessAllocationStorehouse:{} 仓库调拨基本信息节点
+ * 2、businessAllocationStorehouseAttr:[{}] 仓库调拨属性信息节点
+ * 3、businessAllocationStorehousePhoto:[{}] 仓库调拨照片信息节点
+ * 4、businessAllocationStorehouseCerdentials:[{}] 仓库调拨证件信息节点
+ * 协议地址 :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("updateAllocationStorehouseInfoListener")
+@Transactional
+public class UpdateAllocationStorehouseInfoListener extends AbstractAllocationStorehouseBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateAllocationStorehouseInfoListener.class);
+    @Autowired
+    private IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessAllocationStorehouse 节点
+            if(data.containsKey(AllocationStorehousePo.class.getSimpleName())){
+                Object _obj = data.get(AllocationStorehousePo.class.getSimpleName());
+                JSONArray businessAllocationStorehouses = null;
+                if(_obj instanceof JSONObject){
+                    businessAllocationStorehouses = new JSONArray();
+                    businessAllocationStorehouses.add(_obj);
+                }else {
+                    businessAllocationStorehouses = (JSONArray)_obj;
+                }
+                //JSONObject businessAllocationStorehouse = data.getJSONObject(AllocationStorehousePo.class.getSimpleName());
+                for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouses.size();_allocationAllocationStorehousehouseIndex++) {
+                    JSONObject businessAllocationStorehouse = businessAllocationStorehouses.getJSONObject(_allocationAllocationStorehousehouseIndex);
+                    doBusinessAllocationStorehouse(business, businessAllocationStorehouse);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId"));
+                    }
+                }
+            }
+    }
+
+
+    /**
+     * 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> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(info);
+        if( businessAllocationStorehouseInfos != null && businessAllocationStorehouseInfos.size() >0) {
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+                if(businessAllocationStorehouseInfo.size() == 1) {
+                    dataFlowContext.addParamOut("allocationAllocationStorehousehouseId", businessAllocationStorehouseInfo.get("allocationAllocationStorehousehouse_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> allocationAllocationStorehousehouseInfo = allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(info);
+        if(allocationAllocationStorehousehouseInfo != null && allocationAllocationStorehousehouseInfo.size() > 0){
+
+            //仓库调拨信息
+            List<Map> businessAllocationStorehouseInfos = allocationAllocationStorehousehouseServiceDaoImpl.getBusinessAllocationStorehouseInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessAllocationStorehouseInfos == null || businessAllocationStorehouseInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(allocationAllocationStorehousehouse),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _allocationAllocationStorehousehouseIndex = 0; _allocationAllocationStorehousehouseIndex < businessAllocationStorehouseInfos.size();_allocationAllocationStorehousehouseIndex++) {
+                Map businessAllocationStorehouseInfo = businessAllocationStorehouseInfos.get(_allocationAllocationStorehousehouseIndex);
+                flushBusinessAllocationStorehouseInfo(businessAllocationStorehouseInfo,StatusConstant.STATUS_CD_VALID);
+                allocationAllocationStorehousehouseServiceDaoImpl.updateAllocationStorehouseInfoInstance(businessAllocationStorehouseInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessAllocationStorehouse 节点
+     * @param business 总的数据节点
+     * @param businessAllocationStorehouse 仓库调拨节点
+     */
+    private void doBusinessAllocationStorehouse(Business business,JSONObject businessAllocationStorehouse){
+
+        Assert.jsonObjectHaveKey(businessAllocationStorehouse,"allocationAllocationStorehousehouseId","businessAllocationStorehouse 节点下没有包含 allocationAllocationStorehousehouseId 节点");
+
+        if(businessAllocationStorehouse.getString("allocationAllocationStorehousehouseId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"allocationAllocationStorehousehouseId 错误,不能自动生成(必须已经存在的allocationAllocationStorehousehouseId)"+businessAllocationStorehouse);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessAllocationStorehouse(business,businessAllocationStorehouse);
+
+        businessAllocationStorehouse.put("bId",business.getbId());
+        businessAllocationStorehouse.put("operate", StatusConstant.OPERATE_ADD);
+        //保存仓库调拨信息
+        allocationAllocationStorehousehouseServiceDaoImpl.saveBusinessAllocationStorehouseInfo(businessAllocationStorehouse);
+
+    }
+
+
+
+    @Override
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+
+
+}

+ 2 - 0
service-store/src/main/java/com/java110/store/listener/resourceStore/AbstractResourceStoreBusinessServiceDataFlowListener.java

@@ -50,6 +50,7 @@ public abstract class AbstractResourceStoreBusinessServiceDataFlowListener exten
         businessResourceStoreInfo.put("remark", businessResourceStoreInfo.get("remark"));
         businessResourceStoreInfo.put("outLowPrice", businessResourceStoreInfo.get("out_low_price"));
         businessResourceStoreInfo.put("outHighPrice", businessResourceStoreInfo.get("out_high_price"));
+        businessResourceStoreInfo.put("shId", businessResourceStoreInfo.get("sh_id"));
         businessResourceStoreInfo.remove("bId");
         businessResourceStoreInfo.put("statusCd", statusCd);
     }
@@ -88,6 +89,7 @@ public abstract class AbstractResourceStoreBusinessServiceDataFlowListener exten
         currentResourceStoreInfo.put("outLowPrice", currentResourceStoreInfo.get("out_low_price"));
         currentResourceStoreInfo.put("outHighPrice", currentResourceStoreInfo.get("out_high_price"));
         currentResourceStoreInfo.put("operate", StatusConstant.OPERATE_DEL);
+        currentResourceStoreInfo.put("shId", currentResourceStoreInfo.get("sh_id"));
         getResourceStoreServiceDaoImpl().saveBusinessResourceStoreInfo(currentResourceStoreInfo);
 
         for (Object key : currentResourceStoreInfo.keySet()) {

+ 92 - 0
service-store/src/main/java/com/java110/store/smo/impl/AllocationStorehouseInnerServiceSMOImpl.java

@@ -0,0 +1,92 @@
+package com.java110.store.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
+import com.java110.store.dao.IAllocationStorehouseServiceDao;
+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 AllocationStorehouseInnerServiceSMOImpl extends BaseServiceSMO implements IAllocationStorehouseInnerServiceSMO {
+
+    @Autowired
+    private IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl;
+
+
+    @Override
+    public List<AllocationStorehouseDto> queryAllocationStorehouses(@RequestBody AllocationStorehouseDto allocationAllocationStorehousehouseDto) {
+
+        //校验是否传了 分页信息
+
+        int page = allocationAllocationStorehousehouseDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            allocationAllocationStorehousehouseDto.setPage((page - 1) * allocationAllocationStorehousehouseDto.getRow());
+        }
+
+        List<AllocationStorehouseDto> allocationAllocationStorehousehouses = BeanConvertUtil.covertBeanList(allocationAllocationStorehousehouseServiceDaoImpl.getAllocationStorehouseInfo(BeanConvertUtil.beanCovertMap(allocationAllocationStorehousehouseDto)), AllocationStorehouseDto.class);
+
+
+        return allocationAllocationStorehousehouses;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param allocationAllocationStorehousehouse 小区仓库调拨信息
+     * @param users                               用户列表
+     */
+    private void refreshAllocationStorehouse(AllocationStorehouseDto allocationAllocationStorehousehouse, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (allocationAllocationStorehousehouse.getAsId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, allocationAllocationStorehousehouse);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param allocationAllocationStorehousehouses 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<AllocationStorehouseDto> allocationAllocationStorehousehouses) {
+        List<String> userIds = new ArrayList<String>();
+        for (AllocationStorehouseDto allocationAllocationStorehousehouse : allocationAllocationStorehousehouses) {
+            userIds.add(allocationAllocationStorehousehouse.getAsId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryAllocationStorehousesCount(@RequestBody AllocationStorehouseDto allocationAllocationStorehousehouseDto) {
+        return allocationAllocationStorehousehouseServiceDaoImpl.queryAllocationStorehousesCount(BeanConvertUtil.beanCovertMap(allocationAllocationStorehousehouseDto));
+    }
+
+    public IAllocationStorehouseServiceDao getAllocationStorehouseServiceDaoImpl() {
+        return allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+    public void setAllocationStorehouseServiceDaoImpl(IAllocationStorehouseServiceDao allocationAllocationStorehousehouseServiceDaoImpl) {
+        this.allocationAllocationStorehousehouseServiceDaoImpl = allocationAllocationStorehousehouseServiceDaoImpl;
+    }
+
+}