master
chentaisen 2024-09-03 10:28:44 +08:00
parent 3634746ea3
commit d9c99e813d
1 changed files with 36 additions and 19 deletions

View File

@ -18,31 +18,48 @@ public class GenerateConstant {
// 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("_");
String className = ""; // String className = "";
for (String split : splits) { // for (String split : splits) {
className += split.substring(0, 1).toUpperCase() + split.substring(1); // className += split.substring(0, 1).toUpperCase() + split.substring(1);
} // }
return className; // return className;
} // }
// public static String generateConstant(Rule rule, RuleEdition ruleEdition) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
// String format = simpleDateFormat.format(new Date());
// String level = selectType(rule.getRuleType());
// return PACKAGE_PATH + "\n" +
// ACTION_IMPORT + "\n" +
// SCOPE_IMPORT + level + ";\n" +
// "\n" +
// "/**\n" +
// " * @date: " + format + "\n" +
// " * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
// " * @Version: 1.0\n" +
// " */\n" +
// "public class " + getClassName(ruleEdition.getRuleCoding()) + " extends " + DATA_FIELD + " {\n" +
// " @Override\n" +
// " public void run () {\n" +
// " }\n" +
// "}";
// }
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 return
"\n" + " * @date: " + format + "\n" +
"/**\n" + " * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
" * @date: " + format + "\n" + " * @Version: 1.0\n" +
" * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" + " */\n" +
" * @Version: 1.0\n" + "public class " + ruleEdition.getRuleCoding() + " {\n" +
" */\n" + " @Override\n" +
"public class " + getClassName(ruleEdition.getRuleCoding()) + " {\n" + " public void run () {\n" +
" @Override\n" + " }\n" +
" public void run () {\n" + "}";
" }\n" +
"}";
} }
// public static String selectType(String level) { // public static String selectType(String level) {