package com.docus.server.archivefile.controller;

import com.docus.infrastructure.web.request.SearchRequest;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.archivefile.TaskMessageApi;
import com.docus.server.archivefile.service.ITaskMessageService;
import com.docus.server.enums.CollectTypeEnum;
import com.docus.server.vo.archivefile.TaskMessageVO;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 被动接收任务表 Controller
 * Generated on  2023-06-28
 */
@RestController
public class TaskMessageController implements TaskMessageApi {
    @Resource
    private ITaskMessageService taskMessageService;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return实体
     */
    @Override
    public TaskMessageVO find(String id) {
        return taskMessageService.findById(id);
    }

    /**
     * 关键字搜素
     *
     * @param searchRequest 搜索参数
     * @return 分页列表
     */
    @Override
    public PageResult<TaskMessageVO> search(SearchRequest searchRequest) {
        return taskMessageService.search(searchRequest);
    }

    /**
     * 批量重试
     *
     * @param searchRequest 搜索参数
     */
    @Override
    public void searchRetry(SearchRequest searchRequest) throws Exception {
        taskMessageService.searchRetry(searchRequest);
    }

    /**
     * 根据主键批量重试
     */
    @Override
    public void findRetry(List<Long> ids) throws Exception {
        taskMessageService.findRetry(ids);
    }

    @Override
    public CollectTypeEnum[] findType() {
        return CollectTypeEnum.values();
    }
}
