├── .gitignore
├── README.md
├── db
├── Dockerfile
└── choy_ms.sql
├── docker-compose.yml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── secondkill-auth
├── .gitignore
├── Dockerfile
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── secondkill
│ │ │ └── auth
│ │ │ ├── SecondkillAuthApplication.java
│ │ │ ├── controller
│ │ │ └── AuthController.java
│ │ │ └── service
│ │ │ ├── AuthService.java
│ │ │ └── impl
│ │ │ └── AuthServiceImpl.java
│ └── resources
│ │ └── application.yml
│ └── test
│ └── java
│ └── com
│ └── secondkill
│ └── auth
│ └── SecondkillAuthApplicationTests.java
├── secondkill-common
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── secondkill
│ │ └── common
│ │ ├── config
│ │ └── RedisAutoConfig.java
│ │ ├── enums
│ │ └── ResultErrEnum.java
│ │ ├── expection
│ │ └── AppRuntimeException.java
│ │ ├── handler
│ │ └── CommonExcHandler.java
│ │ └── utils
│ │ ├── FileUtils.java
│ │ ├── JwtUtils.java
│ │ ├── OssUtils.java
│ │ ├── RedisLuaUtils.java
│ │ ├── RedisUtils.java
│ │ ├── Result.java
│ │ ├── ResultUtils.java
│ │ └── TimeUtils.java
│ └── resources
│ ├── lua
│ ├── cutStock.lua
│ └── restoreStock.lua
│ └── oss.properties
├── secondkill-rabbitmq
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── secondkill
│ └── message
│ └── config
│ ├── DelayQueueConfig.java
│ └── StockQueueConfig.java
├── secondkill-register
└── nacos-1.4.2
│ ├── LICENSE
│ ├── NOTICE
│ ├── bin
│ ├── derby.log
│ ├── shutdown.cmd
│ ├── shutdown.sh
│ ├── startup.cmd
│ └── startup.sh
│ ├── conf
│ ├── 1.4.0-ipv6_support-update.sql
│ ├── application.properties
│ ├── application.properties.example
│ ├── cluster.conf.example
│ ├── nacos-logback.xml
│ ├── nacos-mysql.sql
│ └── schema.sql
│ └── data
│ ├── derby-data
│ ├── README_DO_NOT_TOUCH_FILES.txt
│ ├── db.lck
│ ├── log
│ │ ├── README_DO_NOT_TOUCH_FILES.txt
│ │ ├── log.ctrl
│ │ ├── log1.dat
│ │ └── logmirror.ctrl
│ ├── seg0
│ │ ├── README_DO_NOT_TOUCH_FILES.txt
│ │ ├── c10.dat
│ │ ├── c101.dat
│ │ ├── c111.dat
│ │ ├── c121.dat
│ │ ├── c130.dat
│ │ ├── c141.dat
│ │ ├── c150.dat
│ │ ├── c161.dat
│ │ ├── c171.dat
│ │ ├── c180.dat
│ │ ├── c191.dat
│ │ ├── c1a1.dat
│ │ ├── c1b1.dat
│ │ ├── c1c0.dat
│ │ ├── c1d1.dat
│ │ ├── c1e0.dat
│ │ ├── c1f1.dat
│ │ ├── c20.dat
│ │ ├── c200.dat
│ │ ├── c211.dat
│ │ ├── c221.dat
│ │ ├── c230.dat
│ │ ├── c241.dat
│ │ ├── c251.dat
│ │ ├── c260.dat
│ │ ├── c271.dat
│ │ ├── c281.dat
│ │ ├── c290.dat
│ │ ├── c2a1.dat
│ │ ├── c2b1.dat
│ │ ├── c2c1.dat
│ │ ├── c2d0.dat
│ │ ├── c2e1.dat
│ │ ├── c2f0.dat
│ │ ├── c300.dat
│ │ ├── c31.dat
│ │ ├── c311.dat
│ │ ├── c321.dat
│ │ ├── c331.dat
│ │ ├── c340.dat
│ │ ├── c351.dat
│ │ ├── c361.dat
│ │ ├── c371.dat
│ │ ├── c380.dat
│ │ ├── c391.dat
│ │ ├── c3a1.dat
│ │ ├── c3b1.dat
│ │ ├── c3c0.dat
│ │ ├── c3d1.dat
│ │ ├── c3e1.dat
│ │ ├── c3f1.dat
│ │ ├── c400.dat
│ │ ├── c41.dat
│ │ ├── c411.dat
│ │ ├── c421.dat
│ │ ├── c430.dat
│ │ ├── c441.dat
│ │ ├── c451.dat
│ │ ├── c461.dat
│ │ ├── c470.dat
│ │ ├── c481.dat
│ │ ├── c490.dat
│ │ ├── c4a1.dat
│ │ ├── c4b1.dat
│ │ ├── c4c1.dat
│ │ ├── c4d1.dat
│ │ ├── c4e1.dat
│ │ ├── c4f0.dat
│ │ ├── c501.dat
│ │ ├── c51.dat
│ │ ├── c511.dat
│ │ ├── c521.dat
│ │ ├── c531.dat
│ │ ├── c540.dat
│ │ ├── c551.dat
│ │ ├── c561.dat
│ │ ├── c570.dat
│ │ ├── c581.dat
│ │ ├── c591.dat
│ │ ├── c5a0.dat
│ │ ├── c5b1.dat
│ │ ├── c5c1.dat
│ │ ├── c5d0.dat
│ │ ├── c5e1.dat
│ │ ├── c5f1.dat
│ │ ├── c60.dat
│ │ ├── c600.dat
│ │ ├── c611.dat
│ │ ├── c621.dat
│ │ ├── c630.dat
│ │ ├── c641.dat
│ │ ├── c651.dat
│ │ ├── c660.dat
│ │ ├── c671.dat
│ │ ├── c681.dat
│ │ ├── c691.dat
│ │ ├── c6a0.dat
│ │ ├── c6b1.dat
│ │ ├── c6c1.dat
│ │ ├── c6d0.dat
│ │ ├── c6e1.dat
│ │ ├── c6f1.dat
│ │ ├── c700.dat
│ │ ├── c71.dat
│ │ ├── c711.dat
│ │ ├── c721.dat
│ │ ├── c731.dat
│ │ ├── c740.dat
│ │ ├── c751.dat
│ │ ├── c760.dat
│ │ ├── c771.dat
│ │ ├── c780.dat
│ │ ├── c791.dat
│ │ ├── c81.dat
│ │ ├── c90.dat
│ │ ├── ca1.dat
│ │ ├── cb1.dat
│ │ ├── cc0.dat
│ │ ├── cd1.dat
│ │ ├── ce1.dat
│ │ └── cf0.dat
│ └── service.properties
│ └── naming
│ └── meta.properties
├── secondkill-service-api
├── pom.xml
├── secondkill-goods-api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── secondkill
│ │ └── api
│ │ └── goods
│ │ ├── dto
│ │ ├── EditGoodsDTO.java
│ │ ├── GoodsDTO.java
│ │ ├── MsGoodsBaseDTO.java
│ │ └── MsGoodsDTO.java
│ │ ├── entry
│ │ ├── TbGoods.java
│ │ └── TbMsGoods.java
│ │ ├── feign
│ │ └── GoodsFeign.java
│ │ ├── redis
│ │ └── MsGoodsDO.java
│ │ └── vo
│ │ ├── GoodsAdminVO.java
│ │ ├── MsGoodsAdminVO.java
│ │ ├── MsGoodsBaseVO.java
│ │ ├── MsGoodsDetailVO.java
│ │ └── MsGoodsListVO.java
├── secondkill-order-api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── secondkill
│ │ └── api
│ │ └── order
│ │ ├── entry
│ │ └── TbOrder.java
│ │ └── vo
│ │ ├── ListOrderVO.java
│ │ ├── ListUserOrderVO.java
│ │ └── PayOrderVo.java
└── secondkill-user-api
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── com
│ └── secondkill
│ └── api
│ └── user
│ ├── dto
│ ├── AdminUserDto.java
│ └── UserDTO.java
│ ├── entry
│ ├── TbAdminUser.java
│ └── TbUser.java
│ ├── feign
│ ├── IAdminUserFeign.java
│ └── IUserFeign.java
│ └── vo
│ ├── AdminUserVo.java
│ ├── UserInfoVO.java
│ └── UserVO.java
├── secondkill-service
├── pom.xml
├── secondkill-goods
│ ├── .gitignore
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── secondkill
│ │ │ │ └── system
│ │ │ │ └── goods
│ │ │ │ ├── SecondkillGoodsApplication.java
│ │ │ │ ├── controller
│ │ │ │ ├── GoodsAdminController.java
│ │ │ │ └── GoodsController.java
│ │ │ │ ├── mapper
│ │ │ │ ├── GoodsAdminMapper.java
│ │ │ │ └── TbGoodsMapper.java
│ │ │ │ ├── rpc
│ │ │ │ └── RpcGoodsController.java
│ │ │ │ └── service
│ │ │ │ ├── GoodsAdminService.java
│ │ │ │ ├── GoodsService.java
│ │ │ │ ├── StockMqService.java
│ │ │ │ └── impl
│ │ │ │ ├── GoodsAdminServiceImpl.java
│ │ │ │ └── GoodsServiceImpl.java
│ │ └── resources
│ │ │ ├── application.yml
│ │ │ └── com
│ │ │ └── secondkill
│ │ │ └── system
│ │ │ └── goods
│ │ │ └── mapper
│ │ │ ├── GoodsAdminMapper.xml
│ │ │ └── TbGoodsMapper.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── secondkill
│ │ └── SecondkillGoodsApplicationTests.java
├── secondkill-order
│ ├── .gitignore
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── secondkill
│ │ │ │ └── system
│ │ │ │ └── order
│ │ │ │ ├── SecondkillOrderApplication.java
│ │ │ │ ├── controller
│ │ │ │ ├── OrderAdminController.java
│ │ │ │ └── OrderController.java
│ │ │ │ ├── mapper
│ │ │ │ └── OrderMapper.java
│ │ │ │ └── service
│ │ │ │ ├── OrderService.java
│ │ │ │ └── impl
│ │ │ │ └── OrderServiceImpl.java
│ │ └── resources
│ │ │ ├── application.yml
│ │ │ └── com
│ │ │ └── secondkill
│ │ │ └── system
│ │ │ └── order
│ │ │ └── mapper
│ │ │ └── OrderMapper.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── secondkill
│ │ └── SecondkillOrderApplicationTests.java
└── secondkill-user
│ ├── .gitignore
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── secondkill
│ │ │ └── system
│ │ │ └── user
│ │ │ ├── SecondkillUserApplication.java
│ │ │ ├── controller
│ │ │ ├── UserAdminController.java
│ │ │ └── UserController.java
│ │ │ ├── mapper
│ │ │ ├── TbAdminUserMapper.java
│ │ │ └── TbUserMapper.java
│ │ │ └── service
│ │ │ ├── UserAdminService.java
│ │ │ ├── UserService.java
│ │ │ └── impl
│ │ │ ├── UserAdminServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ └── resources
│ │ ├── application.yml
│ │ └── mapper
│ │ ├── TbAdminUserMapper.xml
│ │ └── TbUserMapper.xml
│ └── test
│ └── java
│ └── com
│ └── secondkill
│ └── SecondkillUserApplicationTests.java
└── secondkill-zuul
├── .gitignore
├── Dockerfile
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── secondkill
│ │ └── zuul
│ │ ├── SecondkillZuulApplication.java
│ │ ├── config
│ │ └── CorsConfig.java
│ │ ├── filter
│ │ ├── RateLimitFilter.java
│ │ └── TokenFilter.java
│ │ └── service
│ │ └── RateLimitService.java
└── resources
│ └── application.yml
└── test
└── java
└── com
└── secondkill
└── zuul
└── SecondkillZuulApplicationTests.java
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
35 |
36 | rebel.xml
37 |
--------------------------------------------------------------------------------
/db/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mysql:8.0.14
2 | ENV TZ=Asia/Shanghai
3 | RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
4 | COPY ./choy_ms.sql /docker-entrypoint-initdb.d
5 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # 指定版本号
2 | version: '3'
3 | services:
4 | # 注册中心服务
5 | secondkill-register:
6 | # nacos-1.4.2镜像
7 | image: nacos/nacos-server:1.4.2
8 | # 重启方式:总是
9 | restart: always
10 | # 端口映射
11 | ports:
12 | - 8848:8848
13 | # 容器名
14 | container_name: secondkill-register
15 | # 主机名
16 | hostname: secondkill-register
17 | # 环境变量,设置启动方式为单机启动
18 | environment:
19 | MODE: standalone
20 | # 添加到网路app
21 | networks:
22 | - app
23 |
24 | # 数据库服务
25 | secondkill-mysql:
26 | # 数据库对应Dockerfile目录
27 | build:
28 | context: ./db
29 | # 设置数据库密码
30 | environment:
31 | MYSQL_ROOT_PASSWORD: 86598659yu
32 | restart: always
33 | container_name: secondkill-mysql
34 | image: secondkill-mysql
35 | ports:
36 | - 3306:3306
37 | networks:
38 | - app
39 |
40 | # redis服务
41 | secondkill-redis:
42 | # redis-3.2镜像
43 | image: redis:3.2
44 | ports:
45 | - 6379:6379
46 | restart: always
47 | container_name: secondkill-redis
48 | hostname: secondkill-redis
49 | networks:
50 | - app
51 |
52 | # rabbitmq队列服务
53 | secondkill-rabbitmq:
54 | # rabbitmq-3.8.4镜像
55 | image: rabbitmq:3.8.4
56 | ports:
57 | - 5672:5672
58 | - 15672:15672
59 | restart: always
60 | container_name: secondkill-rabbitmq
61 | hostname: secondkill-rabbitmq
62 | networks:
63 | - app
64 |
65 | # 以下是微服务
66 |
67 | # 网关服务
68 | secondkill-zuul:
69 | # 网关服务对应Dockerfile路径
70 | build:
71 | context: ./secondkill-zuul
72 | ports:
73 | - 8000:8000
74 | restart: always
75 | container_name: secondkill-zuul
76 | hostname: secondkill-zuul
77 | networks:
78 | - app
79 |
80 | # 鉴权服务
81 | secondkill-auth:
82 | # 鉴权服务对应Dockerfile路径
83 | build:
84 | context: ./secondkill-auth
85 | ports:
86 | - 8002:8002
87 | restart: always
88 | container_name: secondkill-auth
89 | hostname: secondkill-auth
90 | networks:
91 | - app
92 |
93 | # 商品服务
94 | secondkill-goods:
95 | # 商品服务对应Dockerfile路径
96 | build:
97 | context: ./secondkill-service/secondkill-goods
98 | ports:
99 | - 8021:8021
100 | restart: always
101 | container_name: secondkill-goods
102 | hostname: secondkill-goods
103 | networks:
104 | - app
105 |
106 | # 订单服务
107 | secondkill-order:
108 | # 订单服务对应Dockerfile路径
109 | build:
110 | context: ./secondkill-service/secondkill-order
111 | ports:
112 | - 8010:8010
113 | restart: always
114 | container_name: secondkill-order
115 | hostname: secondkill-order
116 | networks:
117 | - app
118 |
119 | # 用户服务
120 | secondkill-user:
121 | # 用户服务对应Dockerfile路径
122 | build:
123 | context: ./secondkill-service/secondkill-user
124 | ports:
125 | - 8001:8001
126 | restart: always
127 | container_name: secondkill-user
128 | hostname: secondkill-user
129 | networks:
130 | - app
131 |
132 | # 设置网络为app
133 | networks:
134 | app:
--------------------------------------------------------------------------------
/secondkill-auth/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/secondkill-auth/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jre
2 | WORKDIR /build
3 | ADD ./target/secondkill-auth-1.1.0.jar ./secondkill-auth.jar
4 | EXPOSE 8002
5 | CMD sleep 40; java -jar secondkill-auth.jar v
--------------------------------------------------------------------------------
/secondkill-auth/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.choy
7 | secondkill
8 | 1.1.0
9 |
10 |
11 | secondkill-auth
12 |
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-web
17 |
18 |
19 | com.alibaba.cloud
20 | spring-cloud-starter-alibaba-nacos-discovery
21 |
22 |
23 | com.choy
24 | secondkill-user-api
25 |
26 |
27 | com.choy
28 | secondkill-common
29 |
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-openfeign
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/secondkill-auth/src/main/java/com/secondkill/auth/SecondkillAuthApplication.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.auth;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.openfeign.EnableFeignClients;
7 | import org.springframework.context.annotation.ComponentScan;
8 |
9 |
10 | @SpringBootApplication
11 | @EnableDiscoveryClient
12 | @EnableFeignClients("com.secondkill.api.*")
13 | @ComponentScan(basePackages = {"com.secondkill"})
14 | public class SecondkillAuthApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(SecondkillAuthApplication.class, args);
18 | }
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/secondkill-auth/src/main/java/com/secondkill/auth/service/AuthService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.auth.service;
2 |
3 | import java.util.HashMap;
4 |
5 | /**
6 | * @author Choy
7 | * @date 2021/03/03
8 | * 用户鉴权Service类
9 | */
10 | public interface AuthService {
11 |
12 | /**
13 | * 普通用户登录
14 | * @return
15 | */
16 | String userAuthLogin(HashMap reqMap);
17 |
18 | /**
19 | * 管理员用户登录
20 | * @return
21 | */
22 | String adminAuthLogin(HashMap reqMap);
23 |
24 | /**
25 | * token校验
26 | * @return
27 | */
28 | String tokenVerity(String token);
29 |
30 |
31 | Boolean userLogout();
32 |
33 | Boolean adminLogout();
34 | }
35 |
--------------------------------------------------------------------------------
/secondkill-auth/src/main/java/com/secondkill/auth/service/impl/AuthServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.auth.service.impl;
2 |
3 | import com.secondkill.api.user.feign.IAdminUserFeign;
4 | import com.secondkill.api.user.feign.IUserFeign;
5 | import com.secondkill.api.user.vo.AdminUserVo;
6 | import com.secondkill.api.user.vo.UserVO;
7 | import com.secondkill.auth.service.AuthService;
8 | import com.secondkill.common.enums.ResultErrEnum;
9 | import com.secondkill.common.expection.AppRuntimeException;
10 | import com.secondkill.common.utils.JwtUtils;
11 | import com.secondkill.common.utils.Result;
12 | import org.slf4j.Logger;
13 | import org.slf4j.LoggerFactory;
14 | import org.springframework.beans.factory.annotation.Autowired;
15 | import org.springframework.stereotype.Service;
16 |
17 | import java.util.HashMap;
18 |
19 | /**
20 | * @author Choy
21 | * @date 2021/03/01
22 | * 权限校验service
23 | */
24 | @Service
25 | public class AuthServiceImpl implements AuthService {
26 |
27 | private final static Logger logger = LoggerFactory.getLogger(AuthServiceImpl.class);
28 |
29 | @Autowired
30 | private IUserFeign userFeign;
31 | @Autowired
32 | private IAdminUserFeign adminUserFeign;
33 | @Autowired
34 | private JwtUtils jwtUtils;
35 |
36 | /**
37 | * 普通用户登录
38 | * @param reqMap 传入的登录参数
39 | * @return
40 | */
41 | @Override
42 | public String userAuthLogin(HashMap reqMap) {
43 | String sign = "false";
44 | Result userVOResult = userFeign.userLogin(reqMap);
45 | if (userVOResult.getCode() != 20000){
46 | logger.warn("{}用户登录失败", reqMap.get("username"));
47 | throw new AppRuntimeException(ResultErrEnum.USER_NOT_FOUND);
48 | }else{
49 | UserVO userVO = userVOResult.getData();
50 | sign = jwtUtils.generateToken(userVO, "false");
51 | }
52 | logger.info("{}用户登录成功", reqMap.get("username"));
53 | return sign;
54 | }
55 |
56 | /**
57 | * 管理员用户登录
58 | * @param reqMap 传入的登录参数
59 | * @return
60 | */
61 | @Override
62 | public String adminAuthLogin(HashMap reqMap) {
63 | String sign = "false";
64 | Result adminUserVoResult = adminUserFeign.adminLogin(reqMap);
65 | if (adminUserVoResult.getCode() != 20000){
66 | logger.warn("{}管理员登录失败", reqMap.get("username"));
67 | throw new AppRuntimeException(ResultErrEnum.USER_NOT_FOUND);
68 | }else{
69 | AdminUserVo adminUserVo = adminUserVoResult.getData();
70 | sign = jwtUtils.generateToken(adminUserVo, "true");
71 | }
72 | logger.info("{}管理员登录成功", reqMap.get("username"));
73 | return sign;
74 | }
75 |
76 | /**
77 | * token校验
78 | * @param token 颁发的token
79 | * @return
80 | */
81 | @Override
82 | public String tokenVerity(String token) {
83 | return jwtUtils.verityToken(token);
84 | }
85 |
86 | @Override
87 | public Boolean userLogout() {
88 | return null;
89 | }
90 |
91 | @Override
92 | public Boolean adminLogout() {
93 | return null;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/secondkill-auth/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8002
3 |
4 | spring:
5 | application:
6 | name: secondkill-auth
7 | cloud:
8 | nacos:
9 | discovery:
10 | server-addr: secondkill-register:8848
11 | main:
12 | allow-bean-definition-overriding: true
13 |
14 | auth:
15 | # 设置过期时间为1小时, 调试设置为10小时,避免一直登陆
16 | expireTime: 3600000000
17 | privateKey:
18 | MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMCYr3fZW6xxuFebKZfhZHI86cgq
19 | XFgQ5UkeZLEA/5ylWeskHaebntiqQ22sCFPB+tRalxwwg5QewnwArwZwwFIuQuxuj8fQFvVpMnt7
20 | 89N4jr/ckXRP4sofRVNKJMMDteuybp8VlJ4LdMT/BJS68S7Eqgbul1GG256vEYWuTKAVAgMBAAEC
21 | gYBI9o8jHFk6jyqDJekv/NeM377BcirhwiTa+oSy+encclgKWPhTEwWul3JMDixpbseTw24T4901
22 | NCIB0FB+ZCC3WUDchtibNb2at9qqCX/eqHMrVENDl5TVF5EWfy3h8luo1GjKE1kkaf28HEdXrtpl
23 | Bkd8JmTLZm12wrlJEb0IgQJBAOJ0tt9npfNC7LKPDh0u2RiV4cDUJrLDcGmewJUT0FFmMM+YSz6t
24 | LtZTk7dsSTfIbxOo3LZnrF/90Ue6GjvGyQ0CQQDZuR2EYWYOOtmZF/Zr6BMoulgnjLgzFJQwaS5b
25 | xQG07zperO80Cl7NLFkPI0ltcYuX9t7D6QRu0+7PJsujSuEpAkEA2y6scb8YWENGZe0gdA6MAcfQ
26 | IZs1eYDApPoK3D+5OY/3XnbBHYDx/HAYYUhl9aACIr0mI0ZlCOPaU9pE2ealYQJAeKPkQSge/p+J
27 | VxU6DAyqIRUwJ6oHnvY2LqT5dQwyp+ku9KrqWHGumg2Kw6KP2z7hVLEMOo3xUN/KIaqjh7XEEQJA
28 | OJfxDwyr06ojNupu5TkC5mraia0QVACNqcF78pmSHJ3470OMSjg7lDZVJXaJ6xiQj2FHccF/ZZHR
29 | Dv85ZvfwvA==
30 | publicKey:
31 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAmK932VuscbhXmymX4WRyPOnIKlxYEOVJHmSx
32 | AP+cpVnrJB2nm57YqkNtrAhTwfrUWpccMIOUHsJ8AK8GcMBSLkLsbo/H0Bb1aTJ7e/PTeI6/3JF0
33 | T+LKH0VTSiTDA7Xrsm6fFZSeC3TE/wSUuvEuxKoG7pdRhtuerxGFrkygFQIDAQAB
34 |
35 |
36 | # Redis服务器地址
37 | redis:
38 | host: secondkill-redis:127.0.0.1
39 | # Redis服务器连接端口
40 | port: 6379
41 | # Redis服务器连接密码(默认为空)
42 | password: null
43 | timeout: 30000
44 | # 连接池最大连接数(使用负值表示没有限制)
45 | maxTotal: 30
46 | # 连接池中的最大空闲连接
47 | maxIdle: 10
48 | numTestsPerEvictionRun: 1024
49 | timeBetweenEvictionRunsMillis: 30000
50 | minEvictableIdleTimeMillis: 1800000
51 | softMinEvictableIdleTimeMillis: 10000
52 | # 连接池最大阻塞等待时间(使用负值表示没有限制)
53 | maxWaitMillis: 1500
54 | testOnBorrow: true
55 | testWhileIdle: true
56 | blockWhenExhausted: false
57 | JmxEnabled: true
58 |
--------------------------------------------------------------------------------
/secondkill-auth/src/test/java/com/secondkill/auth/SecondkillAuthApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.auth;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 | import sun.misc.BASE64Encoder;
6 |
7 | import java.security.Key;
8 | import java.security.KeyPair;
9 | import java.security.KeyPairGenerator;
10 | import java.security.NoSuchAlgorithmException;
11 |
12 | @SpringBootTest
13 | class SecondkillAuthApplicationTests {
14 |
15 | @Test
16 | void contextLoads() throws NoSuchAlgorithmException {
17 | KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
18 |
19 | KeyPair keyPair = keyPairGenerator.generateKeyPair();
20 |
21 | Key publicKey = keyPair.getPublic();
22 |
23 | Key privateKey = keyPair.getPrivate();
24 |
25 | System.out.println( (new BASE64Encoder()).encodeBuffer(privateKey.getEncoded()));
26 |
27 | System.out.println( (new BASE64Encoder()).encodeBuffer(publicKey.getEncoded()));
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/secondkill-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-common
13 |
14 |
15 |
16 |
17 | org.springframework.boot
18 | spring-boot-starter-data-redis
19 |
20 |
21 | redis.clients
22 | jedis
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | org.apache.commons
33 | commons-pool2
34 |
35 |
36 | com.alibaba
37 | fastjson
38 |
39 |
40 | org.springframework
41 | spring-web
42 |
43 |
44 | com.fasterxml.jackson.core
45 | jackson-databind
46 |
47 |
48 | io.jsonwebtoken
49 | jjwt
50 |
51 |
52 | com.aliyun.oss
53 | aliyun-sdk-oss
54 |
55 |
56 | commons-io
57 | commons-io
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.boot
66 | spring-boot-maven-plugin
67 |
68 | true
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/config/RedisAutoConfig.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.config;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import redis.clients.jedis.JedisPool;
7 | import redis.clients.jedis.JedisPoolConfig;
8 |
9 | /**
10 | * @author choy
11 | * @date 2021/03/13
12 | * redis自动配置类
13 | */
14 | @Configuration
15 | public class RedisAutoConfig {
16 |
17 | @Value("${redis.host}")
18 | private String host;
19 |
20 | @Value("${redis.port}")
21 | private int port;
22 |
23 | @Value("${redis.timeout}")
24 | private int timeout;
25 |
26 | @Value("${redis.maxIdle}")
27 | private int maxIdle;
28 |
29 | @Value("${redis.maxWaitMillis}")
30 | private int maxWaitMillis;
31 |
32 | @Value("${redis.blockWhenExhausted}")
33 | private Boolean blockWhenExhausted;
34 |
35 | @Value("${redis.JmxEnabled}")
36 | private Boolean JmxEnabled;
37 |
38 | @Bean
39 | public JedisPool jedisPoolFactory() {
40 | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
41 | jedisPoolConfig.setMaxIdle(maxIdle);
42 | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
43 | // 连接耗尽时是否阻塞, false报异常,true阻塞直到超时, 默认true
44 | jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
45 | // 是否启用pool的jmx管理功能, 默认true
46 | jedisPoolConfig.setJmxEnabled(JmxEnabled);
47 | JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
48 | return jedisPool;
49 | }
50 |
51 | public JedisPoolConfig jedisPoolConfig(){ //这个是修改redis性能的时候需要的对象
52 | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
53 | jedisPoolConfig.setMaxTotal(maxIdle);
54 | return jedisPoolConfig;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/enums/ResultErrEnum.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.enums;
2 |
3 | /**
4 | * @author Choy
5 | * @date 2021/03/01
6 | * 错误代码枚举类
7 | */
8 | public enum ResultErrEnum {
9 |
10 |
11 | NOT_FOUND_ERROR(40004, "找不到资源"),
12 | NOT_MS_GOODS(40001, "暂时没有秒杀商品"),
13 | MS_GOODS_IS_END(40002, "抱歉,该商品已经下架"),
14 | MS_GOODS_NOT_FOUNT(40003, "抱歉,找不到该商品"),
15 |
16 | /**
17 | * 系统类型错误码
18 | */
19 | SYSTEM_ERROR(50000, "系统错误,请稍后再试"),
20 | EMPTY_PARAM_ERROR(50001, "参数不能为空"),
21 | ERR_PAGE_PARAM(50002, "错误的分页参数"),
22 | INVALID_PARAM(50003, "无效的参数"),
23 | DEL_ACTION_FAIL(50004, "删除失败"),
24 | MOD_ACTION_FAIL(50005, "修改失败"),
25 | ADD_ACTION_FAIL(50006, "添加失败"),
26 | CACHE_ACTION_FAIL(50007, "缓存失败"),
27 | IMG_IS_EMPTY(50008, "图片为空,请检查图片"),
28 | ERROR_IMG_TYPE(50009, "图片格式错误,请检查图片"),
29 | IMG_UPLOAD_FAIL(50010, "上传失败,请重新上传"),
30 | ORDER_IS_PAY(50011, "订单已支付"),
31 | ORDER_IS_EXPIRED(50012, "订单已过期"),
32 |
33 | /**
34 | * 用户类型错误码
35 | */
36 | USER_NOT_FOUND(10001, "帐号或密码错误"),
37 | EMPTY_TOKEN(10002, "token为空"),
38 | ERR_TOKEN(10003, "token解析错误,请重新登录"),
39 | EXPIRED_TOKEN(10004, "token已过期,请重新登录"),
40 | ERR_PERMISSION(10005, "权限不足"),
41 | USER_IS_REGISTER(10006, "该用户名已被注册"),
42 | USER_REGISTER_FAIL(10007, "注册失败"),
43 |
44 |
45 |
46 | ;
47 |
48 | private Integer code;
49 | private String msg;
50 |
51 | public Integer getCode() {
52 | return code;
53 | }
54 |
55 | public String getMsg() {
56 | return msg;
57 | }
58 |
59 | /**
60 | * 枚举类构造函数
61 | * @param code
62 | * @param msg
63 | */
64 | ResultErrEnum(Integer code, String msg) {
65 | this.code = code;
66 | this.msg = msg;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/expection/AppRuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.expection;
2 |
3 | import com.secondkill.common.enums.ResultErrEnum;
4 |
5 | /**
6 | * @author Choy
7 | * @date 2021/03/01
8 | * 公共异常处理类
9 | */
10 | public class AppRuntimeException extends RuntimeException {
11 |
12 | private int code;
13 |
14 | /**
15 | * 根据枚举返回错误类型
16 | * @param resultErrEnum
17 | */
18 | public AppRuntimeException(ResultErrEnum resultErrEnum){
19 | super(resultErrEnum.getMsg());
20 | this.code = resultErrEnum.getCode();
21 | }
22 |
23 | /**
24 | * 自定义错误类型
25 | * @param code
26 | * @param message
27 | */
28 | public AppRuntimeException(Integer code, String message){
29 | super(message);
30 | this.code = code;
31 | }
32 |
33 | /**
34 | * 获取错误状态码
35 | * @return
36 | */
37 | public int getCode() {
38 | return code;
39 | }
40 |
41 | /**
42 | * 重写获取错误信息接口
43 | * @return
44 | */
45 | @Override
46 | public String getMessage() {
47 | return super.getMessage();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/handler/CommonExcHandler.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.handler;
2 |
3 | import com.secondkill.common.expection.AppRuntimeException;
4 | import com.secondkill.common.utils.Result;
5 | import com.secondkill.common.utils.ResultUtils;
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 | import org.springframework.web.bind.MethodArgumentNotValidException;
9 | import org.springframework.web.bind.annotation.ControllerAdvice;
10 | import org.springframework.web.bind.annotation.ExceptionHandler;
11 | import org.springframework.web.bind.annotation.ResponseBody;
12 |
13 | /**
14 | * @author Choy
15 | * @date 2021/03/01
16 | * 异常处理类
17 | */
18 | @ControllerAdvice
19 | public class CommonExcHandler {
20 |
21 | private static final Logger logger = LoggerFactory.getLogger(CommonExcHandler.class);
22 |
23 |
24 | /**
25 | * 异常处理方法
26 | * @param e
27 | * @return
28 | */
29 | @ResponseBody
30 | @ExceptionHandler(AppRuntimeException.class)
31 | public Result baseServiceException(AppRuntimeException e){
32 | int code = e.getCode();
33 | String msg = e.getMessage();
34 | logger.error("errorCode: {}, errorMessage: {}", code, msg);
35 | return ResultUtils.error(code, msg);
36 | }
37 |
38 | /**
39 | * 处理参数校验错误异常
40 | * @param e
41 | * @return
42 | */
43 | @ResponseBody
44 | @ExceptionHandler(MethodArgumentNotValidException.class)
45 | public Result handleValidatedException(MethodArgumentNotValidException e){
46 | int code = 50001;
47 | String msg = e.getBindingResult().getFieldError().getDefaultMessage();
48 | logger.error("errorCode: {}, errorMessage: {}", code, msg);
49 | return ResultUtils.error(code, msg);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.util.StringUtils;
6 | import org.springframework.web.multipart.MultipartFile;
7 |
8 | import javax.activation.MimetypesFileTypeMap;
9 | import javax.imageio.ImageIO;
10 | import java.awt.*;
11 | import java.io.File;
12 |
13 | /**
14 | * 文件工具类
15 | * @author choy
16 | * @date 2021/3/19
17 | */
18 | public class FileUtils {
19 |
20 | private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
21 |
22 | /**
23 | * 图片格式
24 | */
25 | private static final String[] IMAGE_TYPE = new String[]{".bmp", ".jpg", ".png", ".jpeg", ".gif"};
26 |
27 | /**
28 | * 校验图片类型
29 | * @param file
30 | * @return
31 | */
32 | public static boolean checkImg(File file){
33 | if (file.exists()){
34 | return false;
35 | }
36 | Image img = null;
37 | try{
38 | img = ImageIO.read(file);
39 | if (img == null || img.getWidth(null) <= 0 || img.getHeight(null) <= 0){
40 | return false;
41 | }
42 | return true;
43 | }catch (Exception e){
44 | logger.error(e.getMessage());
45 | return false;
46 | }finally {
47 | img = null;
48 | }
49 | }
50 |
51 |
52 | /**
53 | * 校验图片的类型
54 | * @param multipartFile
55 | * @return
56 | */
57 | public static boolean checkImgType(MultipartFile multipartFile){
58 | boolean isLegal = false;
59 | for (String type : IMAGE_TYPE) {
60 | if (StringUtils.endsWithIgnoreCase(multipartFile.getOriginalFilename(), type)){
61 | isLegal = true;
62 | break;
63 | }
64 | }
65 | return isLegal;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/OssUtils.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 | import com.aliyun.oss.OSS;
4 | import com.aliyun.oss.OSSClientBuilder;
5 | import com.aliyun.oss.model.PutObjectRequest;
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 | import org.springframework.beans.factory.annotation.Value;
9 | import org.springframework.boot.context.properties.ConfigurationProperties;
10 | import org.springframework.context.annotation.PropertySource;
11 | import org.springframework.stereotype.Component;
12 |
13 | import java.io.File;
14 |
15 | @Component
16 | @PropertySource("classpath:oss.properties")
17 | public class OssUtils {
18 |
19 | private final static Logger logger = LoggerFactory.getLogger(OssUtils.class);
20 |
21 | @Value("${oss.endpoint:''}")
22 | private String endpoint;
23 | // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。
24 | @Value("${oss.accessKeyId:''}")
25 | private String accessKeyId;
26 | @Value("${oss.accessKeySecret:''}")
27 | private String accessKeySecret;
28 | /**
29 | * 设置存储空间名称
30 | */
31 | @Value("${oss.bucketName:''}")
32 | private String bucketName;
33 | /**
34 | * 上文件存储目录
35 | */
36 | @Value("${oss.fileDir:''}")
37 | private String fileDir;
38 |
39 |
40 | /**
41 | * 上传图片到oss
42 | * @param file
43 | * @return
44 | */
45 | public String uploadFile2Oss(File file){
46 | OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
47 | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileDir + file.getName(), file);
48 | ossClient.putObject(putObjectRequest);
49 | ossClient.shutdown();
50 | return getOssFilePath(file.getName());
51 | }
52 |
53 | /**
54 | * 生成oss路径
55 | * @param filename
56 | * @return
57 | */
58 | private String getOssFilePath(String filename){
59 | String str = endpoint.substring(endpoint.lastIndexOf("/") + 1, endpoint.length());
60 | String domain = "http://" + bucketName + "." + str;
61 | return domain + "/" + fileDir + filename;
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/RedisLuaUtils.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 | import org.apache.commons.io.IOUtils;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.core.io.Resource;
9 | import org.springframework.stereotype.Component;
10 | import redis.clients.jedis.Jedis;
11 | import redis.clients.jedis.JedisPool;
12 | import java.io.IOException;
13 | import java.io.InputStream;
14 | import java.util.Arrays;
15 |
16 | /**
17 | * redis库存lua脚本执行
18 | * @author choy
19 | * @date 2021/03/26
20 | */
21 | @Component
22 | public class RedisLuaUtils {
23 |
24 | private static final Logger logger = LoggerFactory.getLogger(RedisLuaUtils.class);
25 |
26 | @Autowired
27 | private JedisPool jedisPool;
28 | @Value("classpath:lua/cutStock.lua")
29 | private Resource cutStockLua;
30 | @Value("classpath:lua/restoreStock.lua")
31 | private Resource restoreStock;
32 |
33 | /**
34 | * 扣减库存
35 | * @return
36 | */
37 | public String cutStock(Integer msGoodsId, Integer userId) {
38 | String lua = resourceToString(cutStockLua);
39 | Jedis jedis = null;
40 | try{
41 | jedis = jedisPool.getResource();
42 | Object result = jedis.eval(lua,
43 | Arrays.asList(msGoodsId.toString()),
44 | Arrays.asList(userId.toString())
45 | );
46 | logger.info("返回值:{}", result.toString());
47 | return result.toString();
48 | }catch (Exception e){
49 | logger.warn(e.getMessage());
50 | return null;
51 | }finally {
52 | jedis.close();
53 | }
54 | }
55 |
56 | /**
57 | * 用户超时付款时回滚库存
58 | * @param msGoodsId
59 | * @param userId
60 | * @return
61 | */
62 | public String restoreStock(Integer msGoodsId, Integer userId){
63 | String lua = resourceToString(restoreStock);
64 | Jedis jedis = null;
65 | try{
66 | jedis = jedisPool.getResource();
67 | jedis.eval(lua, Arrays.asList(msGoodsId.toString()), Arrays.asList(userId.toString()));
68 | return "true";
69 | }catch (Exception e){
70 | logger.warn(e.getMessage());
71 | return "false";
72 | }finally {
73 | jedis.close();
74 | }
75 | }
76 |
77 | /**
78 | * 将lua脚本转成字符串
79 | * @param resource
80 | * @return
81 | */
82 | public String resourceToString(Resource resource){
83 | try{
84 | InputStream inputStream = resource.getInputStream();
85 | return IOUtils.toString(inputStream, "utf8");
86 | }catch (IOException e){
87 | logger.error("找不到lua脚本");
88 | return null;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/Result.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @auhtor choy
9 | * @date 2021/03/01
10 | * 返回json类
11 | */
12 | @JsonInclude(value= JsonInclude.Include.NON_NULL)
13 | public class Result implements Serializable {
14 |
15 | private Integer code;
16 | private String msg;
17 | private T data;
18 |
19 | public Integer getCode() {
20 | return code;
21 | }
22 |
23 | public void setCode(Integer code) {
24 | this.code = code;
25 | }
26 |
27 | public String getMsg() {
28 | return msg;
29 | }
30 |
31 | public void setMsg(String msg) {
32 | this.msg = msg;
33 | }
34 |
35 | public T getData() {
36 | return data;
37 | }
38 |
39 | public void setData(T data) {
40 | this.data = data;
41 | }
42 |
43 | public Result(){}
44 |
45 | public Result(Integer code, String msg){
46 | this.code = code;
47 | this.msg = msg;
48 | }
49 |
50 | public Result(Integer code, String msg, T data){
51 | this.code = code;
52 | this.msg = msg;
53 | this.data = data;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/ResultUtils.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 |
4 | /**
5 | * @author Choy
6 | * @date 2021/03/01
7 | * 全局统一返回结果工具类
8 | */
9 | public class ResultUtils {
10 |
11 | /**
12 | * 返回请求成功信息,包含数据
13 | * @param data
14 | * @return
15 | */
16 | public static Result success(Object data){
17 | return new Result(20000, "请求成功", data);
18 | }
19 |
20 | /**
21 | * 返回请求成功,不包含数据
22 | * @return
23 | */
24 | public static Result success(){
25 | return new Result(20000, "请求成功");
26 | }
27 |
28 | /**
29 | * 返回请求成功,不包含数据,自定义信息
30 | * @param msg
31 | * @return
32 | */
33 | public static Result success(String msg){
34 | return new Result(20000, msg);
35 | }
36 |
37 | /**
38 | * 返回自定义请求成功操作
39 | * @param msg
40 | * @param data
41 | * @return
42 | */
43 | public static Result success(String msg, Object data){
44 | return new Result(20000, msg, data);
45 | }
46 |
47 | /**
48 | * 返回失败的自定义json数据,不包含data
49 | * @param code
50 | * @param msg
51 | * @return
52 | */
53 | public static Result error(Integer code, String msg){
54 | return new Result(code, msg);
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/java/com/secondkill/common/utils/TimeUtils.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.common.utils;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 |
7 | /**
8 | * @author choy
9 | * @date 2021/03/13
10 | * 时间工具类
11 | */
12 | public class TimeUtils {
13 |
14 | /**
15 | * 计算某个时间距离现在有多少秒
16 | * @param endDate
17 | * @return
18 | */
19 | public static Integer calSecond(Date endDate){
20 | long time1 = new Date().getTime();
21 | long time2 = endDate.getTime();
22 | return Integer.parseInt(Long.toString((time2 - time1) /1000 ));
23 | }
24 |
25 | /**
26 | * 计算某个时间字符串距离现在有多少秒
27 | * @param time
28 | * @return
29 | * @throws ParseException
30 | */
31 | public static Integer calSecondString(String time) throws ParseException {
32 | long time1 = new Date().getTime();
33 | long time2 = string2Date(time).getTime();
34 | return Integer.parseInt(Long.toString((time2 - time1) /1000 ));
35 | }
36 |
37 | /**
38 | * 字符从转date
39 | * @param time
40 | * @return
41 | */
42 | public static Date string2Date(String time) throws ParseException {
43 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
44 | return simpleDateFormat.parse(time);
45 | }
46 |
47 | /**
48 | * data时间转string字符串
49 | * @param date
50 | * @return
51 | */
52 | public static String date2String(Date date){
53 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
54 | return simpleDateFormat.format(date);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/secondkill-common/src/main/resources/lua/cutStock.lua:
--------------------------------------------------------------------------------
1 | -- 扣减库存lua脚本
2 | -- @auhtor choy
3 | -- @date 2021/03/26
4 |
5 |
6 |
7 | -- 秒杀活动id
8 | local msGoodsId = KEYS[1]
9 | -- 用户id
10 | local userId = KEYS[2]
11 |
12 | -- 秒杀活动库存key
13 | local stockKey = "stock:"..msGoodsId
14 | -- 是否参加过该活动key
15 | local msGoodsIsBuyKey = "msGoods-"..msGoodsId
16 | -- 用户id的值
17 | local userIdValue = "userId-"..ARGV[1]
18 |
19 | -- 获取库存的过期时间
20 | local stockTtl = tonumber(redis.call('ttl', stockKey))
21 | -- 获取库存
22 | local stock = tonumber(redis.call('get', stockKey))
23 | -- 获取用户是否参加过活动
24 | local isBuy = tonumber(redis.call('SISMEMBER', msGoodsIsBuyKey, userIdValue))
25 | -- 如果用户参加过
26 | if isBuy == 1 then
27 | return "isBuy"
28 | else
29 | -- 如果库存大于0,才能执行扣减库存操作
30 | -- 同时要将该用户参加过活动添加到redis中
31 | if stock > 0 then
32 | -- 扣减库存
33 | redis.call('del', stockKey)
34 | redis.call('set', stockKey, stock - 1)
35 | -- 设置过期时间
36 | redis.call('expire', stockKey, stockTtl)
37 | -- 将抢购过的用户添加到名单中
38 | redis.call('sadd', msGoodsIsBuyKey, userIdValue)
39 | -- 设置过期时间
40 | redis.call('expire', msGoodsIsBuyKey, stockTtl)
41 | return "true"
42 | else
43 | -- 如果库存等于0 则说明商品秒杀完
44 | return "end"
45 | end
46 | end
--------------------------------------------------------------------------------
/secondkill-common/src/main/resources/lua/restoreStock.lua:
--------------------------------------------------------------------------------
1 | -- 用户未付款恢复库存
2 | -- @auhtor choy
3 | -- @date 2021/03/26
4 |
5 |
6 | -- 秒杀活动id
7 | local msGoodsId = KEYS[1]
8 | -- 用户id
9 | local userId = KEYS[2]
10 |
11 | -- 秒杀活动库存key
12 | local stockKey = "stock:"..msGoodsId
13 | -- 是否参加过该活动key
14 | local msGoodsIsBuyKey = "msGoods-"..msGoodsId
15 | -- 用户id的值
16 | local userIdValue = "userId-"..ARGV[1]
17 |
18 | -- 获取库存
19 | local stock = tonumber(redis.call('get', stockKey))
20 | -- 获取库存的过期时间
21 | local stockTtl = tonumber(redis.call('ttl', stockKey))
22 |
23 | -- 回滚库存
24 | redis.call('del', stockKey)
25 | redis.call('set', stockKey, stock + 1)
26 | -- 设置过期时间
27 | redis.call('expire', stockKey, stockTtl)
28 | -- 移出该用户已经参加过活动
29 | redis.call('srem', msGoodsIsBuyKey, userIdValue)
--------------------------------------------------------------------------------
/secondkill-common/src/main/resources/oss.properties:
--------------------------------------------------------------------------------
1 | oss.bucketName=''
2 | oss.accessKeyId=''
3 | oss.accessKeySecret=''
4 | oss.#OSS对应的区域
5 | oss.endpoint=''
6 | oss.fileDir=''
7 |
--------------------------------------------------------------------------------
/secondkill-rabbitmq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.choy
7 | secondkill
8 | 1.1.0
9 |
10 |
11 | 4.0.0
12 |
13 | secondkill-rabbitmq
14 |
15 |
16 |
17 | org.springframework.boot
18 | spring-boot-starter-amqp
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-maven-plugin
27 |
28 | true
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/secondkill-rabbitmq/src/main/java/com/secondkill/message/config/DelayQueueConfig.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.message.config;
2 |
3 | import org.springframework.amqp.core.*;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 |
8 | /**
9 | * rabbitMQ中间件配置类
10 | * @author choy
11 | * @date 2021/03/29
12 | */
13 | @Configuration
14 | public class DelayQueueConfig {
15 |
16 | /**
17 | * ttl过期队列
18 | */
19 | public final static String DELAY_QUEUE_PER_QUEUE_TTL_NAME = "delay_queue_per_queue_ttl";
20 |
21 | /**
22 | * 过期后处理消息的队列
23 | */
24 | public final static String DELAY_PROCESS_QUEUE_NAME = "delay_process_queue";
25 |
26 | /**
27 | * 交换机
28 | */
29 | public final static String DELAY_EXCHANGE_NAME = "delay_exchange";
30 |
31 | /**
32 | * 过期时间,1分钟
33 | */
34 | public final static int QUEUE_EXPIRATION = 60000;
35 |
36 | /**
37 | * 死信队列
38 | * @return
39 | */
40 | @Bean
41 | Queue delayQueuePreQueueTTL(){
42 | // 通过x-dead-letter-exchange设置队列的死信路由,那么出现dead letter之后将dead letter重新发送到指定exchange;
43 | // 通过x-dead-letter-routing-key设置路由键:出现dead letter之后将dead letter重新按照指定的routing-key发送;
44 | // 通过x-message-ttl设置队列的过期时间;
45 | return QueueBuilder.durable(DELAY_QUEUE_PER_QUEUE_TTL_NAME)
46 | .withArgument("x-dead-letter-exchange", DELAY_EXCHANGE_NAME)
47 | .withArgument("x-dead-letter-routing-key", DELAY_PROCESS_QUEUE_NAME)
48 | .withArgument("x-message-ttl", QUEUE_EXPIRATION)
49 | .build();
50 | }
51 |
52 | /**
53 | * 死信接受队列
54 | * @return
55 | */
56 | @Bean
57 | Queue delayProcessQueue(){
58 | return QueueBuilder.durable(DELAY_PROCESS_QUEUE_NAME).build();
59 | }
60 |
61 | /**
62 | * 死信交换机
63 | * @return
64 | */
65 | @Bean
66 | DirectExchange delayExchange(){
67 | return new DirectExchange(DELAY_EXCHANGE_NAME);
68 | }
69 |
70 | /**
71 | * 给死信队列绑定交换机
72 | * @param delayProcessQueue
73 | * @param delayExchange
74 | * @return
75 | */
76 | @Bean
77 | Binding dlxBinding(Queue delayProcessQueue, DirectExchange delayExchange){
78 | return BindingBuilder.bind(delayProcessQueue)
79 | .to(delayExchange)
80 | .with(DELAY_PROCESS_QUEUE_NAME);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/secondkill-rabbitmq/src/main/java/com/secondkill/message/config/StockQueueConfig.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.message.config;
2 |
3 | import org.springframework.amqp.core.*;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 |
8 | /**
9 | * 库存队列
10 | * @author choy
11 | * @date 2021/03/30
12 | */
13 | @Configuration
14 | public class StockQueueConfig {
15 |
16 | /**
17 | * 库存队列
18 | */
19 | public final static String STOCK_QUEUE_NAME = "stock_queue";
20 |
21 |
22 | /**
23 | * 创建库存队列
24 | * @return
25 | */
26 | @Bean
27 | Queue stockQueue(){
28 | return QueueBuilder.durable(STOCK_QUEUE_NAME)
29 | .build();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/NOTICE:
--------------------------------------------------------------------------------
1 | Nacos
2 | Copyright 2018-2019 The Apache Software Foundation
3 |
4 | This product includes software developed at
5 | The Alibaba MiddleWare Group.
6 |
7 | ------
8 | This product has a bundle netty:
9 | The Spring oot Project
10 | =================
11 |
12 | Please visit the Netty web site for more information:
13 |
14 | * http://netty.io/
15 |
16 | Copyright 2014 The Netty Project
17 |
18 | The Netty Project licenses this file to you under the Apache License,
19 | version 2.0 (the "License"); you may not use this file except in compliance
20 | with the License. You may obtain a copy of the License at:
21 |
22 | http://www.apache.org/licenses/LICENSE-2.0
23 |
24 | Unless required by applicable law or agreed to in writing, software
25 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
26 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
27 | License for the specific language governing permissions and limitations
28 | under the License.
29 |
30 | Also, please refer to each LICENSE..txt file, which is located in
31 | the 'license' directory of the distribution file, for the license terms of the
32 | components that this product depends on.
33 |
34 | ------
35 | This product has a bundle commons-lang, which includes software from the Spring Framework,
36 | under the Apache License 2.0 (see: StringUtils.containsWhitespace())
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/bin/derby.log:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------
2 | Sun Jul 25 16:28:14 CST 2021:
3 | Booting Derby version The Apache Software Foundation - Apache Derby - 10.14.2.0 - (1828579): instance a816c00e-017a-dcc7-69d1-00001439b058
4 | on database directory C:\Users\Choy\Desktop\nacos\data\derby-data with class loader org.springframework.boot.loader.LaunchedURLClassLoader@6433a2
5 | Loaded from jar:file:/C:/Users/Choy/Desktop/nacos/target/nacos-server.jar!/BOOT-INF/lib/derby-10.14.2.0.jar!/
6 | java.vendor=Oracle Corporation
7 | java.runtime.version=1.8.0_144-b01
8 | user.dir=C:\Users\Choy\Desktop\nacos\bin
9 | os.name=Windows 10
10 | os.arch=amd64
11 | os.version=10.0
12 | derby.system.home=null
13 | Database Class Loader started - derby.database.classpath=''
14 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/bin/shutdown.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | rem Copyright 1999-2018 Alibaba Group Holding Ltd.
3 | rem Licensed under the Apache License, Version 2.0 (the "License");
4 | rem you may not use this file except in compliance with the License.
5 | rem You may obtain a copy of the License at
6 | rem
7 | rem http://www.apache.org/licenses/LICENSE-2.0
8 | rem
9 | rem Unless required by applicable law or agreed to in writing, software
10 | rem distributed under the License is distributed on an "AS IS" BASIS,
11 | rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | rem See the License for the specific language governing permissions and
13 | rem limitations under the License.
14 | if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
15 |
16 | setlocal
17 |
18 | set "PATH=%JAVA_HOME%\bin;%PATH%"
19 |
20 | echo killing nacos server
21 |
22 | for /f "tokens=1" %%i in ('jps -m ^| find "nacos.nacos"') do ( taskkill /F /PID %%i )
23 |
24 | echo Done!
25 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/bin/shutdown.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 1999-2018 Alibaba Group Holding Ltd.
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 |
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | cd `dirname $0`/../target
16 | target_dir=`pwd`
17 |
18 | pid=`ps ax | grep -i 'nacos.nacos' | grep ${target_dir} | grep java | grep -v grep | awk '{print $1}'`
19 | if [ -z "$pid" ] ; then
20 | echo "No nacosServer running."
21 | exit -1;
22 | fi
23 |
24 | echo "The nacosServer(${pid}) is running..."
25 |
26 | kill ${pid}
27 |
28 | echo "Send shutdown request to nacosServer(${pid}) OK"
29 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/conf/1.4.0-ipv6_support-update.sql:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1999-2018 Alibaba Group Holding Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ALTER TABLE `config_info_tag`
18 | MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
19 |
20 | ALTER TABLE `his_config_info`
21 | MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL AFTER `src_user`;
22 |
23 | ALTER TABLE `config_info`
24 | MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
25 |
26 | ALTER TABLE `config_info_beta`
27 | MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/conf/cluster.conf.example:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 1999-2018 Alibaba Group Holding Ltd.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | #it is ip
18 | #example
19 | 192.168.16.101:8847
20 | 192.168.16.102
21 | 192.168.16.103
22 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/README_DO_NOT_TOUCH_FILES.txt:
--------------------------------------------------------------------------------
1 |
2 | # *************************************************************************
3 | # *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
4 | # *** FILES IN THIS DIRECTORY AND SUBDIRECTORIES CONSTITUTE A DERBY ***
5 | # *** DATABASE, WHICH INCLUDES THE DATA (USER AND SYSTEM) AND THE ***
6 | # *** FILES NECESSARY FOR DATABASE RECOVERY. ***
7 | # *** EDITING, ADDING, OR DELETING ANY OF THESE FILES MAY CAUSE DATA ***
8 | # *** CORRUPTION AND LEAVE THE DATABASE IN A NON-RECOVERABLE STATE. ***
9 | # *************************************************************************
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/db.lck:
--------------------------------------------------------------------------------
1 | $a816c00e-017a-dcc7-69d1-00001439b058
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/log/README_DO_NOT_TOUCH_FILES.txt:
--------------------------------------------------------------------------------
1 |
2 | # *************************************************************************
3 | # *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
4 | # *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE RECOVERY ***
5 | # *** SYSTEM. EDITING, ADDING, OR DELETING FILES IN THIS DIRECTORY ***
6 | # *** WILL CAUSE THE DERBY RECOVERY SYSTEM TO FAIL, LEADING TO ***
7 | # *** NON-RECOVERABLE CORRUPT DATABASES. ***
8 | # *************************************************************************
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/log/log.ctrl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/log/log.ctrl
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/log/log1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/log/log1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/log/logmirror.ctrl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/log/logmirror.ctrl
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/README_DO_NOT_TOUCH_FILES.txt:
--------------------------------------------------------------------------------
1 |
2 | # *************************************************************************
3 | # *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
4 | # *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE TO STORE ***
5 | # *** USER AND SYSTEM DATA. EDITING, ADDING, OR DELETING FILES IN THIS ***
6 | # *** DIRECTORY WILL CORRUPT THE ASSOCIATED DERBY DATABASE AND MAKE ***
7 | # *** IT NON-RECOVERABLE. ***
8 | # *************************************************************************
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c10.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c10.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c101.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c101.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c111.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c111.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c121.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c121.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c130.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c130.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c141.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c141.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c150.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c150.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c161.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c161.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c171.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c171.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c180.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c180.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c191.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c191.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1a1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1a1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1c0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1c0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1d1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1d1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1e0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1e0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1f1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c1f1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c20.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c20.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c200.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c200.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c211.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c211.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c221.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c221.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c230.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c230.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c241.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c241.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c251.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c251.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c260.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c260.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c271.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c271.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c281.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c281.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c290.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c290.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2a1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2a1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2c1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2c1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2d0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2d0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2e1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2e1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2f0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c2f0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c300.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c300.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c31.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c31.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c311.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c311.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c321.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c321.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c331.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c331.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c340.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c340.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c351.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c351.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c361.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c361.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c371.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c371.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c380.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c380.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c391.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c391.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3a1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3a1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3c0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3c0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3d1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3d1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3e1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3e1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3f1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c3f1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c400.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c400.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c41.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c41.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c411.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c411.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c421.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c421.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c430.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c430.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c441.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c441.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c451.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c451.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c461.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c461.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c470.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c470.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c481.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c481.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c490.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c490.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4a1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4a1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4c1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4c1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4d1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4d1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4e1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4e1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4f0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c4f0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c501.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c501.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c51.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c51.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c511.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c511.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c521.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c521.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c531.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c531.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c540.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c540.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c551.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c551.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c561.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c561.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c570.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c570.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c581.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c581.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c591.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c591.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5a0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5a0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5c1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5c1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5d0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5d0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5e1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5e1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5f1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c5f1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c60.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c60.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c600.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c600.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c611.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c611.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c621.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c621.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c630.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c630.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c641.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c641.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c651.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c651.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c660.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c660.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c671.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c671.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c681.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c681.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c691.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c691.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6a0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6a0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6b1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6b1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6c1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6c1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6d0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6d0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6e1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6e1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6f1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c6f1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c700.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c700.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c71.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c71.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c711.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c711.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c721.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c721.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c731.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c731.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c740.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c740.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c751.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c751.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c760.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c760.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c771.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c771.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c780.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c780.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c791.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c791.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c81.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c81.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c90.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/c90.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/ca1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/ca1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cb1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cb1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cc0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cc0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cd1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cd1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/ce1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/ce1.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cf0.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/derby-data/seg0/cf0.dat
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/derby-data/service.properties:
--------------------------------------------------------------------------------
1 | #C:\Users\Choy\Desktop\nacos\data\derby-data
2 | # ********************************************************************
3 | # *** Please do NOT edit this file. ***
4 | # *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
5 | # ********************************************************************
6 | #Sun Jul 25 16:28:27 CST 2021
7 | SysschemasIndex2Identifier=225
8 | SyscolumnsIdentifier=144
9 | SysconglomeratesIndex1Identifier=49
10 | SysconglomeratesIdentifier=32
11 | SyscolumnsIndex2Identifier=177
12 | SysschemasIndex1Identifier=209
13 | SysconglomeratesIndex3Identifier=81
14 | SystablesIndex2Identifier=129
15 | SyscolumnsIndex1Identifier=161
16 | derby.serviceProtocol=org.apache.derby.database.Database
17 | SysschemasIdentifier=192
18 | derby.storage.propertiesId=16
19 | SysconglomeratesIndex2Identifier=65
20 | derby.serviceLocale=zh_CN
21 | SystablesIdentifier=96
22 | SystablesIndex1Identifier=113
23 | #--- last line, don't put anything after this line ---
24 |
--------------------------------------------------------------------------------
/secondkill-register/nacos-1.4.2/data/naming/meta.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChoyRunYu/secondkill/9302e9532fa5f8bb80a62e0e99e0c03900069b6c/secondkill-register/nacos-1.4.2/data/naming/meta.properties
--------------------------------------------------------------------------------
/secondkill-service-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-service-api
13 | pom
14 |
15 |
16 | secondkill-goods-api
17 | secondkill-order-api
18 | secondkill-user-api
19 |
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-maven-plugin
26 |
27 | true
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill-service-api
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-goods-api
13 |
14 |
15 |
16 | org.springframework.cloud
17 | spring-cloud-starter-openfeign
18 |
19 |
20 | com.choy
21 | secondkill-common
22 |
23 |
24 | org.hibernate
25 | hibernate-validator
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/dto/EditGoodsDTO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.dto;
2 |
3 | import javax.validation.constraints.Min;
4 | import javax.validation.constraints.NotBlank;
5 | import javax.validation.constraints.NotNull;
6 | import java.math.BigDecimal;
7 |
8 | /**
9 | * 商品信息编辑dto实体类
10 | * @author choy
11 | * @date 2021/03/20
12 | */
13 | public class EditGoodsDTO {
14 |
15 | @NotNull(message = "商品id不能为空")
16 | @Min(1)
17 | private Integer goodsId;
18 | @NotNull(message = "商品名称不能为空")
19 | @NotBlank(message = "商品名称不能为空")
20 | private String goodsName;
21 | @NotNull(message = "商品标题不能为空")
22 | @NotBlank(message = "商品标题不能为空")
23 | private String goodsTitle;
24 | @NotNull(message = "商品图片不能为空")
25 | @NotBlank(message = "商品图片不能为空")
26 | private String goodsImg;
27 | @NotNull(message = "商品价格不能为空")
28 | private BigDecimal goodsPrice;
29 | @NotNull(message = "商品库存不能为空")
30 | private Integer goodsStock;
31 |
32 | public Integer getGoodsId() {
33 | return goodsId;
34 | }
35 |
36 | public void setGoodsId(Integer goodsId) {
37 | this.goodsId = goodsId;
38 | }
39 |
40 | public String getGoodsName() {
41 | return goodsName;
42 | }
43 |
44 | public void setGoodsName(String goodsName) {
45 | this.goodsName = goodsName;
46 | }
47 |
48 | public String getGoodsTitle() {
49 | return goodsTitle;
50 | }
51 |
52 | public void setGoodsTitle(String goodsTitle) {
53 | this.goodsTitle = goodsTitle;
54 | }
55 |
56 | public String getGoodsImg() {
57 | return goodsImg;
58 | }
59 |
60 | public void setGoodsImg(String goodsImg) {
61 | this.goodsImg = goodsImg;
62 | }
63 |
64 | public BigDecimal getGoodsPrice() {
65 | return goodsPrice;
66 | }
67 |
68 | public void setGoodsPrice(BigDecimal goodsPrice) {
69 | this.goodsPrice = goodsPrice;
70 | }
71 |
72 | public Integer getGoodsStock() {
73 | return goodsStock;
74 | }
75 |
76 | public void setGoodsStock(Integer goodsStock) {
77 | this.goodsStock = goodsStock;
78 | }
79 |
80 | @Override
81 | public String toString() {
82 | return "EditGoodsDTO{" +
83 | "goodsId=" + goodsId +
84 | ", goodsName='" + goodsName + '\'' +
85 | ", goodsTitle='" + goodsTitle + '\'' +
86 | ", goodsImg='" + goodsImg + '\'' +
87 | ", goodsPrice=" + goodsPrice +
88 | ", goodsStock=" + goodsStock +
89 | '}';
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/dto/GoodsDTO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.dto;
2 |
3 | import com.secondkill.api.goods.entry.TbMsGoods;
4 |
5 | import javax.validation.constraints.NotBlank;
6 | import javax.validation.constraints.NotNull;
7 | import java.math.BigDecimal;
8 | import java.util.Date;
9 |
10 | /**
11 | * @author choy
12 | * @date 2021/03/12
13 | * 商品dto
14 | */
15 | public class GoodsDTO {
16 |
17 | @NotNull(message = "商品名称不能为空")
18 | @NotBlank(message = "商品名称不能为空")
19 | private String goodsName;
20 | @NotNull(message = "商品标题不能为空")
21 | @NotBlank(message = "商品标题不能为空")
22 | private String goodsTitle;
23 | @NotNull(message = "商品图片不能为空")
24 | @NotBlank(message = "商品图片不能为空")
25 | private String goodsImg;
26 | @NotNull(message = "商品价格不能为空")
27 | private BigDecimal goodsPrice;
28 | @NotNull(message = "商品库存不能为空")
29 | private Integer goodsStock;
30 |
31 |
32 | public String getGoodsName() {
33 | return goodsName;
34 | }
35 |
36 | public void setGoodsName(String goodsName) {
37 | this.goodsName = goodsName;
38 | }
39 |
40 | public String getGoodsTitle() {
41 | return goodsTitle;
42 | }
43 |
44 | public void setGoodsTitle(String goodsTitle) {
45 | this.goodsTitle = goodsTitle;
46 | }
47 |
48 | public String getGoodsImg() {
49 | return goodsImg;
50 | }
51 |
52 | public void setGoodsImg(String goodsImg) {
53 | this.goodsImg = goodsImg;
54 | }
55 |
56 | public BigDecimal getGoodsPrice() {
57 | return goodsPrice;
58 | }
59 |
60 | public void setGoodsPrice(BigDecimal goodsPrice) {
61 | this.goodsPrice = goodsPrice;
62 | }
63 |
64 | public Integer getGoodsStock() {
65 | return goodsStock;
66 | }
67 |
68 | public void setGoodsStock(Integer goodsStock) {
69 | this.goodsStock = goodsStock;
70 | }
71 |
72 | @Override
73 | public String toString() {
74 | return "GoodsDTO{" +
75 | "goodsName='" + goodsName + '\'' +
76 | ", goodsTitle='" + goodsTitle + '\'' +
77 | ", goodsImg='" + goodsImg + '\'' +
78 | ", goodsPrice=" + goodsPrice +
79 | ", goodsStock=" + goodsStock +
80 | '}';
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/dto/MsGoodsBaseDTO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.dto;
2 |
3 | import javax.validation.constraints.Min;
4 | import javax.validation.constraints.NotEmpty;
5 | import javax.validation.constraints.NotNull;
6 | import java.math.BigDecimal;
7 | import java.util.Date;
8 |
9 | /**
10 | * @author choy
11 | * @date 2021/03/17
12 | * 秒杀活动基本DTO实体类
13 | */
14 | public class MsGoodsBaseDTO {
15 |
16 | @NotNull(message = "秒杀活动id不能为空")
17 | @Min(value = 0, message = "秒杀活动id不能为0")
18 | private Integer msGoodsId;
19 | @NotNull(message = "价格不能为空")
20 | private BigDecimal msPrice;
21 | @NotNull(message = "秒杀库存不能为空")
22 | @Min(value = 0, message = "秒杀库存不能为0")
23 | private Integer msGoodsStock;
24 | @NotNull(message = "秒杀开始时间不能为空")
25 | @NotEmpty(message = "秒杀开始时间不能为空")
26 | private String startTime;
27 | @NotNull(message = "秒杀结束时间不能为空")
28 | @NotEmpty(message = "秒杀结束时间不能为空")
29 | private String endTime;
30 |
31 | public Integer getMsGoodsId() {
32 | return msGoodsId;
33 | }
34 |
35 | public void setMsGoodsId(Integer msGoodsId) {
36 | this.msGoodsId = msGoodsId;
37 | }
38 |
39 | public BigDecimal getMsPrice() {
40 | return msPrice;
41 | }
42 |
43 | public void setMsPrice(BigDecimal msPrice) {
44 | this.msPrice = msPrice;
45 | }
46 |
47 | public Integer getMsGoodsStock() {
48 | return msGoodsStock;
49 | }
50 |
51 | public void setMsGoodsStock(Integer msGoodsStock) {
52 | this.msGoodsStock = msGoodsStock;
53 | }
54 |
55 | public String getStartTime() {
56 | return startTime;
57 | }
58 |
59 | public void setStartTime(String startTime) {
60 | this.startTime = startTime;
61 | }
62 |
63 | public String getEndTime() {
64 | return endTime;
65 | }
66 |
67 | public void setEndTime(String endTime) {
68 | this.endTime = endTime;
69 | }
70 |
71 | @Override
72 | public String toString() {
73 | return "MsGoodsBaseVO{" +
74 | "msGoodsId=" + msGoodsId +
75 | ", msPrice='" + msPrice + '\'' +
76 | ", msGoodsStock=" + msGoodsStock +
77 | ", startTime='" + startTime + '\'' +
78 | ", endTime='" + endTime + '\'' +
79 | '}';
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/dto/MsGoodsDTO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.dto;
2 |
3 | import javax.validation.Valid;
4 | import javax.validation.constraints.NotBlank;
5 | import javax.validation.constraints.NotNull;
6 | import java.io.Serializable;
7 | import java.math.BigDecimal;
8 |
9 | /**
10 | * @author Choy
11 | * @date 2021/03/10
12 | * 秒杀商品实体类dto
13 | */
14 |
15 | public class MsGoodsDTO implements Serializable {
16 |
17 | @NotNull(message = "商品id不能为空")
18 | private Integer goodsId;
19 | @NotNull(message = "商品秒杀价不能为空")
20 | private BigDecimal msPrice;
21 | @NotNull(message = "商品秒杀库存不能为空")
22 | private Integer msGoodsStock;
23 | @NotNull(message = "秒杀开始时间不能为空")
24 | private String startTime;
25 | @NotNull(message = "秒杀技结束时间不能为空")
26 | private String endTime;
27 |
28 | public Integer getGoodsId() {
29 | return goodsId;
30 | }
31 |
32 | public void setGoodsId(Integer goodsId) {
33 | this.goodsId = goodsId;
34 | }
35 |
36 | public Integer getMsGoodsStock() {
37 | return msGoodsStock;
38 | }
39 |
40 | public void setMsGoodsStock(Integer msGoodsStock) {
41 | this.msGoodsStock = msGoodsStock;
42 | }
43 |
44 | public String getStartTime() {
45 | return startTime;
46 | }
47 |
48 | public void setStartTime(String startTime) {
49 | this.startTime = startTime;
50 | }
51 |
52 | public String getEndTime() {
53 | return endTime;
54 | }
55 |
56 | public void setEndTime(String endTime) {
57 | this.endTime = endTime;
58 | }
59 |
60 | public BigDecimal getMsPrice() {
61 | return msPrice;
62 | }
63 |
64 | public void setMsPrice(BigDecimal msPrice) {
65 | this.msPrice = msPrice;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return "MsGoodsDTO{" +
71 | "goodsId=" + goodsId +
72 | ", msPrice=" + msPrice +
73 | ", msGoodsStock=" + msGoodsStock +
74 | ", startTime='" + startTime + '\'' +
75 | ", endTime='" + endTime + '\'' +
76 | '}';
77 | }
78 |
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/entry/TbGoods.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.entry;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Date;
5 |
6 | /**
7 | * @author cairunyu
8 | * @date 2021/02/10
9 | * 商品实体类
10 | */
11 | public class TbGoods {
12 |
13 | private static final long serialVersionUID = -919201640201914789L;
14 |
15 | private Integer goodsId;
16 | private String goodsName;
17 | private String goodsTitle;
18 | private String goodsImg;
19 | private BigDecimal goodsPrice;
20 | private Integer goodsStock;
21 | private String goodsDetail;
22 | private Date createTime;
23 | private TbMsGoods tbMsGoods;
24 |
25 | public Integer getGoodsId() {
26 | return goodsId;
27 | }
28 |
29 | public void setGoodsId(Integer goodsId) {
30 | this.goodsId = goodsId;
31 | }
32 |
33 | public String getGoodsName() {
34 | return goodsName;
35 | }
36 |
37 | public void setGoodsName(String goodsName) {
38 | this.goodsName = goodsName;
39 | }
40 |
41 | public String getGoodsTitle() {
42 | return goodsTitle;
43 | }
44 |
45 | public void setGoodsTitle(String goodsTitle) {
46 | this.goodsTitle = goodsTitle;
47 | }
48 |
49 | public String getGoodsImg() {
50 | return goodsImg;
51 | }
52 |
53 | public void setGoodsImg(String goodsImg) {
54 | this.goodsImg = goodsImg;
55 | }
56 |
57 | public BigDecimal getGoodsPrice() {
58 | return goodsPrice;
59 | }
60 |
61 | public void setGoodsPrice(BigDecimal goodsPrice) {
62 | this.goodsPrice = goodsPrice;
63 | }
64 |
65 | public Integer getGoodsStock() {
66 | return goodsStock;
67 | }
68 |
69 | public void setGoodsStock(Integer goodsStock) {
70 | this.goodsStock = goodsStock;
71 | }
72 |
73 | public String getGoodsDetail() {
74 | return goodsDetail;
75 | }
76 |
77 | public void setGoodsDetail(String goodsDetail) {
78 | this.goodsDetail = goodsDetail;
79 | }
80 |
81 | public Date getCreateTime() {
82 | return createTime;
83 | }
84 |
85 | public void setCreateTime(Date createTime) {
86 | this.createTime = createTime;
87 | }
88 |
89 | public TbMsGoods getTbMsGoods() {
90 | return tbMsGoods;
91 | }
92 |
93 | public void setTbMsGoods(TbMsGoods tbMsGoods) {
94 | this.tbMsGoods = tbMsGoods;
95 | }
96 |
97 | @Override
98 | public String toString() {
99 | return "TbGoods{" +
100 | "goodsId=" + goodsId +
101 | ", goodsName='" + goodsName + '\'' +
102 | ", goodsTitle='" + goodsTitle + '\'' +
103 | ", goodsImg='" + goodsImg + '\'' +
104 | ", goodsPrice=" + goodsPrice +
105 | ", goodsStock=" + goodsStock +
106 | ", goodsDetail='" + goodsDetail + '\'' +
107 | ", createTime=" + createTime +
108 | ", tbMsGoods=" + tbMsGoods +
109 | '}';
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/entry/TbMsGoods.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.entry;
2 |
3 | import java.io.Serializable;
4 | import java.math.BigDecimal;
5 | import java.util.Date;
6 |
7 | /**
8 | * @author cairunyu
9 | * @date 2021/02/11
10 | * 秒杀商品实体类
11 | */
12 | public class TbMsGoods implements Serializable {
13 |
14 | private static final long serialVersionUID = -919201640201914789L;
15 |
16 | private Integer msGoodsId;
17 | private Integer goodsId;
18 | private BigDecimal msPrice;
19 | private Integer msGoodsStock;
20 | private Date startTime;
21 | private Date endTime;
22 | private Date createTime;
23 | private Integer isUp;
24 | private TbGoods tbGoods;
25 |
26 | public Integer getMsGoodsId() {
27 | return msGoodsId;
28 | }
29 |
30 | public void setMsGoodsId(Integer msGoodsId) {
31 | this.msGoodsId = msGoodsId;
32 | }
33 |
34 | public Integer getGoodsId() {
35 | return goodsId;
36 | }
37 |
38 | public void setGoodsId(Integer goodsId) {
39 | this.goodsId = goodsId;
40 | }
41 |
42 | public BigDecimal getMsPrice() {
43 | return msPrice;
44 | }
45 |
46 | public void setMsPrice(BigDecimal msPrice) {
47 | this.msPrice = msPrice;
48 | }
49 |
50 | public Integer getMsGoodsStock() {
51 | return msGoodsStock;
52 | }
53 |
54 | public void setMsGoodsStock(Integer msGoodsStock) {
55 | this.msGoodsStock = msGoodsStock;
56 | }
57 |
58 | public Date getStartTime() {
59 | return startTime;
60 | }
61 |
62 | public void setStartTime(Date startTime) {
63 | this.startTime = startTime;
64 | }
65 |
66 | public Date getEndTime() {
67 | return endTime;
68 | }
69 |
70 | public void setEndTime(Date endTime) {
71 | this.endTime = endTime;
72 | }
73 |
74 | public Date getCreateTime() {
75 | return createTime;
76 | }
77 |
78 | public void setCreateTime(Date createTime) {
79 | this.createTime = createTime;
80 | }
81 |
82 | public Integer getIsUp() {
83 | return isUp;
84 | }
85 |
86 | public void setIsUp(Integer isUp) {
87 | this.isUp = isUp;
88 | }
89 |
90 | public TbGoods getTbGoods() {
91 | return tbGoods;
92 | }
93 |
94 |
95 |
96 | @Override
97 | public String toString() {
98 | return "TbMsGoods{" +
99 | "msGoodsId=" + msGoodsId +
100 | ", goodsId=" + goodsId +
101 | ", msPrice=" + msPrice +
102 | ", msGoodsStock=" + msGoodsStock +
103 | ", startTime=" + startTime +
104 | ", endTime=" + endTime +
105 | ", createTime=" + createTime +
106 | ", isUp=" + isUp +
107 | ", tbGoods=" + tbGoods +
108 | '}';
109 | }
110 |
111 | public void setTbGoods(TbGoods tbGoods) {
112 | this.tbGoods = tbGoods;
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/feign/GoodsFeign.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.feign;
2 |
3 | import com.secondkill.api.goods.vo.MsGoodsDetailVO;
4 | import com.secondkill.common.utils.Result;
5 | import org.springframework.cloud.openfeign.FeignClient;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 |
9 | import java.util.HashMap;
10 |
11 |
12 | /**
13 | * 调用商品服务rpc
14 | */
15 | @FeignClient(value = "secondkill-goods")
16 | public interface GoodsFeign {
17 |
18 | @GetMapping("/goods/rpc/msGoods/detail/{msGoodsId}")
19 | Result getMsGoods(@PathVariable("msGoodsId") Integer msGoodsId);
20 | }
21 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/vo/GoodsAdminVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.vo;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Date;
5 |
6 | /**
7 | * @author Choy
8 | * @date 2021/03/10
9 | * 商品实体类vo
10 | */
11 | public class GoodsAdminVO {
12 |
13 | private Integer goodsId;
14 | private String goodsName;
15 | private String goodsTitle;
16 | private String GoodsImg;
17 | private String goodsPrice;
18 | private Integer goodsStock;
19 | private String createTime;
20 |
21 | public Integer getGoodsId() {
22 | return goodsId;
23 | }
24 |
25 | public void setGoodsId(Integer goodsId) {
26 | this.goodsId = goodsId;
27 | }
28 |
29 | public String getGoodsName() {
30 | return goodsName;
31 | }
32 |
33 | public void setGoodsName(String goodsName) {
34 | this.goodsName = goodsName;
35 | }
36 |
37 | public String getGoodsTitle() {
38 | return goodsTitle;
39 | }
40 |
41 | public void setGoodsTitle(String goodsTitle) {
42 | this.goodsTitle = goodsTitle;
43 | }
44 |
45 | public String getGoodsImg() {
46 | return GoodsImg;
47 | }
48 |
49 | public void setGoodsImg(String goodsImg) {
50 | GoodsImg = goodsImg;
51 | }
52 |
53 | public String getGoodsPrice() {
54 | return goodsPrice;
55 | }
56 |
57 | public void setGoodsPrice(String goodsPrice) {
58 | this.goodsPrice = goodsPrice;
59 | }
60 |
61 | public Integer getGoodsStock() {
62 | return goodsStock;
63 | }
64 |
65 | public void setGoodsStock(Integer goodsStock) {
66 | this.goodsStock = goodsStock;
67 | }
68 |
69 | public String getCreateTime() {
70 | return createTime;
71 | }
72 |
73 | public void setCreateTime(String createTime) {
74 | this.createTime = createTime;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/vo/MsGoodsAdminVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.vo;
2 |
3 |
4 | /**
5 | * @author choy
6 | * @date 2021/03/15
7 | * 秒杀商品管理vo实体类
8 | */
9 | public class MsGoodsAdminVO {
10 |
11 | private Integer msGoodsId;
12 | private String goodsTitle;
13 | private String goodsImg;
14 | private String msPrice;
15 | private Integer msGoodsStock;
16 | private String createTime;
17 | private String startTime;
18 | private String endTime;
19 | private Integer goodsStock;
20 |
21 | public Integer getGoodsStock() {
22 | return goodsStock;
23 | }
24 |
25 | public void setGoodsStock(Integer goodsStock) {
26 | this.goodsStock = goodsStock;
27 | }
28 |
29 | public Integer getMsGoodsId() {
30 | return msGoodsId;
31 | }
32 |
33 | public void setMsGoodsId(Integer msGoodsId) {
34 | this.msGoodsId = msGoodsId;
35 | }
36 |
37 | public String getGoodsTitle() {
38 | return goodsTitle;
39 | }
40 |
41 | public void setGoodsTitle(String goodsTitle) {
42 | this.goodsTitle = goodsTitle;
43 | }
44 |
45 | public String getGoodsImg() {
46 | return goodsImg;
47 | }
48 |
49 | public void setGoodsImg(String goodsImg) {
50 | this.goodsImg = goodsImg;
51 | }
52 |
53 | public String getMsPrice() {
54 | return msPrice;
55 | }
56 |
57 | public void setMsPrice(String msPrice) {
58 | this.msPrice = msPrice;
59 | }
60 |
61 | public Integer getMsGoodsStock() {
62 | return msGoodsStock;
63 | }
64 |
65 | public void setMsGoodsStock(Integer msGoodsStock) {
66 | this.msGoodsStock = msGoodsStock;
67 | }
68 |
69 | public String getStartTime() {
70 | return startTime;
71 | }
72 |
73 | public void setStartTime(String startTime) {
74 | this.startTime = startTime;
75 | }
76 |
77 | public String getEndTime() {
78 | return endTime;
79 | }
80 |
81 | public void setEndTime(String endTime) {
82 | this.endTime = endTime;
83 | }
84 |
85 | public String getCreateTime() {
86 | return createTime;
87 | }
88 |
89 | public void setCreateTime(String createTime) {
90 | this.createTime = createTime;
91 | }
92 |
93 | @Override
94 | public String toString() {
95 | return "MsGoodsAdminVO{" +
96 | ", msGoodsId=" + msGoodsId +
97 | ", goodsTitle='" + goodsTitle + '\'' +
98 | ", goodsImg='" + goodsImg + '\'' +
99 | ", msPrice='" + msPrice + '\'' +
100 | ", msGoodsStock=" + msGoodsStock +
101 | ", startTime='" + startTime + '\'' +
102 | ", endTime='" + endTime + '\'' +
103 | '}';
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/vo/MsGoodsBaseVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.vo;
2 |
3 | /**
4 | * @author choy
5 | * @date 2021/03/17
6 | * 秒杀活动基本vo实体类
7 | */
8 | public class MsGoodsBaseVO {
9 |
10 | private Integer msGoodsId;
11 | private String msPrice;
12 | private Integer msGoodsStock;
13 | private String startTime;
14 | private String endTime;
15 | private Integer goodsStock;
16 |
17 | public Integer getGoodsStock() {
18 | return goodsStock;
19 | }
20 |
21 | public void setGoodsStock(Integer goodsStock) {
22 | this.goodsStock = goodsStock;
23 | }
24 |
25 | public Integer getMsGoodsId() {
26 | return msGoodsId;
27 | }
28 |
29 | public void setMsGoodsId(Integer msGoodsId) {
30 | this.msGoodsId = msGoodsId;
31 | }
32 |
33 | public String getMsPrice() {
34 | return msPrice;
35 | }
36 |
37 | public void setMsPrice(String msPrice) {
38 | this.msPrice = msPrice;
39 | }
40 |
41 | public Integer getMsGoodsStock() {
42 | return msGoodsStock;
43 | }
44 |
45 | public void setMsGoodsStock(Integer msGoodsStock) {
46 | this.msGoodsStock = msGoodsStock;
47 | }
48 |
49 | public String getStartTime() {
50 | return startTime;
51 | }
52 |
53 | public void setStartTime(String startTime) {
54 | this.startTime = startTime;
55 | }
56 |
57 | public String getEndTime() {
58 | return endTime;
59 | }
60 |
61 | public void setEndTime(String endTime) {
62 | this.endTime = endTime;
63 | }
64 |
65 | @Override
66 | public String toString() {
67 | return "MsGoodsBaseVO{" +
68 | "msGoodsId=" + msGoodsId +
69 | ", msPrice='" + msPrice + '\'' +
70 | ", msGoodsStock=" + msGoodsStock +
71 | ", startTime='" + startTime + '\'' +
72 | ", endTime='" + endTime + '\'' +
73 | ", goodsStock=" + goodsStock +
74 | '}';
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/vo/MsGoodsDetailVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.vo;
2 |
3 | /**
4 | * @author choy
5 | * @date 2021/03/14
6 | * 秒杀商品详情vo类
7 | */
8 | public class MsGoodsDetailVO {
9 |
10 | private Integer msGoodsId;
11 | private String goodsTitle;
12 | private String goodsImg;
13 | private String goodsPrice;
14 | private String msPrice;
15 | private Integer msGoodsStock;
16 | private String startTime;
17 | private String endTime;
18 | private Integer goodsId;
19 |
20 | public Integer getGoodsId() {
21 | return goodsId;
22 | }
23 |
24 | public void setGoodsId(Integer goodsId) {
25 | this.goodsId = goodsId;
26 | }
27 |
28 | public Integer getMsGoodsId() {
29 | return msGoodsId;
30 | }
31 |
32 | public void setMsGoodsId(Integer msGoodsId) {
33 | this.msGoodsId = msGoodsId;
34 | }
35 |
36 | public String getGoodsTitle() {
37 | return goodsTitle;
38 | }
39 |
40 | public void setGoodsTitle(String goodsTitle) {
41 | this.goodsTitle = goodsTitle;
42 | }
43 |
44 | public String getGoodsImg() {
45 | return goodsImg;
46 | }
47 |
48 | public void setGoodsImg(String goodsImg) {
49 | this.goodsImg = goodsImg;
50 | }
51 |
52 | public String getGoodsPrice() {
53 | return goodsPrice;
54 | }
55 |
56 | public void setGoodsPrice(String goodsPrice) {
57 | this.goodsPrice = goodsPrice;
58 | }
59 |
60 | public String getMsPrice() {
61 | return msPrice;
62 | }
63 |
64 | public void setMsPrice(String msPrice) {
65 | this.msPrice = msPrice;
66 | }
67 |
68 | public Integer getMsGoodsStock() {
69 | return msGoodsStock;
70 | }
71 |
72 | public void setMsGoodsStock(Integer msGoodsStock) {
73 | this.msGoodsStock = msGoodsStock;
74 | }
75 |
76 | public String getStartTime() {
77 | return startTime;
78 | }
79 |
80 | public void setStartTime(String startTime) {
81 | this.startTime = startTime;
82 | }
83 |
84 | public String getEndTime() {
85 | return endTime;
86 | }
87 |
88 | public void setEndTime(String endTime) {
89 | this.endTime = endTime;
90 | }
91 |
92 |
93 | @Override
94 | public String toString() {
95 | return "MsGoodsDetailVO{" +
96 | "msGoodsId=" + msGoodsId +
97 | ", goodsTitle='" + goodsTitle + '\'' +
98 | ", goodsImg='" + goodsImg + '\'' +
99 | ", goodsPrice='" + goodsPrice + '\'' +
100 | ", msPrice='" + msPrice + '\'' +
101 | ", msGoodsStock=" + msGoodsStock +
102 | ", startTime='" + startTime + '\'' +
103 | ", endTime='" + endTime + '\'' +
104 | ", goodsId=" + goodsId +
105 | '}';
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-goods-api/src/main/java/com/secondkill/api/goods/vo/MsGoodsListVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.goods.vo;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Date;
5 |
6 | /**
7 | * @author choy
8 | * @date 2021/03/11
9 | * 秒杀商品信息vo
10 | */
11 | public class MsGoodsListVO {
12 |
13 | private Integer goodsId;
14 | private Integer msGoodsId;
15 | private String goodsTitle;
16 | private String goodsImg;
17 | private String goodsPrice;
18 | private String msPrice;
19 | private Integer msGoodsStock;
20 | private String startTime;
21 | private String endTime;
22 |
23 | public Integer getGoodsId() {
24 | return goodsId;
25 | }
26 |
27 | public void setGoodsId(Integer goodsId) {
28 | this.goodsId = goodsId;
29 | }
30 |
31 | public Integer getMsGoodsId() {
32 | return msGoodsId;
33 | }
34 |
35 | public void setMsGoodsId(Integer msGoodsId) {
36 | this.msGoodsId = msGoodsId;
37 | }
38 |
39 | public String getGoodsTitle() {
40 | return goodsTitle;
41 | }
42 |
43 | public void setGoodsTitle(String goodsTitle) {
44 | this.goodsTitle = goodsTitle;
45 | }
46 |
47 | public String getGoodsImg() {
48 | return goodsImg;
49 | }
50 |
51 | public void setGoodsImg(String goodsImg) {
52 | this.goodsImg = goodsImg;
53 | }
54 |
55 | public String getGoodsPrice() {
56 | return goodsPrice;
57 | }
58 |
59 | public void setGoodsPrice(String goodsPrice) {
60 | this.goodsPrice = goodsPrice;
61 | }
62 |
63 | public String getMsPrice() {
64 | return msPrice;
65 | }
66 |
67 | public void setMsPrice(String msPrice) {
68 | this.msPrice = msPrice;
69 | }
70 |
71 | public Integer getMsGoodsStock() {
72 | return msGoodsStock;
73 | }
74 |
75 | public void setMsGoodsStock(Integer msGoodsStock) {
76 | this.msGoodsStock = msGoodsStock;
77 | }
78 |
79 | public String getStartTime() {
80 | return startTime;
81 | }
82 |
83 | public void setStartTime(String startTime) {
84 | this.startTime = startTime;
85 | }
86 |
87 | public String getEndTime() {
88 | return endTime;
89 | }
90 |
91 | public void setEndTime(String endTime) {
92 | this.endTime = endTime;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-order-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill-service-api
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-order-api
13 |
14 |
15 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-order-api/src/main/java/com/secondkill/api/order/vo/ListOrderVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.order.vo;
2 |
3 |
4 | import java.math.BigDecimal;
5 | import java.util.Date;
6 |
7 | /**
8 | * 秒杀订单列表VO实体类
9 | * @author choy
10 | * @date 2021/03/31
11 | */
12 | public class ListOrderVO {
13 |
14 | private Integer id;
15 | private String goodsTitle;
16 | private Integer count;
17 | private String unitPrice;
18 | private Integer orderState;
19 | private String createTime;
20 | private String payTime;
21 | private String username;
22 | private String goodsImg;
23 |
24 | public Integer getId() {
25 | return id;
26 | }
27 |
28 | public void setId(Integer id) {
29 | this.id = id;
30 | }
31 |
32 | public String getGoodsTitle() {
33 | return goodsTitle;
34 | }
35 |
36 | public void setGoodsTitle(String goodsTitle) {
37 | this.goodsTitle = goodsTitle;
38 | }
39 |
40 | public Integer getCount() {
41 | return count;
42 | }
43 |
44 | public void setCount(Integer count) {
45 | this.count = count;
46 | }
47 |
48 | public String getUnitPrice() {
49 | return unitPrice;
50 | }
51 |
52 | public void setUnitPrice(String unitPrice) {
53 | this.unitPrice = unitPrice;
54 | }
55 |
56 | public Integer getOrderState() {
57 | return orderState;
58 | }
59 |
60 | public void setOrderState(Integer orderState) {
61 | this.orderState = orderState;
62 | }
63 |
64 | public String getCreateTime() {
65 | return createTime;
66 | }
67 |
68 | public void setCreateTime(String createTime) {
69 | this.createTime = createTime;
70 | }
71 |
72 | public String getPayTime() {
73 | return payTime;
74 | }
75 |
76 | public void setPayTime(String payTime) {
77 | this.payTime = payTime;
78 | }
79 |
80 | public String getUsername() {
81 | return username;
82 | }
83 |
84 | public void setUsername(String username) {
85 | this.username = username;
86 | }
87 |
88 | public String getGoodsImg() {
89 | return goodsImg;
90 | }
91 |
92 | public void setGoodsImg(String goodsImg) {
93 | this.goodsImg = goodsImg;
94 | }
95 |
96 | @Override
97 | public String toString() {
98 | return "ListOrderVO{" +
99 | "id=" + id +
100 | ", goodsTitle='" + goodsTitle + '\'' +
101 | ", count=" + count +
102 | ", unitPrice=" + unitPrice +
103 | ", orderState=" + orderState +
104 | ", createTime=" + createTime +
105 | ", payTime=" + payTime +
106 | ", username='" + username + '\'' +
107 | ", goodsImg='" + goodsImg + '\'' +
108 | '}';
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-order-api/src/main/java/com/secondkill/api/order/vo/ListUserOrderVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.order.vo;
2 |
3 | /**
4 | * 前台展示用户订单VO实体类
5 | * @author choy
6 | * @date 2021/03/31
7 | */
8 | public class ListUserOrderVO {
9 |
10 | private Integer id;
11 | private String goodsTitle;
12 | private Integer count;
13 | private String unitPrice;
14 | private Integer orderState;
15 | private String createTime;
16 | private String payTime;
17 | private String goodsImg;
18 |
19 | public Integer getId() {
20 | return id;
21 | }
22 |
23 | public void setId(Integer id) {
24 | this.id = id;
25 | }
26 |
27 | public String getGoodsTitle() {
28 | return goodsTitle;
29 | }
30 |
31 | public void setGoodsTitle(String goodsTitle) {
32 | this.goodsTitle = goodsTitle;
33 | }
34 |
35 | public Integer getCount() {
36 | return count;
37 | }
38 |
39 | public void setCount(Integer count) {
40 | this.count = count;
41 | }
42 |
43 | public String getUnitPrice() {
44 | return unitPrice;
45 | }
46 |
47 | public void setUnitPrice(String unitPrice) {
48 | this.unitPrice = unitPrice;
49 | }
50 |
51 | public Integer getOrderState() {
52 | return orderState;
53 | }
54 |
55 | public void setOrderState(Integer orderState) {
56 | this.orderState = orderState;
57 | }
58 |
59 | public String getCreateTime() {
60 | return createTime;
61 | }
62 |
63 | public void setCreateTime(String createTime) {
64 | this.createTime = createTime;
65 | }
66 |
67 | public String getPayTime() {
68 | return payTime;
69 | }
70 |
71 | public void setPayTime(String payTime) {
72 | this.payTime = payTime;
73 | }
74 |
75 | public String getGoodsImg() {
76 | return goodsImg;
77 | }
78 |
79 | public void setGoodsImg(String goodsImg) {
80 | this.goodsImg = goodsImg;
81 | }
82 |
83 | @Override
84 | public String toString() {
85 | return "ListUserOrderVO{" +
86 | "id=" + id +
87 | ", goodsTitle='" + goodsTitle + '\'' +
88 | ", count=" + count +
89 | ", unitPrice='" + unitPrice + '\'' +
90 | ", orderState=" + orderState +
91 | ", createTime='" + createTime + '\'' +
92 | ", payTime='" + payTime + '\'' +
93 | ", goodsImg='" + goodsImg + '\'' +
94 | '}';
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-order-api/src/main/java/com/secondkill/api/order/vo/PayOrderVo.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.order.vo;
2 |
3 | /**
4 | * 支付页面订单信息vo实体类
5 | * @author Choy
6 | * @date 2021/03/26
7 | */
8 | public class PayOrderVo {
9 |
10 | private Integer id;
11 | private String goodsTitle;
12 | private String unitPrice;
13 | private Integer count;
14 | private Integer orderState;
15 |
16 | public Integer getId() {
17 | return id;
18 | }
19 |
20 | public void setId(Integer id) {
21 | this.id = id;
22 | }
23 |
24 | public String getGoodsTitle() {
25 | return goodsTitle;
26 | }
27 |
28 | public void setGoodsTitle(String goodsTitle) {
29 | this.goodsTitle = goodsTitle;
30 | }
31 |
32 | public String getUnitPrice() {
33 | return unitPrice;
34 | }
35 |
36 | public void setUnitPrice(String unitPrice) {
37 | this.unitPrice = unitPrice;
38 | }
39 |
40 | public Integer getCount() {
41 | return count;
42 | }
43 |
44 | public void setCount(Integer count) {
45 | this.count = count;
46 | }
47 |
48 | public Integer getOrderState() {
49 | return orderState;
50 | }
51 |
52 | public void setOrderState(Integer orderState) {
53 | this.orderState = orderState;
54 | }
55 |
56 | @Override
57 | public String toString() {
58 | return "PayOrderVo{" +
59 | "id=" + id +
60 | ", goodsTitle='" + goodsTitle + '\'' +
61 | ", unitPrice='" + unitPrice + '\'' +
62 | ", count=" + count +
63 | ", orderState=" + orderState +
64 | '}';
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill-service-api
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-user-api
13 |
14 |
15 |
16 | org.springframework.cloud
17 | spring-cloud-starter-openfeign
18 |
19 |
20 | com.choy
21 | secondkill-common
22 |
23 |
24 | org.hibernate
25 | hibernate-validator
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/dto/AdminUserDto.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.dto;
2 |
3 | import org.hibernate.validator.constraints.NotBlank;
4 | import org.hibernate.validator.constraints.NotEmpty;
5 |
6 | import javax.validation.constraints.NotNull;
7 |
8 | /**
9 | * 用户dto类
10 | * @author choy
11 | * @date 2021/03/01
12 | */
13 | public class AdminUserDto {
14 |
15 | @NotNull
16 | private Integer id;
17 | @NotEmpty(message = "用户名不能为空")
18 | @NotBlank(message = "用户名不能为空")
19 | private String username;
20 | @NotEmpty(message = "昵称不能为空")
21 | @NotBlank(message = "昵称不能为空")
22 | private String nickname;
23 | @NotEmpty(message = "密码不能为空")
24 | @NotBlank(message = "密码不能为空")
25 | private String password;
26 | @NotEmpty(message = "手机不能为空")
27 | @NotBlank(message = "手机不能为空")
28 | private String phone;
29 |
30 |
31 | public Integer getId() {
32 | return id;
33 | }
34 |
35 | public void setId(Integer id) {
36 | this.id = id;
37 | }
38 |
39 | public String getUsername() {
40 | return username;
41 | }
42 |
43 | public void setUsername(String username) {
44 | this.username = username;
45 | }
46 |
47 | public String getNickname() {
48 | return nickname;
49 | }
50 |
51 | public void setNickname(String nickname) {
52 | this.nickname = nickname;
53 | }
54 |
55 | public String getPassword() {
56 | return password;
57 | }
58 |
59 | public void setPassword(String password) {
60 | this.password = password;
61 | }
62 |
63 | public String getPhone() {
64 | return phone;
65 | }
66 |
67 | public void setPhone(String phone) {
68 | this.phone = phone;
69 | }
70 |
71 | public String toString() {
72 | return "UserDTO{" +
73 | "id=" + id +
74 | ", username='" + username + '\'' +
75 | ", nickname='" + nickname + '\'' +
76 | ", password='" + password + '\'' +
77 | ", phone='" + phone + '\'' +
78 | '}';
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/dto/UserDTO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.dto;
2 |
3 | import org.hibernate.validator.constraints.NotBlank;
4 | import org.hibernate.validator.constraints.NotEmpty;
5 | import javax.validation.constraints.NotNull;
6 |
7 | /**
8 | * 用户dto类
9 | * @author choy
10 | * @date 2021/03/01
11 | */
12 | public class UserDTO {
13 |
14 | @NotNull
15 | private Integer id;
16 | @NotEmpty(message = "用户名不能为空")
17 | @NotBlank(message = "用户名不能为空")
18 | private String username;
19 | @NotEmpty(message = "昵称不能为空")
20 | @NotBlank(message = "昵称不能为空")
21 | private String nickname;
22 | @NotEmpty(message = "密码不能为空")
23 | @NotBlank(message = "密码不能为空")
24 | private String password;
25 | @NotEmpty(message = "手机不能为空")
26 | @NotBlank(message = "手机不能为空")
27 | private String phone;
28 |
29 |
30 | public Integer getId() {
31 | return id;
32 | }
33 |
34 | public void setId(Integer id) {
35 | this.id = id;
36 | }
37 |
38 | public String getUsername() {
39 | return username;
40 | }
41 |
42 | public void setUsername(String username) {
43 | this.username = username;
44 | }
45 |
46 | public String getNickname() {
47 | return nickname;
48 | }
49 |
50 | public void setNickname(String nickname) {
51 | this.nickname = nickname;
52 | }
53 |
54 | public String getPassword() {
55 | return password;
56 | }
57 |
58 | public void setPassword(String password) {
59 | this.password = password;
60 | }
61 |
62 | public String getPhone() {
63 | return phone;
64 | }
65 |
66 | public void setPhone(String phone) {
67 | this.phone = phone;
68 | }
69 |
70 | public String toString() {
71 | return "UserDTO{" +
72 | "id=" + id +
73 | ", username='" + username + '\'' +
74 | ", nickname='" + nickname + '\'' +
75 | ", password='" + password + '\'' +
76 | ", phone='" + phone + '\'' +
77 | '}';
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/entry/TbAdminUser.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.entry;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * @author choy
7 | * @date 2021/03/03
8 | * 管理员用户实体类
9 | */
10 | public class TbAdminUser {
11 |
12 | private Integer id;
13 | private String username;
14 | private String nickname;
15 | private String password;
16 | private Date createTime;
17 |
18 | public Integer getId() {
19 | return id;
20 | }
21 |
22 | public void setId(Integer id) {
23 | this.id = id;
24 | }
25 |
26 | public String getUsername() {
27 | return username;
28 | }
29 |
30 | public void setUsername(String username) {
31 | this.username = username;
32 | }
33 |
34 | public String getNickname() {
35 | return nickname;
36 | }
37 |
38 | public void setNickname(String nickname) {
39 | this.nickname = nickname;
40 | }
41 |
42 | public String getPassword() {
43 | return password;
44 | }
45 |
46 | public void setPassword(String password) {
47 | this.password = password;
48 | }
49 |
50 | public Date getCreateTime() {
51 | return createTime;
52 | }
53 |
54 | public void setCreateTime(Date createTime) {
55 | this.createTime = createTime;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/entry/TbUser.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.entry;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * @author cairunyu
7 | * @date 2021/02/11
8 | */
9 | public class TbUser {
10 |
11 | private Integer id;
12 | private String username;
13 | private String nickname;
14 | private String password;
15 | private String phone;
16 | private Date createTime;
17 | private Date deleteTime;
18 | private Integer isEnable;
19 |
20 | public Integer getId() {
21 | return id;
22 | }
23 |
24 | public void setId(Integer id) {
25 | this.id = id;
26 | }
27 |
28 | public String getUsername() {
29 | return username;
30 | }
31 |
32 | public void setUsername(String username) {
33 | this.username = username;
34 | }
35 |
36 | public String getNickname() {
37 | return nickname;
38 | }
39 |
40 | public void setNickname(String nickname) {
41 | this.nickname = nickname;
42 | }
43 |
44 | public String getPassword() {
45 | return password;
46 | }
47 |
48 | public void setPassword(String password) {
49 | this.password = password;
50 | }
51 |
52 |
53 | public String getPhone() {
54 | return phone;
55 | }
56 |
57 | public void setPhone(String phone) {
58 | this.phone = phone;
59 | }
60 |
61 | public Date getCreateTime() {
62 | return createTime;
63 | }
64 |
65 | public void setCreateTime(Date createTime) {
66 | this.createTime = createTime;
67 | }
68 |
69 | public Integer getIsEnable() {
70 | return isEnable;
71 | }
72 |
73 | public void setIsEnable(Integer isEnable) {
74 | this.isEnable = isEnable;
75 | }
76 |
77 | public Date getDeleteTime() {
78 | return deleteTime;
79 | }
80 |
81 | public void setDeleteTime(Date deleteTime) {
82 | this.deleteTime = deleteTime;
83 | }
84 |
85 | @Override
86 | public String toString() {
87 | return "TbUser{" +
88 | "id=" + id +
89 | ", username='" + username + '\'' +
90 | ", nickname='" + nickname + '\'' +
91 | ", password='" + password + '\'' +
92 | ", phone='" + phone + '\'' +
93 | ", createTime=" + createTime +
94 | ", deleteTime=" + deleteTime +
95 | ", isEnable=" + isEnable +
96 | '}';
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/feign/IAdminUserFeign.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.feign;
2 |
3 |
4 | import com.secondkill.api.user.vo.AdminUserVo;
5 | import com.secondkill.common.utils.Result;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import java.util.Map;
10 |
11 | /**
12 | * @author choy
13 | * @date 2021/03/04
14 | * 管理员调用用户微服务feign组件
15 | */
16 | @FeignClient(value = "secondkill-user")
17 | public interface IAdminUserFeign {
18 |
19 | /**
20 | * 管理员登录调用接口
21 | * @param reqMap
22 | * @return
23 | */
24 | @PostMapping("/user/admin/login")
25 | Result adminLogin(@RequestBody Map reqMap);
26 | }
27 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/feign/IUserFeign.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.feign;
2 |
3 |
4 | import com.secondkill.api.user.vo.UserVO;
5 | import com.secondkill.common.utils.Result;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.http.MediaType;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 | import org.springframework.web.bind.annotation.PostMapping;
10 | import org.springframework.web.bind.annotation.RequestBody;
11 |
12 | import java.util.HashMap;
13 |
14 |
15 | /**
16 | * @author choy
17 | * @date 2021/03/04
18 | * 用户微服务调用feign
19 | */
20 | @FeignClient("secondkill-user")
21 | public interface IUserFeign {
22 |
23 | /**
24 | * 调用微服务获取用户信息
25 | * @return
26 | */
27 | @GetMapping("/user/test")
28 | String login();
29 |
30 | /**
31 | * 普通用户登录调用服务接口
32 | * @param reqMap
33 | * @return
34 | */
35 | @PostMapping(value = "/user/login")
36 | Result userLogin(@RequestBody HashMap reqMap);
37 | }
38 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/vo/AdminUserVo.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.vo;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * @author choy
7 | * @date 2021/03/03
8 | * 管理员用户vo实体类
9 | */
10 | public class AdminUserVo {
11 |
12 | private Integer id;
13 | private String username;
14 | private String nickname;
15 | private String password;
16 | private Date createTime;
17 |
18 | public Integer getId() {
19 | return id;
20 | }
21 |
22 | public void setId(Integer id) {
23 | this.id = id;
24 | }
25 |
26 | public String getUsername() {
27 | return username;
28 | }
29 |
30 | public void setUsername(String username) {
31 | this.username = username;
32 | }
33 |
34 | public String getNickname() {
35 | return nickname;
36 | }
37 |
38 | public void setNickname(String nickname) {
39 | this.nickname = nickname;
40 | }
41 |
42 | public String getPassword() {
43 | return password;
44 | }
45 |
46 | public void setPassword(String password) {
47 | this.password = password;
48 | }
49 |
50 | public Date getCreateTime() {
51 | return createTime;
52 | }
53 |
54 | public void setCreateTime(Date createTime) {
55 | this.createTime = createTime;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/vo/UserInfoVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.vo;
2 |
3 | /**
4 | * @author choy
5 | * @date 2021/03/15
6 | * 用户信息vo实体类
7 | */
8 | public class UserInfoVO {
9 |
10 | private Integer id;
11 | private String username;
12 | private String nickname;
13 | private String phone;
14 | private String createTime;
15 | private Integer isEnable;
16 |
17 | public Integer getId() {
18 | return id;
19 | }
20 |
21 | public void setId(Integer id) {
22 | this.id = id;
23 | }
24 |
25 | public String getUsername() {
26 | return username;
27 | }
28 |
29 | public void setUsername(String username) {
30 | this.username = username;
31 | }
32 |
33 | public String getNickname() {
34 | return nickname;
35 | }
36 |
37 | public void setNickname(String nickname) {
38 | this.nickname = nickname;
39 | }
40 |
41 | public String getPhone() {
42 | return phone;
43 | }
44 |
45 | public void setPhone(String phone) {
46 | this.phone = phone;
47 | }
48 |
49 | public String getCreateTime() {
50 | return createTime;
51 | }
52 |
53 | public void setCreateTime(String createTime) {
54 | this.createTime = createTime;
55 | }
56 |
57 | public Integer getIsEnable() {
58 | return isEnable;
59 | }
60 |
61 | public void setIsEnable(Integer isEnable) {
62 | this.isEnable = isEnable;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/secondkill-service-api/secondkill-user-api/src/main/java/com/secondkill/api/user/vo/UserVO.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.api.user.vo;
2 |
3 | import com.secondkill.api.user.entry.TbUser;
4 | import org.apache.logging.log4j.message.AsynchronouslyFormattable;
5 |
6 | import java.util.Date;
7 |
8 | /**
9 | * 用户Vo类
10 | * @Author choy
11 | * @date 2021/03/01
12 | */
13 | public class UserVO {
14 |
15 | private Integer id;
16 | private String username;
17 | private String nickname;
18 | private String password;
19 | private String phone;
20 | private String createTime;
21 | private Integer isEnable;
22 |
23 | public Integer getId() {
24 | return id;
25 | }
26 |
27 | public void setId(Integer id) {
28 | this.id = id;
29 | }
30 |
31 | public String getUsername() {
32 | return username;
33 | }
34 |
35 | public void setUsername(String username) {
36 | this.username = username;
37 | }
38 |
39 | public String getNickname() {
40 | return nickname;
41 | }
42 |
43 | public void setNickname(String nickname) {
44 | this.nickname = nickname;
45 | }
46 |
47 | public String getPhone() {
48 | return phone;
49 | }
50 |
51 | public void setPhone(String phone) {
52 | this.phone = phone;
53 | }
54 |
55 | public Integer getIsEnable() {
56 | return isEnable;
57 | }
58 |
59 | public void setIsEnable(Integer isEnable) {
60 | this.isEnable = isEnable;
61 | }
62 |
63 | public String getCreateTime() {
64 | return createTime;
65 | }
66 |
67 | public void setCreateTime(String createTime) {
68 | this.createTime = createTime;
69 | }
70 |
71 | public String getPassword() {
72 | return password;
73 | }
74 |
75 | public void setPassword(String password) {
76 | this.password = password;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/secondkill-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | secondkill
7 | com.choy
8 | 1.1.0
9 |
10 | 4.0.0
11 |
12 | secondkill-service
13 |
14 | pom
15 |
16 |
17 | secondkill-user
18 | secondkill-goods
19 | secondkill-order
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jre
2 | WORKDIR /build
3 | ADD ./target/secondkill-goods-1.1.0.jar ./secondkill-goods.jar
4 | EXPOSE 8021
5 | CMD sleep 40;java -jar secondkill-goods.jar
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.choy
7 | secondkill-service
8 | 1.1.0
9 |
10 |
11 | secondkill-goods
12 |
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-web
17 |
18 |
19 | org.mybatis.spring.boot
20 | mybatis-spring-boot-starter
21 |
22 |
23 | com.alibaba.cloud
24 | spring-cloud-starter-alibaba-nacos-discovery
25 |
26 |
27 | mysql
28 | mysql-connector-java
29 | runtime
30 |
31 |
32 | com.alibaba
33 | druid-spring-boot-starter
34 |
35 |
36 | com.choy
37 | secondkill-common
38 | compile
39 |
40 |
41 | com.choy
42 | secondkill-goods-api
43 |
44 |
45 | com.choy
46 | secondkill-rabbitmq
47 |
48 |
49 | com.choy
50 | secondkill-user-api
51 | compile
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/SecondkillGoodsApplication.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 |
8 | import org.springframework.cloud.openfeign.EnableFeignClients;
9 | import org.springframework.context.annotation.ComponentScan;
10 | import org.springframework.context.annotation.ComponentScans;
11 |
12 | @SpringBootApplication
13 | @EnableDiscoveryClient
14 | @EnableFeignClients("com.secondkill.api.*")
15 | @MapperScan("com.secondkill.system.goods.mapper")
16 | @ComponentScan(basePackages={"com.secondkill"})
17 | public class SecondkillGoodsApplication {
18 |
19 | public static void main(String[] args) {
20 | SpringApplication.run(SecondkillGoodsApplication.class, args);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/mapper/GoodsAdminMapper.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.mapper;
2 |
3 | import com.secondkill.api.goods.entry.TbGoods;
4 | import com.secondkill.api.goods.entry.TbMsGoods;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author choy
11 | * @date 2021/03/10
12 | * 商品管理mapper
13 | */
14 | public interface GoodsAdminMapper {
15 |
16 | /**
17 | * 根据id获取一条商品链接
18 | * @param id
19 | * @return
20 | */
21 | TbGoods getGoodsById(Integer id);
22 |
23 | /**
24 | * 添加秒杀商品
25 | * @return
26 | */
27 | int addMsGoods(TbMsGoods tbMsGoods);
28 |
29 | /**
30 | * 添加商品
31 | * @return
32 | */
33 | int addGoods(TbGoods tbGoods);
34 |
35 | /**
36 | * 获取一条秒杀商品信息
37 | * @param id
38 | * @return
39 | */
40 | TbMsGoods getMsGoodsById(Integer id);
41 |
42 | /**
43 | * 根据分页获取商品列表
44 | * @param page
45 | * @param total
46 | * @return
47 | */
48 | List listGoods(@Param("page")Integer page, @Param("total")Integer total);
49 |
50 | /**
51 | * 统计商品总数
52 | * @return
53 | */
54 | int countGoods();
55 |
56 | /**
57 | * 根据id删除一条商品记录
58 | * @param goodsIds
59 | * @return
60 | */
61 | int delGoods(Integer[] goodsIds);
62 |
63 | /**
64 | * 编辑一条商品信息
65 | * @param tbGoods
66 | * @return
67 | */
68 | int updateGoods(TbGoods tbGoods);
69 |
70 | /**
71 | * 根据分页获取秒杀列表
72 | * @param page
73 | * @param total
74 | * @return
75 | */
76 | List listMsGoods(@Param("page")Integer page, @Param("total")Integer total);
77 |
78 | /**
79 | * 统计秒杀列表总数
80 | * @return
81 | */
82 | int countMsGoods();
83 |
84 | /**
85 | * 删除秒杀商品信息
86 | * @param msGoodsIds
87 | * @return
88 | */
89 | int delMsGoods(Integer[] msGoodsIds);
90 |
91 | /**
92 | * 根据id获取秒杀活动
93 | * @param id
94 | * @return
95 | */
96 | TbMsGoods getMsActivityById(Integer id);
97 |
98 | /**
99 | * 修改秒杀活动信息
100 | * @param tbMsGoods
101 | * @return
102 | */
103 | int updateMsActivity(TbMsGoods tbMsGoods);
104 |
105 | /**
106 | * 根据商品ids删除秒杀活动
107 | * @param goodsIds
108 | * @return
109 | */
110 | int delMsGoodsByGoodsId(Integer[] goodsIds);
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/mapper/TbGoodsMapper.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.mapper;
2 |
3 | import com.secondkill.api.goods.entry.TbGoods;
4 | import com.secondkill.api.goods.entry.TbMsGoods;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author choy
10 | * @date 2021/03/11
11 | * 商品mapper类
12 | */
13 | public interface TbGoodsMapper {
14 |
15 | /**
16 | * 获取所有秒杀商品列表
17 | * @return
18 | */
19 | List listGoods();
20 |
21 | /**
22 | * 根据id获取秒杀商品详情
23 | * @param id
24 | * @return
25 | */
26 | TbMsGoods getMsGoodsById(Integer id);
27 |
28 | /**
29 | * 更新秒杀活动库存
30 | * @param msGoodsId
31 | * @return
32 | */
33 | int updateMsGoodsStock(Integer msGoodsId);
34 |
35 | /**
36 | * 更新秒杀活动库存
37 | * @param goodsId
38 | * @return
39 | */
40 | int updateGoodsStock(Integer goodsId);
41 |
42 |
43 | /**
44 | * 搜索秒杀商品
45 | * @return
46 | */
47 | List listGoodsBySearch(String keyword);
48 | }
49 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/rpc/RpcGoodsController.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.rpc;
2 |
3 |
4 | import com.secondkill.api.goods.entry.TbMsGoods;
5 | import com.secondkill.api.goods.vo.MsGoodsDetailVO;
6 | import com.secondkill.common.enums.ResultErrEnum;
7 | import com.secondkill.common.expection.AppRuntimeException;
8 | import com.secondkill.common.utils.Result;
9 | import com.secondkill.common.utils.ResultUtils;
10 | import com.secondkill.common.utils.TimeUtils;
11 | import com.secondkill.system.goods.service.GoodsService;
12 | import org.springframework.beans.BeanUtils;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.web.bind.annotation.GetMapping;
15 | import org.springframework.web.bind.annotation.PathVariable;
16 | import org.springframework.web.bind.annotation.RequestMapping;
17 | import org.springframework.web.bind.annotation.RestController;
18 |
19 | import java.util.Date;
20 | import java.util.HashMap;
21 | import java.util.Optional;
22 |
23 |
24 | /**
25 | * 微服务rpc调用接口
26 | * @author choy
27 | * @date 2021/03/28
28 | */
29 | @RestController
30 | @RequestMapping("/goods")
31 | public class RpcGoodsController {
32 |
33 | @Autowired
34 | private GoodsService goodsService;
35 |
36 | /**
37 | * 获取秒杀商品详情信息
38 | * @param msGoodsId
39 | * @return
40 | */
41 | @GetMapping("/rpc/msGoods/detail/{msGoodsId}")
42 | public Result getMsGoodsDetail(@PathVariable("msGoodsId") Integer msGoodsId){
43 | if (msGoodsId == 0 || msGoodsId == null){
44 | throw new AppRuntimeException(ResultErrEnum.INVALID_PARAM);
45 | }
46 | Optional msGoodsById = Optional.ofNullable(goodsService.getMsGoodsById(msGoodsId));
47 | if (!msGoodsById.isPresent()){
48 | throw new AppRuntimeException(ResultErrEnum.MS_GOODS_NOT_FOUNT);
49 | }
50 | TbMsGoods tbMsGoods = msGoodsById.get();
51 | MsGoodsDetailVO msGoodsDetailVO = new MsGoodsDetailVO();
52 | BeanUtils.copyProperties(tbMsGoods, msGoodsDetailVO);
53 | msGoodsDetailVO.setGoodsId(tbMsGoods.getTbGoods().getGoodsId());
54 | msGoodsDetailVO.setStartTime(TimeUtils.date2String(tbMsGoods.getStartTime()));
55 | msGoodsDetailVO.setEndTime(TimeUtils.date2String(tbMsGoods.getEndTime()));
56 | msGoodsDetailVO.setGoodsImg(tbMsGoods.getTbGoods().getGoodsImg());
57 | msGoodsDetailVO.setGoodsTitle(tbMsGoods.getTbGoods().getGoodsTitle());
58 | msGoodsDetailVO.setMsPrice(tbMsGoods.getMsPrice().toString());
59 | msGoodsDetailVO.setGoodsPrice(tbMsGoods.getTbGoods().getGoodsPrice().toString());
60 | return ResultUtils.success(msGoodsDetailVO);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/service/GoodsAdminService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.service;
2 |
3 | import com.secondkill.api.goods.dto.EditGoodsDTO;
4 | import com.secondkill.api.goods.dto.GoodsDTO;
5 | import com.secondkill.api.goods.dto.MsGoodsBaseDTO;
6 | import com.secondkill.api.goods.dto.MsGoodsDTO;
7 | import com.secondkill.api.goods.entry.TbGoods;
8 | import com.secondkill.api.goods.entry.TbMsGoods;
9 | import com.secondkill.api.goods.redis.MsGoodsDO;
10 | import org.springframework.web.multipart.MultipartFile;
11 |
12 | import javax.servlet.http.HttpServletRequest;
13 | import java.text.ParseException;
14 | import java.util.List;
15 |
16 | /**
17 | * @author choy
18 | * @date 2021/03/10
19 | * 商品service类
20 | */
21 | public interface GoodsAdminService {
22 |
23 | /**
24 | * 根据id获取商品详情
25 | * @param id
26 | * @return
27 | */
28 | TbGoods getGoodsById(Integer id);
29 |
30 | /**
31 | * 根据分页获取商品列表
32 | * @return
33 | */
34 | List listGoods(Integer page, Integer total);
35 |
36 |
37 | /**
38 | * 发布新商品
39 | * @param goodsDTO
40 | * @return
41 | */
42 | int addGoods(GoodsDTO goodsDTO);
43 |
44 | /**
45 | * 添加秒杀商品
46 | * @return
47 | */
48 | int addMsGoods(MsGoodsDTO msGoodsDTO) throws ParseException;
49 |
50 | /**
51 | * jiang
52 | * @param id
53 | * @return
54 | */
55 | int msGoodsAddRedis(Integer id);
56 |
57 | /**
58 | * 统计商品总条数
59 | * @return
60 | */
61 | int countGoods();
62 |
63 | /**
64 | * 删除商品信息
65 | * @param goodsId
66 | * @return
67 | */
68 | int delGoods(Integer[] goodsId);
69 |
70 | /**
71 | * 根据分页获取秒杀列表
72 | * @param page
73 | * @param total
74 | * @return
75 | */
76 | List listMsGoods(Integer page, Integer total);
77 |
78 | /**
79 | * 统计秒杀总数
80 | * @return
81 | */
82 | int countMsGoods();
83 |
84 | /**
85 | * 根据id删除秒杀商品信息
86 | * @param msGoodsIds
87 | * @return
88 | */
89 | int delMsGoods(Integer[] msGoodsIds);
90 |
91 | /**
92 | * 根据id获取一条秒杀活动
93 | * @param id
94 | * @return
95 | */
96 | TbMsGoods getMsActivityById(Integer id);
97 |
98 | /**
99 | * 修改秒杀活动信息
100 | * @param msGoodsBaseDTO
101 | * @return
102 | */
103 | int updateMsActivity(MsGoodsBaseDTO msGoodsBaseDTO) throws ParseException;
104 |
105 | /**
106 | * 商品图片上传
107 | * @param file
108 | * @return
109 | */
110 | String imgUpload(MultipartFile file);
111 |
112 |
113 | /**
114 | * 编辑商品信息
115 | * @param editGoodsDTO
116 | * @return
117 | */
118 | int updateGoods(EditGoodsDTO editGoodsDTO);
119 | }
120 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/service/GoodsService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.service;
2 |
3 | import com.secondkill.api.goods.entry.TbGoods;
4 | import com.secondkill.api.goods.entry.TbMsGoods;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author choy
10 | * @date 2021/03/11
11 | * 商品实体类
12 | */
13 | public interface GoodsService {
14 |
15 | /**
16 | * 获取秒杀商品列表
17 | * @return
18 | */
19 | List listMsGoods();
20 |
21 | /**
22 | * 根据商品id获取商品详情信息
23 | * @param id
24 | * @return
25 | */
26 | TbMsGoods getMsGoodsById(Integer id);
27 |
28 | /**
29 | * 搜索商品
30 | * @return
31 | */
32 | List listMsGoodsBySearch(String keyword);
33 | }
34 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/service/StockMqService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.service;
2 |
3 | import com.rabbitmq.client.Channel;
4 | import com.secondkill.api.goods.entry.TbMsGoods;
5 | import com.secondkill.message.config.StockQueueConfig;
6 | import com.secondkill.system.goods.mapper.TbGoodsMapper;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.amqp.core.Message;
10 | import org.springframework.amqp.rabbit.annotation.RabbitHandler;
11 | import org.springframework.amqp.rabbit.annotation.RabbitListener;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.stereotype.Service;
14 | import org.springframework.transaction.annotation.Transactional;
15 |
16 | import java.io.IOException;
17 |
18 |
19 | /**
20 | * 消费mq扣减库存服务
21 | * @author choy
22 | * @date 2021/03/30
23 | */
24 | @Service
25 | public class StockMqService{
26 |
27 | private final static Logger logger = LoggerFactory.getLogger(StockMqService.class);
28 |
29 | @Autowired
30 | private TbGoodsMapper goodsMapper;
31 |
32 | /**
33 | * 消费mq扣减库存
34 | * @param msGoodsId
35 | * @return
36 | */
37 | @RabbitListener(queues = StockQueueConfig.STOCK_QUEUE_NAME)
38 | @RabbitHandler
39 | @Transactional
40 | public void updateStock(Channel channel, Message message, Integer msGoodsId) {
41 | // 获取秒杀活动,从中获取商品id
42 | TbMsGoods msGoodsById = goodsMapper.getMsGoodsById(msGoodsId);
43 | Integer goodsId = msGoodsById.getTbGoods().getGoodsId();
44 | if (goodsMapper.updateMsGoodsStock(msGoodsId) == 1){
45 | if(goodsMapper.updateGoodsStock(goodsId) == 1){
46 | logger.info("秒杀活动:{}, 商品:{}, 库存扣减成功", msGoodsId, goodsId);
47 | return;
48 | }
49 | }
50 | logger.info("秒杀活动:{}, 商品:{}, 库存扣减失败", msGoodsId, goodsId);
51 | // 触发回滚
52 | throw new RuntimeException();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/java/com/secondkill/system/goods/service/impl/GoodsServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.goods.service.impl;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.alibaba.fastjson.JSONObject;
5 | import com.secondkill.api.goods.entry.TbGoods;
6 | import com.secondkill.api.goods.entry.TbMsGoods;
7 | import com.secondkill.common.utils.RedisUtils;
8 | import com.secondkill.common.utils.TimeUtils;
9 | import com.secondkill.system.goods.mapper.TbGoodsMapper;
10 | import com.secondkill.system.goods.service.GoodsService;
11 | import org.slf4j.Logger;
12 | import org.slf4j.LoggerFactory;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.stereotype.Service;
15 | import org.springframework.util.StringUtils;
16 |
17 | import java.util.List;
18 |
19 | /**
20 | * @author choy
21 | * @date 2021/03/11
22 | * 商品service实现类
23 | */
24 | @Service
25 | public class GoodsServiceImpl implements GoodsService {
26 |
27 | private final static Logger logger = LoggerFactory.getLogger(GoodsServiceImpl.class);
28 |
29 | @Autowired
30 | private TbGoodsMapper goodsMapper;
31 | @Autowired
32 | private RedisUtils redisUtils;
33 |
34 |
35 |
36 | /**
37 | * 获取秒杀商品列表
38 | * @return
39 | */
40 | @Override
41 | public List listMsGoods() {
42 | List listGoods = goodsMapper.listGoods();
43 | return listGoods;
44 | }
45 |
46 | /**
47 | * 根据商品id获取商品详情信息
48 | * @param id
49 | * @return
50 | */
51 | @Override
52 | public TbMsGoods getMsGoodsById(Integer id) {
53 | String tbMsGoodsString = redisUtils.get("msGoods:" + id);
54 | String stock = redisUtils.get("stock:" + id);
55 | TbMsGoods tbMsGoods = null;
56 | if (StringUtils.isEmpty(tbMsGoodsString)){
57 | tbMsGoods = goodsMapper.getMsGoodsById(id);
58 | int second = TimeUtils.calSecond(tbMsGoods.getEndTime()) + 3600;
59 | try{
60 | redisUtils.setWithTime("msGoods:" + tbMsGoods.getMsGoodsId(), JSON.toJSONString(tbMsGoods), second);
61 | }catch (Exception e){
62 | logger.warn(e.getMessage());
63 | }
64 | }else{
65 | tbMsGoods = JSONObject.parseObject(tbMsGoodsString, TbMsGoods.class);
66 | }
67 | tbMsGoods.setMsGoodsStock(Integer.parseInt(stock == null ? "0" : stock));
68 | return tbMsGoods;
69 | }
70 |
71 |
72 | /**
73 | * 搜索商品
74 | * @param keyword
75 | * @return
76 | */
77 | @Override
78 | public List listMsGoodsBySearch(String keyword) {
79 | return goodsMapper.listGoodsBySearch(keyword);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # port: ${random.int[8011,8020]}
3 | port: 8021
4 | tomcat:
5 | basedir: E:\temp\
6 |
7 | spring:
8 | main:
9 | allow-bean-definition-overriding: true
10 | application:
11 | name: secondkill-goods
12 | cloud:
13 | nacos:
14 | discovery:
15 | server-addr: secondkill-register:8848
16 |
17 | datasource:
18 | driver-class-name: com.mysql.cj.jdbc.Driver
19 | type: com.alibaba.druid.pool.DruidDataSource
20 | druid:
21 | url: jdbc:mysql://secondkill-mysql:3306/choy_ms?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
22 | username: root
23 | password: 86598659yu
24 | initial-size: 10
25 | max-active: 100
26 | min-idle: 10
27 | max-wait: 60000
28 | pool-prepared-statements: true
29 | max-pool-prepared-statement-per-connection-size: 20
30 | time-between-eviction-runs-millis: 60000
31 | min-evictable-idle-time-millis: 300000
32 | validation-query: SELECT 1 FROM DUAL
33 | test-while-idle: true
34 | test-on-borrow: false
35 | test-on-return: false
36 | stat-view-servlet:
37 | enabled: true
38 | url-pattern: /druid/*
39 | #login-username: admin
40 | #login-password: admin
41 | filter:
42 | stat:
43 | log-slow-sql: true
44 | slow-sql-millis: 1000
45 | merge-sql: true
46 | wall:
47 | config:
48 | multi-statement-allow: true
49 |
50 | rabbitmq:
51 | port: 5672
52 | host: secondkill-rabbitmq
53 | username: guest
54 | password: guest
55 |
56 | mybatis:
57 | mapper-locations: classpath*:mapper/*.xml
58 | configuration:
59 | map-underscore-to-camel-case: true
60 |
61 | service-url:
62 | nacos-user-service: http://secondkill-user
63 |
64 | auth:
65 | publicKey:
66 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAmK932VuscbhXmymX4WRyPOnIKlxYEOVJHmSx
67 | AP+cpVnrJB2nm57YqkNtrAhTwfrUWpccMIOUHsJ8AK8GcMBSLkLsbo/H0Bb1aTJ7e/PTeI6/3JF0
68 | T+LKH0VTSiTDA7Xrsm6fFZSeC3TE/wSUuvEuxKoG7pdRhtuerxGFrkygFQIDAQAB
69 |
70 | # Redis服务器地址
71 | redis:
72 | host: secondkill-redis
73 | # Redis服务器连接端口
74 | port: 6379
75 | # Redis服务器连接密码(默认为空)
76 | password: null
77 | timeout: 30000
78 | # 连接池最大连接数(使用负值表示没有限制)
79 | maxTotal: 30
80 | # 连接池中的最大空闲连接
81 | maxIdle: 20
82 | numTestsPerEvictionRun: 1024
83 | timeBetweenEvictionRunsMillis: 30000
84 | minEvictableIdleTimeMillis: 1800000
85 | softMinEvictableIdleTimeMillis: 10000
86 | # 连接池最大阻塞等待时间(使用负值表示没有限制)
87 | maxWaitMillis: 1500
88 | testOnBorrow: true
89 | testWhileIdle: true
90 | blockWhenExhausted: false
91 | JmxEnabled: true
92 |
93 | logger:
94 | level:
95 | com.secondkill: debug
--------------------------------------------------------------------------------
/secondkill-service/secondkill-goods/src/test/java/com/secondkill/SecondkillGoodsApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.secondkill;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SecondkillGoodsApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jre
2 | WORKDIR /build
3 | ADD ./target/secondkill-order-1.1.0.jar ./secondkill-order.jar
4 | EXPOSE 8010
5 | CMD sleep 40; java -jar secondkill-order.jar
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.choy
7 | secondkill-service
8 | 1.1.0
9 |
10 |
11 | secondkill-order
12 |
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-jdbc
17 |
18 |
19 | org.springframework.boot
20 | spring-boot-starter-web
21 |
22 |
23 | org.mybatis.spring.boot
24 | mybatis-spring-boot-starter
25 |
26 |
27 | com.alibaba.cloud
28 | spring-cloud-starter-alibaba-nacos-discovery
29 |
30 |
31 | com.alibaba
32 | druid-spring-boot-starter
33 |
34 |
35 | com.choy
36 | secondkill-goods-api
37 |
38 |
39 | org.springframework.cloud
40 | spring-cloud-starter-openfeign
41 |
42 |
43 | mysql
44 | mysql-connector-java
45 | runtime
46 |
47 |
48 | com.choy
49 | secondkill-common
50 | compile
51 |
52 |
53 | com.choy
54 | secondkill-order-api
55 | compile
56 |
57 |
58 | com.choy
59 | secondkill-rabbitmq
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/main/java/com/secondkill/system/order/SecondkillOrderApplication.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.order;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 | import org.springframework.context.annotation.ComponentScan;
9 |
10 | @SpringBootApplication
11 | @EnableDiscoveryClient
12 | @EnableFeignClients("com.secondkill.api.*")
13 | @ComponentScan(basePackages = {"com.secondkill"})
14 | @MapperScan("com.secondkill.system.order.mapper")
15 | public class SecondkillOrderApplication {
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(SecondkillOrderApplication.class, args);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/main/java/com/secondkill/system/order/mapper/OrderMapper.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.order.mapper;
2 |
3 |
4 | import com.secondkill.api.order.entry.TbOrder;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.Date;
8 | import java.util.List;
9 |
10 | /**
11 | * 订单mapper类
12 | * @author choy
13 | * @date 2021/03/28
14 | */
15 | public interface OrderMapper {
16 |
17 | /**
18 | * 创建订单
19 | * @param tbOrder
20 | * @return
21 | */
22 | int addOrder(TbOrder tbOrder);
23 |
24 | /**
25 | * 订单超时未支付自动取消
26 | * @param orderId
27 | * @return
28 | */
29 | int updateOrderState(Integer orderId);
30 |
31 | /**
32 | * 获取秒杀id和用户id
33 | * @param orderId
34 | * @return
35 | */
36 | TbOrder getMsGoodsIdAndUserId(Integer orderId);
37 |
38 |
39 | /**
40 | * 根据订单id获取订单信息
41 | * @param orderId
42 | * @return
43 | */
44 | TbOrder getOrderById(Integer orderId);
45 |
46 | /**
47 | * 支付订单,修改订单状态
48 | * @param orderId
49 | * @param payTime
50 | * @return
51 | */
52 | int payUpdateOrder(@Param("orderId")Integer orderId, @Param("payTime")Date payTime);
53 |
54 | /**
55 | * 分页列出所有描述订单
56 | * @return
57 | */
58 | List listOrder(@Param("page")Integer page, @Param("total")Integer total);
59 |
60 | /**
61 | * 统计订单总数
62 | * @return
63 | */
64 | int countOrder();
65 |
66 |
67 | /**
68 | * 删除订单
69 | * @param orderIds
70 | * @return
71 | */
72 | int delOrder(Integer[] orderIds);
73 |
74 | /**
75 | * 根据用户id获取该用户的订单
76 | * @param userId
77 | * @return
78 | */
79 | List listOrderByUserId(Integer userId);
80 | }
81 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/main/java/com/secondkill/system/order/service/OrderService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.order.service;
2 |
3 |
4 | import com.secondkill.api.order.entry.TbOrder;
5 | import com.secondkill.api.order.vo.ListOrderVO;
6 | import com.secondkill.api.order.vo.ListUserOrderVO;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * 订单service层实现类
12 | * @author Choy
13 | * @date 2021/03/28
14 | */
15 | public interface OrderService {
16 |
17 | /**
18 | * 创建订单
19 | * @param msGoodsId
20 | * @param userId
21 | * @return
22 | */
23 | int addOrder(Integer msGoodsId, Integer userId);
24 |
25 | /**
26 | * 根据订单id获取订单信息
27 | * @param orderId
28 | * @return
29 | */
30 | TbOrder getOrderById(Integer orderId);
31 |
32 | /**
33 | * 支付订单,修改订单状态
34 | * @param orderId
35 | * @return
36 | */
37 | int payUpdateOrder(Integer orderId);
38 |
39 | /**
40 | * 分页列出所有订单
41 | * @param page
42 | * @param total
43 | * @return
44 | */
45 | List listOrder(Integer page, Integer total);
46 |
47 | /**
48 | * 统计订单总数
49 | * @return
50 | */
51 | int countOrder();
52 |
53 | /**
54 | * 删除订单
55 | * @param ids
56 | * @return
57 | */
58 | int delOrder(Integer[] ids);
59 |
60 | /**
61 | * 根据用户id获取该用户的订单列表
62 | * @param userId
63 | * @return
64 | */
65 | List listOrderByUserId(Integer userId);
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # port: ${random.int[8021,8030]}
3 | port: 8010
4 |
5 | spring:
6 | application:
7 | name: secondkill-order
8 | datasource:
9 | driver-class-name: com.mysql.cj.jdbc.Driver
10 | type: com.alibaba.druid.pool.DruidDataSource
11 | druid:
12 | url: jdbc:mysql://secondkill-mysql:3306/choy_ms?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
13 | username: root
14 | password: 86598659yu
15 | initial-size: 10
16 | max-active: 100
17 | min-idle: 10
18 | max-wait: 60000
19 | pool-prepared-statements: true
20 | max-pool-prepared-statement-per-connection-size: 20
21 | time-between-eviction-runs-millis: 60000
22 | min-evictable-idle-time-millis: 300000
23 | validation-query: SELECT 1 FROM DUAL
24 | test-while-idle: true
25 | test-on-borrow: false
26 | test-on-return: false
27 | stat-view-servlet:
28 | enabled: true
29 | url-pattern: /druid/*
30 | #login-username: admin
31 | #login-password: admin
32 | filter:
33 | stat:
34 | log-slow-sql: true
35 | slow-sql-millis: 1000
36 | merge-sql: true
37 | wall:
38 | config:
39 | multi-statement-allow: true
40 |
41 | redis:
42 | host: secondkill-redis
43 | port: 6379
44 | password:
45 | jedis:
46 | pool:
47 | max-active: 8
48 | max-wait: -1
49 | max-idle: 500
50 | min-idle: 0
51 | lettuce:
52 | shutdown-timeout: 0
53 |
54 | rabbitmq:
55 | host: secondkill-rabbitmq
56 | port: 5672
57 | username: guest
58 | password: guest
59 |
60 | cloud:
61 | nacos:
62 | discovery:
63 | # group: order
64 | # namespace: dev
65 | server-addr: secondkill-register:8848
66 | # ip: 127.0.0.1
67 |
68 |
69 | service-url:
70 | nacos-user-service: http://secondkill-user
71 | nacos-goods-service: http://secondkill-goods
72 |
73 | auth:
74 | publicKey:
75 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAmK932VuscbhXmymX4WRyPOnIKlxYEOVJHmSx
76 | AP+cpVnrJB2nm57YqkNtrAhTwfrUWpccMIOUHsJ8AK8GcMBSLkLsbo/H0Bb1aTJ7e/PTeI6/3JF0
77 | T+LKH0VTSiTDA7Xrsm6fFZSeC3TE/wSUuvEuxKoG7pdRhtuerxGFrkygFQIDAQAB
78 |
79 |
80 | # Redis服务器地址
81 | redis:
82 | host: secondkill-redis
83 | # Redis服务器连接端口
84 | port: 6379
85 | # Redis服务器连接密码(默认为空)
86 | password: null
87 | timeout: 30000
88 | # 连接池最大连接数(使用负值表示没有限制)
89 | maxTotal: 30
90 | # 连接池中的最大空闲连接
91 | maxIdle: 10
92 | numTestsPerEvictionRun: 1024
93 | timeBetweenEvictionRunsMillis: 30000
94 | minEvictableIdleTimeMillis: 1800000
95 | softMinEvictableIdleTimeMillis: 10000
96 | # 连接池最大阻塞等待时间(使用负值表示没有限制)
97 | maxWaitMillis: 1500
98 | testOnBorrow: true
99 | testWhileIdle: true
100 | blockWhenExhausted: false
101 | JmxEnabled: true
102 |
103 | logger:
104 | level:
105 | root: debug
106 |
107 | mybatis:
108 | mapper-locations: classpath*:mapper/*.xml
109 | configuration:
110 | map-underscore-to-camel-case: true
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/main/resources/com/secondkill/system/order/mapper/OrderMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 | insert into
11 | tb_order(goods_id, user_id,ms_goods_id, count, unit_price, goods_title, order_state, create_time)
12 | value(
13 | #{goodsId},#{userId},#{msGoodsId},#{count},#{unitPrice},#{goodsTitle},#{orderState},#{createTime}
14 | )
15 |
16 |
17 |
18 |
19 |
20 | update tb_order set order_state = 2 where id = #{id}
21 |
22 |
23 |
24 |
25 | update tb_order set order_state = 0, pay_time = #{payTime} where id = #{orderId}
26 |
27 |
28 |
29 |
30 |
31 |
34 |
35 |
36 |
39 |
40 |
41 |
53 |
54 |
55 |
58 |
59 |
60 |
61 |
62 | delete from tb_order where id in
63 |
64 | #{orderId}
65 |
66 |
67 |
68 |
69 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-order/src/test/java/com/secondkill/SecondkillOrderApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.secondkill;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SecondkillOrderApplicationTests {
8 |
9 |
10 | @Test
11 | void contextLoads() {
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jre
2 | WORKDIR /build
3 | ADD ./target/secondkill-user-1.1.0.jar ./secondkill-user.jar
4 | EXPOSE 8001
5 | CMD sleep 40; java -jar secondkill-user.jar
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.choy
7 | secondkill-service
8 | 1.1.0
9 |
10 |
11 | secondkill-user
12 |
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-jdbc
17 |
18 |
19 | org.springframework.boot
20 | spring-boot-starter-web
21 |
22 |
23 | org.mybatis.spring.boot
24 | mybatis-spring-boot-starter
25 |
26 |
27 | com.alibaba
28 | druid-spring-boot-starter
29 |
30 |
31 | mysql
32 | mysql-connector-java
33 | runtime
34 |
35 |
36 | com.alibaba.cloud
37 | spring-cloud-starter-alibaba-nacos-discovery
38 |
39 |
40 |
41 | org.springframework.cloud
42 | spring-cloud-starter-openfeign
43 |
44 |
45 | com.choy
46 | secondkill-user-api
47 | compile
48 |
49 |
50 | com.choy
51 | secondkill-common
52 | compile
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/SecondkillUserApplication.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 | import org.springframework.context.annotation.ComponentScan;
9 |
10 |
11 | @SpringBootApplication
12 | @EnableDiscoveryClient
13 | @EnableFeignClients("com.secondkill.api.*")
14 | @MapperScan("com.secondkill.system.user.mapper")
15 | @ComponentScan(basePackages = {"com.secondkill"})
16 | public class SecondkillUserApplication {
17 |
18 |
19 | public static void main(String[] args) {
20 | SpringApplication.run(SecondkillUserApplication.class, args);
21 | }
22 |
23 | }
24 |
25 |
26 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/mapper/TbAdminUserMapper.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user.mapper;
2 |
3 | import com.secondkill.api.user.entry.TbAdminUser;
4 | import org.apache.ibatis.annotations.Param;
5 |
6 | /**
7 | * @author Choy
8 | * @date 2021/03/03
9 | * 管理员用户mapper层
10 | */
11 | public interface TbAdminUserMapper {
12 |
13 | /**
14 | * 管理员登录
15 | * @param username
16 | * @param password
17 | * @return
18 | */
19 | TbAdminUser login(@Param("username") String username, @Param("password") String password);
20 |
21 |
22 | /**
23 | * 根据管理员id获取管理员信息
24 | * @param id
25 | * @return
26 | */
27 | TbAdminUser getAdminInfoById(Integer id);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/mapper/TbUserMapper.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user.mapper;
2 |
3 | import com.secondkill.api.user.entry.TbUser;
4 | import org.apache.ibatis.annotations.Param;
5 |
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | /**
10 | * @author cairunyu
11 | * @date 2021/02/13
12 | * 用户dao层
13 | */
14 | public interface TbUserMapper {
15 |
16 | /**
17 | * 根据id获取用户信息
18 | *
19 | * @param id
20 | * @return
21 | */
22 | TbUser getUserById(Integer id);
23 |
24 | /**
25 | * 添加用户
26 | *
27 | * @param tbUser
28 | * @return
29 | */
30 | int insertUser(TbUser tbUser);
31 |
32 | /**
33 | * 修改用户
34 | *
35 | * @param tbUser
36 | * @return
37 | */
38 | int updateUser(TbUser tbUser);
39 |
40 | /**
41 | * 用户登录
42 | * @param username
43 | * @param password
44 | * @return
45 | */
46 | TbUser login(@Param("username") String username, @Param("password") String password);
47 |
48 | /**
49 | * 用户注册
50 | * @param tbUser
51 | * @return
52 | */
53 | int userRegister(TbUser tbUser);
54 |
55 | /**
56 | * 分页列出商城所有会员,一次返回10条记录
57 | * @return
58 | */
59 | List listUser(@Param("page")Integer page, @Param("total") Integer total);
60 |
61 | /**
62 | * 统计用户数
63 | * @return
64 | */
65 | int countUser();
66 |
67 | /**
68 | * 删除用户
69 | * @param id
70 | * @return
71 | */
72 | int delUser(Integer id);
73 |
74 | /**
75 | * 启用/停用商城会员
76 | * @param id
77 | * @param isEnable
78 | * @return
79 | */
80 | int updateUserIsEnable(@Param("id")Integer id, @Param("isEnable")Integer isEnable);
81 |
82 | /**
83 | * 检验用户名是否已注册
84 | * @param username
85 | * @return
86 | */
87 | int checkUsername(String username);
88 |
89 | /**
90 | * 用户注册
91 | * @param tbUser
92 | * @return
93 | */
94 | int register(TbUser tbUser);
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/service/UserAdminService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user.service;
2 |
3 | import com.secondkill.api.user.dto.UserDTO;
4 | import com.secondkill.api.user.entry.TbAdminUser;
5 | import com.secondkill.api.user.entry.TbUser;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * 用户管理模块service层
11 | * @author choy
12 | * @date 2021/03/01
13 | */
14 | public interface UserAdminService {
15 |
16 | /**
17 | * 管理员登录操作
18 | * @param username
19 | * @param password
20 | * @return
21 | */
22 | TbAdminUser login(String username, String password);
23 |
24 | /**
25 | * 根据用户id获取管理员信息
26 | * @param token 传递的token
27 | * @return
28 | */
29 | TbAdminUser getAdminInfoById(String token);
30 |
31 | /**
32 | * 分页返回商城会员列表
33 | * @param page 页数
34 | * @param total 条数
35 | * @return
36 | */
37 | List listUser(Integer page, Integer total);
38 |
39 | /**
40 | * 统计商城会员用户总数
41 | * @return
42 | */
43 | int countUser();
44 |
45 | /**
46 | * 添加新用户
47 | * @param tbUser
48 | * @return
49 | */
50 | Integer insertUser(TbUser tbUser);
51 |
52 | /**
53 | * 更新用户信息
54 | * @param userDTO
55 | * @return
56 | */
57 | Integer updateUser(UserDTO userDTO);
58 |
59 | /**
60 | * 删除用户
61 | * @param id
62 | * @return
63 | */
64 | Integer delUser(Integer id);
65 |
66 | /**
67 | * 启用/停用商城会员帐号
68 | * @param id
69 | * @param isEnable
70 | * @return
71 | */
72 | Integer updateUserIsEnable(Integer id, Integer isEnable);
73 |
74 | /**
75 | * 根据id获取会员信息
76 | * @param id
77 | * @return
78 | */
79 | TbUser getUserById(Integer id);
80 | }
81 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user.service;
2 |
3 | import com.secondkill.api.user.dto.UserDTO;
4 | import com.secondkill.api.user.entry.TbUser;
5 | import com.secondkill.api.user.vo.UserVO;
6 |
7 | /**
8 | * @author cairunyu
9 | * @date 2021/02/13
10 | * 用户service层
11 | */
12 | public interface UserService {
13 |
14 | /**
15 | * 用户登录操作
16 | * @param username
17 | * @param password
18 | * @return
19 | */
20 | TbUser login(String username, String password);
21 |
22 | /**
23 | * 用户注册操作
24 | * @param tbUser
25 | * @return
26 | */
27 | int register(TbUser tbUser);
28 |
29 | /**
30 | * 根据id获取用户信息
31 | * @param id
32 | * @return
33 | */
34 | TbUser getUserInfo(Integer id);
35 |
36 | /**
37 | * 检验用户名是否已经注册
38 | * @param username
39 | * @return
40 | */
41 | int checkUsername(String username);
42 |
43 |
44 | /**
45 | * 用户注册
46 | * @param username
47 | * @param password
48 | * @return
49 | */
50 | int register(String username, String password);
51 | }
52 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/java/com/secondkill/system/user/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.system.user.service.impl;
2 |
3 | import com.secondkill.api.user.entry.TbUser;
4 | import com.secondkill.api.user.vo.UserInfoVO;
5 | import com.secondkill.system.user.mapper.TbUserMapper;
6 | import com.secondkill.system.user.service.UserService;
7 | import org.springframework.beans.BeanUtils;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 | import java.util.Date;
11 |
12 | /**
13 | * @auhtor cairunyu
14 | * @date 2021/02/13
15 | * 用户service层实现类
16 | */
17 | @Service
18 | public class UserServiceImpl implements UserService {
19 |
20 |
21 | @Autowired
22 | private TbUserMapper userMapper;
23 |
24 |
25 | /**
26 | * 用户登录操作
27 | * @param username
28 | * @param password
29 | * @return
30 | */
31 | @Override
32 | public TbUser login(String username, String password) {
33 | return userMapper.login(username, password);
34 | }
35 |
36 | /**
37 | * 用户注册操作
38 | * @param tbUser
39 | * @return
40 | */
41 | @Override
42 | public int register(TbUser tbUser) {
43 | tbUser.setCreateTime(new Date());
44 | tbUser.setIsEnable(0);
45 | return userMapper.userRegister(tbUser);
46 | }
47 |
48 | /**
49 | * 根据id获取用户信息
50 | * @param id
51 | * @return
52 | */
53 | @Override
54 | public TbUser getUserInfo(Integer id) {
55 | return userMapper.getUserById(id);
56 | }
57 |
58 |
59 | /**
60 | * 检验用户名是否已注册
61 | * @param username
62 | * @return
63 | */
64 | @Override
65 | public int checkUsername(String username) {
66 | return userMapper.checkUsername(username);
67 | }
68 |
69 | /**
70 | * 用户注册
71 | * @param username
72 | * @param password
73 | * @return
74 | */
75 | @Override
76 | public int register(String username, String password) {
77 | TbUser tbUser = new TbUser();
78 | tbUser.setUsername(username);
79 | tbUser.setPassword(password);
80 | tbUser.setCreateTime(new Date());
81 | tbUser.setNickname(username);
82 | return userMapper.register(tbUser);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # port: ${random.int[8000,8010]}
3 | port: 8001
4 | spring:
5 | main:
6 | allow-bean-definition-overriding: true
7 | application:
8 | name: secondkill-user
9 | datasource:
10 | driver-class-name: com.mysql.cj.jdbc.Driver
11 | type: com.alibaba.druid.pool.DruidDataSource
12 | druid:
13 | url: jdbc:mysql://secondkill-mysql:3306/choy_ms?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
14 | username: root
15 | password: 86598659yu
16 | initial-size: 10
17 | max-active: 100
18 | min-idle: 10
19 | max-wait: 60000
20 | pool-prepared-statements: true
21 | max-pool-prepared-statement-per-connection-size: 20
22 | time-between-eviction-runs-millis: 60000
23 | min-evictable-idle-time-millis: 300000
24 | validation-query: SELECT 1 FROM DUAL
25 | test-while-idle: true
26 | test-on-borrow: false
27 | test-on-return: false
28 | stat-view-servlet:
29 | enabled: true
30 | url-pattern: /druid/*
31 | #login-username: admin
32 | #login-password: admin
33 | filter:
34 | stat:
35 | log-slow-sql: true
36 | slow-sql-millis: 1000
37 | merge-sql: true
38 | wall:
39 | config:
40 | multi-statement-allow: true
41 |
42 | cloud:
43 | nacos:
44 | discovery:
45 | server-addr: secondkill-register:8848
46 | # namespace: dev
47 | # group: user
48 | # ip: 127.0.0.1
49 |
50 |
51 | redis:
52 | host: secondkill-redis
53 | port: 6379
54 | password:
55 | jedis:
56 | pool:
57 | max-active: 8
58 | max-wait: -1
59 | max-idle: 500
60 | min-idle: 0
61 | lettuce:
62 | shutdown-timeout: 0
63 |
64 | mybatis:
65 | mapper-locations: classpath*:mapper/*.xml
66 | configuration:
67 | map-underscore-to-camel-case: true
68 |
69 |
70 | auth:
71 | publicKey:
72 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAmK932VuscbhXmymX4WRyPOnIKlxYEOVJHmSx
73 | AP+cpVnrJB2nm57YqkNtrAhTwfrUWpccMIOUHsJ8AK8GcMBSLkLsbo/H0Bb1aTJ7e/PTeI6/3JF0
74 | T+LKH0VTSiTDA7Xrsm6fFZSeC3TE/wSUuvEuxKoG7pdRhtuerxGFrkygFQIDAQAB
75 |
76 |
77 | # Redis服务器地址
78 | redis:
79 | host: secondkill-redis
80 | # Redis服务器连接端口
81 | port: 6379
82 | # Redis服务器连接密码(默认为空)
83 | password: null
84 | timeout: 30000
85 | # 连接池最大连接数(使用负值表示没有限制)
86 | maxTotal: 30
87 | # 连接池中的最大空闲连接
88 | maxIdle: 10
89 | numTestsPerEvictionRun: 1024
90 | timeBetweenEvictionRunsMillis: 30000
91 | minEvictableIdleTimeMillis: 1800000
92 | softMinEvictableIdleTimeMillis: 10000
93 | # 连接池最大阻塞等待时间(使用负值表示没有限制)
94 | maxWaitMillis: 1500
95 | testOnBorrow: true
96 | testWhileIdle: true
97 | blockWhenExhausted: false
98 | JmxEnabled: true
99 |
100 |
101 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/resources/mapper/TbAdminUserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
22 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/main/resources/mapper/TbUserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | insert into tb_user(username, nickname, password, create_time, is_enable)
18 | value(#{username}, #{nickname}, #{password}, #{createTime}, #{isEnable})
19 |
20 |
21 |
22 |
23 |
24 | update tb_user
25 | set
26 | username = #{username}, nickname = #{nickname}, password = #{password}
27 | where
28 | id = #{id}
29 |
30 |
31 |
32 |
33 | delete from tb_user where id = #{id}
34 |
35 |
36 |
37 |
40 |
41 |
42 |
45 |
46 |
47 |
48 | insert into
49 | tb_user(id, username, nickname, password, create_time, is_enable)
50 | value(
51 | #{id}, #{username}, #{nickname}, #{nickname}, #{password}, #{createTime}, #{isEnable}
52 | )
53 |
54 |
55 |
56 |
64 |
65 |
66 |
69 |
70 |
71 |
72 |
73 | update tb_user set is_enable = #{isEnable} where id = #{id}
74 |
75 |
76 |
77 |
78 |
81 |
82 |
83 |
84 |
85 | insert into tb_user(username, nickname, password, create_time, is_enable)
86 | value(#{username}, #{nickname}, #{password}, #{createTime}, 1)
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/secondkill-service/secondkill-user/src/test/java/com/secondkill/SecondkillUserApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.secondkill;
2 |
3 | import com.alibaba.nacos.api.annotation.NacosInjected;
4 | import com.alibaba.nacos.api.exception.NacosException;
5 | import com.alibaba.nacos.api.naming.NamingService;
6 | import org.junit.jupiter.api.Test;
7 | import org.springframework.boot.test.context.SpringBootTest;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RequestMethod;
11 | import org.springframework.web.bind.annotation.RequestParam;
12 | import org.springframework.web.bind.annotation.ResponseBody;
13 |
14 | @SpringBootTest
15 | class SecondkillUserApplicationTests {
16 |
17 | @Test
18 | void contextLoads() {
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/secondkill-zuul/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/secondkill-zuul/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jre
2 | WORKDIR /build
3 | ADD ./target/secondkill-zuul-1.1.0.jar ./secondkill-zuul.jar
4 | EXPOSE 8000
5 | CMD sleep 30;java -jar secondkill-zuul.jar
--------------------------------------------------------------------------------
/secondkill-zuul/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.choy
7 | secondkill
8 | 1.1.0
9 |
10 |
11 | secondkill-zuul
12 |
13 |
14 |
15 | org.springframework.cloud
16 | spring-cloud-starter-netflix-zuul
17 |
18 |
19 | com.choy
20 | secondkill-common
21 |
22 |
23 |
24 | com.marcosbarbero.cloud
25 | spring-cloud-zuul-ratelimit
26 |
27 |
28 | com.alibaba.cloud
29 | spring-cloud-starter-alibaba-nacos-discovery
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/main/java/com/secondkill/zuul/SecondkillZuulApplication.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.zuul;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.context.annotation.ComponentScan;
9 |
10 | @SpringBootApplication
11 | @EnableDiscoveryClient
12 | @EnableZuulProxy
13 | @ComponentScan(basePackages = "com.secondkill")
14 | public class SecondkillZuulApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(SecondkillZuulApplication.class, args);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/main/java/com/secondkill/zuul/config/CorsConfig.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.zuul.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.cors.CorsConfiguration;
6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
7 | import org.springframework.web.filter.CorsFilter;
8 |
9 | @Configuration
10 | public class CorsConfig {
11 |
12 | @Bean
13 | public CorsFilter corsFilter() {
14 | final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
15 | final CorsConfiguration config = new CorsConfiguration();
16 | config.setAllowCredentials(true);
17 | config.addAllowedOrigin("*");
18 | config.addAllowedHeader("*");
19 | config.setMaxAge(18000L);
20 | config.addAllowedMethod("*");
21 | source.registerCorsConfiguration("/**", config);
22 | return new CorsFilter(source);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/main/java/com/secondkill/zuul/filter/RateLimitFilter.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.zuul.filter;
2 |
3 | import com.google.common.util.concurrent.RateLimiter;
4 | import com.netflix.zuul.ZuulFilter;
5 | import com.netflix.zuul.context.RequestContext;
6 | import com.netflix.zuul.exception.ZuulException;
7 | import com.secondkill.zuul.service.RateLimitService;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Component;
12 | import org.springframework.util.AntPathMatcher;
13 | import javax.servlet.http.HttpServletRequest;
14 | import javax.servlet.http.HttpServletResponse;
15 |
16 | /**
17 | * 限流过滤器
18 | * @author choy
19 | * @date 2021/03/25
20 | */
21 | @Component
22 | public class RateLimitFilter extends ZuulFilter {
23 |
24 | private static final Logger logger = LoggerFactory.getLogger(RateLimitFilter.class);
25 |
26 | @Autowired
27 | private RateLimitService rateLimitService;
28 |
29 | @Override
30 | public String filterType() {
31 | return "pre";
32 | }
33 |
34 | @Override
35 | public int filterOrder() {
36 | return 0;
37 | }
38 |
39 | @Override
40 | public boolean shouldFilter() {
41 | // 获取请求上下文
42 | RequestContext ctx = RequestContext.getCurrentContext();
43 | // 获取请求
44 | HttpServletRequest request = ctx.getRequest();
45 | // 获取请求的uri
46 | String uri = request.getRequestURI();
47 | // uri地址匹配
48 | AntPathMatcher antPathMatcher = new AntPathMatcher();
49 | // 如果是立即抢购地址,则需要限流,其他接口暂时不用
50 | return checkUrl(uri);
51 | }
52 |
53 | /**
54 | * 校验需要进行权限校验的url,白名单匹配
55 | * @return
56 | */
57 | public Boolean checkUrl(String url){
58 | AntPathMatcher antPathMatcher = new AntPathMatcher();
59 | String[] writeUrls = new String[]{
60 | "/api/order/checkStock/{id}",
61 | "/api/order/createOrder/{id}"
62 | };
63 | boolean flag = false;
64 | for (String writeUrl : writeUrls) {
65 | if (antPathMatcher.match(writeUrl, url)){
66 | flag = true;
67 | break;
68 | }
69 | }
70 | return flag;
71 | }
72 |
73 | @Override
74 | public Object run() throws ZuulException {
75 | RequestContext ctx = RequestContext.getCurrentContext();
76 | HttpServletResponse response = ctx.getResponse();
77 | try{
78 | logger.info("获取令牌");
79 | // 尝试获取令牌
80 | if (!rateLimitService.tryAcquire()){
81 | ctx.setSendZuulResponse(false);
82 | response.setCharacterEncoding("UTF-8");
83 | response.setContentType("application/json;charset=utf-8");
84 | ctx.setResponseBody("{\"code\":40004, \"msg\":\"哎呀,访问人数多,店小二正在处理~\"}");
85 | logger.info("被限流了");
86 | }else{
87 | logger.info("没有被限流");
88 | ctx.setSendZuulResponse(true);
89 | return true;
90 | }
91 | }catch (Exception e){
92 | ctx.setSendZuulResponse(false);
93 | }finally {
94 | return false;
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/main/java/com/secondkill/zuul/service/RateLimitService.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.zuul.service;
2 |
3 | import com.google.common.util.concurrent.RateLimiter;
4 | import org.springframework.stereotype.Service;
5 |
6 | /**
7 | * 令牌桶限流
8 | * @author choy
9 | * @date 2021/03/25
10 | */
11 | @Service
12 | public class RateLimitService {
13 |
14 | /**
15 | * 每秒发出10个令牌
16 | */
17 | RateLimiter rateLimiter = RateLimiter.create(10.0);
18 |
19 | /**
20 | * 尝试获取令牌
21 | * @return
22 | */
23 | public Boolean tryAcquire(){
24 | return rateLimiter.tryAcquire();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # port: ${random.int[8011,8020]}
3 | port: 8000
4 | tomcat:
5 | basedir: E:\temp\
6 |
7 | spring:
8 | application:
9 | name: secondkill-zuul
10 | cloud:
11 | nacos:
12 | discovery:
13 | server-addr: secondkill-register:8848
14 |
15 | ribbon:
16 | ReadTimeout: 5000
17 | # 请求连接超时时间
18 | ConnectTimeout: 1000
19 |
20 |
21 | zuul:
22 | routes:
23 | secondkill-user:
24 | path: /user/**
25 | serviceId: secondkill-user
26 | stripPrefix: false
27 | secondkill-order:
28 | path: /order/**
29 | serviceId: secondkill-order
30 | stripPrefix: false
31 | secondkill-auth:
32 | path: /auth/**
33 | serviceId: secondkill-auth
34 | stripPrefix: false
35 | secondkill-good:
36 | path: /goods/**
37 | serviceId: secondkill-goods
38 | stripPrefix: false
39 | prefix: /api
40 | sensitiveHeaders: "*"
41 | strip-prefix: true
42 | auth:
43 | publicKey:
44 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAmK932VuscbhXmymX4WRyPOnIKlxYEOVJHmSx
45 | AP+cpVnrJB2nm57YqkNtrAhTwfrUWpccMIOUHsJ8AK8GcMBSLkLsbo/H0Bb1aTJ7e/PTeI6/3JF0
46 | T+LKH0VTSiTDA7Xrsm6fFZSeC3TE/wSUuvEuxKoG7pdRhtuerxGFrkygFQIDAQAB
47 |
48 |
49 | # Redis服务器地址
50 | redis:
51 | host: secondkill-redis:127.0.0.1
52 | # Redis服务器连接端口
53 | port: 6379
54 | # Redis服务器连接密码(默认为空)
55 | password: null
56 | timeout: 30000
57 | # 连接池最大连接数(使用负值表示没有限制)
58 | maxTotal: 30
59 | # 连接池中的最大空闲连接
60 | maxIdle: 10
61 | numTestsPerEvictionRun: 1024
62 | timeBetweenEvictionRunsMillis: 30000
63 | minEvictableIdleTimeMillis: 1800000
64 | softMinEvictableIdleTimeMillis: 10000
65 | # 连接池最大阻塞等待时间(使用负值表示没有限制)
66 | maxWaitMillis: 1500
67 | testOnBorrow: true
68 | testWhileIdle: true
69 | blockWhenExhausted: false
70 | JmxEnabled: true
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/secondkill-zuul/src/test/java/com/secondkill/zuul/SecondkillZuulApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.secondkill.zuul;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SecondkillZuulApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------