Commit bc0ebe25 authored by 黎博's avatar 黎博

新增风控相关,vcc造数据接口优化

parent 356b06b2
...@@ -21,9 +21,6 @@ public class GenVccController { ...@@ -21,9 +21,6 @@ public class GenVccController {
@PostMapping("/gen") @PostMapping("/gen")
@ApiOperation(value = "vcc造数据") @ApiOperation(value = "vcc造数据")
public JsonResult genVccUser(String namespace, String phoneNo, String channel, Integer status) throws Exception { public JsonResult genVccUser(String namespace, String phoneNo, String channel, Integer status) throws Exception {
if (status != 0 && status != 1 && status !=2 ) {
return JsonResult.clientFailed("状态必须为0、1、2");
}
if (!channel.equals("214") && !channel.equals("217")) { if (!channel.equals("214") && !channel.equals("217")) {
return JsonResult.clientFailed("渠道必须为214或217"); return JsonResult.clientFailed("渠道必须为214或217");
} }
......
package cn.qg.qaplatform.dao;
public interface RuleEngineMapper {
int addBlackList(String uuid);
}
...@@ -761,4 +761,10 @@ public class Xyqb { ...@@ -761,4 +761,10 @@ public class Xyqb {
return flag; return flag;
} }
public static void main(String[] args) throws URISyntaxException {
String fundOpToken = loginFundOP("vcc2");
boolean assignFundResult = assignFundOrNot("vcc2", 480, fundOpToken);
System.out.println("分配结果为:" + assignFundResult);
}
} }
package cn.qg.qaplatform.service;
/**
* 风控相关接口
*/
public interface RuleEngineService {
/**
* 添加授信黑名单
* @param uuid uuid
* @return 成功与否
*/
boolean addBlackList(String uuid);
}
package cn.qg.qaplatform.service.impl;
import cn.qg.qaplatform.common.SwitchDataSource;
import cn.qg.qaplatform.dao.RuleEngineMapper;
import cn.qg.qaplatform.service.RuleEngineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class RuleEngineServiceImpl implements RuleEngineService {
@Autowired
RuleEngineMapper ruleEngineMapper;
@Override
public boolean addBlackList(String uuid) {
SwitchDataSource.dataSourceSwitch("fe", "workflow");
int insertResult = ruleEngineMapper.addBlackList(uuid);
return insertResult >= 1;
}
}
...@@ -5,6 +5,7 @@ import cn.qg.qaplatform.dao.QueryVccDataMapper; ...@@ -5,6 +5,7 @@ import cn.qg.qaplatform.dao.QueryVccDataMapper;
import cn.qg.qaplatform.domain.GenVccUser; import cn.qg.qaplatform.domain.GenVccUser;
import cn.qg.qaplatform.domain.QueryVccUser; import cn.qg.qaplatform.domain.QueryVccUser;
import cn.qg.qaplatform.process.Vcc; import cn.qg.qaplatform.process.Vcc;
import cn.qg.qaplatform.service.RuleEngineService;
import cn.qg.qaplatform.service.VccDataService; import cn.qg.qaplatform.service.VccDataService;
import cn.qg.qaplatform.utils.page.PageResult; import cn.qg.qaplatform.utils.page.PageResult;
import cn.qg.qaplatform.utils.page.PageUtil; import cn.qg.qaplatform.utils.page.PageUtil;
...@@ -24,12 +25,15 @@ public class VccDataServiceImpl implements VccDataService { ...@@ -24,12 +25,15 @@ public class VccDataServiceImpl implements VccDataService {
@Autowired @Autowired
QueryVccDataMapper queryVccDataMapper; QueryVccDataMapper queryVccDataMapper;
@Autowired
RuleEngineService ruleEngineService;
/** /**
* vcc造数据 * vcc造数据
* @param namespace 环境 * @param namespace 环境
* @param phoneNo 手机号 * @param phoneNo 手机号
* @param openedChannel 创建渠道 * @param openedChannel 创建渠道
* @param status 0-未激活,1-已激活 * @param status 1-授信成功,2-授信失败,3-开户成功,4-开户失败
* @return * @return
* @throws Exception * @throws Exception
*/ */
...@@ -52,6 +56,10 @@ public class VccDataServiceImpl implements VccDataService { ...@@ -52,6 +56,10 @@ public class VccDataServiceImpl implements VccDataService {
Map loginResult = Vcc.login(namespace, phoneNo, openedChannel, openedChannel); Map loginResult = Vcc.login(namespace, phoneNo, openedChannel, openedChannel);
String token = loginResult.get("token").toString(); String token = loginResult.get("token").toString();
String uuid = loginResult.get("uuid").toString(); String uuid = loginResult.get("uuid").toString();
// 加入授信黑名单
if (status == 2) {
ruleEngineService.addBlackList(uuid);
}
// 检查用户是否已有额度 // 检查用户是否已有额度
boolean haveQuota = Vcc.checkIfAlreadyHaveQuota(namespace, uuid); boolean haveQuota = Vcc.checkIfAlreadyHaveQuota(namespace, uuid);
if (haveQuota) { if (haveQuota) {
...@@ -74,7 +82,7 @@ public class VccDataServiceImpl implements VccDataService { ...@@ -74,7 +82,7 @@ public class VccDataServiceImpl implements VccDataService {
Vcc.submitCredit(namespace, token, vccChannel); Vcc.submitCredit(namespace, token, vccChannel);
// 授信结果查询 // 授信结果查询
Vcc.searchCreditResult(namespace, token, vccChannel); Vcc.searchCreditResult(namespace, token, vccChannel);
if (status == 0) { if (status == 1 || status == 2) {
genVccUser.setMsg("提交授信成功!"); genVccUser.setMsg("提交授信成功!");
return genVccUser; return genVccUser;
} }
...@@ -86,7 +94,7 @@ public class VccDataServiceImpl implements VccDataService { ...@@ -86,7 +94,7 @@ public class VccDataServiceImpl implements VccDataService {
String requestId = Vcc.bindCardSms(namespace, token, vccChannel, "ABC", "6228272537046278993"); String requestId = Vcc.bindCardSms(namespace, token, vccChannel, "ABC", "6228272537046278993");
// 额度激活 // 额度激活
JSONObject quotaActivationResult = Vcc.quotaActivation(namespace, token, vccChannel, "6228272537046278993", requestId); JSONObject quotaActivationResult = Vcc.quotaActivation(namespace, token, vccChannel, "6228272537046278993", requestId);
if (status == 1) { if (status == 3) {
// 开户结果 // 开户结果
JSONObject result = Vcc.openResult(namespace, token, vccChannel); JSONObject result = Vcc.openResult(namespace, token, vccChannel);
Map data = (Map) result.get("data"); Map data = (Map) result.get("data");
...@@ -96,7 +104,7 @@ public class VccDataServiceImpl implements VccDataService { ...@@ -96,7 +104,7 @@ public class VccDataServiceImpl implements VccDataService {
genVccUser.setEacctNo(eacctNo); genVccUser.setEacctNo(eacctNo);
genVccUser.setMsg("开户成功"); genVccUser.setMsg("开户成功");
} }
if (status == 2) { if (status == 4) {
Map data = (Map) quotaActivationResult.get("data"); Map data = (Map) quotaActivationResult.get("data");
if (data.get("status").equals("2")) { if (data.get("status").equals("2")) {
genVccUser.setMsg("开户失败"); genVccUser.setMsg("开户失败");
......
...@@ -7,6 +7,7 @@ import cn.qg.qaplatform.process.Xyqb; ...@@ -7,6 +7,7 @@ import cn.qg.qaplatform.process.Xyqb;
import cn.qg.qaplatform.service.QueryInProcessStatusService; import cn.qg.qaplatform.service.QueryInProcessStatusService;
import cn.qg.qaplatform.service.XyqbDataService; import cn.qg.qaplatform.service.XyqbDataService;
import cn.qg.qaplatform.service.QueryBasicLoanStatusDataService; import cn.qg.qaplatform.service.QueryBasicLoanStatusDataService;
import com.alibaba.fastjson.JSONException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -47,6 +48,9 @@ public class XyqbDataServiceImpl implements XyqbDataService { ...@@ -47,6 +48,9 @@ public class XyqbDataServiceImpl implements XyqbDataService {
isAleadyAssign = Xyqb.assignFundOrNot(namespace, fundId, fundOpToken); isAleadyAssign = Xyqb.assignFundOrNot(namespace, fundId, fundOpToken);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
e.printStackTrace(); e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
return false;
} }
boolean assignResult = false; boolean assignResult = false;
boolean unblockResult = false; boolean unblockResult = false;
...@@ -254,6 +258,10 @@ public class XyqbDataServiceImpl implements XyqbDataService { ...@@ -254,6 +258,10 @@ public class XyqbDataServiceImpl implements XyqbDataService {
boolean assignFundResult = assignFundCorp(namespace, fundId, symbol); boolean assignFundResult = assignFundCorp(namespace, fundId, symbol);
log.info("分配资金方的结果为:" + assignFundResult); log.info("分配资金方的结果为:" + assignFundResult);
if (!assignFundResult) {
log.info("资金方分配失败,请检查环境!");
return false;
}
/** /**
* 0 - 审核通过 * 0 - 审核通过
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.qg.qaplatform.dao.RuleEngineMapper">
<insert id="addBlackList">
INSERT INTO `black_list_config` (`uuid`, `expir_date`, `type`, `enable`,) VALUES (#{uuid}, '14', '0', '1');
</insert>
</mapper>
\ No newline at end of file
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