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.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import static java.util.function.Function.identity;
|
import static java.util.function.Function.identity;
|
||||||
import static java.util.stream.Collectors.toMap;
|
import static java.util.stream.Collectors.toMap;
|
||||||
@ -40,7 +39,7 @@ public class MessageMappingProcessor implements EventMappingProcessor {
|
|||||||
private final ImClient imClient;
|
private final ImClient imClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Scope("prototype") -> we're good
|
* Scope("prototype") -> we're good
|
||||||
*/
|
*/
|
||||||
@Setter
|
@Setter
|
||||||
private TemplateMessage template;
|
private TemplateMessage template;
|
||||||
@ -70,7 +69,7 @@ public class MessageMappingProcessor implements EventMappingProcessor {
|
|||||||
public TemplateSendResultV3 buildTemplateSendResult() {
|
public TemplateSendResultV3 buildTemplateSendResult() {
|
||||||
TemplateSendResultV3 templateResult = new TemplateSendResultV3();
|
TemplateSendResultV3 templateResult = new TemplateSendResultV3();
|
||||||
templateResult.setTemplateCode(template.getTemplateCode());
|
templateResult.setTemplateCode(template.getTemplateCode());
|
||||||
templateResult.setBizActionCategory(template.getConfig().getCategory());
|
templateResult.setChannel(template.getConfig().getCategory());
|
||||||
for (MessageRecordV3 message : template.getMessageRecords()) {
|
for (MessageRecordV3 message : template.getMessageRecords()) {
|
||||||
templateResult.addResult(new MessageSendResultV3(
|
templateResult.addResult(new MessageSendResultV3(
|
||||||
message.getReceiverPersonId(), message.getId()));
|
message.getReceiverPersonId(), message.getId()));
|
||||||
|
|||||||
@ -138,22 +138,16 @@ public class TemplateMessage {
|
|||||||
// ------------------------------- 辅助方法
|
// ------------------------------- 辅助方法
|
||||||
|
|
||||||
String parseTitle() {
|
String parseTitle() {
|
||||||
if (title != null) {
|
if (title == null) {
|
||||||
return title;
|
title = PlaceholderResolver.tryResolve(template.getTitle(), req.getBizExtParams());
|
||||||
}
|
}
|
||||||
title = req.getBizExtParams() == null
|
|
||||||
? template.getTitle()
|
|
||||||
: PlaceholderResolver.resolve(template.getTitle(), req.getBizExtParams());
|
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
String parseContent() {
|
String parseContent() {
|
||||||
if (content != null) {
|
if (content == null) {
|
||||||
return content;
|
content = PlaceholderResolver.tryResolve(template.getContent(), req.getBizExtParams());
|
||||||
}
|
}
|
||||||
content = req.getBizExtParams() == null
|
|
||||||
? template.getContent()
|
|
||||||
: PlaceholderResolver.resolve(template.getContent(), req.getBizExtParams());
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,11 +17,11 @@ import java.io.Serializable;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MessageSendResultV3 implements Serializable {
|
public class MessageSendResultV3 implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 接收者ID
|
* 接收者id
|
||||||
*/
|
*/
|
||||||
private Long receiverPersonId;
|
private Long receiverPersonId;
|
||||||
/**
|
/**
|
||||||
* 消息id或者待办id
|
* 渠道结果id
|
||||||
*/
|
*/
|
||||||
private Long resultId;
|
private Long resultId;
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,11 @@ public class TemplateSendResultV3 implements Serializable {
|
|||||||
@Getter
|
@Getter
|
||||||
private String templateCode;
|
private String templateCode;
|
||||||
/**
|
/**
|
||||||
* NOTIFICATION: 通知, PENDING: 待办
|
* 渠道
|
||||||
|
* <p>NOTIFICATION: 通知, PENDING: 待办
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private String bizActionCategory;
|
private String channel;
|
||||||
|
|
||||||
public void addResult(MessageSendResultV3 result) {
|
public void addResult(MessageSendResultV3 result) {
|
||||||
receiverPersonId2SendResult.put(result.getReceiverPersonId(), 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 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.function.Function;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@ -46,7 +50,10 @@ public class PlaceholderResolver {
|
|||||||
this.placeholderSuffix = placeholderSuffix;
|
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);
|
return getDefaultResolver().resolveByMap(template, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user