mirror of https://gitee.com/y_project/RuoYi.git
修复定时任务参数值带括号时异常问题(IBEBOX)
parent
a3b8727b94
commit
568787a12a
|
@ -286,6 +286,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
|
||||||
|
*
|
||||||
|
* @param str 要截取的字符串
|
||||||
|
* @param open 起始字符串
|
||||||
|
* @param close 结束字符串
|
||||||
|
* @return 截取结果
|
||||||
|
*/
|
||||||
|
public static String substringBetweenLast(final String str, final String open, final String close)
|
||||||
|
{
|
||||||
|
if (isEmpty(str) || isEmpty(open) || isEmpty(close))
|
||||||
|
{
|
||||||
|
return NULLSTR;
|
||||||
|
}
|
||||||
|
final int start = str.indexOf(open);
|
||||||
|
if (start != INDEX_NOT_FOUND)
|
||||||
|
{
|
||||||
|
final int end = str.lastIndexOf(close);
|
||||||
|
if (end != INDEX_NOT_FOUND)
|
||||||
|
{
|
||||||
|
return str.substring(start + open.length(), end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULLSTR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化文本, {} 表示占位符<br>
|
* 格式化文本, {} 表示占位符<br>
|
||||||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class JobInvokeUtil
|
||||||
*/
|
*/
|
||||||
public static List<Object[]> getMethodParams(String invokeTarget)
|
public static List<Object[]> getMethodParams(String invokeTarget)
|
||||||
{
|
{
|
||||||
String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")");
|
String methodStr = StringUtils.substringBetweenLast(invokeTarget, "(", ")");
|
||||||
if (StringUtils.isEmpty(methodStr))
|
if (StringUtils.isEmpty(methodStr))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue