wuxw7 лет назад: 7
Родитель
Сommit
809af2e40f

+ 71 - 0
CommentService/pom.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>MicroCommunity</artifactId>
+        <groupId>com.java110</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>CommentService</artifactId>
+
+    <name>CommentService</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.java110</groupId>
+            <artifactId>java110-service</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.java110</groupId>
+            <artifactId>java110-event</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>CommentService</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>unpack</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>com.java110</groupId>
+                                    <artifactId>java110-config</artifactId>
+                                    <version>${microcommunity.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.java110.comment.CommentServiceApplicationStart</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 51 - 0
CommentService/src/main/java/com/java110/comment/CommentServiceApplicationStart.java

@@ -0,0 +1,51 @@
+package com.java110.comment;
+
+import com.java110.core.annotation.Java110ListenerDiscovery;
+import com.java110.event.service.BusinessServiceDataFlowEventPublishing;
+import com.java110.service.init.ServiceStartInit;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.Charset;
+
+
+/**
+ * spring boot 初始化启动类
+ *
+ * @version v0.1
+ * @auther com.java110.wuxw
+ * @mail 928255095@qq.com
+ * @date 2016年8月6日
+ * @tag
+ */
+@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.comment","com.java110.core","com.java110.cache"})
+@EnableDiscoveryClient
+@Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
+        basePackages = {"com.java110.comment.listener"})
+public class CommentServiceApplicationStart {
+
+
+    /**
+     * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力.
+     * @return restTemplate
+     */
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate() {
+        StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8"));
+        RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build();
+        return restTemplate;
+    }
+
+    public static void main(String[] args) throws Exception{
+        ApplicationContext context = SpringApplication.run(CommentServiceApplicationStart.class, args);
+        ServiceStartInit.initSystemConfig(context);
+    }
+}

+ 101 - 0
CommentService/src/main/java/com/java110/comment/api/CommentApi.java

@@ -0,0 +1,101 @@
+package com.java110.comment.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.comment.smo.ICommentServiceSMO;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.InitConfigDataException;
+import com.java110.common.exception.InitDataFlowContextException;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.context.BusinessServiceDataFlow;
+import com.java110.core.factory.DataTransactionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 用户服务类
+ * Created by wuxw on 2018/5/14.
+ */
+@RestController
+public class CommentApi extends BaseController {
+
+    @Autowired
+    ICommentServiceSMO commentServiceSMOImpl;
+
+    @RequestMapping(path = "/commentApi/service",method= RequestMethod.GET)
+    public String serviceGet(HttpServletRequest request) {
+        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"不支持Get方法请求").toJSONString();
+    }
+
+    /**
+     * 用户服务统一处理接口
+     * @param orderInfo
+     * @param request
+     * @return
+     */
+    @RequestMapping(path = "/commentApi/service",method= RequestMethod.POST)
+    public String servicePost(@RequestBody String orderInfo, HttpServletRequest request) {
+        BusinessServiceDataFlow businessServiceDataFlow = null;
+        JSONObject responseJson = null;
+        try {
+            Map<String, String> headers = new HashMap<String, String>();
+            getRequestInfo(request, headers);
+            //预校验
+            preValiateOrderInfo(orderInfo);
+            businessServiceDataFlow = this.writeDataToDataFlowContext(orderInfo, headers);
+            responseJson = commentServiceSMOImpl.service(businessServiceDataFlow);
+        }catch (InitDataFlowContextException e){
+            logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败"+orderInfo,e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
+        }catch (InitConfigDataException e){
+            logger.error("请求报文错误,加载配置信息失败"+orderInfo,e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
+        }catch (Exception e){
+            logger.error("请求订单异常",e);
+            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow,ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e,
+                    null);
+        }finally {
+            return responseJson.toJSONString();
+        }
+    }
+
+    /**
+     * 这里预校验,请求报文中不能有 dataFlowId
+     * @param orderInfo
+     */
+    private void preValiateOrderInfo(String orderInfo) {
+       /* if(JSONObject.parseObject(orderInfo).getJSONObject("orders").containsKey("dataFlowId")){
+            throw new BusinessException(ResponseConstant.RESULT_CODE_ERROR,"报文中不能存在dataFlowId节点");
+        }*/
+    }
+
+    /**
+     * 获取请求信息
+     * @param request
+     * @param headers
+     * @throws RuntimeException
+     */
+    private void getRequestInfo(HttpServletRequest request,Map headers) throws Exception{
+        try{
+            super.initHeadParam(request,headers);
+            super.initUrlParam(request,headers);
+        }catch (Exception e){
+            logger.error("加载头信息失败",e);
+            throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR,"加载头信息失败");
+        }
+    }
+
+    public ICommentServiceSMO getCommentServiceSMOImpl() {
+        return commentServiceSMOImpl;
+    }
+
+    public void setCommentServiceSMOImpl(ICommentServiceSMO commentServiceSMOImpl) {
+        this.commentServiceSMOImpl = commentServiceSMOImpl;
+    }
+}

+ 334 - 0
CommentService/src/main/java/com/java110/comment/dao/ICommentServiceDao.java

@@ -0,0 +1,334 @@
+package com.java110.comment.dao;
+
+
+import com.java110.common.exception.DAOException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品组件内部之间使用,没有给外围系统提供服务能力
+ * 商品服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+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 商品 描述信息
+     * @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;
+
+
+    /**
+     * 查询商品信息(business过程)
+     * 根据bId 查询商品信息
+     * @param info bId 信息
+     * @return 商品信息
+     * @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;
+
+    /**
+     * 保存商品购买记录属性
+     * @param businessBuyShopAttr
+     * @throws DAOException
+     */
+    public void saveBuyShopAttrInstance(Map businessBuyShopAttr) throws DAOException;
+
+    /**
+     * 查询商品信息(instance过程)
+     * 根据bId 查询商品信息
+     * @param info bId 信息
+     * @return 商品信息
+     * @throws DAOException
+     */
+    public Map getShopInfo(Map info) 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)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    public Map getBuyShop(Map info) throws DAOException;
+
+    /**
+     * 商品属性查询(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    public List<Map> getBuyShopAttrs(Map info) throws DAOException;
+
+    /**
+     * 修改商品信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateShopInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 修改商品属性信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateShopAttrInstance(Map info) throws DAOException;
+
+    /**
+     * 修改商品属性参数信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateShopAttrParamInstance(Map info) throws DAOException;
+
+
+    /**
+     * 修改商品照片信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateShopPhotoInstance(Map info) throws DAOException;
+
+    /**
+     * 修改商品优惠信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updateShopPreferentialInstance(Map info) throws DAOException;
+
+    /**
+     * 修改商品描述信息
+     * @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;
+}

+ 703 - 0
CommentService/src/main/java/com/java110/comment/dao/impl/CommentServiceDaoImpl.java

@@ -0,0 +1,703 @@
+package com.java110.comment.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.comment.dao.ICommentServiceDao;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.DAOException;
+import com.java110.common.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("shopServiceDaoImpl")
+//@Transactional
+public class CommentServiceDaoImpl extends BaseServiceDao implements ICommentServiceDao {
+
+    private final static Logger logger = LoggerFactory.getLogger(CommentServiceDaoImpl.class);
+
+    /**
+     * 商品信息封装
+     * @param businessShopInfo 商品信息 封装
+     * @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);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品数据失败:"+ JSONObject.toJSONString(businessShopInfo));
+        }
+    }
+
+    /**
+     * 商品属性信息分装
+     * @param businessShopAttr 商品属性信息封装
+     * @throws DAOException
+     */
+    @Override
+    public void saveBusinessShopAttr(Map businessShopAttr) throws DAOException {
+        businessShopAttr.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存商品属性信息 入参 businessShopAttr : {}",businessShopAttr);
+
+        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopAttr",businessShopAttr);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品属性数据失败:"+ JSONObject.toJSONString(businessShopAttr));
+        }
+    }
+
+    /**
+     * 商品属性参数保存
+     * @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
+     * @throws DAOException
+     */
+    @Override
+    public void saveBuyShopAttrInstance(Map businessBuyShopAttr) throws DAOException {
+        businessBuyShopAttr.put("month", DateUtil.getCurrentMonth());
+        logger.debug("保存商品购买记录属性信息 入参 businessBuyShopAttr : {}",businessBuyShopAttr);
+
+        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBuyShopAttrInstance",businessBuyShopAttr);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品购买记录属性数据失败:"+ JSONObject.toJSONString(businessBuyShopAttr));
+        }
+    }
+
+    /**
+     * 查询商品信息(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public Map getShopInfo(Map info) throws DAOException {
+        logger.debug("查询商品信息 入参 info : {}",info);
+
+        List<Map> businessShopInfos = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopInfo",info);
+        if(businessShopInfos == null || businessShopInfos.size() == 0){
+            return null;
+        }
+        if(businessShopInfos.size() >1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopInfo,"+ JSONObject.toJSONString(info));
+        }
+
+        return businessShopInfos.get(0);
+    }
+
+    /**
+     * 商品属性查询(instance)
+     * @param info bId 信息
+     * @return
+     * @throws DAOException
+     */
+    @Override
+    public List<Map> getShopAttrs(Map info) throws DAOException {
+        logger.debug("查询商品属性信息 入参 info : {}",info);
+
+        List<Map> shopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopAttrs",info);
+
+        return shopAttrs;
+    }
+
+    /**
+     * 商品属性参数查询(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);
+
+        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopInfoInstance",info);
+
+        if(saveFlag < 1){
+            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);
+
+        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopAttrInstance",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));
+        }
+    }
+
+    /**
+     * 修改商品购买属性信息(instance)
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    @Override
+    public void updateBuyShopAttrInstance(Map info) throws DAOException {
+        logger.debug("修改商品购买属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateBuyShopAttrInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品购买属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+}

+ 16 - 0
CommentService/src/main/java/com/java110/comment/kafka/CommentServiceBean.java

@@ -0,0 +1,16 @@
+package com.java110.comment.kafka;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Created by wuxw on 2018/4/15.
+ */
+@Configuration
+public class CommentServiceBean {
+    @Bean
+    public CommentServiceKafka listener() {
+        return new CommentServiceKafka();
+    }
+
+}

+ 87 - 0
CommentService/src/main/java/com/java110/comment/kafka/CommentServiceKafka.java

@@ -0,0 +1,87 @@
+package com.java110.comment.kafka;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.comment.smo.ICommentServiceSMO;
+import com.java110.common.constant.KafkaConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.InitConfigDataException;
+import com.java110.common.exception.InitDataFlowContextException;
+import com.java110.common.kafka.KafkaFactory;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.context.BusinessServiceDataFlow;
+import com.java110.core.factory.DataTransactionFactory;
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.kafka.annotation.KafkaListener;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * kafka侦听
+ * Created by wuxw on 2018/4/15.
+ */
+public class CommentServiceKafka extends BaseController {
+
+    @Autowired
+    private ICommentServiceSMO commentServiceSMOImpl;
+
+    @KafkaListener(topics = {"commentServiceTopic"})
+    public void listen(ConsumerRecord<?, ?> record) {
+        logger.info("kafka的key: " + record.key());
+        logger.info("kafka的value: " + record.value().toString());
+        String orderInfo = record.value().toString();
+        BusinessServiceDataFlow businessServiceDataFlow = null;
+        JSONObject responseJson = null;
+        try {
+            Map<String, String> headers = new HashMap<String, String>();
+            //预校验
+            preValiateOrderInfo(orderInfo);
+            businessServiceDataFlow = this.writeDataToDataFlowContext(orderInfo, headers);
+            responseJson = commentServiceSMOImpl.service(businessServiceDataFlow);
+        }catch (InitDataFlowContextException e){
+            logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败"+orderInfo,e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
+        }catch (InitConfigDataException e){
+            logger.error("请求报文错误,加载配置信息失败"+orderInfo,e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
+        }catch (Exception e){
+            logger.error("请求订单异常",e);
+            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow,ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e,
+                    null);
+        }finally {
+            logger.debug("当前请求报文:" + orderInfo +", 当前返回报文:" +responseJson.toJSONString());
+            //只有business 和 instance 过程才做通知消息
+            if(!StatusConstant.REQUEST_BUSINESS_TYPE_BUSINESS.equals(responseJson.getString("businessType"))
+                    && !StatusConstant.REQUEST_BUSINESS_TYPE_INSTANCE.equals(responseJson.getString("businessType"))){
+                return ;
+            }
+            try {
+                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_NOTIFY_CENTER_SERVICE_NAME, "", responseJson.toJSONString());
+            }catch (Exception e){
+                logger.error("用户服务通知centerService失败"+responseJson,e);
+                //这里保存异常信息
+            }
+        }
+    }
+
+
+    /**
+     * 这里预校验,请求报文中不能有 dataFlowId
+     * @param orderInfo
+     */
+    private void preValiateOrderInfo(String orderInfo) {
+       /* if(JSONObject.parseObject(orderInfo).getJSONObject("orders").containsKey("dataFlowId")){
+            throw new BusinessException(ResponseConstant.RESULT_CODE_ERROR,"报文中不能存在dataFlowId节点");
+        }*/
+    }
+
+    public ICommentServiceSMO getCommentServiceSMOImpl() {
+        return commentServiceSMOImpl;
+    }
+
+    public void setCommentServiceSMOImpl(ICommentServiceSMO commentServiceSMOImpl) {
+        this.commentServiceSMOImpl = commentServiceSMOImpl;
+    }
+}

+ 300 - 0
CommentService/src/main/java/com/java110/comment/listener/AbstractCommentBusinessServiceDataFlowListener.java

@@ -0,0 +1,300 @@
+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.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 商户 服务侦听 父类
+ * Created by wuxw on 2018/7/4.
+ */
+public abstract class AbstractCommentBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener{
+
+
+    /**
+     * 获取 DAO工具类
+     * @return
+     */
+    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);
+    }
+}

+ 17 - 0
CommentService/src/main/java/com/java110/comment/smo/ICommentServiceSMO.java

@@ -0,0 +1,17 @@
+package com.java110.comment.smo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.exception.SMOException;
+import com.java110.core.context.BusinessServiceDataFlow;
+
+/**
+ *
+ * 用户信息管理,服务
+ * Created by wuxw on 2017/4/5.
+ */
+public interface ICommentServiceSMO {
+
+
+    public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException;
+
+}

+ 107 - 0
CommentService/src/main/java/com/java110/comment/smo/impl/CommentServiceSMOImpl.java

@@ -0,0 +1,107 @@
+package com.java110.comment.smo.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.comment.smo.ICommentServiceSMO;
+import com.java110.common.cache.MappingCache;
+import com.java110.common.constant.KafkaConstant;
+import com.java110.common.constant.MappingConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.SMOException;
+import com.java110.common.kafka.KafkaFactory;
+import com.java110.common.util.Assert;
+import com.java110.common.util.DateUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.context.BusinessServiceDataFlow;
+import com.java110.core.factory.DataFlowFactory;
+import com.java110.entity.center.DataFlowLinksCost;
+import com.java110.entity.center.DataFlowLog;
+import com.java110.event.service.BusinessServiceDataFlowEventPublishing;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 用户服务信息管理业务信息实现
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("shopServiceSMOImpl")
+@Transactional
+public class CommentServiceSMOImpl extends BaseServiceSMO implements ICommentServiceSMO {
+
+
+        @Override
+        public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
+            try {
+                Assert.hasLength(businessServiceDataFlow.getbId(),"bId 不能为空");
+
+                BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
+                Assert.notEmpty(businessServiceDataFlow.getResJson(),"评论服务["+businessServiceDataFlow.getCurrentBusiness().getServiceCode()+"]没有返回内容");
+            } catch (Exception e) {
+                logger.error("评论信息处理异常",e);
+                throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR,"评论信息处理异常"+e.getMessage());
+            }finally {
+                if(businessServiceDataFlow == null){
+                    return null;
+                }
+
+                //这里记录日志
+                Date endDate = DateUtil.getCurrentDate();
+
+                businessServiceDataFlow.setEndDate(endDate);
+                //添加耗时
+                DataFlowFactory.addCostTime(businessServiceDataFlow, "service", "业务处理总耗时",
+                        businessServiceDataFlow.getStartDate(), businessServiceDataFlow.getEndDate());
+                //保存耗时
+                saveCostTimeLogMessage(businessServiceDataFlow);
+                //保存日志
+                saveLogMessage(businessServiceDataFlow);
+            }
+            return businessServiceDataFlow.getResJson();
+    }
+
+    /**
+     * 保存日志信息
+     * @param businessServiceDataFlow
+     */
+    private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
+
+        try{
+            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))){
+                for(DataFlowLog dataFlowLog :businessServiceDataFlow.getLogDatas()) {
+                    KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME, "", JSONObject.toJSONString(dataFlowLog));
+                }
+            }
+        }catch (Exception e){
+            logger.error("报错日志出错了,",e);
+        }
+    }
+
+    /**
+     * 保存耗时信息
+     * @param businessServiceDataFlow
+     */
+    private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
+        try{
+            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))){
+                List<DataFlowLinksCost> dataFlowLinksCosts = businessServiceDataFlow.getLinksCostDates();
+                JSONObject costDate = new JSONObject();
+                JSONArray costDates = new JSONArray();
+                JSONObject newObj = null;
+                for(DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts){
+                    newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
+                    newObj.put("dataFlowId",businessServiceDataFlow.getDataFlowId());
+                    newObj.put("transactionId",businessServiceDataFlow.getTransactionId());
+                    costDates.add(newObj);
+                }
+                costDate.put("costDates",costDates);
+
+                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME,"",costDate.toJSONString());
+            }
+        }catch (Exception e){
+            logger.error("报错日志出错了,",e);
+        }
+    }
+}

+ 92 - 0
CommentService/src/main/resources/application-dev.yml

@@ -0,0 +1,92 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 192.168.31.199
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://192.168.31.199:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8008
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: comment-service
+  redis:
+    database: 0
+    host: 192.168.31.199
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://192.168.31.199:3306/TT?useUnicode=true&characterEncoding=utf-8
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: commentBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 92 - 0
CommentService/src/main/resources/application-prod.yml

@@ -0,0 +1,92 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8008
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: comment-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT?useUnicode=true&characterEncoding=utf-8
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: commentBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 92 - 0
CommentService/src/main/resources/application-test.yml

@@ -0,0 +1,92 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8008
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: comment-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT?useUnicode=true&characterEncoding=utf-8
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: commentBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 3 - 0
CommentService/src/main/resources/application.yml

@@ -0,0 +1,3 @@
+spring:
+  profiles:
+    active: test

+ 9 - 0
CommentService/src/main/resources/banner.txt

@@ -0,0 +1,9 @@
+${AnsiColor.BRIGHT_RED}
+       _                           ___   ___   ____           _____    __                            _____                         _
+      (_)  ____ _ _   __  ____ _  <  /  <  /  / __ \         / ___/   / /_   ____     ____          / ___/  ___    _____ _   __   (_)  _____  ___
+     / /  / __ `/| | / / / __ `/  / /   / /  / / / /         \__ \   / __ \ / __ \   / __ \         \__ \  / _ \  / ___/| | / /  / /  / ___/ / _ \
+    / /  / /_/ / | |/ / / /_/ /  / /   / /  / /_/ /         ___/ /  / / / // /_/ /  / /_/ /        ___/ / /  __/ / /    | |/ /  / /  / /__  /  __/
+ __/ /   \__,_/  |___/  \__,_/  /_/   /_/   \____/         /____/  /_/ /_/ \____/  / .___/        /____/  \___/ /_/     |___/  /_/   \___/  \___/
+/___/                                                                             /_/
+
+ java110 ShopService starting, more information scan https://github.com/java110/MicroCommunity

+ 17 - 0
CommentService/src/test/java/com/java110/AppTest.java

@@ -0,0 +1,17 @@
+package com.java110;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    //@Test
+    public void shouldAnswerWithTrue()
+    {
+
+        //assertTrue( true );
+    }
+}

+ 146 - 0
java110-config/db/CommentService/create_table.sql

@@ -0,0 +1,146 @@
+-- 评论
+create table c_comment(
+    comment_id VARCHAR(30) NOT NULL COMMENT '评论ID',
+    user_id varchar(30) not null comment '评论者用户ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
+    comment_type_cd varchar(2) not null default 'S' comment '评论类型 S表示 商品 M表示 商户 T 物流',
+    out_id varchar(30) not null comment '外部ID,如商品ID 商户ID等',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'
+)
+PARTITION BY RANGE (`month`) (
+    PARTITION comment_1 VALUES LESS THAN (2),
+    PARTITION comment_2 VALUES LESS THAN (3),
+    PARTITION comment_3 VALUES LESS THAN (4),
+    PARTITION comment_4 VALUES LESS THAN (5),
+    PARTITION comment_5 VALUES LESS THAN (6),
+    PARTITION comment_6 VALUES LESS THAN (7),
+    PARTITION comment_7 VALUES LESS THAN (8),
+    PARTITION comment_8 VALUES LESS THAN (9),
+    PARTITION comment_9 VALUES LESS THAN (10),
+    PARTITION comment_10 VALUES LESS THAN (11),
+    PARTITION comment_11 VALUES LESS THAN (12),
+    PARTITION comment_12 VALUES LESS THAN (13)
+);
+
+CREATE INDEX idx_comment_b_id ON c_comment(b_id);
+CREATE INDEX idx_comment_out_id ON c_comment(out_id);
+-- 评论子表
+create table c_sub_comment(
+    sub_comment_id varchar(30) not null comment '子评论ID',
+    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 追加',
+    comment_context LONGTEXT not null COMMENT '评论内容',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'
+)
+PARTITION BY RANGE (`month`) (
+    PARTITION sub_comment_1 VALUES LESS THAN (2),
+    PARTITION sub_comment_2 VALUES LESS THAN (3),
+    PARTITION sub_comment_3 VALUES LESS THAN (4),
+    PARTITION sub_comment_4 VALUES LESS THAN (5),
+    PARTITION sub_comment_5 VALUES LESS THAN (6),
+    PARTITION sub_comment_6 VALUES LESS THAN (7),
+    PARTITION sub_comment_7 VALUES LESS THAN (8),
+    PARTITION sub_comment_8 VALUES LESS THAN (9),
+    PARTITION sub_comment_9 VALUES LESS THAN (10),
+    PARTITION sub_comment_10 VALUES LESS THAN (11),
+    PARTITION sub_comment_11 VALUES LESS THAN (12),
+    PARTITION sub_comment_12 VALUES LESS THAN (13)
+);
+
+CREATE INDEX idx_sub_comment_b_id ON c_sub_comment(b_id);
+CREATE INDEX idx_sub_comment_comment_id ON c_sub_comment(comment_id);
+CREATE INDEX idx_sub_comment_parent_sub_comment_id ON c_sub_comment(parent_sub_comment_id);
+
+-- 属性
+create table c_sub_comment_attr(
+    attr_id VARCHAR(30) NOT NULL COMMENT '属性id',
+    sub_comment_id VARCHAR(30) NOT NULL COMMENT '子评论ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
+    spec_cd VARCHAR(12) NOT NULL COMMENT '规格id,参考spec表',
+    value VARCHAR(50) NOT NULL COMMENT '属性值',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'
+)
+PARTITION BY RANGE (`month`) (
+    PARTITION sub_comment_attr_1 VALUES LESS THAN (2),
+    PARTITION sub_comment_attr_2 VALUES LESS THAN (3),
+    PARTITION sub_comment_attr_3 VALUES LESS THAN (4),
+    PARTITION sub_comment_attr_4 VALUES LESS THAN (5),
+    PARTITION sub_comment_attr_5 VALUES LESS THAN (6),
+    PARTITION sub_comment_attr_6 VALUES LESS THAN (7),
+    PARTITION sub_comment_attr_7 VALUES LESS THAN (8),
+    PARTITION sub_comment_attr_8 VALUES LESS THAN (9),
+    PARTITION sub_comment_attr_9 VALUES LESS THAN (10),
+    PARTITION sub_comment_attr_10 VALUES LESS THAN (11),
+    PARTITION sub_comment_attr_11 VALUES LESS THAN (12),
+    PARTITION sub_comment_attr_12 VALUES LESS THAN (13)
+);
+
+CREATE INDEX idx_sub_comment_attr_b_id ON c_sub_comment_attr(b_id);
+CREATE INDEX idx_sub_comment_attr_sub_comment_id ON c_sub_comment_attr(sub_comment_id);
+CREATE INDEX idx_sub_comment_attr_spec_cd ON c_sub_comment_attr(spec_cd);
+
+
+
+-- 评论 照片
+CREATE TABLE c_sub_comment_photo(
+    comment_photo_id VARCHAR(30) NOT NULL COMMENT '评论照片ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+    sub_comment_id VARCHAR(30) NOT NULL COMMENT '商店ID',
+    comment_photo_type_cd VARCHAR(12) NOT NULL default 'S' COMMENT '评论照片类型,S 商品照片 M 商户ID',
+    photo VARCHAR(100) NOT NULL COMMENT '照片',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'
+)
+PARTITION BY RANGE (`month`) (
+    PARTITION sub_comment_photo_1 VALUES LESS THAN (2),
+    PARTITION sub_comment_photo_2 VALUES LESS THAN (3),
+    PARTITION sub_comment_photo_3 VALUES LESS THAN (4),
+    PARTITION sub_comment_photo_4 VALUES LESS THAN (5),
+    PARTITION sub_comment_photo_5 VALUES LESS THAN (6),
+    PARTITION sub_comment_photo_6 VALUES LESS THAN (7),
+    PARTITION sub_comment_photo_7 VALUES LESS THAN (8),
+    PARTITION sub_comment_photo_8 VALUES LESS THAN (9),
+    PARTITION sub_comment_photo_9 VALUES LESS THAN (10),
+    PARTITION sub_comment_photo_10 VALUES LESS THAN (11),
+    PARTITION sub_comment_photo_11 VALUES LESS THAN (12),
+    PARTITION sub_comment_photo_12 VALUES LESS THAN (13)
+);
+CREATE INDEX idx_sub_comment_photo_b_id ON c_sub_comment_photo(b_id);
+CREATE INDEX idx_sub_comment_photo_sub_comment_id ON c_sub_comment_photo(sub_comment_id);
+-- 评论分数
+create table c_comment_score(
+    comment_score_id varchar(30) not null comment '评论分数ID',
+    comment_id varchar(30) not null comment '评论ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+    score_type_cd varchar(30) not null comment '打分类别,S 商品相符,U 卖家打分,T 物流打分'
+    value int not null comment '分数',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'
+)
+PARTITION BY RANGE (`month`) (
+    PARTITION comment_score_1 VALUES LESS THAN (2),
+    PARTITION comment_score_2 VALUES LESS THAN (3),
+    PARTITION comment_score_3 VALUES LESS THAN (4),
+    PARTITION comment_score_4 VALUES LESS THAN (5),
+    PARTITION comment_score_5 VALUES LESS THAN (6),
+    PARTITION comment_score_6 VALUES LESS THAN (7),
+    PARTITION comment_score_7 VALUES LESS THAN (8),
+    PARTITION comment_score_8 VALUES LESS THAN (9),
+    PARTITION comment_score_9 VALUES LESS THAN (10),
+    PARTITION comment_score_10 VALUES LESS THAN (11),
+    PARTITION comment_score_11 VALUES LESS THAN (12),
+    PARTITION comment_score_12 VALUES LESS THAN (13)
+);
+
+CREATE INDEX idx_comment_score_b_id ON c_comment_score(b_id);
+CREATE INDEX idx_comment_score_comment_id ON c_comment_score(comment_id);

+ 1 - 0
pom.xml

@@ -31,6 +31,7 @@
         <module>java110-logAgent</module>
         <module>zipkin</module>
         <module>ShopService</module>
+        <module>CommentService</module>
     </modules>
 
     <parent>