TASK:卖家审核通知
This commit is contained in:
@@ -1076,4 +1076,45 @@ public class SendEmailUtil {
|
||||
|
||||
}
|
||||
|
||||
private final static Long SELLER_APPROVED = 184414L;
|
||||
private final static Long SELLER_REJECTED = 184415L;
|
||||
public static void sellerApproval(String receiver, boolean isApproved) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(CODE_CREATE_SEND_ADDRESS);
|
||||
req.setDestination(new String[]{receiver});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject;
|
||||
Template template = new Template();
|
||||
if (isApproved) {
|
||||
subject = "AiDA卖家权限已开通 AiDA Seller Access Enabled";
|
||||
template.setTemplateID(SELLER_APPROVED);
|
||||
}else {
|
||||
subject = "AiDA卖家权限审批不通过 Seller Access Not Approved";
|
||||
template.setTemplateID(SELLER_REJECTED);
|
||||
}
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("邮件发送成功,收件人地址:{}", receiver);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info(receiver);
|
||||
log.error("邮件发送失败###{},收件人地址:{}", e.toString(), receiver);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ai.da.model.dto.GetNotificationDTO;
|
||||
import com.ai.da.model.vo.NotificationVO;
|
||||
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||
import com.ai.da.service.MessageCenterService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -60,4 +61,12 @@ public class MessageCenterController {
|
||||
messageCenterService.setReadAll(type);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@Hidden
|
||||
@Operation(summary = "卖家审批结果站内信通知")
|
||||
@PostMapping("/sellerApprovalNotice")
|
||||
public Response<String> sellerApprovalNotice(@RequestParam("userId") Long userId, @RequestParam("isApproved") boolean isApproved) {
|
||||
messageCenterService.sellerApprovalNotice(userId, isApproved);
|
||||
return Response.success("success");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface MessageCenterService extends IService<Notification> {
|
||||
void publishSystemNotification(PublishSysNotificationDTO message);
|
||||
|
||||
void videoFinishedMsg(Long userId, String projectName, boolean isSuccess);
|
||||
|
||||
void sellerApprovalNotice(Long userId, boolean isApproved);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.utils.SendEmailUtil;
|
||||
import com.ai.da.common.websocket.NotificationConnection;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
@@ -441,4 +442,50 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
pushMessage("system", userId);
|
||||
}
|
||||
|
||||
private final static String APPROVED_MESSAGE = "尊敬的用户,您的卖家权限已开通。" +
|
||||
"现在可通过“成为卖家”的同一入口进入卖家中心。\\n在卖家中心中,您可以:" +
|
||||
"\\n·从设计项目中批量选择服装设计,并创建上架内容 " +
|
||||
"\\n·将设计及高级工具媒体转为可售卖的数字商品 " +
|
||||
"\\n·编辑、保存、发布并管理商品状态" +
|
||||
"\\n\\nDear User, your seller access has been enabled. " +
|
||||
"You can now enter the Seller Dashboard from the same entry point used to become a seller.\\nIn the Seller Dashboard, you can:" +
|
||||
"\\n·Batch select apparel designs from a design project and create listings" +
|
||||
"\\n·Turn designs and Advanced Tools media into sellable digital items " +
|
||||
"\\n·Edit, save, publish, and manage item status";
|
||||
|
||||
private final static String REJECTED_MESSAGE = "尊敬的用户,您的卖家权限申请审批未通过。 请检查您提交的信息,并确保您的卖家资料符合平台要求。您可以更新相关信息后重新提交申请。\\n\\n" +
|
||||
"Dear User, your seller access request was not approved. Please review the information you submitted and make sure your seller profile meets the platform requirements. You may update the relevant information and resubmit your application.";
|
||||
|
||||
public void sellerApprovalNotice(Long userId, boolean isApproved) {
|
||||
if (userId != null && userId != 0) {
|
||||
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
|
||||
Notification notification = new Notification();
|
||||
notification.setType("system");
|
||||
notification.setReceiverId(userId);
|
||||
if (isApproved) {
|
||||
sysNotificationDTO.setTitle("卖家权限审批通过 Seller Access Enabled");
|
||||
sysNotificationDTO.setContent(APPROVED_MESSAGE);
|
||||
|
||||
} else {
|
||||
sysNotificationDTO.setTitle("卖家权限审批不通过 Seller Access Not Approved");
|
||||
sysNotificationDTO.setContent(REJECTED_MESSAGE);
|
||||
|
||||
}
|
||||
notification.setContent(JSON.toJSONString(sysNotificationDTO));
|
||||
notification.setIsRead(0);
|
||||
notification.setCreateTime(LocalDateTime.now());
|
||||
// 保存消息内容
|
||||
save(notification);
|
||||
// 推送系统消息
|
||||
pushMessage("system", userId);
|
||||
|
||||
Account account = accountService.getById(userId);
|
||||
if (account != null) {
|
||||
// 发送邮件
|
||||
SendEmailUtil.sellerApproval(account.getUserEmail(), isApproved);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user