/**读取规则文件,
@param 参数类型 字符串 参数名 script 说明 例:if("*".equals(app.getVhl().getCPlateNo())&&"0".equals(app.getVhl().getCNewMrk())){
for (com.isoftstone.pcis.policy.vo.AbstractCvrgVO cvrg : app.getCoverages()) {
if("030100".equals(cvrg.getCCvrgNo())){
return true;
}
}
}
return false;*/
public static Boolean readJavaRuleStr(PolicyApplication app,String script) throws BusinessServiceException{
try {
//初始化bsh对象
Interpreter interpreter = new Interpreter();
//设置业务数据
interpreter.set("app", app);
//获取脚本
//执行脚本
Object obj = interpreter.eval(script);
if(obj==null){//如果没有返回值,则设置为false
return false;
}
//脚本执行的结果(返回true|false)
return (Boolean) obj;
} catch (EvalError e) {
e.printStackTrace();
logger.error("读取规则异常结束");
throw new BusinessServiceException("返回规则时出错", e);
}
}
@param 参数类型 字符串 参数名 script 说明 例:if("*".equals(app.getVhl().getCPlateNo())&&"0".equals(app.getVhl().getCNewMrk())){
for (com.isoftstone.pcis.policy.vo.AbstractCvrgVO cvrg : app.getCoverages()) {
if("030100".equals(cvrg.getCCvrgNo())){
return true;
}
}
}
return false;*/
public static Boolean readJavaRuleStr(PolicyApplication app,String script) throws BusinessServiceException{
try {
//初始化bsh对象
Interpreter interpreter = new Interpreter();
//设置业务数据
interpreter.set("app", app);
//获取脚本
//执行脚本
Object obj = interpreter.eval(script);
if(obj==null){//如果没有返回值,则设置为false
return false;
}
//脚本执行的结果(返回true|false)
return (Boolean) obj;
} catch (EvalError e) {
e.printStackTrace();
logger.error("读取规则异常结束");
throw new BusinessServiceException("返回规则时出错", e);
}
}