feat: 2.6.0
1. 新增表达式检验逻辑
This commit is contained in:
parent
965f92a2a0
commit
273a45ce7f
@ -1,9 +1,12 @@
|
|||||||
package com.aizuda.easy.retry.server.job.task.support.expression;
|
package com.aizuda.easy.retry.server.job.task.support.expression;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.aizuda.easy.retry.common.core.exception.EasyRetryCommonException;
|
||||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||||
|
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -22,16 +25,23 @@ public class ExpressionInvocationHandler implements InvocationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||||
|
|
||||||
Object[] expressionParams = (Object[]) args[1];
|
try {
|
||||||
String params = (String) expressionParams[0];
|
Object[] expressionParams = (Object[]) args[1];
|
||||||
Map<String, Object> contextMap = new HashMap<>();
|
String params = (String) expressionParams[0];
|
||||||
if (StrUtil.isNotBlank(params)) {
|
Map<String, Object> contextMap = new HashMap<>();
|
||||||
contextMap = JsonUtil.parseHashMap(params);
|
if (StrUtil.isNotBlank(params)) {
|
||||||
|
contextMap = JsonUtil.parseHashMap(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
args[1] = new Object[]{contextMap};
|
||||||
|
return method.invoke(expressionEngine, args);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
Throwable targetException = e.getTargetException();
|
||||||
|
throw new EasyRetryServerException(targetException.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new EasyRetryServerException("表达式执行失败", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
args[1] = new Object[]{contextMap};
|
|
||||||
return method.invoke(expressionEngine, args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||||||
Assert.notNull(realExpressionEngine, () -> new EasyRetryServerException("表达式引擎不存在"));
|
Assert.notNull(realExpressionEngine, () -> new EasyRetryServerException("表达式引擎不存在"));
|
||||||
ExpressionInvocationHandler invocationHandler = new ExpressionInvocationHandler(realExpressionEngine);
|
ExpressionInvocationHandler invocationHandler = new ExpressionInvocationHandler(realExpressionEngine);
|
||||||
ExpressionEngine expressionEngine = ExpressionFactory.getExpressionEngine(invocationHandler);
|
ExpressionEngine expressionEngine = ExpressionFactory.getExpressionEngine(invocationHandler);
|
||||||
expressionEngine.eval(decisionConfig.getNodeExpression(), new HashMap<>());
|
expressionEngine.eval(decisionConfig.getNodeExpression(), StrUtil.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
21
frontend/public/lib/assets/8zF6m6u3.js
Normal file
21
frontend/public/lib/assets/8zF6m6u3.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,16 +1,16 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Easy Retry</title>
|
<title>Easy Retry</title>
|
||||||
<script type="module" crossorigin src="./assets/O1TCl_bu.js"></script>
|
<script type="module" crossorigin src="./assets/8zF6m6u3.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/gKrsqr4E.css">
|
<link rel="stylesheet" crossorigin href="./assets/EQnfluSr.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user