mirror of https://gitee.com/y_project/RuoYi.git
定时任务违规的字符
parent
faa4bfaef3
commit
df1c283335
|
@ -111,5 +111,5 @@ public class Constants
|
|||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.ruoyi.common.utils.file" };
|
||||
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 配置处理工具类
|
||||
*
|
||||
* @author yml
|
||||
*/
|
||||
public class YamlUtil
|
||||
{
|
||||
public static Map<?, ?> loadYaml(String fileName) throws FileNotFoundException
|
||||
{
|
||||
InputStream in = YamlUtil.class.getClassLoader().getResourceAsStream(fileName);
|
||||
return StringUtils.isNotEmpty(fileName) ? (LinkedHashMap<?, ?>) new Yaml().load(in) : null;
|
||||
}
|
||||
|
||||
public static void dumpYaml(String fileName, Map<?, ?> map) throws IOException
|
||||
{
|
||||
if (StringUtils.isNotEmpty(fileName))
|
||||
{
|
||||
FileWriter fileWriter = new FileWriter(YamlUtil.class.getResource(fileName).getFile());
|
||||
DumperOptions options = new DumperOptions();
|
||||
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
Yaml yaml = new Yaml(options);
|
||||
yaml.dump(map, fileWriter);
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getProperty(Map<?, ?> map, Object qualifiedKey)
|
||||
{
|
||||
if (map != null && !map.isEmpty() && qualifiedKey != null)
|
||||
{
|
||||
String input = String.valueOf(qualifiedKey);
|
||||
if (!"".equals(input))
|
||||
{
|
||||
if (input.contains("."))
|
||||
{
|
||||
int index = input.indexOf(".");
|
||||
String left = input.substring(0, index);
|
||||
String right = input.substring(index + 1, input.length());
|
||||
return getProperty((Map<?, ?>) map.get(left), right);
|
||||
}
|
||||
else if (map.containsKey(input))
|
||||
{
|
||||
return map.get(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void setProperty(Map<?, ?> map, Object qualifiedKey, Object value)
|
||||
{
|
||||
if (map != null && !map.isEmpty() && qualifiedKey != null)
|
||||
{
|
||||
String input = String.valueOf(qualifiedKey);
|
||||
if (!input.equals(""))
|
||||
{
|
||||
if (input.contains("."))
|
||||
{
|
||||
int index = input.indexOf(".");
|
||||
String left = input.substring(0, index);
|
||||
String right = input.substring(index + 1, input.length());
|
||||
setProperty((Map<?, ?>) map.get(left), right, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
((Map<Object, Object>) map).put(qualifiedKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -130,9 +130,9 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
int row = genTableMapper.updateGenTable(genTable);
|
||||
if (row > 0)
|
||||
{
|
||||
for (GenTableColumn cenTableColumn : genTable.getColumns())
|
||||
for (GenTableColumn genTableColumn : genTable.getColumns())
|
||||
{
|
||||
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
|
||||
genTableColumnMapper.updateGenTableColumn(genTableColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue