Sfoglia il codice sorgente

商户信息保存功能完成

wuxw7 7 anni fa
parent
commit
da79b93b70

+ 162 - 0
StoreService/src/main/java/com/java110/store/dao/IStoreServiceDao.java

@@ -1,6 +1,7 @@
 package com.java110.store.dao;
 package com.java110.store.dao;
 
 
 
 
+import com.java110.common.exception.DAOException;
 import com.java110.entity.merchant.BoMerchant;
 import com.java110.entity.merchant.BoMerchant;
 import com.java110.entity.merchant.BoMerchantAttr;
 import com.java110.entity.merchant.BoMerchantAttr;
 import com.java110.entity.merchant.Merchant;
 import com.java110.entity.merchant.Merchant;
@@ -8,6 +9,7 @@ import com.java110.entity.merchant.MerchantAttr;
 
 
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 商户组件内部之间使用,没有给外围系统提供服务能力
  * 商户组件内部之间使用,没有给外围系统提供服务能力
@@ -18,5 +20,165 @@ import java.util.List;
  */
  */
 public interface IStoreServiceDao {
 public interface IStoreServiceDao {
 
 
+    /**
+     * 保存 商户信息
+     * @param businessStoreInfo 商户信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessStoreInfo(Map businessStoreInfo) throws DAOException;
 
 
+    /**
+     * 保存商户属性
+     * @param businessStoreAttr 商户属性信息封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessStoreAttr(Map businessStoreAttr) throws DAOException;
+
+
+    /**
+     * 保存商户照片信息
+     * @param businessStorePhoto 商户照片
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessStorePhoto(Map businessStorePhoto) throws DAOException;
+
+    /**
+     * 保存商户证件信息
+     * @param businessStoreCerdentials 商户证件
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessStoreCerdentials(Map businessStoreCerdentials) throws DAOException;
+
+    /**
+     * 查询商户信息(business过程)
+     * 根据bId 查询商户信息
+     * @param info bId 信息
+     * @return 商户信息
+     * @throws DAOException
+     */
+    public Map getBusinessStoreInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询商户属性信息(business过程)
+     * @param info bId 信息
+     * @return 商户属性
+     * @throws DAOException
+     */
+    public List<Map> getBusinessStoreAttrs(Map info) throws DAOException;
+
+
+    /**
+     * 查询商户照片
+     * @param info bId 信息
+     * @return 商户照片
+     * @throws DAOException
+     */
+    public List<Map> getBusinessStorePhoto(Map info) throws DAOException;
+
+
+    /**
+     * 查询商户证件信息
+     * @param info bId 信息
+     * @return 商户照片
+     * @throws DAOException
+     */
+    public List<Map> getBusinessStoreCerdentials(Map info) throws DAOException;
+
+    /**
+     * 保存 商户信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void saveStoreInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 保存 商户属性信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void saveStoreAttrsInstance(Map info) throws DAOException;
+
+    /**
+     * 保存 商户照片信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void saveStorePhotoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 保存 商户证件信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void saveStoreCerdentialsInstance(Map info) throws DAOException;
+
+
+
+    /**
+     * 查询商户信息(instance过程)
+     * 根据bId 查询商户信息
+     * @param info bId 信息
+     * @return 商户信息
+     * @throws DAOException
+     */
+    public Map getStoreInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询商户属性信息(instance过程)
+     * @param info bId 信息
+     * @return 商户属性
+     * @throws DAOException
+     */
+    public List<Map> getStoreAttrs(Map info) throws DAOException;
+
+
+    /**
+     * 查询商户照片(instance 过程)
+     * @param info bId 信息
+     * @return 商户照片
+     * @throws DAOException
+     */
+    public List<Map> getStorePhoto(Map info) throws DAOException;
+
+    /**
+     * 查询商户证件信息(instance 过程)
+     * @param info bId 信息
+     * @return 商户照片
+     * @throws DAOException
+     */
+    public List<Map> getStoreCerdentials(Map info) throws DAOException;
+
+    /**
+     * 修改商户信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateStoreInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 修改商户属性信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateStoreAttrInstance(Map info) throws DAOException;
+
+
+    /**
+     * 修改商户照片信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateStorePhotoInstance(Map info) throws DAOException;
+
+    /**
+     * 修改商户证件信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateStoreCerdentailsInstance(Map info) throws DAOException;
 }
 }

+ 318 - 7
StoreService/src/main/java/com/java110/store/dao/impl/StoreServiceDaoImpl.java

@@ -1,26 +1,337 @@
 package com.java110.store.dao.impl;
 package com.java110.store.dao.impl;
 
 
-import com.java110.common.log.LoggerEngine;
-import com.java110.common.util.Assert;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.DAOException;
 import com.java110.core.base.dao.BaseServiceDao;
 import com.java110.core.base.dao.BaseServiceDao;
-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 com.java110.store.dao.IStoreServiceDao;
 import com.java110.store.dao.IStoreServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 商户服务 与数据库交互
  * 商户服务 与数据库交互
  * Created by wuxw on 2017/4/5.
  * Created by wuxw on 2017/4/5.
  */
  */
 @Service("storeServiceDaoImpl")
 @Service("storeServiceDaoImpl")
-@Transactional
+//@Transactional
 public class StoreServiceDaoImpl extends BaseServiceDao implements IStoreServiceDao {
 public class StoreServiceDaoImpl extends BaseServiceDao implements IStoreServiceDao {
 
 
+    private final static Logger logger = LoggerFactory.getLogger(StoreServiceDaoImpl.class);
 
 
+    /**
+     * 商户信息封装
+     * @param businessStoreInfo 商户信息 封装
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessStoreInfo(Map businessStoreInfo) throws DAOException {
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存商户信息 入参 businessStoreInfo : {}",businessStoreInfo);
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreInfo",businessStoreInfo);
 
 
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户数据失败:"+ JSONObject.toJSONString(businessStoreInfo));
+        }
+    }
+
+    /**
+     * 商户属性信息分装
+     * @param businessStoreAttr 商户属性信息封装
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessStoreAttr(Map businessStoreAttr) throws DAOException {
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存商户属性信息 入参 businessStoreAttr : {}",businessStoreAttr);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreAttr",businessStoreAttr);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户属性数据失败:"+ JSONObject.toJSONString(businessStoreAttr));
+        }
+    }
+
+    /**
+     * 保存商户照片信息
+     * @param businessStorePhoto 商户照片
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessStorePhoto(Map businessStorePhoto) throws DAOException {
+
+        logger.debug("保存商户照片信息 入参 businessStorePhoto : {}",businessStorePhoto);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStorePhoto",businessStorePhoto);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户照片数据失败:"+ JSONObject.toJSONString(businessStorePhoto));
+        }
+    }
+
+    /**
+     * 保存商户证件信息
+     * @param businessStoreCerdentials 商户证件
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessStoreCerdentials(Map businessStoreCerdentials) throws DAOException {
+        logger.debug("保存商户证件信息 入参 businessStoreCerdentials : {}",businessStoreCerdentials);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreCerdentials",businessStoreCerdentials);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户证件数据失败:"+ JSONObject.toJSONString(businessStoreCerdentials));
+        }
+    }
+
+    /**
+     * 查询商户信息
+     * @param info bId 信息
+     * @return 商户信息
+     * @throws DAOException
+     */
+    @Override
+    public Map getBusinessStoreInfo(Map info) throws DAOException {
+
+        logger.debug("查询商户信息 入参 info : {}",info);
+
+        List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreInfo",info);
+        if(businessStoreInfos == null){
+            return null;
+        }
+        if(businessStoreInfos.size() >1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessStoreInfos,"+ JSONObject.toJSONString(info));
+        }
+
+        return businessStoreInfos.get(0);
+    }
+
+    /**
+     * 查询商户属性
+     * @param info bId 信息
+     * @return 商户属性
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getBusinessStoreAttrs(Map info) throws DAOException {
+        logger.debug("查询商户属性信息 入参 info : {}",info);
+
+        List<Map> businessStoreAttrs = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreAttrs",info);
+
+        return businessStoreAttrs;
+    }
+
+    /**
+     * 查询商户照片
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getBusinessStorePhoto(Map info) throws DAOException {
+        logger.debug("查询商户照片信息 入参 info : {}",info);
+
+        List<Map> businessStorePhotos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStorePhoto",info);
+
+        return businessStorePhotos;
+    }
+
+    /**
+     * 查询商户证件
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getBusinessStoreCerdentials(Map info) throws DAOException {
+        logger.debug("查询商户证件信息 入参 info : {}",info);
+
+        List<Map> businessStoreCerdentialses = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreCerdentials",info);
+
+        return businessStoreCerdentialses;
+    }
+
+    /**
+     * 保存商户信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException
+     */
+    @Override
+    public void saveStoreInfoInstance(Map info) throws DAOException {
+        logger.debug("保存商户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStoreInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    @Override
+    public void saveStoreAttrsInstance(Map info) throws DAOException {
+        logger.debug("保存商户属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStoreAttrsInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    @Override
+    public void saveStorePhotoInstance(Map info) throws DAOException {
+        logger.debug("保存商户照片信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStorePhotoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    @Override
+    public void saveStoreCerdentialsInstance(Map info) throws DAOException {
+        logger.debug("保存商户证件信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStoreCerdentialsInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询商户信息(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public Map getStoreInfo(Map info) throws DAOException {
+        logger.debug("查询商户信息 入参 info : {}",info);
+
+        List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreInfo",info);
+        if(businessStoreInfos == null){
+            return null;
+        }
+        if(businessStoreInfos.size() >1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getStoreInfo,"+ JSONObject.toJSONString(info));
+        }
+
+        return businessStoreInfos.get(0);
+    }
+
+    /**
+     * 商户属性查询(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getStoreAttrs(Map info) throws DAOException {
+        logger.debug("查询商户属性信息 入参 info : {}",info);
+
+        List<Map> storeAttrs = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreAttrs",info);
+
+        return storeAttrs;
+    }
+
+    /**
+     * 商户照片查询(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getStorePhoto(Map info) throws DAOException {
+        logger.debug("查询商户照片信息 入参 info : {}",info);
+
+        List<Map> storePhotos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStorePhoto",info);
+
+        return storePhotos;
+    }
+
+    /**
+     * 商户证件查询(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getStoreCerdentials(Map info) throws DAOException {
+        logger.debug("查询商户证件信息 入参 info : {}",info);
+
+        List<Map> storeCerdentialses = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreCerdentials",info);
+
+        return storeCerdentialses;
+    }
+
+    /**
+     * 修改商户信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateStoreInfoInstance(Map info) throws DAOException {
+        logger.debug("修改商户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 修改商户属性信息(instance)
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateStoreAttrInstance(Map info) throws DAOException {
+        logger.debug("修改商户属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreAttrInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 修改 商户照片信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateStorePhotoInstance(Map info) throws DAOException {
+        logger.debug("修改商户照片信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStorePhotoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 修改商户证件信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateStoreCerdentailsInstance(Map info) throws DAOException {
+        logger.debug("修改商户证件信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreCerdentailsInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
 }
 }

+ 180 - 75
StoreService/src/main/java/com/java110/store/listener/SaveStoreInfoListener.java

@@ -47,21 +47,24 @@ public class SaveStoreInfoListener extends LoggerEngine implements BusinessServi
     public void soService(BusinessServiceDataFlowEvent event) {
     public void soService(BusinessServiceDataFlowEvent event) {
         //这里处理业务逻辑数据
         //这里处理业务逻辑数据
         DataFlowContext dataFlowContext = event.getDataFlowContext();
         DataFlowContext dataFlowContext = event.getDataFlowContext();
-        doSaveUserInfo(dataFlowContext);
+        doSaveStoreInfo(dataFlowContext);
     }
     }
 
 
-    private void doSaveUserInfo(DataFlowContext dataFlowContext){
+    /**
+     * 保存商户信息
+     * 主要保存 businessStore,businessStoreAttr,businessStorePhoto,businessStoreCerdentials信息
+     * @param dataFlowContext 数据流对象
+     */
+    private void doSaveStoreInfo(DataFlowContext dataFlowContext){
         String businessType = dataFlowContext.getOrder().getBusinessType();
         String businessType = dataFlowContext.getOrder().getBusinessType();
         Business business = dataFlowContext.getCurrentBusiness();
         Business business = dataFlowContext.getCurrentBusiness();
-        //Assert.hasLength(business.getbId(),"bId 不能为空");
         // Instance 过程
         // Instance 过程
         if(StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(businessType)){
         if(StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(businessType)){
-            //doComplateUserInfo(business);
-            doSaveInstanceUserInfo(dataFlowContext,business);
+            doSaveInstanceStoreInfo(dataFlowContext,business);
         }else if(StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(businessType)){ // Business过程
         }else if(StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(businessType)){ // Business过程
-            doSaveBusinessUserInfo(dataFlowContext,business);
+            doSaveBusinessStoreInfo(dataFlowContext,business);
         }else if(StatusConstant.REQUEST_BUSINESS_TYPE_DELETE.equals(businessType)){ //撤单过程
         }else if(StatusConstant.REQUEST_BUSINESS_TYPE_DELETE.equals(businessType)){ //撤单过程
-            doDeleteInstanceUserInfo(dataFlowContext,business);
+            doDeleteInstanceStoreInfo(dataFlowContext,business);
         }
         }
 
 
         dataFlowContext.setResJson(DataTransactionFactory.createBusinessResponseJson(dataFlowContext,ResponseConstant.RESULT_CODE_SUCCESS,"成功",
         dataFlowContext.setResJson(DataTransactionFactory.createBusinessResponseJson(dataFlowContext,ResponseConstant.RESULT_CODE_SUCCESS,"成功",
@@ -72,33 +75,40 @@ public class SaveStoreInfoListener extends LoggerEngine implements BusinessServi
      * 撤单
      * 撤单
      * @param business
      * @param business
      */
      */
-    private void doDeleteInstanceUserInfo(DataFlowContext dataFlowContext,Business business) {
+    private void doDeleteInstanceStoreInfo(DataFlowContext dataFlowContext, Business business) {
 
 
-        /*String bId = business.getbId();
+        String bId = business.getbId();
         //Assert.hasLength(bId,"请求报文中没有包含 bId");
         //Assert.hasLength(bId,"请求报文中没有包含 bId");
         Map info = new HashMap();
         Map info = new HashMap();
         info.put("bId",bId);
         info.put("bId",bId);
-        Map userInfo = storeServiceDaoImpl.queryUserInfo(info);
-        if(userInfo != null && !userInfo.isEmpty()){
+        //商户信息
+        Map storeInfo = storeServiceDaoImpl.getStoreInfo(info);
+        if(storeInfo != null && !storeInfo.isEmpty()){
             info.put("bId",bId);
             info.put("bId",bId);
-            info.put("userId",userInfo.get("user_id").toString());
+            info.put("storeId",storeInfo.get("store_id").toString());
             info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
             info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
-            storeServiceDaoImpl.updateUserInfoInstance(userInfo);
-            dataFlowContext.addParamOut("userId",userInfo.get("user_id"));
+            storeServiceDaoImpl.updateStoreInfoInstance(info);
+            dataFlowContext.addParamOut("storeId",storeInfo.get("store_id"));
         }
         }
 
 
-        info.clear();
-        info.put("bId",bId);
+        //商户属性
+        List<Map> storeAttrs = storeServiceDaoImpl.getStoreAttrs(info);
+        if(storeAttrs != null && storeAttrs.size()>0){
+            storeServiceDaoImpl.updateStoreAttrInstance(info);
+        }
 
 
-        List<Map> userAttrs = storeServiceDaoImpl.queryUserInfoAttrs(info);
+        //商户照片
+        List<Map> storePhotos = storeServiceDaoImpl.getStorePhoto(info);
+        if(storePhotos != null && storePhotos.size()>0){
+            storeServiceDaoImpl.updateStorePhotoInstance(info);
+        }
 
 
-        if(userAttrs != null && userAttrs.size() >0){
-            info.put("bId",bId);
-            //info.put("userId",userInfo.get("user_id").toString());
-            info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
-            storeServiceDaoImpl.updateUserAttrInstance(info);
+        //商户属性
+        List<Map> storeCerdentialses = storeServiceDaoImpl.getStoreCerdentials(info);
+        if(storeCerdentialses != null && storeCerdentialses.size()>0){
+            storeServiceDaoImpl.updateStoreCerdentailsInstance(info);
         }
         }
-*/
+
 
 
     }
     }
 
 
@@ -106,28 +116,35 @@ public class SaveStoreInfoListener extends LoggerEngine implements BusinessServi
      * instance过程
      * instance过程
      * @param business
      * @param business
      */
      */
-    private void doSaveInstanceUserInfo(DataFlowContext dataFlowContext,Business business) {
+    private void doSaveInstanceStoreInfo(DataFlowContext dataFlowContext, Business business) {
 
 
         JSONObject data = business.getDatas();
         JSONObject data = business.getDatas();
 
 
-        //Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
-
-        //Assert.jsonObjectHaveKey(data,"businessUser","datas 节点下没有包含 businessUser 节点");
-
-        //JSONObject businessUser = data.getJSONObject("businessUser");
-       /* Map info = new HashMap();
+        Map info = new HashMap();
         info.put("bId",business.getbId());
         info.put("bId",business.getbId());
         info.put("operate",StatusConstant.OPERATE_ADD);
         info.put("operate",StatusConstant.OPERATE_ADD);
-        Map businessUser = storeServiceDaoImpl.queryBusinessUserInfo(info);
-        if( businessUser != null && !businessUser.isEmpty()) {
-            storeServiceDaoImpl.saveUserInfoInstance(businessUser);
-            dataFlowContext.addParamOut("userId",businessUser.get("user_id"));
-        }
-        List<Map> businessUserAttrs = storeServiceDaoImpl.queryBusinessUserInfoAttrs(info);
-        if(businessUserAttrs != null && businessUserAttrs.size() > 0) {
-            storeServiceDaoImpl.saveUserAttrInstance(businessUser);
-        }*/
 
 
+        //商户信息
+        Map businessStoreInfo = storeServiceDaoImpl.getBusinessStoreInfo(info);
+        if( businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
+            storeServiceDaoImpl.saveStoreInfoInstance(info);
+            dataFlowContext.addParamOut("storeId",businessStoreInfo.get("store_id"));
+        }
+        //商户属性
+        List<Map> businessStoreAttrs = storeServiceDaoImpl.getBusinessStoreAttrs(info);
+        if(businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
+            storeServiceDaoImpl.saveStoreAttrsInstance(info);
+        }
+        //商户照片
+        List<Map> businessStorePhotos = storeServiceDaoImpl.getBusinessStorePhoto(info);
+        if(businessStorePhotos != null && businessStorePhotos.size() >0){
+            storeServiceDaoImpl.saveStorePhotoInstance(info);
+        }
+        //商户证件
+        List<Map> businessStoreCerdentialses = storeServiceDaoImpl.getBusinessStoreCerdentials(info);
+        if(businessStoreCerdentialses != null && businessStoreCerdentialses.size()>0){
+            storeServiceDaoImpl.saveStoreCerdentialsInstance(info);
+        }
 
 
     }
     }
 
 
@@ -145,67 +162,155 @@ public class SaveStoreInfoListener extends LoggerEngine implements BusinessServi
     }
     }
 
 
     /**
     /**
-     * 处理户信息
+     * 处理户信息
      * @param business
      * @param business
      */
      */
-    private void doSaveBusinessUserInfo(DataFlowContext dataFlowContext,Business business) {
+    private void doSaveBusinessStoreInfo(DataFlowContext dataFlowContext, Business business) {
 
 
-        /*JSONObject data = business.getDatas();
+        JSONObject data = business.getDatas();
 
 
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
 
-        Assert.jsonObjectHaveKey(data,"businessUser","datas 节点下没有包含 businessUser 节点");
-
-        JSONObject businessUser = data.getJSONObject("businessUser");
+        //处理 businessStore 节点
+        if(data.containsKey("businessStore")){
+            JSONObject businessStore = data.getJSONObject("businessStore");
+            doBusinessStore(business,businessStore);
+            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
+        }
 
 
-        Assert.jsonObjectHaveKey(businessUser,"userId","businessUser 节点下没有包含 userId 节点");
+        if(data.containsKey("businessStorePhoto")){
+            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
+            doBusinessStorePhoto(business,businessStorePhotos);
+        }
 
 
-        if(businessUser.getInteger("userId") < 0){
-            //生成userId
-            String userId = GenerateCodeFactory.getUserId();
-            businessUser.put("userId",userId);
+        if(data.containsKey("businessStoreCerdentials")){
+            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
+            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
         }
         }
-        dataFlowContext.addParamOut("userId",businessUser.getString("userId"));
-        businessUser.put("bId",business.getbId());
-        businessUser.put("operate", StatusConstant.OPERATE_ADD);
-        //保存用户信息
-        storeServiceDaoImpl.saveBusinessUserInfo(businessUser);
 
 
-        if(businessUser.containsKey("businessUserAttr")){
-            doSaveUserAttrs(business);
-        }*/
 
 
         //storeServiceDaoImpl.saveUserInfoInstance(businessUser);
         //storeServiceDaoImpl.saveUserInfoInstance(businessUser);
+    }
 
 
+    /**
+     * 保存商户照片
+     * @param business 业务对象
+     * @param businessStorePhotos 商户照片
+     */
+    private void doBusinessStorePhoto(Business business, JSONArray businessStorePhotos) {
 
 
+        for(int businessStorePhotoIndex = 0 ;businessStorePhotoIndex < businessStorePhotos.size();businessStorePhotoIndex++) {
+            JSONObject businessStorePhoto = businessStorePhotos.getJSONObject(businessStorePhotoIndex);
+            Assert.jsonObjectHaveKey(businessStorePhoto, "storeId", "businessStorePhoto 节点下没有包含 storeId 节点");
 
 
+            if (businessStorePhoto.getLong("storePhotoId") < 0) {
+                String storePhotoId = GenerateCodeFactory.getStorePhotoId();
+                businessStorePhoto.put("storePhotoId", storePhotoId);
+            }
+            businessStorePhoto.put("bId", business.getbId());
+            businessStorePhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存商户信息
+            storeServiceDaoImpl.saveBusinessStorePhoto(businessStorePhoto);
+        }
     }
     }
 
 
-    private void doSaveUserAttrs(Business business){
-        /*JSONObject data = business.getDatas();
-        JSONObject businessUser = data.getJSONObject("businessUser");
-        JSONArray businessUserAttrs = businessUser.getJSONArray("businessUserAttr");
-        for(int userAttrIndex = 0 ; userAttrIndex < businessUserAttrs.size();userAttrIndex ++){
-            JSONObject userAttr = businessUserAttrs.getJSONObject(userAttrIndex);
-            Assert.jsonObjectHaveKey(userAttr,"attrId","businessUserAttr 节点下没有包含 attrId 节点");
+    /**
+     * 处理 businessStore 节点
+     * @param business 总的数据节点
+     * @param businessStore 商户节点
+     */
+    private void doBusinessStore(Business business,JSONObject businessStore){
+
+        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
 
 
-            if(userAttr.getInteger("attrId") < 0){
+        if(businessStore.getInteger("storeId") < 0){
+            //刷新缓存
+            flushStoreId(business.getDatas());
+        }
+
+
+        businessStore.put("bId",business.getbId());
+        businessStore.put("operate", StatusConstant.OPERATE_ADD);
+        //保存商户信息
+        storeServiceDaoImpl.saveBusinessStoreInfo(businessStore);
+        //保存 商户属性信息
+        if(businessStore.containsKey("businessStoreAttr")){
+            JSONArray businessStoreAttrs = businessStore.getJSONArray("businessStoreAttr");
+            doSaveBusinessStoreAttrs(business,businessStoreAttrs);
+        }
+    }
+
+
+
+    /**
+     * 保存商户属性信息
+     * @param business 当前业务
+     * @param businessStoreAttrs 商户属性
+     */
+    private void doSaveBusinessStoreAttrs(Business business,JSONArray businessStoreAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessStore = data.getJSONObject("businessStore");
+        for(int storeAttrIndex = 0 ; storeAttrIndex < businessStoreAttrs.size();storeAttrIndex ++){
+            JSONObject storeAttr = businessStoreAttrs.getJSONObject(storeAttrIndex);
+            Assert.jsonObjectHaveKey(storeAttr,"attrId","businessStoreAttr 节点下没有包含 attrId 节点");
+
+            if(storeAttr.getInteger("attrId") < 0){
                 String attrId = GenerateCodeFactory.getAttrId();
                 String attrId = GenerateCodeFactory.getAttrId();
-                userAttr.put("attrId",attrId);
+                storeAttr.put("attrId",attrId);
+            }
+
+            storeAttr.put("bId",business.getbId());
+            storeAttr.put("storeId",businessStore.getString("storeId"));
+            storeAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            storeServiceDaoImpl.saveBusinessStoreAttr(storeAttr);
+        }
+    }
+
+
+    /**
+     * 保存 商户证件 信息
+     * @param business 当前业务
+     * @param businessStoreCerdentialses 商户证件
+     */
+    private void doBusinessStoreCerdentials(Business business, JSONArray businessStoreCerdentialses) {
+        for(int businessStoreCerdentialsIndex = 0 ; businessStoreCerdentialsIndex < businessStoreCerdentialses.size() ; businessStoreCerdentialsIndex ++) {
+            JSONObject businessStoreCerdentials = businessStoreCerdentialses.getJSONObject(businessStoreCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessStoreCerdentials, "storeId", "businessStorePhoto 节点下没有包含 storeId 节点");
+
+            if (businessStoreCerdentials.getLong("storeCerdentialsId") < 0) {
+                String storePhotoId = GenerateCodeFactory.getStoreCerdentialsId();
+                businessStoreCerdentials.put("storeCerdentialsId", storePhotoId);
             }
             }
+            businessStoreCerdentials.put("bId", business.getbId());
+            businessStoreCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存商户信息
+            storeServiceDaoImpl.saveBusinessStoreCerdentials(businessStoreCerdentials);
+        }
+    }
 
 
-            userAttr.put("bId",business.getbId());
-            userAttr.put("userId",businessUser.getString("userId"));
-            userAttr.put("operate", StatusConstant.OPERATE_ADD);
 
 
-            storeServiceDaoImpl.saveBusinessUserAttr(userAttr);
-        }*/
 
 
-        /*JSONObject attrInstance = new JSONObject();
-        attrInstance.put("bId",business.getbId());
-        storeServiceDaoImpl.saveUserAttrInstance(attrInstance);*/
+    /**
+     * 刷新 商户ID
+     * @param data
+     */
+    private void flushStoreId(JSONObject data) {
+
+        String storeId = GenerateCodeFactory.getStoreId();
+        JSONObject businessStore = data.getJSONObject("businessStore");
+        businessStore.put("storeId",storeId);
+        if(data.containsKey("businessStorePhoto")) {
+            JSONObject businessStorePhoto = data.getJSONObject("businessStorePhoto");
+            businessStorePhoto.put("storeId", storeId);
+        }
+        if(data.containsKey("businessStoreCerdentials")) {
+            JSONObject businessStoreCerdentials = data.getJSONObject("businessStoreCerdentials");
+            businessStoreCerdentials.put("storeId", storeId);
+        }
     }
     }
 
 
+
     public IStoreServiceDao getStoreServiceDaoImpl() {
     public IStoreServiceDao getStoreServiceDaoImpl() {
         return storeServiceDaoImpl;
         return storeServiceDaoImpl;
     }
     }

+ 1 - 1
java110-config/db/StoreService/create_table.sql

@@ -59,7 +59,7 @@ create table s_store(
     name varchar(100) not null comment '店铺名称',
     name varchar(100) not null comment '店铺名称',
     address varchar(200) not null comment '店铺地址',
     address varchar(200) not null comment '店铺地址',
     tel varchar(11) not null comment '电话',
     tel varchar(11) not null comment '电话',
-    store_type varchar(10) not null commnet '店铺种类',
+    store_type_cd varchar(10) not null commnet '店铺种类',
     nearby_landmarks varchar(200) comment '地标,如王府井北60米',
     nearby_landmarks varchar(200) comment '地标,如王府井北60米',
     map_x varchar(20) not null comment '地区 x坐标',
     map_x varchar(20) not null comment '地区 x坐标',
     map_y varchar(20) not null comment '地区 y坐标',
     map_y varchar(20) not null comment '地区 y坐标',

+ 0 - 123
java110-config/src/main/resources/mapper/merchant/MerchantServiceDaoImplMapper.xml

@@ -1,123 +0,0 @@
-<?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="merchantServiceDAOImpl">
-
-    <resultMap type="com.java110.entity.merchant.Merchant" id="merchantMap">
-        <id column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
-        <result column="logoImg" jdbcType="VARCHAR" property="logoImg"/>
-        <result column="name" jdbcType="VARCHAR" property="name"/>
-        <result column="address" jdbcType="VARCHAR" property="address"/>
-        <result column="type" jdbcType="VARCHAR" property="type"/>
-        <result column="start_dt" jdbcType="DATE" property="start_dt"/>
-        <result column="end_dt" jdbcType="DATE" property="end_dt"/>
-        <result column="status_cd" jdbcType="VARCHAR" property="status_cd"/>
-        <result column="create_dt" jdbcType="DATE" property="create_dt"/>
-        <!-- 一对多关系 -->
-        <!-- <collection property="stus" resultMap="Student.StudentResult"></collection>  -->
-        <collection property="merchantAttrs" javaType="com.java110.entity.merchant.MerchantAttr">
-            <id property="merchantId" column="merchantId"/>
-            <result property="attrCd" column="attrCd"/>
-            <result property="value" column="value"/>
-        </collection>
-    </resultMap>
-
-    <!--根据用户Id查询用户角色
-    <select id="findRolesByUserId" resultType="SysRole">
-        SELECT
-        r.*
-        FROM
-        t_role r,
-        t_merchant_role ur
-        WHERE ur.uid = #{merchantId}
-        AND ur.roleId = r.roleId
-        AND ur.status_cd = '1'
-    </select>
--->
-    <!--保存数据至过程表 bo_merchant 中 -->
-    <insert id="saveDataToBoMerchant" parameterType="com.java110.entity.merchant.BoMerchant">
-        <![CDATA[
-            insert into bo_merchant(boId,merchantId,logoImg,name,address,type,start_dt,end_dt,state)
-            values(#{boId},#{merchantId},#{logoImg},#{name},#{address},#{type},#{start_dt},#{end_dt},#{state})
-        ]]>
-    </insert>
-    <!-- 保存数据至过程表bo_merchant_attr 中-->
-    <insert id="saveDataToBoMerchantAttr" parameterType="com.java110.entity.merchant.BoMerchantAttr">
-        <![CDATA[
-            insert into bo_merchant_attr(boId,merchantId,attrCd,value,state)
-            values(#{boId},#{merchantId},#{attrCd},#{value},#{state})
-        ]]>
-    </insert>
-    <!-- 保存 实例客户信息 merchant -->
-    <insert id="saveDataToMerchant" parameterType="com.java110.entity.merchant.Merchant">
-        <![CDATA[
-            insert into merchant(merchantId,logoImg,name,address,type,start_dt,end_dt,status_cd)
-            values(#{merchantId},#{logoImg},#{name},#{address},#{type},#{start_dt},#{end_dt},#{status_cd})
-        ]]>
-    </insert>
-    <!-- 删除实例客户信息 merchant -->
-    <insert id="deleteDataToMerchant" parameterType="com.java110.entity.merchant.Merchant">
-        <![CDATA[
-           delete * from merchant c where c.merchantId = #{merchantId}
-        ]]>
-    </insert>
-
-    <!-- 保存 实例客户属性信息 merchant_attr -->
-    <insert id="saveDataToMerchantAttr" parameterType="com.java110.entity.merchant.MerchantAttr">
-        <![CDATA[
-            insert into merchant_attr(merchantId,attrCd,value,status_cd)
-            values(#{merchantId},#{attrCd},#{value},#{status_cd})
-        ]]>
-    </insert>
-    <!-- 删除实例客户信息 merchant -->
-    <update id="deleteDataToMerchantAttr" parameterType="com.java110.entity.merchant.MerchantAttr">
-           delete * from merchant_attr ct where 1=1
-           <if test="merchantId != null and merchantId != ''">
-               and ct.merchantId = #{merchantId}
-           </if>
-            <if test="attrCd != null and attrCd != ''">
-                and ct.attrCd = #{attrCd}
-            </if>
-    </update>
-    <!--根据客户ID 查询客户信息,其中包括 merchant 和merchantAttr 数据-->
-    <select id="queryDataToMerchant" parameterType="com.java110.entity.merchant.Merchant" resultMap="merchantMap">
-        <![CDATA[
-            select c.merchantId,c.logoImg,c.name,c.address,c.type,c.start_dt,c.end_dt,c.status_cd,c.create_dt,
-            ca.merchantId,ca.attrCd,ca.value
-             from merchant c, merchant_attr ca where c.merchantId= ca.merchantId
-            and c.merchantId = #{merchantId}
-            and c.status_cd = '0'
-        ]]>
-    </select>
-
-    <!-- 查询客户过程数据 -->
-    <select id="queryBoMerchant" parameterType="com.java110.entity.merchant.BoMerchant" resultType="com.java110.entity.merchant.BoMerchant">
-        select bc.boId,bc.merchantId,bc.logoImg,bc.name,bc.address,bc.type,bc.start_dt,bc.end_dt,bc.state,bc.create_dt,
-        from bo_merchant bc where 1=1
-        <if test="boId != null and boId != ''">
-            and bc.boId = #{boId}
-        </if>
-        <if test="merchantId != null and merchantId != ''">
-            and bc.merchantId = #{merchantId}
-        </if>
-        and bc.state in ('ADD','DEL')
-        <if test="create_dt != null and create_dt != ''">
-            order by bc.create_dt desc
-        </if>
-    </select>
-    <!-- 查询客户属性过程表-->
-    <select id="queryBoMerchantAttr" parameterType="com.java110.entity.merchant.BoMerchantAttr" resultType="com.java110.entity.merchant.BoMerchantAttr">
-        select bca.boId,bca.merchantId,bca.attrCd,bca.value,bca.state,bca.create_dt from bo_merchant_attr bca where 1=1
-        <if test="boId !=null and boId != ''">
-            and bca.boId = #{boId}
-        </if>
-        <if test="merchantId != null and merchantId != ''">
-            and bca.merchantId = #{merchantId}
-        </if>
-        <if test="create_dt != null and create_dt != ''">
-            order by bc.create_dt desc
-        </if>
-    </select>
-
-</mapper>

java110-config/src/main/resources/mapper/merchant/MerchantMemberServiceDaoImplMapper.xml → java110-config/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml


+ 232 - 0
java110-config/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml

@@ -0,0 +1,232 @@
+<?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="storeServiceDaoImpl">
+    
+    <!-- 保存商户信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessStoreInfo" parameterType="Map">
+        insert into business_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,operate)
+        values(#{storeId},#{bId},#{userId},#{name},#{address},#{tel},#{storeTypeCd},#{nearbyLandmarks},#{mapX},#{mapY},#{operate})
+    </insert>
+    <!-- 保存商户属性信息  add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessStoreAttr" parameterType="Map">
+        insert into business_store_attr(b_id,attr_id,store_id,spec_cd,value,operate)
+        values(#{bId},#{attrId},#{storeId},#{specCd},#{value},#{operate})
+    </insert>
+    <!-- 保存商户照片信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessStorePhoto" parameterType="Map">
+        insert into business_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,operate)
+        values(#{storePhotoId},#{bId},#{storeId},#{storePhotoTypeCd},#{photo})
+    </insert>
+    <!-- 保存商户证件信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessStoreCerdentials" parameterType="Map">
+        insert into business_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,operate)
+        values(#{storeCerdentialsId},#{bId},#{storeId},#{credentialsCd},#{value},#{validityPeriod},#{positivePhoto},#{negativePhoto},#{operate})
+    </insert>
+
+    <!-- 查询商户信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessStoreInfo" parameterType="Map" resultType="Map">
+        select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,s.operate
+        from business_store s where 1 = 1
+        <if test="operate != null and operate != ''">
+            and s.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and s.store_id = #{storeId}
+        </if>
+    </select>
+
+
+    <!-- 查询商户属性信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessStoreAttrs" parameterType="Map" resultType="Map">
+        select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,sa.operate
+        from business_store_attr sa where 1=1
+        <if test="operate != null and operate != ''">
+            and s.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and sa.store_id = #{storeId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and sa.attr_id = #{attrId}
+        </if>
+    </select>
+
+    <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
+    <select id="getBusinessStorePhoto" parameterType="Map" resultType="Map">
+        select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.operate
+        from business_store_photo sp where 1=1
+        <if test="bId != null and bId !=''">
+            and sp.b_id = #{bId}
+        </if>
+        <if test="operate != null and operate != ''">
+            and sp.operate = #{operate}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and sp.store_id = #{storeId}
+        </if>
+    </select>
+
+    <!-- 查询商户 证件信息 add by wuxw 2018-07-03 -->
+    <select id="getBusinessStoreCerdentials" parameterType="Map" resultType="Map">
+        select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,sc.operate
+        from business_store_cerdentials sc where 1 = 1
+        <if test="bId != null and bId !=''">
+            and sc.b_id = #{bId}
+        </if>
+        <if test="operate != null and operate != ''">
+            and sc.operate = #{operate}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and sc.store_id = #{storeId}
+        </if>
+    </select>
+
+    <!-- 保存商户信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveStoreInfoInstance" parameterType="Map">
+        insert into s_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,status_cd)
+        select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,'0'
+        from business_store s where 
+        s.operate = 'ADD' and s.b_id=#{bId}
+    </insert>
+
+    <!-- 保存商户属性信息到 instance add by wuxw 2018-07-03 -->
+    <insert id="saveStoreAttrsInstance" parameterType="Map">
+        insert into s_store_attr(b_id,attr_id,store_id,spec_cd,value,status_cd)
+        select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,'0'
+        from business_store_attr sa
+        where sa.operate = 'ADD' and sa.b_id=#{bId}
+    </insert>
+    
+    <!-- 保存 商户照片信息 instance add by wuxw 2018-07-03 -->
+    <insert id="saveStorePhotoInstance" parameterType="Map">
+        insert into s_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,status_cd)
+        select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,'0'
+        from business_store_photo sp
+        where  sp.operate = 'ADD' and sp.b_id=#{bId}
+    </insert>
+    <!-- 保存 商户证件信息 instance add by wuxw 2018-07-03 -->
+    <insert id="saveStoreCerdentialsInstance" parameterType="Map">
+        insert into s_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,status_cd)
+        select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,'0'
+        from business_store_cerdentials sc
+        where sc.operate = 'ADD' and sc.b_id=#{bId}
+    </insert>
+
+    <!-- 查询商户信息 add by wuxw 2018-07-03 -->
+    <select id="getStoreInfo" parameterType="Map" resultType="Map">
+        select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,s.status_cd
+        from s_store s
+        where s.status_cd = '0'
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and s.store_id = #{storeId}
+        </if>
+    </select>
+
+    <!-- 查询商户属性信息 add by wuxw 2018-07-03 -->
+    <select id="getStoreAttr" parameterType="Map" resultType="Map">
+        select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,sa.status_cd
+        from s_store_attr sa
+        where sa.status_cd = '0'
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sa.store_id = #{storeId}
+        </if>
+    </select>
+
+    <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
+    <select id="getStorePhoto" parameterType="Map" resultType="Map">
+        select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.status_cd
+        from s_store_photo sp
+        where sp.status_cd = '0'
+        <if test="bId != null and bId !=''">
+            and sp.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sp.store_id = #{storeId}
+        </if>
+    </select>
+
+    <!-- 查询商户证件信息 add by wuxw 2018-07-03 -->
+    <select id="getStoreCerdentials" parameterType="Map" resultType="Map">
+        select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,sc.status_cd
+        from s_store_cerdentials sc
+        where sc.status_cd = '0'
+        <if test="bId != null and bId !=''">
+            and sc.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sc.store_id = #{storeId}
+        </if>
+    </select>
+
+
+    <!-- 修改商户信息 add by wuxw 2018-07-03 -->
+    <update id="updateStoreInfoInstance" parameterType="Map">
+        update s_store s set s.status_cd = #{statusCd}
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and s.store_id = #{storeId}
+        </if>
+    </update>
+
+    <!-- 修改商户属性信息 add by wuxw 2018-07-03 -->
+    <update id="updateStoreAttrInstance" parameterType="Map">
+        update s_store_attr sa set sa.status_cd = #{statusCd}
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sa.store_id = #{storeId}
+        </if>
+        <if test="specCd != null and specCd !=''">
+            and sa.spec_cd = #{specCd}
+        </if>
+    </update>
+
+    <!-- 修改商户照片信息 add by wuxw 2018-07-03 -->
+    <update id="updateStorePhotoInstance" parameterType="Map">
+        update s_store_photo sp set sp.status_cd = #{statusCd}
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and sp.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sp.store_id = #{storeId}
+        </if>
+        <if test="storePhotoId != null and storePhotoId !=''">
+            and sp.store_photo_id = #{storePhotoId}
+        </if>
+    </update>
+
+    <!-- 修改商户证件信息 add by wuxw 2018-07-03 -->
+    <update id="updateStoreCerdentialsInstance" parameterType="Map">
+        update s_store_cerdentials sc set sc.status_cd = #{statusCd}
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and sc.b_id = #{bId}
+        </if>
+        <if test="storeId != null and storeId !=''">
+            and sc.store_id = #{storeId}
+        </if>
+        <if test="storeCerdentialsId != null and storeCerdentialsId !=''">
+            and sc.store_cerdentials_id = #{storeCerdentialsId}
+        </if>
+    </update>
+</mapper>

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

@@ -51,6 +51,9 @@ public class GenerateCodeFactory {
         prefixMap.put("pageTransactionId","1000002");
         prefixMap.put("pageTransactionId","1000002");
         prefixMap.put("dataFlowId","2000");
         prefixMap.put("dataFlowId","2000");
         prefixMap.put("userId","30");
         prefixMap.put("userId","30");
+        prefixMap.put("storeId","40");
+        prefixMap.put("storePhotoId","41");
+        prefixMap.put("storeCerdentialsId","42");
     }
     }
 
 
     private static String PLATFORM_CODE = "0001";
     private static String PLATFORM_CODE = "0001";
@@ -184,6 +187,32 @@ public class GenerateCodeFactory {
     }
     }
 
 
 
 
+    public static String getStoreId()  throws GenerateCodeException{
+        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+            return prefixMap.get("storeId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
+        }
+        //调用服务
+        return getCode(prefixMap.get("storeId"));
+    }
+
+
+    public static String getStorePhotoId()  throws GenerateCodeException{
+        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+            return prefixMap.get("storePhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
+        }
+        //调用服务
+        return getCode(prefixMap.get("storePhotoId"));
+    }
+
+
+    public static String getStoreCerdentialsId()  throws GenerateCodeException{
+        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+            return prefixMap.get("storeCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
+        }
+        //调用服务
+        return getCode(prefixMap.get("storeCerdentialsId"));
+    }
+
     /**
     /**
      * 获取restTemplate
      * 获取restTemplate
      * @return
      * @return