package com.ruoyi.system.service; import com.ruoyi.system.domain.NotifyTask; import java.util.List; /** * 通知任务服务接口 * * @author ruoyi * @date 2025-12-07 */ public interface INotifyTaskService { /** * 查询通知任务 * * @param id 主键ID * @return 通知任务 */ NotifyTask selectNotifyTaskById(Long id); /** * 查询通知任务列表 * * @param notifyTask 查询条件 * @return 通知任务列表 */ List selectNotifyTaskList(NotifyTask notifyTask); /** * 查询待处理的通知任务 * * @param limit 查询数量限制 * @return 待处理的通知任务列表 */ List selectPendingNotifyTasks(int limit); /** * 检查通知任务是否已存在(防重) * * @param taskId 业务任务ID * @param userId 用户ID * @param notifyType 通知类型 * @return true=已存在, false=不存在 */ boolean existsNotifyTask(Long taskId, Long userId, String notifyType); /** * 创建通知任务(带防重) * 如果已存在则返回null,否则创建并返回 * * @param notifyTask 通知任务 * @return 创建的通知任务,如果已存在返回null */ NotifyTask createNotifyTask(NotifyTask notifyTask); /** * 批量创建通知任务 * * @param notifyTasks 通知任务列表 * @return 成功创建的数量 */ int createNotifyTasks(List notifyTasks); /** * 修改通知任务 * * @param notifyTask 通知任务 * @return 影响行数 */ int updateNotifyTask(NotifyTask notifyTask); /** * 更新通知任务状态为处理中 * * @param id 主键ID * @return 影响行数 */ int markProcessing(Long id); /** * 更新通知任务状态为完成 * * @param id 主键ID * @return 影响行数 */ int markCompleted(Long id); /** * 更新通知任务状态为失败 * * @param id 主键ID * @param errorMsg 错误信息 * @return 影响行数 */ int markFailed(Long id, String errorMsg); /** * 增加重试次数 * * @param id 主键ID * @return 影响行数 */ int incrementRetryCount(Long id); /** * 删除通知任务 * * @param id 主键ID * @return 影响行数 */ int deleteNotifyTaskById(Long id); /** * 批量删除通知任务 * * @param ids 主键ID数组 * @return 影响行数 */ int deleteNotifyTaskByIds(Long[] ids); }