package com.docus.server.controller;

import com.docus.server.api.collector.update.CollectorUpdateApi;
import com.docus.server.common.service.IFileUploadService;
import com.docus.server.service.ICollectorUpdateService;
import com.docus.server.vo.collector.update.CollectorUpdateVersionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 患者信息表 控制器类
 *
 * @author AutoGenerator
 * @since 2023-08-29
 */
@Api(value = "采集器更新配置", tags = "采集器更新配置")
@RestController
public class CollectorUpdateController implements CollectorUpdateApi {
    @Resource
    private ICollectorUpdateService iCollectorUpdateService;
    @Resource
    private IFileUploadService iFileUploadService;

    /**
     * 获取采集器版本号
     */
    @ApiOperation("获取采集器版本号")
    @Override
    public CollectorUpdateVersionVO find() throws Exception {
        return iCollectorUpdateService.find();
    }

    /**
     * 采集器部署包下载
     */
    @ApiOperation("采集器部署包下载")
    @Override
    public void downloadFile(HttpServletResponse response) throws Exception {

        String filePath = iCollectorUpdateService.getFilePath();

        iFileUploadService.downloadFile(filePath, response);
    }
}
