@@ -2,12 +2,13 @@ package com.ruoyi.system.controller; | |||
import cn.dev33.satoken.annotation.SaIgnore; | |||
import com.ruoyi.system.service.ZsEmailService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
@Slf4j | |||
@RestController | |||
@RequestMapping("/system/zsEmail") | |||
public class ZsEmailController { | |||
@@ -21,10 +22,16 @@ public class ZsEmailController { | |||
*/ | |||
@SaIgnore | |||
@GetMapping("/sendEmailWeb") | |||
public void sendEmailWeb(@RequestParam("receiveEmail") String receiveEmail, | |||
public boolean sendEmailWeb(@RequestParam("receiveEmail") String receiveEmail, | |||
@RequestParam("title")String title, | |||
@RequestParam("context")String context) { | |||
//发送邮件 | |||
emailService.sendEmail(receiveEmail,title,context); | |||
try { | |||
return emailService.sendEmail(receiveEmail,title,context); | |||
} catch (Exception e) { | |||
log.error("邮件发送接口失败!",e); | |||
return false; | |||
} | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
package com.ruoyi.system.service; | |||
public interface ZsEmailService { | |||
void sendEmail(String receiveEmail,String title,String context); | |||
boolean sendEmail(String receiveEmail,String title,String context); | |||
} |
@@ -20,7 +20,7 @@ public class ZsEmailServiceImpl implements ZsEmailService { | |||
@Autowired | |||
private EmailUtils emailUtils; | |||
@Override | |||
public void sendEmail(String receiveEmail,String title,String context) { | |||
public boolean sendEmail(String receiveEmail,String title,String context) { | |||
QueryWrapper<ZsOperationSendconfig> sendWrapper= new QueryWrapper<>(); | |||
sendWrapper.eq("module",1);//站点模块 | |||
sendWrapper.eq("code",0);//邮箱方式 | |||
@@ -31,5 +31,7 @@ public class ZsEmailServiceImpl implements ZsEmailService { | |||
emailUtils.sendMailByTransport(zsOperationSendconfig.getSendEmail(),receiveEmail,title,context,zsOperationSendconfig.getSmtpId()); | |||
} | |||
} | |||
return true; | |||
} | |||
} |
@@ -158,8 +158,15 @@ public class MonitorTaskScheduler { | |||
} | |||
} | |||
} | |||
} else { | |||
log.info("没有设置对应的预警配置"); | |||
} | |||
} else { | |||
log.info("商品:"+newName+";价格变动小于阈值,不生成比对结果;本次变动幅度=:"+percentageChange); | |||
} | |||
} else { | |||
log.info("商品:"+newName+";新价格为0,不生成比对结果"); | |||
} | |||
} | |||
} else { |