From 1e12b2abcaa1bdbdb57d3694446337126168bef1 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 28 三月 2025 19:15:08 +0800 Subject: [PATCH] bug修改 --- xinquan-common/xinquan-common-core/src/main/java/com/xinquan/common/core/utils/JuHeFuUtil.java | 138 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 107 insertions(+), 31 deletions(-) diff --git a/xinquan-common/xinquan-common-core/src/main/java/com/xinquan/common/core/utils/JuHeFuUtil.java b/xinquan-common/xinquan-common-core/src/main/java/com/xinquan/common/core/utils/JuHeFuUtil.java index ed5c8a7..cbde3c3 100644 --- a/xinquan-common/xinquan-common-core/src/main/java/com/xinquan/common/core/utils/JuHeFuUtil.java +++ b/xinquan-common/xinquan-common-core/src/main/java/com/xinquan/common/core/utils/JuHeFuUtil.java @@ -1,10 +1,13 @@ package com.xinquan.common.core.utils; +import cn.hutool.core.util.RandomUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.obs.services.IFSClient; import com.xinquan.common.core.domain.R; import com.xinquan.common.core.exception.ServiceException; @@ -72,6 +75,8 @@ private static final String PAYMENT_REFUND_INTERFACE = "/api/payment/payment_refund"; private static final String QUERY_PAYMENT_INTERFACE = "/api/query/query_payment"; private static final String MERCHANT_PAY_INTERFACE = "/api/account/merchant_pay"; + // 查询用户列表 + private static final String QUERY_USER_LIST = "/api/query/query_user_list"; // 接口地址 TODO private static final String BASE_URL = "https://payapi.juhefu.com/"; // 支付宝支付渠道 @@ -81,7 +86,93 @@ private static final String PAY_CHANNEL_WECHAT_THiRD = "wx"; // 微信小程序id TODO private static final String WX_APP_ID = ""; + public static void main(String[] args) throws Exception { +// createPayment1("CZ192818331231230901", 1, "0.01", +// "充值", "充值", +// "127.0.0.1", "o4Q_v6QMqkcO7kIOOxp-x1-UpOww", +// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") +//// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") +// ; +// String orderNo = OrderUtil.getOrderNoForPrefix("User"); +// long time = new Date().getTime(); +// String s = RandomUtil.randomNumbers(4); +// String s1 = "FZ" + time + s; +// System.err.println(s1); + createUser("1","董国庆","00" + ,"511602199910018718" + ,"18224358736" + ,"6230520460328218072"); +// updateAccount("FZ17403857003793677","邱仕珍","13682696011" +// ,"4367427200563236884"); +// updateAccount("FZ17430446395934603","刘晓梅","18186305036" +// ,"6215591804000544393"); +// balancePay("CZ09809217341", "FZ17343419268427877","0.01", ""); +// queryBalance("FZ17343419268427877"); +// String decrypt = decrypt("z8Che/JwxrGj/oTOuAvU8HFN6vXL/OqeioV41ZuPV/xVQPt9vCHHc1R5LgAO51Hq5ilD9wqsminRvSiJj6Fs/Bfk8espZSOO2g1OE7FZyqcLB1w01MSWyxfQT8nc2GH/EfOKXCuaKBCeyW24OvW3ng=="); +// System.err.println(decrypt); +// balanceWithdraw("TX1000928371648172","0.01","FZ17343419268427877","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); + queryUserList("420881198207202109"); +// queryBalanceList("FZ17430701653874185"); +// queryPayment("002212025032410341110750073154527547392"); + } + public static String queryUserList(String identifier) + throws Exception { + JSONObject data = new JSONObject(); +// data.put("app_id", APP_ID); + data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); + data.put("member_type", "01"); + data.put("identifier", identifier); + data.put("page_index", "1"); + data.put("page_size", "10"); + JSONObject body = new JSONObject(); + body.put("merId", "1120241105365033"); + body.put("sign", sign(JSONObject.toJSONString(data))); +// body.put("reqCipher", +// EncryptUtils.aes256ECBPkcs7PaddingEncrypt(JSONObject.toJSONString(data), AES_KEY)); + body.put("reqCipher", + EncryptUtils.aes256ECBPkcs7PaddingEncrypt(JSONObject.toJSONString(data), "6d548eb01bad44bbbb4a23743e733103")); + body.put("reqTime", DateUtils.dateTimeNow("yyyyMMddHHmmsssss")); + System.err.println(body); +// String result = sendPost(BASE_URL + CREATE_USER_INTERFACE, body); + String result = sendPost("https://payapi.juhefu.com/" + QUERY_USER_LIST, body); + JSONObject resJsonObject = JSONObject.parseObject(result); + System.err.println(resJsonObject); + if (resJsonObject.get("error_msg")!=null){ + return resJsonObject.getString("error_msg"); + } + String string = resJsonObject.getString("resCipher"); + String decrypt = decrypt(string); + System.err.println(decrypt); + JSONObject jsonObject = JSONObject.parseObject(decrypt); + System.err.println(jsonObject); + if (jsonObject!=null){ + JSONArray data1 = jsonObject.getJSONArray("data"); + if(data1==null){ + return null; + }else{ + for (Object o : data1) { + // 将Object转化为jsonObject + JSONObject jsonObject1 = (JSONObject) o; + if(jsonObject1!=null){ + String fzId = jsonObject1.getString("member_id"); + String sfz = jsonObject1.getString("identifier"); + if (org.springframework.util.StringUtils.hasLength(fzId)&&org.springframework.util.StringUtils.hasLength(sfz)){ + if (sfz.equals(identifier)){ + return fzId; + } + }else{ + return null; + } + }else{ + return null; + } + } + return null; + } + } + return null; + } /** * 创建用户 * @@ -129,16 +220,21 @@ // String result = sendPost(BASE_URL + CREATE_USER_INTERFACE, body); String result = sendPost("https://payapi.juhefu.com/" + CREATE_USER_INTERFACE, body); JSONObject resJsonObject = JSONObject.parseObject(result); + if (org.springframework.util.StringUtils.hasLength(resJsonObject.getString("error_msg"))){ + return resJsonObject.getString("error_msg"); + } System.err.println(resJsonObject); - String string = resJsonObject.getString("reqCipher"); + String string = resJsonObject.getString("resCipher"); String decrypt = decrypt(string); System.err.println(decrypt); JSONObject jsonObject = JSONObject.parseObject(decrypt); - if (resJsonObject.get("error_msg")!=null){ + if (jsonObject.get("error_msg")!=null){ + System.err.println("添加银行卡失败没有获取到分账id"+resJsonObject.get("error_msg")); return resJsonObject.getString("error_msg"); } return "success"; } + public static String updateAccount( String memberId ,String username @@ -155,6 +251,7 @@ data.put("card_id", cardId); data.put("card_name", username); data.put("tel_no", telNo); + data.put("bank_acct_type", "2"); JSONObject body = new JSONObject(); // body.put("merId", MER_ID); body.put("merId", "1120241105365033"); @@ -170,9 +267,12 @@ JSONObject resJsonObject = JSONObject.parseObject(result); System.err.println(resJsonObject); if (resJsonObject.get("error_msg")!=null){ + if (resJsonObject.getString("error_msg").contains("无需更新")){ + return "success"; + } return resJsonObject.getString("error_msg"); } - String string = resJsonObject.getString("reqCipher"); + String string = resJsonObject.getString("resCipher"); String decrypt = decrypt(string); if (decrypt==null){ return "false"+"发生未知异常(应该是银行卡信息和持卡人信息不一致 但是第三方没有返回准确的错误信息 这里统一返回为银行卡信息或持卡人信息有误)"; @@ -192,9 +292,8 @@ JSONObject data = new JSONObject(); // data.put("app_id", APP_ID); - data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); + data.put("app_id", APP_ID); data.put("member_id", memberId); - data.put("member_type", "01"); JSONObject body = new JSONObject(); // body.put("merId", MER_ID); body.put("merId", "1120241105365033"); @@ -219,7 +318,7 @@ System.err.println(jsonObject); return "success"; } - public static String queryBalanceList() + public static String queryBalanceList(String member_id) throws Exception { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = new Date(); @@ -232,8 +331,8 @@ data.put("start_date", format1); data.put("end_date", format); data.put("page_index", "01"); - data.put("page_size", "01"); - data.put("member_id", "FZ17343419268427877"); + data.put("page_size", "10"); + data.put("member_id", member_id); JSONObject body = new JSONObject(); // body.put("merId", MER_ID); body.put("merId", "1120241105365033"); @@ -257,30 +356,7 @@ return "success"; } - public static void main(String[] args) throws Exception { -// createPayment1("CZ192818331231230901", 1, "0.01", -// "充值", "充值", -// "127.0.0.1", "o4Q_v6QMqkcO7kIOOxp-x1-UpOww", -// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") -//// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") -// ; -// String orderNo = OrderUtil.getOrderNoForPrefix("User"); -// createUser("test945622121","周帅","00" -// ,"513902200006257079" -// ,"19983174515" -// ,"6228480469852935177"); -// updateAccount("test945622121","周帅","19983174515" -// ,"6228480469852935177"); -// updateAccount("test945622121","周帅","19983174515" -// ,"6228480469852935177"); -// balancePay("CZ09809217341", "FZ17343419268427877","0.01", ""); -// queryBalance("FZ17343419268427877"); -// String decrypt = decrypt("z8Che/JwxrGj/oTOuAvU8HFN6vXL/OqeioV41ZuPV/xVQPt9vCHHc1R5LgAO51Hq5ilD9wqsminRvSiJj6Fs/Bfk8espZSOO2g1OE7FZyqcLB1w01MSWyxfQT8nc2GH/EfOKXCuaKBCeyW24OvW3ng=="); -// System.err.println(decrypt); -// balanceWithdraw("TX1000928371648172","0.01","FZ17343419268427877","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); - queryBalanceList(); - } public static JSONObject balancePay(String orderNo, String memberId, String payAmt, String notifyUrl) throws Exception { JSONObject data = new JSONObject(); -- Gitblit v1.7.1