feat: 空指针处理

This commit is contained in:
fcli 2022-12-14 13:51:01 +08:00
parent d3de862d11
commit ad3f7595bd
1 changed files with 16 additions and 1 deletions

View File

@ -12,7 +12,10 @@ import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@ -23,6 +26,9 @@ public class EncryptUtil {
}
public <T> T encrypt(T data, Class<T> clazz) {
if (data == null || clazz == null) {
return data;
}
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
if (!encryptIsOpen) {
return data;
@ -48,6 +54,9 @@ public class EncryptUtil {
}
public <T> List<T> encryptList(List<T> dataList, Class<T> clazz) {
if (CollectionUtils.isEmpty(dataList) || clazz == null) {
return dataList;
}
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
if (!encryptIsOpen) {
return dataList;
@ -77,6 +86,9 @@ public class EncryptUtil {
}
public <T> T decrypt(T data, Class<T> clazz) {
if (data == null || clazz == null) {
return data;
}
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
if (!encryptIsOpen) {
return data;
@ -102,6 +114,9 @@ public class EncryptUtil {
}
public <T> List<T> decryptList(List<T> dataList, Class<T> clazz) {
if (CollectionUtils.isEmpty(dataList) || clazz == null) {
return dataList;
}
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
if (!encryptIsOpen) {
return dataList;