1、各模块服务功能
注:其部分实体类、接口、mapper文件由MyBatis逆向工程生成。
2、Maven管理(多模块,继承和聚合)
2.1 parent模块
<?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">
<modelVersion>4.0.0</modelVersion>
<!--SpringBoot的父项目-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<!--聚合-->
<modules>
<module>../micr-api</module>
<module>../micr-dataservice</module>
<module>../micr-web</module>
<module>../micr-common</module>
<module>../micr-task</module>
<module>../micr-pay</module>
</modules>
<properties>
<dubbo.version>2.7.8</dubbo.version>
<zookeeper.version>2.7.8</zookeeper.version>
<mybatis.version>2.2.2</mybatis.version>
<fastjson>1.2.51</fastjson>
<swagger.version>2.9.2</swagger.version>
<swagger.ui.version>1.9.6</swagger.ui.version>
<jwt.version>0.11.2</jwt.version>
</properties>
<!--管理依赖-->
<dependencyManagement>
<dependencies>
<!--jwt-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId> <!-- or jjwt-gson if Gson is preferred -->
<version>${jwt.version}</version>
<scope>runtime</scope>
</dependency>
<!--声明项目使用的gav-->
<!--Dubbo-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!--Zookeeper-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>${zookeeper.version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!--MyBatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!--Fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson}</version>
</dependency>
<!--Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger.ui.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!--统一jdk-->
<build>
<plugins>
<!-- 编译插件 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 插件的版本 -->
<version>3.5.1</version>
<!-- 编译级别 -->
<configuration>
<source>1.8</source>
<target>1.8</target>
<!-- 编码格式 -->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
2.2 api模块
<?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>micr-parent</artifactId>
<groupId>com.bjpowernode</groupId>
<version>1.0.0</version>
<relativePath>../micr-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>micr-api</artifactId>
</project>
2.3 dataservice模块
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--自己的父项目-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-dataservice</artifactId>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--引入公共模块common-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-common</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo公共项目依赖-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!--zookeeper起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
2.4 common模块
<?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>micr-parent</artifactId>
<groupId>com.bjpowernode</groupId>
<version>1.0.0</version>
<relativePath>../micr-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>micr-common</artifactId>
<dependencies>
<!--jwt-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
</dependency>
<!--commons-lang3-->
<!--Lang组件主要是一些工具类,涉及到数组工具类,字符串工具类,字符工具类,数学方面,时间日期工具类,异常,事件等工具类。-->
<!--commons-lang3,封装JwtUtil工具类,创建jwt-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!--Httpclient-->
<!--Springboot集成HttpClient依赖,封装HTTP请求类并配置连接池-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!--fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<!--junit-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>
2.5 web模块
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--自己的父项目-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-web</artifactId>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--dubbo公共项目依赖-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!--zookeeper起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<!--Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.5.4-beta</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
2.6 task模块
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--自己的父项目-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-task</artifactId>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--dubbo公共项目依赖-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!--zookeeper起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>2.7.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
2.7 pay模块
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--自己的父项目-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/>
</parent>
<artifactId>micr-pay</artifactId>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--dubbo公共项目依赖-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!--zookeeper起步依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>2.7.8</version>
</dependency>
</dependencies>
<build>
<!--资源插件-->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.pfx</include>
<include>**/*.cer</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
3、配置文件application.yml
3.1 dataservice模块
#服务名称
spring:
application:
name: micr-dataservice
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ylb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: root
#设置mybatis
mybatis:
mapper-locations: classpath:/mappers/**/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
#Dubbo配置
dubbo:
registry:
address: zookeeper://localhost:2181
scan:
base-packages: com.bjpowernode.dataservice.service
provider:
timeout: 50000
retries: 0
#密码的盐
ylb:
config:
password-salt: fiwsyhrf9wejroi2huio3y4234operw3
3.2 web模块
spring:
application:
name: micr-web
mvc:
pathmatch:
matching-strategy: ant_path_matcher
redis:
host: localhost
port: 6379
#端口号
server:
port: 8000
servlet:
context-path: /api
encoding:
enabled: true
charset: utf-8
force: true
#dubbo配置
dubbo:
registry:
address: zookeeper://localhost:2181
scan:
base-packages: com.bjpowernode.front
consumer:
check: false
timeout: 50000
retries: 0
#短信配置
jdwx:
sms:
url: https://way.jd.com/chuangxin/dxjk
appkey: 3680fa919b771148da626bbcbd459475
content: 【大富科技】你的验证码是:%s,3分钟内有效,请勿泄露给他人
login-text: 【大富科技】登录验证码是:%s,3分钟内有效,请勿泄露给他人
realname:
url: https://way.jd.com/youhuoBeijing/test
appkey: 3680fa919b771148da626bbcbd459475
jwt:
secret: 342903934cb944808920b642616b3e76
3.3 task模块
spring:
application:
name: micr-task
dubbo:
scan:
base-packages: com.bjpowernode.task
registry:
address: zookeeper://localhost:2181
consumer:
timeout: 50000
check: false
retries: 0
3.4 pay模块
server:
port: 9000
servlet:
context-path: /pay
spring:
thymeleaf:
cache: false
application:
name: micr-pay
redis:
host: localhost
port: 6379
dubbo:
registry:
address: zookeeper://localhost:2181
scan:
base-packages: com.bjpowernode.pay
consumer:
check: false
timeout: 60000
retries: 0
4、数据库表
数据库名:ylb
各表字段信息: