REQ-1898: 适当抽象
This commit is contained in:
parent
186540128a
commit
08e935c894
@ -10,8 +10,8 @@ import cn.axzo.msg.center.domain.entity.MessageRecordV3;
|
||||
import cn.axzo.msg.center.inside.notices.service.impl.v3.EventMappingProcessor;
|
||||
import cn.axzo.msg.center.inside.notices.service.impl.v3.ImClient;
|
||||
import cn.axzo.msg.center.inside.notices.utils.FunctionalTransactionTemplate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -26,19 +26,18 @@ import static java.util.stream.Collectors.toMap;
|
||||
*/
|
||||
@Component
|
||||
@Scope("prototype")
|
||||
@RequiredArgsConstructor
|
||||
public class MessageMappingProcessor implements EventMappingProcessor {
|
||||
|
||||
@Autowired
|
||||
private MessageRecordV3Dao messageRecordV3Dao;
|
||||
@Autowired
|
||||
private FunctionalTransactionTemplate transactionTemplate;
|
||||
@Autowired
|
||||
private TerminalAppMapping terminalAppMapping;
|
||||
@Autowired
|
||||
private MessageTemplateParser templateParser;
|
||||
@Autowired
|
||||
private ImClient imClient;
|
||||
private final MessageRecordV3Dao messageRecordV3Dao;
|
||||
private final FunctionalTransactionTemplate transactionTemplate;
|
||||
private final TerminalAppMapping terminalAppMapping;
|
||||
private final MessageTemplateParser templateParser;
|
||||
private final ImClient imClient;
|
||||
|
||||
/**
|
||||
* @Scope("prototype") -> we're good
|
||||
*/
|
||||
@Setter
|
||||
private TemplateMessage template;
|
||||
|
||||
@ -65,7 +64,7 @@ public class MessageMappingProcessor implements EventMappingProcessor {
|
||||
@Override
|
||||
public TemplateSendResultV3 buildTemplateSendResult() {
|
||||
TemplateSendResultV3 templateResult = new TemplateSendResultV3();
|
||||
templateResult.setTemplateCode(template.getTemplate().getCode());
|
||||
templateResult.setTemplateCode(template.getTemplateCode());
|
||||
templateResult.setBizActionCategory(template.getConfig().getCategory());
|
||||
for (MessageRecordV3 message : template.getMessageRecords()) {
|
||||
templateResult.addResult(new MessageSendResultV3(
|
||||
|
||||
@ -43,6 +43,10 @@ public class TemplateMessage {
|
||||
private String title;
|
||||
private String content;
|
||||
|
||||
String getTemplateCode() {
|
||||
return template.getCode();
|
||||
}
|
||||
|
||||
Collection<Long> getMessageIds() {
|
||||
return getMessageRecords().stream()
|
||||
.map(MessageRecordV3::getId)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user