--删除 springboot监控模块
This commit is contained in:
parent
d473ad3b52
commit
e35a1ad742
@ -34,12 +34,6 @@
|
||||
<artifactId>boot-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
||||
@ -65,7 +65,7 @@ spring.data:
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# redis 密码必须配置
|
||||
password: boot123
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@ -43,24 +43,6 @@ spring:
|
||||
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
# username:
|
||||
# password:
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||
# username: ROOT
|
||||
# password: root
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
# sqlserver:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
|
||||
@ -163,7 +163,7 @@ springdoc:
|
||||
enabled: true
|
||||
info:
|
||||
# 标题
|
||||
title: '标题:boot-Vue-Plus多租户管理系统_接口文档'
|
||||
title: '标题:boot-base接口文档'
|
||||
# 描述
|
||||
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
|
||||
# 版本
|
||||
@ -184,14 +184,10 @@ springdoc:
|
||||
group-configs:
|
||||
- group: 1.演示模块
|
||||
packages-to-scan: com.base.demo
|
||||
- group: 2.通用模块
|
||||
packages-to-scan: com.base.web
|
||||
- group: 3.系统模块
|
||||
packages-to-scan: com.base.system
|
||||
- group: 4.代码生成模块
|
||||
packages-to-scan: com.base.generator
|
||||
- group: 5.工作流模块
|
||||
packages-to-scan: com.base.workflow
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
@ -218,18 +214,6 @@ lock4j:
|
||||
# 分布式锁的超时时间,默认为 30 秒
|
||||
expire: 30000
|
||||
|
||||
--- # Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
logfile:
|
||||
external-file: ./logs/sys-console.log
|
||||
|
||||
--- # 默认/推荐使用sse推送
|
||||
sse:
|
||||
enabled: true
|
||||
@ -243,20 +227,3 @@ websocket:
|
||||
path: /resource/websocket
|
||||
# 设置访问源地址
|
||||
allowedOrigins: '*'
|
||||
|
||||
--- # warm-flow工作流配置
|
||||
warm-flow:
|
||||
# 是否开启工作流,默认true
|
||||
enabled: true
|
||||
# 是否开启设计器ui
|
||||
ui: true
|
||||
# 默认Authorization,如果有多个token,用逗号分隔
|
||||
token-name: ${sa-token.token-name},clientid
|
||||
# 流程状态对应的三元色
|
||||
chart-status-color:
|
||||
## 未办理
|
||||
- 62,62,62
|
||||
## 待办理
|
||||
- 255,205,23
|
||||
## 已办理
|
||||
- 157,255,0
|
||||
|
||||
@ -1,8 +1,2 @@
|
||||
Application Version: ${revision}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
__________ _____.___.__ ____ ____ __________.__
|
||||
\______ \__ __ ____\__ | |__| \ \ / /_ __ ____ \______ \ | __ __ ______
|
||||
| _/ | \/ _ \/ | | | ______ \ Y / | \_/ __ \ ______ | ___/ | | | \/ ___/
|
||||
| | \ | ( <_> )____ | | /_____/ \ /| | /\ ___/ /_____/ | | | |_| | /\___ \
|
||||
|____|_ /____/ \____// ______|__| \___/ |____/ \___ > |____| |____/____//____ >
|
||||
\/ \/ \/ \/
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
package com.base.common.framework.web.annotation;
|
||||
|
||||
import com.base.common.framework.web.handler.TranslationHandler;
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 通用翻译注解
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.METHOD})
|
||||
@Documented
|
||||
@JacksonAnnotationsInside
|
||||
@JsonSerialize(using = TranslationHandler.class)
|
||||
public @interface Translation {
|
||||
|
||||
/**
|
||||
* 类型 (需与实现类上的 {@link TranslationType} 注解type对应)
|
||||
* <p>
|
||||
* 默认取当前字段的值 如果设置了 @{@link Translation#mapper()} 则取映射字段的值
|
||||
*/
|
||||
String type();
|
||||
|
||||
/**
|
||||
* 映射字段 (如果不为空则取此字段的值)
|
||||
*/
|
||||
String mapper() default "";
|
||||
|
||||
/**
|
||||
* 其他条件 例如: 字典type(sys_user_sex)
|
||||
*/
|
||||
String other() default "";
|
||||
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.base.common.framework.web.annotation;
|
||||
|
||||
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 翻译类型注解 (标注到{@link TranslationInterface} 的实现类)
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
@Documented
|
||||
public @interface TranslationType {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
String type();
|
||||
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
package com.base.common.framework.web.config;
|
||||
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.handler.TranslationBeanSerializerModifier;
|
||||
import com.base.common.framework.web.handler.TranslationHandler;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 翻译模块配置类
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
public class TranslationConfig {
|
||||
|
||||
@Autowired
|
||||
private List<TranslationInterface<?>> list;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
Map<String, TranslationInterface<?>> map = new HashMap<>(list.size());
|
||||
for (TranslationInterface<?> trans : list) {
|
||||
if (trans.getClass().isAnnotationPresent(TranslationType.class)) {
|
||||
TranslationType annotation = trans.getClass().getAnnotation(TranslationType.class);
|
||||
map.put(annotation.type(), trans);
|
||||
} else {
|
||||
log.warn(trans.getClass().getName() + " 翻译实现类未标注 TranslationType 注解!");
|
||||
}
|
||||
}
|
||||
TranslationHandler.TRANSLATION_MAPPER.putAll(map);
|
||||
// 设置 Bean 序列化修改器
|
||||
objectMapper.setSerializerFactory(
|
||||
objectMapper.getSerializerFactory()
|
||||
.withSerializerModifier(new TranslationBeanSerializerModifier()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.base.common.framework.web.constant;
|
||||
|
||||
/**
|
||||
* 翻译常量
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface TransConstant {
|
||||
|
||||
/**
|
||||
* 用户id转账号
|
||||
*/
|
||||
String USER_ID_TO_NAME = "user_id_to_name";
|
||||
|
||||
/**
|
||||
* 用户id转用户名称
|
||||
*/
|
||||
String USER_ID_TO_NICKNAME = "user_id_to_nickname";
|
||||
|
||||
/**
|
||||
* 部门id转名称
|
||||
*/
|
||||
String DEPT_ID_TO_NAME = "dept_id_to_name";
|
||||
|
||||
/**
|
||||
* 字典type转label
|
||||
*/
|
||||
String DICT_TYPE_TO_LABEL = "dict_type_to_label";
|
||||
|
||||
/**
|
||||
* ossId转url
|
||||
*/
|
||||
String OSS_ID_TO_URL = "oss_id_to_url";
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.base.common.framework.web.handler;
|
||||
|
||||
import com.fasterxml.jackson.databind.BeanDescription;
|
||||
import com.fasterxml.jackson.databind.SerializationConfig;
|
||||
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
|
||||
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Bean 序列化修改器 解决 Null 被单独处理问题
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public class TranslationBeanSerializerModifier extends BeanSerializerModifier {
|
||||
|
||||
@Override
|
||||
public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc,
|
||||
List<BeanPropertyWriter> beanProperties) {
|
||||
for (BeanPropertyWriter writer : beanProperties) {
|
||||
// 如果序列化器为 TranslationHandler 的话 将 Null 值也交给他处理
|
||||
if (writer.getSerializer() instanceof TranslationHandler serializer) {
|
||||
writer.assignNullSerializer(serializer);
|
||||
}
|
||||
}
|
||||
return beanProperties;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.base.common.framework.web.handler;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.base.common.core.utils.StringUtils;
|
||||
import com.base.common.core.utils.reflect.ReflectUtils;
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.BeanProperty;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 翻译处理器
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
public class TranslationHandler extends JsonSerializer<Object> implements ContextualSerializer {
|
||||
|
||||
/**
|
||||
* 全局翻译实现类映射器
|
||||
*/
|
||||
public static final Map<String, TranslationInterface<?>> TRANSLATION_MAPPER = new ConcurrentHashMap<>();
|
||||
|
||||
private Translation translation;
|
||||
|
||||
@Override
|
||||
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
TranslationInterface<?> trans = TRANSLATION_MAPPER.get(translation.type());
|
||||
if (ObjectUtil.isNotNull(trans)) {
|
||||
// 如果映射字段不为空 则取映射字段的值
|
||||
if (StringUtils.isNotBlank(translation.mapper())) {
|
||||
value = ReflectUtils.invokeGetter(gen.currentValue(), translation.mapper());
|
||||
}
|
||||
// 如果为 null 直接写出
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
gen.writeNull();
|
||||
return;
|
||||
}
|
||||
Object result = trans.translation(value, translation.other());
|
||||
gen.writeObject(result);
|
||||
} else {
|
||||
gen.writeObject(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException {
|
||||
Translation translation = property.getAnnotation(Translation.class);
|
||||
if (Objects.nonNull(translation)) {
|
||||
this.translation = translation;
|
||||
return this;
|
||||
}
|
||||
return prov.findValueSerializer(property.getType(), property);
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.base.common.framework.web.handler.impl;
|
||||
|
||||
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
|
||||
/**
|
||||
* 翻译接口 (实现类需标注 {@link TranslationType} 注解标明翻译类型)
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface TranslationInterface<T> {
|
||||
|
||||
/**
|
||||
* 翻译
|
||||
*
|
||||
* @param key 需要被翻译的键(不为空)
|
||||
* @param other 其他参数
|
||||
* @return 返回键对应的值
|
||||
*/
|
||||
T translation(Object key, String other);
|
||||
}
|
||||
@ -14,4 +14,3 @@ com.base.common.framework.web.config.UndertowConfig
|
||||
com.base.common.framework.web.config.JacksonConfig
|
||||
com.base.common.framework.web.config.IdempotentConfig
|
||||
com.base.common.framework.web.config.RateLimiterConfig
|
||||
com.base.common.framework.web.config.TranslationConfig
|
||||
@ -4,8 +4,6 @@ import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.base.common.framework.excel.annotation.ExcelNotation;
|
||||
import com.base.common.framework.excel.annotation.ExcelRequired;
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.demo.domain.TestDemo;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
@ -85,7 +83,6 @@ public class TestDemoVo implements Serializable {
|
||||
/**
|
||||
* 创建人账号
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy")
|
||||
@ExcelProperty(value = "创建人账号")
|
||||
private String createByName;
|
||||
|
||||
@ -104,7 +101,6 @@ public class TestDemoVo implements Serializable {
|
||||
/**
|
||||
* 更新人账号
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "updateBy")
|
||||
@ExcelProperty(value = "更新人账号")
|
||||
private String updateByName;
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.base.system.domain.vo;
|
||||
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.system.domain.SysNotice;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
@ -62,7 +60,6 @@ public class SysNoticeVo implements Serializable {
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy")
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.base.system.domain.vo;
|
||||
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.system.domain.SysOss;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
@ -65,7 +63,6 @@ public class SysOssVo implements Serializable {
|
||||
/**
|
||||
* 上传人名称
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy")
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
|
||||
@ -4,8 +4,6 @@ import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.base.common.framework.excel.annotation.ExcelDictFormat;
|
||||
import com.base.common.framework.excel.convert.ExcelDictConvert;
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.system.domain.SysPost;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
@ -85,7 +83,6 @@ public class SysPostVo implements Serializable {
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package com.base.system.domain.vo;
|
||||
|
||||
import com.base.common.framework.web.annotation.Sensitive;
|
||||
import com.base.common.framework.web.annotation.Translation;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.core.SensitiveStrategy;
|
||||
import com.base.system.domain.SysUser;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@ -73,7 +71,6 @@ public class SysUserVo implements Serializable {
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
||||
private Long avatar;
|
||||
|
||||
/**
|
||||
@ -111,7 +108,6 @@ public class SysUserVo implements Serializable {
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
package com.base.system.service.impl.translation;
|
||||
|
||||
import com.base.common.core.service.DeptService;
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 部门翻译实现
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.DEPT_ID_TO_NAME)
|
||||
public class DeptNameTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final DeptService deptService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof String ids) {
|
||||
return deptService.selectDeptNameByIds(ids);
|
||||
} else if (key instanceof Long id) {
|
||||
return deptService.selectDeptNameByIds(id.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package com.base.system.service.impl.translation;
|
||||
|
||||
import com.base.common.core.service.DictService;
|
||||
import com.base.common.core.utils.StringUtils;
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 字典翻译实现
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.DICT_TYPE_TO_LABEL)
|
||||
public class DictTypeTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final DictService dictService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof String dictValue && StringUtils.isNotBlank(other)) {
|
||||
return dictService.getDictLabel(other, dictValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.base.system.service.impl.translation;
|
||||
|
||||
import com.base.common.core.service.UserService;
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户名称翻译实现
|
||||
*
|
||||
* @author may
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
public class NicknameTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof Long id) {
|
||||
return userService.selectNicknameByIds(id.toString());
|
||||
} else if (key instanceof String ids) {
|
||||
return userService.selectNicknameByIds(ids);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.base.system.service.impl.translation;
|
||||
|
||||
import com.base.common.core.service.OssService;
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* OSS翻译实现
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.OSS_ID_TO_URL)
|
||||
public class OssUrlTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final OssService ossService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof String ids) {
|
||||
return ossService.selectUrlByIds(ids);
|
||||
} else if (key instanceof Long id) {
|
||||
return ossService.selectUrlByIds(id.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package com.base.system.service.impl.translation;
|
||||
|
||||
import com.base.common.core.service.UserService;
|
||||
import com.base.common.framework.web.annotation.TranslationType;
|
||||
import com.base.common.framework.web.constant.TransConstant;
|
||||
import com.base.common.framework.web.handler.impl.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户名翻译实现
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.USER_ID_TO_NAME)
|
||||
public class UserNameTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof Long id) {
|
||||
return userService.selectUserNameById(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
11
pom.xml
11
pom.xml
@ -254,17 +254,6 @@
|
||||
<version>${sms4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||
<version>${spring-boot-admin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>${spring-boot-admin.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--redisson-->
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user