diff --git a/jetlinks-components/notify-component/notify-core/src/main/java/org/jetlinks/community/notify/template/Template.java b/jetlinks-components/notify-component/notify-core/src/main/java/org/jetlinks/community/notify/template/Template.java index 1edd1a879..61caca3d0 100755 --- a/jetlinks-components/notify-component/notify-core/src/main/java/org/jetlinks/community/notify/template/Template.java +++ b/jetlinks-components/notify-component/notify-core/src/main/java/org/jetlinks/community/notify/template/Template.java @@ -62,7 +62,18 @@ default String get(String key, } default Map renderMap(Map context) { - return Maps.transformValues(context, value -> value == null ? null: VariableSource.of(value).resolveStatic(context)); + return Maps.transformEntries(context, (key, value) -> + Optional.ofNullable(value) + .map(val -> VariableSource.of(val).resolveStatic(context)) + .map(val -> { + Optional variableDefOpt = getVariable(key); + if (variableDefOpt.isPresent()) { + return variableDefOpt.get().convertValue(val); + } + return val; + }) + .orElse(null) + ); } default String convert(String key, Object value) {