Quellcode durchsuchen

加入供应链服务

wuxw vor 3 Jahren
Ursprung
Commit
79097d767f

+ 22 - 0
java110-boot/src/main/java/com/java110/scm/ScmServiceApplicationStart.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.scm;
+
+
+public class ScmServiceApplicationStart {
+
+
+}

+ 1 - 0
pom.xml

@@ -31,6 +31,7 @@
         <module>springboot</module>
         <module>java110-boot</module>
         <module>java110-doc</module>
+        <module>service-scm</module>
 
     </modules>
 

+ 28 - 0
service-scm/pom-boot.xml

@@ -0,0 +1,28 @@
+<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-scm</artifactId>
+    <packaging>jar</packaging>
+
+    <name>service-scm</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>
+
+    </dependencies>
+</project>

+ 71 - 0
service-scm/pom-cloud.xml

@@ -0,0 +1,71 @@
+<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-scm</artifactId>
+    <packaging>jar</packaging>
+
+    <name>service-scm</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>
+
+
+
+    </dependencies>
+
+    <build>
+        <finalName>service-scm</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.scm.ScmServiceApplicationStart</mainClass>
+	                </configuration>
+	            </plugin>
+	        </plugins>
+
+    </build>
+</project>

+ 71 - 0
service-scm/pom.xml

@@ -0,0 +1,71 @@
+<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-scm</artifactId>
+    <packaging>jar</packaging>
+
+    <name>service-scm</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>
+
+
+
+    </dependencies>
+
+    <build>
+        <finalName>service-scm</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.scm.ScmServiceApplicationStart</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+
+    </build>
+</project>

+ 109 - 0
service-scm/src/main/java/com/java110/scm/ScmServiceApplicationStart.java

@@ -0,0 +1,109 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.scm;
+
+import com.java110.core.annotation.Java110CmdDiscovery;
+import com.java110.core.annotation.Java110ListenerDiscovery;
+import com.java110.core.client.RestTemplate;
+import com.java110.core.event.cmd.ServiceCmdEventPublishing;
+import com.java110.core.event.service.BusinessServiceDataFlowEventPublishing;
+import com.java110.core.log.LoggerFactory;
+import com.java110.core.trace.Java110RestTemplateInterceptor;
+import com.java110.service.init.ServiceStartInit;
+import org.slf4j.Logger;
+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 javax.annotation.Resource;
+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.scm", "com.java110.core",
+        "com.java110.config.properties.code", "com.java110.db","com.java110.doc"})
+@EnableDiscoveryClient
+@Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
+        basePackages = {"com.java110.store.listener"})
+@Java110CmdDiscovery(cmdPublishClass = ServiceCmdEventPublishing.class,
+        basePackages = {"com.java110.store.cmd"})
+@EnableFeignClients(basePackages = {
+        "com.java110.intf.community",
+        "com.java110.intf.fee",
+        "com.java110.intf.user",
+        "com.java110.intf.common",
+        "com.java110.intf.acct",
+        "com.java110.intf.order",
+        "com.java110.intf.store",
+        "com.java110.intf.mall"
+})
+public class ScmServiceApplicationStart {
+
+    private final static Logger logger = LoggerFactory.getLogger(ScmServiceApplicationStart.class);
+
+
+
+    @Resource
+    private Java110RestTemplateInterceptor java110RestTemplateInterceptor;
+    /**
+     * 实例化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);
+        restTemplate.getInterceptors().add(java110RestTemplateInterceptor);
+        return restTemplate;
+    }
+
+    @Bean
+    public RestTemplate outRestTemplate() {
+        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 {
+            ServiceStartInit.preInitSystemConfig();
+
+            ApplicationContext context = SpringApplication.run(ScmServiceApplicationStart.class, args);
+            ServiceStartInit.initSystemConfig(context);
+            //加载业务侦听
+            //SystemStartLoadBusinessConfigure.initSystemConfig(LISTENER_PATH);
+        } catch (Throwable e) {
+            logger.error("系统启动失败", e);
+        }
+    }
+}

+ 116 - 0
service-scm/src/main/resources/application-dev.yml

@@ -0,0 +1,116 @@
+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: 8004
+  tomcat:
+    uri-encoding: UTF-8
+
+java110:
+  community-service: community-service
+  acct-service: acct-service
+  user-service: user-service
+  store-service: store-service
+  common-service: common-service
+  job-service: job-service
+  fee-service: fee-service
+  report-service: report-service
+  dev-service: dev-service
+  oa-service: oa-service
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: scm-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
+  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://dev.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
+
+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: scmBusinessStatus
+    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

+ 116 - 0
service-scm/src/main/resources/application-dynamic.yml

@@ -0,0 +1,116 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: dev.redis.java110.com
+    port: ${redisport:6379}
+    timeout: 3000
+    password: ${redispwd}
+
+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: 8004
+  tomcat:
+    uri-encoding: UTF-8
+
+java110:
+  community-service: community-service
+  acct-service: acct-service
+  user-service: user-service
+  store-service: store-service
+  common-service: common-service
+  job-service: job-service
+  fee-service: fee-service
+  report-service: report-service
+  dev-service: dev-service
+  oa-service: oa-service
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: store-service
+  redis:
+    database: 0
+    host: dev.redis.java110.com
+    port: ${redisport:6379}
+    password: ${redispwd}
+    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://dev.db.java110.com:${mysqlport}/${dbttname}?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: ${dbttuser}
+
+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: scmBusinessStatus
+    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

+ 116 - 0
service-scm/src/main/resources/application-zihao.yml

@@ -0,0 +1,116 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: dev.redis.java110.com
+    port: 6379
+    timeout: 3000
+    password: ${redispwd}
+
+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: 8004
+  tomcat:
+    uri-encoding: UTF-8
+
+java110:
+  community-service: community-service
+  acct-service: acct-service
+  user-service: user-service
+  store-service: store-service
+  common-service: common-service
+  job-service: job-service
+  fee-service: fee-service
+  report-service: report-service
+  dev-service: dev-service
+  oa-service: oa-service
+
+spring:
+  http:
+    encoding:
+      charset: UTF-8
+      enabled: true
+      force: true
+  application:
+    name: scm-service
+  redis:
+    database: 0
+    host: dev.redis.java110.com
+    port: 6379
+    password: ${redispwd}
+    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://dev.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
+
+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: scmBusinessStatus
+    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

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

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

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

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

+ 75 - 0
service-scm/src/main/resources/dataSource-dynamic.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:${mysqlport}/${dbhcname}?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+    username: ${dbhcuser}
+    password: ${mysqlpwd}
+    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:${mysqlport}/${dbttname}?useUnicode=true&characterEncoding=utf-8
+#    username: ${dbttuser}
+#    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:${mysqlport}/${dbttname}?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+    username: ${dbttuser}
+    password: ${mysqlpwd}
+    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:${mysqlport}/${dbttname}?useUnicode=true&characterEncoding=utf-8
+#    username: ${dbttuser}
+#    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

+ 75 - 0
service-scm/src/main/resources/dataSource-zihao.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: ${mysqlpwd}
+    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: ${mysqlpwd}
+    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

+ 75 - 0
service-scm/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

+ 4 - 0
service-scm/src/main/resources/java110.properties

@@ -0,0 +1,4 @@
+java110.mappingPath=classpath:mapper/store/**/*.xml,classpath:mapper/service/*.xml
+java110.testSwitch=ON
+
+

+ 20 - 0
service-scm/src/test/java/com/java110/AppTest.java

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

+ 11 - 0
springboot/pom.xml

@@ -160,6 +160,17 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>com.java110</groupId>
+            <artifactId>service-scm</artifactId>
+            <version>${hc.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>java110-service</artifactId>
+                    <groupId>com.java110</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-websocket</artifactId>