🎉 新版本依赖兼容适配
This commit is contained in:
parent
ef90946076
commit
8957bbc451
|
|
@ -42,7 +42,7 @@
|
||||||
<!--Spring-->
|
<!--Spring-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
<artifactId>spring-cloud-starter-gateway-server-webflux</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
||||||
|
* <p>
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* <p>
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p>
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.springblade.gateway.config;
|
||||||
|
|
||||||
|
import com.github.xiaoymin.knife4j.spring.gateway.Knife4jGatewayProperties;
|
||||||
|
import com.github.xiaoymin.knife4j.spring.gateway.discover.router.DiscoverClientRouteServiceConvert;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.cloud.gateway.discovery.DiscoveryClientRouteDefinitionLocator;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* knife4j自动聚合配置
|
||||||
|
*
|
||||||
|
* @author BladeX
|
||||||
|
*/
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
public class ReactiveDiscoveryConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(name = {"spring.cloud.gateway.server.webflux.discovery.locator.enabled"})
|
||||||
|
public DiscoverClientRouteServiceConvert discoverClientRouteServiceConvert(DiscoveryClientRouteDefinitionLocator discoveryClient,
|
||||||
|
Knife4jGatewayProperties knife4jGatewayProperties) {
|
||||||
|
return new DiscoverClientRouteServiceConvert(discoveryClient, knife4jGatewayProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ package org.springblade.gateway.utils;
|
||||||
|
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
|
import io.jsonwebtoken.security.Keys;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springblade.core.launch.constant.TokenConstant;
|
import org.springblade.core.launch.constant.TokenConstant;
|
||||||
import org.springblade.gateway.props.JwtProperties;
|
import org.springblade.gateway.props.JwtProperties;
|
||||||
|
|
@ -103,9 +104,10 @@ public class JwtUtil {
|
||||||
*/
|
*/
|
||||||
public static Claims parseJWT(String jsonWebToken) {
|
public static Claims parseJWT(String jsonWebToken) {
|
||||||
try {
|
try {
|
||||||
return Jwts.parserBuilder()
|
return Jwts.parser()
|
||||||
.setSigningKey(Base64.getDecoder().decode(getBase64Security())).build()
|
.verifyWith(Keys.hmacShaKeyFor(Base64.getDecoder().decode(getBase64Security()))).build()
|
||||||
.parseClaimsJws(jsonWebToken).getBody();
|
.parseSignedClaims(jsonWebToken)
|
||||||
|
.getPayload();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@ server:
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
gateway:
|
gateway:
|
||||||
discovery:
|
server:
|
||||||
locator:
|
webflux:
|
||||||
enabled: true
|
discovery:
|
||||||
|
locator:
|
||||||
|
enabled: true
|
||||||
loadbalancer:
|
loadbalancer:
|
||||||
retry:
|
retry:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
||||||
|
|
@ -31,28 +31,8 @@
|
||||||
<artifactId>blade-user-api</artifactId>
|
<artifactId>blade-user-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>blade-starter-excel</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml-schemas</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>ooxml-schemas</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
package org.springblade.system.controller;
|
package org.springblade.system.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import cn.idev.excel.FastExcel;
|
||||||
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
|
import cn.idev.excel.read.builder.ExcelReaderBuilder;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
|
@ -27,6 +27,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -43,10 +44,10 @@ import org.springblade.core.tool.constant.BladeConstant;
|
||||||
import org.springblade.core.tool.constant.RoleConstant;
|
import org.springblade.core.tool.constant.RoleConstant;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.core.tool.utils.StringUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
import org.springblade.system.user.entity.User;
|
|
||||||
import org.springblade.system.excel.UserExcel;
|
import org.springblade.system.excel.UserExcel;
|
||||||
import org.springblade.system.excel.UserImportListener;
|
import org.springblade.system.excel.UserImportListener;
|
||||||
import org.springblade.system.service.IUserService;
|
import org.springblade.system.service.IUserService;
|
||||||
|
import org.springblade.system.user.entity.User;
|
||||||
import org.springblade.system.user.vo.UserVO;
|
import org.springblade.system.user.vo.UserVO;
|
||||||
import org.springblade.system.wrapper.UserWrapper;
|
import org.springblade.system.wrapper.UserWrapper;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
@ -70,6 +71,7 @@ import java.util.Map;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "用户管理", description = "接口")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
|
|
@ -227,7 +229,7 @@ public class UserController {
|
||||||
try {
|
try {
|
||||||
UserImportListener importListener = new UserImportListener(userService);
|
UserImportListener importListener = new UserImportListener(userService);
|
||||||
inputStream = new BufferedInputStream(file.getInputStream());
|
inputStream = new BufferedInputStream(file.getInputStream());
|
||||||
ExcelReaderBuilder builder = EasyExcel.read(inputStream, UserExcel.class, importListener);
|
ExcelReaderBuilder builder = FastExcel.read(inputStream, UserExcel.class, importListener);
|
||||||
builder.doReadAll();
|
builder.doReadAll();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -254,7 +256,7 @@ public class UserController {
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
String fileName = URLEncoder.encode("用户数据导出", StandardCharsets.UTF_8);
|
String fileName = URLEncoder.encode("用户数据导出", StandardCharsets.UTF_8);
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||||
EasyExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
|
FastExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -270,7 +272,7 @@ public class UserController {
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
String fileName = URLEncoder.encode("用户数据模板", StandardCharsets.UTF_8);
|
String fileName = URLEncoder.encode("用户数据模板", StandardCharsets.UTF_8);
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||||
EasyExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
|
FastExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package org.springblade.system.excel;
|
package org.springblade.system.excel;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.springblade.system.excel;
|
package org.springblade.system.excel;
|
||||||
|
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import cn.idev.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
import cn.idev.excel.event.AnalysisEventListener;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
|
||||||
70
pom.xml
70
pom.xml
|
|
@ -9,19 +9,14 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>4.5.0</revision>
|
<revision>4.6.0-SNAPSHOT</revision>
|
||||||
|
|
||||||
<blade.tool.version>4.5.0</blade.tool.version>
|
<blade.tool.version>4.6.0-SNAPSHOT</blade.tool.version>
|
||||||
|
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.plugin.version>3.11.0</maven.plugin.version>
|
<maven.plugin.version>3.11.0</maven.plugin.version>
|
||||||
<maven.flatten.version>1.3.0</maven.flatten.version>
|
<maven.flatten.version>1.3.0</maven.flatten.version>
|
||||||
|
|
||||||
<captcha.version>1.6.2</captcha.version>
|
|
||||||
<easyexcel.version>3.3.4</easyexcel.version>
|
|
||||||
<poi.version>4.1.2</poi.version>
|
|
||||||
<mica.auto.version>3.1.3</mica.auto.version>
|
|
||||||
|
|
||||||
<!-- 推荐使用Harbor -->
|
<!-- 推荐使用Harbor -->
|
||||||
<docker.registry.url>10.211.55.5</docker.registry.url>
|
<docker.registry.url>10.211.55.5</docker.registry.url>
|
||||||
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
||||||
|
|
@ -87,73 +82,18 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||||
<version>3.2.3</version>
|
<version>3.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
<version>3.2.3</version>
|
<version>3.4.1</version>
|
||||||
</dependency>
|
|
||||||
<!-- Captcha -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.whvcse</groupId>
|
|
||||||
<artifactId>easy-captcha</artifactId>
|
|
||||||
<version>${captcha.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Easyexcel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>easyexcel</artifactId>
|
|
||||||
<version>${easyexcel.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi</artifactId>
|
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml-schemas</artifactId>
|
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>ooxml-schemas</artifactId>
|
|
||||||
<version>1.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- dynamic-datasource -->
|
<!-- dynamic-datasource -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.1</version>
|
||||||
</dependency>
|
|
||||||
<!-- JWT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt-impl</artifactId>
|
|
||||||
<version>0.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
|
||||||
<version>0.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Mica -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.dreamlu</groupId>
|
|
||||||
<artifactId>mica-auto</artifactId>
|
|
||||||
<version>${mica.auto.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user