feat(email): 添加租户 ID并更新邮件发送功能
- 在 EmailRecordService 接口中,更新 sendEmail 方法签名,添加 tenantId 参数 - 在 EmailRecordServiceImpl 中实现更新后的 sendEmail 方法,增加租户 ID 设置 - 修改 MainController 和 TenantServiceImpl 中调用 sendEmail 方法,传入租户 ID
This commit is contained in:
@@ -651,7 +651,7 @@ public class MainController extends BaseController {
|
|||||||
String content = title + appUrl + appName + passwordStr;
|
String content = title + appUrl + appName + passwordStr;
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
if (email != null) {
|
if (email != null) {
|
||||||
emailRecordService.sendEmail(title, content, email);
|
emailRecordService.sendEmail(title, content, email, addUser.getTenantId());
|
||||||
}
|
}
|
||||||
return success("注册成功", new LoginResult(access_token, addUser));
|
return success("注册成功", new LoginResult(access_token, addUser));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,5 +47,5 @@ public interface EmailRecordService extends IService<EmailRecord> {
|
|||||||
void sendHtmlEmail(String title, String path, Map<String, Object> map, String[] toEmails)
|
void sendHtmlEmail(String title, String path, Map<String, Object> map, String[] toEmails)
|
||||||
throws MessagingException, IOException;
|
throws MessagingException, IOException;
|
||||||
|
|
||||||
void sendEmail(String title, String content, String receiver);
|
void sendEmail(String title, String content, String receiver, Integer tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,13 +72,14 @@ public class EmailRecordServiceImpl extends ServiceImpl<EmailRecordMapper, Email
|
|||||||
|
|
||||||
@Async
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public void sendEmail(String title, String content, String receiver) {
|
public void sendEmail(String title, String content, String receiver, Integer tenantId) {
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
EmailRecord emailRecord = new EmailRecord();
|
EmailRecord emailRecord = new EmailRecord();
|
||||||
emailRecord.setTitle(title);
|
emailRecord.setTitle(title);
|
||||||
emailRecord.setContent(content);
|
emailRecord.setContent(content);
|
||||||
emailRecord.setReceiver(receiver);
|
emailRecord.setReceiver(receiver);
|
||||||
emailRecord.setCreateUserId(42);
|
emailRecord.setCreateUserId(42);
|
||||||
|
emailRecord.setTenantId(tenantId);
|
||||||
sendTextEmail(title,content,receiver.split(","));
|
sendTextEmail(title,content,receiver.split(","));
|
||||||
save(emailRecord);
|
save(emailRecord);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -600,7 +600,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
String content = title + appUrl + appName + adminUrl + account + password;
|
String content = title + appUrl + appName + adminUrl + account + password;
|
||||||
// 发送邮件通知
|
// 发送邮件通知
|
||||||
if (company.getEmail() != null) {
|
if (company.getEmail() != null) {
|
||||||
emailRecordService.sendEmail(title, content, company.getEmail());
|
emailRecordService.sendEmail(title, content, company.getEmail(), company.getTid());
|
||||||
}
|
}
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user