feat: 数据适配器和接口管理
This commit is contained in:
@@ -59,11 +59,7 @@ public class EncryptAspect {
|
||||
} else if (arg instanceof List) {
|
||||
try {
|
||||
List<String> list = (List<String>) arg;
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
String ciphertext = list.get(j);
|
||||
String decrypt = encryptService.decrypt(ciphertext);
|
||||
list.set(j, decrypt);
|
||||
}
|
||||
list.replaceAll(encryptService::decrypt);
|
||||
args[i] = list;
|
||||
} catch (Exception e) {
|
||||
throw new CustomException("接受参数类型错误,请使用String类型的泛型参数");
|
||||
@@ -117,7 +113,9 @@ public class EncryptAspect {
|
||||
String decrypt = encryptService.encrypt((String) value);
|
||||
ReflectionUtils.setField(field, data, decrypt);
|
||||
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
|
||||
encrypt(value);
|
||||
if (!value.getClass().isEnum()){
|
||||
encrypt(value);
|
||||
}
|
||||
} else if (value instanceof Collection) {
|
||||
Collection<Object> collection = (Collection<Object>) value;
|
||||
for (Object item : collection) {
|
||||
@@ -148,7 +146,9 @@ public class EncryptAspect {
|
||||
String decrypt = encryptService.decrypt((String) value);
|
||||
ReflectionUtils.setField(field, arg, decrypt);
|
||||
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
|
||||
decrypt(value);
|
||||
if (!value.getClass().isEnum()){
|
||||
decrypt(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.fateverse.common.decrypt.entity;
|
||||
|
||||
import cn.fateverse.common.decrypt.annotation.EncryptField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2024/4/15 12:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EncryptOption {
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@EncryptField
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.fateverse.common.decrypt.entity;
|
||||
|
||||
import cn.fateverse.common.core.entity.OptionTree;
|
||||
import cn.fateverse.common.decrypt.annotation.EncryptField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2024/4/15 12:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EncryptOptionTree {
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@EncryptField
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private Object label;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<OptionTree> children;
|
||||
}
|
||||
Reference in New Issue
Block a user