Commit d436e7ca authored by 黎博's avatar 黎博

新增vcc手动回调逻辑

parent e32a8ec0
......@@ -192,7 +192,7 @@ public class Vcc {
/**
* 授信结果查询
*/
public static void searchCreditResult(String namespace, String token, String vccChannel) throws URISyntaxException {
public static Map<String, Object> searchCreditResult(String namespace, String token, String vccChannel) throws URISyntaxException {
String url = "https://talos-" + namespace + ".liangkebang.net/vcc/xyqb_mall/credit_info";
Map<String, Object> headers = new HashMap<>();
headers.put("x-auth-token", token);
......@@ -200,6 +200,8 @@ public class Vcc {
headers.put("content-type", "application/x-www-form-urlencoded");
JSONObject result = HttpClientUtils.doGetReturnJson(url, null, headers);
log.info("授信结果查询:" + result);
Map<String, Object> map = (Map<String, Object>) result.get("data");
return map;
}
/**
......@@ -343,7 +345,10 @@ public class Vcc {
return true;
}
public static void main(String[] args) throws SQLException {
vccWindControlCreditCallback("vc2", "1", "");
public static void main(String[] args) throws Exception {
Map<String, String> loginResult = login("vcc3", "18300000418", "214", "214");
String uuid = loginResult.get("uuid");
String riskNo = getRiskNo("vcc3", uuid);
vccWindControlCreditCallback("vcc3", "1", riskNo);
}
}
......@@ -85,7 +85,23 @@ public class VccDataServiceImpl implements VccDataService {
// 提交授信
Vcc.submitCredit(namespace, token, vccChannel);
// 授信结果查询
Vcc.searchCreditResult(namespace, token, vccChannel);
int searchCreditCount = 0;
while (true) {
try {
Thread.sleep(1000);
searchCreditCount++;
Map<String, Object> creditResult = Vcc.searchCreditResult(namespace, token, vccChannel);
if (creditResult.get("status").equals("1")) {
break;
} else if (creditResult.get("status").equals("0") && searchCreditCount == 10) {
String riskNo = Vcc.getRiskNo(namespace, uuid);
Vcc.vccWindControlCreditCallback(namespace, uuid, riskNo);
break;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (status == 1 || status == 2) {
log.info("提交授信成功!");
Thread.sleep(2000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment