refactor(system/client): 移除终端部分配置字段

This commit is contained in:
2025-04-13 16:29:33 +08:00
parent 36f975c30b
commit 240d6fcb01
9 changed files with 29 additions and 83 deletions

View File

@@ -46,14 +46,9 @@ public class ClientDO extends BaseDO {
private String clientId;
/**
* 终端 Key
* 终端类型
*/
private String clientKey;
/**
* 终端秘钥
*/
private String clientSecret;
private String clientType;
/**
* 登录类型
@@ -61,11 +56,6 @@ public class ClientDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> authType;
/**
* 终端类型
*/
private String clientType;
/**
* Token 最低活跃频率(单位:秒,-1不限制永不冻结
*/

View File

@@ -41,16 +41,10 @@ public class ClientQuery implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 终端 Key
* 终端类型
*/
@Schema(description = "终端 Key", example = "PC")
private String clientKey;
/**
* 终端秘钥
*/
@Schema(description = "终端秘钥", example = "dd77ab1e353a027e0d60ce3b151e8642")
private String clientSecret;
@Schema(description = "终端类型", example = "PC")
private String clientType;
/**
* 认证类型
@@ -59,12 +53,6 @@ public class ClientQuery implements Serializable {
@Query(type = QueryType.IN)
private List<String> authType;
/**
* 终端类型
*/
@Schema(description = "终端类型", example = "PC")
private String clientType;
/**
* 状态
*/

View File

@@ -42,20 +42,12 @@ public class ClientReq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 终端 Key
* 终端类型
*/
@Schema(description = "终端 Key", example = "PC")
@NotBlank(message = "终端Key不能为空")
@Length(max = 32, message = "终端Key长度不能超过 {max} 个字符")
private String clientKey;
/**
* 终端秘钥
*/
@Schema(description = "终端秘钥", example = "dd77ab1e353a027e0d60ce3b151e8642")
@NotBlank(message = "终端秘钥不能为空")
@Length(max = 255, message = "终端秘钥长度不能超过 {max} 个字符")
private String clientSecret;
@Schema(description = "终端类型", example = "PC")
@NotBlank(message = "终端类型不能为空")
@Length(max = 32, message = "终端类型长度不能超过 {max} 个字符")
private String clientType;
/**
* 认证类型
@@ -64,14 +56,6 @@ public class ClientReq implements Serializable {
@NotEmpty(message = "认证类型不能为空")
private List<String> authType;
/**
* 终端类型
*/
@Schema(description = "终端类型", example = "PC")
@NotBlank(message = "终端类型不能为空")
@Length(max = 32, message = "终端类型长度不能超过 {max} 个字符")
private String clientType;
/**
* Token 最低活跃频率(单位:秒,-1不限制永不冻结
*/

View File

@@ -53,17 +53,12 @@ public class ClientResp extends BaseDetailResp {
private String clientId;
/**
* 终端 Key
* 终端类型(取值于字典 client_type
*/
@Schema(description = "终端 Key", example = "PC")
@ExcelProperty(value = "终端 Key", order = 3)
private String clientKey;
/**
* 终端秘钥
*/
@Schema(description = "终端秘钥", example = "dd77ab1e353a027e0d60ce3b151e8642")
private String clientSecret;
@Schema(description = "终端类型(取值于字典 client_type", example = "PC")
@ExcelProperty(value = "终端类型", converter = ExcelDictConverter.class, order = 5)
@DictExcelProperty("client_type")
private String clientType;
/**
* 认证类型
@@ -72,14 +67,6 @@ public class ClientResp extends BaseDetailResp {
@ExcelProperty(value = "认证类型", converter = ExcelListConverter.class, order = 4)
private List<String> authType;
/**
* 终端类型(取值于字典 client_type
*/
@Schema(description = "终端类型(取值于字典 client_type", example = "PC")
@ExcelProperty(value = "终端类型", converter = ExcelDictConverter.class, order = 5)
@DictExcelProperty("client_type")
private String clientType;
/**
* Token 最低活跃频率(单位:秒,-1不限制永不冻结
*/

View File

@@ -17,7 +17,9 @@
package top.continew.admin.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.SecureUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.continew.admin.auth.model.query.OnlineUserQuery;
@@ -49,8 +51,9 @@ public class ClientServiceImpl extends BaseServiceImpl<ClientMapper, ClientDO, C
@Override
public void beforeCreate(ClientReq req) {
String clientId = DigestUtil.md5Hex(req.getClientKey() + StringConstants.COLON + req.getClientSecret());
req.setClientId(clientId);
req.setClientId(SecureUtil.md5(Base64.encode(IdUtil.fastSimpleUUID())
.replace(StringConstants.SLASH, StringConstants.EMPTY)
.replace(StringConstants.PLUS, StringConstants.EMPTY)));
}
@Override
@@ -60,7 +63,7 @@ public class ClientServiceImpl extends BaseServiceImpl<ClientMapper, ClientDO, C
for (Long id : ids) {
ClientDO client = this.getById(id);
query.setClientId(client.getClientId());
CheckUtils.throwIfNotEmpty(onlineUserService.list(query), "终端 [{}] 还存在在线用户,不能删除", client.getClientKey());
CheckUtils.throwIfNotEmpty(onlineUserService.list(query), "终端 [{}] 还存在在线用户,不能删除", client.getClientId());
}
}