Commit dbfb2a03 authored by 技术部-韩成龙's avatar 技术部-韩成龙

风控层-授信结果校验

parent 99b60a40
......@@ -9,7 +9,7 @@ import java.util.List;
public interface IChannelRuleRepository extends JpaRepository<ChannelRuleEntity, Long>, QueryDslPredicateExecutor<ChannelRuleEntity> {
ChannelRuleEntity getByFundProductIdEquals(long fundProductId);
List<ChannelRuleEntity> getByChannelIdOrderByPriority(long channelId);
List<ChannelRuleEntity> getByChannelIdAndCreditResultOrderByPriority(long channelId, Integer creditResult);
List<ChannelRuleEntity> getAllByEnableEquals(Boolean enable);
......@@ -19,5 +19,5 @@ public interface IChannelRuleRepository extends JpaRepository<ChannelRuleEntity,
void deleteAllByChannelIdEqualsAndEnableEquals(Long channelId,Boolean enable);
List<ChannelRuleEntity> getByChannelIdAndFundProductIdOrderByPriority(long channelId, long fundProductId);
List<ChannelRuleEntity> getByChannelIdAndFundProductIdAndCreditResultOrderByPriority(long channelId, long fundProductId, Integer creditResult);
}
......@@ -92,41 +92,44 @@ public class CoreFilter {
List<FinanceProduct> financeProducts = new ArrayList<>();
List<RoutingRecordVO> routingRecordList = new ArrayList<>();
UserAssociationBean associationBean = userCenterService.getUserAssociationBean(auditResponce.getUuid());
if (auditResponce.getAuditResult()) {
//白名单
WhiteListEntity whiteListEntity = whiteListRepository.getByPhoneEquals(associationBean.getPhoneNo());
if (whiteListEntity != null && whiteListEntity.getStatus().equals(Byte.valueOf("1"))) {
channelRuleEntityList = channelRuleRepository.getByChannelIdAndFundProductIdOrderByPriority(Long.parseLong(auditResponce.getBizChannel()), whiteListEntity.getFundProductId());
} else {
channelRuleEntityList = channelRuleRepository.getByChannelIdOrderByPriority(Long.parseLong(auditResponce.getBizChannel()));
}
if (CollectionUtils.isEmpty(channelRuleEntityList)) {
log.error("渠道配置产品集不存在,运营人员配置有问题, bizNo:{}", auditResponce.getBizNo());
} else {
for (ChannelRuleEntity channelRuleEntity : channelRuleEntityList) {
if (channelRuleEntity.getPublishStatus().equals(0)) {
continue;
}
FundProductEntity fundProduct = fundProductRepository.getByIdEquals(channelRuleEntity.getFundProductId());
log.info("coreHandle | 开始路由channelRuleEntity={}", channelRuleEntity.toString());
if (fundProduct == null) {
log.error("这种情况不可能出现,需要看下原因 {}", JSON.toJSONString(channelRuleEntity));
continue;
}
if (currentVerify(fundProduct, auditResponce, associationBean, channelRuleEntity)) {
log.info("coreHandle | 所有规则校验通过");
financeProducts.add(build(auditResponce, fundProduct, channelRuleEntity));
routingRecordList.add(generateRouteRecord(channelRuleEntity));
}
//白名单
WhiteListEntity whiteListEntity = whiteListRepository.getByPhoneEquals(associationBean.getPhoneNo());
if (whiteListEntity != null && whiteListEntity.getStatus().equals(Byte.valueOf("1"))) {
channelRuleEntityList = channelRuleRepository
.getByChannelIdAndFundProductIdAndCreditResultOrderByPriority(Long.parseLong(auditResponce.getBizChannel()),
whiteListEntity.getFundProductId(), auditResponce.getAuditResult() ? 1 : 0);
} else {
channelRuleEntityList = channelRuleRepository
.getByChannelIdAndCreditResultOrderByPriority(Long.parseLong(auditResponce.getBizChannel()),
auditResponce.getAuditResult() ? 1 : 0);
}
if (CollectionUtils.isEmpty(channelRuleEntityList)) {
log.error("渠道配置产品集不存在,运营人员配置有问题, bizNo:{}", auditResponce.getBizNo());
} else {
for (ChannelRuleEntity channelRuleEntity : channelRuleEntityList) {
if (channelRuleEntity.getPublishStatus().equals(0)) {
continue;
}
FundProductEntity fundProduct = fundProductRepository.getByIdEquals(channelRuleEntity.getFundProductId());
log.info("coreHandle | 开始路由channelRuleEntity={}", channelRuleEntity.toString());
if (fundProduct == null) {
log.error("这种情况不可能出现,需要看下原因 {}", JSON.toJSONString(channelRuleEntity));
continue;
}
if (currentVerify(fundProduct, auditResponce, associationBean, channelRuleEntity)) {
log.info("coreHandle | 所有规则校验通过");
financeProducts.add(build(auditResponce, fundProduct, channelRuleEntity));
routingRecordList.add(generateRouteRecord(channelRuleEntity));
}
}
if (CollectionUtils.isEmpty(financeProducts)) {
log.error("筛选完成后没有可用的配置, bizNo:{}", auditResponce.getBizNo());
auditResponce.setAuditResult(false);
} else {
result.setFinanceProducts(JSON.toJSONString(financeProducts));
}
}
if (CollectionUtils.isEmpty(financeProducts)) {
log.error("筛选完成后没有可用的配置, bizNo:{}", auditResponce.getBizNo());
auditResponce.setAuditResult(false);
} else {
result.setFinanceProducts(JSON.toJSONString(financeProducts));
auditResponce.setAuditResult(true);
}
log.info("coreHandle | 通知业务系统审核结果");
Map<String, String> response = httpService.postHasResponse(auditResponce.getCallbackUrl(), result.get(auditResponce));
if (MapUtils.isEmpty(response) || !(HttpStatus.OK.value() + "").equals(response.get("statusCode"))
......@@ -217,14 +220,15 @@ public class CoreFilter {
log.error("channelId不符");
return Boolean.FALSE;
}
//如果配置不为空,则匹配参数是否符合
if (StringUtils.isNotBlank(channelRuleEntity.getUserLevel())
&& !channelRuleEntity.getUserLevel().contains(auditResponce.getCreditLevel())) {
&& (StringUtils.isEmpty(auditResponce.getCreditLevel()) || !channelRuleEntity.getUserLevel().contains(auditResponce.getCreditLevel()))) {
log.error("CreditLevel不符 userLevel:{}", auditResponce.getCreditLevel());
return Boolean.FALSE;
}
if (StringUtils.isNotBlank(channelRuleEntity.getUserTag())
&& !channelRuleEntity.getUserTag().contains(auditResponce.getUserTag())) {
&& (StringUtils.isEmpty(auditResponce.getUserTag()) || !channelRuleEntity.getUserTag().contains(auditResponce.getUserTag()))) {
log.error("UserTag不符, userTag:{}", auditResponce.getUserTag());
return Boolean.FALSE;
}
......
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