|
|
@ -54,10 +54,6 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
@Value("${cmb.url}") |
|
|
|
private String url; |
|
|
|
|
|
|
|
// 业务模式编号
|
|
|
|
@Value("${cmb.busMod}") |
|
|
|
private String busMod; |
|
|
|
|
|
|
|
// 火车票税率
|
|
|
|
@Value("${cmb.invoice.trainTaxRate:0.09}") |
|
|
|
private String trainTaxRate; |
|
|
@ -79,8 +75,12 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public BankDO payment(BankDO bankDO) { |
|
|
|
if(StringUtils.isEmpty(bankDO.getUid()) || StringUtils.isEmpty(bankDO.getBusMod())){ |
|
|
|
bankDO.setMessage("用户ID或业务模式为空"); |
|
|
|
return bankDO; |
|
|
|
} |
|
|
|
String funCode = "BB1PAYOP"; |
|
|
|
String data = "{\"request\":{\"body\":{\"bb1paybmx1\":[{\"busCod\":\"N02030\",\"busMod\":\"" + busMod + "\"}]},\"head\":{\"funcode\":\"" + funCode + "\",\"userid\":\"" + uid + "\"}}}"; |
|
|
|
String data = "{\"request\":{\"body\":{\"bb1paybmx1\":[{\"busCod\":\"N02030\",\"busMod\":\"" + bankDO.getBusMod() + "\"}]},\"head\":{\"funcode\":\"" + funCode + "\",\"userid\":\"" + bankDO.getUid() + "\"}}}"; |
|
|
|
JsonObject requestJson = new Gson().fromJson(data, JsonObject.class); |
|
|
|
JsonArray bb1payopx1 = new JsonArray(); |
|
|
|
JsonObject info = new JsonObject(); |
|
|
@ -104,7 +104,7 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
logger.info("发送给招商银行的数据:" + JsonUtil.formatJson(requestJson.toString())); |
|
|
|
String response; |
|
|
|
try { |
|
|
|
response = sendRequest(requestJson.toString(), funCode); |
|
|
|
response = sendRequest(requestJson.toString(), funCode, bankDO.getUid()); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -129,13 +129,17 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public BankDO queryPaymentResult(BankDO bankDO) { |
|
|
|
if(StringUtils.isEmpty(bankDO.getUid())){ |
|
|
|
bankDO.setMessage("用户ID为空"); |
|
|
|
return bankDO; |
|
|
|
} |
|
|
|
String funCode = "BB1PAYQR"; |
|
|
|
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\":\"" + bankDO.getUid() + "\"}}}"; |
|
|
|
logger.info("发送给招商银行的数据" + JsonUtil.formatJson(data)); |
|
|
|
String response; |
|
|
|
try { |
|
|
|
response = sendRequest(data, funCode); |
|
|
|
response = sendRequest(data, funCode, bankDO.getUid()); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -196,7 +200,7 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
logger.info("发送给招商银行的数据" + JsonUtil.formatJson(data)); |
|
|
|
String response; |
|
|
|
try { |
|
|
|
response = sendRequest(data, funCode); |
|
|
|
response = sendRequest(data, funCode, uid); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -315,9 +319,9 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
return totalPage; |
|
|
|
} |
|
|
|
|
|
|
|
public String sendRequest(String data, String funcode) throws Exception { |
|
|
|
public String sendRequest(String data, String funcode, String userId) throws Exception { |
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
map.put("UID", uid); |
|
|
|
map.put("UID", userId); |
|
|
|
map.put("ALG", alg); |
|
|
|
map.put("DATA", URLEncoder.encode(data, StandardCharsets.UTF_8.displayName())); |
|
|
|
map.put("FUNCODE", funcode); |
|
|
|