|
@@ -39,6 +39,27 @@ public class EncryptHandler implements TypeHandler<String> {
|
|
|
if (value.length()<=20 ) {
|
|
|
return value;
|
|
|
}
|
|
|
+ String s = SecureUtil.aes(KEYS).decryptStr(value);
|
|
|
+ String authorizationToken = ServletUtils.getRequest().getHeader("AuthorizationToken");
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(authorizationToken)){
|
|
|
+ Boolean phoneConceal = false;
|
|
|
+ try (InputStream inputStream = EncryptHandler.class.getClassLoader().getResourceAsStream("application.yml")) {
|
|
|
+ Properties properties = new Properties();
|
|
|
+ properties.load(inputStream);
|
|
|
+ String property = properties.getProperty("conceal");
|
|
|
+ phoneConceal = Boolean.valueOf(property);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (phoneConceal){
|
|
|
+ //开启手机号码加密
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ if (s.length() <= 11 &&
|
|
|
+ (ObjectUtils.isNull(loginUser.getPhoneConcealSign()) || loginUser.getPhoneConcealSign() != 1)){
|
|
|
+ return TelPhoneUtils.hideTelPhone(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return SecureUtil.aes(KEYS).decryptStr(value);
|
|
|
}
|
|
|
|