Skip to content

Commit

Permalink
fix(短信通知模块): 修复产品/设备发生告警,短信通知内置函数未进行格式化问题 (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
fighter-wang authored May 9, 2024
1 parent ff0f7dd commit 8d7d900
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ default String get(String key,
}

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) {
Expand Down

0 comments on commit 8d7d900

Please sign in to comment.