package com.njcn.csharmonic.controller;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.template.TemplateException;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
import com.njcn.csharmonic.service.event.CsEventMonitorReportService;
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
import com.njcn.event.common.service.EventMonitorReportService;
import com.njcn.event.pojo.param.ExportParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;

/**
 * govern
 *
 * @author cdf
 * @date 2025/12/6
 */
@Slf4j
@Api(tags = "暂态报告")
@RestController
@RequestMapping("/eventReport")
@RequiredArgsConstructor
public class CsEventMonitorReportController {

    private final CsEventMonitorReportService monitorEventReportService;

    private final CsLineFeignClient csLineFeignClient;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLineExport")
    @ApiOperation("监测点报告导出")
    @ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true)
    public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException {
        monitorEventReportService.getLineExport(exportParam, response);
    }
}
