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

风控层-授信结果校验

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