测试类编写
This commit is contained in:
@@ -12,8 +12,9 @@ public enum NotifyType {
|
||||
/**
|
||||
* 邮件类型
|
||||
*/
|
||||
MAIL_TYPE("邮件"),
|
||||
SMS_TYPE("短信");
|
||||
TYPE_LOG("日志输出"),
|
||||
TYPE_MAIL("邮件"),
|
||||
TYPE_MSG("短信");
|
||||
|
||||
private final String typeName;
|
||||
|
||||
|
@@ -6,7 +6,6 @@ import com.hxuanyu.notify.service.MailService;
|
||||
import com.hxuanyu.notify.service.NotifyService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -26,10 +25,12 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
|
||||
@Override
|
||||
public void notify(Object content, NotifyType notifyType) {
|
||||
if (NotifyType.MAIL_TYPE.equals(notifyType)) {
|
||||
if (NotifyType.TYPE_MAIL.equals(notifyType)) {
|
||||
sendMail(content);
|
||||
} else if (NotifyType.SMS_TYPE.equals(notifyType)) {
|
||||
} else if (NotifyType.TYPE_MSG.equals(notifyType)) {
|
||||
sendSms(content);
|
||||
} else if (NotifyType.TYPE_LOG.equals(notifyType)) {
|
||||
logger.info("新通知:{}", content);
|
||||
} else {
|
||||
logger.info("未匹配到通知类型:[{}]", content);
|
||||
}
|
||||
|
Reference in New Issue
Block a user