package com.trade.client.trade.exportrebate.controller;

import com.trade.client.trade.exportrebate.dto.ExportTaxRebateDetailsDto;
import com.trade.common.core.domain.ResponseResult;
import com.trade.common.core.page.GridPage;
import com.trade.service.trade.exportrebate.dto.ExportTaxRebateStatisticDto;
import com.trade.service.trade.exportrebate.dto.search.ExportTaxRebateDetailsForCSearchDto;
import com.trade.service.trade.exportrebate.dto.search.TaxRebateSearchDto;
import org.springframework.web.bind.annotation.*;
import com.trade.client.trade.exportrebate.service.ExportTaxRebateService;

import javax.annotation.Resource;

/**
 * 出口退税接口
 *
 * @author hlb
 * @since 2024-10-22 15:46:16
 */
@RestController
@RequestMapping("/taxRebate")
public class ExportTaxRebateController {

    /**
     * 服务对象
     */
    @Resource
    private ExportTaxRebateService exportTaxRebateService;

    /**
     * 分页查询出口退税明细
     *
     * @param search 查询实体
     * @return 所有数据
     */
    @GetMapping("/pages")
    public ResponseResult<GridPage<ExportTaxRebateStatisticDto>> getPages(TaxRebateSearchDto search) {
        return ResponseResult.success(exportTaxRebateService.getPagesBySearch(search));
    }

    /**
     * 查询出口退税明细详情
     *
     * @param search 查询实体
     * @return 详情
     */
    @GetMapping("/details")
    public ResponseResult<ExportTaxRebateDetailsDto> getDetails(ExportTaxRebateDetailsForCSearchDto search) {
        return ResponseResult.success(exportTaxRebateService.getDetails(search));
    }
    /**
     * 重定向小图进行退税
     */
    @GetMapping("/doTaxRebate")
    public ResponseResult<String> doTaxRebate() {
        String taxRebateUrl = exportTaxRebateService.getTaxRebateUrl();
        return ResponseResult.success(taxRebateUrl);
    }
}
