Commit 14f71cb0 authored by liwenbin's avatar liwenbin

资方命中允许false条件

parent c8da8a4e
......@@ -212,9 +212,6 @@ public class AssetServiceImpl implements IAssetService{
* @param assetForm
*/
public void hitFundIfUseFundModule(AssetForm assetForm, Map<String, Object> data) {
if ("false".equals(assetForm.getAuditResult())) {
return;
}
// 如果auditResult为true, amount或term有一个为空, 那就不管是否是测试,都不能使用资方模块了
if ("true".equals(assetForm.getAuditResult()) && (StringUtils.isEmpty(assetForm.getAmount()) || StringUtils.isEmpty(assetForm.getTerm()))) {
return;
......@@ -243,14 +240,25 @@ public class AssetServiceImpl implements IAssetService{
List<ChannelFundConfig> fundConfigList = JSONArray.parseArray(config.getFunds(), ChannelFundConfig.class);
A : for (ChannelFundConfig channelFundConfig : fundConfigList) {
List<ChannelFundConfig.Limit> limits = channelFundConfig.getLimits();
// 是否配了审核条件
boolean hasAuditResultLimit = false;
if (CollectionUtils.isNotEmpty(limits)) {
for (ChannelFundConfig.Limit limit : limits) {
String expression = limit.getLimit();
if (expression.contains("auditResult")) {
hasAuditResultLimit = true;
}
if (!ruleService.valid(expression, data)) {
continue A;
}
}
}
if (!hasAuditResultLimit) {
// 如果没配,自动过一层auditResult@true的条件
if (!ruleService.valid("audit_result==true", data)) {
continue A;
}
}
// 创建并增加资方配置
JSONObject fundInfoJSON = new JSONObject();
fundInfoJSON.put("fundId", channelFundConfig.getFundId());
......@@ -263,8 +271,13 @@ public class AssetServiceImpl implements IAssetService{
log.info("资方模块用户命中资方条件, uuid : {}, assetNo : {}, bizNo : {}, bizChannel : {}, fundId : {}, fundProductId : {}",
assetForm.getUuid(), assetForm.getAssetNo(), assetForm.getBizNo(), assetForm.getBizChannel(), channelFundConfig.getFundId(), channelFundConfig.getFundProductId());
}
// 如果fundArray为空,未命中任何一个资方
// 如果审核拒绝,也没命中任何资方, 直接返回
if ("false".equals(assetForm.getAuditResult()) && fundArray.size() == 0) {
return;
}
QGPreconditions.checkArgument(fundArray.size() != 0, QGExceptionType.NO_FUND_INFO_BEEN_HIT, assetForm.getBizChannel(), assetForm.getAmount(), assetForm.getTerm());
// 看命中优先级是否符合要求
boolean[] bucket = new boolean[fundArray.size() + 1];
for (int i = 0, len = fundArray.size(); i < len; i++) {
......
......@@ -1130,8 +1130,6 @@ public class Expression {
variables.put("e", CreateLazyNumber(e.toPlainString()));
variables.put("PI", CreateLazyNumber(PI.toPlainString()));
variables.put("NULL", null);
variables.put("TRUE", CreateLazyNumber(BigDecimal.ONE.toPlainString()));
variables.put("FALSE", CreateLazyNumber(BigDecimal.ZERO.toPlainString()));
}
private void assertNotNull(String v1) {
......@@ -1578,9 +1576,7 @@ public class Expression {
} else if (value.equalsIgnoreCase("null")) {
variables.put(variable, null);
} else if (value.equalsIgnoreCase("e") ||
value.equalsIgnoreCase("PI") ||
value.equalsIgnoreCase("TRUE")||
value.equalsIgnoreCase("FALSE")) {
value.equalsIgnoreCase("PI")) {
final String expStr = value;
variables.put(variable, new LazyNumber() {
private final Map<String, LazyNumber> outerVariables = variables;
......
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