|
@@ -5,6 +5,7 @@ import cn.hutool.crypto.symmetric.AES;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.common.utils.TelPhoneUtils;
|
|
|
import org.apache.ibatis.type.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,21 +40,24 @@ public class EncryptHandler implements TypeHandler<String> {
|
|
|
return value;
|
|
|
}
|
|
|
String s = SecureUtil.aes(KEYS).decryptStr(value);
|
|
|
- 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);
|
|
|
+ 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 s;
|