package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.domain.AirData;
import com.tuoheng.admin.entity.request.report.ExportReportRequest;
import com.tuoheng.admin.service.airData.IAirDataService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author ChengWang
 * @Date 2023/5/23
 */
@Slf4j
@RestController
@RequestMapping("/airData")
public class AirDataController {

    @Autowired
    private IAirDataService airDataService;

    /**
     * 获取列表
     */
    @GetMapping("/list")
    public JsonResult getList() {
        return null;
    }

    /**
     * 根据任务id获取大气数据列表
     *
     * @param id
     * @return
     */
    @GetMapping("/list/{id}")
    public JsonResult getList(@PathVariable("id") String id) {
        return airDataService.getAirDataList(id);
    }

    /**
     * 生成并导出excel表格
     */
    @GetMapping("/generateTable/{id}")
    public JsonResult generateTableById(@PathVariable("id") String id) {
        return airDataService.generateTable(id);
    }

    /**
     * 导出报告
     */
    @PostMapping("/export")
    public JsonResult exportReport(@RequestBody ExportReportRequest request) {
//        log.info("进入导出报告接口");
        return airDataService.exportReport(request);
    }

}
