From ca1ad791b7b7b04e57db6bd4fb93f0c1066a9f99 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 24 九月 2020 18:31:23 +0800
Subject: [PATCH] 淘口令格式兼容

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/BindingAccountServiceImpl.java |  408 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 209 insertions(+), 199 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/BindingAccountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/BindingAccountServiceImpl.java
index 5d5bd8a..40eb12a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/BindingAccountServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/BindingAccountServiceImpl.java
@@ -7,6 +7,7 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -41,225 +42,234 @@
 
 @Service
 public class BindingAccountServiceImpl implements BindingAccountService {
-	@Resource
-	private BindingAccountMapper bindingAccountMapper;
-	@Resource
-	private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
-	@Resource
-	private UserInfoMapper userInfoMapper;
-	@Resource
-	private UserAccountBindingHistoryService userAccountBindingHistoryService;
-	@Resource
-	private UserMoneyDetailMapper userMoneyDetailMapper;
-	@Resource
-	private UserMoneyService userMoneyService;
-	@Resource
-	private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
-	@Resource
-	private UserMoneyDebtService userMoneyDebtService;
+    @Resource
+    private BindingAccountMapper bindingAccountMapper;
+    @Resource
+    private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
+    @Resource
+    private UserInfoMapper userInfoMapper;
+    @Resource
+    private UserAccountBindingHistoryService userAccountBindingHistoryService;
+    @Resource
+    private UserMoneyDetailMapper userMoneyDetailMapper;
+    @Resource
+    private UserMoneyService userMoneyService;
+    @Resource
+    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
+    @Resource
+    private UserMoneyDebtService userMoneyDebtService;
 
-	public List<BindingAccount> getBindingAccountByUid(long uid) {
-		return bindingAccountMapper.selectByUid(uid);
-	}
+    public List<BindingAccount> getBindingAccountByUid(long uid) {
+        return bindingAccountMapper.selectByUid(uid);
+    }
 
-	public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException {
-		BindingAccount account = bindingAccountMapper.selectByUidAndType(addAccount.getUserInfo().getId(),
-				addAccount.getType());
+    public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException {
+        BindingAccount account = bindingAccountMapper.selectByUidAndType(addAccount.getUserInfo().getId(),
+                addAccount.getType());
 
-		if (account == null) {
-			bindingAccountMapper.insertSelective(addAccount);
-		} else {
-			throw new BindingAccountException(Constant.BA_EXIST);
-		}
-	}
+        if (account == null) {
+            bindingAccountMapper.insertSelective(addAccount);
+        } else {
+            throw new BindingAccountException(Constant.BA_EXIST);
+        }
+    }
 
-	@Transactional
-	public Integer deleteBindingAccount(BindingAccount account) {
-		BindingAccount oldAccount = bindingAccountMapper.selectByUidAndType(account.getUserInfo().getId(),
-				account.getType());
-		if (oldAccount != null)
-			bindingAccountMapper.deleteByPrimaryKey(oldAccount.getId());
-		return 1;
-	}
+    @Transactional
+    public Integer deleteBindingAccount(BindingAccount account) {
+        BindingAccount oldAccount = bindingAccountMapper.selectByUidAndType(account.getUserInfo().getId(),
+                account.getType());
+        if (oldAccount != null)
+            bindingAccountMapper.deleteByPrimaryKey(oldAccount.getId());
+        return 1;
+    }
 
-	public BindingAccount getBindingAccountByUidAndType(long uid, int type) {
-		BindingAccount account = bindingAccountMapper.selectByUidAndType(uid, type);
-		return account;
-	}
+    public BindingAccount getBindingAccountByUidAndType(long uid, int type) {
+        BindingAccount account = bindingAccountMapper.selectByUidAndType(uid, type);
+        return account;
+    }
 
-	@Override
-	public BindingAccount changeAlipayBinding(Long uid, String name, String account) {
-		BindingAccount bindingAccount = getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
-		if (bindingAccount == null)// 鍒涘缓璐﹀彿
-		{
-			bindingAccount = new BindingAccount();
-			bindingAccount.setAccount(account);
-			bindingAccount.setName(name);
-			bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
-			bindingAccount.setUserInfo(new UserInfo(uid));
-			bindingAccountMapper.insertSelective(bindingAccount);
-		} else {
-			bindingAccount.setName(name);
-			bindingAccount.setAccount(account);
-			bindingAccountMapper.updateByPrimaryKeySelective(bindingAccount);
-		}
-		return bindingAccount;
-	}
+    @Override
+    public BindingAccount changeAlipayBinding(Long uid, String name, String account) {
+        BindingAccount bindingAccount = getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
+        if (bindingAccount == null)// 鍒涘缓璐﹀彿
+        {
+            bindingAccount = new BindingAccount();
+            bindingAccount.setAccount(account);
+            bindingAccount.setName(name);
+            bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
+            bindingAccount.setUserInfo(new UserInfo(uid));
+            bindingAccountMapper.insertSelective(bindingAccount);
+        } else {
+            bindingAccount.setName(name);
+            bindingAccount.setAccount(account);
+            bindingAccountMapper.updateByPrimaryKeySelective(bindingAccount);
+        }
+        return bindingAccount;
+    }
 
-	@Override
-	public int deleteByPrimaryKey(Long id) {
-		return bindingAccountMapper.deleteByPrimaryKey(id);
-	}
+    @Override
+    public int deleteByPrimaryKey(Long id) {
+        return bindingAccountMapper.deleteByPrimaryKey(id);
+    }
 
-	@Transactional(rollbackFor=Exception.class)
-	@Override
-	public void validAlipayAccount(Long uid, String account, String name)
-			throws AlipayTransferException, AlipayApiException, AlipayAccountException {
-		if (uid == null)
-			throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "鐢ㄦ埛ID涓嶈兘涓虹┖");
-		if (StringUtil.isNullOrEmpty(account))
-			throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "璐﹀彿涓嶈兘涓虹┖");
-		if (StringUtil.isNullOrEmpty(name))
-			throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "鐪熷疄濮撳悕涓嶈兘涓虹┖");
-		//
-		List<BindingAccount> bindingAccountList = bindingAccountMapper.selectByAccount(account);
-		if (bindingAccountList != null && bindingAccountList.size() > 0) {
-			if (bindingAccountList.get(0).getUserInfo().getId().longValue() != uid)
-				throw new AlipayAccountException(AlipayAccountException.CODE_ALREADY_BIND,
-						"璇ユ敮浠樺疂璐﹀彿宸茶鍏朵粬璐﹀彿缁戝畾锛岃鏇存崲鍏朵粬鐨勬敮浠樺疂璐﹀彿鏉ョ粦瀹�");
-		}
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void validAlipayAccount(Long uid, String account, String name)
+            throws AlipayTransferException, AlipayApiException, AlipayAccountException {
+        if (uid == null)
+            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "鐢ㄦ埛ID涓嶈兘涓虹┖");
+        if (StringUtil.isNullOrEmpty(account))
+            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "璐﹀彿涓嶈兘涓虹┖");
+        if (StringUtil.isNullOrEmpty(name))
+            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "鐪熷疄濮撳悕涓嶈兘涓虹┖");
 
-		AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
-		if (latest != null) {
-			Calendar caLatest = Calendar.getInstance();
-			caLatest.setTimeInMillis(latest.getCreateTime().getTime());
-			Calendar nowLatest = Calendar.getInstance();
-			if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 涓婃鏇存敼鍜岀幇鍦ㄦ槸鍚屼竴涓湀
-				throw new AlipayAccountException(AlipayAccountException.CODE_TIMES_LIMIT, "姣忔湀鍙兘鏇存崲缁戝畾涓�娆℃敮浠樺疂璐﹀彿锛岃娆℃湀鍐嶈瘯銆�");
-		}
+        List<BindingAccount> bindingAccountList = bindingAccountMapper.selectByAccount(account);
 
-		UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
-		if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
-			throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "浣犵殑璐︽埛鏃犱綑棰濓紝鏃犻渶缁戝畾鎻愮幇甯愬彿銆�");
+        if (bindingAccountList != null && bindingAccountList.size() > 0) {
+            UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
+            SystemEnum systemEnum = user.getSystem();
 
-		// 闇�瑕佽浆璐﹂獙璇�
-		BigDecimal money = new BigDecimal("0.1");
-		transferAlipayWithVerify(account, name);
+            for (int i = 0; i < bindingAccountList.size(); i++) {
+                UserInfo u = userInfoMapper.selectByPrimaryKey(bindingAccountList.get(i).getUserInfo().getId());
+                //鍚屼竴绯荤粺涓嬬粦瀹氳处鍙蜂笉鑳介噸澶�
+                if (u.getSystem() == systemEnum && bindingAccountList.get(i).getUserInfo().getId().longValue() != uid) {
+                    throw new AlipayAccountException(AlipayAccountException.CODE_ALREADY_BIND,
+                            "璇ユ敮浠樺疂璐﹀彿宸茶鍏朵粬璐﹀彿缁戝畾锛岃鏇存崲鍏朵粬鐨勬敮浠樺疂璐﹀彿鏉ョ粦瀹�");
+                }
+            }
+        }
 
-		// 杞处鎴愬姛
-		// 鎻掑叆杞处鎴愬姛琛�
-		AlipayAccountValidNormalHistory history = new AlipayAccountValidNormalHistory();
-		history.setAccount(account);
-		history.setCreateTime(new Date());
-		history.setName(name);
-		history.setUid(uid);
-		alipayAccountValidNormalHistoryMapper.insertSelective(history);
-		UserMoneyDetail userMoneyDetail = null;
-		// 鏂扮増璧勯噾
-		try {
-			userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
-		} catch (UserMoneyDetailException e) {
-			try {
-				LogHelper.errorDetailInfo(e);
-			} catch (Exception e1) {
-				e1.printStackTrace();
-			}
-		}
+        AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
+        if (latest != null) {
+            Calendar caLatest = Calendar.getInstance();
+            caLatest.setTimeInMillis(latest.getCreateTime().getTime());
+            Calendar nowLatest = Calendar.getInstance();
+            if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 涓婃鏇存敼鍜岀幇鍦ㄦ槸鍚屼竴涓湀
+                throw new AlipayAccountException(AlipayAccountException.CODE_TIMES_LIMIT, "姣忔湀鍙兘鏇存崲缁戝畾涓�娆℃敮浠樺疂璐﹀彿锛岃娆℃湀鍐嶈瘯銆�");
+        }
 
-		// 浣欓鍏呰冻
-		if (userInfo.getMyHongBao().compareTo(money) >= 0) {
-			// 鎵f
-			userMoneyService.subUserMoney(uid, money, userMoneyDetail);
-			userMoneyMsgNotificationService.alipayAccountValid(history,"1涓湀",latest!=null);
-		} else {// 浣欓涓嶈冻锛屾殏鏃朵笉鎵f锛屽姞鍏ュ�熻捶鍏崇郴
-			UserMoneyDebt debt = new UserMoneyDebt();
-			debt.setCreateTime(new Date());
-			debt.setLeftMoney(money);
-			debt.setOriginMoney(money);
-			debt.setSourceId(history.getId());
-			debt.setType(UserMoneyDebtTypeEnum.extractVerify);
-			debt.setUid(uid);
-			try {
-				userMoneyDebtService.addUserMoneyDebt(debt);
-			} catch (UserMoneyDebtException e) {
-				LogHelper.errorDetailInfo(e, "楠岃瘉ID锛�" + history.getId(), "");
-			}
+        UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
+        if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
+            throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "浣犵殑璐︽埛鏃犱綑棰濓紝鏃犻渶缁戝畾鎻愮幇甯愬彿銆�");
 
-		}
+        // 闇�瑕佽浆璐﹂獙璇�
+        BigDecimal money = new BigDecimal("0.1");
+        transferAlipayWithVerify(account, name);
 
-	}
+        // 杞处鎴愬姛
+        // 鎻掑叆杞处鎴愬姛琛�
+        AlipayAccountValidNormalHistory history = new AlipayAccountValidNormalHistory();
+        history.setAccount(account);
+        history.setCreateTime(new Date());
+        history.setName(name);
+        history.setUid(uid);
+        alipayAccountValidNormalHistoryMapper.insertSelective(history);
+        UserMoneyDetail userMoneyDetail = null;
+        // 鏂扮増璧勯噾
+        try {
+            userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
+        } catch (UserMoneyDetailException e) {
+            try {
+                LogHelper.errorDetailInfo(e);
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
 
-	private void transferAlipayWithVerify(String account, String name)
-			throws AlipayTransferException, AlipayApiException {
-		String outBizNo=StringUtil.Md5(account)+TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
-		String appName = Constant.systemCommonConfig.getProjectChineseName();
-		AlipayUtil.transfer(outBizNo, account, name, new BigDecimal("0.1"), appName + "鏀粯瀹濋獙璇�", "鏉ヨ嚜" + appName + "鐨勬敮浠樺疂楠岃瘉鎵撴");
-	}
+        // 浣欓鍏呰冻
+        if (userInfo.getMyHongBao().compareTo(money) >= 0) {
+            // 鎵f
+            userMoneyService.subUserMoney(uid, money, userMoneyDetail);
+            userMoneyMsgNotificationService.alipayAccountValid(history, "1涓湀", latest != null);
+        } else {// 浣欓涓嶈冻锛屾殏鏃朵笉鎵f锛屽姞鍏ュ�熻捶鍏崇郴
+            UserMoneyDebt debt = new UserMoneyDebt();
+            debt.setCreateTime(new Date());
+            debt.setLeftMoney(money);
+            debt.setOriginMoney(money);
+            debt.setSourceId(history.getId());
+            debt.setType(UserMoneyDebtTypeEnum.extractVerify);
+            debt.setUid(uid);
+            try {
+                userMoneyDebtService.addUserMoneyDebt(debt);
+            } catch (UserMoneyDebtException e) {
+                LogHelper.errorDetailInfo(e, "楠岃瘉ID锛�" + history.getId(), "");
+            }
 
-	@Transactional(rollbackFor=Exception.class)
-	@Override
-	public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
-			throws AlipayTransferException, AlipayApiException, AlipayAccountException {
-		BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
-		if (bindingAccount != null) {
-			// 楠岃瘉鏄惁7澶╁唴鏇存崲浜嗘墜鏈哄彿
-			UserAccountBindingHistory history = userAccountBindingHistoryService.getLatestHistory(uid,
-					UserAccountBindingHistory.TYPE_PHONE);
-			// 鎵嬫満鍙锋洿鎹㈢粦瀹氱殑7澶╁唴涓嶈兘鎻愮幇
-			if (history != null && !history.getFirst()
-					&& (System.currentTimeMillis() - history.getCreateTime().getTime()) < 1000 * 60 * 60 * 24 * 7L) {
-				throw new AlipayAccountException(111, "淇敼鎵嬫満鍙峰悗锛�7澶╁唴鏃犳硶鏇存崲鎻愮幇璐﹀彿");
-			}
-		}
+        }
 
-		try {
-			validAlipayAccount(uid, account, name);
-		} catch (AlipayTransferException e1) {
-			throw new AlipayTransferException(e1.getCode(), e1.getSubCode(), e1.getMsg());
-		} catch (AlipayApiException e1) {
-			throw new AlipayApiException(e1.getErrCode(), e1.getErrMsg());
-		} catch (AlipayAccountException e1) {
-			throw new AlipayAccountException(e1.getCode(), e1.getMsg());
-		}
+    }
 
-		if (bindingAccount == null)// 鍒涘缓璐﹀彿
-		{
-			bindingAccount = new BindingAccount();
-			bindingAccount.setAccount(account);
-			bindingAccount.setName(name);
-			bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
-			bindingAccount.setUserInfo(new UserInfo(uid));
-			bindingAccountMapper.insertSelective(bindingAccount);
-		} else {
-			BindingAccount updateBindingAccount = new BindingAccount();
-			updateBindingAccount.setId(bindingAccount.getId());
-			updateBindingAccount.setName(name);
-			updateBindingAccount.setAccount(account);
-			bindingAccountMapper.updateByPrimaryKeySelective(updateBindingAccount);
-			bindingAccount.setName(updateBindingAccount.getName());
-			bindingAccount.setAccount(updateBindingAccount.getAccount());
-		}
+    private void transferAlipayWithVerify(String account, String name)
+            throws AlipayTransferException, AlipayApiException {
+        String outBizNo = StringUtil.Md5(account) + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
+        String appName = Constant.systemCommonConfig.getProjectChineseName();
+        AlipayUtil.transfer(outBizNo, account, name, new BigDecimal("0.1"), appName + "鏀粯瀹濋獙璇�", "鏉ヨ嚜" + appName + "鐨勬敮浠樺疂楠岃瘉鎵撴");
+    }
 
-		return bindingAccount;
-	}
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
+            throws AlipayTransferException, AlipayApiException, AlipayAccountException {
+        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
+        if (bindingAccount != null) {
+            // 楠岃瘉鏄惁7澶╁唴鏇存崲浜嗘墜鏈哄彿
+            UserAccountBindingHistory history = userAccountBindingHistoryService.getLatestHistory(uid,
+                    UserAccountBindingHistory.TYPE_PHONE);
+            // 鎵嬫満鍙锋洿鎹㈢粦瀹氱殑7澶╁唴涓嶈兘鎻愮幇
+            if (history != null && !history.getFirst()
+                    && (System.currentTimeMillis() - history.getCreateTime().getTime()) < 1000 * 60 * 60 * 24 * 7L) {
+                throw new AlipayAccountException(111, "淇敼鎵嬫満鍙峰悗锛�7澶╁唴鏃犳硶鏇存崲鎻愮幇璐﹀彿");
+            }
+        }
 
-	@Override
-	public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
-		UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
-		if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0) {
-			BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
-			if (bindingAccount != null)
-				throw new BindingAccountException(1, "褰撳墠璐︽埛娌℃湁浣欓锛屾棤闇�淇敼锛岃鏈変綑棰濆悗淇敼銆�");
-			else
-				throw new BindingAccountException(1, "褰撳墠璐︽埛娌℃湁浣欓锛岃鏈変綑棰濆悗缁戝畾銆�");
-		}
-		AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
-		if (latest != null) {
-			if (TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM")
-					.equalsIgnoreCase(TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM")))// 涓婃鏇存敼鍜岀幇鍦ㄦ槸鍚屼竴骞村悓涓�涓湀
-				throw new BindingAccountException(2, "姣忔湀浠呭彲淇敼1娆℃彁鐜拌处鍙凤紝璇蜂笅鏈堝啀璇曞惂銆�");
-		}
-		return true;
-	}
+        try {
+            validAlipayAccount(uid, account, name);
+        } catch (AlipayTransferException e1) {
+            throw new AlipayTransferException(e1.getCode(), e1.getSubCode(), e1.getMsg());
+        } catch (AlipayApiException e1) {
+            throw new AlipayApiException(e1.getErrCode(), e1.getErrMsg());
+        } catch (AlipayAccountException e1) {
+            throw new AlipayAccountException(e1.getCode(), e1.getMsg());
+        }
+
+        if (bindingAccount == null)// 鍒涘缓璐﹀彿
+        {
+            bindingAccount = new BindingAccount();
+            bindingAccount.setAccount(account);
+            bindingAccount.setName(name);
+            bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
+            bindingAccount.setUserInfo(new UserInfo(uid));
+            bindingAccountMapper.insertSelective(bindingAccount);
+        } else {
+            BindingAccount updateBindingAccount = new BindingAccount();
+            updateBindingAccount.setId(bindingAccount.getId());
+            updateBindingAccount.setName(name);
+            updateBindingAccount.setAccount(account);
+            bindingAccountMapper.updateByPrimaryKeySelective(updateBindingAccount);
+            bindingAccount.setName(updateBindingAccount.getName());
+            bindingAccount.setAccount(updateBindingAccount.getAccount());
+        }
+
+        return bindingAccount;
+    }
+
+    @Override
+    public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
+        UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
+        if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0) {
+            BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
+            if (bindingAccount != null)
+                throw new BindingAccountException(1, "褰撳墠璐︽埛娌℃湁浣欓锛屾棤闇�淇敼锛岃鏈変綑棰濆悗淇敼銆�");
+            else
+                throw new BindingAccountException(1, "褰撳墠璐︽埛娌℃湁浣欓锛岃鏈変綑棰濆悗缁戝畾銆�");
+        }
+        AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
+        if (latest != null) {
+            if (TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM")
+                    .equalsIgnoreCase(TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM")))// 涓婃鏇存敼鍜岀幇鍦ㄦ槸鍚屼竴骞村悓涓�涓湀
+                throw new BindingAccountException(2, "姣忔湀浠呭彲淇敼1娆℃彁鐜拌处鍙凤紝璇蜂笅鏈堝啀璇曞惂銆�");
+        }
+        return true;
+    }
 
 }

--
Gitblit v1.8.0