fix: 修复发送通知时没有获取到表里最新的值的问题
--bug=1008988 --user=刘瑞斌 【消息通知】删除接口用例无删除时间删除人ID,以及创建人ID,标签 https://www.tapd.cn/55049933/s/1084364
This commit is contained in:
parent
4142a2a8d0
commit
083bc8f9e9
|
@ -101,6 +101,28 @@ public class SendNoticeAspect {
|
||||||
String[] params = discoverer.getParameterNames(method);
|
String[] params = discoverer.getParameterNames(method);
|
||||||
//获取操作
|
//获取操作
|
||||||
SendNotice sendNotice = method.getAnnotation(SendNotice.class);
|
SendNotice sendNotice = method.getAnnotation(SendNotice.class);
|
||||||
|
// 再次从数据库查询一次内容,方便获取最新参数
|
||||||
|
InvocationHandler invocationHandler = Proxy.getInvocationHandler(sendNotice);
|
||||||
|
Field value = invocationHandler.getClass().getDeclaredField("memberValues");
|
||||||
|
value.setAccessible(true);
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(sendNotice.target())) {
|
||||||
|
//将参数纳入Spring管理
|
||||||
|
EvaluationContext context = new StandardEvaluationContext();
|
||||||
|
for (int len = 0; len < params.length; len++) {
|
||||||
|
context.setVariable(params[len], args[len]);
|
||||||
|
}
|
||||||
|
context.setVariable("targetClass", CommonBeanFactory.getBean(sendNotice.targetClass()));
|
||||||
|
|
||||||
|
String target = sendNotice.target();
|
||||||
|
Expression titleExp = parser.parseExpression(target);
|
||||||
|
Object v = titleExp.getValue(context, Object.class);
|
||||||
|
if (v != null) {
|
||||||
|
Map<String, Object> memberValues = (Map<String, Object>) value.get(invocationHandler);
|
||||||
|
memberValues.put("source", JSON.toJSONString(v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EvaluationContext context = new StandardEvaluationContext();
|
EvaluationContext context = new StandardEvaluationContext();
|
||||||
for (int len = 0; len < params.length; len++) {
|
for (int len = 0; len < params.length; len++) {
|
||||||
context.setVariable(params[len], args[len]);
|
context.setVariable(params[len], args[len]);
|
||||||
|
|
Loading…
Reference in New Issue