Commit 14f71cb0 authored by liwenbin's avatar liwenbin

资方命中允许false条件

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