package com.tuoheng.admin.service.airData;

import com.tuoheng.admin.entity.domain.AirData;
import com.tuoheng.admin.entity.request.report.ExportReportRequest;
import com.tuoheng.admin.entity.third.LingXiuDataResponse;
import com.tuoheng.admin.mapper.AirDataMapper;
import com.tuoheng.admin.service.airData.query.QueryAirDataListService;
import com.tuoheng.admin.service.airData.report.ExportReportService;
import com.tuoheng.admin.service.airData.syncdata.SyncAirDataService;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author ChengWang
 * @Date 2023/5/23
 */
@Service
@Slf4j
public class AirDataServiceImpl extends BaseServiceImpl<AirDataMapper, AirData> implements IAirDataService {

    @Autowired
    private ExportReportService eportReportService;

    @Autowired
    private QueryAirDataListService queryAirDataListService;

    @Autowired
    private SyncAirDataService syncAirDataService;

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

    /**
     * 生成excel表格并下载
     *
     * @param id
     */
    @Override
    public JsonResult generateTable(String id) {
        return queryAirDataListService.generateTable(id);
    }

    /**
     * 同步数据
     *
     * @return
     */
    public JsonResult syncData(LingXiuDataResponse response) {
        return syncAirDataService.sync(response);
    }

    /**
     * 导出报告
     *
     * @return
     */
    public JsonResult exportReport(ExportReportRequest request) {
        return eportReportService.exportReport(request);
    }
}
