Changes
parent
414ae7b95e
commit
3634746ea3
|
@ -11,12 +11,12 @@ import java.util.Date;
|
||||||
@Component
|
@Component
|
||||||
public class GenerateConstant {
|
public class GenerateConstant {
|
||||||
|
|
||||||
public static final String DATA_FIELD = "DataEngineValueActuator";
|
// public static final String DATA_FIELD = "DataEngineValueActuator";
|
||||||
public static final String DATA_RECORD = "DataEngineRecordActuator";
|
// public static final String DATA_RECORD = "DataEngineRecordActuator";
|
||||||
public static final String DATA_SET = "DataEngineSetActuator";
|
// public static final String DATA_SET = "DataEngineSetActuator";
|
||||||
public static final String ACTION_IMPORT = "import com.muyu.rule.engine.action.ActionDiscard;\n";
|
// public static final String ACTION_IMPORT = "import com.muyu.rule.engine.action.ActionDiscard;\n";
|
||||||
public static final String SCOPE_IMPORT = "import com.muyu.rule.engine.scope.DataModelEngine";
|
// public static final String SCOPE_IMPORT = "import com.muyu.rule.engine.scope.DataModelEngine";
|
||||||
public static final String PACKAGE_PATH = "package com.muyu.generate;";
|
// public static final String PACKAGE_PATH = "package com.muyu.generate;";
|
||||||
|
|
||||||
public static String getClassName(String versionCode) {
|
public static String getClassName(String versionCode) {
|
||||||
String[] splits = versionCode.split("_");
|
String[] splits = versionCode.split("_");
|
||||||
|
@ -30,37 +30,35 @@ public class GenerateConstant {
|
||||||
public static String generateConstant(Rule rule, RuleEdition ruleEdition) {
|
public static String generateConstant(Rule rule, RuleEdition ruleEdition) {
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
String format = simpleDateFormat.format(new Date());
|
String format = simpleDateFormat.format(new Date());
|
||||||
String level = selectType(rule.getRuleType());
|
// String level = selectType(rule.getRuleType());
|
||||||
return PACKAGE_PATH + "\n" +
|
return
|
||||||
ACTION_IMPORT + "\n" +
|
|
||||||
SCOPE_IMPORT + level + ";\n" +
|
|
||||||
"\n" +
|
"\n" +
|
||||||
"/**\n" +
|
"/**\n" +
|
||||||
" * @date: " + format + "\n" +
|
" * @date: " + format + "\n" +
|
||||||
" * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
|
" * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
|
||||||
" * @Version: 1.0\n" +
|
" * @Version: 1.0\n" +
|
||||||
" */\n" +
|
" */\n" +
|
||||||
"public class " + getClassName(ruleEdition.getRuleCoding()) + " extends " + DATA_FIELD + " {\n" +
|
"public class " + getClassName(ruleEdition.getRuleCoding()) + " {\n" +
|
||||||
" @Override\n" +
|
" @Override\n" +
|
||||||
" public void run () {\n" +
|
" public void run () {\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String selectType(String level) {
|
// public static String selectType(String level) {
|
||||||
String type = "";
|
// String type = "";
|
||||||
switch (level) {
|
// switch (level) {
|
||||||
case "F":
|
// case "F":
|
||||||
type = DATA_FIELD;
|
// type = DATA_FIELD;
|
||||||
break;
|
// break;
|
||||||
case "R":
|
// case "R":
|
||||||
type = DATA_RECORD;
|
// type = DATA_RECORD;
|
||||||
break;
|
// break;
|
||||||
case "C":
|
// case "C":
|
||||||
type = DATA_SET;
|
// type = DATA_SET;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
return type;
|
// return type;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue