Commit 7acede24 authored by suntao's avatar suntao

放款二次风控 操作

parent 966a23f3
Pipeline #32 failed with stages
......@@ -25,6 +25,7 @@ import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingReposito
import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService;
import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenterService;
import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter;
import cn.quantgroup.cashloanflowboss.spi.user.service.UserSysService;
import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.Contract;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.FundLending;
......@@ -94,14 +95,14 @@ public class OrderService {
@Value("${debug.model}")
private Boolean debugModel;
@Autowired
private ClfOrderMappingRepository clfOrderMappingRepository;
@Value("${debug.model}")
private Boolean debugModel;
public Page<OrderVo> orderList(Long channelId, String channelOrderNo, String applyNo, Long loanId, Integer pageNumber, Integer pageSize) {
......@@ -180,6 +181,8 @@ public class OrderService {
*/
public Tuple<Boolean, Boolean> approveOpt(ApproveVo approveVo) {
log.info("approveOpt,审批操作入参,approveVo={}", JSONTools.serialize(approveVo));
if (StringUtils.isEmpty(approveVo.getAmount())) {
// 如果UI 金额为空 默认4000
approveVo.setAmount("4000");
......@@ -256,6 +259,7 @@ public class OrderService {
data.put("financeProducts", fundFormat);
// 发起审批
log.info("[approveOpt] 向clotho发起审批,data={}", JSONTools.serialize(data));
String approveStringResult = clothoCenterService.approve(data);
Boolean corpPolicyValidate = false;
try {
......@@ -328,7 +332,7 @@ public class OrderService {
optHistoryLog.setCreateTime(new Date());
// 更新待放款时间
// 更新待放款时间(5分钟之前)
FundLending fundLending = xyqbCenterService.findFundLendingByLoanId(orderMapping.getLoanId());
if (fundLending != null) {
LocalDateTime localDateTime = LocalDateTime.now();
......@@ -337,6 +341,36 @@ public class OrderService {
xyqbCenterService.saveFundLending(fundLending);
}
// 二次风控回调
XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId());
if (xUser == null) {
log.info("[order_lending]二次风控失败,未找到user channelOrderNumber={}", lendingFormModel.getChannelOrderNumber());
optHistoryLog.setOptLogDetail("放款操作失败,二次风控失败,未找到user");
optHistoryLog.setOptResult(false);
optHistoryLogService.save(optHistoryLog);
return false;
}
ChannelConf channelConf = channelConfRepository.getByChannelId(lendingFormModel.getChannelId());
if (channelConf == null) {
log.info("[order_lending]二次风控失败,未找到channelConf配置 channelOrderNumber={}", lendingFormModel.getChannelOrderNumber());
optHistoryLog.setOptLogDetail("放款操作失败,二次风控失败,未找到channelConf配置");
optHistoryLog.setOptResult(false);
optHistoryLogService.save(optHistoryLog);
return false;
}
Boolean auditNotify = clothoCenterService.orderAuditNotify(xUser.getUuid(), orderMapping.getLoanId(), true, channelConf.getBizType());
if (auditNotify) {
log.info("[order_lending]放款操作,二次风控成功,继续,channelOrderNumber={}, result={}", lendingFormModel.getChannelOrderNumber(), result);
} else {
log.info("[order_lending]二次风控失败,二次风控失败,clotho返回失败 channelOrderNumber={}", lendingFormModel.getChannelOrderNumber());
optHistoryLog.setOptLogDetail("放款操作失败,二次风控失败,clotho返回失败");
optHistoryLog.setOptResult(false);
optHistoryLogService.save(optHistoryLog);
return false;
}
if (orderApprove.getFundType() == 0) {
// 如果是非存管
result = this.xyqbCenterService.payResultNotify(orderMapping.getLoanId(), lendingFormModel.getResult());
......
......@@ -22,6 +22,9 @@ public interface ClothoCenter {
@PostMapping(value = "/external/quota/auth_amount_audit/notify", consumes = "application/x-www-form-urlencoded")
String approve(@RequestParam Map approveData);
@PostMapping(value = "/external/quota/order_audit/notify", consumes = "application/x-www-form-urlencoded")
String orderAuditNotify(@RequestParam Map notify);
/**
* 生成放款MQ消息
*
......@@ -66,6 +69,11 @@ public interface ClothoCenter {
return "error1";
}
@Override
public String orderAuditNotify(Map notify) {
return null;
}
@Override
public String generatorLendingMessage(Map data) {
throw new ClothoCenterException();
......
......@@ -26,6 +26,22 @@ public class ClothoCenterService {
@Value("${debug.model}")
public Boolean debugModel;
public Boolean orderAuditNotify(String uuid, Long loanId, boolean auditResult, int bizType) {
Map notify = new HashMap();
notify.put("code", 0);
notify.put("msg", "success");
notify.put("bizChannel", 1);
notify.put("uuid", uuid);
notify.put("bizNo", loanId);
notify.put("bizType", bizType);
notify.put("auditResult", auditResult);
return "success".equals(clothoCenter.orderAuditNotify(notify));
}
/**
* 生成放款MQ消息
*
......
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