544245
parent
39f23b9a96
commit
6546834cad
|
@ -129,44 +129,30 @@ public class RuleEngineVersionController {
|
||||||
// 定义模板字符串
|
// 定义模板字符串
|
||||||
String template = "package com.muyu.rule.common.engine;\n" +
|
String template = "package com.muyu.rule.common.engine;\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"import cn.hutool.core.util.DesensitizedUtil;\n" +
|
|
||||||
"import com.alibaba.fastjson2.JSON;\n" +
|
|
||||||
"import com.alibaba.fastjson2.JSONObject;\n" +
|
|
||||||
"import com.muyu.etl.domain.DataValue;\n" +
|
"import com.muyu.etl.domain.DataValue;\n" +
|
||||||
"import com.muyu.rule.common.basic.abstracts." + parentClass + ";\n" +
|
"import com.muyu.rule.common.basic.abstracts.${parentClass};\n" +
|
||||||
|
"import com.muyu.rule.common.exception.DeliteException;\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"/**\n" +
|
"/**\n" +
|
||||||
" * @Author:张承志\n" +
|
" * @Author:张承志\n" +
|
||||||
" * @Package:com.muyu.rule.server.basic.engine.row\n" +
|
" * @Package:com.muyu.rule.server.basic.engine\n" +
|
||||||
" * @Project:cloud-etl-rule\n" +
|
" * @Project:cloud-etl-rule\n" +
|
||||||
" * @name:数据集指定字段进行脱敏\n" +
|
" * @name:${className}\n" +
|
||||||
" * @Date:2024/8/30 11:13\n" +
|
" * @Date:2024/8/30 11:13\n" +
|
||||||
" */\n" +
|
" */\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"public class ${className} extends " + parentClass + " {\n" +
|
"public class ${className} extends ${parentClass} {\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" @Override\n" +
|
" @Override\n" +
|
||||||
" public void run() {\n" +
|
" public void run() {\n" +
|
||||||
"\n" +
|
|
||||||
" DataValue[][] dataValues = get();\n" +
|
" DataValue[][] dataValues = get();\n" +
|
||||||
"\n" +
|
" if (dataValues == null || \"\".equals(dataValues) || \"null\".equals(dataValues)) {\n" +
|
||||||
" String dataValue = getDataValue();\n" +
|
" throw new DeliteException();\n" +
|
||||||
"\n" +
|
" }else {\n" +
|
||||||
" JSONObject jsonObject = JSON.parseObject(dataValue);\n" +
|
" System.out.println(\"数据检测无异常\");\n" +
|
||||||
"\n" +
|
|
||||||
" String key = (String)jsonObject.get(\"key\");\n" +
|
|
||||||
"\n" +
|
|
||||||
" for (DataValue[] value : dataValues) {\n" +
|
|
||||||
" for (DataValue dataValue1 : value) {\n" +
|
|
||||||
" if (dataValue1.getKey().equals(key)) {\n" +
|
|
||||||
" dataValue1.setValue(DesensitizedUtil.mobilePhone((String) dataValue1.getValue()));\n" +
|
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
|
||||||
" set(dataValues);\n" +
|
|
||||||
"\n" +
|
|
||||||
" }\n" +
|
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
// 使用Map进行模板替换
|
// 使用Map进行模板替换
|
||||||
|
|
Loading…
Reference in New Issue