wuxw7
2018-07-13 9663ede17e832eb313407791ae5c1c0e0052fc69
评论服务开发完成
6个文件已修改
10个文件已添加
2641 ■■■■■ 已修改文件
CommentService/doc/deleteCommentInfo.json 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/doc/saveCommentInfo.json 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/doc/start_commentService.sh 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/dao/ICommentServiceDao.java 314 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/dao/impl/CommentServiceDaoImpl.java 740 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/AbstractCommentBusinessServiceDataFlowListener.java 271 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/DeleteCommentOrSubCommentListener.java 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/FlushAboutCommentIdListener.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/SaveCommentAndSubCommentListener.java 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/SaveCommentScoreListener.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/SaveSubCommentAttrListener.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/src/main/java/com/java110/comment/listener/SaveSubCommentPhotoListener.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/db/CommentService/create_table.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-config/src/main/resources/mapper/comment/CommentServiceDaoImplMapper.xml 216 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CommentService/doc/deleteCommentInfo.json
New file
@@ -0,0 +1,32 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "delete.comment.info",
    "serviceName": "保存评论信息",
    "remark": "备注",
    "datas": {
      "comment": {
        "commentId": "123"
      },
      "subComment": { //如果有 comment 节点 这个节点不用写
        "subCommentId": "123456"
      }
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
CommentService/doc/saveCommentInfo.json
New file
@@ -0,0 +1,57 @@
{
  "orders": {
    "appId": "外系统ID,分配得到",
    "transactionId": "100000000020180409224736000001",
    "userId": "用户ID",
    "orderTypeCd": "订单类型,查询,受理",
    "requestTime": "20180409224736",
    "remark": "备注",
    "sign": "这个服务是否要求MD5签名",
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  },
  "business": [{
    "serviceCode": "save.comment.info",
    "serviceName": "保存评论信息",
    "remark": "备注",
    "datas": {
      "comment": {
        "commentId": "-1",
        "userId": "123",
        "commentTypeCd":"S",
        "outId": "9898989898"
      },
      "subComment": {
        "subCommentId": "-1",
        "commentId":"-1",
        "parentSubCommentId":"-1",
        "subCommentTypeCd":"C",
        "commentContext":"非常好"
      },
      "subCommentAttr": [{
        "subCommentId": "-1",
        "attrId":"-1",
        "specCd":"1001",
        "value":"01"
      }],
      "subCommentPhoto":[{
        "commentPhotoId":"-1",
        "subCommentId":"-1",
        "commentPhotoTypeCd":"L",
        "photo":"123.jpg"
      }],
      "commentScore":[{
        "commentScoreId":"-1",
        "commentId":"-1",
        "scoreTypeCd":"S",
        "value":"5"
      }]
    },
    "attrs": [{
      "specCd": "配置的字段ID",
      "value": "具体值"
    }]
  }]
}
CommentService/doc/start_commentService.sh
New file
@@ -0,0 +1,14 @@
#!/bin/bash
#### debug model prod
#nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar -Dspring.profiles.active=dev CommentService.jar $1 > comment.log 2>&1 &
#### normal prod model
#nohup java -jar -Dspring.profiles.active=prod $1 CommentService.jar > comment.log $1 2>&1 &
#### normal test model
#nohup java -jar -Dspring.profiles.active=test $1 CommentService.jar > comment.log $1 2>&1 &
#### normal dev model
nohup java -jar -Dspring.profiles.active=dev $1 CommentService.jar > comment.log $1 2>&1 &
tail -100f comment.log
CommentService/src/main/java/com/java110/comment/dao/ICommentServiceDao.java
@@ -15,320 +15,126 @@
 */
public interface ICommentServiceDao {
    /**
     * 保存 商品信息
     * @param businessShopInfo 商品信息 封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopInfo(Map businessShopInfo) throws DAOException;
    /**
     * 保存商品属性
     * @param businessShopAttr 商品属性信息封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopAttr(Map businessShopAttr) throws DAOException;
    /**
     * 保存 商品属性参数
     * @param businessShopAttrParam 商品属性参数信息封装
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopAttrParam(Map businessShopAttrParam) throws DAOException;
    /**
     * 保存商品照片信息
     * @param businessShopPhoto 商品照片
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopPhoto(Map businessShopPhoto) throws DAOException;
    /**
     * 保存商品证件信息
     * @param businessShopPreferential 商品证件
     * @throws DAOException 操作数据库异常
     */
    public void saveBusinessShopPreferential(Map businessShopPreferential) throws DAOException;
    /**
     * 保存商品 描述 信息
     * @param businessShopDesc 商品 描述信息
     * 保存评论
     * @param comment 评论
     * @throws DAOException
     */
    public void saveBusinessShopDesc(Map businessShopDesc) throws DAOException;
    /**
     * 保存商品目录信息 add by wuxw 2018-09-08
     * @param businessShopCatalog 商品目录
     * @throws DAOException
     */
    public void saveBusinessShopCatalog(Map businessShopCatalog) throws DAOException;
    public void saveCommentInstance(Map comment) throws DAOException;
    /**
     * 查询商品信息(business过程)
     * 根据bId 查询商品信息
     * @param info bId 信息
     * @return 商品信息
     * 保存评论
     * @param subComment 评论内容
     * @throws DAOException
     */
    public Map getBusinessShopInfo(Map info) throws DAOException;
    /**
     * 查询商品属性信息(business过程)
     * @param info bId 信息
     * @return 商品属性
     * @throws DAOException
     */
    public List<Map> getBusinessShopAttrs(Map info) throws DAOException;
    /**
     * 查询商品属性参数信息(business过程)
     * @param info bId 信息
     * @return 商品属性参数
     * @throws DAOException
     */
    public List<Map> getBusinessShopAttrParams(Map info) throws DAOException;
    /**
     * 查询商品照片
     * @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;
    /**
     * 查询商品目录信息
     * @param info bId 信息
     * @return 商品目录
     * @throws DAOException
     */
    public Map getBusinessShopCatalog(Map info) throws DAOException;
    /**
     * 保存 商品信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopInfoInstance(Map info) throws DAOException;
    /**
     * 保存 商品属性信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopAttrsInstance(Map info) throws DAOException;
    /**
     * 保存 商户属性参数 business 数据到 Instance 中
     * @param info
     * @throws DAOException
     */
    public void saveShopAttrParamsInstance(Map info) throws DAOException;
    /**
     * 保存 商品照片信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopPhotoInstance(Map info) throws DAOException;
    /**
     * 保存 商品证件信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopPreferentialInstance(Map info) throws DAOException;
    /**
     * 保存 商品描述信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopDescInstance(Map info) throws DAOException;
    /**
     * 保存 商品目录信息 Business数据到 Instance中
     * @param info
     * @throws DAOException
     */
    public void saveShopCatalogInstance(Map info) throws DAOException;
    /**
     * 保存购买记录
     * @param businessBuyShop
     * @throws DAOException
     */
    public void saveBuyShopInstance(Map businessBuyShop) throws DAOException;
    public void saveSubCommentInstance(Map subComment) throws DAOException;
    /**
     * 保存商品购买记录属性
     * @param businessBuyShopAttr
     * @param subCommentAttr
     * @throws DAOException
     */
    public void saveBuyShopAttrInstance(Map businessBuyShopAttr) throws DAOException;
    public void saveSubCommentAttrInstance(Map subCommentAttr) throws DAOException;
    /**
     * 查询商品信息(instance过程)
     * 根据bId 查询商品信息
     * @param info bId 信息
     * @return 商品信息
     * 保存评论分数属性
     * @param subCommentScore
     * @throws DAOException
     */
    public Map getShopInfo(Map info) throws DAOException;
    public void saveCommentScoreInstance(Map subCommentScore) throws DAOException;
    /**
     * 保存 评论照片
     * @param subCommentPhoto
     * @throws DAOException
     */
    public void saveSubCommentPhotoInstance(Map subCommentPhoto) throws DAOException;
    /**
     * 查询商品属性信息(instance过程)
     * @param info bId 信息
     * @return 商品属性
     * @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;
    /**
     * 查询商品目录信息(instance 过程)
     * @param info bId 信息
     * @return 商品目录
     * @throws DAOException
     */
    public Map getShopCatalog(Map info) throws DAOException;
    /**
     * 商品购买查询(instance)
     * 评论查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public Map getBuyShop(Map info) throws DAOException;
    public Map getComment(Map info) throws DAOException;
    /**
     * 商品属性查询(instance)
     * 评论内容查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public List<Map> getBuyShopAttrs(Map info) throws DAOException;
    public Map getSubComment(Map info) throws DAOException;
    /**
     * 修改商品信息
     * @param info 修改信息
     * 评论内容查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public void updateShopInfoInstance(Map info) throws DAOException;
    public List<Map> getSubComments(Map info) throws DAOException;
    /**
     * 评论属性查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public List<Map> getSubCommentAttrs(Map info) throws DAOException;
    /**
     * 评论照片查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public List<Map> getSubCommentPhotos(Map info) throws DAOException;
    /**
     * 评论分数查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    public List<Map> getCommentScores(Map info) throws DAOException;
    /**
     * 修改商品属性信息
     * 修改评论信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopAttrInstance(Map info) throws DAOException;
    public void updateCommentInstance(Map info) throws DAOException;
    /**
     * 修改商品属性参数信息
     * 修改评论内容信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopAttrParamInstance(Map info) throws DAOException;
    public void updateSubCommentInstance(Map info) throws DAOException;
    /**
     * 修改商品照片信息
     * 修改评论属性信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopPhotoInstance(Map info) throws DAOException;
    public void updateSubCommentAttrInstance(Map info) throws DAOException;
    /**
     * 修改商品优惠信息
     * 修改评论照片信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopPreferentialInstance(Map info) throws DAOException;
    public void updateSubCommentPhotoInstance(Map info) throws DAOException;
    /**
     * 修改商品描述信息
     * 修改评论照片信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopDescInstance(Map info) throws DAOException;
    /**
     * 修改商品目录信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateShopCatalogInstance(Map info) throws DAOException;
    /**
     * 修改商品购买信息
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateBuyShopInstance(Map info) throws DAOException;
    /**
     * 修改商品购买属性信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    public void updateBuyShopAttrInstance(Map info) throws DAOException;
    public void updateCommentScoreInstance(Map info) throws DAOException;
}
CommentService/src/main/java/com/java110/comment/dao/impl/CommentServiceDaoImpl.java
@@ -17,404 +17,120 @@
 * 商品服务 与数据库交互
 * Created by wuxw on 2017/4/5.
 */
@Service("shopServiceDaoImpl")
@Service("commentServiceDaoImpl")
//@Transactional
public class CommentServiceDaoImpl extends BaseServiceDao implements ICommentServiceDao {
    private final static Logger logger = LoggerFactory.getLogger(CommentServiceDaoImpl.class);
    /**
     * 商品信息封装
     * @param businessShopInfo 商品信息 封装
     * 保存评论信息
     * @param comment
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopInfo(Map businessShopInfo) throws DAOException {
        businessShopInfo.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商品信息 入参 businessShopInfo : {}",businessShopInfo);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopInfo",businessShopInfo);
    public void saveCommentInstance(Map comment) throws DAOException {
        comment.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存评论记录信息 入参 comment : {}",comment);
        int saveFlag = sqlSessionTemplate.insert("commentServiceDaoImpl.saveCommentInstance",comment);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品数据失败:"+ JSONObject.toJSONString(businessShopInfo));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存评论数据失败:"+ JSONObject.toJSONString(comment));
        }
    }
    /**
     * 商品属性信息分装
     * @param businessShopAttr 商品属性信息封装
     * 保存评论信息
     * @param subComment
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopAttr(Map businessShopAttr) throws DAOException {
        businessShopAttr.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商品属性信息 入参 businessShopAttr : {}",businessShopAttr);
    public void saveSubCommentInstance(Map subComment) throws DAOException {
        subComment.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存评论记录信息 入参 subComment : {}",subComment);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopAttr",businessShopAttr);
        int saveFlag = sqlSessionTemplate.insert("commentServiceDaoImpl.saveSubCommentInstance",subComment);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性数据失败:"+ JSONObject.toJSONString(businessShopAttr));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存评论数据失败:"+ JSONObject.toJSONString(subComment));
        }
    }
    /**
     * 商品属性参数保存
     * @param businessShopAttrParam 商品属性参数信息封装
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopAttrParam(Map businessShopAttrParam) throws DAOException {
        businessShopAttrParam.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存商品属性参数信息 入参 businessShopAttr : {}",businessShopAttrParam);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopAttrParam",businessShopAttrParam);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性参数数据失败:"+ JSONObject.toJSONString(businessShopAttrParam));
        }
    }
    /**
     * 保存商品照片信息
     * @param businessShopPhoto 商品照片
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopPhoto(Map businessShopPhoto) throws DAOException {
        businessShopPhoto.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品照片信息 入参 businessShopPhoto : {}",businessShopPhoto);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopPhoto",businessShopPhoto);
        if(saveFlag < 1){
            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 businessShopCatalog 商品目录
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopCatalog(Map businessShopCatalog) throws DAOException {
        businessShopCatalog.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品目录信息 入参 businessShopCatalog : {}",businessShopCatalog);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopCatalog",businessShopCatalog);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录数据失败:"+ JSONObject.toJSONString(businessShopCatalog));
        }
    }
    /**
     * 查询商品信息
     * @param info bId 信息
     * @return 商品信息
     * @throws DAOException
     */
    @Override
    public Map getBusinessShopInfo(Map info) throws DAOException {
        logger.debug("查询商品信息 入参 info : {}",info);
        List<Map> businessShopInfos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopInfo",info);
        if(businessShopInfos == null){
            return null;
        }
        if(businessShopInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopInfos,"+ JSONObject.toJSONString(info));
        }
        return businessShopInfos.get(0);
    }
    /**
     * 查询商品属性
     * @param info bId 信息
     * @return 商品属性
     * @throws DAOException
     */
    @Override
    public List<Map> getBusinessShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品属性信息 入参 info : {}",info);
        List<Map> businessShopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopAttrs",info);
        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> getBusinessShopPhoto(Map info) throws DAOException {
        logger.debug("查询商品照片信息 入参 info : {}",info);
        List<Map> businessShopPhotos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopPhoto",info);
        return businessShopPhotos;
    }
    /**
     * 查询商品优惠
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBusinessShopPreferential(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",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 businessShopPreferentiales.get(0);
    }
    /**
     * 查询商品描述
     * @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);
    }
    /**
     * 查询商品目录
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBusinessShopCatalog(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> businessShopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopCatalog",info);
        if(businessShopCatalogs == null){
            return null;
        }
        if(businessShopCatalogs.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopCatalogs,"+ JSONObject.toJSONString(info));
        }
        return businessShopCatalogs.get(0);
    }
    /**
     * 保存商品信息 到 instance
     * @param info   bId 信息
     * @throws DAOException
     */
    @Override
    public void saveShopInfoInstance(Map info) throws DAOException {
        logger.debug("保存商品信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveShopAttrsInstance(Map info) throws DAOException {
        logger.debug("保存商品属性信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopAttrsInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 保存 商品属性 参数 至 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));
        }
    }
    @Override
    public void saveShopCatalogInstance(Map info) throws DAOException {
        logger.debug("保存商品目录信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopCatalogInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 保存购买记录
     * @param businessBuyShop
     * @throws DAOException
     */
    @Override
    public void saveBuyShopInstance(Map businessBuyShop) throws DAOException {
        businessBuyShop.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品购买记录信息 入参 businessBuyShop : {}",businessBuyShop);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBuyShopInstance",businessBuyShop);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品购买记录数据失败:"+ JSONObject.toJSONString(businessBuyShop));
        }
    }
    /**
     * 购买商品属性保存
     * @param businessBuyShopAttr
     * @param subCommentAttr
     * @throws DAOException
     */
    @Override
    public void saveBuyShopAttrInstance(Map businessBuyShopAttr) throws DAOException {
        businessBuyShopAttr.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品购买记录属性信息 入参 businessBuyShopAttr : {}",businessBuyShopAttr);
    public void saveSubCommentAttrInstance(Map subCommentAttr) throws DAOException {
        subCommentAttr.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存评论属性信息 入参 subCommentAttr : {}",subCommentAttr);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBuyShopAttrInstance",businessBuyShopAttr);
        int saveFlag = sqlSessionTemplate.insert("commentServiceDaoImpl.saveSubCommentAttrInstance",subCommentAttr);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品购买记录属性数据失败:"+ JSONObject.toJSONString(businessBuyShopAttr));
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存评论属性数据失败:"+ JSONObject.toJSONString(subCommentAttr));
        }
    }
    /**
     * 查询商品信息(instance)
     * 评论查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getShopInfo(Map info) throws DAOException {
        logger.debug("查询商品信息 入参 info : {}",info);
    public Map getComment(Map info) throws DAOException {
        logger.debug("查询评论信息 入参 info : {}",info);
        List<Map> businessShopInfos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopInfo",info);
        if(businessShopInfos == null || businessShopInfos.size() == 0){
        List<Map> comments = sqlSessionTemplate.selectList("commentServiceDaoImpl.getComment",info);
        if(comments == null || comments.size() == 0){
            return null;
        }
        if(businessShopInfos.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopInfo,"+ JSONObject.toJSONString(info));
        if(comments.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
        }
        return comments.get(0);
    }
        return businessShopInfos.get(0);
    /**
     * 评论内容查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getSubComment(Map info) throws DAOException {
        logger.debug("查询评论信息 入参 info : {}",info);
        List<Map> subComments = sqlSessionTemplate.selectList("commentServiceDaoImpl.getSubComment",info);
        if(subComments == null || subComments.size() == 0){
            return null;
        }
        return subComments.get(0);
    }
    /**
     * 评论内容查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getSubComments(Map info) throws DAOException {
        logger.debug("查询评论信息 入参 info : {}",info);
        List<Map> subComments = sqlSessionTemplate.selectList("commentServiceDaoImpl.getSubComment",info);
        return subComments;
    }
    /**
@@ -424,264 +140,42 @@
     * @throws DAOException
     */
    @Override
    public List<Map> getShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品属性信息 入参 info : {}",info);
    public List<Map> getSubCommentAttrs(Map info) throws DAOException {
        logger.debug("查询评论属性信息 入参 info : {}",info);
        List<Map> shopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopAttrs",info);
        List<Map> subCommentAttrs = sqlSessionTemplate.selectList("commentServiceDaoImpl.getSubCommentAttrs",info);
        return shopAttrs;
        return subCommentAttrs;
    }
    /**
     * 商品属性参数查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getShopAttrParams(Map info) throws DAOException {
        logger.debug("查询商品属性参数信息 入参 info : {}",info);
        List<Map> shopAttrParams = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopAttrParams",info);
        return shopAttrParams;
    }
    /**
     * 商品照片查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getShopPhoto(Map info) throws DAOException {
        logger.debug("查询商品照片信息 入参 info : {}",info);
        List<Map> shopPhotos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopPhoto",info);
        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);
    }
    /**
     * 商品目录查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getShopCatalog(Map info) throws DAOException {
        logger.debug("查询商品目录信息 入参 info : {}",info);
        List<Map> shopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopCatalog",info);
        if(shopCatalogs == null || shopCatalogs.size() == 0){
            return null;
        }
        if(shopCatalogs.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
        }
        return shopCatalogs.get(0);
    }
    /**
     * 商品描述查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBuyShop(Map info) throws DAOException {
        logger.debug("查询商品购买信息 入参 info : {}",info);
        List<Map> getBuyShops = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBuyShop",info);
        if(getBuyShops == null || getBuyShops.size() == 0){
            return null;
        }
        if(getBuyShops.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
        }
        return getBuyShops.get(0);
    }
    /**
     * 商品属性查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getBuyShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品购买属性信息 入参 info : {}",info);
        List<Map> buyShopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBuyShopAttrs",info);
        return buyShopAttrs;
    }
    /**
     * 修改商品信息
     * 修改评论信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopInfoInstance(Map info) throws DAOException {
        logger.debug("修改商品信息Instance 入参 info : {}",info);
    public void updateCommentInstance(Map info) throws DAOException {
        logger.debug("修改评论信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopInfoInstance",info);
        int saveFlag = sqlSessionTemplate.update("commentServiceDaoImpl.updateCommentInstance",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 updateShopAttrInstance(Map info) throws DAOException {
        logger.debug("修改商品属性信息Instance 入参 info : {}",info);
    public void updateSubCommentInstance(Map info) throws DAOException {
        logger.debug("修改评论信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopAttrInstance",info);
        int saveFlag = sqlSessionTemplate.update("commentServiceDaoImpl.updateSubCommentInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品属性参数(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopAttrParamInstance(Map info) throws DAOException {
        logger.debug("修改商品属性参数信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopAttrParamInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品属性参数信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改 商品照片信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopPhotoInstance(Map info) throws DAOException {
        logger.debug("修改商品照片信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopPhotoInstance",info);
        if(saveFlag < 1){
            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));
        }
    }
    /**
     * 修改商品描述信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopCatalogInstance(Map info) throws DAOException {
        logger.debug("修改商品目录信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopCatalogInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品购买信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateBuyShopInstance(Map info) throws DAOException {
        logger.debug("修改商品购买信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateBuyShopInstance",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));
        }
    }
@@ -691,13 +185,77 @@
     * @throws DAOException
     */
    @Override
    public void updateBuyShopAttrInstance(Map info) throws DAOException {
        logger.debug("修改商品购买属性信息Instance 入参 info : {}",info);
    public void updateSubCommentAttrInstance(Map info) throws DAOException {
        logger.debug("修改评价属性信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateBuyShopAttrInstance",info);
        int saveFlag = sqlSessionTemplate.update("commentServiceDaoImpl.updateSubCommentAttrInstance",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 saveSubCommentPhotoInstance(Map subCommentPhoto) throws DAOException {
        subCommentPhoto.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存评论照片信息 入参 subCommentPhoto : {}",subCommentPhoto);
        int saveFlag = sqlSessionTemplate.insert("commentServiceDaoImpl.saveSubCommentPhotoInstance",subCommentPhoto);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存评论照片数据失败:"+ JSONObject.toJSONString(subCommentPhoto));
        }
    }
    @Override
    public List<Map> getSubCommentPhotos(Map info) throws DAOException {
        logger.debug("查询评论照片信息 入参 info : {}",info);
        List<Map> subCommentPhotos = sqlSessionTemplate.selectList("commentServiceDaoImpl.getSubCommentPhotos",info);
        return subCommentPhotos;
    }
    @Override
    public void updateSubCommentPhotoInstance(Map info) throws DAOException {
        logger.debug("修改评价照片信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("commentServiceDaoImpl.updateSubCommentPhotoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改评价照片信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveCommentScoreInstance(Map commentScore) throws DAOException {
        commentScore.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存评论分数信息 入参 subCommentScore : {}",commentScore);
        int saveFlag = sqlSessionTemplate.insert("commentServiceDaoImpl.saveCommentScoreInstance",commentScore);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存评论分数数据失败:"+ JSONObject.toJSONString(commentScore));
        }
    }
    @Override
    public List<Map> getCommentScores(Map info) throws DAOException {
        logger.debug("查询评论分数信息 入参 info : {}",info);
        List<Map> subCommentScores = sqlSessionTemplate.selectList("commentServiceDaoImpl.getCommentScores",info);
        return subCommentScores;
    }
    @Override
    public void updateCommentScoreInstance(Map info) throws DAOException {
        logger.debug("修改评价分数信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("commentServiceDaoImpl.updateCommentScoreInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改评价分数信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
}
CommentService/src/main/java/com/java110/comment/listener/AbstractCommentBusinessServiceDataFlowListener.java
@@ -26,275 +26,4 @@
     */
    public abstract ICommentServiceDao getCommentServiceDaoImpl();
    /**
     * 刷新 businessShopInfo 数据
     * 主要将 数据库 中字段和 接口传递字段建立关系
     * @param businessShopInfo
     */
    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);
    }
    /**
        刷新 businessShopAttr 数据
     * 主要将 数据库 中字段和 接口传递字段建立关系
     * @param businessShopAttr
     * @param 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);
    }
    /**
     * 刷新 businessShopAttrParam 数据
     * @param businessShopAttrParam
     * @param 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);
    }
    /**
     * 刷新 businessShopPhoto 数据
     * @param businessShopPhoto
     * @param 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);
    }
    /**
     * 刷新 businessShopCatalog 数据
     * @param businessShopCatalog
     * @param statusCd
     */
    protected void flushBusinessShopCatalog(Map businessShopCatalog ,String statusCd){
        businessShopCatalog.put("catalogId",businessShopCatalog.get("catalog_id"));
        businessShopCatalog.put("storeId",businessShopCatalog.get("store_id"));
        businessShopCatalog.put("parentCatalogId",businessShopCatalog.get("parent_catalog_id"));
        businessShopCatalog.put("newBId",businessShopCatalog.get("b_id"));
        businessShopCatalog.put("statusCd",statusCd);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param businessShop 商户信息
     */
    protected void autoSaveDelBusinessShop(Business business, JSONObject businessShop){
//自动插入DEL
        Map info = new HashMap();
        info.put("shopId",businessShop.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map currentShopInfo = getCommentServiceDaoImpl().getShopInfo(info);
        if(currentShopInfo == null || currentShopInfo.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        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);
        getCommentServiceDaoImpl().saveBusinessShopInfo(currentShopInfo);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business 当前业务
     * @param shopAttr 商户属性
     */
    protected void autoSaveDelBusinessShopAttr(Business business, JSONObject shopAttr){
        Map info = new HashMap();
        info.put("attrId",shopAttr.getString("attrId"));
        info.put("shopId",shopAttr.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentShopAttrs = getCommentServiceDaoImpl().getShopAttrs(info);
        if(currentShopAttrs == null || currentShopAttrs.size() != 1){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        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);
        getCommentServiceDaoImpl().saveBusinessShopAttr(currentShopAttr);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business 当前业务
     * @param shopAttrParam 商品属性参数
     */
    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 = getCommentServiceDaoImpl().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);
        getCommentServiceDaoImpl().saveBusinessShopAttrParam(currentShopAttrParam);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business
     * @param businessShopPhoto 商户照片
     */
    protected void autoSaveDelBusinessShopPhoto(Business business,JSONObject businessShopPhoto){
       Map info = new HashMap();
        info.put("shopPhotoId",businessShopPhoto.getString("shopPhotoId"));
        info.put("shopId",businessShopPhoto.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        List<Map> currentShopPhotos = getCommentServiceDaoImpl().getShopPhoto(info);
        if(currentShopPhotos == null || currentShopPhotos.size() != 1){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        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);
        getCommentServiceDaoImpl().saveBusinessShopPhoto(currentShopPhoto);
    }
    /**
     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
     * @param business
     * @param businessShopPreferentials 商品优惠
     */
    protected void autoSaveDelBusinessShopPreferential(Business business,JSONObject businessShopPreferentials){
        Map info = new HashMap();
        info.put("shopPreferentialId",businessShopPreferentials.getString("shopPreferentialId"));
        info.put("shopId",businessShopPreferentials.getString("shopId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map currentShopPreferential = getCommentServiceDaoImpl().getShopPreferential(info);
        if(currentShopPreferential == null || currentShopPreferential.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        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);
        getCommentServiceDaoImpl().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 = getCommentServiceDaoImpl().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);
        getCommentServiceDaoImpl().saveBusinessShopDesc(currentShopDesc);
    }
    /**
     * 商品目录 自动刷 DEL数据
     * @param business
     * @param businessShopCalalog
     */
    protected void autoSaveDelBusinessShopCatalog(Business business,JSONObject businessShopCalalog){
        Map info = new HashMap();
        info.put("catalogId",businessShopCalalog.getString("catalogId"));
        info.put("storeId",businessShopCalalog.getString("storeId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map currentShopCatalog = getCommentServiceDaoImpl().getShopCatalog(info);
        if(currentShopCatalog == null || currentShopCatalog.isEmpty()){
            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
        }
        currentShopCatalog.put("bId",business.getbId());
        currentShopCatalog.put("catalogId",currentShopCatalog.get("catalog_id"));
        currentShopCatalog.put("storeId",currentShopCatalog.get("store_id"));
        currentShopCatalog.put("parentCatalogId",currentShopCatalog.get("parent_catalog_id"));
        currentShopCatalog.put("operate",StatusConstant.OPERATE_DEL);
        getCommentServiceDaoImpl().saveBusinessShopCatalog(currentShopCatalog);
    }
}
CommentService/src/main/java/com/java110/comment/listener/DeleteCommentOrSubCommentListener.java
New file
@@ -0,0 +1,233 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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 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("deleteCommentOrSubCommentListener")
@Transactional
public class DeleteCommentOrSubCommentListener extends AbstractCommentBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(DeleteCommentOrSubCommentListener.class);
    @Autowired
    ICommentServiceDao commentServiceDaoImpl;
    @Override
    public int getOrder() {
        return 1;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_DELETE_SHOP_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("comment")){
            JSONObject comment = data.getJSONObject("comment");
            doComment(business,comment);
            dataFlowContext.addParamOut("commentId",comment.getString("commentId"));
            return ;
        }
        if(data.containsKey("subComment")){
            JSONObject subComment = data.getJSONObject("subComment");
            doSubComment(business,subComment);
            dataFlowContext.addParamOut("subCommentId",subComment.getString("subCommentId"));
        }
    }
    /**
     * 删除 instance数据
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        // nothing to do
    }
    /**
     * 撤单
     * 从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.STATUS_CD_VALID);
        //商户信息
        Map comment = commentServiceDaoImpl.getComment(info);
        if(comment != null && !comment.isEmpty()){
            commentServiceDaoImpl.updateCommentInstance(delInfo);
        }
        //商户信息
        List<Map> subComments = commentServiceDaoImpl.getSubComments(info);
        if(subComments != null && subComments.size() > 0){
            commentServiceDaoImpl.updateSubCommentInstance(delInfo);
        }
        //商户信息
        List<Map> commentAttrs = commentServiceDaoImpl.getSubCommentAttrs(info);
        if(commentAttrs != null && commentAttrs.size() > 0){
            commentServiceDaoImpl.updateSubCommentAttrInstance(delInfo);
        }
        //商户信息
        List<Map> commentPhotos = commentServiceDaoImpl.getSubCommentPhotos(info);
        if(commentPhotos != null && commentPhotos.size() > 0){
            commentServiceDaoImpl.updateSubCommentPhotoInstance(delInfo);
        }
        List<Map> commentScores = commentServiceDaoImpl.getCommentScores(info);
        if(commentScores != null && commentScores.size() > 0){
            commentServiceDaoImpl.updateCommentScoreInstance(delInfo);
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param comment 商户节点
     */
    private void doComment(Business business,JSONObject comment){
        Assert.jsonObjectHaveKey(comment,"commentId","comment 节点下没有包含 commentId 节点");
        //作废 comment
        Map info = new HashMap();
        info.put("commentId",comment.getString("commentId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        Map commentMap = commentServiceDaoImpl.getComment(info);
        Assert.notEmpty(commentMap,"没有找到需要作废的评论,入参错误:" + comment);
        delInfo.put("commentId",comment.getString("commentId"));
        commentServiceDaoImpl.updateCommentInstance(delInfo);
        // 作废 comment_score
        List<Map> commentScores = commentServiceDaoImpl.getCommentScores(info);
        if(commentScores != null && commentScores.size()>0){
            commentServiceDaoImpl.updateCommentScoreInstance(delInfo);
        }
        // 作废 sub_comment
        List<Map> subComments = commentServiceDaoImpl.getSubComments(info);
        if(subComments == null || subComments.size()>0){
            return ;
        }
        commentServiceDaoImpl.updateSubCommentInstance(delInfo);
        for(Map subComment : subComments){
            // 作废 sub_comment_attr
            doDeleteCommentAttrAndCommentPhoto(info,delInfo,subComment);
        }
    }
    /**
     * 处理 businessShop 节点
     * @param business 总的数据节点
     * @param subComment 商户节点
     */
    private void doSubComment(Business business,JSONObject subComment){
        Assert.jsonObjectHaveKey(subComment,"subCommentId","subComment 节点下没有包含 subCommentId 节点");
        //作废 comment
        Map info = new HashMap();
        info.put("subCommentId",subComment.getString("subCommentId"));
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map delInfo = new HashMap();
        delInfo.put("bId",business.getbId());
        delInfo.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        // 作废 sub_comment
        Map subCommentMap = commentServiceDaoImpl.getSubComment(info);
        Assert.notEmpty(subCommentMap,"没有找到需要作废的评论,入参错误:" + subComment);
        commentServiceDaoImpl.updateSubCommentInstance(delInfo);
        doDeleteCommentAttrAndCommentPhoto(info,delInfo,subComment);
    }
    private void doDeleteCommentAttrAndCommentPhoto(Map info,Map delInfo,Map subComment){
        // 作废 sub_comment_attr
        info.put("subCommentId",subComment.get("sub_comment_id"));
        delInfo.put("subCommentId",subComment.get("sub_comment_id"));
        List<Map> commentAttrs = commentServiceDaoImpl.getSubCommentAttrs(info);
        if(commentAttrs != null && commentAttrs.size() >0){
            commentServiceDaoImpl.updateSubCommentAttrInstance(delInfo);
        }
        // 作废 sub_comment_photo
        List<Map> commentPhotos = commentServiceDaoImpl.getSubCommentPhotos(info);
        if(commentPhotos != null && commentPhotos.size() >0){
            commentServiceDaoImpl.updateSubCommentPhotoInstance(delInfo);
        }
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return commentServiceDaoImpl;
    }
    public void setCommentServiceDaoImpl(ICommentServiceDao commentServiceDaoImpl) {
        this.commentServiceDaoImpl = commentServiceDaoImpl;
    }
}
CommentService/src/main/java/com/java110/comment/listener/FlushAboutCommentIdListener.java
New file
@@ -0,0 +1,153 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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;
/**
 * 如果commentId填写的值为-1,则重新生成
 * Created by wuxw on 2018/7/12.
 */
@Java110Listener(name="flushAboutCommentIdListener")
public class FlushAboutCommentIdListener extends AbstractCommentBusinessServiceDataFlowListener {
    @Override
    public int getOrder() {
        return 1;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_COMMENT_INFO;
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return null;
    }
    @Override
    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
        JSONObject data = business.getDatas();
        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
        //刷新commentId
        if(data.containsKey("comment")){
            JSONObject comment = data.getJSONObject("comment");
            if(!comment.containsKey("commentId") || comment.getString("commentId").startsWith("-")){
                flushCommentId(data);
            }
        }
        //刷新 subCommentId
        if(data.containsKey("subComment")){
            JSONObject subComment = data.getJSONObject("subComment");
            if(!subComment.containsKey("subCommentId") || subComment.getString("subCommentId").startsWith("-")){
                flushSubCommentId(data);
            }
        }
        //刷新 attrId
        if(data.containsKey("subCommentAttr")){
            JSONArray subCommentAttrs = data.getJSONArray("subCommentAttr");
            for (int subCommentAttrIndex = 0;subCommentAttrIndex < subCommentAttrs.size();subCommentAttrIndex ++){
                JSONObject subCommentAttr = subCommentAttrs.getJSONObject(subCommentAttrIndex);
                if(subCommentAttr.containsKey("attrId") && !subCommentAttr.getString("attrId").startsWith("-")){
                    continue;
                }
                subCommentAttr.put("attrId",GenerateCodeFactory.getSubCommentAttrId());
            }
        }
        //刷新 commentPhotoId
        if(data.containsKey("subCommentPhoto")){
            JSONArray subCommentPhotos = data.getJSONArray("subCommentPhoto");
            for (int subCommentPhotoIndex = 0;subCommentPhotoIndex < subCommentPhotos.size();subCommentPhotoIndex ++){
                JSONObject subCommentPhoto = subCommentPhotos.getJSONObject(subCommentPhotoIndex);
                if(subCommentPhoto.containsKey("commentPhotoId") && !subCommentPhoto.getString("commentPhotoId").startsWith("-")){
                    continue;
                }
                subCommentPhoto.put("commentPhotoId",GenerateCodeFactory.getCommentPhotoId());
            }
        }
        //刷新 commentPhotoId
        if(data.containsKey("commentScore")){
            JSONArray commentScores = data.getJSONArray("commentScore");
            for (int commentScoreIndex = 0;commentScoreIndex < commentScores.size();commentScoreIndex ++){
                JSONObject commentScore = commentScores.getJSONObject(commentScoreIndex);
                if(commentScore.containsKey("commentScoreId") && !commentScore.getString("commentScoreId").startsWith("-")){
                    continue;
                }
                commentScore.put("commentScoreId",GenerateCodeFactory.getCommentScoreId());
            }
        }
    }
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        // nothing to do
    }
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        // nothing to do
    }
    /**
     * 刷新 commentID
     * @param data
     */
    private void flushCommentId(JSONObject data) {
        String commentId = GenerateCodeFactory.getCommentId();
        JSONObject comment = data.getJSONObject("comment");
        comment.put("commentId",commentId);
        //刷商品属性
        if(data.containsKey("subComment")) {
            JSONObject subCommentObj = data.getJSONObject("subComment");
            subCommentObj.put("commentId",commentId);
        }
        //刷 是商品照片 的 shopId
        if(data.containsKey("commentScore")) {
            JSONArray commentScores = data.getJSONArray("commentScore");
            for(int commentScoreIndex = 0;commentScoreIndex < commentScores.size();commentScoreIndex++) {
                JSONObject commentScore = commentScores.getJSONObject(commentScoreIndex);
                commentScore.put("commentId", commentId);
            }
        }
    }
    /**
     * 刷新 subCommentId
     *
     * @param data 数据节点
     */
    private void flushSubCommentId(JSONObject data){
        String subCommentId = GenerateCodeFactory.getSubCommentId();
        JSONObject subComment = data.getJSONObject("subComment");
        subComment.put("subCommentId",subCommentId);
        //刷评论属性
        if(data.containsKey("subCommentAttr")) {
            JSONArray subCommentAttrs = data.getJSONArray("subCommentAttr");
            for(int subCommentAttrIndex = 0;subCommentAttrIndex < subCommentAttrs.size();subCommentAttrIndex++) {
                JSONObject subCommentAttr = subCommentAttrs.getJSONObject(subCommentAttrIndex);
                subCommentAttr.put("subCommentId", subCommentId);
            }
        }
        //刷照片
        if(data.containsKey("subCommentPhoto")) {
            JSONArray subCommentPhotos = data.getJSONArray("subCommentPhoto");
            for(int subCommentPhotoIndex = 0;subCommentPhotoIndex < subCommentPhotos.size();subCommentPhotoIndex++) {
                JSONObject subCommentPhoto = subCommentPhotos.getJSONObject(subCommentPhotoIndex);
                subCommentPhoto.put("subCommentId", subCommentId);
            }
        }
    }
}
CommentService/src/main/java/com/java110/comment/listener/SaveCommentAndSubCommentListener.java
New file
@@ -0,0 +1,161 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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 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;
/**
 * 保存 评论 侦听
 * 处理 comment 和 subComment 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveCommentAndSubCommentListener")
@Transactional
public class SaveCommentAndSubCommentListener extends AbstractCommentBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveCommentAndSubCommentListener.class);
    @Autowired
    ICommentServiceDao commentServiceDaoImpl;
    @Override
    public int getOrder() {
        return 2;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_COMMENT_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("comment")){
            JSONObject comment = data.getJSONObject("comment");
            doComment(business,comment);
            dataFlowContext.addParamOut("commentId",comment.getString("commentId"));
        }
        if(data.containsKey("subComment")){
            JSONObject subComment = data.getJSONObject("subComment");
            doSubComment(business,subComment);
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //todo buy 没有business过程,所以这里不做处理
    }
    /**
     * 撤单
     * @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 comment = commentServiceDaoImpl.getComment(info);
        if(comment != null && !comment.isEmpty()){
            paramIn.put("commentId",comment.get("comment_id").toString());
            commentServiceDaoImpl.updateCommentInstance(paramIn);
            dataFlowContext.addParamOut("commentId",comment.get("comment_id"));
        }
        //评论内容
        Map subComment = commentServiceDaoImpl.getSubComment(info);
        if(subComment != null && !subComment.isEmpty()){
            paramIn.put("subCommentId",subComment.get("sub_comment_id").toString());
            commentServiceDaoImpl.updateSubCommentInstance(paramIn);
            dataFlowContext.addParamOut("subCommentId",subComment.get("sub_comment_id"));
        }
    }
    /**
     * 处理 comment 节点
     * @param business 总的数据节点
     * @param comment 评论信息
     */
    private void doComment(Business business,JSONObject comment){
        Assert.jsonObjectHaveKey(comment,"commentId","comment 节点下没有包含 commentId 节点");
        Assert.jsonObjectHaveKey(comment,"outId","comment 节点下没有包含 outId 节点");
        Assert.jsonObjectHaveKey(comment,"userId","comment 节点下没有包含 userId 节点");
        comment.put("bId",business.getbId());
        //保存商户信息
        commentServiceDaoImpl.saveCommentInstance(comment);
    }
    /**
     * 处理 subComment 节点
     * @param business 总的数据节点
     * @param subComment 评论信息
     */
    private void doSubComment(Business business,JSONObject subComment){
        Assert.jsonObjectHaveKey(subComment,"commentId","subComment 节点下没有包含 commentId 节点");
        Assert.jsonObjectHaveKey(subComment,"subCommentTypeCd","subComment 节点下没有包含 subCommentTypeCd 节点");
        Assert.jsonObjectHaveKey(subComment,"commentContext","subComment 节点下没有包含 commentContext 节点");
        subComment.put("bId",business.getbId());
        //保存商户信息
        commentServiceDaoImpl.saveSubCommentInstance(subComment);
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return commentServiceDaoImpl;
    }
    public void setCommentServiceDaoImpl(ICommentServiceDao commentServiceDaoImpl) {
        this.commentServiceDaoImpl = commentServiceDaoImpl;
    }
}
CommentService/src/main/java/com/java110/comment/listener/SaveCommentScoreListener.java
New file
@@ -0,0 +1,124 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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 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;
/**
 * 保存 评论 侦听
 * 处理 comment 和 subComment 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveCommentScoreListener")
@Transactional
public class SaveCommentScoreListener extends AbstractCommentBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveCommentScoreListener.class);
    @Autowired
    ICommentServiceDao commentServiceDaoImpl;
    @Override
    public int getOrder() {
        return 5;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_COMMENT_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("commentScore")){
            JSONArray commentScores = data.getJSONArray("commentScore");
            doCommentScore(business,commentScores);
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //todo buy 没有business过程,所以这里不做处理
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //评论照片
        List<Map> commentScores = commentServiceDaoImpl.getCommentScores(info);
        if(commentScores != null && commentScores.size()>0){
            commentServiceDaoImpl.updateCommentScoreInstance(paramIn);
        }
    }
    /**
     * 处理商品 属性
     * @param business 当前业务
     * @param commentScores 评论分数
     */
    private void doCommentScore(Business business, JSONArray commentScores) {
        for(int commentScoreIndex = 0 ; commentScoreIndex < commentScores.size();commentScoreIndex ++){
            JSONObject commentScore = commentScores.getJSONObject(commentScoreIndex);
            Assert.jsonObjectHaveKey(commentScore,"scoreTypeCd","commentScores 节点下没有包含 scoreTypeCd 节点");
            Assert.jsonObjectHaveKey(commentScore,"value","commentScores 节点下没有包含 value 节点");
            commentScore.put("bId",business.getbId());
            commentServiceDaoImpl.saveCommentScoreInstance(commentScore);
        }
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return commentServiceDaoImpl;
    }
    public void setCommentServiceDaoImpl(ICommentServiceDao commentServiceDaoImpl) {
        this.commentServiceDaoImpl = commentServiceDaoImpl;
    }
}
CommentService/src/main/java/com/java110/comment/listener/SaveSubCommentAttrListener.java
New file
@@ -0,0 +1,123 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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 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;
/**
 * 保存 评论 侦听
 * 处理 comment 和 subComment 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveSubCommentAttrListener")
@Transactional
public class SaveSubCommentAttrListener extends AbstractCommentBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveSubCommentAttrListener.class);
    @Autowired
    ICommentServiceDao commentServiceDaoImpl;
    @Override
    public int getOrder() {
        return 3;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_COMMENT_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("subCommentAttr")){
            JSONArray subCommentAttrs = data.getJSONArray("subCommentAttr");
            doSubCommentAttr(business,subCommentAttrs);
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //todo buy 没有business过程,所以这里不做处理
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //商品属性
        List<Map> subCommentAttrs = commentServiceDaoImpl.getSubCommentAttrs(info);
        if(subCommentAttrs != null && subCommentAttrs.size()>0){
            commentServiceDaoImpl.updateSubCommentAttrInstance(paramIn);
        }
    }
    /**
     * 处理商品 属性
     * @param business 当前业务
     * @param subCommentAttrs 评论属性
     */
    private void doSubCommentAttr(Business business, JSONArray subCommentAttrs) {
        for(int subCommentAttrIndex = 0 ; subCommentAttrIndex < subCommentAttrs.size();subCommentAttrIndex ++){
            JSONObject subCommentAttr = subCommentAttrs.getJSONObject(subCommentAttrIndex);
            Assert.jsonObjectHaveKey(subCommentAttr,"attrId","subCommentAttr 节点下没有包含 attrId 节点");
            subCommentAttr.put("bId",business.getbId());
            commentServiceDaoImpl.saveSubCommentAttrInstance(subCommentAttr);
        }
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return commentServiceDaoImpl;
    }
    public void setCommentServiceDaoImpl(ICommentServiceDao commentServiceDaoImpl) {
        this.commentServiceDaoImpl = commentServiceDaoImpl;
    }
}
CommentService/src/main/java/com/java110/comment/listener/SaveSubCommentPhotoListener.java
New file
@@ -0,0 +1,123 @@
package com.java110.comment.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.comment.dao.ICommentServiceDao;
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 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;
/**
 * 保存 评论 侦听
 * 处理 comment 和 subComment 节点
 * Created by wuxw on 2018/5/18.
 */
@Java110Listener("saveSubCommentPhotoListener")
@Transactional
public class SaveSubCommentPhotoListener extends AbstractCommentBusinessServiceDataFlowListener {
    private final static Logger logger = LoggerFactory.getLogger(SaveSubCommentPhotoListener.class);
    @Autowired
    ICommentServiceDao commentServiceDaoImpl;
    @Override
    public int getOrder() {
        return 4;
    }
    @Override
    public String getServiceCode() {
        return ServiceCodeConstant.SERVICE_CODE_SAVE_COMMENT_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("subCommentPhoto")){
            JSONArray subCommentPhotos = data.getJSONArray("subCommentPhoto");
            doSubCommentPhoto(business,subCommentPhotos);
        }
    }
    /**
     * business 数据转移到 instance
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
        //todo buy 没有business过程,所以这里不做处理
    }
    /**
     * 撤单
     * @param dataFlowContext 数据对象
     * @param business 当前业务对象
     */
    @Override
    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
        String bId = business.getbId();
        Map info = new HashMap();
        info.put("bId",bId);
        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
        Map paramIn = new HashMap();
        paramIn.put("bId",bId);
        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
        //评论照片
        List<Map> subCommentPhotos = commentServiceDaoImpl.getSubCommentPhotos(info);
        if(subCommentPhotos != null && subCommentPhotos.size()>0){
            commentServiceDaoImpl.updateSubCommentPhotoInstance(paramIn);
        }
    }
    /**
     * 处理商品 属性
     * @param business 当前业务
     * @param subCommentPhotos 评论照片
     */
    private void doSubCommentPhoto(Business business, JSONArray subCommentPhotos) {
        for(int subCommentPhotoIndex = 0 ; subCommentPhotoIndex < subCommentPhotos.size();subCommentPhotoIndex ++){
            JSONObject subCommentPhoto = subCommentPhotos.getJSONObject(subCommentPhotoIndex);
            Assert.jsonObjectHaveKey(subCommentPhoto,"commentPhotoTypeCd","subCommentPhoto 节点下没有包含 commentPhotoTypeCd 节点");
            subCommentPhoto.put("bId",business.getbId());
            commentServiceDaoImpl.saveSubCommentAttrInstance(subCommentPhoto);
        }
    }
    @Override
    public ICommentServiceDao getCommentServiceDaoImpl() {
        return commentServiceDaoImpl;
    }
    public void setCommentServiceDaoImpl(ICommentServiceDao commentServiceDaoImpl) {
        this.commentServiceDaoImpl = commentServiceDaoImpl;
    }
}
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java
@@ -138,6 +138,11 @@
     */
    public static final String SERVICE_CODE_DELETE_SHOP_CATALOG = "delete.shop.catalog";
    /**
     * 保存评论
     */
    public static final String SERVICE_CODE_SAVE_COMMENT_INFO = "sava.comment.info";
java110-config/db/CommentService/create_table.sql
@@ -32,7 +32,7 @@
    comment_id varchar(30) not null  comment '评论ID ',
    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
    parent_sub_comment_id varchar(30) not null default '-1' comment '父 子评论ID 如果不是回复 写成-1',
    sub_commnet_type_cd varchar(2) not null default 'C' comment '评论类型 C 评论 R 回复 A 追加',
    sub_comment_type_cd varchar(2) not null default 'C' comment '评论类型 C 评论 R 回复 A 追加',
    comment_context LONGTEXT not null COMMENT '评论内容',
    `month` INT NOT NULL COMMENT '月份',
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
java110-config/src/main/resources/mapper/comment/CommentServiceDaoImplMapper.xml
New file
@@ -0,0 +1,216 @@
<?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="commentServiceDaoImpl">
    <!-- 评论信息 保存 add by wuxw 2018-07-12 -->
    <insert id="saveCommentInstance" parameterType="Map">
        insert into c_comment(comment_id,user_id,b_id,comment_type_cd,out_id,month,status_cd)
        values(#{commentId},#{userId},#{bId},#{commentTypeCd},#{outId},#{month},'0')
    </insert>
    <!-- 评论信息 保存 add by wuxw 2018-07-12 -->
    <insert id="saveSubCommentInstance" parameterType="Map">
        insert into c_sub_comment(sub_comment_id,comment_id,parent_sub_comment_id,b_id,sub_comment_type_cd,comment_context,month,status_cd)
        values(#{subCommentId},#{commentId},#{parentSubCommentId},#{bId},#{subCommentTypeCd},#{commentContext},#{month},'0')
    </insert>
    <!-- 保存购买记录属性 add by wuxw 2018-07-08 -->
    <insert id="saveSubCommentAttrInstance" parameterType="Map">
        insert into c_sub_comment_attr(sub_comment_id,b_id,attr_id,spec_cd,value,month,status_cd)
        values(#{subCommentId},#{bId},#{attrId},#{specCd},#{value},#{month},'0')
    </insert>
    <!-- 查询商品目录 instance add by wuxw 2018-07-08 -->
    <select id="getComment" parameterType="Map" resultType="Map">
        select c.comment_id,c.user_id,c.b_id,c.comment_type_cd,c.out_id,c.month,c.status_cd
        from c_comment c
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and c.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and c.b_id = #{bId}
        </if>
        <if test="commentId != null and commentId !=''">
            and c.comment_id = #{commentId}
        </if>
    </select>
    <!-- 查询商品目录 instance add by wuxw 2018-07-08 -->
    <select id="getSubComment" parameterType="Map" resultType="Map">
        select sc.sub_comment_id,sc.comment_id,sc.parent_sub_comment_id,sc.b_id,sc.sub_comment_type_cd,sc.comment_context,sc.month,sc.status_cd
        from c_sub_comment sc
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sc.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sc.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sc.sub_comment_id = #{subCommentId}
        </if>
        <if test="commentId != null and commentId != ''">
            and sc.comment_id = #{commentId}
        </if>
    </select>
    <!-- 查询购买记录属性信息 add by wuxw 2018-07-03 -->
    <select id="getSubCommentAttrs" parameterType="Map" resultType="Map">
        select sca.b_id,sca.attr_id,sca.sub_comment_id,sca.spec_cd,sca.value,sca.status_cd
        from c_sub_comment_attr sca
        where
        1=1
        <if test="statusCd != null and statusCd != ''">
            and sca.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sca.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sca.sub_comment_id = #{subCommentId}
        </if>
        <if test="attrId != null and attrId != ''">
            and sca.attr_id = #{attrId}
        </if>
    </select>
    <!-- 修改 评论信息 add by wuxw 2018-07-08 -->
    <update id="updateCommentInstance" parameterType="Map">
        update c_comment c set c.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,c.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and c.b_id = #{bId}
        </if>
        <if test="commentId != null and commentId !=''">
            and c.comment_id = #{commentId}
        </if>
    </update>
    <update id="updateSubCommentInstance" parameterType="Map">
        update c_sub_comment sc set sc.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sc.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sc.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sc.sub_comment_id = #{subCommentId}
        </if>
        <if test="commentId != null and commentId !=''">
            and sc.comment_id = #{commentId}
        </if>
    </update>
    <!-- 修改评价属性信息 add by wuxw 2018-07-03 -->
    <update id="updateSubCommentAttrInstance" parameterType="Map">
        update c_sub_comment_attr bca set bca.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,bca.b_id = #{newBId}
        </if>
        <if test="value != null and value != ''">
            ,bca.value = #{value}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and bca.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and bca.sub_comment_id = #{subCommentId}
        </if>
        <if test="specCd != null and specCd !=''">
            and bca.spec_cd = #{specCd}
        </if>
        <if test="attrId != null and attrId !=''">
            and bca.attr_id = #{attrId}
        </if>
    </update>
    <insert id="saveSubCommentPhotoInstance" parameterType="Map">
        insert into c_sub_comment_photo(comment_photo_id,b_id,sub_comment_id,comment_photo_type_cd,photo,month,status_cd)
        values(#{commentPhotoId},#{bId},#{subCommentId},#{commentPhotoTypeCd},#{photo},#{month},'0')
    </insert>
    <select id="getSubCommentPhotos" parameterType="Map" resultType="Map">
        select scp.comment_photo_id,scp.b_id,scp.sub_comment_id,scp.comment_photo_type_cd,scp.photo,scp.month,scp.status_cd
        from c_sub_comment_photo scp
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and scp.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and scp.b_id = #{bId}
        </if>
        <if test="commentPhotoId != null and commentPhotoId !=''">
            and scp.comment_photo_id = #{commentPhotoId}
        </if>
    </select>
    <update id="updateSubCommentPhotoInstance" parameterType="Map">
        update c_sub_comment_photo scp set scp.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,scp.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and scp.b_id = #{bId}
        </if>
        <if test="commentPhotoId != null and commentPhotoId !=''">
            and scp.comment_photo_id = #{commentPhotoId}
        </if>
    </update>
    <insert id="saveCommentScoreInstance" parameterType="Map">
        insert into c_comment_score(comment_score_id,b_id,comment_id,score_type_cd,value,month,status_cd)
        values(#{commentScoreId},#{bId},#{commentId},#{scoreTypeCd},#{value},#{month},'0')
    </insert>
    <select id="getCommentScores" parameterType="Map" resultType="Map">
        select cs.comment_score_id,cs.b_id,cs.comment_id,cs.score_type_cd,cs.value,cs.month,cs.status_cd
        from c_comment_score cs
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and cs.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and cs.b_id = #{bId}
        </if>
        <if test="commentScoreId != null and commentScoreId !=''">
            and cs.comment_score_id = #{commentScoreId}
        </if>
        <if test="commentId != null and commentId !=''">
            and cs.comment_id = #{commentId}
        </if>
    </select>
    <update id="updateCommentScoreInstance" parameterType="Map">
        update c_comment_score cs set cs.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,cs.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and cs.b_id = #{bId}
        </if>
        <if test="commentScoreId != null and commentScoreId !=''">
            and cs.comment_score_id = #{commentScoreId}
        </if>
        <if test="commentId != null and commentId !=''">
            and cs.comment_id = #{commentId}
        </if>
    </update>
</mapper>
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -63,6 +63,11 @@
        prefixMap.put("shopCatalogId","56");
        prefixMap.put("buyId","57");
        prefixMap.put("buyAttrId","58");
        prefixMap.put("commentId","60");
        prefixMap.put("subCommentId","61");
        prefixMap.put("subCommentAttrId","62");
        prefixMap.put("commentPhotoId","63");
        prefixMap.put("commentScoreId","64");
    }
    private static String PLATFORM_CODE = "0001";
@@ -279,6 +284,21 @@
        //调用服务
        return getCode(prefixMap.get("shopAttrParamId"));
    }
    /**
     * 商品属性参数ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("commentPhotoId"));
    }
    /**
     * 商品属性ID生成
@@ -344,6 +364,59 @@
        //调用服务
        return getCode(prefixMap.get("buyAttrId"));
    }
    /**
     * 评论ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("commentId"));
    }
    /**
     * 评论ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getSubCommentId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("subCommentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("subCommentId"));
    }
    /**
     * 评论ID生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getSubCommentAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("subCommentAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("subCommentAttrId"));
    }
    /**
     * commentScoreId生成
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentScoreId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentScoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d");
        }
        //调用服务
        return getCode(prefixMap.get("commentScoreId"));
    }
    /**
     * 获取restTemplate
     * @return