|
@@ -199,11 +199,11 @@ public class WithdrawSdk {
|
|
|
String resultJsonStr = HttpUtil.postForHttp(apiUrl + "/bpotop_trade/single", JSONObject.toJSONString(mapParam), null);
|
|
|
logger.info("单笔请求返回参数:{}", resultJsonStr);
|
|
|
|
|
|
- Map<String,Object> mapTypes = JSON.parseObject(resultJsonStr);
|
|
|
+ Map<String, Object> mapTypes = JSON.parseObject(resultJsonStr);
|
|
|
String returnCode = String.valueOf(mapTypes.get("return_code"));
|
|
|
- if (returnCode.equals("T")){
|
|
|
+ if (returnCode.equals("T")) {
|
|
|
return HttpResponseResult.succeed(true);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return HttpResponseResult.failed(String.valueOf(mapTypes.get("return_message")));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
@@ -251,9 +251,10 @@ public class WithdrawSdk {
|
|
|
|
|
|
/**
|
|
|
* 查询商户余额(单位为:分,范围:1~10000000000)
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public BigDecimal balanceQuery(){
|
|
|
+ public BigDecimal balanceQuery() {
|
|
|
Map<String, Object> requestMap = new HashMap<>();
|
|
|
requestMap.put("outMemberNo", memberNo);
|
|
|
requestMap.put("charset", "UTF-8");
|
|
@@ -274,15 +275,10 @@ public class WithdrawSdk {
|
|
|
try {
|
|
|
resultJsonStr = HttpUtil.postForHttp(apiUrl + "/bpotop_trade/balance_query", JSONObject.toJSONString(requestMap), null);
|
|
|
logger.info("查询余额响应参数(未解析):{}", resultJsonStr);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(resultJsonStr);
|
|
|
- String code = jsonObject.getString("code");
|
|
|
- if(code.equals("100")){
|
|
|
- String resData = jsonObject.getJSONObject("details").getString("data");
|
|
|
- String decryptStr = RSA.decryptPri(resData, privateKey);
|
|
|
- logger.info("查询余额响应参数(解析后):{}", decryptStr);
|
|
|
- JSONObject data = JSONObject.parseObject(decryptStr);
|
|
|
- return new BigDecimal(data.getString("balance")).divide(new BigDecimal("100"));
|
|
|
- }
|
|
|
+ String decryptStr = RSA.decryptPri(resultJsonStr, privateKey);
|
|
|
+ logger.info("查询余额响应参数(已解析):{}", decryptStr);
|
|
|
+ Map stringToMap = JSONObject.parseObject(decryptStr);
|
|
|
+ return new BigDecimal(String.valueOf(stringToMap.get("balance"))).divide(new BigDecimal("100"));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|