| | |
| | | package com.yeshi.fanli.util.account;
|
| | |
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | if (rank == null)
|
| | | rank = 0;
|
| | |
|
| | | return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png",
|
| | | rank + "");
|
| | | return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
|
| | | }
|
| | |
|
| | | public static String getInviteShortLink(Long uid) {
|
| | | return HttpUtil.getShortLink(
|
| | | "http://" + Constant.wxGZConfig.getLoginHost() + "/" + Constant.systemCommonConfig.getProjectName()
|
| | | + "/client/threeShareNew?uid=" + uid + "&_=" + java.lang.System.currentTimeMillis());
|
| | | }
|
| | |
|
| | | public static String getInviteCode(int base, Long uid) {
|
| | |
|
| | | long num = base * 100000000L + uid;
|
| | |
|
| | | return convert10To36(num);
|
| | | }
|
| | |
|
| | | private static String convert10To36(Long num) {
|
| | | String numbers = "YE9VFA3N6KG7JZH4LD5IO2RBS0QTMPU1WC8X";
|
| | | BigDecimal numBig = new BigDecimal(num);
|
| | |
|
| | | int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue();
|
| | | int n = 1;
|
| | | String result = "";
|
| | | result += numbers.charAt(ge);
|
| | |
|
| | | while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) {
|
| | | int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1]
|
| | | .intValue();
|
| | | result = numbers.charAt(w) + result;
|
| | | n++;
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 过滤支付宝账号,中间用*代替
|
| | | * |
| | | * @param bindingAccountList
|
| | | * @return
|
| | | */
|
| | | public static List<BindingAccount> filterBindingAccount(List<BindingAccount> bindingAccountList) {
|
| | | List<BindingAccount> accountList = new ArrayList<>();
|
| | |
|
| | | if (bindingAccountList != null)
|
| | | for (BindingAccount bindingAccount : bindingAccountList) {
|
| | | accountList.add(filterBindingAccount(bindingAccount));
|
| | | }
|
| | | return accountList;
|
| | | }
|
| | |
|
| | | public static BindingAccount filterBindingAccount(BindingAccount bindingAccount) {
|
| | |
|
| | | BindingAccount dest = new BindingAccount();
|
| | | try {
|
| | | PropertyUtils.copyProperties(dest, bindingAccount);
|
| | | if (!StringUtil.isNullOrEmpty(dest.getAccount()) && !StringUtil.isNullOrEmpty(dest.getName())) {
|
| | | String name = "";
|
| | | if ((dest.getName() + "").length() > 2)
|
| | | for (int i = 0; i < (dest.getName() + "").length(); i++) {
|
| | | if (i == 0)
|
| | | name += dest.getName().charAt(i);
|
| | | else
|
| | | name += "*";
|
| | | }
|
| | | else
|
| | | name = dest.getName().charAt(0) + "*";
|
| | | dest.setName(name);
|
| | |
|
| | | String account = filterAlipayAccount(dest.getAccount());
|
| | |
|
| | | dest.setAccount(account);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | return dest;
|
| | | }
|
| | |
|
| | | public static String filterAlipayAccount(String alipayAccount) {
|
| | | String account = "";
|
| | | if (alipayAccount.indexOf("@") > -1) {// 邮箱
|
| | | int index = alipayAccount.indexOf("@");
|
| | |
|
| | | for (int i = 0; i < alipayAccount.length(); i++) {
|
| | | if (i < 3 || i >= index)
|
| | | account += alipayAccount.charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | } else if (StringUtil.isMobile(alipayAccount)) {// 电话
|
| | | account = alipayAccount.substring(0, 3) + "*****"
|
| | | + alipayAccount.substring(alipayAccount.length() - 2, alipayAccount.length());
|
| | |
|
| | | } else {// 其他
|
| | | if (alipayAccount.length() >= 6) {
|
| | | for (int i = 0; i < alipayAccount.length(); i++) {
|
| | | if (i < 3 || i >= alipayAccount.length() - 2)
|
| | | account += alipayAccount.charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | } else {
|
| | | for (int i = 0; i < alipayAccount.length(); i++) {
|
| | | if (i < 1 || i >= alipayAccount.length() - 1)
|
| | | account += alipayAccount.charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | }
|
| | | }
|
| | | return account;
|
| | | }
|
| | |
|
| | | public static String filterAlipayName(String name) {
|
| | | String st = "";
|
| | | for (int i = 0; i < name.length(); i++) {
|
| | | if (i == 0)
|
| | | st += name.charAt(i);
|
| | | else
|
| | | st += "*";
|
| | | }
|
| | | return st;
|
| | | }
|
| | |
|
| | | public static String filterOrderId(String orderId) {
|
| | | if (orderId == null || orderId.length() <= 6)
|
| | | return orderId;
|
| | | if (orderId.length() <= 16) {// 隐藏2位
|
| | | return orderId.substring(0, orderId.length() - 2) + "**";
|
| | | } else {// 隐藏6位
|
| | | return orderId.substring(0, orderId.length() - 6) + "******";
|
| | | }
|
| | | }
|
| | | }
|