|
@ -26,10 +26,13 @@ import com.win.bank.service.bank.BankService; |
|
|
import com.win.bank.utils.HttpUtil; |
|
|
import com.win.bank.utils.HttpUtil; |
|
|
import com.win.bank.utils.JsonUtil; |
|
|
import com.win.bank.utils.JsonUtil; |
|
|
|
|
|
|
|
|
|
|
|
import lombok.extern.log4j.Log4j; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 招商银行 |
|
|
* 招商银行 |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
|
|
|
@Log4j |
|
|
public class CmbServiceImpl implements BaseBankService { |
|
|
public class CmbServiceImpl implements BaseBankService { |
|
|
|
|
|
|
|
|
// 企业网银用户号
|
|
|
// 企业网银用户号
|
|
@ -46,7 +49,7 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
// 算法,固定为国密算法
|
|
|
// 算法,固定为国密算法
|
|
|
private static final String alg = "SM"; |
|
|
private static final String alg = "SM"; |
|
|
private static final String SUCCESS_CODE = "SUC0000"; |
|
|
private static final String SUCCESS_CODE = "SUC0000"; |
|
|
private static final Logger logger = LoggerFactory.getLogger(CmbServiceImpl.class); |
|
|
private static final Logger logger = LoggerFactory.getLogger("sys-user"); |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private BankService bankService; |
|
|
private BankService bankService; |
|
@ -74,14 +77,14 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
info.addProperty("yurRef", businessCode); |
|
|
info.addProperty("yurRef", businessCode); |
|
|
bb1payopx1.add(info); |
|
|
bb1payopx1.add(info); |
|
|
requestJson.getAsJsonObject("request").getAsJsonObject("body").add("bb1payopx1", bb1payopx1); |
|
|
requestJson.getAsJsonObject("request").getAsJsonObject("body").add("bb1payopx1", bb1payopx1); |
|
|
logger.debug("发送给招商银行的数据:" + JsonUtil.formatJson(requestJson.toString())); |
|
|
logger.info("发送给招商银行的数据:" + JsonUtil.formatJson(requestJson.toString())); |
|
|
String response; |
|
|
String response; |
|
|
try { |
|
|
try { |
|
|
response = sendRequest(requestJson.toString(), funCode); |
|
|
response = sendRequest(requestJson.toString(), funCode); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
|
logger.debug("收到招商银行的数据:" + JsonUtil.formatJson(response)); |
|
|
logger.info("收到招商银行的数据:" + JsonUtil.formatJson(response)); |
|
|
JsonObject responseJson = new Gson().fromJson(response, JsonObject.class); |
|
|
JsonObject responseJson = new Gson().fromJson(response, JsonObject.class); |
|
|
JsonObject headJson = responseJson.getAsJsonObject("response").getAsJsonObject("head"); |
|
|
JsonObject headJson = responseJson.getAsJsonObject("response").getAsJsonObject("head"); |
|
|
if (SUCCESS_CODE.equals(headJson.get("resultcode").getAsString())) { |
|
|
if (SUCCESS_CODE.equals(headJson.get("resultcode").getAsString())) { |
|
@ -105,14 +108,14 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
String funCode = "BB1PAYQR"; |
|
|
String funCode = "BB1PAYQR"; |
|
|
String yurRef = bankDO.getBusinessCode(); |
|
|
String yurRef = bankDO.getBusinessCode(); |
|
|
String data = "{\"request\":{\"body\":{\"bb1payqrx1\":[{\"busCod\":\"N02030\",\"yurRef\":\"" + yurRef + "\"}]},\"head\":{\"funcode\":\"" + funCode + "\",\"userid\":\"" + uid + "\"}}}"; |
|
|
String data = "{\"request\":{\"body\":{\"bb1payqrx1\":[{\"busCod\":\"N02030\",\"yurRef\":\"" + yurRef + "\"}]},\"head\":{\"funcode\":\"" + funCode + "\",\"userid\":\"" + uid + "\"}}}"; |
|
|
logger.debug("发送给招商银行的数据" + JsonUtil.formatJson(data)); |
|
|
logger.info("发送给招商银行的数据" + JsonUtil.formatJson(data)); |
|
|
String response; |
|
|
String response; |
|
|
try { |
|
|
try { |
|
|
response = sendRequest(data, funCode); |
|
|
response = sendRequest(data, funCode); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
|
logger.debug("收到招商银行的数据:" + JsonUtil.formatJson(response)); |
|
|
logger.info("收到招商银行的数据:" + JsonUtil.formatJson(response)); |
|
|
JsonObject responseJson = new Gson().fromJson(response, JsonObject.class); |
|
|
JsonObject responseJson = new Gson().fromJson(response, JsonObject.class); |
|
|
JsonObject headJson = responseJson.getAsJsonObject("response").getAsJsonObject("head"); |
|
|
JsonObject headJson = responseJson.getAsJsonObject("response").getAsJsonObject("head"); |
|
|
if (SUCCESS_CODE.equals(headJson.get("resultcode").getAsString())) { |
|
|
if (SUCCESS_CODE.equals(headJson.get("resultcode").getAsString())) { |
|
|