From 286e7a9b9632087798fbcd7b0a63b12d2a458235 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@Admin> Date: 星期四, 22 十一月 2018 10:00:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 93 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java index d12d4ae..cc5a8d1 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java @@ -723,6 +723,99 @@ redisManager.removeCommonString(key); } } + + + + @RequestMapping(value = "bindalipaywithverifynew") + public void bindAlipayWithVerifyNew(AcceptData acceptData, Long uid, String name, String account, PrintWriter out) { + + System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�")); + return; + } + + if (uid == null || uid == 0) { + out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼犵敤鎴稩D")); + return; + } + + if (StringUtil.isNullOrEmpty(name)) { + out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼犳敮浠樺疂瀹炲悕鍚嶇О")); + return; + } + + if (StringUtil.isNullOrEmpty(account)) { + out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼犳敮浠樺疂璐﹀彿")); + return; + } + + UserInfo user = userInfoService.getUserById(uid); + + boolean bind = redisManager.isBindAlipayAccountSMSStateValid(user.getPhone()); + if (!bind) { + out.print(JsonUtil.loadFalseResult(90002, "鎵嬫満楠岃瘉瓒呮椂")); + return; + } + + String key = "bindalipay-" + uid; + + if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) { + out.print(JsonUtil.loadFalseResult(1001, "鏈嶅姟鍣ㄧ箒蹇欙紝璇风◢鍚庨噸璇�")); + return; + } + redisManager.cacheCommonString(key, "1", 120); + // 鍙互灞曠ず缁欑敤鎴风湅鐨勯敊璇爜 + String[] ALIPAY_CODES = new String[] { "SYSTEM_ERROR", "PERMIT_CHECK_PERM_LIMITED", "PERM_AML_NOT_REALNAME_REV", + "PERM_AML_NOT_REALNAME_REV", "PAYEE_USER_INFO_ERROR", "PAYEE_ACC_OCUPIED", + "PERMIT_CHECK_PERM_IDENTITY_THEFT", "PERMIT_NON_BANK_LIMIT_PAYEE", "EXCEED_LIMIT_UNRN_DM_AMOUNT" }; + try { + BindingAccount bindingAccount = bindingAccountService.changeAlipayBindingWithVerify(uid, name, account); + out.print(JsonUtil.loadTrue(0, JsonUtil.getGson().toJson(bindingAccount), "绯荤粺宸叉垚鍔熻浆璐�0.1鍏冨埌鎻愮幇璐﹀彿涓紝鎻愮幇璐﹀彿楠岃瘉閫氳繃锛屾伃鍠滀綘锛佸彲浠ユ彁鐜颁簡銆�")); + } catch (AlipayTransferException e1) { + if (e1.getSubCode().equalsIgnoreCase("PAYEE_NOT_EXIST")) { + String msg = "绯荤粺鏈兘鎴愬姛杞处0.1鍏冿紝鎻愮幇璐﹀彿淇℃伅鏈夎锛岃鏍稿鍚庨噸鏂板~鍐欍��"; + out.print(JsonUtil.loadFalseResult(1, msg)); + } else { + for (String st : ALIPAY_CODES) { + if (st.equalsIgnoreCase(e1.getSubCode())) { + out.print(JsonUtil.loadFalseResult(2, e1.getMsg())); + return; + } + } + out.print(JsonUtil.loadFalseResult(3, "鏀粯瀹濇帴鍙e嚭閿欙紝楠岃瘉澶辫触锛岃鑱旂郴瀹㈡湇銆�")); + return; + } + + } catch (AlipayApiException e2) { + out.print(JsonUtil.loadFalseResult(4, e2.getErrMsg())); + return; + } catch (AlipayAccountException e3) { + // 璐︽埛鏃犱綑棰� + if (e3.getCode() == AlipayAccountException.CODE_NO_MONEY) { + out.print(JsonUtil.loadFalseResult(5, "浣犵殑璐︽埛鐩墠娌℃湁浣欓锛屾棤闇�缁戝畾鎻愮幇璐﹀彿銆�")); + return; + // 鎻愮幇娆℃暟闄愬埗 + } else if (e3.getCode() == AlipayAccountException.CODE_TIMES_LIMIT) { + out.print(JsonUtil.loadFalseResult(6, "姣忔湀浠呭彲淇敼1娆℃彁鐜拌处鍙凤紝璇蜂笅鏈堝啀璇曞惂銆�")); + return; + } else { + out.print(JsonUtil.loadFalseResult(7, e3.getMsg())); + return; + } + + } catch (Exception e) { + try { + LogHelper.errorDetailInfo(e); + } catch (Exception e1) { + e1.printStackTrace(); + } + out.print(JsonUtil.loadFalseResult(8, "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝楠岃瘉澶辫触锛岃鑱旂郴瀹㈡湇銆�")); + } finally { + redisManager.removeCommonString(key); + } + } + /** * 鑾峰彇鐢ㄦ埛璧勯噾璇︽儏 -- Gitblit v1.8.0