流程图
条件流规则配置
1.选中线
2.编辑代码,代码根据下面不同的流程配置
3.右下角的保存按钮 没改一次都需要保存一次。
需要法务
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("standard","");
if ("0".equals(standard)) {
requestVO.setSuccess(true);
}
logger.info("判断是否需要法务-结果:{},参数:{}", standard, map);
end
不需要法务
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("standard", "");
if ("1".equals(standard)) {
requestVO.setSuccess(true);
}
logger.info("判断是否需要法务-结果:{},参数:{}", standard, map);
end
宁波
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("location","");
if (standard.equals("宁波")) {
requestVO.setSuccess(true);
}
logger.info("判断是宁波-结果:{},参数:{}", standard, map);
end
非宁波
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("location","");
if (!standard.equals("宁波")) {
requestVO.setSuccess(true);
}
logger.info("判断不是宁波-结果:{},参数:{}", standard, map);
end
仓储类
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("bizType","");
if ("1".equals(standard) || "2".equals(standard)) {
requestVO.setSuccess(true);
}
logger.info("判断是仓储类-结果:{},参数:{}", standard, map);
end
非仓储类
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
global org.slf4j.Logger logger
rule "condition"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
String standard = (String) map.getOrDefault("bizType","");
if (!("1".equals(standard) || "2".equals(standard))) {
requestVO.setSuccess(true);
}
logger.info("判断是非仓储类-结果:{},参数:{}", standard, map);
end
区域总监
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.98)) >= 0) {
requestVO.setSuccess(true);
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) > 0;
logger.info("(年涨幅-指导涨幅)>0.5%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhui = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhui)>=0;
logger.info("(年限>1 合同有效收入/合同面价收入)>=(11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(1))>=0;
logger.info("(年限<1 合同有效收入/合同面价收入)>=1:{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(0)) >= 0
&& period.compareTo(new BigDecimal(3)) <= 0;
logger.info("(合同年限 [0,3]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(true);
drools.halt();
}
logger.info("区域总监流程判断:false");
end
超过区域总监-next
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.98)) >= 0) {
requestVO.setSuccess(false);
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) > 0;
logger.info("(年涨幅-指导涨幅)>0.5%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,不判断");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhui = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhui)>=0;
logger.info("(年限>1 合同有效收入/合同面价收入)>=(11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(1))>=0;
logger.info("(年限<1 合同有效收入/合同面价收入)>=1:{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(0)) >= 0
&& period.compareTo(new BigDecimal(3)) <= 0;
logger.info("(合同年限 [0,3]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(false);
drools.halt();
}
logger.info("区域总监流程Next判断:true");
requestVO.setSuccess(true);
end
大区总监-end
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.97)) >= 0 && divide.compareTo(new BigDecimal(0.98)) < 0) {
requestVO.setSuccess(true);
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) > 0;
logger.info("(年涨幅-指导涨幅)>0.5%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhui = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhui)>=0;
logger.info("(年限>1 合同有效收入/合同面价收入)>=(11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(1))>=0;
logger.info("(年限<1 合同有效收入/合同面价收入)>=1:{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(0)) >= 0
&& period.compareTo(new BigDecimal(3)) <= 0;
logger.info("(合同年限 [0,3]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(true);
drools.halt();
}
logger.info("大区总监流程判断:false");
end
超过大区总监-next
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.97)) >= 0 && divide.compareTo(new BigDecimal(0.98)) < 0) {
requestVO.setSuccess(false);;
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount)>=98%:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) > 0;
logger.info("(年涨幅-指导涨幅)>0.5%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(false);;
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhui = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhui)>=0;
logger.info("(年限>1 合同有效收入/合同面价收入)>=(11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);;
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(1))>=0;
logger.info("(年限<1 合同有效收入/合同面价收入)>=1:{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);;
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(0)) >= 0
&& period.compareTo(new BigDecimal(3)) <= 0;
logger.info("(合同年限 [0,3]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(false);;
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(false);;
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(false);;
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(false);;
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(false);;
drools.halt();
}
logger.info("大区总监流程Next判断:false");
requestVO.setSuccess(true);;
end
公司商务分管领导-end
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.95)) >= 0 && divide.compareTo(new BigDecimal(0.97)) < 0) {
requestVO.setSuccess(true);
logger.info("指导价-(afterTaxMarketAmount/guidAmount) [95%,97%]:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount) [95%,97%]:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.01)) >= 0
&& yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) <= 0;
logger.info("(年涨幅-指导涨幅) [-1%,-0.5%]:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhuiMin = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
BigDecimal youhuiMax = new BigDecimal(9).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhuiMin)>=0 && value.compareTo(youhuiMax)<0;
logger.info("(年限>1 合同有效收入/合同面价收入)[9/12,11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(0))>0 && value.compareTo(new BigDecimal(1))<0;
logger.info("(年限<1 合同有效收入/合同面价收入) (0,1):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(3)) > 0
&& period.compareTo(new BigDecimal(5)) <= 0;
logger.info("(合同年限 (3,5]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(true);
drools.halt();
}
logger.info("公司商务分管领导流程判断:false");
end
公司商务分管领导-next
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0.95)) >= 0 && divide.compareTo(new BigDecimal(0.97)) < 0) {
requestVO.setSuccess(false);
logger.info("指导价-(afterTaxMarketAmount/guidAmount) [95%,97%]:{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount) [95%,97%]:{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.01)) >= 0
&& yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.005)) <= 0;
logger.info("(年涨幅-指导涨幅) [-1%,-0.5%]:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhuiMin = new BigDecimal(11).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
BigDecimal youhuiMax = new BigDecimal(9).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhuiMin)>=0 && value.compareTo(youhuiMax)<0;
logger.info("(年限>1 合同有效收入/合同面价收入)[9/12,11/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
} else if (period.compareTo(new BigDecimal(1))<0) {
flag = value.compareTo(new BigDecimal(0))>0 && value.compareTo(new BigDecimal(1))<0;
logger.info("(年限<1 合同有效收入/合同面价收入) (0,1):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(3)) > 0
&& period.compareTo(new BigDecimal(5)) <= 0;
logger.info("(合同年限 (3,5]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null && monthDeposit.compareTo(new BigDecimal(2)) >= 0;
logger.info("履约保证金>=2:{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 不带中介
Boolean guize6 = existAgency != null && !existAgency;
logger.info("不带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 不带保函
Boolean guize7 = existLetter != null && !existLetter;
logger.info("不带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(false);
drools.halt();
}
logger.info("公司商务分管领导-next:true");
requestVO.setSuccess(true);
end
公司总经理-end
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
salience 8
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0)) > 0 && divide.compareTo(new BigDecimal(0.95)) < 0) {
requestVO.setSuccess(true);
logger.info("指导价-(afterTaxMarketAmount/guidAmount) (0,95%):{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount) (0,95%):{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
salience 7
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.01)) < 0;
logger.info("(年涨幅-指导涨幅) <-1%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
salience 6
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhuiMin = new BigDecimal(7).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
BigDecimal youhuiMax = new BigDecimal(9).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhuiMin)>=0 && value.compareTo(youhuiMax)<0;
logger.info("(年限>1 合同有效收入/合同面价收入)[7/12,9/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
salience 5
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(5)) > 0
&& period.compareTo(new BigDecimal(10)) <= 0;
logger.info("(合同年限 (5,10]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(true);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
salience 4
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null
&& monthDeposit.compareTo(new BigDecimal(0)) > 0
&& monthDeposit.compareTo(new BigDecimal(2)) < 0;
logger.info("履约保证金 (0,2):{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
salience 3
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 带中介
Boolean guize6 = existAgency != null && existAgency;
logger.info("带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则7 保函
rule "baohan"
salience 2
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 带保函
Boolean guize7 = existLetter != null && existLetter;
logger.info("带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(true);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience 1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(true);
drools.halt();
}
logger.info("公司总经理流程判断:false");
end
公司总经理-next
import cn.flyrise.common.rules.vo.process.ConditionRequestVO
import java.util.Date
import java.util.Map;
import cn.flyrise.common.core.utils.DateUtils
import cn.flyrise.pai.rules.blogis.BusinessContractDto
import cn.hutool.core.convert.Convert
import java.math.BigDecimal
global org.slf4j.Logger logger
//指导价 合同不含税面价总收入/合同指导总收入
rule "zhidaojia"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
logger.info("判断区域总监是否结束-参数:{}", map);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal afterTaxMarketAmount = businessContractDto.getAfterTaxMarketAmount();
BigDecimal guidAmount = businessContractDto.getGuidAmount();
BigDecimal zero = new BigDecimal(0);
//判断指导价
if (afterTaxMarketAmount != null
&& afterTaxMarketAmount.compareTo(zero) > 0
&& guidAmount != null
&& guidAmount.compareTo(zero) > 0) {
BigDecimal divide = afterTaxMarketAmount.divide(guidAmount).setScale(4);
if (divide.compareTo(new BigDecimal(0)) > 0 && divide.compareTo(new BigDecimal(0.95)) < 0) {
requestVO.setSuccess(false);
logger.info("指导价-(afterTaxMarketAmount/guidAmount) (0,95%):{},{}", true, divide);
drools.halt();
} else {
logger.info("指导价-(afterTaxMarketAmount/guidAmount) (0,95%):{}", false);
}
} else {
logger.info("指导价-结果:{},msg:{}", false, "guidAmount、afterTaxMarketAmount数据为空");
}
end
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
rule "nianzhangfu"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
//规则2 判断年涨幅,大于1才判断 年涨幅-指导涨幅
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal yearIncrease = businessContractDto.getYearIncrease();
BigDecimal guidIncrease = businessContractDto.getGuidIncrease();
if (period != null && period.compareTo(new BigDecimal(1)) >= 0) {
//年涨幅-指导涨幅
if (yearIncrease != null && guidIncrease != null) {
Boolean guize2 = yearIncrease.subtract(guidIncrease).compareTo(new BigDecimal(-0.01)) < 0;
logger.info("(年涨幅-指导涨幅) <-1%:{},{}", guize2, yearIncrease.subtract(guidIncrease));
if (guize2) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else {
logger.info("合同年限为空<1,false");
}
end
//规则3 优惠期【合同有效收入/合同面价收入】
rule "youhuiqi"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BigDecimal zero = new BigDecimal(0);
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
BigDecimal receivableAmount = businessContractDto.getReceivableAmount();
BigDecimal marketAmount = businessContractDto.getMarketAmount();
boolean zhangfuBool = receivableAmount != null
&& receivableAmount.compareTo(zero) > 0
&& marketAmount != null
&& marketAmount.compareTo(zero) > 0;
if (period != null) {
if (zhangfuBool) {
//规则3 优惠期 年限>=1 合同有效收入/合同面价收入>=(11/12)
BigDecimal value = receivableAmount.divide(marketAmount, 4, BigDecimal.ROUND_HALF_UP);
Boolean flag = false;
if(period.compareTo(new BigDecimal(1))>=0){
BigDecimal youhuiMin = new BigDecimal(7).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
BigDecimal youhuiMax = new BigDecimal(9).divide(new BigDecimal(12), 4, BigDecimal.ROUND_HALF_UP);
flag = value.compareTo(youhuiMin)>=0 && value.compareTo(youhuiMax)<0;
logger.info("(年限>1 合同有效收入/合同面价收入)[7/12,9/12):{},{}", flag, value);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
} else{
logger.info("(合同有效收入/合同面价收入) 为空");
}
}
end
//规则4 合同年限
rule "hetongnianxian"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal period = businessContractDto.getPeriod();
//规则4 合同年限 [0,3]
if (period != null) {
Boolean flag = period.compareTo(new BigDecimal(5)) > 0
&& period.compareTo(new BigDecimal(10)) <= 0;
logger.info("(合同年限 (5,10]):{},{}", flag, period);
if (flag) {
requestVO.setSuccess(false);
drools.halt();
}
}
end
//规则5 履约保证金等于月保证金
rule "lvyue"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null && !getSuccess())
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal monthDeposit = businessContractDto.getMonthDeposit();
Boolean guize5 = monthDeposit != null
&& monthDeposit.compareTo(new BigDecimal(0)) > 0
&& monthDeposit.compareTo(new BigDecimal(2)) < 0;
logger.info("履约保证金 (0,2):{},{}", guize5, monthDeposit);
if (guize5) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则6 中介
rule "zhongjie"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existAgency = businessContractDto.getExistAgency();
//规则6 带中介
Boolean guize6 = existAgency != null && existAgency;
logger.info("带中介:{},{}", guize6, existAgency);
if (guize6) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则7 保函
rule "baohan"
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
Boolean existLetter = businessContractDto.getExistLetter();
//规则7 带保函
Boolean guize7 = existLetter != null && existLetter;
logger.info("带保函:{},{}", guize7, existLetter);
if (guize7) {
requestVO.setSuccess(false);
drools.halt();
}
end
//规则8 合同金额 < 1亿
rule "hetongjin"
salience -1
no-loop true
lock-on-active true
when
requestVO: ConditionRequestVO(getBusinessMap() != null)
then
Map<String, Object> map = requestVO.getBusinessMap();
BusinessContractDto businessContractDto = Convert.convert(BusinessContractDto.class, map);
BigDecimal totalAmount = businessContractDto.getTotalAmount();
//规则8 合同金额 < 1亿
Boolean guize8 = totalAmount != null && totalAmount.compareTo(new BigDecimal(100000000)) <= 0;
logger.info("合同金额 [0,1亿]:{},合同金额:{}", guize8, totalAmount);
if (guize8) {
requestVO.setSuccess(false);
drools.halt();
}
logger.info("公司总经理流程判断:true");
requestVO.setSuccess(true);
end
文档更新时间: 2022-10-27 11:40 作者:朱灿奕