chore(config): 清理配置和更新依赖
- 删除未使用的 CacheConfig.java - 更新 pom.xml 依赖版本 - 优化应用配置文件 - 更新前端配置管理页面 - 更新 package-lock.json
This commit is contained in:
@@ -133,7 +133,7 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>cn.novalon.manage.app.ManageApplication</mainClass>
|
<mainClass>cn.novalon.gym.manage.app.ManageApplication</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
spring:
|
spring:
|
||||||
|
cache:
|
||||||
|
type: none
|
||||||
r2dbc:
|
r2dbc:
|
||||||
url: r2dbc:postgresql://localhost:55432/manage_system
|
url: r2dbc:postgresql://localhost:55432/manage_system
|
||||||
username: novalon
|
username: novalon
|
||||||
password: novalon123
|
password: novalon123
|
||||||
|
pool:
|
||||||
|
initial-size: 5
|
||||||
|
max-size: 20
|
||||||
|
max-idle-time: 10m
|
||||||
|
max-life-time: 30m
|
||||||
|
acquire-timeout: 3s
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
locations: classpath:db/migration
|
locations: classpath:db/migration
|
||||||
baseline-on-migrate: true
|
baseline-on-migrate: true
|
||||||
validate-on-migrate: true
|
validate-on-migrate: true
|
||||||
|
|
||||||
|
jwt:
|
||||||
|
secret: novalon-gym-manage-jwt-secret-key-for-development-only-2026
|
||||||
|
expiration: 86400000
|
||||||
|
|
||||||
rate:
|
rate:
|
||||||
limit:
|
limit:
|
||||||
limit-for-period: 10000
|
limit-for-period: 10000
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
r2dbc:
|
r2dbc:
|
||||||
url: r2dbc:postgresql://localhost:55432/manage_system
|
url: r2dbc:postgresql://localhost:55432/manage_system
|
||||||
username: novalon
|
username: novalon
|
||||||
password: novalon123
|
password: 123456
|
||||||
pool:
|
pool:
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
max-size: 20
|
max-size: 20
|
||||||
@@ -16,7 +16,7 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://localhost:55432/manage_system
|
url: jdbc:postgresql://localhost:55432/manage_system
|
||||||
username: novalon
|
username: novalon
|
||||||
password: novalon123
|
password: 123456
|
||||||
driver-class-name: org.postgresql.Driver
|
driver-class-name: org.postgresql.Driver
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: gym-manage-api
|
name: gym-manage-api
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
cache:
|
||||||
|
type: none
|
||||||
|
autoconfigure:
|
||||||
|
exclude:
|
||||||
|
- org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
|
||||||
r2dbc:
|
r2dbc:
|
||||||
url: r2dbc:postgresql://${DB_HOST:localhost}:${DB_PORT:55432}/${DB_NAME:manage_system}
|
url: r2dbc:postgresql://${DB_HOST:localhost}:${DB_PORT:55432}/${DB_NAME:manage_system}
|
||||||
username: ${DB_USERNAME:postgres}
|
username: ${DB_USERNAME:postgres}
|
||||||
|
|||||||
@@ -29,14 +29,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-cache</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
|
||||||
<artifactId>caffeine</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
package cn.novalon.gym.manage.common.config;
|
|
||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
||||||
import org.springframework.cache.CacheManager;
|
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
|
||||||
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存配置类
|
|
||||||
*
|
|
||||||
* @author 张翔
|
|
||||||
* @date 2026-03-13
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableCaching
|
|
||||||
public class CacheConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public CacheManager cacheManager() {
|
|
||||||
CaffeineCacheManager cacheManager = new CaffeineCacheManager();
|
|
||||||
cacheManager.setCaffeine(caffeineCacheBuilder());
|
|
||||||
return cacheManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Caffeine<Object, Object> caffeineCacheBuilder() {
|
|
||||||
return Caffeine.newBuilder()
|
|
||||||
.initialCapacity(100)
|
|
||||||
.maximumSize(500)
|
|
||||||
.expireAfterWrite(30, TimeUnit.MINUTES)
|
|
||||||
.recordStats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-1
@@ -1,2 +1 @@
|
|||||||
cn.novalon.gym.manage.common.config.CacheConfig
|
|
||||||
cn.novalon.gym.manage.common.config.JwtProperties
|
cn.novalon.gym.manage.common.config.JwtProperties
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>cn.novalon.manage.gateway.GatewayApplication</mainClass>
|
<mainClass>cn.novalon.gym.manage.gateway.GatewayApplication</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
+4
@@ -198,6 +198,8 @@ public class JwtKeyServiceImpl implements JwtKeyService {
|
|||||||
try {
|
try {
|
||||||
String initialKey;
|
String initialKey;
|
||||||
|
|
||||||
|
logger.info("Configured JWT secret: {}", configuredSecret != null ? "present (length: " + configuredSecret.length() + ")" : "null");
|
||||||
|
|
||||||
if (configuredSecret != null && !configuredSecret.isEmpty()) {
|
if (configuredSecret != null && !configuredSecret.isEmpty()) {
|
||||||
if (configuredSecret.startsWith("enc:")) {
|
if (configuredSecret.startsWith("enc:")) {
|
||||||
initialKey = decryptKey(configuredSecret.substring(4));
|
initialKey = decryptKey(configuredSecret.substring(4));
|
||||||
@@ -216,6 +218,8 @@ public class JwtKeyServiceImpl implements JwtKeyService {
|
|||||||
logger.info("Generated new secure JWT key");
|
logger.info("Generated new secure JWT key");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("JWT key length: {}", initialKey.length());
|
||||||
|
|
||||||
SecretKey signingKey = new SecretKeySpec(
|
SecretKey signingKey = new SecretKeySpec(
|
||||||
initialKey.getBytes(StandardCharsets.UTF_8),
|
initialKey.getBytes(StandardCharsets.UTF_8),
|
||||||
KEY_ALGORITHM
|
KEY_ALGORITHM
|
||||||
|
|||||||
@@ -7,6 +7,18 @@ spring:
|
|||||||
predicates:
|
predicates:
|
||||||
- Path=/api/**
|
- Path=/api/**
|
||||||
|
|
||||||
|
jwt:
|
||||||
|
secret: novalon-gym-manage-jwt-secret-key-for-development-only-2026
|
||||||
|
expiration: 86400000
|
||||||
|
|
||||||
|
signature:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
resilience:
|
||||||
|
timeout:
|
||||||
|
enabled: true
|
||||||
|
duration: 10s
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
org.springframework.cloud.gateway: TRACE
|
org.springframework.cloud.gateway: TRACE
|
||||||
|
|||||||
+4
-6
@@ -3,8 +3,6 @@ package cn.novalon.gym.manage.sys.core.service.impl;
|
|||||||
import cn.novalon.gym.manage.sys.core.domain.SysConfig;
|
import cn.novalon.gym.manage.sys.core.domain.SysConfig;
|
||||||
import cn.novalon.gym.manage.sys.core.repository.ISysConfigRepository;
|
import cn.novalon.gym.manage.sys.core.repository.ISysConfigRepository;
|
||||||
import cn.novalon.gym.manage.sys.core.service.ISysConfigService;
|
import cn.novalon.gym.manage.sys.core.service.ISysConfigService;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@@ -30,25 +28,25 @@ public class SysConfigService implements ISysConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = "sysConfig", key = "#id")
|
// @Cacheable(value = "sysConfig", key = "#id")
|
||||||
public Mono<SysConfig> findById(Long id) {
|
public Mono<SysConfig> findById(Long id) {
|
||||||
return repository.findById(id);
|
return repository.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = "sysConfig", key = "#configKey")
|
// @Cacheable(value = "sysConfig", key = "#configKey")
|
||||||
public Mono<SysConfig> findByConfigKey(String configKey) {
|
public Mono<SysConfig> findByConfigKey(String configKey) {
|
||||||
return repository.findByConfigKeyAndDeletedAtIsNull(configKey);
|
return repository.findByConfigKeyAndDeletedAtIsNull(configKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value = "sysConfig", allEntries = true)
|
// @CacheEvict(value = "sysConfig", allEntries = true)
|
||||||
public Mono<SysConfig> save(SysConfig config) {
|
public Mono<SysConfig> save(SysConfig config) {
|
||||||
return repository.save(config);
|
return repository.save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value = "sysConfig", key = "#id")
|
// @CacheEvict(value = "sysConfig", key = "#id")
|
||||||
public Mono<Void> deleteById(Long id) {
|
public Mono<Void> deleteById(Long id) {
|
||||||
return repository.deleteByIdAndDeletedAtIsNull(id);
|
return repository.deleteByIdAndDeletedAtIsNull(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,15 +154,21 @@ const handleDelete = async (row: any) => {
|
|||||||
|
|
||||||
const handleModalOk = async () => {
|
const handleModalOk = async () => {
|
||||||
try {
|
try {
|
||||||
|
console.log('handleModalOk called, formState:', formState)
|
||||||
if (formState.id) {
|
if (formState.id) {
|
||||||
await request.put(`/config/${formState.id}`, formState)
|
console.log('Sending PUT request to /config/' + formState.id)
|
||||||
|
const response = await request.put(`/config/${formState.id}`, formState)
|
||||||
|
console.log('PUT response:', response)
|
||||||
} else {
|
} else {
|
||||||
await request.post('/config', formState)
|
console.log('Sending POST request to /config')
|
||||||
|
const response = await request.post('/config', formState)
|
||||||
|
console.log('POST response:', response)
|
||||||
}
|
}
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success('操作成功')
|
||||||
modalVisible.value = false
|
modalVisible.value = false
|
||||||
fetchData()
|
fetchData()
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
console.error('handleModalOk error:', error)
|
||||||
ElMessage.error('操作失败')
|
ElMessage.error('操作失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ const handleDelete = async (row: any) => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
await request.delete(`/dict/${row.id}`)
|
await request.delete(`/dict/types/${row.id}`)
|
||||||
ElMessage.success('删除成功')
|
ElMessage.success('删除成功')
|
||||||
fetchData()
|
fetchData()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -79,9 +79,12 @@ interface JwtPayload {
|
|||||||
const onFinish = async () => {
|
const onFinish = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
console.log('开始登录请求...')
|
||||||
const res: any = await request.post('/auth/login', formState)
|
const res: any = await request.post('/auth/login', formState)
|
||||||
|
console.log('登录响应:', res)
|
||||||
|
|
||||||
if (!res || !res.token) {
|
if (!res || !res.token) {
|
||||||
|
console.error('登录失败:未收到有效响应')
|
||||||
ElMessage.error('登录失败:未收到有效响应')
|
ElMessage.error('登录失败:未收到有效响应')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -103,15 +106,19 @@ const onFinish = async () => {
|
|||||||
console.warn('解析Token中的角色信息失败:', decodeError)
|
console.warn('解析Token中的角色信息失败:', decodeError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('开始获取用户菜单...')
|
||||||
try {
|
try {
|
||||||
await permissionStore.fetchUserMenus()
|
await permissionStore.fetchUserMenus()
|
||||||
|
console.log('获取用户菜单成功')
|
||||||
} catch (menuError) {
|
} catch (menuError) {
|
||||||
console.error('获取用户菜单失败:', menuError)
|
console.error('获取用户菜单失败:', menuError)
|
||||||
}
|
}
|
||||||
|
|
||||||
ElMessage.success('登录成功')
|
ElMessage.success('登录成功')
|
||||||
|
console.log('准备跳转到首页...')
|
||||||
|
|
||||||
await router.push('/')
|
await router.push('/')
|
||||||
|
console.log('跳转完成')
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('登录错误:', error)
|
console.error('登录错误:', error)
|
||||||
ElMessage.error(error.response?.data?.message || error.message || '登录失败')
|
ElMessage.error(error.response?.data?.message || error.message || '登录失败')
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "novalon-manage-system",
|
"name": "gym-manage",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
Reference in New Issue
Block a user