wuxw7
2018-07-08 80478815dcce0329fa192ffd53060e736f7b6700
商品服务开发完成
10个文件已修改
18个文件已添加
4467 ■■■■ 已修改文件
ShopService/doc/deleteShopInfo.json 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/doc/savaShopCatalog.json 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/doc/savaShopInfo.json 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/doc/updateShopInfo.json 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/dao/IShopServiceDao.java 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/dao/impl/ShopServiceDaoImpl.java 434 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/AbstractShopBusinessServiceDataFlowListener.java 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/DeleteShopAttrAndAttrParamListener.java 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/DeleteShopDescListener.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/DeleteShopInfoListener.java 200 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/DeleteShopPhotoListener.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/DeleteShopPreferentialListener.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/FlushAboutShopIdListener.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/SaveShopAttrAndAttrParamListener.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/SaveShopDescListener.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/SaveShopInfoListener.java 223 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/SaveShopPhotoListener.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/SaveShopPreferentialListener.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/UpdateShopAttrAndAttrParamListener.java 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/UpdateShopDescListener.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/UpdateShopInfoListener.java 227 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/UpdateShopPhotoListener.java 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/src/main/java/com/java110/shop/listener/UpdateShopPreferentialListener.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/db/ShopService/create_table.sql 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml 457 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-event/src/main/java/com/java110/event/service/AbstractBusinessServiceDataFlowListener.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ShopService/doc/deleteShopInfo.json
New file
@@ -0,0 +1,49 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "delete.shop.info",
    "serviceName": "删除商品信息",
    "remark": "备注",
    "datas": {
      "businessShop": {
        "shopId": "123456"
      },
      "businessShopAttr": [{
        "shopId": "123456",
        "attrId":"123123"
      }],
      "businessShopPhoto":[{
        "shopPhotoId":"123123",
        "shopId":"123456"
      }],
      "businessShopAttrParam":[{
        "attrParamId":"123123",
        "shopId":"123456"
      }],
      "businessShopPreferential":{
        "shopPreferentialId":"23213",
        "shopId":"123456"
      },
      "businessShopDesc":{
        "shopDescId":"343434",
        "shopId":"123456"
      }
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
ShopService/doc/savaShopCatalog.json
New file
@@ -0,0 +1,33 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "save.shop.catalog",
    "serviceName": "保存商品目录",
    "remark": "备注",
    "datas": {
      "businessShopCatalog":[{
        "catalogId":"-1",
        "storeId":"123",
        "name":"盖浇饭",
        "level":"1",
        "parentCatalogId":"-1"
      }]
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
ShopService/doc/savaShopInfo.json
New file
@@ -0,0 +1,70 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "save.shop.info",
    "serviceName": "保存商品信息",
    "remark": "备注",
    "datas": {
      "businessShop": {
        "shopId": "-1",
        "storeId": "123",
        "catalogId":"-1",
        "name": "西红柿鸡蛋盖浇饭",
        "hotBuy": "Y",
        "salePrice": "12.00",
        "openShopCount": "N",
        "shopCount": "1",
        "startDate": "2018-07-07 11:04:00",
        "endDate": "2019-07-07 11:04:00"
      },
      "businessShopAttr": [{
        "shopId": "-1",
        "attrId":"-1",
        "specCd":"1001",
        "value":"01"
      }],
      "businessShopPhoto":[{
        "shopPhotoId":"-1",
        "shopId":"-1",
        "shopPhotoTypeCd":"L",
        "photo":"123.jpg"
      }],
      "businessShopAttrParam":[{
        "attrParamId":"-1",
        "shopId":"-1",
        "specCd":"123",
        "param":"加米"
      }],
      "businessShopPreferential":{
        "shopPreferentialId":"-1",
        "shopId":"-1",
        "originalPrice":"12.00",
        "discountRate":"1.00",
        "showOriginalPrice":"N",
        "preferentialStartDate":"2018-07-07 12:17:00",
        "preferentialEndDate":"2018-07-08 12:17:00"
      },
      "businessShopDesc":{
        "shopDescId":"-1",
        "shopId":"-1",
        "shopDescribe":""
      }
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
ShopService/doc/updateShopInfo.json
New file
@@ -0,0 +1,70 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "update.shop.info",
    "serviceName": "修改商品信息",
    "remark": "备注",
    "datas": {
      "businessShop": {
        "shopId": "123456",
        "storeId": "123",
        "catalogId":"-1",
        "name": "西红柿鸡蛋盖浇饭",
        "hotBuy": "Y",
        "salePrice": "12.00",
        "openShopCount": "N",
        "shopCount": "1",
        "startDate": "2018-07-07 11:04:00",
        "endDate": "2019-07-07 11:04:00"
      },
      "businessShopAttr": [{
        "shopId": "123456",
        "attrId":"123123",
        "specCd":"1001",
        "value":"01"
      }],
      "businessShopPhoto":[{
        "shopPhotoId":"123123",
        "shopId":"123456",
        "shopPhotoTypeCd":"L",
        "photo":"123.jpg"
      }],
      "businessShopAttrParam":[{
        "attrParamId":"123123",
        "shopId":"123456",
        "specCd":"123",
        "param":"加米"
      }],
      "businessShopPreferential":{
        "shopPreferentialId":"23213",
        "shopId":"123456",
        "originalPrice":"12.00",
        "discountRate":"1.00",
        "showOriginalPrice":"N",
        "preferentialStartDate":"2018-07-07 12:17:00",
        "preferentialEndDate":"2018-07-08 12:17:00"
      },
      "businessShopDesc":{
        "shopDescId":"343434",
        "shopId":"123456",
        "shopDescribe":""
      }
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
ShopService/src/main/java/com/java110/shop/dao/IShopServiceDao.java
@@ -7,8 +7,8 @@
import java.util.Map;
/**
 * 商户组件内部之间使用,没有给外围系统提供服务能力
 * 商户服务接口类,要求全部以字符串传输,方便微服务化
 * 商品组件内部之间使用,没有给外围系统提供服务能力
 * 商品服务接口类,要求全部以字符串传输,方便微服务化
 * 新建客户,修改客户,删除客户,查询客户等功能
 *
 * Created by wuxw on 2016/12/27.
@@ -16,165 +16,238 @@
public interface IShopServiceDao {
    /**
     * 保存 商户信息
     * @param businessStoreInfo 商户信息 封装
     * 保存 商品信息
     * @param businessShopInfo 商品信息 封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessStoreInfo(Map businessStoreInfo) throws DAOException;
    public void saveBusinessShopInfo(Map businessShopInfo) throws DAOException;
    /**
     * 保存商户属性
     * @param businessStoreAttr 商户属性信息封装
     * 保存商品属性
     * @param businessShopAttr 商品属性信息封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessStoreAttr(Map businessStoreAttr) throws DAOException;
    public void saveBusinessShopAttr(Map businessShopAttr) throws DAOException;
    /**
     * 保存商户照片信息
     * @param businessStorePhoto 商户照片
     * 保存 商品属性参数
     * @param businessShopAttrParam 商品属性参数信息封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessStorePhoto(Map businessStorePhoto) throws DAOException;
    public void saveBusinessShopAttrParam(Map businessShopAttrParam) throws DAOException;
    /**
     * 保存商户证件信息
     * @param businessStoreCerdentials 商户证件
     * 保存商品照片信息
     * @param businessShopPhoto 商品照片
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessStoreCerdentials(Map businessStoreCerdentials) throws DAOException;
    public void saveBusinessShopPhoto(Map businessShopPhoto) throws DAOException;
    /**
     * 查询商户信息(business过程)
     * 根据bId 查询商户信息
     * @param info bId 信息
     * @return 商户信息
     * 保存商品证件信息
     * @param businessShopPreferential 商品证件
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopPreferential(Map businessShopPreferential) throws DAOException;
    /**
     * 保存商品 描述 信息
     * @param businessShopDesc 商品 描述信息
     * @throws DAOException
     */
    public Map getBusinessStoreInfo(Map info) throws DAOException;
    public void saveBusinessShopDesc(Map businessShopDesc) throws DAOException;
    /**
     * 查询商户属性信息(business过程)
     * 查询商品信息(business过程)
     * 根据bId 查询商品信息
     * @param info bId 信息
     * @return 商户属性
     * @return 商品信息
     * @throws DAOException
     */
    public List<Map> getBusinessStoreAttrs(Map info) throws DAOException;
    public Map getBusinessShopInfo(Map info) throws DAOException;
    /**
     * 查询商户照片
     * 查询商品属性信息(business过程)
     * @param info bId 信息
     * @return 商户照片
     * @return 商品属性
     * @throws DAOException
     */
    public List<Map> getBusinessStorePhoto(Map info) throws DAOException;
    public List<Map> getBusinessShopAttrs(Map info) throws DAOException;
    /**
     * 查询商户证件信息
     * 查询商品属性参数信息(business过程)
     * @param info bId 信息
     * @return 商户照片
     * @return 商品属性参数
     * @throws DAOException
     */
    public List<Map> getBusinessStoreCerdentials(Map info) throws DAOException;
    public List<Map> getBusinessShopAttrParams(Map info) throws DAOException;
    /**
     * 保存 商户信息 Business数据到 Instance中
     * 查询商品照片
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public List<Map> getBusinessShopPhoto(Map info) throws DAOException;
    /**
     * 查询商品优惠信息
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public Map getBusinessShopPreferential(Map info) throws DAOException;
    /**
     * 查询商品描述信息
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public Map getBusinessShopDesc(Map info) throws DAOException;
    /**
     * 保存 商品信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveStoreInfoInstance(Map info) throws DAOException;
    public void saveShopInfoInstance(Map info) throws DAOException;
    /**
     * 保存 商户属性信息 Business数据到 Instance中
     * 保存 商品属性信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveStoreAttrsInstance(Map info) throws DAOException;
    public void saveShopAttrsInstance(Map info) throws DAOException;
    /**
     * 保存 商户照片信息 Business数据到 Instance中
     * 保存 商户属性参数 business 数据到 Instance 中
     * @param info
     * @throws DAOException
     */
    public void saveStorePhotoInstance(Map info) throws DAOException;
    public void saveShopAttrParamsInstance(Map info) throws DAOException;
    /**
     * 保存 商户证件信息 Business数据到 Instance中
     * 保存 商品照片信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveStoreCerdentialsInstance(Map info) throws DAOException;
    public void saveShopPhotoInstance(Map info) throws DAOException;
    /**
     * 查询商户信息(instance过程)
     * 根据bId 查询商户信息
     * @param info bId 信息
     * @return 商户信息
     * 保存 商品证件信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public Map getStoreInfo(Map info) throws DAOException;
    public void saveShopPreferentialInstance(Map info) throws DAOException;
    /**
     * 查询商户属性信息(instance过程)
     * @param info bId 信息
     * @return 商户属性
     * 保存 商品描述信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public List<Map> getStoreAttrs(Map info) throws DAOException;
    public void saveShopDescInstance(Map info) throws DAOException;
    /**
     * 查询商户照片(instance 过程)
     * 查询商品信息(instance过程)
     * 根据bId 查询商品信息
     * @param info bId 信息
     * @return 商户照片
     * @return 商品信息
     * @throws DAOException
     */
    public List<Map> getStorePhoto(Map info) throws DAOException;
    public Map getShopInfo(Map info) throws DAOException;
    /**
     * 查询商户证件信息(instance 过程)
     * 查询商品属性信息(instance过程)
     * @param info bId 信息
     * @return 商户照片
     * @return 商品属性
     * @throws DAOException
     */
    public List<Map> getStoreCerdentials(Map info) throws DAOException;
    public List<Map> getShopAttrs(Map info) throws DAOException;
    /**
     * 修改商户信息
     * 查询商品属性参数信息 (instance过程)
     * @param info bId 信息
     * @return 商品属性参数
     * @throws DAOException
     */
    public List<Map> getShopAttrParams(Map info) throws DAOException;
    /**
     * 查询商品照片(instance 过程)
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public List<Map> getShopPhoto(Map info) throws DAOException;
    /**
     * 查询商品优惠信息(instance 过程)
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public Map getShopPreferential(Map info) throws DAOException;
    /**
     * 查询商品描述信息(instance 过程)
     * @param info bId 信息
     * @return 商品照片
     * @throws DAOException
     */
    public Map getShopDesc(Map info) throws DAOException;
    /**
     * 修改商品信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateStoreInfoInstance(Map info) throws DAOException;
    public void updateShopInfoInstance(Map info) throws DAOException;
    /**
     * 修改商户属性信息
     * 修改商品属性信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateStoreAttrInstance(Map info) throws DAOException;
    public void updateShopAttrInstance(Map info) throws DAOException;
    /**
     * 修改商品属性参数信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopAttrParamInstance(Map info) throws DAOException;
    /**
     * 修改商户照片信息
     * 修改商品照片信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateStorePhotoInstance(Map info) throws DAOException;
    public void updateShopPhotoInstance(Map info) throws DAOException;
    /**
     * 修改商户证件信息
     * 修改商品优惠信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateStoreCerdentailsInstance(Map info) throws DAOException;
    public void updateShopPreferentialInstance(Map info) throws DAOException;
    /**
     * 修改商品描述信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopDescInstance(Map info) throws DAOException;
}
ShopService/src/main/java/com/java110/shop/dao/impl/ShopServiceDaoImpl.java
@@ -14,7 +14,7 @@
import java.util.Map;
/**
 * 商户服务 与数据库交互
 * 商品服务 与数据库交互
 * Created by wuxw on 2017/4/5.
 */
@Service("shopServiceDaoImpl")
@@ -24,317 +24,495 @@
    private final static Logger logger = LoggerFactory.getLogger(ShopServiceDaoImpl.class);
    /**
     * 商户信息封装
     * @param businessStoreInfo 商户信息 封装
     * 商品信息封装
     * @param businessShopInfo 商品信息 封装
     * @throws DAOException
     */
    @Override
    public void saveBusinessStoreInfo(Map businessStoreInfo) throws DAOException {
        businessStoreInfo.put("month", DateUtil.getCurrentMonth());
    public void saveBusinessShopInfo(Map businessShopInfo) throws DAOException {
        businessShopInfo.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商户信息 入参 businessStoreInfo : {}",businessStoreInfo);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreInfo",businessStoreInfo);
        logger.debug("保存商品信息 入参 businessShopInfo : {}",businessShopInfo);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopInfo",businessShopInfo);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户数据失败:"+ JSONObject.toJSONString(businessStoreInfo));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品数据失败:"+ JSONObject.toJSONString(businessShopInfo));
        }
    }
    /**
     * 商户属性信息分装
     * @param businessStoreAttr 商户属性信息封装
     * 商品属性信息分装
     * @param businessShopAttr 商品属性信息封装
     * @throws DAOException
     */
    @Override
    public void saveBusinessStoreAttr(Map businessStoreAttr) throws DAOException {
        businessStoreAttr.put("month", DateUtil.getCurrentMonth());
    public void saveBusinessShopAttr(Map businessShopAttr) throws DAOException {
        businessShopAttr.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商户属性信息 入参 businessStoreAttr : {}",businessStoreAttr);
        logger.debug("保存商品属性信息 入参 businessShopAttr : {}",businessShopAttr);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreAttr",businessStoreAttr);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopAttr",businessShopAttr);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户属性数据失败:"+ JSONObject.toJSONString(businessStoreAttr));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性数据失败:"+ JSONObject.toJSONString(businessShopAttr));
        }
    }
    /**
     * 保存商户照片信息
     * @param businessStorePhoto 商户照片
     * 商品属性参数保存
     * @param businessShopAttrParam 商品属性参数信息封装
     * @throws DAOException
     */
    @Override
    public void saveBusinessStorePhoto(Map businessStorePhoto) throws DAOException {
        businessStorePhoto.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商户照片信息 入参 businessStorePhoto : {}",businessStorePhoto);
    public void saveBusinessShopAttrParam(Map businessShopAttrParam) throws DAOException {
        businessShopAttrParam.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商品属性参数信息 入参 businessShopAttr : {}",businessShopAttrParam);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStorePhoto",businessStorePhoto);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopAttrParam",businessShopAttrParam);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户照片数据失败:"+ JSONObject.toJSONString(businessStorePhoto));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性参数数据失败:"+ JSONObject.toJSONString(businessShopAttrParam));
        }
    }
    /**
     * 保存商户证件信息
     * @param businessStoreCerdentials 商户证件
     * 保存商品照片信息
     * @param businessShopPhoto 商品照片
     * @throws DAOException
     */
    @Override
    public void saveBusinessStoreCerdentials(Map businessStoreCerdentials) throws DAOException {
        businessStoreCerdentials.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商户证件信息 入参 businessStoreCerdentials : {}",businessStoreCerdentials);
    public void saveBusinessShopPhoto(Map businessShopPhoto) throws DAOException {
        businessShopPhoto.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品照片信息 入参 businessShopPhoto : {}",businessShopPhoto);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreCerdentials",businessStoreCerdentials);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopPhoto",businessShopPhoto);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户证件数据失败:"+ JSONObject.toJSONString(businessStoreCerdentials));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品照片数据失败:"+ JSONObject.toJSONString(businessShopPhoto));
        }
    }
    /**
     * 查询商户信息
     * 保存商品证件信息
     * @param businessShopPreferential 商品证件
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopPreferential(Map businessShopPreferential) throws DAOException {
        businessShopPreferential.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品优惠信息 入参 businessShopPreferential : {}",businessShopPreferential);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopPreferential",businessShopPreferential);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品证件数据失败:"+ JSONObject.toJSONString(businessShopPreferential));
        }
    }
    /**
     * 保存 商品描述信息
     * @param businessShopDesc 商品 描述信息
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopDesc(Map businessShopDesc) throws DAOException {
        businessShopDesc.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品描述信息 入参 businessShopDesc : {}",businessShopDesc);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopDesc",businessShopDesc);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品描述数据失败:"+ JSONObject.toJSONString(businessShopDesc));
        }
    }
    /**
     * 查询商品信息
     * @param info bId 信息
     * @return 商户信息
     * @return 商品信息
     * @throws DAOException
     */
    @Override
    public Map getBusinessStoreInfo(Map info) throws DAOException {
    public Map getBusinessShopInfo(Map info) throws DAOException {
        logger.debug("查询商户信息 入参 info : {}",info);
        logger.debug("查询商品信息 入参 info : {}",info);
        List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreInfo",info);
        if(businessStoreInfos == null){
        List<Map> businessShopInfos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopInfo",info);
        if(businessShopInfos == null){
            return null;
        }
        if(businessStoreInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessStoreInfos,"+ JSONObject.toJSONString(info));
        if(businessShopInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopInfos,"+ JSONObject.toJSONString(info));
        }
        return businessStoreInfos.get(0);
        return businessShopInfos.get(0);
    }
    /**
     * 查询商户属性
     * 查询商品属性
     * @param info bId 信息
     * @return 商户属性
     * @return 商品属性
     * @throws DAOException
     */
    @Override
    public List<Map> getBusinessStoreAttrs(Map info) throws DAOException {
        logger.debug("查询商户属性信息 入参 info : {}",info);
    public List<Map> getBusinessShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品属性信息 入参 info : {}",info);
        List<Map> businessStoreAttrs = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreAttrs",info);
        List<Map> businessShopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopAttrs",info);
        return businessStoreAttrs;
        return businessShopAttrs;
    }
    /**
     * 查询商户照片
     * 查询商品属性参数信息
     * @param info bId 信息
     * @return 商品属性参数信息
     * @throws DAOException
     */
    @Override
    public List<Map> getBusinessShopAttrParams(Map info) throws DAOException {
        logger.debug("查询商品属性参数信息 入参 info : {}",info);
        List<Map> businessShopAttrParams = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopAttrParams",info);
        return businessShopAttrParams;
    }
    /**
     * 查询商品照片
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getBusinessStorePhoto(Map info) throws DAOException {
        logger.debug("查询商户照片信息 入参 info : {}",info);
    public List<Map> getBusinessShopPhoto(Map info) throws DAOException {
        logger.debug("查询商品照片信息 入参 info : {}",info);
        List<Map> businessStorePhotos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStorePhoto",info);
        List<Map> businessShopPhotos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopPhoto",info);
        return businessStorePhotos;
        return businessShopPhotos;
    }
    /**
     * 查询商户证件
     * 查询商品优惠
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getBusinessStoreCerdentials(Map info) throws DAOException {
        logger.debug("查询商户证件信息 入参 info : {}",info);
    public Map getBusinessShopPreferential(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> businessStoreCerdentialses = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessStoreCerdentials",info);
        List<Map> businessShopPreferentiales = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopPreferential",info);
        if(businessShopPreferentiales == null){
            return null;
        }
        if(businessShopPreferentiales.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopPreferentiales,"+ JSONObject.toJSONString(info));
        }
        return businessStoreCerdentialses;
        return businessShopPreferentiales.get(0);
    }
    /**
     * 保存商户信息 到 instance
     * 查询商品描述
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBusinessShopDesc(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> businessShopDesces = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopDesc",info);
        if(businessShopDesces == null){
            return null;
        }
        if(businessShopDesces.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopDesces,"+ JSONObject.toJSONString(info));
        }
        return businessShopDesces.get(0);
    }
    /**
     * 保存商品信息 到 instance
     * @param info   bId 信息
     * @throws DAOException
     */
    @Override
    public void saveStoreInfoInstance(Map info) throws DAOException {
        logger.debug("保存商户信息Instance 入参 info : {}",info);
    public void saveShopInfoInstance(Map info) throws DAOException {
        logger.debug("保存商品信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStoreInfoInstance",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户信息Instance数据失败:"+ JSONObject.toJSONString(info));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveStoreAttrsInstance(Map info) throws DAOException {
        logger.debug("保存商户属性信息Instance 入参 info : {}",info);
    public void saveShopAttrsInstance(Map info) throws DAOException {
        logger.debug("保存商品属性信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveStoreAttrsInstance",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopAttrsInstance",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));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 查询商户信息(instance)
     * 保存 商品属性 参数 至 business
     * @param info b_id
     * @throws DAOException
     */
    @Override
    public void saveShopAttrParamsInstance(Map info) throws DAOException {
        logger.debug("保存商品属性参数信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopAttrParamsInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性参数信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveShopPhotoInstance(Map info) throws DAOException {
        logger.debug("保存商品照片信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopPhotoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveShopPreferentialInstance(Map info) throws DAOException {
        logger.debug("保存商品证件信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopPreferentialInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveShopDescInstance(Map info) throws DAOException {
        logger.debug("保存商品描述信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopDescInstance",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);
    public Map getShopInfo(Map info) throws DAOException {
        logger.debug("查询商品信息 入参 info : {}",info);
        List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreInfo",info);
        if(businessStoreInfos == null || businessStoreInfos.size() == 0){
        List<Map> businessShopInfos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopInfo",info);
        if(businessShopInfos == null || businessShopInfos.size() == 0){
            return null;
        }
        if(businessStoreInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getStoreInfo,"+ JSONObject.toJSONString(info));
        if(businessShopInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopInfo,"+ JSONObject.toJSONString(info));
        }
        return businessStoreInfos.get(0);
        return businessShopInfos.get(0);
    }
    /**
     * 商户属性查询(instance)
     * 商品属性查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getStoreAttrs(Map info) throws DAOException {
        logger.debug("查询商户属性信息 入参 info : {}",info);
    public List<Map> getShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品属性信息 入参 info : {}",info);
        List<Map> storeAttrs = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreAttrs",info);
        List<Map> shopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopAttrs",info);
        return storeAttrs;
        return shopAttrs;
    }
    /**
     * 商户照片查询(instance)
     * 商品属性参数查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getStorePhoto(Map info) throws DAOException {
        logger.debug("查询商户照片信息 入参 info : {}",info);
    public List<Map> getShopAttrParams(Map info) throws DAOException {
        logger.debug("查询商品属性参数信息 入参 info : {}",info);
        List<Map> storePhotos = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStorePhoto",info);
        List<Map> shopAttrParams = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopAttrParams",info);
        return storePhotos;
        return shopAttrParams;
    }
    /**
     * 商户证件查询(instance)
     * 商品照片查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getStoreCerdentials(Map info) throws DAOException {
        logger.debug("查询商户证件信息 入参 info : {}",info);
    public List<Map> getShopPhoto(Map info) throws DAOException {
        logger.debug("查询商品照片信息 入参 info : {}",info);
        List<Map> storeCerdentialses = sqlSessionTemplate.selectList("storeServiceDaoImpl.getStoreCerdentials",info);
        List<Map> shopPhotos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopPhoto",info);
        return storeCerdentialses;
        return shopPhotos;
    }
    /**
     * 修改商户信息
     * 商品优惠查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getShopPreferential(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> shopPreferentiales = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopPreferential",info);
        if(shopPreferentiales == null || shopPreferentiales.size() == 0){
            return null;
        }
        if(shopPreferentiales.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopInfo,"+ JSONObject.toJSONString(info));
        }
        return shopPreferentiales.get(0);
    }
    /**
     * 商品描述查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getShopDesc(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> shopDesces = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopDesc",info);
        if(shopDesces == null || shopDesces.size() == 0){
            return null;
        }
        if(shopDesces.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopInfo,"+ JSONObject.toJSONString(info));
        }
        return shopDesces.get(0);
    }
    /**
     * 修改商品信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateStoreInfoInstance(Map info) throws DAOException {
        logger.debug("修改商户信息Instance 入参 info : {}",info);
    public void updateShopInfoInstance(Map info) throws DAOException {
        logger.debug("修改商品信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreInfoInstance",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户信息Instance数据失败:"+ JSONObject.toJSONString(info));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商户属性信息(instance)
     * 修改商品属性信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateStoreAttrInstance(Map info) throws DAOException {
        logger.debug("修改商户属性信息Instance 入参 info : {}",info);
    public void updateShopAttrInstance(Map info) throws DAOException {
        logger.debug("修改商品属性信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreAttrInstance",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopAttrInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改 商户照片信息
     * 修改商品属性参数(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateStorePhotoInstance(Map info) throws DAOException {
        logger.debug("修改商户照片信息Instance 入参 info : {}",info);
    public void updateShopAttrParamInstance(Map info) throws DAOException {
        logger.debug("修改商品属性参数信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStorePhotoInstance",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopAttrParamInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
            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);
    public void updateShopPhotoInstance(Map info) throws DAOException {
        logger.debug("修改商品照片信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateStoreCerdentailsInstance",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopPhotoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品证件信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopPreferentialInstance(Map info) throws DAOException {
        logger.debug("修改商品证件信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopPreferentialInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品描述信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopDescInstance(Map info) throws DAOException {
        logger.debug("修改商品描述信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopDescInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品描述信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
}
ShopService/src/main/java/com/java110/shop/listener/AbstractShopBusinessServiceDataFlowListener.java
@@ -27,158 +27,237 @@
    public abstract IShopServiceDao getShopServiceDaoImpl();
    /**
     * 刷新 businessStoreInfo 数据
     * 刷新 businessShopInfo 数据
     * 主要将 数据库 中字段和 接口传递字段建立关系
     * @param businessStoreInfo
     * @param businessShopInfo
     */
    protected void flushBusinessStoreInfo(Map businessStoreInfo,String statusCd){
        businessStoreInfo.put("newBId",businessStoreInfo.get("b_id"));
        businessStoreInfo.put("storeId",businessStoreInfo.get("store_id"));
        businessStoreInfo.put("userId",businessStoreInfo.get("user_id"));
        businessStoreInfo.put("storeTypeCd",businessStoreInfo.get("store_type_cd"));
        businessStoreInfo.put("nearbyLandmarks",businessStoreInfo.get("nearby_landmarks"));
        businessStoreInfo.put("mapX",businessStoreInfo.get("map_x"));
        businessStoreInfo.put("mapY",businessStoreInfo.get("map_y"));
        businessStoreInfo.put("statusCd", statusCd);
    protected void flushBusinessShopInfo(Map businessShopInfo,String statusCd){
        businessShopInfo.put("newBId",businessShopInfo.get("b_id"));
        businessShopInfo.put("shopId",businessShopInfo.get("shop_id"));
        businessShopInfo.put("storeId",businessShopInfo.get("store_id"));
        businessShopInfo.put("catalogId",businessShopInfo.get("catalog_id"));
        businessShopInfo.put("hotBuy",businessShopInfo.get("hot_buy"));
        businessShopInfo.put("salePrice",businessShopInfo.get("sale_price"));
        businessShopInfo.put("openShopCount",businessShopInfo.get("open_shop_count"));
        businessShopInfo.put("shopCount",businessShopInfo.get("shop_count"));
        businessShopInfo.put("startDate",businessShopInfo.get("start_date"));
        businessShopInfo.put("endDate",businessShopInfo.get("end_date"));
        businessShopInfo.put("statusCd", statusCd);
    }
    /**
        刷新 businessStoreAttr 数据
        刷新 businessShopAttr 数据
     * 主要将 数据库 中字段和 接口传递字段建立关系
     * @param businessStoreAttr
     * @param businessShopAttr
     * @param statusCd
     */
    protected void flushBusinessStoreAttr(Map businessStoreAttr,String statusCd){
        businessStoreAttr.put("attrId",businessStoreAttr.get("attr_id"));
        businessStoreAttr.put("specCd",businessStoreAttr.get("spec_cd"));
        businessStoreAttr.put("storeId",businessStoreAttr.get("store_id"));
        businessStoreAttr.put("newBId",businessStoreAttr.get("b_id"));
        businessStoreAttr.put("statusCd",statusCd);
    protected void flushBusinessShopAttr(Map businessShopAttr,String statusCd){
        businessShopAttr.put("attrId",businessShopAttr.get("attr_id"));
        businessShopAttr.put("specCd",businessShopAttr.get("spec_cd"));
        businessShopAttr.put("shopId",businessShopAttr.get("shop_id"));
        businessShopAttr.put("newBId",businessShopAttr.get("b_id"));
        businessShopAttr.put("statusCd",statusCd);
    }
    /**
     * 刷新 businessStorePhoto 数据
     * @param businessStorePhoto
     * 刷新 businessShopAttrParam 数据
     * @param businessShopAttrParam
     * @param statusCd
     */
    protected void flushBusinessStorePhoto(Map businessStorePhoto,String statusCd){
        businessStorePhoto.put("storeId",businessStorePhoto.get("store_id"));
        businessStorePhoto.put("storePhotoId",businessStorePhoto.get("store_photo_id"));
        businessStorePhoto.put("storePhotoTypeCd",businessStorePhoto.get("store_photo_type_cd"));
        businessStorePhoto.put("newBId",businessStorePhoto.get("b_id"));
        businessStorePhoto.put("statusCd",statusCd);
    protected void flushBusinessShopAttrParam(Map businessShopAttrParam,String statusCd){
        businessShopAttrParam.put("newBId",businessShopAttrParam.get("b_id"));
        businessShopAttrParam.put("attrParamId",businessShopAttrParam.get("attr_param_id"));
        businessShopAttrParam.put("shopId",businessShopAttrParam.get("shop_id"));
        businessShopAttrParam.put("specCd",businessShopAttrParam.get("spec_cd"));
        businessShopAttrParam.put("statusCd",statusCd);
    }
    /**
     * 刷新 businessStoreCerdentials 数据
     * @param businessStoreCerdentials
     * 刷新 businessShopPhoto 数据
     * @param businessShopPhoto
     * @param statusCd
     */
    protected void flushBusinessStoreCredentials(Map businessStoreCerdentials ,String statusCd){
        businessStoreCerdentials.put("storeId",businessStoreCerdentials.get("store_id"));
        businessStoreCerdentials.put("storeCerdentialsId",businessStoreCerdentials.get("store_cerdentials_id"));
        businessStoreCerdentials.put("credentialsCd",businessStoreCerdentials.get("credentials_cd"));
        businessStoreCerdentials.put("validityPeriod",businessStoreCerdentials.get("validity_period"));
        businessStoreCerdentials.put("positivePhoto",businessStoreCerdentials.get("positive_photo"));
        businessStoreCerdentials.put("negativePhoto",businessStoreCerdentials.get("negative_photo"));
        businessStoreCerdentials.put("newBId",businessStoreCerdentials.get("b_id"));
        businessStoreCerdentials.put("statusCd",statusCd);
    protected void flushBusinessShopPhoto(Map businessShopPhoto,String statusCd){
        businessShopPhoto.put("shopId",businessShopPhoto.get("shop_id"));
        businessShopPhoto.put("shopPhotoId",businessShopPhoto.get("shop_photo_id"));
        businessShopPhoto.put("shopPhotoTypeCd",businessShopPhoto.get("shop_photo_type_cd"));
        businessShopPhoto.put("newBId",businessShopPhoto.get("b_id"));
        businessShopPhoto.put("statusCd",statusCd);
    }
    /**
     * 刷新 businessShopPreferential 数据
     * @param businessShopPreferential
     * @param statusCd
     */
    protected void flushBusinessShopPreferential(Map businessShopPreferential ,String statusCd){
        businessShopPreferential.put("shopPreferentialId",businessShopPreferential.get("shop_preferential_id"));
        businessShopPreferential.put("shopId",businessShopPreferential.get("shop_id"));
        businessShopPreferential.put("originalPrice",businessShopPreferential.get("original_price"));
        businessShopPreferential.put("discountRate",businessShopPreferential.get("discount_rate"));
        businessShopPreferential.put("showOriginalPrice",businessShopPreferential.get("show_original_price"));
        businessShopPreferential.put("preferentialStartDate",businessShopPreferential.get("preferential_start_date"));
        businessShopPreferential.put("preferentialEndDate",businessShopPreferential.get("preferential_end_date"));
        businessShopPreferential.put("newBId",businessShopPreferential.get("b_id"));
        businessShopPreferential.put("statusCd",statusCd);
    }
    /**
     * 刷新 businessShopDesc 数据
     * @param businessShopDesc
     * @param statusCd
     */
    protected void flushBusinessShopDesc(Map businessShopDesc ,String statusCd){
        businessShopDesc.put("shopDescId",businessShopDesc.get("shop_desc_id"));
        businessShopDesc.put("shopId",businessShopDesc.get("shop_id"));
        businessShopDesc.put("shopDescribe",businessShopDesc.get("shop_describe"));
        businessShopDesc.put("newBId",businessShopDesc.get("b_id"));
        businessShopDesc.put("statusCd",statusCd);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param businessStore 商户信息
     * @param businessShop 商户信息
     */
    protected void autoSaveDelBusinessStore(Business business, JSONObject businessStore){
    protected void autoSaveDelBusinessShop(Business business, JSONObject businessShop){
//自动插入DEL
        Map info = new HashMap();
        info.put("storeId",businessStore.getString("storeId"));
        info.put("shopId",businessShop.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map currentStoreInfo = getShopServiceDaoImpl().getStoreInfo(info);
        if(currentStoreInfo == null || currentStoreInfo.isEmpty()){
        Map currentShopInfo = getShopServiceDaoImpl().getShopInfo(info);
        if(currentShopInfo == null || currentShopInfo.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        currentStoreInfo.put("bId",business.getbId());
        currentStoreInfo.put("storeId",currentStoreInfo.get("store_id"));
        currentStoreInfo.put("userId",currentStoreInfo.get("user_id"));
        currentStoreInfo.put("storeTypeCd",currentStoreInfo.get("store_type_cd"));
        currentStoreInfo.put("nearbyLandmarks",currentStoreInfo.get("nearby_landmarks"));
        currentStoreInfo.put("mapX",currentStoreInfo.get("map_x"));
        currentStoreInfo.put("mapY",currentStoreInfo.get("map_y"));
        currentStoreInfo.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessStoreInfo(currentStoreInfo);
        currentShopInfo.put("bId",business.getbId());
        currentShopInfo.put("shopId",currentShopInfo.get("shop_id"));
        currentShopInfo.put("storeId",currentShopInfo.get("store_id"));
        currentShopInfo.put("catalogId",currentShopInfo.get("catalog_id"));
        currentShopInfo.put("hotBuy",currentShopInfo.get("hot_buy"));
        currentShopInfo.put("salePrice",currentShopInfo.get("sale_price"));
        currentShopInfo.put("openShopCount",currentShopInfo.get("open_shop_count"));
        currentShopInfo.put("shopCount",currentShopInfo.get("shop_count"));
        currentShopInfo.put("startDate",currentShopInfo.get("start_date"));
        currentShopInfo.put("endDate",currentShopInfo.get("end_date"));
        currentShopInfo.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopInfo(currentShopInfo);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business 当前业务
     * @param storeAttr 商户属性
     * @param shopAttr 商户属性
     */
    protected void autoSaveDelBusinessStoreAttr(Business business, JSONObject storeAttr){
    protected void autoSaveDelBusinessShopAttr(Business business, JSONObject shopAttr){
        Map info = new HashMap();
        info.put("attrId",storeAttr.getString("attrId"));
        info.put("storeId",storeAttr.getString("storeId"));
        info.put("attrId",shopAttr.getString("attrId"));
        info.put("shopId",shopAttr.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentStoreAttrs = getShopServiceDaoImpl().getStoreAttrs(info);
        if(currentStoreAttrs == null || currentStoreAttrs.size() != 1){
        List<Map> currentShopAttrs = getShopServiceDaoImpl().getShopAttrs(info);
        if(currentShopAttrs == null || currentShopAttrs.size() != 1){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        Map currentStoreAttr = currentStoreAttrs.get(0);
        currentStoreAttr.put("bId",business.getbId());
        currentStoreAttr.put("attrId",currentStoreAttr.get("attr_id"));
        currentStoreAttr.put("storeId",currentStoreAttr.get("store_id"));
        currentStoreAttr.put("specCd",currentStoreAttr.get("spec_cd"));
        currentStoreAttr.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessStoreAttr(currentStoreAttr);
        Map currentShopAttr = currentShopAttrs.get(0);
        currentShopAttr.put("bId",business.getbId());
        currentShopAttr.put("attrId",currentShopAttr.get("attr_id"));
        currentShopAttr.put("shopId",currentShopAttr.get("shop_id"));
        currentShopAttr.put("specCd",currentShopAttr.get("spec_cd"));
        currentShopAttr.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopAttr(currentShopAttr);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business
     * @param businessStorePhoto 商户照片
     * @param business 当前业务
     * @param shopAttrParam 商品属性参数
     */
    protected void autoSaveDelBusinessStorePhoto(Business business,JSONObject businessStorePhoto){
    protected void autoSaveDelBusinessShopAttrParam(Business business,JSONObject shopAttrParam){
        Map info = new HashMap();
        info.put("attrParamId",shopAttrParam.getString("attrParamId"));
        info.put("shopId",shopAttrParam.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentShopAttrParams = getShopServiceDaoImpl().getShopAttrParams(info);
        if(currentShopAttrParams == null || currentShopAttrParams.size() != 1){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        Map currentShopAttrParam = currentShopAttrParams.get(0);
        currentShopAttrParam.put("bId",business.getbId());
        currentShopAttrParam.put("attrParamId",currentShopAttrParam.get("attr_param_id"));
        currentShopAttrParam.put("shopId",currentShopAttrParam.get("shop_id"));
        currentShopAttrParam.put("specCd",currentShopAttrParam.get("spec_cd"));
        currentShopAttrParam.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopAttrParam(currentShopAttrParam);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business
     * @param businessShopPhoto 商户照片
     */
    protected void autoSaveDelBusinessShopPhoto(Business business,JSONObject businessShopPhoto){
       Map info = new HashMap();
        info.put("storePhotoId",businessStorePhoto.getString("storePhotoId"));
        info.put("storeId",businessStorePhoto.getString("storeId"));
        info.put("shopPhotoId",businessShopPhoto.getString("shopPhotoId"));
        info.put("shopId",businessShopPhoto.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentStorePhotos = getShopServiceDaoImpl().getStorePhoto(info);
        if(currentStorePhotos == null || currentStorePhotos.size() != 1){
        List<Map> currentShopPhotos = getShopServiceDaoImpl().getShopPhoto(info);
        if(currentShopPhotos == null || currentShopPhotos.size() != 1){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        Map currentStorePhoto = currentStorePhotos.get(0);
        currentStorePhoto.put("bId",business.getbId());
        currentStorePhoto.put("storePhotoId",currentStorePhoto.get("store_photo_id"));
        currentStorePhoto.put("storeId",currentStorePhoto.get("store_id"));
        currentStorePhoto.put("storePhotoTypeCd",currentStorePhoto.get("store_photo_type_cd"));
        currentStorePhoto.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessStorePhoto(currentStorePhoto);
        Map currentShopPhoto = currentShopPhotos.get(0);
        currentShopPhoto.put("bId",business.getbId());
        currentShopPhoto.put("shopPhotoId",currentShopPhoto.get("shop_photo_id"));
        currentShopPhoto.put("shopId",currentShopPhoto.get("shop_id"));
        currentShopPhoto.put("shopPhotoTypeCd",currentShopPhoto.get("shop_photo_type_cd"));
        currentShopPhoto.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopPhoto(currentShopPhoto);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business
     * @param businessStoreCerdentials 商户证件
     * @param businessShopPreferentials 商品优惠
     */
    protected void autoSaveDelBusinessStoreCerdentials(Business business,JSONObject businessStoreCerdentials){
    protected void autoSaveDelBusinessShopPreferential(Business business,JSONObject businessShopPreferentials){
        Map info = new HashMap();
        info.put("storeCerdentialsId",businessStoreCerdentials.getString("storeCerdentialsId"));
        info.put("storeId",businessStoreCerdentials.getString("storeId"));
        info.put("shopPreferentialId",businessShopPreferentials.getString("shopPreferentialId"));
        info.put("shopId",businessShopPreferentials.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentStoreCerdentailses = getShopServiceDaoImpl().getStoreCerdentials(info);
        if(currentStoreCerdentailses == null || currentStoreCerdentailses.size() != 1){
        Map currentShopPreferential = getShopServiceDaoImpl().getShopPreferential(info);
        if(currentShopPreferential == null || currentShopPreferential.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        Map currentStoreCerdentials = currentStoreCerdentailses.get(0);
        currentStoreCerdentials.put("bId",business.getbId());
        currentStoreCerdentials.put("storeCerdentialsId",currentStoreCerdentials.get("store_cerdentials_id"));
        currentStoreCerdentials.put("storeId",currentStoreCerdentials.get("store_id"));
        currentStoreCerdentials.put("credentialsCd",currentStoreCerdentials.get("credentials_cd"));
        currentStoreCerdentials.put("validityPeriod",currentStoreCerdentials.get("validity_period"));
        currentStoreCerdentials.put("positivePhoto",currentStoreCerdentials.get("positive_photo"));
        currentStoreCerdentials.put("negativePhoto",currentStoreCerdentials.get("negative_photo"));
        currentStoreCerdentials.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessStoreCerdentials(currentStoreCerdentials);
        currentShopPreferential.put("bId",business.getbId());
        currentShopPreferential.put("shopPreferentialId",currentShopPreferential.get("shop_preferential_id"));
        currentShopPreferential.put("shopId",currentShopPreferential.get("shop_id"));
        currentShopPreferential.put("originalPrice",currentShopPreferential.get("original_price"));
        currentShopPreferential.put("discountRate",currentShopPreferential.get("discount_rate"));
        currentShopPreferential.put("showOriginalPrice",currentShopPreferential.get("show_original_price"));
        currentShopPreferential.put("preferentialStartDate",currentShopPreferential.get("preferential_start_date"));
        currentShopPreferential.put("preferentialEndDate",currentShopPreferential.get("preferential_end_date"));
        currentShopPreferential.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopPreferential(currentShopPreferential);
    }
    /**
     *
     * @param business
     * @param businessShopDesc
     */
    protected void autoSaveDelBusinessShopDesc(Business business,JSONObject businessShopDesc){
        Map info = new HashMap();
        info.put("shopDescId",businessShopDesc.getString("shopDescId"));
        info.put("shopId",businessShopDesc.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map currentShopDesc = getShopServiceDaoImpl().getShopDesc(info);
        if(currentShopDesc == null || currentShopDesc.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        currentShopDesc.put("bId",business.getbId());
        currentShopDesc.put("shopDescId",currentShopDesc.get("shop_desc_id"));
        currentShopDesc.put("shopId",currentShopDesc.get("shop_id"));
        currentShopDesc.put("shopDescribe",currentShopDesc.get("shop_describe"));
        currentShopDesc.put("operate",StatusConstant.OPERATE_DEL);
        getShopServiceDaoImpl().saveBusinessShopDesc(currentShopDesc);
    }
}
ShopService/src/main/java/com/java110/shop/listener/DeleteShopAttrAndAttrParamListener.java
New file
@@ -0,0 +1,200 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 删除商户信息 侦听
 *
 * 处理节点
 * 1、businessShop:{} 商户基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("deleteShopAttrAndAttrParamListener")
@Transactional
public class DeleteShopAttrAndAttrParamListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(DeleteShopAttrAndAttrParamListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 2;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
    }
    /**
     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShopAttr")){
            JSONArray businessShopAttrs = data.getJSONArray("businessShopAttr");
            doSaveBusinessShopAttrs(business,businessShopAttrs);
        }
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShopAttrParam")){
            JSONArray businessShopAttrParams = data.getJSONArray("businessShopAttrParam");
            doSaveBusinessShopAttrParams(business,businessShopAttrParams);
        }
    }
    /**
     * 删除 instance数据
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        //商户信息
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_DEL);
        //商品属性
        List<Map> businessShopAttrs = shopServiceDaoImpl.getBusinessShopAttrs(info);
        if(businessShopAttrs != null && businessShopAttrs.size() > 0) {
            for(Map businessShopAttr : businessShopAttrs) {
                flushBusinessShopAttr(businessShopAttr,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateShopAttrInstance(businessShopAttr);
            }
        }
        //商品属性参数
        List<Map> businessShopAttrParams = shopServiceDaoImpl.getBusinessShopAttrParams(info);
        if(businessShopAttrParams != null && businessShopAttrParams.size() > 0) {
            for(Map businessShopAttrParam : businessShopAttrParams) {
                flushBusinessShopAttrParam(businessShopAttrParam,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateShopAttrParamInstance(businessShopAttrParam);
            }
        }
    }
    /**
     * 撤单
     * 从business表中查询到DEL的数据 将instance中的数据更新回来
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商品属性
        List<Map> shopAttrs = shopServiceDaoImpl.getShopAttrs(info);
        if(shopAttrs != null && shopAttrs.size()>0){
            List<Map> businessShopAttrs = shopServiceDaoImpl.getBusinessShopAttrs(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopAttrs == null || businessShopAttrs.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_attr),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopAttr : businessShopAttrs) {
                flushBusinessShopAttr(businessShopAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrInstance(businessShopAttr);
            }
        }
        //商品属性参数
        List<Map> shopAttrParams = shopServiceDaoImpl.getShopAttrParams(info);
        if(shopAttrParams != null && shopAttrParams.size()>0){
            List<Map> businessShopAttrParams = shopServiceDaoImpl.getBusinessShopAttrParams(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopAttrParams == null || businessShopAttrParams.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_attr_param),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopAttrParam : businessShopAttrParams) {
                flushBusinessShopAttrParam(businessShopAttrParam,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrParamInstance(businessShopAttrParam);
            }
        }
    }
    /**
     * 保存商户属性信息
     * @param business 当前业务
     * @param businessShopAttrs 商户属性
     */
    private void doSaveBusinessShopAttrs(Business business,JSONArray businessShopAttrs){
        JSONObject data = business.getDatas();
        for(int shopAttrIndex = 0 ; shopAttrIndex < businessShopAttrs.size();shopAttrIndex ++){
            JSONObject shopAttr = businessShopAttrs.getJSONObject(shopAttrIndex);
            Assert.jsonObjectHaveKey(shopAttr,"attrId","businessShopAttr 节点下没有包含 attrId 节点");
            if(shopAttr.getString("attrId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+shopAttr);
            }
            autoSaveDelBusinessShopAttr(business,shopAttr);
        }
    }
    /**
     * 保存商品属性信息
     * @param business 当前业务
     * @param businessShopAttrParams 商品属性 参数
     */
    private void doSaveBusinessShopAttrParams(Business business,JSONArray businessShopAttrParams){
        JSONObject data = business.getDatas();
        for(int shopAttrParamIndex = 0 ; shopAttrParamIndex < businessShopAttrParams.size();shopAttrParamIndex ++){
            JSONObject shopAttrParam = businessShopAttrParams.getJSONObject(shopAttrParamIndex);
            Assert.jsonObjectHaveKey(shopAttrParam,"attrParamId","businessShopAttrParam 节点下没有包含 attrParamId 节点");
            if(shopAttrParam.getString("attrParamId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrParamId 错误,不能自动生成(必须已经存在的attrParamId)"+shopAttrParam);
            }
            autoSaveDelBusinessShopAttrParam(business,shopAttrParam);
        }
    }
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/DeleteShopDescListener.java
New file
@@ -0,0 +1,148 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
 * 删除商户信息 侦听
 *
 * 处理节点
 * 1、businessShop:{} 商户基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("deleteShopDescListener")
@Transactional
public class DeleteShopDescListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(DeleteShopDescListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 5;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
    }
    /**
     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShopDesc")){
            JSONObject businessShopDesc = data.getJSONObject("businessShopDesc");
            doBusinessShopDesc(business,businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.getString("shopDescId"));
        }
    }
    /**
     * 删除 instance数据
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        //商户信息
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map businessShopDesc = shopServiceDaoImpl.getBusinessShopDesc(info);
        if( businessShopDesc != null && !businessShopDesc.isEmpty()) {
            flushBusinessShopDesc(businessShopDesc,StatusConstant.STATUS_CD_INVALID);
            shopServiceDaoImpl.updateShopDescInstance(businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.get("shop_desc_id"));
        }
    }
    /**
     * 撤单
     * 从business表中查询到DEL的数据 将instance中的数据更新回来
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map shopDesc = shopServiceDaoImpl.getShopDesc(info);
        if(shopDesc != null && !shopDesc.isEmpty()){
            //商户信息
            Map businessShopDesc = shopServiceDaoImpl.getBusinessShopDesc(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopDesc == null || businessShopDesc.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_desc),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessShopDesc(businessShopDesc,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopDescInstance(businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",shopDesc.get("shop_desc_id"));
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessShopDesc 商品优惠节点
     */
    private void doBusinessShopDesc(Business business,JSONObject businessShopDesc){
        Assert.jsonObjectHaveKey(businessShopDesc,"shopDescId","businessShopDesc 节点下没有包含 shopDescId 节点");
        if(businessShopDesc.getString("shopDescId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopDescId 错误,不能自动生成(必须已经存在的shopDescId)"+businessShopDesc);
        }
        //自动插入DEL
        autoSaveDelBusinessShopDesc(business,businessShopDesc);
    }
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/DeleteShopInfoListener.java
@@ -24,10 +24,7 @@
 * 删除商户信息 侦听
 *
 * 处理节点
 * 1、businessStore:{} 商户基本信息节点
 * 2、businessStoreAttr:[{}] 商户属性信息节点
 * 3、businessStorePhoto:[{}] 商户照片信息节点
 * 4、businessStoreCerdentials:[{}] 商户证件信息节点
 * 1、businessShop:{} 商户基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@@ -41,7 +38,7 @@
    @Override
    public int getOrder() {
        return 3;
        return 1;
    }
    @Override
@@ -60,26 +57,11 @@
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessStore 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessStore")){
            JSONObject businessStore = data.getJSONObject("businessStore");
            doBusinessStore(business,businessStore);
            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
        }
        if(data.containsKey("businessStoreAttr")){
            JSONArray businessStoreAttrs = data.getJSONArray("businessStoreAttr");
            doSaveBusinessStoreAttrs(business,businessStoreAttrs);
        }
        if(data.containsKey("businessStorePhoto")){
            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
            doBusinessStorePhoto(business,businessStorePhotos);
        }
        if(data.containsKey("businessStoreCerdentials")){
            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShop")){
            JSONObject businessShop = data.getJSONObject("businessShop");
            doBusinessShop(business,businessShop);
            dataFlowContext.addParamOut("shopId",businessShop.getString("shopId"));
        }
    }
@@ -99,35 +81,11 @@
        info.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map businessStoreInfo = shopServiceDaoImpl.getBusinessStoreInfo(info);
        if( businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_INVALID);
            shopServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
            dataFlowContext.addParamOut("storeId",businessStoreInfo.get("store_id"));
        }
        //商户属性
        List<Map> businessStoreAttrs = shopServiceDaoImpl.getBusinessStoreAttrs(info);
        if(businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
            for(Map businessStoreAttr : businessStoreAttrs) {
                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
            }
        }
        //商户照片
        List<Map> businessStorePhotos = shopServiceDaoImpl.getBusinessStorePhoto(info);
        if(businessStorePhotos != null && businessStorePhotos.size() >0){
            for(Map businessStorePhoto : businessStorePhotos) {
                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
            }
        }
        //商户证件
        List<Map> businessStoreCerdentialses = shopServiceDaoImpl.getBusinessStoreCerdentials(info);
        if(businessStoreCerdentialses != null && businessStoreCerdentialses.size()>0){
            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
            }
        Map businessShopInfo = shopServiceDaoImpl.getBusinessShopInfo(info);
        if( businessShopInfo != null && !businessShopInfo.isEmpty()) {
            flushBusinessShopInfo(businessShopInfo,StatusConstant.STATUS_CD_INVALID);
            shopServiceDaoImpl.updateShopInfoInstance(businessShopInfo);
            dataFlowContext.addParamOut("shopId",businessShopInfo.get("shop_id"));
        }
    }
@@ -149,141 +107,37 @@
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map storeInfo = shopServiceDaoImpl.getStoreInfo(info);
        if(storeInfo != null && !storeInfo.isEmpty()){
        Map shopInfo = shopServiceDaoImpl.getShopInfo(info);
        if(shopInfo != null && !shopInfo.isEmpty()){
            //商户信息
            Map businessStoreInfo = shopServiceDaoImpl.getBusinessStoreInfo(delInfo);
            Map businessShopInfo = shopServiceDaoImpl.getBusinessShopInfo(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreInfo == null || businessStoreInfo.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store),程序内部异常,请检查! "+delInfo);
            if(businessShopInfo == null || businessShopInfo.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
            dataFlowContext.addParamOut("storeId",storeInfo.get("store_id"));
        }
        //商户属性
        List<Map> storeAttrs = shopServiceDaoImpl.getStoreAttrs(info);
        if(storeAttrs != null && storeAttrs.size()>0){
            List<Map> businessStoreAttrs = shopServiceDaoImpl.getBusinessStoreAttrs(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreAttrs == null || businessStoreAttrs.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_attr),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStoreAttr : businessStoreAttrs) {
                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
            }
        }
        //商户照片
        List<Map> storePhotos = shopServiceDaoImpl.getStorePhoto(info);
        if(storePhotos != null && storePhotos.size()>0){
            List<Map> businessStorePhotos = shopServiceDaoImpl.getBusinessStorePhoto(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStorePhotos == null || businessStorePhotos.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_photo),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStorePhoto : businessStorePhotos) {
                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
            }
        }
        //商户属性
        List<Map> storeCerdentialses = shopServiceDaoImpl.getStoreCerdentials(info);
        if(storeCerdentialses != null && storeCerdentialses.size()>0){
            List<Map> businessStoreCerdentialses = shopServiceDaoImpl.getBusinessStoreCerdentials(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreCerdentialses == null || businessStoreCerdentialses.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_cerdentials),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
            }
            flushBusinessShopInfo(businessShopInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopInfoInstance(businessShopInfo);
            dataFlowContext.addParamOut("shopId",shopInfo.get("shop_id"));
        }
    }
    /**
     * 保存商户照片
     * @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.getString("storePhotoId").startsWith("-")) {
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStorePhoto);
            }
            autoSaveDelBusinessStorePhoto(business,businessStorePhoto);
        }
    }
    /**
     * 处理 businessStore 节点
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessStore 商户节点
     * @param businessShop 商户节点
     */
    private void doBusinessStore(Business business,JSONObject businessStore){
    private void doBusinessShop(Business business,JSONObject businessShop){
        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
        Assert.jsonObjectHaveKey(businessShop,"shopId","businessShop 节点下没有包含 shopId 节点");
        if(businessStore.getString("storeId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storeId 错误,不能自动生成(必须已经存在的storeId)"+businessStore);
        if(businessShop.getString("shopId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopId 错误,不能自动生成(必须已经存在的shopId)"+businessShop);
        }
        //自动插入DEL
        autoSaveDelBusinessStore(business,businessStore);
    }
    /**
     * 保存商户属性信息
     * @param business 当前业务
     * @param businessStoreAttrs 商户属性
     */
    private void doSaveBusinessStoreAttrs(Business business,JSONArray businessStoreAttrs){
        JSONObject data = business.getDatas();
        for(int storeAttrIndex = 0 ; storeAttrIndex < businessStoreAttrs.size();storeAttrIndex ++){
            JSONObject storeAttr = businessStoreAttrs.getJSONObject(storeAttrIndex);
            Assert.jsonObjectHaveKey(storeAttr,"attrId","businessStoreAttr 节点下没有包含 attrId 节点");
            if(storeAttr.getString("attrId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+storeAttr);
            }
            autoSaveDelBusinessStoreAttr(business,storeAttr);
        }
    }
    /**
     * 保存 商户证件 信息
     * @param business 当前业务
     * @param businessStoreCerdentialses 商户证件
     */
    private void doBusinessStoreCerdentials(Business business, JSONArray businessStoreCerdentialses) {
        Map info = null;
        Map currentStoreCerdentials = null;
        for(int businessStoreCerdentialsIndex = 0 ; businessStoreCerdentialsIndex < businessStoreCerdentialses.size() ; businessStoreCerdentialsIndex ++) {
            JSONObject businessStoreCerdentials = businessStoreCerdentialses.getJSONObject(businessStoreCerdentialsIndex);
            Assert.jsonObjectHaveKey(businessStoreCerdentials, "storeId", "businessStorePhoto 节点下没有包含 storeId 节点");
            if (businessStoreCerdentials.getString("storeCerdentialsId").startsWith("-")) {
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStoreCerdentials);
            }
            autoSaveDelBusinessStoreCerdentials(business,businessStoreCerdentials);
        }
        autoSaveDelBusinessShop(business,businessShop);
    }
    public IShopServiceDao getShopServiceDaoImpl() {
ShopService/src/main/java/com/java110/shop/listener/DeleteShopPhotoListener.java
New file
@@ -0,0 +1,153 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 删除商户信息 侦听
 *
 * 处理节点
 * 1、businessShop:{} 商户基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("deleteShopPhotoListener")
@Transactional
public class DeleteShopPhotoListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(DeleteShopPhotoListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 3;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
    }
    /**
     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShopPhoto")){
            JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");
            doSaveBusinessShopPhotos(business,businessShopPhotos);
        }
    }
    /**
     * 删除 instance数据
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        //商户信息
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_DEL);
        //商品属性
        List<Map> businessShopPhotos = shopServiceDaoImpl.getBusinessShopPhoto(info);
        if(businessShopPhotos != null && businessShopPhotos.size() > 0) {
            for(Map businessShopPhoto : businessShopPhotos) {
                flushBusinessShopPhoto(businessShopPhoto,StatusConstant.STATUS_CD_INVALID);
                shopServiceDaoImpl.updateShopPhotoInstance(businessShopPhoto);
            }
        }
    }
    /**
     * 撤单
     * 从business表中查询到DEL的数据 将instance中的数据更新回来
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商品属性
        List<Map> shopPhotos = shopServiceDaoImpl.getShopPhoto(info);
        if(shopPhotos != null && shopPhotos.size()>0){
            List<Map> businessShopPhotos = shopServiceDaoImpl.getBusinessShopPhoto(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopPhotos == null || businessShopPhotos.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_photo),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopPhoto : businessShopPhotos) {
                flushBusinessShopPhoto(businessShopPhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopPhotoInstance(businessShopPhoto);
            }
        }
    }
    /**
     * 保存商户属性信息
     * @param business 当前业务
     * @param businessShopPhotos 商户属性
     */
    private void doSaveBusinessShopPhotos(Business business,JSONArray businessShopPhotos){
        JSONObject data = business.getDatas();
        for(int shopPhotoIndex = 0 ; shopPhotoIndex < businessShopPhotos.size();shopPhotoIndex ++){
            JSONObject shopPhoto = businessShopPhotos.getJSONObject(shopPhotoIndex);
            Assert.jsonObjectHaveKey(shopPhoto,"shopPhotoId","businessShopPhoto 节点下没有包含 shopPhotoId 节点");
            if(shopPhoto.getString("shopPhotoId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopPhotoId 错误,不能自动生成(必须已经存在的shopPhotoId)"+shopPhoto);
            }
            autoSaveDelBusinessShopPhoto(business,shopPhoto);
        }
    }
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/DeleteShopPreferentialListener.java
New file
@@ -0,0 +1,148 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
 * 删除商户信息 侦听
 *
 * 处理节点
 * 1、businessShop:{} 商户基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("deleteShopPreferentialListener")
@Transactional
public class DeleteShopPreferentialListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(DeleteShopPreferentialListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 4;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
    }
    /**
     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点 按理这里不应该处理,程序上支持,以防真有这种业务
        if(data.containsKey("businessShopPreferential")){
            JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
            doBusinessShopPreferential(business,businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.getString("shopPreferentialId"));
        }
    }
    /**
     * 删除 instance数据
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        //商户信息
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map businessShopPreferential = shopServiceDaoImpl.getBusinessShopPreferential(info);
        if( businessShopPreferential != null && !businessShopPreferential.isEmpty()) {
            flushBusinessShopPreferential(businessShopPreferential,StatusConstant.STATUS_CD_INVALID);
            shopServiceDaoImpl.updateShopPreferentialInstance(businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 撤单
     * 从business表中查询到DEL的数据 将instance中的数据更新回来
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map shopPreferential = shopServiceDaoImpl.getShopPreferential(info);
        if(shopPreferential != null && !shopPreferential.isEmpty()){
            //商户信息
            Map businessShopPreferential = shopServiceDaoImpl.getBusinessShopPreferential(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopPreferential == null || businessShopPreferential.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_preferential),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessShopPreferential(businessShopPreferential,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopPreferentialInstance(businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",shopPreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessShopPreferential 商品优惠节点
     */
    private void doBusinessShopPreferential(Business business,JSONObject businessShopPreferential){
        Assert.jsonObjectHaveKey(businessShopPreferential,"shopPreferentialId","businessShopPreferential 节点下没有包含 shopPreferentialId 节点");
        if(businessShopPreferential.getString("shopPreferentialId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopPreferentialId 错误,不能自动生成(必须已经存在的shopPreferentialId)"+businessShopPreferential);
        }
        //自动插入DEL
        autoSaveDelBusinessShopPreferential(business,businessShopPreferential);
    }
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/FlushAboutShopIdListener.java
New file
@@ -0,0 +1,140 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
/**
 * 如果shopId填写的值为-1,则重新生成
 * Created by wuxw on 2018/7/7.
 */
@Java110Listener(name="flushAboutShopIdListener")
public class FlushAboutShopIdListener extends AbstractShopBusinessServiceDataFlowListener {
    @Override
    public int getOrder() {
        return 0;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return null;
    }
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //刷新shopId
        if(data.containsKey("businessShop")){
            JSONObject businessShop = data.getJSONObject("businessShop");
            if(!businessShop.containsKey("shopId") || businessShop.getString("shopId").startsWith("-")){
                flushShopId(data);
            }
        }
        //刷新 attrId
        if(data.containsKey("businessShopAttr")){
            JSONArray businessShopAttrs = data.getJSONArray("businessShopAttr");
            for(int businessShopAttrIndex = 0 ; businessShopAttrIndex < businessShopAttrs.size();businessShopAttrIndex++){
                JSONObject attrObj = businessShopAttrs.getJSONObject(businessShopAttrIndex);
                if(attrObj.containsKey("attrId") && !attrObj.getString("attrId").startsWith("-")){
                    continue;
                }
                attrObj.put("attrId",GenerateCodeFactory.getShopAttrId());
            }
        }
        //刷新 shopPhotoId
        if(data.containsKey("businessShopPhoto")){
            JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");
            for (int businessShopPhotoIndex = 0;businessShopPhotoIndex < businessShopPhotos.size();businessShopPhotoIndex ++){
                JSONObject photoObj = businessShopPhotos.getJSONObject(businessShopPhotoIndex);
                if(photoObj.containsKey("shopPhotoId") && !photoObj.getString("shopPhotoId").startsWith("-")){
                    continue;
                }
                photoObj.put("shopPhotoId",GenerateCodeFactory.getShopPhotoId());
            }
        }
        //刷新 attrParamId
        if(data.containsKey("businessShopAttrParam")){
            JSONArray businessShopAttrParams = data.getJSONArray("businessShopAttrParam");
            for (int businessShopAttrParamIndex = 0;businessShopAttrParamIndex < businessShopAttrParams.size();businessShopAttrParamIndex ++){
                JSONObject attrParamObj = businessShopAttrParams.getJSONObject(businessShopAttrParamIndex);
                if(attrParamObj.containsKey("attrParamId") && !attrParamObj.getString("attrParamId").startsWith("-")){
                    continue;
                }
                attrParamObj.put("attrParamId",GenerateCodeFactory.getShopAttrParamId());
            }
        }
        //刷新 shopPreferentialId
        if(data.containsKey("businessShopPreferential")){
            JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
            if(!businessShopPreferential.containsKey("shopPreferentialId") || businessShopPreferential.getString("shopId").startsWith("-")){
                businessShopPreferential.put("shopPreferentialId",GenerateCodeFactory.getShopPreferentialId());
            }
        }
        //刷新 商品描述Id
        if(data.containsKey("businessShopDesc")){
            JSONObject businessShopDesc = data.getJSONObject("businessShopDesc");
            if(!businessShopDesc.containsKey("shopDescId") || businessShopDesc.getString("shopDescId").startsWith("-")){
                businessShopDesc.put("shopDescId",GenerateCodeFactory.getShopDescId());
            }
        }
    }
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        // nothing to do
    }
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        // nothing to do
    }
    /**
     * 刷新 商品ID
     * @param data
     */
    private void flushShopId(JSONObject data) {
        String shopId = GenerateCodeFactory.getShopId();
        JSONObject businessShop = data.getJSONObject("businessShop");
        businessShop.put("shopId",shopId);
        //刷商品属性
        if(data.containsKey("businessShopAttr")) {
            JSONArray businessShopAttrs = data.getJSONArray("businessShopAttr");
            for(int businessShopAttrIndex = 0;businessShopAttrIndex < businessShopAttrs.size();businessShopAttrIndex++) {
                JSONObject businessStoreAttr = businessShopAttrs.getJSONObject(businessShopAttrIndex);
                businessStoreAttr.put("shopId", shopId);
            }
        }
        //刷 是商品照片 的 shopId
        if(data.containsKey("businessShopPhoto")) {
            JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");
            for(int businessShopPhotoIndex = 0;businessShopPhotoIndex < businessShopPhotos.size();businessShopPhotoIndex++) {
                JSONObject businessStorePhoto = businessShopPhotos.getJSONObject(businessShopPhotoIndex);
                businessStorePhoto.put("shopId", shopId);
            }
        }
        //刷 商品优惠 的 shopId
        if(data.containsKey("businessShopPreferential")) {
            JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
            businessShopPreferential.put("shopId", shopId);
        }
        //商品描述
        if(data.containsKey("businessShopDesc")){
            JSONObject businessShopDesc = data.getJSONObject("businessShopDesc");
            businessShopDesc.put("shopId", shopId);
        }
    }
}
ShopService/src/main/java/com/java110/shop/listener/SaveShopAttrAndAttrParamListener.java
New file
@@ -0,0 +1,147 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 处理节点 businessShopAttr
 * 和 businessShopAttrParam
 * Created by wuxw on 2018/7/7.
 */
@Java110Listener(name = "saveShopAttrAndAttrParamListener")
@Transactional
public class SaveShopAttrAndAttrParamListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveShopAttrAndAttrParamListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 2;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理商品属性
        if(data.containsKey("businessShopAttr")){
            JSONArray businessShopAttrs = data.getJSONArray("businessShopAttr");
            doBusinessShopAttr(business,businessShopAttrs);
        }
        //处理商品属性参数
        if(data.containsKey("businessShopAttrParam")){
            JSONArray businessShopAttrParams = data.getJSONArray("businessShopAttrParam");
            doBusinessShopAttrParams(business,businessShopAttrParams);
        }
    }
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商品属性
        List<Map> businessShopAttrs = shopServiceDaoImpl.getBusinessShopAttrs(info);
        if(businessShopAttrs != null && businessShopAttrs.size() > 0) {
            shopServiceDaoImpl.saveShopAttrsInstance(info);
        }
        //商品属性参数
        List<Map> buinessShopAttrParams = shopServiceDaoImpl.getBusinessShopAttrParams(info);
        if(buinessShopAttrParams != null && buinessShopAttrParams.size() > 0){
            shopServiceDaoImpl.saveShopAttrParamsInstance(info);
        }
    }
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        Map info = new HashMap();
        info.put("bId",bId);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        //商品属性
        List<Map> shopAttrs = shopServiceDaoImpl.getShopAttrs(info);
        if(shopAttrs != null && shopAttrs.size()>0){
            shopServiceDaoImpl.updateShopAttrInstance(paramIn);
        }
        //商品属性参数
        List<Map> shopAttrParams = shopServiceDaoImpl.getShopAttrParams(info);
        if(shopAttrParams != null && shopAttrParams.size() >0){
            shopServiceDaoImpl.updateShopAttrParamInstance(info);
        }
    }
    /**
     * 处理商品 属性
     * @param business 当前业务
     * @param businessShopAttrs 商品属性
     */
    private void doBusinessShopAttr(Business business, JSONArray businessShopAttrs) {
        for(int shopAttrIndex = 0 ; shopAttrIndex < businessShopAttrs.size();shopAttrIndex ++){
            JSONObject shopAttr = businessShopAttrs.getJSONObject(shopAttrIndex);
            Assert.jsonObjectHaveKey(shopAttr,"attrId","businessShopAttr 节点下没有包含 attrId 节点");
            shopAttr.put("bId",business.getbId());
            shopAttr.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopAttr(shopAttr);
        }
    }
    /**
     * 商品属性参数
     * @param business 当前业务
     * @param businessShopAttrParams 商品属性参数
     */
    private void doBusinessShopAttrParams(Business business, JSONArray businessShopAttrParams) {
        for(int shopAttrParamIndex = 0 ; shopAttrParamIndex < businessShopAttrParams.size();shopAttrParamIndex ++){
            JSONObject shopAttrParam = businessShopAttrParams.getJSONObject(shopAttrParamIndex);
            Assert.jsonObjectHaveKey(shopAttrParam,"attrParamId","businessShopAttr 节点下没有包含 attrParamId 节点");
            shopAttrParam.put("bId",business.getbId());
            shopAttrParam.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopAttrParam(shopAttrParam);
        }
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/SaveShopDescListener.java
New file
@@ -0,0 +1,142 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * 保存 商品信息 侦听
 * 处理 businessShop 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveShopDescListener")
@Transactional
public class SaveShopDescListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveShopDescListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 5;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    /**
     * 保存商品信息 business 表中
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 shopDescId 节点
        if(data.containsKey("businessShopDesc")){
            JSONObject businessShopDesc = data.getJSONObject("businessShopDesc");
            doBusinessShopDesc(business,businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.getString("shop_desc_Id"));
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户信息
        Map businessShopDesc = shopServiceDaoImpl.getBusinessShopDesc(info);
        if( businessShopDesc != null && !businessShopDesc.isEmpty()) {
            shopServiceDaoImpl.saveShopDescInstance(info);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.get("shop_desc_id"));
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //商户信息
        Map storeDesc = shopServiceDaoImpl.getShopDesc(info);
        if(storeDesc != null && !storeDesc.isEmpty()){
            paramIn.put("shopId",storeDesc.get("shop_id").toString());
            shopServiceDaoImpl.updateShopDescInstance(paramIn);
            dataFlowContext.addParamOut("shopDescId",storeDesc.get("shop_desc_id"));
        }
    }
    /**
     * 处理 businessShopDesc 节点
     * @param business 总的数据节点
     * @param businessShopDesc 商品节点
     */
    private void doBusinessShopDesc(Business business, JSONObject businessShopDesc){
        Assert.jsonObjectHaveKey(businessShopDesc,"shopDescId","businessShop 节点下没有包含 shopDescId 节点");
        businessShopDesc.put("bId",business.getbId());
        businessShopDesc.put("operate", StatusConstant.OPERATE_ADD);
        //保存商户信息
        shopServiceDaoImpl.saveBusinessShopDesc(businessShopDesc);
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/SaveShopInfoListener.java
@@ -26,7 +26,8 @@
import java.util.Map;
/**
 * 保存 用户信息 侦听
 * 保存 商品信息 侦听
 * 处理 businessShop 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveShopInfoListener")
@@ -40,12 +41,12 @@
    @Override
    public int getOrder() {
        return 0;
        return 1;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_STORE_INFO;
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    /**
@@ -58,27 +59,13 @@
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessStore 节点
        if(data.containsKey("businessStore")){
            JSONObject businessStore = data.getJSONObject("businessStore");
            doBusinessStore(business,businessStore);
            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
        //处理 businessShop 节点
        if(data.containsKey("businessShop")){
            JSONObject businessShop = data.getJSONObject("businessShop");
            doBusinessShop(business,businessShop);
            dataFlowContext.addParamOut("shopId",businessShop.getString("shopId"));
        }
        if(data.containsKey("businessStoreAttr")){
            JSONArray businessStoreAttrs = data.getJSONArray("businessStoreAttr");
            doSaveBusinessStoreAttrs(business,businessStoreAttrs);
        }
        if(data.containsKey("businessStorePhoto")){
            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
            doBusinessStorePhoto(business,businessStorePhotos);
        }
        if(data.containsKey("businessStoreCerdentials")){
            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
        }
    }
    /**
@@ -95,26 +82,12 @@
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户信息
        Map businessStoreInfo = shopServiceDaoImpl.getBusinessStoreInfo(info);
        if( businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
            shopServiceDaoImpl.saveStoreInfoInstance(info);
            dataFlowContext.addParamOut("storeId",businessStoreInfo.get("store_id"));
        Map businessShopInfo = shopServiceDaoImpl.getBusinessShopInfo(info);
        if( businessShopInfo != null && !businessShopInfo.isEmpty()) {
            shopServiceDaoImpl.saveShopInfoInstance(info);
            dataFlowContext.addParamOut("storeId",businessShopInfo.get("store_id"));
        }
        //商户属性
        List<Map> businessStoreAttrs = shopServiceDaoImpl.getBusinessStoreAttrs(info);
        if(businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
            shopServiceDaoImpl.saveStoreAttrsInstance(info);
        }
        //商户照片
        List<Map> businessStorePhotos = shopServiceDaoImpl.getBusinessStorePhoto(info);
        if(businessStorePhotos != null && businessStorePhotos.size() >0){
            shopServiceDaoImpl.saveStorePhotoInstance(info);
        }
        //商户证件
        List<Map> businessStoreCerdentialses = shopServiceDaoImpl.getBusinessStoreCerdentials(info);
        if(businessStoreCerdentialses != null && businessStoreCerdentialses.size()>0){
            shopServiceDaoImpl.saveStoreCerdentialsInstance(info);
        }
    }
    /**
@@ -133,171 +106,45 @@
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //商户信息
        Map storeInfo = shopServiceDaoImpl.getStoreInfo(info);
        Map storeInfo = shopServiceDaoImpl.getShopInfo(info);
        if(storeInfo != null && !storeInfo.isEmpty()){
            paramIn.put("storeId",storeInfo.get("store_id").toString());
            shopServiceDaoImpl.updateStoreInfoInstance(paramIn);
            paramIn.put("shopId",storeInfo.get("shop_id").toString());
            shopServiceDaoImpl.updateShopInfoInstance(paramIn);
            dataFlowContext.addParamOut("storeId",storeInfo.get("store_id"));
        }
        //商户属性
        List<Map> storeAttrs = shopServiceDaoImpl.getStoreAttrs(info);
        if(storeAttrs != null && storeAttrs.size()>0){
            shopServiceDaoImpl.updateStoreAttrInstance(paramIn);
        }
        //商户照片
        List<Map> storePhotos = shopServiceDaoImpl.getStorePhoto(info);
        if(storePhotos != null && storePhotos.size()>0){
            shopServiceDaoImpl.updateStorePhotoInstance(paramIn);
        }
        //商户属性
        List<Map> storeCerdentialses = shopServiceDaoImpl.getStoreCerdentials(info);
        if(storeCerdentialses != null && storeCerdentialses.size()>0){
            shopServiceDaoImpl.updateStoreCerdentailsInstance(paramIn);
        }
    }
    /**
     * 保存商户照片
     * @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.getString("storePhotoId").startsWith("-")) {
                String storePhotoId = GenerateCodeFactory.getStorePhotoId();
                businessStorePhoto.put("storePhotoId", storePhotoId);
            }
            businessStorePhoto.put("bId", business.getbId());
            businessStorePhoto.put("operate", StatusConstant.OPERATE_ADD);
            //保存商户信息
            shopServiceDaoImpl.saveBusinessStorePhoto(businessStorePhoto);
        }
    }
    /**
     * 处理 businessStore 节点
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessStore 商户节点
     * @param businessShop 商品节点
     */
    private void doBusinessStore(Business business,JSONObject businessStore){
    private void doBusinessShop(Business business,JSONObject businessShop){
        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
        Assert.jsonObjectHaveKey(businessShop,"shopId","businessShop 节点下没有包含 storeId 节点");
        if(businessStore.getString("storeId").startsWith("-")){
            //刷新缓存
            flushStoreId(business.getDatas());
        businessShop.put("bId",business.getbId());
        businessShop.put("operate", StatusConstant.OPERATE_ADD);
        //对日期处理
        Date startDate = null;
        Date entDate = null;
        try {
            startDate = DateUtil.getDateFromString(businessShop.getString("startDate"), DateUtil.DATE_FORMATE_STRING_A);
            entDate = DateUtil.getDateFromString(businessShop.getString("entDate"), DateUtil.DATE_FORMATE_STRING_A);
            businessShop.put("startDate",startDate);
            businessShop.put("entDate",entDate);
        } catch (ParseException e) {
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 startDate entDate 格式不正确,请填写 "
                    +DateUtil.DATE_FORMATE_STRING_A +" 格式,"+businessShop);
        }
        businessStore.put("bId",business.getbId());
        businessStore.put("operate", StatusConstant.OPERATE_ADD);
        //保存商户信息
        shopServiceDaoImpl.saveBusinessStoreInfo(businessStore);
        shopServiceDaoImpl.saveBusinessShopInfo(businessShop);
    }
    /**
     * 保存商户属性信息
     * @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.getString("attrId").startsWith("-")){
                String attrId = GenerateCodeFactory.getAttrId();
                storeAttr.put("attrId",attrId);
            }
            storeAttr.put("bId",business.getbId());
            storeAttr.put("storeId",businessStore.getString("storeId"));
            storeAttr.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.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.getString("storeCerdentialsId").startsWith("-")) {
                String storePhotoId = GenerateCodeFactory.getStoreCerdentialsId();
                businessStoreCerdentials.put("storeCerdentialsId", storePhotoId);
            }
            Date validityPeriod = null;
            try {
                if(StringUtil.isNullOrNone(businessStoreCerdentials.getString("validityPeriod"))){
                    validityPeriod = DateUtil.getLastDate();
                }else {
                    validityPeriod = DateUtil.getDateFromString(businessStoreCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
                }
            } catch (ParseException e) {
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessStoreCerdentials);
            }
            businessStoreCerdentials.put("validityPeriod",validityPeriod);
            businessStoreCerdentials.put("bId", business.getbId());
            businessStoreCerdentials.put("operate", StatusConstant.OPERATE_ADD);
            //保存商户信息
            shopServiceDaoImpl.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("businessStoreAttr")) {
            JSONArray businessStoreAttrs = data.getJSONArray("businessStoreAttr");
            for(int businessStoreAttrIndex = 0;businessStoreAttrIndex < businessStoreAttrs.size();businessStoreAttrIndex++) {
                JSONObject businessStoreAttr = businessStoreAttrs.getJSONObject(businessStoreAttrIndex);
                businessStoreAttr.put("storeId", storeId);
            }
        }
        //刷 是商户照片 的 storeId
        if(data.containsKey("businessStorePhoto")) {
            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
            for(int businessStorePhotoIndex = 0;businessStorePhotoIndex < businessStorePhotos.size();businessStorePhotoIndex++) {
                JSONObject businessStorePhoto = businessStorePhotos.getJSONObject(businessStorePhotoIndex);
                businessStorePhoto.put("storeId", storeId);
            }
        }
        //刷 商户证件 的storeId
        if(data.containsKey("businessStoreCerdentials")) {
            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
            for(int businessStoreCerdentialsIndex = 0;businessStoreCerdentialsIndex < businessStoreCerdentialses.size();businessStoreCerdentialsIndex++) {
                JSONObject businessStoreCerdentials = businessStoreCerdentialses.getJSONObject(businessStoreCerdentialsIndex);
                businessStoreCerdentials.put("storeId", storeId);
            }
        }
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
ShopService/src/main/java/com/java110/shop/listener/SaveShopPhotoListener.java
New file
@@ -0,0 +1,113 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 处理节点 businessShopPhoto
 * Created by wuxw on 2018/7/7.
 */
@Java110Listener(name = "saveShopPhotoListener")
@Transactional
public class SaveShopPhotoListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveShopPhotoListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 3;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理商品属性
        if(data.containsKey("businessShopPhoto")){
            JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");
            doBusinessShopPhoto(business,businessShopPhotos);
        }
    }
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商品属性
        List<Map> businessShopPhotos = shopServiceDaoImpl.getBusinessShopPhoto(info);
        if(businessShopPhotos != null && businessShopPhotos.size() > 0) {
            shopServiceDaoImpl.saveShopPhotoInstance(info);
        }
    }
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        Map info = new HashMap();
        info.put("bId",bId);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        //商品属性
        List<Map> shopPhotos = shopServiceDaoImpl.getShopPhoto(info);
        if(shopPhotos != null && shopPhotos.size()>0){
            shopServiceDaoImpl.updateShopPhotoInstance(paramIn);
        }
    }
    /**
     * 处理商品 属性
     * @param business 当前业务
     * @param businessShopPhotos 商品照片
     */
    private void doBusinessShopPhoto(Business business, JSONArray businessShopPhotos) {
        for(int shopPhotoIndex = 0 ; shopPhotoIndex < businessShopPhotos.size();shopPhotoIndex ++){
            JSONObject shopPhoto = businessShopPhotos.getJSONObject(shopPhotoIndex);
            Assert.jsonObjectHaveKey(shopPhoto,"shopPhotoId","businessShopPhoto 节点下没有包含 shopPhotoId 节点");
            shopPhoto.put("bId",business.getbId());
            shopPhoto.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopPhoto(shopPhoto);
        }
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/SaveShopPreferentialListener.java
New file
@@ -0,0 +1,153 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * 保存 商品信息 侦听
 * 处理 businessShop 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveShopPreferentialListener")
@Transactional
public class SaveShopPreferentialListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveShopPreferentialListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 4;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_SHOP_INFO;
    }
    /**
     * 保存商品信息 business 表中
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShopPreferential 节点
        if(data.containsKey("businessShopPreferential")){
            JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
            doBusinessShopPreferential(business,businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.getString("shopPreferentialId"));
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户信息
        Map businessShopPreferential = shopServiceDaoImpl.getBusinessShopPreferential(info);
        if( businessShopPreferential != null && !businessShopPreferential.isEmpty()) {
            shopServiceDaoImpl.saveShopPreferentialInstance(info);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //商户信息
        Map storePreferential = shopServiceDaoImpl.getShopPreferential(info);
        if(storePreferential != null && !storePreferential.isEmpty()){
            paramIn.put("shopId",storePreferential.get("shop_id").toString());
            shopServiceDaoImpl.updateShopPreferentialInstance(paramIn);
            dataFlowContext.addParamOut("shopPreferentialId",storePreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 处理 businessShopPreferential 节点
     * @param business 总的数据节点
     * @param businessShopPreferential 商品节点
     */
    private void doBusinessShopPreferential(Business business, JSONObject businessShopPreferential){
        Assert.jsonObjectHaveKey(businessShopPreferential,"shopPreferentialId","businessShop 节点下没有包含 shopPreferentialId 节点");
        businessShopPreferential.put("bId",business.getbId());
        businessShopPreferential.put("operate", StatusConstant.OPERATE_ADD);
        //对日期处理
        Date preferentialStartDate = null;
        Date preferentialEndDate = null;
        try {
            preferentialStartDate = DateUtil.getDateFromString(businessShopPreferential.getString("startDate"), DateUtil.DATE_FORMATE_STRING_A);
            preferentialEndDate = DateUtil.getDateFromString(businessShopPreferential.getString("entDate"), DateUtil.DATE_FORMATE_STRING_A);
            businessShopPreferential.put("startDate",preferentialStartDate);
            businessShopPreferential.put("entDate",preferentialEndDate);
        } catch (ParseException e) {
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 preferentialStartDate preferentialEndDate 格式不正确,请填写 "
                    +DateUtil.DATE_FORMATE_STRING_A +" 格式,"+businessShopPreferential);
        }
        //保存商户信息
        shopServiceDaoImpl.saveBusinessShopPreferential(businessShopPreferential);
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/UpdateShopAttrAndAttrParamListener.java
New file
@@ -0,0 +1,221 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 修改商户信息 侦听
 *
 * 处理节点
 * 1、businessShopAttr:{} 商品属性信息节点
 * 2、businessShopAttrParam:{} 商品属性参数节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("updateShopAttrAndAttrParamListener")
@Transactional
public class UpdateShopAttrAndAttrParamListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(UpdateShopAttrAndAttrParamListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 2;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_SHOP_INFO;
    }
    /**
     * business过程
     * @param dataFlowContext
     * @param business
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点
        if(data.containsKey("businessShopAttr")){
            JSONArray businessShopAttrs = data.getJSONArray("businessShopAttr");
            doBusinessShopAttr(business,businessShopAttrs);
        }
        //处理 businessShop 节点
        if(data.containsKey("businessShopAttrParam")){
            JSONArray businessShopAttrParams = data.getJSONArray("businessShopAttrParam");
            doBusinessShopAttrParam(business,businessShopAttrParams);
        }
    }
    /**
     * business to instance 过程
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户属性信息
        List<Map> businessShopAttrs = shopServiceDaoImpl.getBusinessShopAttrs(info);
        if(businessShopAttrs != null && businessShopAttrs.size() > 0) {
            for(Map businessShopAttr : businessShopAttrs) {
                flushBusinessShopAttr(businessShopAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrInstance(businessShopAttr);
            }
        }
        //商户属性参数信息
        List<Map> businessShopAttrParams = shopServiceDaoImpl.getBusinessShopAttrParams(info);
        if(businessShopAttrParams != null && businessShopAttrParams.size() > 0) {
            for(Map businessShopAttrParam : businessShopAttrParams) {
                flushBusinessShopAttrParam(businessShopAttrParam,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrParamInstance(businessShopAttrParam);
            }
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        List<Map> shopAttrs = shopServiceDaoImpl.getShopAttrs(info);
        if(shopAttrs != null && shopAttrs.size()>0){
            List<Map> businessShopAttrs = shopServiceDaoImpl.getBusinessShopAttrs(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopAttrs == null || businessShopAttrs.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_attr),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopAttr : businessShopAttrs) {
                flushBusinessShopAttr(businessShopAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrInstance(businessShopAttr);
            }
        }
        //商户属性参数信息
        List<Map> shopAttrParams = shopServiceDaoImpl.getShopAttrParams(info);
        if(shopAttrParams != null && shopAttrParams.size()>0){
            List<Map> businessShopAttrParams = shopServiceDaoImpl.getBusinessShopAttrParams(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopAttrParams == null || businessShopAttrParams.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_attr_param),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopAttrParam : businessShopAttrParams) {
                flushBusinessShopAttrParam(businessShopAttrParam,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopAttrParamInstance(businessShopAttrParam);
            }
        }
    }
    /**
     * 处理 businessShopAttr 节点
     * @param business 总的数据节点
     * @param businessShopAttrs 商品属性节点
     */
    private void doBusinessShopAttr(Business business,JSONArray businessShopAttrs){
        JSONObject data = business.getDatas();
        for(int shopAttrIndex = 0 ; shopAttrIndex < businessShopAttrs.size();shopAttrIndex ++){
            JSONObject shopAttr = businessShopAttrs.getJSONObject(shopAttrIndex);
            Assert.jsonObjectHaveKey(shopAttr,"attrId","businessShopAttr 节点下没有包含 attrId 节点");
            if(shopAttr.getString("attrId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+shopAttr);
            }
            //自动保存DEL数据
            autoSaveDelBusinessShopAttr(business,shopAttr);
            shopAttr.put("bId",business.getbId());
            shopAttr.put("shopId",shopAttr.getString("shopId"));
            shopAttr.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopAttr(shopAttr);
        }
    }
    /**
     * 处理 businessShopAttrParam 节点
     * @param business 总的数据节点
     * @param businessShopAttrParams 商品属性参数节点
     */
    private void doBusinessShopAttrParam(Business business,JSONArray businessShopAttrParams){
        JSONObject data = business.getDatas();
        for(int shopAttrParamIndex = 0 ; shopAttrParamIndex < businessShopAttrParams.size();shopAttrParamIndex ++){
            JSONObject shopAttrParam = businessShopAttrParams.getJSONObject(shopAttrParamIndex);
            Assert.jsonObjectHaveKey(shopAttrParam,"attrParamId","businessShopAttr 节点下没有包含 attrParamId 节点");
            if(shopAttrParam.getString("attrParamId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrParamId 错误,不能自动生成(必须已经存在的attrId)"+shopAttrParam);
            }
            //自动保存DEL数据
            autoSaveDelBusinessShopAttrParam(business,shopAttrParam);
            shopAttrParam.put("bId",business.getbId());
            shopAttrParam.put("shopId",shopAttrParam.getString("shopId"));
            shopAttrParam.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopAttrParam(shopAttrParam);
        }
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/UpdateShopDescListener.java
New file
@@ -0,0 +1,156 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
 * 修改商户信息 侦听
 *
 * 处理节点
 * 1、businessShopDesc:{} 商品优惠信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("updateShopDescListener")
@Transactional
public class UpdateShopDescListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(UpdateShopDescListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 5;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_SHOP_INFO;
    }
    /**
     * business过程
     * @param dataFlowContext
     * @param business
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShopDesc 节点
        if(data.containsKey("businessShopDesc")){
            JSONObject businessShopDesc = data.getJSONObject("businessShopDesc");
            doBusinessShopDesc(business,businessShopDesc);
        }
    }
    /**
     * business to instance 过程
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户优惠信息
        Map businessShopDesc = shopServiceDaoImpl.getBusinessShopDesc(info);
        if( businessShopDesc != null && !businessShopDesc.isEmpty()) {
            flushBusinessShopDesc(businessShopDesc,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopDescInstance(businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.get("shop_desc_id"));
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map shopDesc = shopServiceDaoImpl.getShopDesc(info);
        if(shopDesc != null && !shopDesc.isEmpty()){
            //商户信息
            Map businessShopDesc = shopServiceDaoImpl.getBusinessShopDesc(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopDesc == null || businessShopDesc.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_desc),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessShopDesc(businessShopDesc,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopDescInstance(businessShopDesc);
            dataFlowContext.addParamOut("shopDescId",businessShopDesc.get("shop_desc_id"));
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessShopDesc 商户节点
     */
    private void doBusinessShopDesc(Business business,JSONObject businessShopDesc){
        Assert.jsonObjectHaveKey(businessShopDesc,"shopDescId","businessShop 节点下没有包含 shopDescId 节点");
        if(businessShopDesc.getString("shopDescId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopDescId 错误,不能自动生成(必须已经存在的shopDescId)"+businessShopDesc);
        }
        //自动保存DEL
        autoSaveDelBusinessShopDesc(business,businessShopDesc);
        businessShopDesc.put("bId",business.getbId());
        businessShopDesc.put("operate", StatusConstant.OPERATE_ADD);
        //保存商户信息
        shopServiceDaoImpl.saveBusinessShopDesc(businessShopDesc);
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/UpdateShopInfoListener.java
@@ -24,11 +24,8 @@
 * 修改商户信息 侦听
 *
 * 处理节点
 * 1、businessStore:{} 商户基本信息节点
 * 2、businessStoreAttr:[{}] 商户属性信息节点
 * 3、businessStorePhoto:[{}] 商户照片信息节点
 * 4、businessStoreCerdentials:[{}] 商户证件信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * 1、businessShop:{} 商品基本信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("updateShopInfoListener")
@@ -41,12 +38,12 @@
    @Override
    public int getOrder() {
        return 2;
        return 1;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_STORE_INFO;
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_SHOP_INFO;
    }
    /**
@@ -61,26 +58,11 @@
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessStore 节点
        if(data.containsKey("businessStore")){
            JSONObject businessStore = data.getJSONObject("businessStore");
            doBusinessStore(business,businessStore);
            dataFlowContext.addParamOut("storeId",businessStore.getString("storeId"));
        }
        if(data.containsKey("businessStoreAttr")){
            JSONArray businessStoreAttrs = data.getJSONArray("businessStoreAttr");
            doSaveBusinessStoreAttrs(business,businessStoreAttrs);
        }
        if(data.containsKey("businessStorePhoto")){
            JSONArray businessStorePhotos = data.getJSONArray("businessStorePhoto");
            doBusinessStorePhoto(business,businessStorePhotos);
        }
        if(data.containsKey("businessStoreCerdentials")){
            JSONArray businessStoreCerdentialses = data.getJSONArray("businessStoreCerdentials");
            doBusinessStoreCerdentials(business,businessStoreCerdentialses);
        //处理 businessShop 节点
        if(data.containsKey("businessShop")){
            JSONObject businessShop = data.getJSONObject("businessShop");
            doBusinessShop(business,businessShop);
            dataFlowContext.addParamOut("shopId",businessShop.getString("shopId"));
        }
    }
@@ -93,42 +75,18 @@
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        //JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户信息
        Map businessStoreInfo = shopServiceDaoImpl.getBusinessStoreInfo(info);
        if( businessStoreInfo != null && !businessStoreInfo.isEmpty()) {
            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
            dataFlowContext.addParamOut("storeId",businessStoreInfo.get("store_id"));
        }
        //商户属性
        List<Map> businessStoreAttrs = shopServiceDaoImpl.getBusinessStoreAttrs(info);
        if(businessStoreAttrs != null && businessStoreAttrs.size() > 0) {
            for(Map businessStoreAttr : businessStoreAttrs) {
                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
            }
        }
        //商户照片
        List<Map> businessStorePhotos = shopServiceDaoImpl.getBusinessStorePhoto(info);
        if(businessStorePhotos != null && businessStorePhotos.size() >0){
            for(Map businessStorePhoto : businessStorePhotos) {
                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
            }
        }
        //商户证件
        List<Map> businessStoreCerdentialses = shopServiceDaoImpl.getBusinessStoreCerdentials(info);
        if(businessStoreCerdentialses != null && businessStoreCerdentialses.size()>0){
            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
            }
        Map businessShopInfo = shopServiceDaoImpl.getBusinessShopInfo(info);
        if( businessShopInfo != null && !businessShopInfo.isEmpty()) {
            flushBusinessShopInfo(businessShopInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopInfoInstance(businessShopInfo);
            dataFlowContext.addParamOut("shopId",businessShopInfo.get("shop_id"));
        }
    }
@@ -149,164 +107,45 @@
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map storeInfo = shopServiceDaoImpl.getStoreInfo(info);
        if(storeInfo != null && !storeInfo.isEmpty()){
        Map shopInfo = shopServiceDaoImpl.getShopInfo(info);
        if(shopInfo != null && !shopInfo.isEmpty()){
            //商户信息
            Map businessStoreInfo = shopServiceDaoImpl.getBusinessStoreInfo(delInfo);
            Map businessShopInfo = shopServiceDaoImpl.getBusinessShopInfo(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreInfo == null || businessStoreInfo.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store),程序内部异常,请检查! "+delInfo);
            if(businessShopInfo == null || businessShopInfo.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessStoreInfo(businessStoreInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateStoreInfoInstance(businessStoreInfo);
            dataFlowContext.addParamOut("storeId",storeInfo.get("store_id"));
            flushBusinessShopInfo(businessShopInfo,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopInfoInstance(businessShopInfo);
            dataFlowContext.addParamOut("shopId",shopInfo.get("shop_id"));
        }
        //商户属性
        List<Map> storeAttrs = shopServiceDaoImpl.getStoreAttrs(info);
        if(storeAttrs != null && storeAttrs.size()>0){
            List<Map> businessStoreAttrs = shopServiceDaoImpl.getBusinessStoreAttrs(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreAttrs == null || businessStoreAttrs.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_attr),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStoreAttr : businessStoreAttrs) {
                flushBusinessStoreAttr(businessStoreAttr,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreAttrInstance(businessStoreAttr);
            }
        }
        //商户照片
        List<Map> storePhotos = shopServiceDaoImpl.getStorePhoto(info);
        if(storePhotos != null && storePhotos.size()>0){
            List<Map> businessStorePhotos = shopServiceDaoImpl.getBusinessStorePhoto(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStorePhotos == null || businessStorePhotos.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_photo),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStorePhoto : businessStorePhotos) {
                flushBusinessStorePhoto(businessStorePhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStorePhotoInstance(businessStorePhoto);
            }
        }
        //商户属性
        List<Map> storeCerdentialses = shopServiceDaoImpl.getStoreCerdentials(info);
        if(storeCerdentialses != null && storeCerdentialses.size()>0){
            List<Map> businessStoreCerdentialses = shopServiceDaoImpl.getBusinessStoreCerdentials(delInfo);
            //除非程序出错了,这里不会为空
            if(businessStoreCerdentialses == null || businessStoreCerdentialses.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(store_cerdentials),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessStoreCerdentials : businessStoreCerdentialses) {
                flushBusinessStoreCredentials(businessStoreCerdentials,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateStoreCerdentailsInstance(businessStoreCerdentials);
            }
        }
    }
    /**
     * 保存商户照片
     * @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.getString("storePhotoId").startsWith("-")) {
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStorePhoto);
            }
            //自动保存DEL信息
            autoSaveDelBusinessStorePhoto(business,businessStorePhoto);
            businessStorePhoto.put("bId", business.getbId());
            businessStorePhoto.put("operate", StatusConstant.OPERATE_ADD);
            //保存商户信息
            shopServiceDaoImpl.saveBusinessStorePhoto(businessStorePhoto);
        }
    }
    /**
     * 处理 businessStore 节点
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessStore 商户节点
     * @param businessShop 商户节点
     */
    private void doBusinessStore(Business business,JSONObject businessStore){
    private void doBusinessShop(Business business,JSONObject businessShop){
        Assert.jsonObjectHaveKey(businessStore,"storeId","businessStore 节点下没有包含 storeId 节点");
        Assert.jsonObjectHaveKey(businessShop,"shopId","businessShop 节点下没有包含 shopId 节点");
        if(businessStore.getString("storeId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storeId 错误,不能自动生成(必须已经存在的storeId)"+businessStore);
        if(businessShop.getString("shopId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopId 错误,不能自动生成(必须已经存在的shopId)"+businessShop);
        }
        //自动保存DEL
        autoSaveDelBusinessStore(business,businessStore);
        autoSaveDelBusinessShop(business,businessShop);
        businessStore.put("bId",business.getbId());
        businessStore.put("operate", StatusConstant.OPERATE_ADD);
        businessShop.put("bId",business.getbId());
        businessShop.put("operate", StatusConstant.OPERATE_ADD);
        //保存商户信息
        shopServiceDaoImpl.saveBusinessStoreInfo(businessStore);
        shopServiceDaoImpl.saveBusinessShopInfo(businessShop);
    }
    /**
     * 保存商户属性信息
     * @param business 当前业务
     * @param businessStoreAttrs 商户属性
     */
    private void doSaveBusinessStoreAttrs(Business business,JSONArray businessStoreAttrs){
        JSONObject data = business.getDatas();
        for(int storeAttrIndex = 0 ; storeAttrIndex < businessStoreAttrs.size();storeAttrIndex ++){
            JSONObject storeAttr = businessStoreAttrs.getJSONObject(storeAttrIndex);
            Assert.jsonObjectHaveKey(storeAttr,"attrId","businessStoreAttr 节点下没有包含 attrId 节点");
            if(storeAttr.getString("attrId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+storeAttr);
            }
            //自动保存DEL数据
            autoSaveDelBusinessStoreAttr(business,storeAttr);
            storeAttr.put("bId",business.getbId());
            storeAttr.put("storeId",storeAttr.getString("storeId"));
            storeAttr.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.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.getString("storeCerdentialsId").startsWith("-")) {
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"storePhotoId 错误,不能自动生成(必须已经存在的storePhotoId)"+businessStoreCerdentials);
            }
            autoSaveDelBusinessStoreCerdentials(business,businessStoreCerdentials);
            businessStoreCerdentials.put("bId", business.getbId());
            businessStoreCerdentials.put("operate", StatusConstant.OPERATE_ADD);
            //保存商户信息
            shopServiceDaoImpl.saveBusinessStoreCerdentials(businessStoreCerdentials);
        }
    }
    @Override
ShopService/src/main/java/com/java110/shop/listener/UpdateShopPhotoListener.java
New file
@@ -0,0 +1,164 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 修改商户信息 侦听
 *
 * 处理节点
 * 1、businessShopPhoto:{} 商品照片信息
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("updateShopPhotoListener")
@Transactional
public class UpdateShopPhotoListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(UpdateShopPhotoListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 3;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_SHOP_INFO;
    }
    /**
     * business过程
     * @param dataFlowContext
     * @param business
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShop 节点
        if(data.containsKey("businessShopPhoto")){
            JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");
            doBusinessShopPhoto(business,businessShopPhotos);
        }
    }
    /**
     * business to instance 过程
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户属性信息
        List<Map> businessShopPhotos = shopServiceDaoImpl.getBusinessShopPhoto(info);
        if(businessShopPhotos != null && businessShopPhotos.size() > 0) {
            for(Map businessShopPhoto : businessShopPhotos) {
                flushBusinessShopPhoto(businessShopPhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopPhotoInstance(businessShopPhoto);
            }
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        List<Map> shopPhotos = shopServiceDaoImpl.getShopPhoto(info);
        if(shopPhotos != null && shopPhotos.size()>0){
            List<Map> businessShopPhotos = shopServiceDaoImpl.getBusinessShopPhoto(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopPhotos == null || businessShopPhotos.size() ==0 ){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop_photo),程序内部异常,请检查! "+delInfo);
            }
            for(Map businessShopPhoto : businessShopPhotos) {
                flushBusinessShopPhoto(businessShopPhoto,StatusConstant.STATUS_CD_VALID);
                shopServiceDaoImpl.updateShopPhotoInstance(businessShopPhoto);
            }
        }
    }
    /**
     * 处理 businessShopPhoto 节点
     * @param business 总的数据节点
     * @param businessShopPhotos 商品属性节点
     */
    private void doBusinessShopPhoto(Business business,JSONArray businessShopPhotos){
        JSONObject data = business.getDatas();
        for(int shopPhotoIndex = 0 ; shopPhotoIndex < businessShopPhotos.size();shopPhotoIndex ++){
            JSONObject shopPhoto = businessShopPhotos.getJSONObject(shopPhotoIndex);
            Assert.jsonObjectHaveKey(shopPhoto,"shopPhotoId","businessShopPhoto 节点下没有包含 shopPhotoId 节点");
            if(shopPhoto.getString("shopPhotoId").startsWith("-")){
                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopPhotoId 错误,不能自动生成(必须已经存在的shopPhotoId)"+shopPhoto);
            }
            //自动保存DEL数据
            autoSaveDelBusinessShopPhoto(business,shopPhoto);
            shopPhoto.put("bId",business.getbId());
            shopPhoto.put("shopId",shopPhoto.getString("shopId"));
            shopPhoto.put("operate", StatusConstant.OPERATE_ADD);
            shopServiceDaoImpl.saveBusinessShopPhoto(shopPhoto);
        }
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
ShopService/src/main/java/com/java110/shop/listener/UpdateShopPreferentialListener.java
New file
@@ -0,0 +1,156 @@
package com.java110.shop.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.ServiceCodeConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.common.exception.ListenerExecuteException;
import com.java110.common.util.Assert;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.entity.center.Business;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
 * 修改商户信息 侦听
 *
 * 处理节点
 * 1、businessShopPreferential:{} 商品优惠信息节点
 * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("updateShopPreferentialListener")
@Transactional
public class UpdateShopPreferentialListener extends AbstractShopBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(UpdateShopPreferentialListener.class);
    @Autowired
    IShopServiceDao shopServiceDaoImpl;
    @Override
    public int getOrder() {
        return 4;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_UPDATE_SHOP_INFO;
    }
    /**
     * business过程
     * @param dataFlowContext
     * @param business
     */
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //处理 businessShopPreferential 节点
        if(data.containsKey("businessShopPreferential")){
            JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
            doBusinessShopPreferential(business,businessShopPreferential);
        }
    }
    /**
     * business to instance 过程
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //JSONObject data = business.getDatas();
        Map info = new HashMap();
        info.put("bId",business.getbId());
        info.put("operate",StatusConstant.OPERATE_ADD);
        //商户优惠信息
        Map businessShopPreferential = shopServiceDaoImpl.getBusinessShopPreferential(info);
        if( businessShopPreferential != null && !businessShopPreferential.isEmpty()) {
            flushBusinessShopPreferential(businessShopPreferential,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopPreferentialInstance(businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        //Assert.hasLength(bId,"请求报文中没有包含 bId");
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("operate",StatusConstant.OPERATE_DEL);
        //商户信息
        Map shopPreferential = shopServiceDaoImpl.getShopPreferential(info);
        if(shopPreferential != null && !shopPreferential.isEmpty()){
            //商户信息
            Map businessShopPreferential = shopServiceDaoImpl.getBusinessShopPreferential(delInfo);
            //除非程序出错了,这里不会为空
            if(businessShopPreferential == null || businessShopPreferential.isEmpty()){
                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(shop),程序内部异常,请检查! "+delInfo);
            }
            flushBusinessShopPreferential(businessShopPreferential,StatusConstant.STATUS_CD_VALID);
            shopServiceDaoImpl.updateShopPreferentialInstance(businessShopPreferential);
            dataFlowContext.addParamOut("shopPreferentialId",businessShopPreferential.get("shop_preferential_id"));
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param businessShopPreferential 商户节点
     */
    private void doBusinessShopPreferential(Business business,JSONObject businessShopPreferential){
        Assert.jsonObjectHaveKey(businessShopPreferential,"shopPreferentialId","businessShop 节点下没有包含 shopPreferentialId 节点");
        if(businessShopPreferential.getString("shopPreferentialId").startsWith("-")){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"shopPreferentialId 错误,不能自动生成(必须已经存在的shopPreferentialId)"+businessShopPreferential);
        }
        //自动保存DEL
        autoSaveDelBusinessShopPreferential(business,businessShopPreferential);
        businessShopPreferential.put("bId",business.getbId());
        businessShopPreferential.put("operate", StatusConstant.OPERATE_ADD);
        //保存商户信息
        shopServiceDaoImpl.saveBusinessShopPreferential(businessShopPreferential);
    }
    @Override
    public IShopServiceDao getShopServiceDaoImpl() {
        return shopServiceDaoImpl;
    }
    public void setShopServiceDaoImpl(IShopServiceDao shopServiceDaoImpl) {
        this.shopServiceDaoImpl = shopServiceDaoImpl;
    }
}
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java
@@ -102,5 +102,27 @@
    /**
     * 保存商品信息
     */
    public static final String SERVICE_CODE_SAVE_SHOP_INFO = "save.shop.info";
    /**
     * 修改商品信息
     */
    public static final String SERVICE_CODE_UPDATE_SHOP_INFO = "update.shop.info";
    /**
     * 删除商品信息
     */
    public static final String SERVICE_CODE_DELETE_SHOP_INFO = "delete.shop.info";
    /**
     * 购买商品
     */
    public static final String SERVICE_CODE_BUY_SHOP_INFO = "buy.shop.info";
}
java110-config/db/ShopService/create_table.sql
@@ -2,6 +2,7 @@
create table business_shop(
    shop_id VARCHAR(30) NOT NULL COMMENT '商品ID',
    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
    catalog_id varchar(30) not null comment '目录ID',
    store_id VARCHAR(30) NOT NULL COMMENT '商店ID',
    `name` VARCHAR(100) NOT NULL COMMENT '商品名称',
    hot_buy varchar(2) not null default 'N' comment '是否热卖 Y是 N否',
@@ -57,6 +58,65 @@
);
CREATE INDEX idx_business_shop_attr_shop_id ON business_shop_attr(shop_id);
CREATE INDEX idx_business_shop_attr_b_id ON business_shop_attr(b_id);
-- 商品 目录
create table business_shop_catalog(
    catalog_id varchar(30) not null comment '目录ID',
    store_id VARCHAR(30) NOT NULL COMMENT '商店ID',
    `name` varchar(100) not null comment '目录名称',
    level varchar(2) not null comment '目录等级',
    parent_catalog_id varchar(30) not null default '-1' comment '父目录ID,一级目录则写-1',
    `month` INT NOT NULL COMMENT '月份',
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
)
PARTITION BY RANGE (`month`) (
    PARTITION business_shop_catalog_1 VALUES LESS THAN (2),
    PARTITION business_shop_catalog_2 VALUES LESS THAN (3),
    PARTITION business_shop_catalog_3 VALUES LESS THAN (4),
    PARTITION business_shop_catalog_4 VALUES LESS THAN (5),
    PARTITION business_shop_catalog_5 VALUES LESS THAN (6),
    PARTITION business_shop_catalog_6 VALUES LESS THAN (7),
    PARTITION business_shop_catalog_7 VALUES LESS THAN (8),
    PARTITION business_shop_catalog_8 VALUES LESS THAN (9),
    PARTITION business_shop_catalog_9 VALUES LESS THAN (10),
    PARTITION business_shop_catalog_10 VALUES LESS THAN (11),
    PARTITION business_shop_catalog_11 VALUES LESS THAN (12),
    PARTITION business_shop_catalog_12 VALUES LESS THAN (13)
);
CREATE INDEX idx_business_shop_catalog_store_id ON business_shop_catalog(store_id);
CREATE INDEX idx_business_shop_catalog_b_id ON business_shop_catalog(b_id);
-- 商店照片
CREATE TABLE business_shop_photo(
    shop_photo_id VARCHAR(30) NOT NULL COMMENT '商品照片ID',
    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
    shop_id VARCHAR(30) NOT NULL COMMENT '商店ID',
    shop_photo_type_cd VARCHAR(12) NOT NULL COMMENT '商品照片类型,L logo O 其他照片',
    photo VARCHAR(100) NOT NULL COMMENT '照片',
    `month` INT NOT NULL COMMENT '月份',
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
)
PARTITION BY RANGE (`month`) (
    PARTITION business_shop_photo_1 VALUES LESS THAN (2),
    PARTITION business_shop_photo_2 VALUES LESS THAN (3),
    PARTITION business_shop_photo_3 VALUES LESS THAN (4),
    PARTITION business_shop_photo_4 VALUES LESS THAN (5),
    PARTITION business_shop_photo_5 VALUES LESS THAN (6),
    PARTITION business_shop_photo_6 VALUES LESS THAN (7),
    PARTITION business_shop_photo_7 VALUES LESS THAN (8),
    PARTITION business_shop_photo_8 VALUES LESS THAN (9),
    PARTITION business_shop_photo_9 VALUES LESS THAN (10),
    PARTITION business_shop_photo_10 VALUES LESS THAN (11),
    PARTITION business_shop_photo_11 VALUES LESS THAN (12),
    PARTITION business_shop_photo_12 VALUES LESS THAN (13)
);
CREATE INDEX idx_business_shop_photo_shop_id ON business_shop_photo(shop_id);
CREATE INDEX idx_business_shop_photo_b_id ON business_shop_photo(b_id);
-- 商品属性 离散值表,例如 手机颜色 黑 白 红
create table business_shop_attr_param(
@@ -150,6 +210,7 @@
    shop_id VARCHAR(30) NOT NULL COMMENT '商品ID',
    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
    store_id VARCHAR(30) NOT NULL COMMENT '商店ID',
    catalog_id varchar(30) not null comment '目录ID',
    `name` VARCHAR(100) NOT NULL COMMENT '商品名称',
    hot_buy varchar(2) not null default 'N' comment '是否热卖 Y是 N否',
    sale_price DECIMAL(10,2) not null comment '商品销售价,再没有打折情况下显示',
@@ -220,6 +281,21 @@
CREATE INDEX idx_shop_desc_b_id ON s_shop_desc(b_id);
CREATE INDEX idx_shop_desc_shop_id ON s_shop_desc(shop_id);
-- 商店照片
CREATE TABLE s_shop_photo(
    shop_photo_id VARCHAR(30) NOT NULL COMMENT '商品照片ID',
    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
    shop_id VARCHAR(30) NOT NULL COMMENT '商品ID',
    shop_photo_type_cd VARCHAR(12) NOT NULL COMMENT '商品照片类型,L logo O 其他照片',
    photo VARCHAR(100) NOT NULL COMMENT '照片',
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
    UNIQUE KEY (store_photo_id)
);
CREATE INDEX idx_shop_photo_b_id ON s_store_photo(b_id);
CREATE INDEX idx_shop_photo_shop_id ON s_store_photo(shop_id);
CREATE INDEX idx_shop_photo_shop_photo_id ON s_store_photo(shop_photo_id);
-- 商品购买记录
create table s_buy_shop(
java110-config/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml
New file
@@ -0,0 +1,457 @@
<?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="shopServiceDaoImpl">
    <!-- 保存商品信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessShopInfo" parameterType="Map">
        insert into business_shop(shop_id,b_id,catalog_id,store_id,name,hot_buy,sale_price,open_shop_count,shop_count,start_date,end_date,month,operate)
        values(#{shopId},#{bId},#{catalogId},#{storeId},#{name},#{hotBuy},#{salePrice},#{openShopCount},#{shopCount},#{startDate},#{endDate},#{month},#{operate})
    </insert>
    <!-- 保存商品属性信息  add by wuxw 2018-07-03 -->
    <insert id="saveBusinessShopAttr" parameterType="Map">
        insert into business_shop_attr(b_id,attr_id,shop_id,spec_cd,value,month,operate)
        values(#{bId},#{attrId},#{shopId},#{specCd},#{value},#{month},#{operate})
    </insert>
    <insert id="saveBusinessShopAttrParam" parameterType="Map">
        insert into business_shop_attr_param(attr_param_id,b_id,shop_id,spec_cd,param,month,operate)
        values(#{attrParamId},#{bId},#{shopId},#{specCd},#{param},#{month},#{operate})
    </insert>
    <!-- 保存商品照片信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessShopPhoto" parameterType="Map">
        insert into business_shop_photo(shop_photo_id,b_id,shop_id,shop_photo_type_cd,photo,month,operate)
        values(#{shopPhotoId},#{bId},#{shopId},#{shopPhotoTypeCd},#{photo},#{month},#{operate})
    </insert>
    <!-- 保存商品优惠信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessShopPreferential" parameterType="Map">
        insert into business_shop_preferential(shop_preferential_id,b_id,shop_id,original_price,discount_rate,show_original_price,preferential_start_date,preferential_end_date,month,operate)
        values(#{shopPreferentialId},#{bId},#{shopId},#{originalPrice},#{discountRate},#{showOriginalPrice},#{preferentialStartDate},#{preferentialEndDate},#{month},#{operate})
    </insert>
    <insert id="saveBusinessShopDesc" parameterType="Map">
        insert into business_shop_desc(shop_desc_id,shop_id,b_id,shop_describe,month,operate)
        values(#{shopDescId},#{shopId},#{bId},#{shopDescribe},#{month},#{operate})
    </insert>
    <!-- 查询商品信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessShopInfo" parameterType="Map" resultType="Map">
        select s.shop_id,s.b_id,s.catalog_id,s.store_id,s.name,s.hot_buy,s.sale_price,s.open_shop_count,s.shop_count,s.start_date,s.end_date,s.operate
        from business_shop 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="shopId != null and shopId != ''">
            and s.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品属性信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessShopAttrs" parameterType="Map" resultType="Map">
        select sa.b_id,sa.attr_id,sa.shop_id,sa.spec_cd,sa.value,sa.operate
        from business_shop_attr sa where 1=1
        <if test="operate != null and operate != ''">
            and sa.operate = #{operate}
        </if>
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId != ''">
            and sa.shop_id = #{shopId}
        </if>
        <if test="attrId != null and attrId != ''">
            and sa.attr_id = #{attrId}
        </if>
    </select>
    <!-- 查询 商品 属性参数 add by wuxw 2018-07-03 -->
    <select id="getBusinessShopAttrParams" parameterType="Map" resultType="Map">
        select sap.attr_param_id,sap.b_id,sap.shop_id,sap.spec_cd,sap.param,sap.operate
        from business_shop_attr_param sap where 1=1
        <if test="operate != null and operate != ''">
            and sap.operate = #{operate}
        </if>
        <if test="bId != null and bId !=''">
            and sap.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId != ''">
            and sa.shop_id = #{shopId}
        </if>
        <if test="attrParamId != null and attrParamId != ''">
            and sa.attr_param_id = #{attrParamId}
        </if>
    </select>
    <!-- 查询商品照片信息 add by wuxw 2018-07-03 -->
    <select id="getBusinessShopPhoto" parameterType="Map" resultType="Map">
        select sp.shop_photo_id,sp.b_id,sp.shop_id,sp.shop_photo_type_cd,sp.photo,sp.operate
        from business_shop_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="shopId != null and shopId != ''">
            and sp.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品 证件信息 add by wuxw 2018-07-03 -->
    <select id="getBusinessShopPreferential" parameterType="Map" resultType="Map">
        select sp.shop_preferential_id,sp.b_id,sc.shop_id,sp.original_price,sp.discount_rate,sp.show_original_price,sp.preferential_start_date,sp.preferential_end_date,sp.operate
        from business_shop_preferential 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="shopId != null and shopId != ''">
            and sp.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品 描述信息 add by wuxw 2018-07-03 -->
    <select id="getBusinessShopDesc" parameterType="Map" resultType="Map">
        select sd.shop_desc_id,sd.b_id,sd.shop_id,sd.shop_describe,sd.operate
        from business_shop_desc sd where 1 = 1
        <if test="bId != null and bId !=''">
            and sd.b_id = #{bId}
        </if>
        <if test="operate != null and operate != ''">
            and sd.operate = #{operate}
        </if>
        <if test="shopId != null and shopId != ''">
            and sd.shop_id = #{shopId}
        </if>
    </select>
    <!-- 保存商品信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveShopInfoInstance" parameterType="Map">
        insert into s_shop(shop_id,b_id,catalog_id,store_id,name,hot_buy,sale_price,open_shop_count,shop_count,start_date,end_date,status_cd)
        select s.shop_id,s.b_id,s.catalog_id,s.store_id,s.name,s.hot_buy,s.sale_price,s.open_shop_count,s.shop_count,s.start_date,s.end_date,'0'
        from business_shop s where
        s.operate = 'ADD' and s.b_id=#{bId}
    </insert>
    <!-- 保存商品属性信息到 instance add by wuxw 2018-07-03 -->
    <insert id="saveShopAttrsInstance" parameterType="Map">
        insert into s_shop_attr(b_id,attr_id,shop_id,spec_cd,value,status_cd)
        select sa.b_id,sa.attr_id,sa.shop_id,sa.spec_cd,sa.value,'0'
        from business_shop_attr sa
        where sa.operate = 'ADD' and sa.b_id=#{bId}
    </insert>
    <!-- 保存商品属性参数 instance add by wuxw 2018-07-07 -->
    <insert id="saveShopAttrParamsInstance" parameterType="Map">
        insert into s_shop_attr_param(attr_param_id,b_id,shop_id,spec_cd,param,status_cd)
        select sap.attr_param_id,sap.b_id,sap.shop_id,sap.spec_cd,sap.param,'0'
        from business_shop_attr_param sa
        where sa.operate = 'ADD' and sa.b_id=#{bId}
    </insert>
    <!-- 保存 商品照片信息 instance add by wuxw 2018-07-03 -->
    <insert id="saveShopPhotoInstance" parameterType="Map">
        insert into s_shop_photo(shop_photo_id,b_id,shop_id,shop_photo_type_cd,photo,status_cd)
        select sp.shop_photo_id,sp.b_id,sp.shop_id,sp.shop_photo_type_cd,sp.photo,'0'
        from business_shop_photo sp
        where  sp.operate = 'ADD' and sp.b_id=#{bId}
    </insert>
    <!-- 保存 商品证件信息 instance add by wuxw 2018-07-03 -->
    <insert id="saveShopPreferentialInstance" parameterType="Map">
        insert into s_shop_preferential(shop_preferential_id,b_id,shop_id,original_price,discount_rate,show_original_price,preferential_start_date,preferential_end_date,status_cd)
        select sp.shop_preferential_id,sp.b_id,sc.shop_id,sp.original_price,sp.discount_rate,sp.show_original_price,sp.preferential_start_date,sp.preferential_end_date,'0'
        from business_shop_preferential sp
        where sp.operate = 'ADD' and sp.b_id=#{bId}
    </insert>
    <!-- 保存 商品描述信息 instance add by wuxw 2018-07-03 -->
    <insert id="saveShopDescInstance" parameterType="Map">
        insert into s_shop_desc(shop_desc_id,b_id,shop_id,shop_describe,status_cd)
        select sd.shop_desc_id,sd.b_id,sd.shop_id,sd.shop_describe,'0'
        from business_shop_desc sd
        where sd.operate = 'ADD' and sd.b_id=#{bId}
    </insert>
    <!-- 查询商品信息 add by wuxw 2018-07-03 -->
    <select id="getShopInfo" parameterType="Map" resultType="Map">
        select s.shop_id,s.b_id,s.catalog_id,s.store_id,s.name,s.hot_buy,s.sale_price,s.open_shop_count,s.shop_count,s.start_date,s.end_date,s.status_cd
        from s_shop s
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and s.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and s.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and s.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品属性信息 add by wuxw 2018-07-03 -->
    <select id="getShopAttrs" parameterType="Map" resultType="Map">
        select sa.b_id,sa.attr_id,sa.shop_id,sa.spec_cd,sa.value,sa.status_cd
        from s_shop_attr sa
        where
        1=1
        <if test="statusCd != null and statusCd != ''">
            and sa.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sa.shop_id = #{shopId}
        </if>
        <if test="attrId != null and attrId != ''">
            and sa.attr_id = #{attrId}
        </if>
    </select>
    <!-- 查询商品属性参数信息 add by wuxw 2018-07-06 -->
    <select id="getShopAttrParams" parameterType="Map" resultType="Map">
        select sap.attr_param_id,sap.b_id,sap.shop_id,sap.spec_cd,sap.param,sap.status_cd
        from s_shop_attr_param sap
        where
        1=1
        <if test="statusCd != null and statusCd != ''">
            and sap.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sap.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sap.shop_id = #{shopId}
        </if>
        <if test="attrParamId != null and attrParamId != ''">
            and sap.attr_param_id = #{attrParamId}
        </if>
    </select>
    <!-- 查询商品照片信息 add by wuxw 2018-07-03 -->
    <select id="getShopPhoto" parameterType="Map" resultType="Map">
        select sp.shop_photo_id,sp.b_id,sp.shop_id,sp.shop_photo_type_cd,sp.photo,sp.status_cd
        from s_shop_photo sp
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sp.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sp.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品证件信息 add by wuxw 2018-07-03 -->
    <select id="getShopPreferential" parameterType="Map" resultType="Map">
        select sp.shop_preferential_id,sp.b_id,sc.shop_id,sp.original_price,sp.discount_rate,sp.show_original_price,sp.preferential_start_date,sp.preferential_end_date,sc.status_cd
        from s_shop_preferential sp
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sp.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sp.shop_id = #{shopId}
        </if>
    </select>
    <!-- 查询商品证件信息 add by wuxw 2018-07-03 -->
    <select id="getShopDesc" parameterType="Map" resultType="Map">
        select sd.shop_desc_id,sd.b_id,sd.shop_id,sd.shop_describe,sd.status_cd
        from s_shop_desc sd
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sd.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sd.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sd.shop_id = #{shopId}
        </if>
    </select>
    <!-- 修改商品信息 add by wuxw 2018-07-03 -->
    <update id="updateShopInfoInstance" parameterType="Map">
        update s_shop s set s.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,s.b_id = #{newBId}
        </if>
        <if test="storeId != null and storeId != ''">
            ,s.store_id = #{storeId}
        </if>
        <if test="catalogId != null and catalogId != ''">
            ,s.catalog_id = #{catalogId}
        </if>
        <if test="name != null and name != ''">
            ,s.name = #{name}
        </if>
        <if test="hotBuy != null and hotBuy != ''">
            ,s.hot_buy = #{hotBuy}
        </if>
        <if test="salePrice != null and salePrice != ''">
            ,s.sale_price = #{salePrice}
        </if>
        <if test="openShopCount != null and openShopCount != ''">
            ,s.open_shop_count = #{openShopCount}
        </if>
        <if test="shopCount != null and shopCount != ''">
            ,s.shop_count = #{shopCount}
        </if>
        <if test="startDate != null and startDate != ''">
            ,s.start_date = #{startDate}
        </if>
        <if test="endDate != null and endDate != ''">
            ,s.end_date = #{endDate}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and s.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and s.shop_id = #{shopId}
        </if>
    </update>
    <!-- 修改商品属性信息 add by wuxw 2018-07-03 -->
    <update id="updateShopAttrInstance" parameterType="Map">
        update s_shop_attr sa set sa.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sa.b_id = #{newBId}
        </if>
        <if test="value != null and value != ''">
            ,sa.value = #{value}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sa.shop_id = #{shopId}
        </if>
        <if test="specCd != null and specCd !=''">
            and sa.spec_cd = #{specCd}
        </if>
        <if test="attrId != null and attrId !=''">
            and sa.attr_id = #{attrId}
        </if>
    </update>
    <!-- 修改商品属性参数信息 add by wuxw 2018-07-03 -->
    <update id="updateShopAttrParamInstance" parameterType="Map">
        update s_shop_attr_param sap set sap.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sap.b_id = #{newBId}
        </if>
        <if test="param != null and param != ''">
            ,sap.param = #{param}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sap.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sap.shop_id = #{shopId}
        </if>
        <if test="specCd != null and specCd !=''">
            and sap.spec_cd = #{specCd}
        </if>
        <if test="attrParamId != null and attrParamId !=''">
            and sap.attr_param_id = #{attrParamId}
        </if>
    </update>
    <!-- 修改商品照片信息 add by wuxw 2018-07-03 -->
    <update id="updateShopPhotoInstance" parameterType="Map">
        update s_shop_photo sp set sp.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sp.b_id = #{newBId}
        </if>
        <if test="shopPhotoTypeCd != null and shopPhotoTypeCd != ''">
            ,sp.shop_photo_type_cd = #{shopPhotoTypeCd}
        </if>
        <if test="photo != null and photo != ''">
            ,sp.photo = #{photo}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sp.shop_id = #{shopId}
        </if>
        <if test="shopPhotoId != null and shopPhotoId !=''">
            and sp.shop_photo_id = #{shopPhotoId}
        </if>
    </update>
    <!-- 修改商品优惠信息 add by wuxw 2018-07-03 -->
    <update id="updateShopPreferentialInstance" parameterType="Map">
        update s_shop_preferential sp set sp.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sp.b_id = #{newBId}
        </if>
        <if test="originalPrice != null and originalPrice != ''">
            ,sp.original_price = #{originalPrice}
        </if>
        <if test="discountRate != null and discountRate != ''">
            ,sp.discount_rate = #{discountRate}
        </if>
        <if test="showOriginalPrice != null and showOriginalPrice != ''">
            ,sp.show_original_price = #{showOriginalPrice}
        </if>
        <if test="preferentialStartDate != null ">
            ,sp.preferential_start_date = #{preferentialStartDate}
        </if>
        <if test="preferentialEndDate != null ">
            ,sp.preferential_end_date = #{preferentialEndDate}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sp.shop_id = #{shopId}
        </if>
        <if test="shopPreferentialId != null and shopPreferentialId !=''">
            and sp.shop_preferential_id = #{shopPreferentialId}
        </if>
    </update>
    <!-- 修改商品优惠信息 add by wuxw 2018-07-03 -->
    <update id="updateShopDescInstance" parameterType="Map">
        update s_shop_desc sd set sd.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sd.b_id = #{newBId}
        </if>
        <if test="shopDescribe != null and shopDescribe != ''">
            ,sd.shop_describe = #{shopDescribe}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sd.b_id = #{bId}
        </if>
        <if test="shopId != null and shopId !=''">
            and sd.shop_id = #{shopId}
        </if>
        <if test="shopDescId != null and shopDescId !=''">
            and sd.shop_desc_id = #{shopDescId}
        </if>
    </update>
</mapper>
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -54,6 +54,12 @@
        prefixMap.put("storeId","40");
        prefixMap.put("storePhotoId","41");
        prefixMap.put("storeCerdentialsId","42");
        prefixMap.put("shopId","50");
        prefixMap.put("shopAttrId","51");
        prefixMap.put("shopPhotoId","52");
        prefixMap.put("shopAttrParamId","53");
        prefixMap.put("shopPreferentialId","54");
        prefixMap.put("shopDescId","55");
    }
    private static String PLATFORM_CODE = "0001";
@@ -204,7 +210,11 @@
        return getCode(prefixMap.get("storePhotoId"));
    }
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    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");
@@ -214,6 +224,85 @@
    }
    /**
     * 商品ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopId"));
    }
    /**
     * 商品属性ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopAttrId"));
    }
    /**
     * 商品优惠ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopPreferentialId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopPreferentialId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopPreferentialId"));
    }
    /**
     * 商品属性参数ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopAttrParamId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopAttrParamId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopAttrParamId"));
    }
    /**
     * 商品属性ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopPhotoId"));
    }
    /**
     * 商品描述ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopDescId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopDescId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("shopDescId"));
    }
    /**
     * 获取restTemplate
     * @return
     * @throws NoSuchObjectException
java110-event/src/main/java/com/java110/event/service/AbstractBusinessServiceDataFlowListener.java
@@ -1,5 +1,6 @@
package com.java110.event.service;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.StatusConstant;
import com.java110.core.context.DataFlowContext;
@@ -35,6 +36,7 @@
        }else if(StatusConstant.REQUEST_BUSINESS_TYPE_DELETE.equals(businessType)){ //撤单过程
            doRecover(dataFlowContext,business);
        }
        dataFlowContext.setResJson(DataTransactionFactory.createBusinessResponseJson(dataFlowContext, ResponseConstant.RESULT_CODE_SUCCESS,"成功",
                dataFlowContext.getParamOut()));
    }