package com.rongwei.sfcommon.sys.service;

import com.rongwei.rwcommon.base.R;
import com.rongwei.rwcommon.vo.MailDo;
import com.rongwei.safecommon.utils.CXCommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;

import java.util.List;

/**
 * UrgingService class
 *
 * @author XH
 * @date 2024/09/13
 */
public interface UrgingService {
    @Autowired

    R emailAndNotifyUrging(List<String> ids);

    /**
     *  发送催办邮件
     * @param title 主题
     * @param content 内容
     * @param reMails 收件人
     */
    @Async("customThreadPool")
    default void sendEmail(String title,String content,String[] reMails) {
        MailDo mailDo = new MailDo();
        mailDo.setReceiveEmail(reMails);
        mailDo.setNeedTransReceive(false);
        mailDo.setCcEmail(new String[]{});
        mailDo.setSubject(title);
        mailDo.setContent(content);
        CXCommonUtils.sendTextMail(mailDo);
    }

    /**
     * 发送催办消息提醒
     *
     * @param title        消息提醒标题
     * @param content      消息提醒内容
     * @param remark       消息提醒备注
     * @param recipientIds 接收人ID
     * @param roption      目前存的是业务数据ID
     * @param notifyStatus 消息提醒类型
     */
    default void sendNotify(String title, String content,
                            List<String> recipientIds, String roption,
                            String notifyStatus) {
        // TODO:XH add 2024/9/14 需要执行的特殊逻辑
        //发送消息
        CXCommonUtils.sendNotify(title,content, null, recipientIds, roption, notifyStatus);
    }
}
