浏览代码

1.邮件发送接口添加返回

2.添加注释
wq_dev
wangqiang 1 个月前
父节点
当前提交
866da547a6

+ 10
- 3
ruoyi-system/src/main/java/com/ruoyi/system/controller/ZsEmailController.java 查看文件



import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.system.service.ZsEmailService; import com.ruoyi.system.service.ZsEmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController @RestController
@RequestMapping("/system/zsEmail") @RequestMapping("/system/zsEmail")
public class ZsEmailController { public class ZsEmailController {
*/ */
@SaIgnore @SaIgnore
@GetMapping("/sendEmailWeb") @GetMapping("/sendEmailWeb")
public void sendEmailWeb(@RequestParam("receiveEmail") String receiveEmail,
public boolean sendEmailWeb(@RequestParam("receiveEmail") String receiveEmail,
@RequestParam("title")String title, @RequestParam("title")String title,
@RequestParam("context")String context) { @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
- 1
ruoyi-system/src/main/java/com/ruoyi/system/service/ZsEmailService.java 查看文件

package com.ruoyi.system.service; package com.ruoyi.system.service;


public interface ZsEmailService { public interface ZsEmailService {
void sendEmail(String receiveEmail,String title,String context);
boolean sendEmail(String receiveEmail,String title,String context);
} }

+ 3
- 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZsEmailServiceImpl.java 查看文件

@Autowired @Autowired
private EmailUtils emailUtils; private EmailUtils emailUtils;
@Override @Override
public void sendEmail(String receiveEmail,String title,String context) {
public boolean sendEmail(String receiveEmail,String title,String context) {
QueryWrapper<ZsOperationSendconfig> sendWrapper= new QueryWrapper<>(); QueryWrapper<ZsOperationSendconfig> sendWrapper= new QueryWrapper<>();
sendWrapper.eq("module",1);//站点模块 sendWrapper.eq("module",1);//站点模块
sendWrapper.eq("code",0);//邮箱方式 sendWrapper.eq("code",0);//邮箱方式
emailUtils.sendMailByTransport(zsOperationSendconfig.getSendEmail(),receiveEmail,title,context,zsOperationSendconfig.getSmtpId()); emailUtils.sendMailByTransport(zsOperationSendconfig.getSendEmail(),receiveEmail,title,context,zsOperationSendconfig.getSmtpId());
} }
} }
return true;
} }

} }

+ 7
- 0
ruoyi-system/src/main/java/com/ruoyi/system/task/MonitorTaskScheduler.java 查看文件

} }
} }
} }
} else {
log.info("没有设置对应的预警配置");
} }

} else {
log.info("商品:"+newName+";价格变动小于阈值,不生成比对结果;本次变动幅度=:"+percentageChange);
} }
} else {
log.info("商品:"+newName+";新价格为0,不生成比对结果");
} }
} }
} else { } else {

正在加载...
取消
保存