From c81f7206397c1098fd07a3d61f0a54ae863e8ad1 Mon Sep 17 00:00:00 2001
From: bunny <1319900154@qq.com>
Date: Fri, 26 Jul 2024 08:39:20 +0800
Subject: [PATCH 1/4] =?UTF-8?q?feat(=E6=96=B0=E5=A2=9E):=20:rocket:=20?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=BA=93=E6=BA=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
service/pom.xml | 6 ++++++
service/src/main/resources/application.yml | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/service/pom.xml b/service/pom.xml
index f738218..9234c70 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -60,6 +60,12 @@
org.aspectj
aspectjweaver
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot3-starter
+ 4.3.1
+
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 60bc9fa..35e44de 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -13,6 +13,23 @@ spring:
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
password: ${bunny.datasource.password}
+ # dynamic:
+ # primary: master #设置默认的数据源或者数据源组,默认值即为master
+ # strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+ # grace-destroy: false #是否优雅关闭数据源,默认为false,设置为true时,关闭数据源时如果数据源中还存在活跃连接,至多等待10s后强制关闭
+ # datasource:
+ # master:
+ # driver-class-name: com.zaxxer.hikari.HikariDataSource
+ # url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
+ # username: ${bunny.datasource.username}
+ # password: ${bunny.datasource.password}
+ # i18n:
+ # url: jdbc:mysql://${bunny.datasource2.host}:${bunny.datasource2.port}/${bunny.datasource2.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
+ # username: ${bunny.datasource2.username}
+ # password: ${bunny.datasource2.password}
+ # driver-class-name: com.zaxxer.hikari.HikariDataSource
+ # aop:
+ # enabled: true
data:
redis:
--
2.43.0
From 25d27ffa693a04d74a8add7dbff0b7b1a887e314 Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Sat, 27 Jul 2024 22:35:15 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=20feat(=E4=BF=AE=E6=94=B9):=20:art:=20?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E5=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/common-generator/pom.xml | 20 ----------
common/pom.xml | 20 ++++++++++
common/service-utils/pom.xml | 18 ++-------
.../common/service/config/Knife4jConfig.java | 13 ++-----
.../service/config/MybatisPlusConfig.java | 6 ---
dao/pom.xml | 37 -------------------
pom.xml | 16 ++++----
service/pom.xml | 27 +++++++++-----
.../src/main/resources/application-dev.yml | 6 +--
.../src/main/resources/application-prod.yml | 2 +-
10 files changed, 57 insertions(+), 108 deletions(-)
diff --git a/common/common-generator/pom.xml b/common/common-generator/pom.xml
index c99ab7e..8a81ce5 100644
--- a/common/common-generator/pom.xml
+++ b/common/common-generator/pom.xml
@@ -18,31 +18,11 @@
-
- org.projectlombok
- lombok
-
javax.xml.bind
jaxb-api
2.1
-
-
- mysql
- mysql-connector-java
-
-
-
- com.zaxxer
- HikariCP
- 5.1.0
-
-
-
- com.baomidou
- mybatis-plus-spring-boot3-starter
-
com.baomidou
diff --git a/common/pom.xml b/common/pom.xml
index f82ae99..05e0527 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -25,5 +25,25 @@
io.jsonwebtoken
jjwt
+
+
+ cn.hutool
+ hutool-all
+
+
+
+ com.alibaba.fastjson2
+ fastjson2
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.zaxxer
+ HikariCP
+
diff --git a/common/service-utils/pom.xml b/common/service-utils/pom.xml
index 32bafae..6cf708f 100644
--- a/common/service-utils/pom.xml
+++ b/common/service-utils/pom.xml
@@ -22,6 +22,10 @@
dao
0.0.1-SNAPSHOT
+
+ org.springframework.boot
+ spring-boot-starter-web
+
javax.xml.bind
@@ -34,15 +38,6 @@
httpclient
4.5.14
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-starter-web
-
org.springframework.boot
@@ -54,11 +49,6 @@
redisson
3.26.1
-
-
- com.github.pagehelper
- pagehelper
-
org.lionsoul
diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java
index 5abefce..6eff47b 100644
--- a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java
+++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java
@@ -15,13 +15,12 @@ import org.springframework.context.annotation.Configuration;
public class Knife4jConfig {
@Bean
public OpenAPI openAPI() {
- log.info("Knife4jConfig===>配置knife4j");
// 作者等信息
Contact contact = new Contact().name("Bunny").email("1319900154@qq.com").url("http://z-bunny.com");
// 使用协议
License license = new License().name("MIT").url("http://MUT.com");
// 相关信息
- Info info = new Info().title("Bunny-Java-Template").description("Bunny的Java模板").version("v1.0.0").contact(contact).license(license);
+ Info info = new Info().title("Bunny-Java-Template").description("Bunny的Java模板").version("v1.0.0").contact(contact).license(license).termsOfService("记得给我start");
return new OpenAPI().info(info).externalDocs(new ExternalDocumentation());
}
@@ -29,18 +28,12 @@ public class Knife4jConfig {
// 前台相关分类接口
@Bean
public GroupedOpenApi groupedOpenApi() {
- return GroupedOpenApi.builder().group("前台接口管理").pathsToMatch("/api/**").build();
+ return GroupedOpenApi.builder().group("web前台接口管理").pathsToMatch("/api/**").build();
}
// 管理员相关分类接口
@Bean
public GroupedOpenApi groupedOpenAdminApi() {
- return GroupedOpenApi.builder().group("管理员接口请求").pathsToMatch("/admin/**").build();
- }
-
- // 测试相关分类接口
- @Bean
- public GroupedOpenApi testGroupedOpenApi() {
- return GroupedOpenApi.builder().group("测试相关分类接口").pathsToMatch("/test/**").build();
+ return GroupedOpenApi.builder().group("admin管理员接口请求").pathsToMatch("/admin/**").build();
}
}
diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java
index 013c778..519a465 100644
--- a/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java
+++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import com.github.pagehelper.PageInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -34,9 +33,4 @@ public class MybatisPlusConfig {
return interceptor;
}
-
- @Bean// pagehelper分页插件需要配的拦截器
- public PageInterceptor pageInterceptor() {
- return new PageInterceptor();
- }
}
diff --git a/dao/pom.xml b/dao/pom.xml
index ac62f0e..dfcd89a 100644
--- a/dao/pom.xml
+++ b/dao/pom.xml
@@ -23,28 +23,6 @@
org.projectlombok
lombok
-
-
-
- cn.hutool
- hutool-all
-
-
-
- com.alibaba.fastjson2
- fastjson2
-
-
-
- mysql
- mysql-connector-java
-
-
-
- com.zaxxer
- HikariCP
- 5.1.0
-
com.baomidou
@@ -55,21 +33,6 @@
com.github.xiaoymin
knife4j-openapi3-jakarta-spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
-
- org.springframework.security
- spring-security-test
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
io.swagger
diff --git a/pom.xml b/pom.xml
index 1937036..b87e949 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
6.1.0
2.2
3.1
+ 5.1.0
@@ -72,6 +73,12 @@
mysql-connector-java
${mysql.version}
+
+
+ com.zaxxer
+ HikariCP
+ ${HikariCP.version}
+
com.github.xiaoymin
@@ -96,7 +103,7 @@
lombok
${lombok.version}
-
+
cn.hutool
hutool-all
@@ -131,17 +138,12 @@
joda-time
${jodatime.version}
-
+
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
2.12.3
-
- com.github.pagehelper
- pagehelper
- ${pagehelper.version}
-
diff --git a/service/pom.xml b/service/pom.xml
index 9234c70..01add39 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -20,21 +20,33 @@
+
+ cn.bunny
+ dao
+ 0.0.1-SNAPSHOT
+
+
cn.bunny
spring-security
0.0.1-SNAPSHOT
+
+
+ org.springframework.security
+ spring-security-test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
cn.bunny
module-mail
0.0.1-SNAPSHOT
-
- cn.bunny
- module-minio
- 0.0.1-SNAPSHOT
-
junit
@@ -46,11 +58,6 @@
org.springframework.boot
spring-boot-starter-test
-
-
- org.springframework.boot
- spring-boot-starter-websocket
-
org.aspectj
diff --git a/service/src/main/resources/application-dev.yml b/service/src/main/resources/application-dev.yml
index 0eae702..f2147b4 100644
--- a/service/src/main/resources/application-dev.yml
+++ b/service/src/main/resources/application-dev.yml
@@ -1,19 +1,19 @@
bunny:
datasource:
- host: 192.168.1.4
+ host: 192.168.3.100
port: 3305
sqlData: bunny_docs
username: root
password: "02120212"
redis:
- host: 192.168.1.4
+ host: 1192.168.3.100
port: 6379
database: 3
password: "123456"
minio:
- endpointUrl: "http://192.168.1.4:9000"
+ endpointUrl: "http://192.168.3.100:9000"
bucket-name: test
accessKey: bunny
secretKey: "02120212"
\ No newline at end of file
diff --git a/service/src/main/resources/application-prod.yml b/service/src/main/resources/application-prod.yml
index de30295..035261d 100644
--- a/service/src/main/resources/application-prod.yml
+++ b/service/src/main/resources/application-prod.yml
@@ -13,7 +13,7 @@ bunny:
password: "123456"
minio:
- endpointUrl: "http://192.168.1.4:9000"
+ endpointUrl: "http://192.168.3.100:9000"
bucket-name: test
accessKey: bunny
secretKey: "02120212"
\ No newline at end of file
--
2.43.0
From e202c103368500f26a978baecd66fa65a4e82cfe Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Sat, 27 Jul 2024 22:46:47 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=20feat(=E4=BF=AE=E6=94=B9):=20:art:=20?=
=?UTF-8?q?=E6=B6=88=E9=99=A4=E6=89=80=E6=9C=89=E5=8C=85=E7=9A=84=E9=BB=84?=
=?UTF-8?q?=E8=89=B2=E8=AD=A6=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
module/pom.xml | 9 +++++++++
pom.xml | 7 +++++++
service/pom.xml | 14 ++++++++------
.../java/cn/bunny/service/ServiceApplication.java | 1 -
4 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/module/pom.xml b/module/pom.xml
index 4ea3077..cc81d26 100644
--- a/module/pom.xml
+++ b/module/pom.xml
@@ -31,5 +31,14 @@
service-utils
0.0.1-SNAPSHOT
+
+ com.google.protobuf
+ protobuf-java
+ 4.27.2
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
diff --git a/pom.xml b/pom.xml
index b87e949..db56230 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
2.2
3.1
5.1.0
+ 4.3.1
@@ -79,6 +80,12 @@
HikariCP
${HikariCP.version}
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot3-starter
+ ${dynamic.datasource.version}
+
com.github.xiaoymin
diff --git a/service/pom.xml b/service/pom.xml
index 01add39..60266e8 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -22,24 +22,27 @@
cn.bunny
- dao
+ service-utils
0.0.1-SNAPSHOT
-
cn.bunny
spring-security
0.0.1-SNAPSHOT
-
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
org.springframework.security
spring-security-test
-
+
org.springframework.boot
- spring-boot-starter-security
+ spring-boot-starter-web
@@ -71,7 +74,6 @@
com.baomidou
dynamic-datasource-spring-boot3-starter
- 4.3.1
diff --git a/service/src/main/java/cn/bunny/service/ServiceApplication.java b/service/src/main/java/cn/bunny/service/ServiceApplication.java
index 559b8c6..c9022ce 100644
--- a/service/src/main/java/cn/bunny/service/ServiceApplication.java
+++ b/service/src/main/java/cn/bunny/service/ServiceApplication.java
@@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Slf4j
public class ServiceApplication {
public static void main(String[] args) {
- log.info("ServiceApplication启动...");
SpringApplication.run(ServiceApplication.class, args);
}
}
--
2.43.0
From 0d218cd7ba73f97f6173e56118919cfd63d1f4df Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Sat, 27 Jul 2024 23:36:23 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=20feat(=E6=96=B0=E5=A2=9E):=20:rocket:=20?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=9B=BE=E7=89=87=E9=AA=8C=E8=AF=81=E7=A0=81?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/config/WebMvcConfiguration.java | 5 ++-
.../security/config/WebSecurityConfig.java | 5 +--
.../service/controller/WebController.java | 31 +++++++++++++++++++
.../bunny/service/service/LoginService.java | 10 ++++++
.../service/impl/LoginServiceImpl.java | 21 +++++++++++++
5 files changed, 69 insertions(+), 3 deletions(-)
create mode 100644 service/src/main/java/cn/bunny/service/controller/WebController.java
create mode 100644 service/src/main/java/cn/bunny/service/service/LoginService.java
create mode 100644 service/src/main/java/cn/bunny/service/service/impl/LoginServiceImpl.java
diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/WebMvcConfiguration.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/WebMvcConfiguration.java
index 34dd3b5..abfaafc 100644
--- a/common/service-utils/src/main/java/cn/bunny/common/service/config/WebMvcConfiguration.java
+++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/WebMvcConfiguration.java
@@ -30,8 +30,11 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
- String[] excludeList = {"/api/checkCode", "/api/sendEmailCode", "/api/register", "/api/login", "/api/article/loadArticle/**"};
log.info("WebMvcConfiguration===>开始注册自定义拦截器...");
+
+ String[] excludeList = {"/api/checkCode", "/api/sendEmailCode", "/api/register", "/api/login",};
+ registry.addInterceptor(userTokenInterceptor).excludePathPatterns(excludeList);
+
// TODO 如果想使用普通JWT可以使用这个,不使用 SpringSecurity6
// registry.addInterceptor(userTokenInterceptor).addPathPatterns("/api/**").excludePathPatterns(excludeList);
}
diff --git a/module/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java b/module/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java
index 5899405..1dfde60 100644
--- a/module/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java
+++ b/module/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java
@@ -88,8 +88,9 @@ public class WebSecurityConfig {
// 排出鉴定路径
@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
- String[] annotations = {"/", "/test/**", "/diagram-viewer/**", "/editor-app/**", "/*.html",
- "/*/*/noAuth/**", "/*/noAuth/**", "/favicon.ico", "/swagger-resources/**", "/webjars/**", "/v3/**", "/swagger-ui.html/**", "/doc.html"};
+ String[] annotations = {"/", "/test/**", "/*.html", "/*/*/noAuth/**", "/*/noAuth/**", "/favicon.ico", "/swagger-resources/**", "/swagger-ui.html/**",
+ "/api/**"
+ };
return web -> web.ignoring().requestMatchers(annotations);
}
}
diff --git a/service/src/main/java/cn/bunny/service/controller/WebController.java b/service/src/main/java/cn/bunny/service/controller/WebController.java
new file mode 100644
index 0000000..88e4fb6
--- /dev/null
+++ b/service/src/main/java/cn/bunny/service/controller/WebController.java
@@ -0,0 +1,31 @@
+package cn.bunny.service.controller;
+
+import cn.bunny.service.service.LoginService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Tag(name = "web相关接口")
+@RestController
+@RequestMapping("/api")
+public class WebController {
+ @Autowired
+ private LoginService loginService;
+
+ @Operation(summary = "生成验证码", description = "生成验证码")
+ @GetMapping("checkCode")
+ public ResponseEntity checkCode() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.IMAGE_JPEG);
+
+ byte[] image = loginService.checkCode();
+ return new ResponseEntity(image, headers, HttpStatus.OK);
+ }
+}
diff --git a/service/src/main/java/cn/bunny/service/service/LoginService.java b/service/src/main/java/cn/bunny/service/service/LoginService.java
new file mode 100644
index 0000000..6a2dd06
--- /dev/null
+++ b/service/src/main/java/cn/bunny/service/service/LoginService.java
@@ -0,0 +1,10 @@
+package cn.bunny.service.service;
+
+public interface LoginService {
+ /**
+ * * 生成验证码
+ *
+ * @return 验证码图片数组
+ */
+ byte[] checkCode();
+}
diff --git a/service/src/main/java/cn/bunny/service/service/impl/LoginServiceImpl.java b/service/src/main/java/cn/bunny/service/service/impl/LoginServiceImpl.java
new file mode 100644
index 0000000..36023b1
--- /dev/null
+++ b/service/src/main/java/cn/bunny/service/service/impl/LoginServiceImpl.java
@@ -0,0 +1,21 @@
+package cn.bunny.service.service.impl;
+
+import cn.bunny.service.service.LoginService;
+import cn.hutool.captcha.CaptchaUtil;
+import cn.hutool.captcha.CircleCaptcha;
+import org.springframework.stereotype.Service;
+
+@Service
+public class LoginServiceImpl implements LoginService {
+ /**
+ * * 生成验证码
+ *
+ * @return 验证码图片数组
+ */
+ @Override
+ public byte[] checkCode() {
+ // 生成验证码
+ CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(150, 48, 4, 2);
+ return captcha.getImageBytes();
+ }
+}
--
2.43.0