86 changed files with 23254 additions and 21308 deletions
@ -0,0 +1,3 @@ |
|||||
|
2025-01-03: |
||||
|
1. 替换 mysql 驱动,支持 mysql-5,以便默认支持 TDSQL |
||||
|
2. 修复部分 bug |
Binary file not shown.
@ -1,18 +1,18 @@ |
|||||
[ |
[ |
||||
{ |
{ |
||||
"name" : "parseCompanyCreditReport", |
"name" : "parseCompanyCreditReport", |
||||
"signature" : "parseCompanyCreditReport(xml)", |
"signature" : "UDF.parseCompanyCreditReport(xml)", |
||||
"description" : "将 xml 解析成征信报告对象(企业)", |
"description" : "将 xml 解析成征信报告对象(企业)", |
||||
"enable" : true, |
"enable" : true, |
||||
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>parseCompanyCreditReport</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>xml</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>UDF.parseCompanyCreditReport</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>xml</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
||||
"body" : "def parseCompanyCreditReport(String xml){\n return io.sc.creditreport.core.CreditReportParser.parseCompanyCreditReport(xml);\n}" |
"body" : "def static parseCompanyCreditReport(String xml){\n return io.sc.creditreport.core.CreditReportParser.parseCompanyCreditReport(xml);\n}" |
||||
}, |
}, |
||||
{ |
{ |
||||
"name" : "parsePersonCreditReport", |
"name" : "parsePersonCreditReport", |
||||
"signature" : "parsePersonCreditReport(xml)", |
"signature" : "UDF.parsePersonCreditReport(xml)", |
||||
"description" : "将 xml 解析成征信报告对象(个人)", |
"description" : "将 xml 解析成征信报告对象(个人)", |
||||
"enable" : true, |
"enable" : true, |
||||
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>parsePersonCreditReport</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>xml</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>UDF.parsePersonCreditReport</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>xml</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
||||
"body" : "def parsePersonCreditReport(String xml){\n return io.sc.creditreport.core.CreditReportParser.parsePersonCreditReport(xml);\n}" |
"body" : "def static parsePersonCreditReport(String xml){\n return io.sc.creditreport.core.CreditReportParser.parsePersonCreditReport(xml);\n}" |
||||
} |
} |
||||
] |
] |
@ -0,0 +1,49 @@ |
|||||
|
#define renderArgument(model) |
||||
|
@JsonIgnoreProperties(ignoreUnknown=true) |
||||
|
class Argument { |
||||
|
#(tabs(ParameterGenerator.generateFields(model.getAllParameters()),1)) |
||||
|
|
||||
|
public static Argument convertArgument(Map<String,Object> map){ |
||||
|
if(map!=null){ |
||||
|
Argument arg =new Argument(); |
||||
|
#(tabs(ParameterGenerator.generateConvertorFromMap(model.getAllParameters()),3)) |
||||
|
return arg; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public static Argument convertArgument(String json){ |
||||
|
if(json!=null && !"".equals(json.trim())){ |
||||
|
Argument arg =ObjectMapperUtil.json().readValue(json, Argument.class); |
||||
|
#(tabs(ParameterGenerator.generateConvertorFromJson(model.getAllParameters()),3)) |
||||
|
return arg; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void validate(ValidateResult result) { |
||||
|
#(tabs(ParameterGenerator.generateValidator(model.getAllParameters()),2)) |
||||
|
} |
||||
|
|
||||
|
public void mergeParameterValueFromIndicatorLib(Map<String,Object> libs){ |
||||
|
#(tabs(ParameterGenerator.generateMergeParameterValueFromIndicatorLib(model.getAllParameters()),2)) |
||||
|
} |
||||
|
|
||||
|
public ResourceResult toResult(){ |
||||
|
ResourceResult result =new ResourceResult(); |
||||
|
#(tabs(ParameterGenerator.generateToResult(model.getAllParameters()),2)) |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public Map<String,Object> toMap(){ |
||||
|
Map<String,Object> map =new HashMap<String,Object>(); |
||||
|
#(tabs(ParameterGenerator.generateToMap(model.getAllParameters()),2)) |
||||
|
return map; |
||||
|
} |
||||
|
|
||||
|
public void mergeResult(ResourceResult result){ |
||||
|
if(result!=null){ |
||||
|
#(tabs(ParameterGenerator.generateMergeResult(model.getAllParameters()),3)) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
#end |
@ -0,0 +1,13 @@ |
|||||
|
#define renderDictionary(dictionary) |
||||
|
/** |
||||
|
* #(dictionary.name) |
||||
|
*/ |
||||
|
@JsonIgnoreProperties(ignoreUnknown=true) |
||||
|
class #(className(dictionary.code,dictionary.version)) { |
||||
|
#(tabs(DictionaryGenerator.generateFields(dictionary.getFields()),1)) |
||||
|
|
||||
|
public void init(){ |
||||
|
#(tabs(DictionaryGenerator.generateInits(dictionary.getFields()),2)) |
||||
|
} |
||||
|
} |
||||
|
#end |
@ -0,0 +1,7 @@ |
|||||
|
#define renderFunction(function) |
||||
|
|
||||
|
/** |
||||
|
* #(function.description) |
||||
|
*/ |
||||
|
#(tabs(function.body,1)) |
||||
|
#end |
@ -0,0 +1,173 @@ |
|||||
|
#set(dictionaries =executeUnit.dictionaries) |
||||
|
#set(lib =executeUnit.lib) |
||||
|
|
||||
|
####################################### |
||||
|
### 模版函数 |
||||
|
####################################### |
||||
|
#include("/io/sc/engine/rule/core/code/template/package_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/import_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/functions_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/dictionary_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/lib_render.tpl") |
||||
|
|
||||
|
#@renderPackage(packageName) |
||||
|
|
||||
|
#@renderImport() |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 自定义函数 |
||||
|
//****************************************************************************** |
||||
|
class UDF { |
||||
|
#for(function : executeUnit.functions) |
||||
|
#@renderFunction(function) |
||||
|
#end |
||||
|
} |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 执行主体类 |
||||
|
//****************************************************************************** |
||||
|
/** |
||||
|
* type: #(executeUnit.type) |
||||
|
* code: #(lib.code), |
||||
|
* name: #(lib.name), |
||||
|
* version: #(lib.version) |
||||
|
*/ |
||||
|
class #(className(lib.code,lib.version)) { |
||||
|
private static final Logger log =LoggerFactory.getLogger(#(className(lib.code,lib.version)).class); |
||||
|
|
||||
|
/** |
||||
|
* 执行方法(Map作为输入参数,该 Map 封装了调用模型的参数) |
||||
|
* @param map 输入参数封装器 |
||||
|
* @return 执行结果 |
||||
|
*/ |
||||
|
public static ResourceResult execute(Map<String,Object> map) throws Exception { |
||||
|
return execute(map["executor"],map["subModelCode"],map["argument"]); |
||||
|
} |
||||
|
|
||||
|
public static ResourceResult execute(Executor executor,String subModelCode,Object data) throws Exception { |
||||
|
if(log.isDebugEnabled()){log.debug("开始执行指标库 : #(className(lib.code,lib.version))");} |
||||
|
if(data instanceof Map){ |
||||
|
if(log.isDebugEnabled()){log.debug("显示输入参数(Map)=================================================\n{}",ObjectMapperUtil.json().writeValueAsString(data));} |
||||
|
}else if(data instanceof String){ |
||||
|
if(log.isDebugEnabled()){log.debug("显示输入参数(Json字符串)=================================================\n{}",data);} |
||||
|
} |
||||
|
if(log.isDebugEnabled()){log.debug("初始化指标库参数");} |
||||
|
Argument arg =Argument.convertArgument(data); |
||||
|
|
||||
|
if(log.isDebugEnabled()){log.debug("开始检查指标库输入参数数据合法性");} |
||||
|
ValidateResult validateResult =new ValidateResult(); |
||||
|
arg.validate(validateResult); |
||||
|
if(validateResult.hasError()){ |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 失败!");} |
||||
|
ResourceResult result =new ResourceResult(); |
||||
|
result.setValidateResult(validateResult); |
||||
|
return result; |
||||
|
} |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 成功!");} |
||||
|
|
||||
|
#for(indicator : lib.indicators) |
||||
|
#if("INDICATOR"==indicator.type.toString()) |
||||
|
#(methodName(indicator.code))(executor,arg);//#(indicator.name),#(indicator.type) |
||||
|
#end |
||||
|
#end |
||||
|
|
||||
|
//返回结果 |
||||
|
ResourceResult result =arg.toResult(); |
||||
|
if(log.isDebugEnabled()){log.debug("指标库调用成功,返回结果:\n{}",ObjectMapperUtil.json().writeValueAsString(result));} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
#for(indicator : lib.indicators) |
||||
|
#if("INDICATOR"==indicator.type.toString()) |
||||
|
#set(parameter=indicator) |
||||
|
|
||||
|
public static void #(methodName(indicator.code))(Executor executor,Argument arg) { |
||||
|
#for(processor : indicator.processors) |
||||
|
if(log.isDebugEnabled()){log.debug(" {}","#(parameter.name)(#(parameter.type))");} |
||||
|
#switch (processor.type.toString()) |
||||
|
#case ("ARITHMETIC") |
||||
|
//算数运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/arithmetic.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 算数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("CONDITION_RANGE") |
||||
|
//条件分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/conditionRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 条件分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("GROOVY_SCRIPT") |
||||
|
//Groovy 脚本 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/groovy_script.tpl") |
||||
|
#case ("HTTP_REQUEST") |
||||
|
//Http 请求 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/http_request.tpl") |
||||
|
#case ("MATH_FORMULA") |
||||
|
//数学公式 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/math_formula.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数学公式运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("NUMBER_RANGE") |
||||
|
//数值分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/numberRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数值分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("OBJECT_PROPERTIES") |
||||
|
//对象属性赋值函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/object_properties.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 对象属性函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("SQL") |
||||
|
//SQL 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/sql.tpl") |
||||
|
#case ("TERNARY") |
||||
|
//三元运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/ternary.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 三元运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("WHEN_THEN") |
||||
|
//WhenThen 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/when_then.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" WhenThen 运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
|
||||
|
@JsonIgnoreProperties(ignoreUnknown=true) |
||||
|
class Argument { |
||||
|
#(tabs(IndicatorGenerator.generateFields(lib.indicators),1)) |
||||
|
public static Argument convertArgument(Map<String,Object> map){ |
||||
|
if(map!=null){ |
||||
|
Argument arg =new Argument(); |
||||
|
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators,"arg"),3)) |
||||
|
return arg; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public static Argument convertArgument(String json){ |
||||
|
if(json!=null && !"".equals(json.trim())){ |
||||
|
Argument arg =ObjectMapperUtil.json().readValue(json, Argument.class); |
||||
|
#(tabs(IndicatorGenerator.generateConvertorFromJson(lib.indicators),3)) |
||||
|
return arg; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void validate(ValidateResult result) { |
||||
|
#(tabs(IndicatorGenerator.generateValidator(lib.indicators),2)) |
||||
|
} |
||||
|
|
||||
|
public ResourceResult toResult(){ |
||||
|
ResourceResult result =new ResourceResult(); |
||||
|
#(tabs(IndicatorGenerator.generateToResult(lib.indicators),2)) |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 元数据定义类 |
||||
|
//****************************************************************************** |
||||
|
#for(dictionary : dictionaries) |
||||
|
#@renderDictionary(dictionary) |
||||
|
#end |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 执行并返回结果 |
||||
|
//****************************************************************************** |
||||
|
#(className(lib.code,lib.version)).execute(INPUT_PARAMETER); |
@ -0,0 +1,160 @@ |
|||||
|
#set(resource = executeUnit.resource) |
||||
|
#set(dictionaries =executeUnit.dictionaries) |
||||
|
#set(libs =executeUnit.libs) |
||||
|
#set(model = resource.model) |
||||
|
|
||||
|
####################################### |
||||
|
### 模版函数 |
||||
|
####################################### |
||||
|
#include("/io/sc/engine/rule/core/code/template/package_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/import_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/functions_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/parameter_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/model_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/argument_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/dictionary_render.tpl") |
||||
|
#include("/io/sc/engine/rule/core/code/template/lib_render.tpl") |
||||
|
|
||||
|
#@renderPackage(packageName) |
||||
|
|
||||
|
#@renderImport() |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 自定义函数 |
||||
|
//****************************************************************************** |
||||
|
class UDF { |
||||
|
#for(function : executeUnit.functions) |
||||
|
#@renderFunction(function) |
||||
|
#end |
||||
|
} |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 执行主体类 |
||||
|
//****************************************************************************** |
||||
|
/** |
||||
|
* type: #(executeUnit.type) |
||||
|
* code: #(resource.code), |
||||
|
* name: #(resource.name), |
||||
|
* version: #(resource.version) |
||||
|
*/ |
||||
|
class #(className(resource.code,resource.version)) { |
||||
|
private static final Logger log =LoggerFactory.getLogger(#(className(resource.code,resource.version)).class); |
||||
|
|
||||
|
/** |
||||
|
* 执行方法(Map作为输入参数,该 Map 封装了调用模型的参数) |
||||
|
* @param map 输入参数封装器 |
||||
|
* @return 执行结果 |
||||
|
*/ |
||||
|
public static ResourceResult execute(Map<String,Object> map) throws Exception{ |
||||
|
return execute(map["executor"],map["subModelCode"],map["argument"]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 执行方法 |
||||
|
* @param executor 执行器对象 |
||||
|
* @param subModelCode 子模型代码 |
||||
|
* @param data 输入参数 |
||||
|
* @return 执行结果 |
||||
|
*/ |
||||
|
public static ResourceResult execute(Executor executor,String subModelCode,Object data) throws Exception{ |
||||
|
if(log.isDebugEnabled()){log.debug("开始执行: #(resource.name)");} |
||||
|
if(data instanceof Map){ |
||||
|
if(log.isDebugEnabled()){log.debug("显示输入参数(Map)=================================================\n{}",ObjectMapperUtil.json().writeValueAsString(data));} |
||||
|
}else if(data instanceof String){ |
||||
|
if(log.isDebugEnabled()){log.debug("显示输入参数(Json字符串)=================================================\n{}",data);} |
||||
|
} |
||||
|
|
||||
|
//初始化指标库 |
||||
|
#for(lib : libs) |
||||
|
if(log.isDebugEnabled()){log.debug("初始化指标库 : #(lib.name)_V#(lib.version)");} |
||||
|
|
||||
|
#(className(lib.code,lib.version)) #(varName(lib.code,lib.version)) =new #(className(lib.code,lib.version))(); |
||||
|
#(varName(lib.code,lib.version)).convertArgument(data); |
||||
|
#end |
||||
|
|
||||
|
//初始化模型参数 |
||||
|
if(log.isDebugEnabled()){log.debug("从 {} 初始化模型参数",String.class==data.class?"Json":"Map");} |
||||
|
Argument arg =Argument.convertArgument(data); |
||||
|
|
||||
|
//输入参数合法性检查 |
||||
|
ValidateResult validateResult =new ValidateResult(); |
||||
|
|
||||
|
//输入参数合法性检查(指标库) |
||||
|
#for(lib : libs) |
||||
|
if(log.isDebugEnabled()){log.debug("开始检查输入参数数据合法性(指标库: #(lib.name)_V#(lib.version))");} |
||||
|
#(varName(lib.code,lib.version)).validate(validateResult); |
||||
|
if(validateResult.hasError()){ |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 失败!");} |
||||
|
ResourceResult result =new ResourceResult(); |
||||
|
result.setValidateResult(validateResult); |
||||
|
return result; |
||||
|
} |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 成功!");} |
||||
|
#end |
||||
|
|
||||
|
//输入参数合法性检查(模型) |
||||
|
if(log.isDebugEnabled()){log.debug("开始检查模型输入参数数据合法性");} |
||||
|
arg.validate(validateResult); |
||||
|
if(validateResult.hasError()){ |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 失败!");} |
||||
|
ResourceResult result =new ResourceResult(); |
||||
|
result.setValidateResult(validateResult); |
||||
|
return result; |
||||
|
} |
||||
|
if(log.isDebugEnabled()){log.debug("\t检查结果: 成功!");} |
||||
|
|
||||
|
//执行指标库 |
||||
|
#for(lib : executeUnit.getLibs()) |
||||
|
if(log.isDebugEnabled()){log.debug("开始执行指标库: #(lib.name)_V#(lib.version)");} |
||||
|
#(varName(lib.code,lib.version)).execute(); |
||||
|
#end |
||||
|
|
||||
|
//合并指标库指标 |
||||
|
if(log.isDebugEnabled()){log.debug("开始合并指标库指标");} |
||||
|
Map<String,Object> indicatorLibs =new HashMap<String,Object>(); |
||||
|
#for(lib : executeUnit.getLibs()) |
||||
|
indicatorLibs.put("#(varName(lib.code,lib.version))",#(varName(lib.code,lib.version))); |
||||
|
#end |
||||
|
arg.mergeParameterValueFromIndicatorLib(indicatorLibs); |
||||
|
if(log.isDebugEnabled()){log.debug("显示合并后输入参数:\n{}",ObjectMapperUtil.json().writeValueAsString(arg));} |
||||
|
|
||||
|
//执行模型 |
||||
|
if(subModelCode){ |
||||
|
subModelCode =IdReplacer.methodName(subModelCode); |
||||
|
"${subModelCode}"(executor,arg);//调用子模型 |
||||
|
}else{ |
||||
|
#(methodName(model.code))(executor,arg);//调用顶级模型(#(model.name)) |
||||
|
} |
||||
|
|
||||
|
//返回结果 |
||||
|
ResourceResult result =arg.toResult(); |
||||
|
if(log.isDebugEnabled()){log.debug("模型调用成功,返回结果:\n{}",ObjectMapperUtil.json().writeValueAsString(result));} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
#@renderModel(model) |
||||
|
} |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 模型参数定义类 |
||||
|
//****************************************************************************** |
||||
|
#@renderArgument(model) |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 元数据定义类 |
||||
|
//****************************************************************************** |
||||
|
#for(dictionary : dictionaries) |
||||
|
#@renderDictionary(dictionary) |
||||
|
#end |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 指标库定义类 |
||||
|
//****************************************************************************** |
||||
|
#for(lib : libs ) |
||||
|
#@renderLib(lib) |
||||
|
#end |
||||
|
|
||||
|
//****************************************************************************** |
||||
|
// 执行并返回结果 |
||||
|
//****************************************************************************** |
||||
|
#(className(resource.code,resource.version)).execute(INPUT_PARAMETER); |
@ -0,0 +1,97 @@ |
|||||
|
#define renderImport() |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
|
import com.fasterxml.jackson.core.type.TypeReference; |
||||
|
import groovy.transform.Canonical; |
||||
|
import io.sc.engine.rule.client.Executor; |
||||
|
import io.sc.engine.rule.core.ResourceAbstract; |
||||
|
import io.sc.engine.rule.core.RuleSetResult; |
||||
|
import io.sc.engine.rule.core.SingleRuleResult; |
||||
|
import io.sc.engine.rule.core.FieldValidator; |
||||
|
import io.sc.engine.rule.core.ParameterResult; |
||||
|
import io.sc.engine.rule.core.ResourceResult; |
||||
|
import io.sc.engine.rule.core.ValidateResult; |
||||
|
import io.sc.engine.rule.core.enums.ParameterType; |
||||
|
import io.sc.engine.rule.core.enums.RuntimeInputParameterType; |
||||
|
import io.sc.engine.rule.core.function.JpmmlEvaluator; |
||||
|
import io.sc.engine.rule.core.util.IdReplacer; |
||||
|
import io.sc.engine.rule.core.util.ESql; |
||||
|
import io.sc.platform.util.DateUtil; |
||||
|
import io.sc.platform.util.ObjectMapperUtil; |
||||
|
import io.sc.platform.util.StringUtil; |
||||
|
import io.sc.platform.util.TypeConvertor; |
||||
|
import java.math.*; |
||||
|
import java.util.Map; |
||||
|
import java.util.Random; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.div; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.lg; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.ln; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.log; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.max; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.min; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.mod; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.randomInt; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.root; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.sum; |
||||
|
import static io.sc.engine.rule.core.function.ArithmeticFunction.transformSequencing; |
||||
|
import static io.sc.engine.rule.core.function.DateFunction.now; |
||||
|
import static io.sc.engine.rule.core.function.DateFunction.yyyyMMdd; |
||||
|
import static io.sc.engine.rule.core.function.DateFunction.yyyy_MM_dd; |
||||
|
import static io.sc.engine.rule.core.function.NormalDistributionFunction.G; |
||||
|
import static io.sc.engine.rule.core.function.NormalDistributionFunction.iG; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.infinite; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.isInfinite; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.isNan; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.isNil; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.isZero; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.nan; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.nil; |
||||
|
import static io.sc.engine.rule.core.function.SpecialValueFunction.zero; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.contains; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.endsWith; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.join; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.length; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.lowerCase; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.startsWith; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.trim; |
||||
|
import static io.sc.engine.rule.core.function.StringFunction.upperCase; |
||||
|
import static io.sc.platform.util.CollectionUtil.hasElements; |
||||
|
import static io.sc.platform.util.DateUtil.yearsBetween; |
||||
|
import static io.sc.platform.util.DateUtil.monthsBetween; |
||||
|
import static io.sc.platform.util.DateUtil.weeksBetween; |
||||
|
import static io.sc.platform.util.DateUtil.daysBetween; |
||||
|
import static io.sc.platform.util.DateUtil.hoursBetween; |
||||
|
import static io.sc.platform.util.DateUtil.minutesBetween; |
||||
|
import static io.sc.platform.util.DateUtil.secondsBetween; |
||||
|
import static io.sc.platform.util.NumberUtil.comma; |
||||
|
import static io.sc.platform.util.NumberUtil.decimal; |
||||
|
import static io.sc.platform.util.NumberUtil.money; |
||||
|
import static io.sc.platform.util.NumberUtil.percent; |
||||
|
import static java.lang.Math.E; |
||||
|
import static java.lang.Math.IEEEremainder; |
||||
|
import static java.lang.Math.PI; |
||||
|
import static java.lang.Math.abs; |
||||
|
import static java.lang.Math.acos; |
||||
|
import static java.lang.Math.asin; |
||||
|
import static java.lang.Math.atan; |
||||
|
import static java.lang.Math.atan2; |
||||
|
import static java.lang.Math.cbrt; |
||||
|
import static java.lang.Math.ceil; |
||||
|
import static java.lang.Math.cos; |
||||
|
import static java.lang.Math.cosh; |
||||
|
import static java.lang.Math.exp; |
||||
|
import static java.lang.Math.expm1; |
||||
|
import static java.lang.Math.floor; |
||||
|
import static java.lang.Math.pow; |
||||
|
import static java.lang.Math.random; |
||||
|
import static java.lang.Math.rint; |
||||
|
import static java.lang.Math.round; |
||||
|
import static java.lang.Math.sin; |
||||
|
import static java.lang.Math.sinh; |
||||
|
import static java.lang.Math.sqrt; |
||||
|
import static java.lang.Math.tan; |
||||
|
import static java.lang.Math.tanh; |
||||
|
import static java.lang.Math.toDegrees; |
||||
|
import static java.lang.Math.toRadians; |
||||
|
#end |
@ -0,0 +1,79 @@ |
|||||
|
#define renderLib(lib) |
||||
|
@JsonIgnoreProperties(ignoreUnknown=true) |
||||
|
class #(className(lib.code,lib.version)) { |
||||
|
private static final Logger log =LoggerFactory.getLogger(#(className(lib.code,lib.version)).class); |
||||
|
#(tabs(IndicatorGenerator.generateFields(lib.indicators),1)) |
||||
|
|
||||
|
//通过输入参数构建指标库对象 |
||||
|
public void convertArgument(Map<String,Object> map){ |
||||
|
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators,"this"),2)) |
||||
|
} |
||||
|
|
||||
|
public void convertArgument(String json){ |
||||
|
#(tabs(IndicatorGenerator.generateConvertorFromJson(lib.indicators),2)) |
||||
|
} |
||||
|
|
||||
|
public void execute() throws Exception{ |
||||
|
#for(indicator : lib.indicators) |
||||
|
#if(indicator.type.toString()=="INDICATOR" && indicator.processors!=null && indicator.processors.size()>0) |
||||
|
#(methodName(indicator.code))();//#(indicator.name),#(indicator.type) |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
|
||||
|
public void validate(ValidateResult result) { |
||||
|
#(tabs(IndicatorGenerator.generateValidator(lib.indicators),2)) |
||||
|
} |
||||
|
|
||||
|
#for(indicator : lib.indicators) |
||||
|
#if(indicator.type.toString()=="INDICATOR" && indicator.processors!=null && indicator.processors.size()>0) |
||||
|
#set(parameter=indicator) |
||||
|
public void #(methodName(indicator.code))(){ |
||||
|
#(className(lib.code,lib.version)) arg =this; |
||||
|
#for(processor : indicator.processors) |
||||
|
if(log.isDebugEnabled()){log.debug(" {}","#(parameter.name)(#(parameter.type))");} |
||||
|
#switch (processor.type.toString()) |
||||
|
#case ("ARITHMETIC") |
||||
|
//算数运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/arithmetic.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 算数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("CONDITION_RANGE") |
||||
|
//条件分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/conditionRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 条件分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("GROOVY_SCRIPT") |
||||
|
//Groovy 脚本 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/groovy_script.tpl") |
||||
|
#case ("HTTP_REQUEST") |
||||
|
//Http 请求 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/http_request.tpl") |
||||
|
#case ("MATH_FORMULA") |
||||
|
//数学公式 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/math_formula.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数学公式运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("NUMBER_RANGE") |
||||
|
//数值分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/numberRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数值分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("OBJECT_PROPERTIES") |
||||
|
//对象属性赋值函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/object_properties.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 对象属性函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("SQL") |
||||
|
//SQL 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/sql.tpl") |
||||
|
#case ("TERNARY") |
||||
|
//三元运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/ternary.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 三元运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("WHEN_THEN") |
||||
|
//WhenThen 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/when_then.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" WhenThen 运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
#end |
@ -0,0 +1,30 @@ |
|||||
|
#define renderModel(model) |
||||
|
//#(model.fullName.contains("/")?"子":"主")模型(#(model.fullName)) |
||||
|
private static void #(methodName(model.code))(Executor executor,Argument arg){ |
||||
|
if(log.isDebugEnabled()){log.debug("开始调用模型: {}({})","#(model.fullName)","#(model.executeMode)");} |
||||
|
|
||||
|
#if(!model.enable) |
||||
|
if(log.isDebugEnabled()){log.debug("开始调用模型: enable==false");} |
||||
|
#end |
||||
|
#if(model.executeMode.toString()=="DOWN_UP") |
||||
|
//调用子模型 |
||||
|
#for(subModel : model.children) |
||||
|
#(methodName(subModel.code))(executor,arg);//#(subModel.name) |
||||
|
#end |
||||
|
#end |
||||
|
|
||||
|
//计算中间值和结果值 |
||||
|
#for(parameter : model.parameters) |
||||
|
#if(parameter.type.toString()=="INTERMEDIATE" || parameter.type.toString()=="OUT") |
||||
|
#(methodName(parameter.code))(executor,arg);//#(parameter.type), #(parameter.name) |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
|
||||
|
### 递归调用生成子模式代码 |
||||
|
#for(subModel : model.children) |
||||
|
#@renderModel(subModel) |
||||
|
#end |
||||
|
|
||||
|
#@renderParameter(model) |
||||
|
#end |
@ -0,0 +1,3 @@ |
|||||
|
#define renderPackage(packageName) |
||||
|
package #(packageName); |
||||
|
#end |
@ -0,0 +1,125 @@ |
|||||
|
#define renderParameter(model) |
||||
|
#for(parameter : model.parameters) |
||||
|
#if(("INTERMEDIATE"==parameter.type.toString() || "OUT"==parameter.type.toString()) && ("io.sc.engine.rule.core.SingleRuleResult"==parameter.valueType || "io.sc.engine.rule.core.RuleSetResult"==parameter.valueType)) |
||||
|
//参数处理器, #(parameter.name)(#(parameter.type)) |
||||
|
private static void #(methodName(parameter.code))(Executor executor,Argument arg) { |
||||
|
if(log.isDebugEnabled()){log.debug(" {}","#(parameter.name)(#(parameter.type))");} |
||||
|
#for(processor : parameter.processors) |
||||
|
#if(processor.enable) |
||||
|
#switch (processor.type.toString()) |
||||
|
#case ("SINGLE_RULE") |
||||
|
//单规则 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/single_rule.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 单规则运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("RULE_SET") |
||||
|
//规则集 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/rule_set.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 规则集运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
#else if("INTERMEDIATE"==parameter.type.toString() || "OUT"==parameter.type.toString()) |
||||
|
//参数处理器, #(parameter.name)(#(parameter.type)) |
||||
|
private static void #(methodName(parameter.code))(Executor executor,Argument arg) { |
||||
|
if(log.isDebugEnabled()){log.debug(" {}","#(parameter.name)(#(parameter.type))");} |
||||
|
#for(processor : parameter.processors) |
||||
|
#if(processor.enable) |
||||
|
#switch (processor.type.toString()) |
||||
|
#case ("ARITHMETIC") |
||||
|
//算数运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/arithmetic.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 算数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("CONDITION_RANGE") |
||||
|
//条件分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/conditionRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 条件分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("DECISION_TABLE") |
||||
|
//决策表 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/decision_table.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 决策表运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("DECISION_TABLE_2C") |
||||
|
//简单决策表 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/decision_table_2c.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 简单决策表运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("DECISION_TREE") |
||||
|
//决策树(此处只是入口,真正的决策树计算逻辑在后面通过一系列方法完成) |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/decision_tree.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 决策树运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("EXECUTION_FLOW") |
||||
|
//执行流(此处只是入口,真正的执行流计算逻辑在后面通过一系列方法完成) |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/execution_flow.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 执行流运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("GROOVY_SCRIPT") |
||||
|
//Groovy 脚本 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/groovy_script.tpl") |
||||
|
#case ("HTTP_REQUEST") |
||||
|
//Http 请求 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/http_request.tpl") |
||||
|
#case ("MATH_FORMULA") |
||||
|
//数学公式 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/math_formula.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数学公式运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("NUMBER_RANGE") |
||||
|
//数值分段函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/numberRange.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 数值分段函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("OBJECT_PROPERTIES") |
||||
|
//对象属性赋值函数 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/object_properties.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 对象属性函数运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("OPTION_VALUE") |
||||
|
//选项值运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/option_value.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 选项运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("PMML") |
||||
|
//PMML |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/pmml.tpl") |
||||
|
#case ("RULE") |
||||
|
#case ("SCORE_CARD") |
||||
|
//评分卡 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/score_card.tpl") |
||||
|
#case ("SINGLE_RULE") |
||||
|
#case ("SQL") |
||||
|
//SQL 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/sql.tpl") |
||||
|
#case ("TERNARY") |
||||
|
//三元运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/ternary.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" 三元运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#case ("WHEN_THEN") |
||||
|
//WhenThen 运算 |
||||
|
#include("/io/sc/engine/rule/core/code/template/processor/when_then.tpl") |
||||
|
if(log.isDebugEnabled()){log.debug(" WhenThen 运算结果 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
|
||||
|
if(log.isDebugEnabled()){log.debug(" 参数结果值 : {}",arg.#(fieldName(parameter.code)));} |
||||
|
} |
||||
|
|
||||
|
#end |
||||
|
#end |
||||
|
### 决策树函数 |
||||
|
#for(parameter : model.allParameters) |
||||
|
#if("INTERMEDIATE"==parameter.type.toString() || "OUT"==parameter.type.toString()) |
||||
|
#for(processor : parameter.processors) |
||||
|
#if("DECISION_TREE"==processor.type.toString()) |
||||
|
//决策树函数: #(parameter.name)(#(parameter.type)) |
||||
|
#(tabs(DecisionTree.groovy(parameter,processor),1)) |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
### 执行流函数 |
||||
|
#for(parameter : model.allParameters) |
||||
|
#if("INTERMEDIATE"==parameter.type.toString() || "OUT"==parameter.type.toString()) |
||||
|
#for(processor : parameter.processors) |
||||
|
#if("EXECUTION_FLOW"==processor.type.toString()) |
||||
|
//执行流函数: #(parameter.name)(#(parameter.type)) |
||||
|
#(tabs(ExecutionFlow.groovy(parameter,processor),1)) |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
#end |
@ -0,0 +1 @@ |
|||||
|
arg.#(fieldName(parameter.code)) =#(Arithmetic.groovy(parameter,processor)); |
@ -0,0 +1 @@ |
|||||
|
#(tabs(ConditionRange.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(DecisionTable.groovy(parameter,processor,model.allParameters),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(DecisionTable2C.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
arg.#(fieldName(parameter.code)) =Tree_#(fieldName(parameter.code))_#(DecisionTree.parse(processor.decisionTree).id)(executor,arg); |
@ -0,0 +1 @@ |
|||||
|
Flow_#(fieldName(parameter.code))_#(ExecutionFlow.parse(processor.executionFlow).id)(executor,arg); |
@ -0,0 +1 @@ |
|||||
|
#(tabs(io.sc.engine.rule.core.util.GroovyExpressionReplacer::groovy(processor.groovyScript),2)) |
@ -0,0 +1 @@ |
|||||
|
arg.#(fieldName(parameter.code)) =#(MathFormula.groovy(parameter,processor)); |
@ -0,0 +1 @@ |
|||||
|
#(tabs(NumberRange.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(ObjectProperty.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(OptionValue.groovy(parameter,processor,model),2)) |
@ -0,0 +1,4 @@ |
|||||
|
arg.#(fieldName(parameter.code)) =JpmmlEvaluator.evaluate( |
||||
|
'#(parameter.id)_#(processor.id)', |
||||
|
'''#(tabs(processor.pmml,3))''' |
||||
|
,arg.toMap()); |
@ -0,0 +1 @@ |
|||||
|
#(tabs(RuleSet.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(ScoreCard.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(SingleRule.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(SqlFieldMapping.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(Ternary.groovy(parameter,processor),2)) |
@ -0,0 +1 @@ |
|||||
|
#(tabs(WhenThen.groovy(parameter,processor),2)) |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@ |
|||||
[ |
[ |
||||
{ |
{ |
||||
"name" : "DIV", |
"name" : "DIV", |
||||
"signature" : "DIV(a,b)", |
"signature" : "UDF.DIV(a,b)", |
||||
"description" : "特殊除法, a 除以 b, 用于处理分母为零", |
"description" : "特殊除法, a 除以 b, 用于处理分母为零", |
||||
"enable" : true, |
"enable" : true, |
||||
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>DIV</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>a</mi>\n <mspace></mspace>\n <mo>,</mo>\n <mspace></mspace>\n <mi>b</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
"mathXml" : "<mspace></mspace>\n<mrow>\n <mo>UDF.DIV</mo>\n <mi>(</mi>\n <mspace></mspace>\n <mi>a</mi>\n <mspace></mspace>\n <mo>,</mo>\n <mspace></mspace>\n <mi>b</mi>\n <mspace></mspace>\n <mi>)</mi>\n</mrow>\n<mspace></mspace>", |
||||
"body" : "def DIV(Double a, Double b){\n if(b==0){\n if(a>0){\n return 999;\n }else if(a<0){\n return -999;\n }else{\n return 0;\n }\n }\n}" |
"body" : "def static DIV(Double a, Double b){\n if(b==0){\n if(a>0){\n return 999;\n }else if(a<0){\n return -999;\n }else{\n return 0;\n }\n }\n}" |
||||
} |
} |
||||
] |
] |
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@ |
|||||
dependencies { |
dependencies { |
||||
api( |
api( |
||||
"com.mysql:mysql-connector-j", |
//"com.mysql:mysql-connector-j", |
||||
|
"mysql:mysql-connector-java:${jdbc_mysql_version}" |
||||
) |
) |
||||
} |
} |
@ -1,5 +1,6 @@ |
|||||
dependencies { |
dependencies { |
||||
api( |
api( |
||||
"com.mysql:mysql-connector-j", |
//"com.mysql:mysql-connector-j", |
||||
|
"mysql:mysql-connector-java:${jdbc_mysql_version}" |
||||
) |
) |
||||
} |
} |
@ -1,5 +1,6 @@ |
|||||
dependencies { |
dependencies { |
||||
api( |
api( |
||||
"com.mysql:mysql-connector-j", |
//"com.mysql:mysql-connector-j", |
||||
|
"mysql:mysql-connector-java:${jdbc_mysql_version}" |
||||
) |
) |
||||
} |
} |
Loading…
Reference in new issue