REQ-2135: fix bugs
This commit is contained in:
parent
cea1bfd194
commit
ff5bbc169f
@ -43,7 +43,7 @@ public class TodoExt {
|
|||||||
|
|
||||||
public String parseTitle() {
|
public String parseTitle() {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
JSONObject ext = new JSONObject(parseBizExtParams());
|
JSONObject ext = (JSONObject)parseBizExtParams().clone();
|
||||||
ext.put(CTX, ImmutableMap.of("request", request));
|
ext.put(CTX, ImmutableMap.of("request", request));
|
||||||
title = PlaceholderResolver.tryResolve(template.getTitle(), ext);
|
title = PlaceholderResolver.tryResolve(template.getTitle(), ext);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ public class TodoExt {
|
|||||||
|
|
||||||
public String parseContent() {
|
public String parseContent() {
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
JSONObject ext = new JSONObject(parseRouterExtParams());
|
JSONObject ext = (JSONObject)parseBizExtParams().clone();
|
||||||
ext.put(CTX, ImmutableMap.of("request", request));
|
ext.put(CTX, ImmutableMap.of("request", request));
|
||||||
content = PlaceholderResolver.tryResolve(template.getContent(), ext);
|
content = PlaceholderResolver.tryResolve(template.getContent(), ext);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -212,7 +212,7 @@ public final class MessageRouterUtil {
|
|||||||
|
|
||||||
private static void concatRouterParam(Supplier<String> getUrlSupplier, Consumer<String> setUrlConsumer,
|
private static void concatRouterParam(Supplier<String> getUrlSupplier, Consumer<String> setUrlConsumer,
|
||||||
JSONObject routerParam, boolean isConcat) {
|
JSONObject routerParam, boolean isConcat) {
|
||||||
JSONObject copy = new JSONObject(routerParam);
|
JSONObject copy = (JSONObject)routerParam.clone();
|
||||||
// 对第一层的值进行编码
|
// 对第一层的值进行编码
|
||||||
//for (String key : new HashSet<>(copy.keySet())) {
|
//for (String key : new HashSet<>(copy.keySet())) {
|
||||||
// Object value = copy.get(key);
|
// Object value = copy.get(key);
|
||||||
@ -228,7 +228,7 @@ public final class MessageRouterUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String concatRouterParam(String originalUrl, JSONObject routerParam) {
|
private static String concatRouterParam(String originalUrl, JSONObject routerParam) {
|
||||||
JSONObject copy = new JSONObject(routerParam);
|
JSONObject copy = (JSONObject)routerParam.clone();
|
||||||
copy.remove(TodoExt.CTX);
|
copy.remove(TodoExt.CTX);
|
||||||
if (copy.isEmpty()) {
|
if (copy.isEmpty()) {
|
||||||
return originalUrl;
|
return originalUrl;
|
||||||
|
|||||||
@ -48,10 +48,9 @@ public class TemplateParser {
|
|||||||
SpelParserConfiguration parseCfg = new SpelParserConfiguration(
|
SpelParserConfiguration parseCfg = new SpelParserConfiguration(
|
||||||
SpelCompilerMode.OFF, TemplateParser.class.getClassLoader());
|
SpelCompilerMode.OFF, TemplateParser.class.getClassLoader());
|
||||||
Expression exp = new SpelExpressionParser(parseCfg).parseExpression(expression, templateContext);
|
Expression exp = new SpelExpressionParser(parseCfg).parseExpression(expression, templateContext);
|
||||||
exp.getValue(evalContext, String.class);
|
|
||||||
Object value = exp.getValue(evalContext);
|
Object value = exp.getValue(evalContext);
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return null;
|
return "";
|
||||||
return value instanceof String ? (String) value : String.valueOf(value);
|
return value instanceof String ? (String) value : String.valueOf(value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("无效的模版内容, 请检查格式是否正确. expression={}, value={}",
|
log.warn("无效的模版内容, 请检查格式是否正确. expression={}, value={}",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user