REQ-1898: 更新字段名称
This commit is contained in:
parent
6756812c75
commit
63675a63dc
@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.util.function.Function.identity;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
@ -40,7 +39,7 @@ public class MessageMappingProcessor implements EventMappingProcessor {
|
||||
private final ImClient imClient;
|
||||
|
||||
/**
|
||||
* @Scope("prototype") -> we're good
|
||||
* Scope("prototype") -> we're good
|
||||
*/
|
||||
@Setter
|
||||
private TemplateMessage template;
|
||||
@ -70,7 +69,7 @@ public class MessageMappingProcessor implements EventMappingProcessor {
|
||||
public TemplateSendResultV3 buildTemplateSendResult() {
|
||||
TemplateSendResultV3 templateResult = new TemplateSendResultV3();
|
||||
templateResult.setTemplateCode(template.getTemplateCode());
|
||||
templateResult.setBizActionCategory(template.getConfig().getCategory());
|
||||
templateResult.setChannel(template.getConfig().getCategory());
|
||||
for (MessageRecordV3 message : template.getMessageRecords()) {
|
||||
templateResult.addResult(new MessageSendResultV3(
|
||||
message.getReceiverPersonId(), message.getId()));
|
||||
|
||||
@ -138,22 +138,16 @@ public class TemplateMessage {
|
||||
// ------------------------------- 辅助方法
|
||||
|
||||
String parseTitle() {
|
||||
if (title != null) {
|
||||
return title;
|
||||
if (title == null) {
|
||||
title = PlaceholderResolver.tryResolve(template.getTitle(), req.getBizExtParams());
|
||||
}
|
||||
title = req.getBizExtParams() == null
|
||||
? template.getTitle()
|
||||
: PlaceholderResolver.resolve(template.getTitle(), req.getBizExtParams());
|
||||
return title;
|
||||
}
|
||||
|
||||
String parseContent() {
|
||||
if (content != null) {
|
||||
return content;
|
||||
if (content == null) {
|
||||
content = PlaceholderResolver.tryResolve(template.getContent(), req.getBizExtParams());
|
||||
}
|
||||
content = req.getBizExtParams() == null
|
||||
? template.getContent()
|
||||
: PlaceholderResolver.resolve(template.getContent(), req.getBizExtParams());
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
@ -17,11 +17,11 @@ import java.io.Serializable;
|
||||
@AllArgsConstructor
|
||||
public class MessageSendResultV3 implements Serializable {
|
||||
/**
|
||||
* 接收者ID
|
||||
* 接收者id
|
||||
*/
|
||||
private Long receiverPersonId;
|
||||
/**
|
||||
* 消息id或者待办id
|
||||
* 渠道结果id
|
||||
*/
|
||||
private Long resultId;
|
||||
|
||||
|
||||
@ -28,10 +28,11 @@ public class TemplateSendResultV3 implements Serializable {
|
||||
@Getter
|
||||
private String templateCode;
|
||||
/**
|
||||
* NOTIFICATION: 通知, PENDING: 待办
|
||||
* 渠道
|
||||
* <p>NOTIFICATION: 通知, PENDING: 待办
|
||||
*/
|
||||
@Getter
|
||||
private String bizActionCategory;
|
||||
private String channel;
|
||||
|
||||
public void addResult(MessageSendResultV3 result) {
|
||||
receiverPersonId2SendResult.put(result.getReceiverPersonId(), result);
|
||||
|
||||
@ -2,7 +2,11 @@ package cn.axzo.msg.center.common.utils;
|
||||
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -46,7 +50,10 @@ public class PlaceholderResolver {
|
||||
this.placeholderSuffix = placeholderSuffix;
|
||||
}
|
||||
|
||||
public static String resolve(String template, Map<String, Object> values) {
|
||||
public static String tryResolve(String template, Map<String, Object> values) {
|
||||
if (values == null || values.isEmpty()) {
|
||||
return template;
|
||||
}
|
||||
return getDefaultResolver().resolveByMap(template, values);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user