zhouhao 2 سال پیش
والد
کامیت
d4c14be015

+ 5 - 0
jetlinks-components/notify-component/notify-core/src/main/java/org/jetlinks/community/notify/template/Template.java

@@ -1,6 +1,7 @@
 package org.jetlinks.community.notify.template;
 
 
+import com.google.common.collect.Maps;
 import org.jetlinks.community.notify.NotifierProvider;
 import org.jetlinks.community.relation.utils.VariableSource;
 
@@ -47,6 +48,10 @@ public interface Template extends Serializable {
         return convert(key, value);
     }
 
+    default Map<String, Object> renderMap(Map<String, Object> context) {
+        return Maps.transformValues(context, value -> VariableSource.of(value).resolveStatic(context));
+    }
+
     default String convert(String key, Object value) {
         if (value instanceof Collection) {
             return ((Collection<?>) value)