REQ-1898: 使用新的枚举
This commit is contained in:
parent
cfeb4e6e9d
commit
fa9fe0fbd7
@ -5,7 +5,7 @@ import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.msg.center.api.request.v3.MessageSendReqV3;
|
||||
import cn.axzo.msg.center.api.response.v3.MessageSendRespV3;
|
||||
import cn.axzo.msg.center.domain.entity.BizEventMapping;
|
||||
import cn.axzo.msg.center.domain.enums.BizActionCategory;
|
||||
import cn.axzo.msg.center.domain.enums.Channels;
|
||||
import cn.axzo.msg.center.inside.notices.service.MessageServiceV3;
|
||||
import cn.axzo.msg.center.inside.notices.service.impl.v3.msg.MessageMappingProcessor;
|
||||
import cn.axzo.msg.center.inside.notices.service.impl.v3.msg.TemplateMessage;
|
||||
@ -54,12 +54,12 @@ public class MessageServiceV3Impl implements MessageServiceV3 {
|
||||
.queryEnableTemplateByCode(cfg.getTemplateCode())
|
||||
.orElseThrow(() -> new ServiceException(String.format(
|
||||
"未查询到对应的模板, templateCode=%s", cfg.getTemplateCode())));
|
||||
if (BizActionCategory.NOTIFICATION.is(cfg.getCategory())) {
|
||||
if (Channels.NOTIFICATION.is(cfg.getCategory())) {
|
||||
// @Scope("prototype") -> we're good
|
||||
MessageMappingProcessor newProcessor = beanFactory.getBean(MessageMappingProcessor.class);
|
||||
newProcessor.setTemplate(new TemplateMessage(req, batchNo, cfg, template));
|
||||
processors.add(newProcessor);
|
||||
} else if (BizActionCategory.PENDING.is(cfg.getCategory())) {
|
||||
} else if (Channels.PENDING.is(cfg.getCategory())) {
|
||||
throw new ServiceException("目前只支持通知");
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package cn.axzo.msg.center.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 渠道
|
||||
*
|
||||
* @author yanglin
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum Channels {
|
||||
|
||||
/**
|
||||
* 通知
|
||||
*/
|
||||
NOTIFICATION("NOTIFICATION","通知"),
|
||||
|
||||
/**
|
||||
* 待办
|
||||
*/
|
||||
PENDING("PENDING", "待办"),
|
||||
|
||||
;
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
public boolean is(String code) {
|
||||
return this.code.equals(code);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user