Commit 678b41a9 by zhouhaibao

feat(SopMessageVariableResolverService): 添加变量名称到结果映射

- 在解析消息变量时同时将变量名称作为键值存入结果映射
- 确保当变量有默认值时也会使用变量名称进行存储
- 提高了消息变量解析的灵活性和可用性
1 parent 2e57870c
...@@ -33,12 +33,15 @@ public class SopMessageVariableResolverService { ...@@ -33,12 +33,15 @@ public class SopMessageVariableResolverService {
for (SopStrategyMetaMessageVariable variable : variables) { for (SopStrategyMetaMessageVariable variable : variables) {
String variableCode = variable.getVariableCode(); String variableCode = variable.getVariableCode();
String variableName = variable.getVariableName();
try { try {
Object value = resolveVariable(variable, context); Object value = resolveVariable(variable, context);
if (value != null) { if (value != null) {
result.put(variableCode, value); result.put(variableCode, value);
result.put(variableName, value);
} else if (StrUtil.isNotBlank(variable.getDefaultValue())) { } else if (StrUtil.isNotBlank(variable.getDefaultValue())) {
result.put(variableCode, variable.getDefaultValue()); result.put(variableCode, variable.getDefaultValue());
result.put(variableName, variable.getDefaultValue());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("解析消息变量失败, variableCode:{}, error:{}", variableCode, e.getMessage(), e); log.error("解析消息变量失败, variableCode:{}, error:{}", variableCode, e.getMessage(), e);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!