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;
|
||||
|
||||
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.server.common.exception.EasyRetryServerException;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -22,16 +25,23 @@ public class ExpressionInvocationHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
@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];
|
||||
String params = (String) expressionParams[0];
|
||||
Map<String, Object> contextMap = new HashMap<>();
|
||||
if (StrUtil.isNotBlank(params)) {
|
||||
contextMap = JsonUtil.parseHashMap(params);
|
||||
try {
|
||||
Object[] expressionParams = (Object[]) args[1];
|
||||
String params = (String) expressionParams[0];
|
||||
Map<String, Object> contextMap = new HashMap<>();
|
||||
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("表达式引擎不存在"));
|
||||
ExpressionInvocationHandler invocationHandler = new ExpressionInvocationHandler(realExpressionEngine);
|
||||
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
@ -5,8 +5,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Easy Retry</title>
|
||||
<script type="module" crossorigin src="./assets/O1TCl_bu.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/gKrsqr4E.css">
|
||||
<script type="module" crossorigin src="./assets/8zF6m6u3.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/EQnfluSr.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user