wuxw7
2018-07-03 da79b93b70f86a858baa9e7aef04fa3c04b280ef
商户信息保存功能完成
1个文件已删除
5个文件已修改
1 文件已重命名
1个文件已添加
1144 ■■■■ 已修改文件
StoreService/src/main/java/com/java110/store/dao/IStoreServiceDao.java 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StoreService/src/main/java/com/java110/store/dao/impl/StoreServiceDaoImpl.java 325 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StoreService/src/main/java/com/java110/store/listener/SaveStoreInfoListener.java 271 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/db/StoreService/create_table.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/src/main/resources/mapper/merchant/MerchantServiceDaoImplMapper.xml 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml 232 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StoreService/src/main/java/com/java110/store/dao/IStoreServiceDao.java
@@ -1,6 +1,7 @@
package com.java110.store.dao;
import com.java110.common.exception.DAOException;
import com.java110.entity.merchant.BoMerchant;
import com.java110.entity.merchant.BoMerchantAttr;
import com.java110.entity.merchant.Merchant;
@@ -8,6 +9,7 @@
import java.util.List;
import java.util.Map;
/**
 * 商户组件内部之间使用,没有给外围系统提供服务能力
@@ -18,5 +20,165 @@
 */
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;
}
StoreService/src/main/java/com/java110/store/dao/impl/StoreServiceDaoImpl.java
@@ -1,26 +1,337 @@
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.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 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("storeServiceDaoImpl")
@Transactional
//@Transactional
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));
        }
    }
}
StoreService/src/main/java/com/java110/store/listener/SaveStoreInfoListener.java
@@ -47,21 +47,24 @@
    public void soService(BusinessServiceDataFlowEvent event) {
        //这里处理业务逻辑数据
        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();
        Business business = dataFlowContext.getCurrentBusiness();
        //Assert.hasLength(business.getbId(),"bId 不能为空");
        // Instance 过程
        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过程
            doSaveBusinessUserInfo(dataFlowContext,business);
            doSaveBusinessStoreInfo(dataFlowContext,business);
        }else if(StatusConstant.REQUEST_BUSINESS_TYPE_DELETE.equals(businessType)){ //撤单过程
            doDeleteInstanceUserInfo(dataFlowContext,business);
            doDeleteInstanceStoreInfo(dataFlowContext,business);
        }
        dataFlowContext.setResJson(DataTransactionFactory.createBusinessResponseJson(dataFlowContext,ResponseConstant.RESULT_CODE_SUCCESS,"成功",
@@ -72,33 +75,40 @@
     * 撤单
     * @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");
        Map info = new HashMap();
        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("userId",userInfo.get("user_id").toString());
            info.put("storeId",storeInfo.get("store_id").toString());
            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> userAttrs = storeServiceDaoImpl.queryUserInfoAttrs(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> storeAttrs = storeServiceDaoImpl.getStoreAttrs(info);
        if(storeAttrs != null && storeAttrs.size()>0){
            storeServiceDaoImpl.updateStoreAttrInstance(info);
        }
*/
        //商户照片
        List<Map> storePhotos = storeServiceDaoImpl.getStorePhoto(info);
        if(storePhotos != null && storePhotos.size()>0){
            storeServiceDaoImpl.updateStorePhotoInstance(info);
        }
        //商户属性
        List<Map> storeCerdentialses = storeServiceDaoImpl.getStoreCerdentials(info);
        if(storeCerdentialses != null && storeCerdentialses.size()>0){
            storeServiceDaoImpl.updateStoreCerdentailsInstance(info);
        }
    }
@@ -106,28 +116,35 @@
     * instance过程
     * @param business
     */
    private void doSaveInstanceUserInfo(DataFlowContext dataFlowContext,Business business) {
    private void doSaveInstanceStoreInfo(DataFlowContext dataFlowContext, Business business) {
        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("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 @@
    }
    /**
     * 处理用户信息
     * 处理商户信息
     * @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.jsonObjectHaveKey(data,"businessUser","datas 节点下没有包含 businessUser 节点");
        JSONObject businessUser = data.getJSONObject("businessUser");
        Assert.jsonObjectHaveKey(businessUser,"userId","businessUser 节点下没有包含 userId 节点");
        if(businessUser.getInteger("userId") < 0){
            //生成userId
            String userId = GenerateCodeFactory.getUserId();
            businessUser.put("userId",userId);
        //处理 businessStore 节点
        if(data.containsKey("businessStore")){
            JSONObject businessStore = data.getJSONObject("businessStore");
            doBusinessStore(business,businessStore);
            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
        }
        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);
        }*/
        if(data.containsKey("businessStorePhoto")){
            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
            doBusinessStorePhoto(business,businessStorePhotos);
        }
        if(data.containsKey("businessStoreCerdentials")){
            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
        }
        //storeServiceDaoImpl.saveUserInfoInstance(businessUser);
    }
    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 节点");
    /**
     * 保存商户照片
     * @param business 业务对象
     * @param businessStorePhotos 商户照片
     */
    private void doBusinessStorePhoto(Business business, JSONArray businessStorePhotos) {
            if(userAttr.getInteger("attrId") < 0){
        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);
        }
    }
    /**
     * 处理 businessStore 节点
     * @param business 总的数据节点
     * @param businessStore 商户节点
     */
    private void doBusinessStore(Business business,JSONObject businessStore){
        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
        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();
                userAttr.put("attrId",attrId);
                storeAttr.put("attrId",attrId);
            }
            userAttr.put("bId",business.getbId());
            userAttr.put("userId",businessUser.getString("userId"));
            userAttr.put("operate", StatusConstant.OPERATE_ADD);
            storeAttr.put("bId",business.getbId());
            storeAttr.put("storeId",businessStore.getString("storeId"));
            storeAttr.put("operate", StatusConstant.OPERATE_ADD);
            storeServiceDaoImpl.saveBusinessUserAttr(userAttr);
        }*/
        /*JSONObject attrInstance = new JSONObject();
        attrInstance.put("bId",business.getbId());
        storeServiceDaoImpl.saveUserAttrInstance(attrInstance);*/
            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);
        }
    }
    /**
     * 刷新 商户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() {
        return storeServiceDaoImpl;
    }
java110-config/db/StoreService/create_table.sql
@@ -59,7 +59,7 @@
    name varchar(100) not null comment '店铺名称',
    address varchar(200) 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米',
    map_x varchar(20) not null comment '地区 x坐标',
    map_y varchar(20) not null comment '地区 y坐标',
java110-config/src/main/resources/mapper/merchant/MerchantServiceDaoImplMapper.xml
File was deleted
java110-config/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml
java110-config/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml
New file
@@ -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>
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -51,6 +51,9 @@
        prefixMap.put("pageTransactionId","1000002");
        prefixMap.put("dataFlowId","2000");
        prefixMap.put("userId","30");
        prefixMap.put("storeId","40");
        prefixMap.put("storePhotoId","41");
        prefixMap.put("storeCerdentialsId","42");
    }
    private static String PLATFORM_CODE = "0001";
@@ -184,6 +187,32 @@
    }
    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
     * @return