| | |
| | | /** |
| | | * 将 30*1000 转为 30000 |
| | | * 不能出现小数点等 |
| | | * |
| | | * @param val |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 生成六位验证码 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String generateVerificationCode(){ |
| | |
| | | return result; |
| | | } |
| | | |
| | | // 手机号码前三后四脱敏 |
| | | public static String mobileEncrypt(String mobile) { |
| | | if (StringUtils.isEmpty(mobile) || (mobile.length() != 11)) { |
| | | return mobile; |
| | | } |
| | | return mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); |
| | | } |
| | | |
| | | //身份证前三后四脱敏 |
| | | public static String idEncrypt(String id) { |
| | | if (StringUtils.isEmpty(id) || (id.length() < 8)) { |
| | | return id; |
| | | } |
| | | return id.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*"); |
| | | } |
| | | |
| | | |
| | | //效验 |
| | | public static boolean sqlValidate(String str) { |