Commit a740574a authored by 黎博's avatar 黎博

新增vcc授信额度自动审核

parent 2adce90e
......@@ -2,7 +2,10 @@ package cn.qg.holmes.interceptor;
import cn.qg.holmes.entity.mock.Mock;
import cn.qg.holmes.mapper.mock.MockMapper;
import cn.qg.holmes.utils.HttpClientUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -99,9 +102,17 @@ public class RuleEngineInterceptor implements HandlerInterceptor {
bodyMap.put("allowInstalmentTerms", null);
bodyMap.put("quotaPaymentAmount", null);
bodyMap.put("auditResult", true);
// vcc授信额度审核
if (bizType.equals("8") && sceneId.equals("0")) {
// TODO: 不知道namespace,暂时无法审核
// 授信额度审核
if (sceneId.equals("0")) {
// vcc
if (bizType.equals("8")) {
String callbackUrl = requestMap.get("callbackUrl").toString();
vccRiskAuthAmountCompletion(callbackUrl, bizChannel, uuid, bizNo, 10000, true);
}
// 一单一审现金贷
if (bizType.equals("0")) {
}
}
// KA准入审核, sceneId=2
if (sceneId.equals("2")) {
......@@ -145,4 +156,94 @@ public class RuleEngineInterceptor implements HandlerInterceptor {
@Nullable Exception ex) throws Exception {
}
/**
* vcc风控授信回调
* @param callbackUrl 回调url
* @param bizChannel 渠道号
* @param uuid uuid
* @param riskNo 授信单号
* @param amount 授信金额
* @param auditResult 授信结果,true/false
*/
public static void vccRiskAuthAmountCompletion(String callbackUrl,String bizChannel, String uuid, String riskNo, Integer amount, boolean auditResult) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 15);
long openingDeadLine = calendar.getTimeInMillis();
Calendar calendar2 = Calendar.getInstance();
calendar2.add(Calendar.YEAR, 1);
Long deadLine = calendar2.getTimeInMillis();
Map<String, Object> params = new HashMap<>();
params.put("amount", amount);
params.put("auditResult", auditResult);
params.put("bizChannel", bizChannel);
params.put("bizNo", riskNo);
params.put("code", 0);
params.put("deadLine", deadLine);
params.put("openingDeadLine", openingDeadLine); // 开户失败有效期
params.put("success", true);
params.put("uuid", uuid);
params.put("sceneId", 0);
params.put("allowInstalment", 1); // 1-允许分期,0-不允许分期
params.put("allowInstalmentTerms", "3,6,9,12"); // 允许分期的期数
Map<String, Object> headers = new HashMap<>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
JSONObject result = HttpClientUtils.doPost(callbackUrl, params, headers);
log.info("vcc风控授信回调参数:{}", params);
log.info("vcc风控授信回调结果:{}", result);
}
public static void quotaAuthAmountAuditNotify(String callbackUrl, String uuid, Integer bizChannel, Integer fundId, String bizNo, Integer bizType, Integer creditAmount, Integer term, boolean auditResult) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 30);
Long deadLine = calendar.getTimeInMillis();
Map<String, Object> headers = new HashMap<>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
Map<String, Object> params = new HashMap<>();
params.put("code", 0);
params.put("msg", "success");
params.put("bizChannel", bizChannel); // 渠道号
params.put("uuid", uuid);
params.put("bizNo", bizNo);
params.put("bizType", bizType); // 业务类型: 0-现金分期一单一审,……
params.put("auditResult", auditResult);
params.put("amount", creditAmount);
params.put("deadLine", deadLine);
params.put("extData", "");
params.put("otherInformation", "");
JSONArray financeProducts = createFinanceProducts(fundId, term);
params.put("financeProducts", financeProducts);
HttpClientUtils.doPost(callbackUrl, params, headers);
log.info("现金分期风控授信回调:{}", params);
}
public static JSONArray createFinanceProducts(Integer fundId, Integer term) {
JSONArray financeProducts = new JSONArray();
JSONObject financeProductsObject = new JSONObject();
JSONArray terms = new JSONArray();
financeProductsObject.put("max", 10000);
financeProductsObject.put("min", 10000);
JSONObject firstTerm = new JSONObject();
firstTerm.put("term", term);
JSONArray fundInfoList = new JSONArray();
JSONObject fundInfoObject = new JSONObject();
fundInfoObject.put("fundId", fundId);
fundInfoObject.put("rate", 0);
fundInfoObject.put("rateType", 1);
fundInfoObject.put("priority", 1);
fundInfoObject.put("feeType", 1);
// 如果是云南信托,需要该参数
if (fundId == 1040) {
fundInfoObject.put("fundProductId", 1061);
}
// 平顶山银行
if (fundId == 1030) {
fundInfoObject.put("fundProductId", 1060);
}
fundInfoList.add(fundInfoObject);
firstTerm.put("fundInfo", fundInfoList);
terms.add(firstTerm);
financeProductsObject.put("terms", terms);
financeProducts.add(financeProductsObject);
return financeProducts;
}
}
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