From 7f86c7148acab0c32f5f7f966e10aca079c21171 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 23 一月 2019 11:21:22 +0800
Subject: [PATCH] 添加淘宝渠道相关代码

---
 fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
index 8c653dd..132d655 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
@@ -2,9 +2,12 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.beanutils.PropertyUtils;
 
+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;
@@ -90,4 +93,78 @@
 		return result;
 	}
 
+	/**
+	 * 杩囨护鏀粯瀹濊处鍙凤紝涓棿鐢�*浠f浛
+	 * 
+	 * @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 = "";
+				if (dest.getAccount().indexOf("@") > -1) {// 閭
+					int index = dest.getAccount().indexOf("@");
+
+					for (int i = 0; i < dest.getAccount().length(); i++) {
+						if (i < 3 || i >= index)
+							account += dest.getAccount().charAt(i);
+						else
+							account += "*";
+					}
+				} else if (StringUtil.isMobile(dest.getAccount())) {// 鐢佃瘽
+					account = dest.getAccount().substring(0, 3) + "*****"
+							+ dest.getAccount().substring(dest.getAccount().length() - 2, dest.getAccount().length());
+
+				} else {// 鍏朵粬
+					if (dest.getAccount().length() >= 6) {
+						for (int i = 0; i < dest.getAccount().length(); i++) {
+							if (i < 3 || i >= dest.getAccount().length() - 2)
+								account += dest.getAccount().charAt(i);
+							else
+								account += "*";
+						}
+					} else {
+						for (int i = 0; i < dest.getAccount().length(); i++) {
+							if (i < 1 || i >= dest.getAccount().length() - 1)
+								account += dest.getAccount().charAt(i);
+							else
+								account += "*";
+						}
+					}
+				}
+
+				dest.setAccount(account);
+			}
+		} catch (Exception e) {
+		}
+
+		return dest;
+	}
+
 }

--
Gitblit v1.8.0