fix(短信通知模块): 修复产品/设备发生告警,短信通知内置函数未进行格式化问题 (#507)
This commit is contained in:
parent
ff0f7ddfa2
commit
8d7d900289
|
|
@ -62,7 +62,18 @@ public interface Template extends Serializable {
|
|||
}
|
||||
|
||||
default Map<String, Object> renderMap(Map<String, Object> 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<VariableDefinition> variableDefOpt = getVariable(key);
|
||||
if (variableDefOpt.isPresent()) {
|
||||
return variableDefOpt.get().convertValue(val);
|
||||
}
|
||||
return val;
|
||||
})
|
||||
.orElse(null)
|
||||
);
|
||||
}
|
||||
|
||||
default String convert(String key, Object value) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue