Explorar o código

加入商品某块

wuxw %!s(int64=5) %!d(string=hai) anos
pai
achega
350370fe62
Modificáronse 32 ficheiros con 806 adicións e 1536 borrados
  1. 0 0
      java110-db/src/main/resources/mapper/goods/ShopServiceDaoImplMapper.xml
  2. 2 1
      pom.xml
  3. 2 2
      service-fee/pom.xml
  4. 10 0
      service-goods/docker/Dockerfile
  5. 14 0
      service-goods/docker/bin/start_goods.sh
  6. 25 0
      service-goods/docker/docker-compose.yml
  7. 11 0
      service-goods/docker/onStart.sh
  8. 69 0
      service-goods/pom.xml
  9. 67 0
      service-goods/src/main/java/com/java110/goods/GoodsServiceApplicationStart.java
  10. 16 0
      service-goods/src/main/java/com/java110/goods/kafka/GoodsServiceBean.java
  11. 86 0
      service-goods/src/main/java/com/java110/goods/kafka/GoodsServiceKafka.java
  12. 17 0
      service-goods/src/main/java/com/java110/goods/smo/IGoodsServiceSMO.java
  13. 112 0
      service-goods/src/main/java/com/java110/goods/smo/impl/GoodsServiceSMOImpl.java
  14. 85 0
      service-goods/src/main/resources/application-dev.yml
  15. 97 0
      service-goods/src/main/resources/application-prod.yml
  16. 97 0
      service-goods/src/main/resources/application-test.yml
  17. 3 0
      service-goods/src/main/resources/application.yml
  18. 15 0
      service-goods/src/main/resources/banner.txt
  19. 75 0
      service-goods/src/main/resources/dataSource.yml
  20. 3 0
      service-goods/src/main/resources/java110.properties
  21. 0 19
      service-rule/README.md
  22. 0 33
      service-rule/pom.xml
  23. 0 38
      service-rule/src/main/java/com/java110/rule/AppSpringBootApplication.java
  24. 0 592
      service-rule/src/main/java/com/java110/rule/common/RuleCommon.java
  25. 0 49
      service-rule/src/main/java/com/java110/rule/dao/IRuleDao.java
  26. 0 204
      service-rule/src/main/java/com/java110/rule/dao/impl/RuleDaoImpl.java
  27. 0 98
      service-rule/src/main/java/com/java110/rule/rest/RuleServiceRest.java
  28. 0 15
      service-rule/src/main/java/com/java110/rule/service/RuleService.java
  29. 0 16
      service-rule/src/main/java/com/java110/rule/smo/IRuleServiceSMO.java
  30. 0 270
      service-rule/src/main/java/com/java110/rule/smo/impl/RuleServiceSMOImpl.java
  31. 0 161
      service-rule/src/main/java/com/java110/rule/thread/RuleCommonThread.java
  32. 0 38
      service-rule/src/test/java/com/java110/AppTest.java

java110-db/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/goods/ShopServiceDaoImplMapper.xml


+ 2 - 1
pom.xml

@@ -21,7 +21,6 @@
         <module>service-eureka</module>
         <module>service-sequence</module>
         <module>service-store</module>
-        <module>service-rule</module>
         <module>service-order</module>
         <module>service-api</module>
         <module>service-community</module>
@@ -29,7 +28,9 @@
         <module>service-common</module>
         <module>service-report</module>
         <module>service-front</module>
+        <module>service-goods</module>
         <module>java110-generator</module>
+
     </modules>
 
     <parent>

+ 2 - 2
service-fee/pom.xml

@@ -18,8 +18,8 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <maven.compiler.source>1.7</maven.compiler.source>
-        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
     </properties>
 
     <dependencies>

+ 10 - 0
service-goods/docker/Dockerfile

@@ -0,0 +1,10 @@
+FROM registry.cn-beijing.aliyuncs.com/sxd/ubuntu-java8:1.0
+MAINTAINER wuxw <928255095@qq.com>
+
+
+ADD bin/start_goods.sh /root/
+
+
+RUN chmod u+x /root/start_goods.sh
+
+CMD ["/root/start_goods.sh","dev"]

+ 14 - 0
service-goods/docker/bin/start_goods.sh

@@ -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 target/service-goods.jar > goods.log 2>&1 &
+
+#### normal prod model
+#nohup java -jar -Dspring.profiles.active=prod target/service-goods.jar > goods.log 2>&1 &
+
+#### normal test model
+#nohup java -jar -Dspring.profiles.active=test target/service-goods.jar > goods.log 2>&1 &
+
+#### normal dev model
+nohup java -jar -Dspring.profiles.active=$1 target/service-goods.jar > goods.log 2>&1 &
+
+tail -100f goods.log

+ 25 - 0
service-goods/docker/docker-compose.yml

@@ -0,0 +1,25 @@
+version: '2'
+services:
+   goodsserivce:
+       container_name: goodsserivce-1
+       build:
+          context: .
+          dockerfile: Dockerfile
+       restart: always
+       ports:
+       - "8014:8014"
+       volumes:
+       - ../target/service-goods.jar:/root/target/service-goods.jar
+       networks:
+       - java110-net
+#       mem_limit: 1024m
+#       extra_hosts:
+#       - "dev.java110.com:192.168.1.18"
+#       - "dev.db.java110.com:192.168.1.18"
+#       - "dev.zk.java110.com:192.168.1.18"
+#       - "dev.kafka.java110.com:192.168.1.18"
+#       - "dev.redis.java110.com:192.168.1.18"
+#       - "api.java110.com:92.168.1.18"
+networks:
+  java110-net:
+    external: true

+ 11 - 0
service-goods/docker/onStart.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+cp -r ../bin .
+
+cp  -r ../target .
+
+docker build -t java110/goods .
+
+docker run -ti --name goods_test -p8014:8014 -idt java110/goods:latest
+
+docker logs -f goods_test

+ 69 - 0
service-goods/pom.xml

@@ -0,0 +1,69 @@
+<?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>service-goods</artifactId>
+
+    <name>service-goods</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.java110</groupId>
+            <artifactId>java110-service</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>service-goods</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-interface</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.goods.GoodsServiceApplicationStart</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 67 - 0
service-goods/src/main/java/com/java110/goods/GoodsServiceApplicationStart.java

@@ -0,0 +1,67 @@
+package com.java110.goods;
+
+import com.java110.core.annotation.Java110ListenerDiscovery;
+import com.java110.core.client.RestTemplate;
+import com.java110.core.event.service.BusinessServiceDataFlowEventPublishing;
+import com.java110.service.init.ServiceStartInit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.converter.StringHttpMessageConverter;
+
+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.goods",
+        "com.java110.core", "com.java110.config.properties.code", "com.java110.db"})
+@EnableDiscoveryClient
+@Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
+        basePackages = {"com.java110.fee.listener"})
+@EnableFeignClients(basePackages = {"com.java110.intf.user",
+        "com.java110.intf.order",
+        "com.java110.intf.community",
+        "com.java110.intf.store",
+        "com.java110.intf.store"})
+public class GoodsServiceApplicationStart {
+
+    private static Logger logger = LoggerFactory.getLogger(GoodsServiceApplicationStart.class);
+
+
+    /**
+     * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力.
+     *
+     * @return restTemplate
+     */
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate() {
+        StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8"));
+        RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(RestTemplate.class);
+        return restTemplate;
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            ApplicationContext context = SpringApplication.run(GoodsServiceApplicationStart.class, args);
+            ServiceStartInit.initSystemConfig(context);
+        } catch (Throwable e) {
+            logger.error("系统启动失败", e);
+        }
+    }
+}

+ 16 - 0
service-goods/src/main/java/com/java110/goods/kafka/GoodsServiceBean.java

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

+ 86 - 0
service-goods/src/main/java/com/java110/goods/kafka/GoodsServiceKafka.java

@@ -0,0 +1,86 @@
+package com.java110.goods.kafka;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.context.BusinessServiceDataFlow;
+import com.java110.core.factory.DataTransactionFactory;
+import com.java110.goods.smo.IGoodsServiceSMO;
+import com.java110.utils.constant.KafkaConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.InitConfigDataException;
+import com.java110.utils.exception.InitDataFlowContextException;
+import com.java110.utils.kafka.KafkaFactory;
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 GoodsServiceKafka extends BaseController {
+
+    private final static Logger logger = LoggerFactory.getLogger(GoodsServiceKafka.class);
+
+
+    @Autowired
+    private IGoodsServiceSMO feeServiceSMOImpl;
+
+    @KafkaListener(topics = {"feeServiceTopic"})
+    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 = feeServiceSMOImpl.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节点");
+        }*/
+    }
+
+
+}

+ 17 - 0
service-goods/src/main/java/com/java110/goods/smo/IGoodsServiceSMO.java

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

+ 112 - 0
service-goods/src/main/java/com/java110/goods/smo/impl/GoodsServiceSMOImpl.java

@@ -0,0 +1,112 @@
+package com.java110.goods.smo.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.context.BusinessServiceDataFlow;
+import com.java110.core.event.service.BusinessServiceDataFlowEventPublishing;
+import com.java110.core.factory.DataFlowFactory;
+import com.java110.entity.center.DataFlowLinksCost;
+import com.java110.entity.center.DataFlowLog;
+import com.java110.goods.smo.IGoodsServiceSMO;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.KafkaConstant;
+import com.java110.utils.constant.MappingConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.SMOException;
+import com.java110.utils.kafka.KafkaFactory;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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("feeServiceSMOImpl")
+@Transactional
+public class GoodsServiceSMOImpl extends BaseServiceSMO implements IGoodsServiceSMO {
+
+    private static Logger logger = LoggerFactory.getLogger(GoodsServiceSMOImpl.class);
+
+    @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);
+        }
+    }
+}

+ 85 - 0
service-goods/src/main/resources/application-dev.yml

@@ -0,0 +1,85 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: dev.redis.java110.com
+    port: 6379
+    timeout: 3000
+    password: hc
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+    preferIpAddress: true
+    instanceId: ${spring.cloud.client.ip-address}:${server.port}
+  client:
+    serviceUrl:
+      defaultZone: http://dev.java110.com:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8014
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  profiles:
+    active: share
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: goods-service
+  redis:
+    database: 0
+    host: dev.redis.java110.com
+    port: 6379
+    password: hc
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+
+feign:
+  client:
+    config:
+      default:
+        connect-timeout: 10000
+        read-timeout: 20000
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: dev.zk.java110.com:2181
+    servers: dev.kafka.java110.com:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: goodsBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: dev.zk.java110.com:2181
+    servers: dev.kafka.java110.com:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 97 - 0
service-goods/src/main/resources/application-prod.yml

@@ -0,0 +1,97 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: prod.redis.java110.com
+    port: 6379
+    timeout: 3000
+    password: hc
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+    preferIpAddress: true
+    instanceId: ${spring.cloud.client.ip-address}:${server.port}
+  client:
+    serviceUrl:
+      defaultZone: http://prod.java110.com:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8014
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: goods-service
+  redis:
+    database: 0
+    host: prod.redis.java110.com
+    port: 6379
+    password: hc
+    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://prod.db.java110.com: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.cj.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: prod.zk.java110.com:2181
+    servers: prod.kafka.java110.com:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: goodsBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: prod.zk.java110.com:2181
+    servers: prod.kafka.java110.com:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 97 - 0
service-goods/src/main/resources/application-test.yml

@@ -0,0 +1,97 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: test.redis.java110.com
+    port: 6379
+    timeout: 3000
+    password: hc
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+    preferIpAddress: true
+    instanceId: ${spring.cloud.client.ip-address}:${server.port}
+  client:
+    serviceUrl:
+      defaultZone: http://test.java110.com:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8014
+  tomcat:
+    uri-encoding: UTF-8
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: goods-service
+  redis:
+    database: 0
+    host: test.redis.java110.com
+    port: 6379
+    password: hc
+    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://test.db.java110.com: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.cj.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: test.zk.java110.com:2181
+    servers: test.kafka.java110.com:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: goodsBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: test.zk.java110.com:2181
+    servers: test.kafka.java110.com:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 3 - 0
service-goods/src/main/resources/application.yml

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

+ 15 - 0
service-goods/src/main/resources/banner.txt

@@ -0,0 +1,15 @@
+${AnsiColor.BRIGHT_RED}
+     __                    ____ ___________
+    |__|____ ___  _______ /_   /_   \   _  \
+    |  \__  \\  \/ /\__  \ |   ||   /  /_\  \
+    |  |/ __ \\   /  / __ \|   ||   \  \_/   \
+/\__|  (____  /\_/  (____  /___||___|\_____  /
+\______|    \/           \/                \/
+ ____ ___                    _________                  .__
+|    |   \______ ___________/   _____/ ______________  _|__| ____  ____
+|    |   /  ___// __ \_  __ \_____  \_/ __ \_  __ \  \/ /  |/ ___\/ __ \
+|    |  /\___ \\  ___/|  | \/        \  ___/|  | \/\   /|  \  \__\  ___/
+|______//____  >\___  >__| /_______  /\___  >__|    \_/ |__|\___  >___  >
+             \/     \/             \/     \/                    \/    \/
+
+ java110 GoodsService starting, more information scan https://github.com/java110/MicroCommunity

+ 75 - 0
service-goods/src/main/resources/dataSource.yml

@@ -0,0 +1,75 @@
+dataSources:
+  ds0: !!com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://dev.db.java110.com:3306/hc_community?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+    username: hc_community
+    password: hc_community@12345678
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+  #  ds0_slave0: !!com.alibaba.druid.pool.DruidDataSource
+  #    driverClassName: com.mysql.jdbc.Driver
+  #    url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
+  #    username: TT
+  #    password: TT@12345678
+  #    connectionTimeoutMilliseconds: 30000
+  #    idleTimeoutMilliseconds: 60000
+  #    maxPoolSize: 50
+  #    minPoolSize: 1
+  #    maintenanceIntervalMilliseconds: 30000
+  ds1: !!com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+    username: TT
+    password: TT@12345678
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+#  ds1_slave0: !!com.alibaba.druid.pool.DruidDataSource
+#    driverClassName: com.mysql.jdbc.Driver
+#    url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
+#    username: TT
+#    password: TT@12345678
+#    connectionTimeoutMilliseconds: 30000
+#    idleTimeoutMilliseconds: 60000
+#    maxPoolSize: 50
+#    minPoolSize: 1
+#    maintenanceIntervalMilliseconds: 30000
+
+shardingRule:
+  tables:
+    business_xxx:
+      actualDataNodes: ds${0..1}.business_community
+      databaseStrategy:
+        inline:
+          shardingColumn: community_id
+          algorithmExpression: ds${Long.parseLong(community_id) % 2}
+
+  bindingTables:
+    - business_xxx
+
+  defaultDataSourceName: ds1
+  defaultDatabaseStrategy:
+    none:
+  defaultTableStrategy:
+    none:
+
+#  masterSlaveRules:
+#    ms_ds0:
+#     masterDataSourceName: ds0
+#     slaveDataSourceNames:
+#       - ds0_slave0
+#     loadBalanceAlgorithmType: ROUND_ROBIN
+#   ms_ds1:
+#     masterDataSourceName: ds1
+#     slaveDataSourceNames:
+#       - ds1_slave0
+#     loadBalanceAlgorithmType: ROUND_ROBIN
+props:
+  sql.show: true

+ 3 - 0
service-goods/src/main/resources/java110.properties

@@ -0,0 +1,3 @@
+java110.mappingPath=classpath:mapper/goods/*.xml
+
+

+ 0 - 19
service-rule/README.md

@@ -1,19 +0,0 @@
-ruleService模块(规则服务模块)
-
-1、建立规则相关表 
-
-1> group_rule 表 规则组, 可以根据业务去指定走那个规则组
-
-2> group_rule_relation 表 规则组域规则关系
-
-3> rule_entrance 表 规则入口(根据订单动作),如只有客户订单走规则
-
-4> rule_cond 表 规则实现方式,反射java 方法 配置sql 执行 过程
-
-5> rule_cond_cfg 表 配置sql 表 和过程入参
-
-
-
-
-
-

+ 0 - 33
service-rule/pom.xml

@@ -1,33 +0,0 @@
-<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>service-rule</artifactId>
-    <packaging>jar</packaging>
-
-    <name>service-rule</name>
-    <url>http://maven.apache.org</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-interface</artifactId>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 38
service-rule/src/main/java/com/java110/rule/AppSpringBootApplication.java

@@ -1,38 +0,0 @@
-package com.java110.rule;
-
-import com.java110.config.properties.EventProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-
-/**
- * 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.rule")
-@EnableDiscoveryClient
-@EnableConfigurationProperties(EventProperties.class)
-@EnableFeignClients(basePackages = {"com.java110.intf"})
-public class AppSpringBootApplication {
-
-    private final static Logger logger = LoggerFactory.getLogger(AppSpringBootApplication.class);
-
-
-    public static void main(String[] args) throws Exception {
-        try{
-            SpringApplication.run(AppSpringBootApplication.class, args);
-        }catch (Throwable e){
-            logger.error("系统启动失败",e);
-        }
-    }
-}

+ 0 - 592
service-rule/src/main/java/com/java110/rule/common/RuleCommon.java

@@ -1,592 +0,0 @@
-package com.java110.rule.common;
-
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.JSONPath;
-import com.java110.utils.constant.RuleDomain;
-import com.java110.utils.log.LoggerEngine;
-import com.java110.utils.util.RuleUtil;
-import com.java110.utils.util.SpringBeanInvoker;
-import com.java110.entity.rule.ContractRootRule;
-import com.java110.entity.rule.Rule;
-import com.java110.entity.rule.RuleCondCfg;
-import com.java110.rule.dao.IRuleDao;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.lang.reflect.Method;
-import java.util.*;
-
-/**
- * Created by wuxw on 2017/7/23.
- */
-@Service("ruleCommon")
-public class RuleCommon extends LoggerEngine{
-
-
-    private String ruleCode;
-    private String ruleMsg;
-    private String ruleCondRtn;//配置规则条件返回值 0成功 1失败
-
-    @Autowired
-    IRuleDao ruleDaoImpl;
-
-
-    Map<String,String> ruleNodeMap;
-
-    Map<String,String> dataStackMap = null;
-
-    Map<String,List<Map<String,String>>> ruleDbMap;
-
-
-
-    public RuleCommon(Map<String, String> dataStackMap) {
-        this.dataStackMap = dataStackMap;
-    }
-
-    public String ruleCommonCondMed(String ruleId, ContractRootRule contractRootRule, JSONObject reqJson)  throws Exception {
-        long allStartTime = System.currentTimeMillis();
-        java.sql.Timestamp startTime = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-
-        String condReturnXml = "";
-        Map<String,Rule> ruleMap = ruleDaoImpl.getRuleMap();
-        Rule rule = ruleMap.get(ruleId);
-
-        Map<String,String> map = new HashMap<String,String>();
-
-        List<TreeMap<String,String>> paramList = new ArrayList<TreeMap<String,String>>();
-
-        map = ruleCommonCondMed(ruleId,paramList,reqJson);
-
-        condReturnXml = ruleCommonCondMed(map,paramList,rule,contractRootRule.getTcpCont().getTransactionId());
-        //记录耗时明细
-        recordCostTime(reqJson,
-                System.currentTimeMillis()-allStartTime,
-                "校验规则条件判断耗时[ruleId:"+ruleId+"]",
-                2,
-                startTime,
-                new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-        return condReturnXml;
-    }
-
-    public String ruleCommonCondMed(Map<String,String> map,List<TreeMap<String,String>> paramList,Rule rule,String transactionID)  throws Exception {
-        String retCode = map.get("retCode");
-        String retMsg = map.get("retMsg");
-        if(!StringUtils.isEmpty(retCode)){
-            if(retCode.equals(RuleDomain.RULE_COND_RETURN_0000)){//校验通过
-                return retCode;
-            }else{//校验失败
-                return RuleUtil.ruleReturnJson(transactionID,retCode,retMsg,rule.getRule_type());
-            }
-        }else{
-            //如果调用存过的参数为空,直接返回成功
-            if(paramList.size() == 0 || !rule.getRule_type().contains(RuleDomain.RULE_TYPE_STORED_PROCEDURE)){
-                return RuleDomain.RULE_COND_RETURN_0000;
-            }else{
-                return ruleAction(transactionID,rule,paramList);
-            }
-        }
-    }
-
-
-    public Map<String,String> ruleCommonCondMed (String ruleId, List<TreeMap<String,String>> list,JSONObject reqJson)  throws Exception {
-        if(list == null){
-            list = new ArrayList<TreeMap<String, String>>();
-        }
-
-        Map<String,String> returnMap = new HashMap<String,String>();
-        dataStackMap = new HashMap<String,String>();
-        Map<String,Rule> ruleMap = ruleDaoImpl.getRuleMap();
-        List<RuleCondCfg> ruleCondCfgList = ruleMap.get(ruleId).getRuleCondCfgs();
-        ruleNodeMap = new HashMap<String,String>();
-        ruleDbMap = new HashMap<String, List<Map<String,String>>>();
-        returnMap.clear();
-        TreeMap<String,String> returnTreeMap = new TreeMap<String,String>();
-        String ruleCommonCondStr = "";
-        int i = 0;
-        for(RuleCondCfg ruleCondCfg : ruleCondCfgList){
-            i++;
-            String ruleNode = ruleCondCfg.getRule_node();
-            String ruleNodeTmp = RuleDomain.RULE_SIGN_5+ruleCondCfg.getNode_existed()+RuleDomain.RULE_SIGN_5;
-            String ruleNodeValue = "";
-            String ruleNodeValueTmp = ruleNodeMap.get(ruleNodeTmp)==null?"":ruleNodeMap.get(ruleNodeTmp);
-            if(!StringUtils.isEmpty(ruleNode)){
-                String dataFromFlag = ruleCondCfg.getData_from_flag();
-                if(dataFromFlag.contains(RuleDomain.RULE_SIGN_4)){
-                    for(String dataFromFlag1 : dataFromFlag.split(RuleDomain.RULE_SIGN_4)){
-                        ruleNodeValue = getRuleNodeValue(dataFromFlag1,ruleCondCfg,ruleNodeValueTmp,reqJson.toJSONString());
-                        if(!StringUtils.isEmpty(ruleNodeValue)){
-                            break;
-                        }
-                    }
-                }else{
-                    ruleNodeValue = getRuleNodeValue(dataFromFlag,ruleCondCfg,ruleNodeValueTmp,reqJson.toJSONString());
-                }
-
-            }
-            ruleNodeMap.put(RuleDomain.RULE_SIGN_5+ruleNode+RuleDomain.RULE_SIGN_5, ruleNodeValue);
-            //如果堆栈节点配置不为空并且取值方式不是5,则把结果值压入堆栈
-            if(!StringUtils.isEmpty(ruleCondCfg.getData_stack_flag_prefix()) && !ruleCondCfg.getData_from_flag().equals("5")){
-                dataStackMap.put(ruleCondCfg.getData_stack_flag_prefix(),ruleNodeValue);
-            }
-            if(!StringUtils.isEmpty(ruleCondCfg.getIs_log()) && ruleCondCfg.getIs_log().equals(RuleDomain.RULE_IS_Y)){
-                ruleCommonCondStr += RuleDomain.RULE_SIGN_1+ruleNodeValue;
-            }
-            if(!StringUtils.isEmpty(ruleCondCfg.getError_code())){
-                if(((StringUtils.isEmpty(StringUtils.replace(ruleNodeValue, "''", ""))
-                        && (StringUtils.isEmpty(ruleCondCfg.getIs_reverse())
-                        || ruleCondCfg.getIs_reverse().equals(RuleDomain.RULE_IS_N)))
-                        || (!StringUtils.isEmpty(StringUtils.replace(ruleNodeValue, "''", ""))
-                        && !StringUtils.isEmpty(ruleCondCfg.getIs_reverse())
-                        && ruleCondCfg.getIs_reverse().equals(RuleDomain.RULE_IS_Y)))){
-                    returnMap.put("retCode", ruleCondCfg.getError_code());
-                    returnMap.put("retMsg", getErrorMsg(ruleCondCfg.getError_msg()));
-                    break;
-                }
-            }
-            if(!StringUtils.isEmpty(ruleCondCfg.getProc_param_flag())){
-                returnTreeMap.put(String.valueOf(i), ruleNodeValue);
-            }
-        }
-        //记录规则日志
-
-        String transactionID = reqJson.getJSONObject("TcpCont").getString("TransactionID");
-        saveRuleCommonCondLog(transactionID,ruleId,ruleCommonCondStr,returnMap);
-        if(!returnTreeMap.isEmpty()){
-            list.add(returnTreeMap);
-        }
-
-        return returnMap;
-    }
-
-
-    /**
-     * 获取值
-     * @param dataFromFlag
-     * @param ruleCondCfg
-     * @param ruleNodeValueTmp
-     * @param reqJson
-     * @return
-     * @throws Exception
-     */
-    public String getRuleNodeValue(String dataFromFlag,RuleCondCfg ruleCondCfg,String ruleNodeValueTmp,String reqJson) throws Exception{
-
-        if(dataFromFlag.equals("2")){//dbSql取值
-            //return getRuleNodeValueFromDbSQL(ruleCondCfg.getRuleNode(),getDbSQL(ruleCondCfg.getDbSql()));
-            String dbSql =getDbSQL(ruleCondCfg.getDb_sql());
-            try
-            {
-                return getRuleNodeValueFromDbSQL(ruleCondCfg.getRule_node(),dbSql);
-            }catch(Exception e)
-            {
-                logger.error("-------------[RuleServiceSMOImpl.getRuleNodeValue]-------------rule_id is "+ruleCondCfg.getRule_id()+" ,error sql is ="+dbSql);
-                throw e;
-            }
-        }else if(dataFromFlag.equals("3")){//常量
-            return ruleCondCfg.getDefault_value();
-        }else if(dataFromFlag.equals("4")){//取已有节点的值
-            return ruleNodeValueTmp;
-        }else if(dataFromFlag.equals("5")){//从堆栈中获取
-            return getRuleNodeValueFromDataStack(ruleCondCfg.getData_stack_flag_prefix());
-        }else if(dataFromFlag.equals("6")){//从XML中获取
-            return getRuleNodeValueFromJson(ruleCondCfg.getJpath(),reqJson);
-        }else{
-            return "";
-        }
-    }
-
-
-    public String getDbSQL(String dbSql)  throws Exception {
-        String exeDbSql = "";
-        String[] sqlArray = dbSql.split(RuleDomain.RULE_SIGN_5);
-        if (null != sqlArray && sqlArray.length > 1) {
-            String sqlStr = null;
-            int sqlLength = sqlArray.length;
-            if (0 == sqlLength % 2) {
-                if (!dbSql.endsWith(RuleDomain.RULE_SIGN_5)) {
-                    return "SQL语句配置错误,参数两边的#没有成对出现:SQL=" + dbSql;
-                }
-            }
-            for (int j = 0; j < sqlLength; j++) {
-                sqlStr = sqlArray[j];
-                if (0 != j % 2) {
-                    sqlStr = ruleNodeMap.get(RuleDomain.RULE_SIGN_5+sqlStr+RuleDomain.RULE_SIGN_5)==null?"":ruleNodeMap.get(RuleDomain.RULE_SIGN_5+sqlStr+RuleDomain.RULE_SIGN_5);
-                    if(!sqlStr.contains(RuleDomain.RULE_SIGN_3)){
-                        sqlStr = "'" + sqlStr + "'";
-                    }
-                } else {
-                    sqlStr = getDbSQL(sqlStr);
-                }
-                exeDbSql += sqlStr;
-            }
-            return exeDbSql;
-        }
-        return dbSql;
-    }
-
-
-    /**
-     * 根据sql获取值
-     * @param ruleNode
-     * @param dbSql
-     * @return
-     * @throws Exception
-     */
-    public String getRuleNodeValueFromDbSQL(String ruleNode,String dbSql)  throws Exception {
-        String columnStr = "";
-        String retVal = "";
-        String dbSqlStr = dbSql;
-        if(dbSql.startsWith(RuleDomain.RULE_SIGN_6)){
-            String dbSqlTmp = dbSql.split(RuleDomain.RULE_SIGN_6)[1];
-            if(dbSqlTmp.contains(RuleDomain.RULE_SIGN_8)){
-                String ruleNodeTmp = dbSqlTmp.split("\\"+RuleDomain.RULE_SIGN_8)[0];
-                String columnStrTmp = dbSqlTmp.split("\\"+RuleDomain.RULE_SIGN_8)[1];
-                List<Map<String,String>> dbList = ruleDbMap.get(ruleNodeTmp);
-                if(dbList != null && dbList.size() > 0){
-                    for(Map<String,String> dbMap : dbList){
-                        retVal += RuleDomain.RULE_SIGN_4 + RuleDomain.RULE_SIGN_3 + String.valueOf(dbMap.get(columnStrTmp.toUpperCase())) + RuleDomain.RULE_SIGN_3;
-                    }
-                    if(retVal.length() > 0){
-                        retVal = retVal.substring(1);
-                    }
-                }
-            }
-        }else{
-            if(dbSql.contains(RuleDomain.RULE_SIGN_7)){
-                if(dbSql.split(RuleDomain.RULE_SIGN_7).length > 1){
-                    columnStr = dbSql.split(RuleDomain.RULE_SIGN_7)[1].toUpperCase();
-                }
-                dbSqlStr = dbSql.split(RuleDomain.RULE_SIGN_7)[0];
-            }
-            List<Map<String,String>> dbList = ruleDaoImpl.executeSql(dbSqlStr);
-            if(dbList != null && dbList.size() > 0){
-                for(Map<String,String> dbMap : dbList){
-                    if(StringUtils.isEmpty(columnStr)){
-                        Object[] retAttr = dbMap.values().toArray();
-                        if(retAttr.length > 0){
-                            if(retAttr[0]!=null){
-                                retVal += RuleDomain.RULE_SIGN_4 + RuleDomain.RULE_SIGN_3 + retAttr[0].toString() + RuleDomain.RULE_SIGN_3;
-
-                            }
-                        }
-                    }else{
-                        retVal += RuleDomain.RULE_SIGN_4 + RuleDomain.RULE_SIGN_3 + String.valueOf(dbMap.get(columnStr)) + RuleDomain.RULE_SIGN_3;
-                    }
-                }
-                if(retVal.length() > 0){
-                    retVal = retVal.substring(1);
-                }
-                ruleDbMap.put(ruleNode, dbList);
-            }
-        }
-        return retVal;
-    }
-
-
-    //从堆栈中获取值
-    public String getRuleNodeValueFromDataStack(String dataStackFlagPrefix)  throws Exception {
-        String retVal = "";
-        if(!StringUtils.isEmpty(dataStackFlagPrefix) && !StringUtils.isEmpty(dataStackMap)){
-            retVal = dataStackMap.get(dataStackFlagPrefix);
-            if(retVal == null){
-                retVal = "";
-            }
-        }else{
-            return "";
-        }
-        return retVal;
-    }
-
-    //从json中获取值
-    public String getRuleNodeValueFromJson(String jPath,String reqJson)  throws Exception {
-        String retVal = "";
-        if (!StringUtils.isEmpty(jPath)) {
-            if(jPath.contains(RuleDomain.RULE_SIGN_5)){
-                String[] sooNodeXpathArray = jPath.split(RuleDomain.RULE_SIGN_5);
-                if (null != sooNodeXpathArray) {
-                    String sql3 = null;
-                    int sooNodeXpathArrayLength = sooNodeXpathArray.length;
-                    if (0 == sooNodeXpathArrayLength % 2) {
-                        if (!jPath.endsWith(RuleDomain.RULE_SIGN_5)) {
-                            return "规则配置错误,配置sooNodeXpath的#没有成对出现";
-                        }
-                    }
-                    String sooNodeParam = null;
-                    String sooNodevalue = null;
-                    for (int j = 0; j < sooNodeXpathArrayLength; j++) {
-                        sooNodeParam = RuleDomain.PART_STRING_ORIGINAL_VALUE;
-                        sooNodeParam = sooNodeXpathArray[j];
-                        if (0 != j % 2) {
-                            sooNodevalue = ruleNodeMap.get(RuleDomain.RULE_SIGN_5+sooNodeParam+RuleDomain.RULE_SIGN_5)==null?"":ruleNodeMap.get(RuleDomain.RULE_SIGN_5+sooNodeParam+RuleDomain.RULE_SIGN_5);
-                            sooNodevalue = sooNodevalue.contains("'")?sooNodevalue:"'"+sooNodevalue+"'";
-                            jPath = StringUtils.replace(jPath, RuleDomain.RULE_SIGN_5+sooNodeParam+RuleDomain.RULE_SIGN_5, sooNodevalue);
-                        }
-                    }
-                }
-            }
-            retVal = this.getNodeValueFromJson(jPath, reqJson);
-        }
-        return retVal;
-    }
-
-
-    /**
-     * 通过jpath 获取值
-     * @param jPath
-     * @param reqJson
-     * @return
-     */
-    private String getNodeValueFromJson(String jPath,String reqJson){
-        String nodeValue = "";
-        JSONObject reqJsonObject = null;
-        if (!StringUtils.isEmpty(reqJson)) {
-            try {
-                reqJsonObject = JSONObject.parseObject(reqJson);
-            } catch (Exception e) {
-                return "给出的报文格式存在错误,无法转换为JSON对象,具体原因为:" + e;
-            }
-            //报文中SOO对象的根节点
-            if (null != reqJsonObject) {
-                if (null != jPath && !"".equals(jPath)) {
-                    String[] array1 = jPath.split(RuleDomain.RULE_SIGN_9);
-                    int length1 = array1.length;
-                    if (0 < length1) {
-                        String sooNodeJpathTmp = null;
-                        for (int i = 0; i < length1; i++) {
-                            sooNodeJpathTmp = array1[i];
-                            if (null != sooNodeJpathTmp && !"".equals(sooNodeJpathTmp)) {
-                                if(!sooNodeJpathTmp.startsWith("$.")){
-                                    sooNodeJpathTmp = "$."+sooNodeJpathTmp;
-                                }
-                                Object valueObj = JSONPath.eval(reqJsonObject,sooNodeJpathTmp);
-                                if (null != valueObj && valueObj instanceof String) {
-                                    nodeValue = nodeValue + ",'" +valueObj + "'";
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return nodeValue.length()>0?nodeValue.substring(1):"";
-    }
-
-
-
-    /**
-     * 业务规则校验,调用存储过程
-     * @param
-     * @return
-     */
-    public String ruleAction(String transactionId, Rule rule,List<TreeMap<String,String>> paramList) throws Exception{
-        long allStartTime = System.currentTimeMillis();
-        java.sql.Timestamp startTime = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-
-        String procParam = "";
-        String ruleCode = RuleDomain.RULE_COND_RETURN_0000;
-        String ruleDesc = "";
-        for(TreeMap<String,String> paramMap : paramList){
-            procParam = "";
-            for(String paramStr : paramMap.values()){
-                if(StringUtils.isEmpty(paramStr)){
-                    paramStr = "''";
-                }
-                procParam +=  paramStr + RuleDomain.RULE_SIGN_1;
-            }
-            procParam = procParam.substring(0,procParam.length() - 2);
-            String actionRtn = ruleDaoImpl.executeProc(transactionId,procParam, rule.getRule_url());
-            if(!actionRtn.equals(ruleCode)){//校验不通过
-                ruleCode = RuleDomain.RULE_COND_RETURN_0002;
-                ruleDesc = actionRtn;
-                break;
-            }else{
-                ruleCode = actionRtn;
-            }
-        }
-
-        //记录耗时明细
-        recordCostTime(null,
-                System.currentTimeMillis()-allStartTime,
-                "LTE4G全量校验规则逻辑校验耗时[ruleId:"+rule.getRule_id()+"]",
-                2,
-                startTime,
-                new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-
-        if(ruleCode.equals(RuleDomain.RULE_COND_RETURN_0000)){//校验通过
-            return ruleCode;
-        }else{//校验失败
-            return RuleUtil.ruleReturnJson(transactionId,rule.getRule_code(),ruleDesc,"");
-        }
-
-    }
-
-    /**
-     * 业务规则条件
-     * @param contractRootRule
-     * @return
-     */
-    public String ruleCond(String ruleId,ContractRootRule contractRootRule) throws Exception{
-
-        long allStartTime = System.currentTimeMillis();
-        java.sql.Timestamp startTime = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-
-        String condReturnXml = "";
-        Map<String,Rule> ruleMap = ruleDaoImpl.getRuleMap();
-        Rule rule = ruleMap.get(ruleId);
-        if(!StringUtils.isEmpty(rule.getRule_url())){
-
-            List<TreeMap<String,String>> paramList = new ArrayList<TreeMap<String,String>>();
-            Class[] parameterTypes = {ContractRootRule.class,List.class};
-            Object[] args = {contractRootRule,paramList};
-
-            Object ruleService = SpringBeanInvoker.getBean("ruleService");
-            Method method = ruleService.getClass().getMethod(rule.getRule_url(), parameterTypes);
-            String condRtn =  (String)method.invoke(ruleService, args);
-            //记录耗时明细
-            recordCostTime(null,
-                    System.currentTimeMillis()-allStartTime,
-                    "LTE4G全量校验规则条件判断耗时[ruleId:"+ruleId+"]",
-                    2,
-                    startTime,
-                    new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-
-            if(!StringUtils.isEmpty(condRtn)){
-                if(condRtn.equals(RuleDomain.RULE_COND_RETURN_0000)){//校验通过
-                    condReturnXml = condRtn;
-                }else if(condRtn.equals(RuleDomain.RULE_COND_RETURN_0001)){//继续转存过校验
-                    //如果调用存过的参数为空,直接返回成功
-                    if(paramList.size() == 0 || !rule.getRule_type().contains(RuleDomain.RULE_TYPE_STORED_PROCEDURE)){
-                        return RuleDomain.RULE_COND_RETURN_0000;
-                    }
-                    condReturnXml = ruleAction(contractRootRule.getTcpCont().getTransactionId(),rule,paramList);
-                }else{//校验失败
-                    condReturnXml = RuleUtil.ruleReturnJson(contractRootRule.getTcpCont().getTransactionId(),rule.getRule_code(),condRtn,rule.getRule_level());
-                }
-            }
-        }
-
-        return condReturnXml;
-
-    }
-
-
-    public String getErrorMsg(String errorMsg)  throws Exception {
-        String exeErrorMsg = "";
-        String[] errorMsgArray = errorMsg.split(RuleDomain.RULE_SIGN_5);
-        if (null != errorMsgArray && errorMsgArray.length > 1) {
-            String errorMsg1 = null;
-            int errorMsgLength = errorMsgArray.length;
-            if (0 == errorMsgLength % 2) {
-                if (!errorMsg.endsWith(RuleDomain.RULE_SIGN_5)) {
-                    return "规则提示语配置错误,配置的#没有成对出现:errorMsg=" + errorMsg;
-                }
-            }
-            for (int j = 0; j < errorMsgLength; j++) {
-                errorMsg1 = errorMsgArray[j];
-                if (0 != j % 2) {
-                    errorMsg1 = ruleNodeMap.get(RuleDomain.RULE_SIGN_5+errorMsg1+RuleDomain.RULE_SIGN_5)==null?"":ruleNodeMap.get(RuleDomain.RULE_SIGN_5+errorMsg1+RuleDomain.RULE_SIGN_5);
-                } else {
-                    errorMsg1 = getErrorMsg(errorMsg1);
-                }
-                exeErrorMsg += errorMsg1;
-            }
-            return exeErrorMsg;
-        }
-        return errorMsg;
-    }
-
-    /**
-     * 为了多线程时可以用到这里我们中转一下
-     * @return
-     * @throws Exception
-     */
-    public Map<String,Rule> getRuleMap() throws Exception{
-       return ruleDaoImpl.getRuleMap();
-    }
-
-    public void saveRuleCommonCondLog(String transactionID,String ruleID,String ruleNodeValue,Map<String,String> returnMap)  throws Exception {
-       /* String retCode = returnMap.get("retCode");
-        String retMsg = returnMap.get("retMsg");
-        String retVal;
-        if(StringUtils.isBlank(retCode) || retCode.equals(RuleDomain.RULE_COND_RETURN_0000)){
-            retVal = RuleDomain.RULE_COND_RETURN_0000;
-        }else{
-            retVal = retMsg;
-        }
-        ruleNodeValue = StringUtils.isBlank(ruleNodeValue)?"":ruleNodeValue.substring(2);
-        Map<String,String> ruleCondMap = new HashMap<String,String>();
-        ruleCondMap.put("transactionID", transactionID);
-        ruleCondMap.put("ruleID", ruleID);
-        ruleCondMap.put("ruleNodeValue", ruleNodeValue);
-        ruleCondMap.put("retVal", retVal);
-        this.getRuleManageBmo().saveRuleCommonCondLog(ruleCondMap);*/
-    }
-
-
-    /**
-     * 记录耗时明细
-     * @param
-     * @return
-     */
-    @SuppressWarnings("unchecked")
-    public void recordCostTime(JSONObject reqJson,long costTime, String costDesc,int classFlag ,java.sql.Timestamp startTime,java.sql.Timestamp endTime){
-       /* try {
-            //判断是否开启了日志记录监控
-            if(PCrmDomain.WRITE_LOG_SWITCH_DCV.ON.value.equals(CodeMapUtil.getDynamicConstantValue(PCrmDomain.WRITE_COST_TIME_SWITCH_DCN))){
-                //这里统计最终的耗时,然后记录到监控表中
-                Map detailMap = new HashMap();
-                detailMap.put("TRANSACTION_ID", transactionId);
-                detailMap.put("COST_TIME", costTime);
-                detailMap.put("REMARK", costDesc);
-                detailMap.put("DO_WHAT", costDesc);
-                detailMap.put("CLASS_FLAG", classFlag);
-                detailMap.put("START_TIME", startTime);
-                detailMap.put("FINISH_TIME", endTime);
-
-                this.getCustManagerSearchBMO().insertCostTimeDetail(detailMap);
-            }
-        } catch (Exception e1) {
-            e1.printStackTrace();
-        }*/
-    }
-
-    public void init(){
-        this.setRuleCode("");
-        this.setRuleMsg("");
-        this.setRuleCondRtn("");
-    }
-
-
-    public String getRuleCode() {
-        return ruleCode;
-    }
-
-    public void setRuleCode(String ruleCode) {
-        this.ruleCode = ruleCode;
-    }
-
-    public String getRuleMsg() {
-        return ruleMsg;
-    }
-
-    public void setRuleMsg(String ruleMsg) {
-        this.ruleMsg = ruleMsg;
-    }
-
-    public String getRuleCondRtn() {
-        return ruleCondRtn;
-    }
-
-    public void setRuleCondRtn(String ruleCondRtn) {
-        this.ruleCondRtn = ruleCondRtn;
-    }
-
-    public IRuleDao getRuleDaoImpl() {
-        return ruleDaoImpl;
-    }
-
-    public void setRuleDaoImpl(IRuleDao ruleDaoImpl) {
-        this.ruleDaoImpl = ruleDaoImpl;
-    }
-}

+ 0 - 49
service-rule/src/main/java/com/java110/rule/dao/IRuleDao.java

@@ -1,49 +0,0 @@
-package com.java110.rule.dao;
-
-import com.java110.entity.rule.Rule;
-import com.java110.entity.rule.RuleEntrance;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by wuxw on 2017/7/23.
- */
-public interface IRuleDao {
-
-
-    /**
-     * 执行 sql
-     * @param sql
-     * @return
-     * @throws Exception
-     */
-    public List<Map<String,String>> executeSql(String sql) throws Exception;
-
-
-    public String executeProc(String transactionId,String paramIn,String procName) throws Exception;
-
-
-    /**
-     *  查询Rule_Entrance
-     * @return
-     * @throws Exception
-     */
-    public Map<String,RuleEntrance> getRuleEntranceMap() throws Exception;
-
-
-    /**
-     * 查询规则组关系信息
-     * @return
-     * @throws Exception
-     */
-    public  List getRuleGroupRelaList() throws Exception;
-
-
-    /**
-     * 查询规则信息
-     * @return
-     * @throws Exception
-     */
-    public Map<String, Rule> getRuleMap() throws Exception;
-}

+ 0 - 204
service-rule/src/main/java/com/java110/rule/dao/impl/RuleDaoImpl.java

@@ -1,204 +0,0 @@
-package com.java110.rule.dao.impl;
-
-import com.java110.utils.constant.RuleDomain;
-import com.java110.utils.util.SerializeUtil;
-import com.java110.core.base.dao.BaseServiceDao;
-import com.java110.entity.rule.Rule;
-import com.java110.entity.rule.RuleCondCfg;
-import com.java110.entity.rule.RuleEntrance;
-import com.java110.rule.dao.IRuleDao;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.StringUtils;
-import redis.clients.jedis.Jedis;
-
-import java.util.*;
-
-/**
- * Created by wuxw on 2017/7/23.
- */
-
-@Service("ruleDaoImpl")
-@Transactional
-public class RuleDaoImpl extends BaseServiceDao implements IRuleDao {
-    private final static Logger logger = LoggerFactory.getLogger(RuleDaoImpl.class);
-
-
-    @Override
-    public List<Map<String, String>> executeSql(String sql) throws Exception {
-        return sqlSessionTemplate.selectList("ruleDaoImpl.executeSql",sql);
-    }
-
-    /**
-     *
-     * @param transactionId
-     * @param paramIn
-     * @param procName
-     * @return
-     * @throws Exception
-     */
-    @Override
-    public String executeProc(String transactionId, String paramIn, String procName) throws Exception {
-
-        Map<String,String> paramInMap = new HashMap<String,String>();
-        paramInMap.put("transactionId",transactionId);
-
-        paramInMap.put("procName",procName);
-
-        paramInMap.put("paramIn",paramIn);
-
-        long updateFlag = sqlSessionTemplate.update("ruleDaoImpl.executeProc",paramInMap);
-
-        if (updateFlag > 0){
-            return paramInMap.get("paramOut");
-        }
-        return null;
-    }
-
-    /**
-     * 查询 rule_entrance表信息
-     *
-     * 这里逻辑,首先从ehCache 中获取数据,如果没有缓存,则校验redis中是否存在,如果不存在从数据库中查询,然后保存至redis中,
-     * 自动缓存到ehcache 中(默认是10分钟)
-     * @return
-     * @throws Exception
-     */
-    @Override
-    @Cacheable(key=RuleDomain.REDIS_KEY_RULE_ENTRANCE)
-    public Map<String, RuleEntrance> getRuleEntranceMap() throws Exception {
-
-        Jedis jedis = getJedis();
-
-        Map map = new HashMap();
-
-        List<RuleEntrance> list = null;
-
-        if(jedis.exists(RuleDomain.REDIS_KEY_RULE_ENTRANCE.getBytes())){
-            list =  SerializeUtil.unserializeList(jedis.get(RuleDomain.REDIS_KEY_RULE_ENTRANCE.getBytes()),RuleEntrance.class);
-        }else{
-            list = sqlSessionTemplate.selectList("ruleDaoImpl.getRuleEntranceMap");
-            //将 数据缓存至redis中
-
-            jedis.set(RuleDomain.REDIS_KEY_RULE_ENTRANCE.getBytes(),SerializeUtil.serializeList(list));
-        }
-
-        if (null != list && !list.isEmpty()) {
-            RuleEntrance ruleEntrance = null;
-            for (int ruleEntranceIndex = 0;ruleEntranceIndex< list.size();ruleEntranceIndex++) {
-                ruleEntrance =  list.get(ruleEntranceIndex);
-                map.put(String.valueOf(ruleEntranceIndex), ruleEntrance);
-            }
-        }
-        return map;
-    }
-
-    /**
-     * 初始化业务规则分组和编码映射关联关系信息
-     * @return
-     * @throws Exception
-     */
-    @Override
-    @Cacheable(key=RuleDomain.REDIS_KEY_RULE_GROUP)
-    public List getRuleGroupRelaList() throws Exception {
-        List saopRuleGroupRelaList = new ArrayList();
-
-        Jedis jedis = getJedis();
-
-        if(jedis.exists(RuleDomain.REDIS_KEY_RULE_ENTRANCE.getBytes())){
-            saopRuleGroupRelaList =  SerializeUtil.unserializeList(jedis.get(RuleDomain.REDIS_KEY_RULE_GROUP.getBytes()),Map.class);
-        }else {
-            //查询全部业务规则分组信息
-            List allSaopRuleGroupInfoList = sqlSessionTemplate.selectList("ruleDaoImpl.querySaopRuleGroupMap");
-
-            //业务分组和编码映射关系集合
-            List allsaopRuleGroupRelaInfoList = sqlSessionTemplate.selectList("ruleDaoImpl.querySaopRuleGroupRelaMap");
-
-            int allSaopRuleGroupInfoListSize = allSaopRuleGroupInfoList.size();
-            int allsaopRuleGroupRelaInfoListSize = allsaopRuleGroupRelaInfoList.size();
-
-            if (allSaopRuleGroupInfoListSize > 0 && allsaopRuleGroupRelaInfoListSize > 0) {
-                for (int i = 0; i < allSaopRuleGroupInfoListSize; i++) {
-                    //每个业务规则分组项
-                    Map saopRuleGroupMap = (Map) allSaopRuleGroupInfoList.get(i);
-                    if (null == saopRuleGroupMap || null == saopRuleGroupMap.get("groupId")) {
-                        continue;
-                    }
-
-                    //当前规则分组编码
-                    String curRuleGroupId = String.valueOf(saopRuleGroupMap.get("groupId"));
-
-                    //当前业务规则分组下的规则编码集合
-                    List ruleIdList = new ArrayList();
-                    saopRuleGroupMap.put("ruleIdList", ruleIdList);
-
-                    for (int j = 0; j < allsaopRuleGroupRelaInfoListSize; j++) {
-                        Map saopRuleGroupRelaMap = (Map) allsaopRuleGroupRelaInfoList.get(j);
-                        if (null == saopRuleGroupRelaMap || null == saopRuleGroupRelaMap.get("groupId")) {
-                            continue;
-                        }
-
-                        //当前规则分组编码
-                        String ruleRelaGroupId = String.valueOf(saopRuleGroupRelaMap.get("groupId"));
-
-                        if (curRuleGroupId.equals(ruleRelaGroupId)) {
-                            //获取规则编码
-                            String ruleId = "";
-                            if (null != saopRuleGroupRelaMap.get("rule_id")) {
-                                ruleId = String.valueOf(saopRuleGroupRelaMap.get("rule_id"));
-                            }
-
-                            if (!StringUtils.isEmpty(ruleId)) {
-                                ruleIdList.add(ruleId);
-                            }
-                        }
-                    }
-                }
-
-                saopRuleGroupRelaList = allSaopRuleGroupInfoList;
-
-                jedis.set(RuleDomain.REDIS_KEY_RULE_ENTRANCE.getBytes(),SerializeUtil.serializeList(saopRuleGroupRelaList));
-            }
-        }
-
-
-        return saopRuleGroupRelaList;
-    }
-
-    @Override
-    @Cacheable(key=RuleDomain.REDIS_KEY_RULE)
-    public Map<String, Rule> getRuleMap() throws Exception {
-
-        Jedis jedis = getJedis();
-
-        List<Rule> ruleList = null;
-
-        Map map = new HashMap();
-
-        if(jedis.exists(RuleDomain.REDIS_KEY_RULE.getBytes())){
-            ruleList =  SerializeUtil.unserializeList(jedis.get(RuleDomain.REDIS_KEY_RULE.getBytes()),Rule.class);
-        }else{
-            ruleList = sqlSessionTemplate.selectList("ruleDaoImpl.queryRule");
-            for (Rule rule : ruleList) {
-                String ruleId = rule.getRule_id();
-                List<RuleCondCfg> ruleCondCfgList = sqlSessionTemplate.selectList("ruleDaoImpl.queryRuleCondCfg", ruleId);
-                rule.setRuleCondCfgs(ruleCondCfgList);
-            }
-            //将 数据缓存至redis中
-
-            jedis.set(RuleDomain.REDIS_KEY_RULE.getBytes(),SerializeUtil.serializeList(ruleList));
-        }
-
-        if (null != ruleList && !ruleList.isEmpty()) {
-            Rule rule = null;
-            for (Iterator i = ruleList.iterator(); i.hasNext();) {
-                rule = (Rule) i.next();
-                map.put(rule.getRule_id(), rule);
-            }
-        }
-
-        return map;
-    }
-}

+ 0 - 98
service-rule/src/main/java/com/java110/rule/rest/RuleServiceRest.java

@@ -1,98 +0,0 @@
-package com.java110.rule.rest;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.RuleDomain;
-import com.java110.utils.log.LoggerEngine;
-import com.java110.utils.util.CodeMapUtil;
-import com.java110.utils.util.RuleUtil;
-import com.java110.core.base.controller.BaseController;
-import com.java110.rule.smo.IRuleServiceSMO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 规则服务
- * Created by wuxw on 2017/7/22.
- */
-@RestController
-public class RuleServiceRest extends BaseController {
-    private final static Logger logger = LoggerFactory.getLogger(RuleServiceRest.class);
-
-
-    @Autowired
-    IRuleServiceSMO ruleServiceSMOImpl;
-
-    /**
-     * 规则校验方法
-     * 请求报文协议:
-     *
-     * {
-     "ContractRoot": {
-     "TcpCont": { -- 请求头部
-     "RuleType":"RULE0001", -- 用来区分走那个规则组
-     "ServiceCode": "SVC0001", -- 用来判断走那些规则
-     "TransactionID": "1001000101201603081234567890", -- 交易流水
-     "ReqTime": "20130817200202123",--请求时间
-     },
-     "SvcCont": { -- 请求体 这里面的结构可以随便定
-     "AccNbr": "",
-     "ProductNbr":"",
-     "RegionCode":"863000"
-     }
-     }
-     }
-     *
-     * @param validateInfo
-     * @return
-     */
-    @RequestMapping("/ruleService/validate")
-    @ResponseBody
-    public String validate(@RequestParam("validateInfo") String validateInfo){
-        String resultInfo = "";
-        logger.debug("----------[RuleServiceRest.validate]-----------请求报文:" + validateInfo);
-        try{
-            resultInfo = ruleServiceSMOImpl.validate(validateInfo);
-        }catch (Exception e){
-            LoggerEngine.error("----------[RuleServiceRest.validate]-----------出现异常,请求报文为["+validateInfo+"]" ,e);
-            try {
-                //XStream转换出错,默认返回成功,后台记录错误日志
-                JSONObject jsonObject = JSONObject.parseObject(validateInfo);
-                String transactionID = jsonObject.containsKey("TcpCont") ?
-                        (jsonObject.getJSONObject("TcpCont").containsKey("TransactionID")?jsonObject.getJSONObject("TcpCont").getString("TransactionID"):"-1")
-                        :"-1";
-                String error =  e.toString();
-                //记录错误日志
-                //recordRuleLog(transactionID,error,"LTE4G全量校验报文转换环节异常");
-                //动态常量DEP_PRVNC_RULE_ERROR_RET,不配置或配置不是1,则程序异常默认返回成功,其他返回具体异常信息
-                String depPrvncSaopRuleErrorRet = CodeMapUtil.getDynamicConstantValue("DEP_PRVNC_RULE_ERROR_RET");
-                if(StringUtils.isEmpty(depPrvncSaopRuleErrorRet) || !depPrvncSaopRuleErrorRet.equals("1")){
-                    resultInfo = RuleUtil.ruleReturnJson(transactionID,RuleDomain.RULE_COND_RETURN_0000,"成功","");
-                }else{
-                    resultInfo = RuleUtil.ruleReturnJson(transactionID,RuleDomain.RULE_COND_RETURN_1999,e.getMessage(),"");
-                }
-            } catch (Exception e1) {
-                LoggerEngine.error("----------[RuleServiceRest.validate]-----------出现异常,请求报文为["+validateInfo+"]" ,e);
-                resultInfo = RuleUtil.ruleReturnJson("-1",RuleDomain.RULE_COND_RETURN_1999,e.getMessage(),"");
-            }
-        }finally {
-            //这里需要记录日志报文
-            logger.debug("----------[RuleServiceRest.validate]-----------返回报文:" + resultInfo);
-            return resultInfo;
-        }
-    }
-
-
-    public IRuleServiceSMO getRuleServiceSMOImpl() {
-        return ruleServiceSMOImpl;
-    }
-
-    public void setRuleServiceSMOImpl(IRuleServiceSMO ruleServiceSMOImpl) {
-        this.ruleServiceSMOImpl = ruleServiceSMOImpl;
-    }
-}

+ 0 - 15
service-rule/src/main/java/com/java110/rule/service/RuleService.java

@@ -1,15 +0,0 @@
-package com.java110.rule.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * Created by wuxw on 2017/7/23.
- */
-
-@Component("ruleService")
-public class RuleService {
-    private final static Logger logger = LoggerFactory.getLogger(RuleService.class);
-
-}

+ 0 - 16
service-rule/src/main/java/com/java110/rule/smo/IRuleServiceSMO.java

@@ -1,16 +0,0 @@
-package com.java110.rule.smo;
-
-/**
- * 规则服务接口类
- * Created by wuxw on 2017/7/23.
- */
-public interface IRuleServiceSMO {
-
-    /**
-     * 校验方法
-     * @param validateInfo
-     * @return
-     * @throws Exception
-     */
-    public String validate(String validateInfo) throws Exception;
-}

+ 0 - 270
service-rule/src/main/java/com/java110/rule/smo/impl/RuleServiceSMOImpl.java

@@ -1,270 +0,0 @@
-package com.java110.rule.smo.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.JSONPath;
-import com.java110.utils.constant.RuleDomain;
-import com.java110.utils.util.CodeMapUtil;
-import com.java110.utils.util.RuleUtil;
-import com.java110.core.base.smo.BaseServiceSMO;
-import com.java110.entity.rule.ContractRootRule;
-import com.java110.entity.rule.Rule;
-import com.java110.entity.rule.RuleEntrance;
-import com.java110.entity.rule.TcpContRule;
-import com.java110.rule.common.RuleCommon;
-import com.java110.rule.dao.IRuleDao;
-import com.java110.rule.smo.IRuleServiceSMO;
-import com.java110.rule.thread.RuleCommonThread;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * 规则服务实现类
- * Created by wuxw on 2017/7/23.
- */
-@Service("ruleServiceSMOImpl")
-public class RuleServiceSMOImpl extends BaseServiceSMO implements IRuleServiceSMO {
-    private final static Logger logger = LoggerFactory.getLogger(RuleServiceSMOImpl.class);
-
-
-    public static DateFormat df = new SimpleDateFormat("yyyyMMddHHmmSSS");
-
-
-
-    @Autowired
-    RuleCommon ruleCommon;
-
-    @Autowired
-    IRuleDao ruleDaoImpl;
-
-
-
-
-    /**
-     * 校验方法
-     *
-     * 请求协议:
-     * {
-     "ContractRoot": {
-     "TcpCont": { -- 请求头部
-     "RuleType":"RULE0001", -- 用来区分走那个规则组
-     "ServiceCode": "SVC0001", -- 用来判断走那些规则
-     "TransactionID": "1001000101201603081234567890", -- 交易流水
-     "ReqTime": "20130817200202123",--请求时间
-     },
-     "SvcCont": { -- 请求体 这里面的结构可以随便定
-     "AccNbr": "",
-     "ProductNbr":"",
-     "RegionCode":"863000"
-     }
-     }
-     }
-     * @param validateInfo
-     * @return
-     * @throws Exception
-     */
-    @Override
-    public String validate(String validateInfo) throws Exception {
-
-        JSONObject validateInfoJson = JSONObject.parseObject(validateInfo);
-        ContractRootRule contractRootRule = new ContractRootRule();
-
-        try {
-            TcpContRule reqTcpCont = JSONObject.parseObject(validateInfoJson.getJSONObject("TcpCont").toJSONString(), TcpContRule.class);
-            JSONObject reqSvcCont = validateInfoJson.getJSONObject("SvcCont");
-            contractRootRule.setTcpCont(reqTcpCont);
-            contractRootRule.setSvcCont(reqSvcCont);
-        }catch (Exception e){
-            //说明报文不是按协议来的,我们也需要支撑,所以这里补充数据,以免后续流程异常,流程继续往下走
-            TcpContRule reqTcpCont = new TcpContRule();
-            reqTcpCont.setTransactionId("-1");
-            reqTcpCont.setServiceCode(RuleDomain.RULE_SERVICE_CODE_DEFAULT);
-            reqTcpCont.setRuleType(RuleDomain.RULE_TYPE_DEFAULT);
-            reqTcpCont.setReqTime(df.format(new Date()));
-            contractRootRule.setTcpCont(reqTcpCont);
-            contractRootRule.setSvcCont(validateInfoJson);
-        }
-
-        return  ruleCommon(contractRootRule,validateInfoJson);
-    }
-
-
-
-
-    /**
-     * 业务规则校验实体转换
-     * @param reqJson
-     * @return
-     */
-    public String ruleCommon(ContractRootRule contractRootRule,JSONObject reqJson) throws Exception{
-            java.sql.Timestamp startTime = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-            long allStartTime = System.currentTimeMillis();
-
-            //调用规则校验
-            String ruleResult =  ruleEntrance(contractRootRule,reqJson);
-
-            //记录耗时明细
-            ruleCommon.recordCostTime(reqJson,
-                    System.currentTimeMillis()-allStartTime,
-                    "LTE4G全量规则校验总耗时",
-                    1,
-                    startTime,
-                    new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-
-            return ruleResult;
-        }
-
-
-    /**
-     * 业务规则入口
-     * @param contractRootRule
-     * @return
-     */
-    public String ruleEntrance(ContractRootRule contractRootRule,JSONObject reqJson) throws Exception{
-        long ruleEntranceStartTime = System.currentTimeMillis();
-        java.sql.Timestamp ruleEntranceStart = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-        String transactionId = contractRootRule.getTcpCont().getTransactionId();
-
-        String roamFlag = RuleDomain.RULE_COND_RETURN_0000;
-            String depPrvncSaopRuleType = CodeMapUtil.getDynamicConstantValue("DEP_PRVNC_RULE_TYPE");
-            //获取表 Rule_Entrance 数据
-            Map<String,RuleEntrance> ruleEntranceMap = ruleDaoImpl.getRuleEntranceMap();
-            int ruleCount = 0;
-            this.ruleCommon.init();
-
-            //当前分组下的规则编码集合
-            List ruleIdsInCurGroupList = RuleUtil.getRuleIdsInGroupByJson(reqJson.toJSONString(),ruleDaoImpl.getRuleGroupRelaList());
-
-            //耗时明细信息集合
-            List costTimeMapList = new ArrayList();
-
-            List<String> ruleList = new ArrayList<String>();
-            //记录耗时明细-耗时明细信息
-            Map ruleEntranceDetailMap = new HashMap();
-            ruleEntranceDetailMap.put("TRANSACTION_ID", contractRootRule.getTcpCont().getTransactionId());
-            ruleEntranceDetailMap.put("COST_TIME", System.currentTimeMillis()-ruleEntranceStartTime);
-            ruleEntranceDetailMap.put("REMARK", "LTE4G全量校验规则对象转换耗时");
-            ruleEntranceDetailMap.put("DO_WHAT", "LTE4G全量校验规则对象转换耗时");
-            ruleEntranceDetailMap.put("CLASS_FLAG", 2);
-            ruleEntranceDetailMap.put("START_TIME", ruleEntranceStart);
-            ruleEntranceDetailMap.put("FINISH_TIME", new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-            costTimeMapList.add(ruleEntranceDetailMap);
-            for (RuleEntrance ruleEntrance : ruleEntranceMap.values()) {
-                //add begin by dongchao 对业务规则校验增加分组逻辑 2015/6/6
-                if(!ruleIdsInCurGroupList.contains(ruleEntrance.getRule_id()))
-                {
-                    continue;
-                }
-                long allStartTime = System.currentTimeMillis();
-                java.sql.Timestamp startTime = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
-
-                String ruleCondition = ruleEntrance.getRule_condition();
-
-                //BO_ACTION_TYPE入口检查
-                if(!StringUtils.isEmpty(ruleCondition)){
-                    if(!ruleCondition(ruleEntrance,reqJson)){
-                        continue;
-                    }
-                }
-
-                //记录耗时明细-耗时明细信息
-                Map detailMap = new HashMap();
-                detailMap.put("TRANSACTION_ID", contractRootRule.getTcpCont().getTransactionId());
-                detailMap.put("COST_TIME", System.currentTimeMillis()-allStartTime);
-                detailMap.put("REMARK", "LTE4G全量校验规则入口判断耗时[ruleId:"+ruleEntrance.getRule_id()+"]");
-                detailMap.put("DO_WHAT", "LTE4G全量校验规则入口判断耗时[ruleId:"+ruleEntrance.getRule_id()+"]");
-                detailMap.put("CLASS_FLAG", 2);
-                detailMap.put("START_TIME", startTime);
-                detailMap.put("FINISH_TIME", new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
-                costTimeMapList.add(detailMap);
-
-                //调用规则条件
-                if(StringUtils.isEmpty(depPrvncSaopRuleType) || !depPrvncSaopRuleType.equals("1")){//不配置或配置不是1 为多线程并发调用模式
-                    ruleCount ++;
-                    ruleList.add(ruleEntrance.getRule_id());
-                }else{//配置1为单线程串行调用模式
-                    Rule rule = ruleDaoImpl.getRuleMap().get(ruleEntrance.getRule_id());
-                    String url = rule.getRule_url();
-                    String entranceRetrunXml = "";
-                    if(!StringUtils.isEmpty(url)){
-                        if(rule.getRule_type().contains(RuleDomain.RULE_TYPE_COND_CFG)){
-                            entranceRetrunXml = ruleCommon.ruleCommonCondMed(ruleEntrance.getRule_id(),contractRootRule,reqJson);
-                        }else{
-                            entranceRetrunXml = ruleCommon.ruleCond(ruleEntrance.getRule_id(),contractRootRule);
-                        }
-
-                    }
-
-                    if(!StringUtils.isEmpty(entranceRetrunXml) && !entranceRetrunXml.equals(RuleDomain.RULE_COND_RETURN_0000)){
-                         //校验失败
-                         //校验失败返回
-                         return entranceRetrunXml;
-                    }
-                }
-            }
-
-            if((StringUtils.isEmpty(depPrvncSaopRuleType) || !depPrvncSaopRuleType.equals("1")) && ruleCount > 0){//不配置或配置不是1 为多线程并发调用模式
-                RuleCommonThread ruleCommonThread = new RuleCommonThread(ruleCommon,"",contractRootRule,reqJson,ruleCount,ruleList);
-                roamFlag = ruleCommonThread.getRuleRst();
-                //关闭线程池
-                ruleCommonThread.shutdownThreadPool();
-            }
-
-            //校验成功返回
-            if(!roamFlag.equals(RuleDomain.RULE_COND_RETURN_0000)){
-                //国漫免预存返回报文-特殊
-                return RuleUtil.ruleReturnJson(transactionId,RuleDomain.RULE_COND_RETURN_1999,roamFlag,"");
-            }else{
-                String serviceCode = contractRootRule.getTcpCont().getServiceCode();
-                return RuleUtil.ruleReturnJson(transactionId,RuleDomain.RULE_COND_RETURN_0000,"成功","");
-
-            }
-
-    }
-
-    /**
-     * 业务规则入口检查[Rule_condition]
-     * @param ruleEntrance,reqJson
-     * @return
-     */
-    public boolean ruleCondition(RuleEntrance ruleEntrance,JSONObject reqJson){
-        try {
-
-            String ruleCondition = ruleEntrance.getRule_condition();
-
-            JSONPath.eval(reqJson,ruleCondition);
-            //ruleCondition 入口检查
-            if(!StringUtils.isEmpty(JSONPath.eval(reqJson,ruleCondition))){
-                return true;
-            }
-
-        }catch (Exception e) {
-            logger.error("----------[RuleServiceSMOImpl.ruleCondition]-----------条件判断异常:规则条件为 "
-                    +JSONObject.toJSONString(ruleEntrance)+",请求报文为 "+reqJson);
-        }
-        return false;
-    }
-
-
-    public RuleCommon getRuleCommon() {
-        return ruleCommon;
-    }
-
-    public void setRuleCommon(RuleCommon ruleCommon) {
-        this.ruleCommon = ruleCommon;
-    }
-
-    public IRuleDao getRuleDaoImpl() {
-        return ruleDaoImpl;
-    }
-
-    public void setRuleDaoImpl(IRuleDao ruleDaoImpl) {
-        this.ruleDaoImpl = ruleDaoImpl;
-    }
-}

+ 0 - 161
service-rule/src/main/java/com/java110/rule/thread/RuleCommonThread.java

@@ -1,161 +0,0 @@
-package com.java110.rule.thread;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.RuleDomain;
-import com.java110.utils.log.LoggerEngine;
-import com.java110.utils.util.CodeMapUtil;
-import com.java110.entity.rule.ContractRootRule;
-import com.java110.entity.rule.Rule;
-import com.java110.rule.common.RuleCommon;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.StringUtils;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.*;
-
-/**
- * Created by wuxw on 2017/7/23.
- */
-public class RuleCommonThread extends LoggerEngine{
-
-    private final static Logger logger = LoggerFactory.getLogger(RuleCommonThread.class);
-
-    private RuleCommon ruleCommon;
-
-    private String ruleId;
-    private JSONObject reqJson;
-    private ContractRootRule contractRootRule;
-    private int threadNum;
-    private ExecutorService rulethreadPool;
-
-    private CompletionService<String> ruleCompletionService;
-
-    public RuleCommonThread(RuleCommon ruleCommon, String ruleId,
-                            ContractRootRule contractRootRule,JSONObject reqJson,int threadNum,List<String> ruleList){
-//		super();
-        this.ruleCommon = ruleCommon;
-        this.ruleId = ruleId;
-        this.contractRootRule = contractRootRule;
-        this.reqJson = reqJson;
-        this.threadNum = threadNum;
-//		this.start();
-        this.ruleCurThread(ruleList);
-    }
-
-    //启动校验线程
-    public void ruleCurThread(List<String> ruleList){
-        rulethreadPool = Executors.newFixedThreadPool(threadNum);
-        ruleCompletionService = new ExecutorCompletionService<String>(rulethreadPool);
-        //往线程池里面加入线程对象
-        for(final String ruleIdStr : ruleList){
-            ruleCompletionService.submit(new Callable<String>(){
-                public String call() throws Exception{
-                    try {
-                        Map<String,Rule> ruleMap = ruleCommon.getRuleMap();
-                        Rule rule = ruleMap.get(ruleIdStr);
-                        String url = rule.getRule_url();
-                        String condRtn = "";
-                        if(!StringUtils.isEmpty(url)){
-                            if(rule.getRule_type().contains(RuleDomain.RULE_TYPE_COND_CFG)){
-                                condRtn = ruleCommon.ruleCommonCondMed(ruleIdStr,contractRootRule,reqJson);
-                            }else{
-                                condRtn = ruleCommon.ruleCond(ruleIdStr,contractRootRule);
-                            }
-                        }
-                        if(!StringUtils.isEmpty(condRtn)){
-                            return condRtn;
-                        }else{
-                            //默认返回成功
-                            return RuleDomain.RULE_COND_RETURN_0000;
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        //动态常量DEP_PRVNC_RULE_ERROR_RET,不配置或配置不是1,则程序异常默认返回成功,其他返回具体异常信息
-                        String depPrvncSaopRuleErrorRet = CodeMapUtil.getDynamicConstantValue("DEP_PRVNC_RULE_ERROR_RET");
-                        if(StringUtils.isEmpty(depPrvncSaopRuleErrorRet) || !depPrvncSaopRuleErrorRet.equals("1")){
-                            return RuleDomain.RULE_COND_RETURN_0000;
-                        }else{
-                            return "LTE4G全量校验规则条件判断环节异常[ruleId:"+ruleIdStr+"]:"+e.getMessage();
-                        }
-                    }
-                }
-            });
-        }
-    }
-
-    //获取执行结果
-    public String getRuleRst(){
-        String retStr = RuleDomain.RULE_COND_RETURN_0000;
-        for(int i=0; i<this.threadNum; i++){
-            //检索并移除表示下一个已完成任务的 Future,如果目前不存在这样的任务,则等待。
-            try {
-                String ruleRst = ruleCompletionService.take().get();
-                if(RuleDomain.RULE_COND_RETURN_0000.equals(ruleRst)){//校验成功
-
-                }else if(RuleDomain.RULE_COND_RETURN_0003.equals(ruleRst)
-                        || RuleDomain.RULE_COND_RETURN_0004.equals(ruleRst)){//国漫预存款校验
-                    retStr = ruleRst;
-                }else{//校验失败
-                    return ruleRst;
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-                //动态常量DEP_PRVNC_RULE_ERROR_RET,不配置或配置不是1,则程序异常默认返回成功,其他返回具体异常信息
-                String depPrvncSaopRuleErrorRet = CodeMapUtil.getDynamicConstantValue("DEP_PRVNC_RULE_ERROR_RET");
-                if(StringUtils.isEmpty(depPrvncSaopRuleErrorRet) || !depPrvncSaopRuleErrorRet.equals("1")){
-
-                }else{
-                    return "LTE4G全量校验规则条件判断环节异常:"+e.getMessage();
-                }
-            }
-        }
-        return retStr;
-    }
-
-    //关闭线程池
-    public void shutdownThreadPool(){
-        rulethreadPool.shutdown();
-    }
-
-    public void run() {
-        Rule rule = null;
-        try{
-            Map<String,Rule> ruleMap = ruleCommon.getRuleMap();
-            rule = ruleMap.get(ruleId);
-            String url = rule.getRule_url();
-            String condRtn = "";
-            if(!StringUtils.isEmpty(url)){
-                if(rule.getRule_type().contains(RuleDomain.RULE_TYPE_COND_CFG)){
-                    condRtn = this.ruleCommon.ruleCommonCondMed(ruleId,contractRootRule,this.reqJson);
-                }else{
-                    condRtn = this.ruleCommon.ruleCond(ruleId,contractRootRule);
-                }
-            }
-
-            if(!StringUtils.isEmpty(condRtn)){
-                if(condRtn.equals(RuleDomain.RULE_COND_RETURN_0000)){//成功
-                    this.ruleCommon.setRuleCondRtn(this.ruleCommon.getRuleCondRtn()+"0,");
-                }else{//失败
-                    this.ruleCommon.setRuleCode(RuleDomain.RULE_COND_RETURN_1999);
-                    this.ruleCommon.setRuleMsg(condRtn);
-                    this.ruleCommon.setRuleCondRtn(this.ruleCommon.getRuleCondRtn()+"1,");
-
-                }
-            }else{
-                this.ruleCommon.setRuleCondRtn(this.ruleCommon.getRuleCondRtn()+"0,");//默认成功
-            }
-        } catch (Exception e) {
-            logger.error("校验异常",e);
-            this.ruleCommon.setRuleCondRtn(this.ruleCommon.getRuleCondRtn()+"0,");//默认成功
-            /*try {
-                //记录错误日志
-                this.ruleCommon.recordRuleLog(rule,e.getMessage(),"LTE4G全量校验规则条件判断环节异常[ruleId:"+ruleId+"]");
-
-            } catch (Exception e1) {
-                e1.printStackTrace();
-            }*/
-        }
-    }
-}

+ 0 - 38
service-rule/src/test/java/com/java110/AppTest.java

@@ -1,38 +0,0 @@
-package com.java110;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest 
-    extends TestCase
-{
-    /**
-     * Create the test case
-     *
-     * @param testName name of the test case
-     */
-    public AppTest( String testName )
-    {
-        super( testName );
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite( AppTest.class );
-    }
-
-    /**
-     * Rigourous Test :-)
-     */
-    public void testApp()
-    {
-        assertTrue( true );
-    }
-}