package com.jianshui.web.controller.platform;

import com.jianshui.common.constant.InvoiceCommonConstants;
import com.jianshui.platform.service.InvoiceDownloadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: kane
 * @Description: 发票批量下载接口
 * @CreateTime: 2023-06-08  14:27
 * @Version: 1.0
 **/
@Api(tags = "发票批量下载")
@RestController
@RequestMapping("/platForm/invoiceDownLoad")
public class InvoiceDownloadController {

    @Autowired
    private InvoiceDownloadService invoiceDownloadService;
    @ApiOperation("发票批量下载")
    @GetMapping("/dowmLoad/{ids}/{status}")
    public Object downLoad(@PathVariable Long[] ids,@PathVariable String status,HttpServletResponse response){
        if (InvoiceCommonConstants.PDFSTATUS.equals(status)){
            //pdf下载
            return invoiceDownloadService.dowmLoadPdf(ids,response);
        }else {
            //ofd下载
            return invoiceDownloadService.dowmLoadOfd(ids,response);
        }
    }

}
