package com.njcn.csharmonic.service.impl.event;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.template.TemplateException;
import com.baomidou.dynamic.datasource.annotation.DS;
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.CommMonitorEventReportService;
import com.njcn.event.pojo.param.ExportParam;
import lombok.RequiredArgsConstructor;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.stereotype.Service;

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



/**
 * govern
 *
 * @author cdf
 * @date 2025/12/6
 */
@Service
@RequiredArgsConstructor
@DS("sjzx")
public class CsEventMonitorReportServiceImpl implements CsEventMonitorReportService {

    private final CommMonitorEventReportService monitorEventReportService;

    private final CsLineFeignClient csLineFeignClient;



    @Override
    public void getLineExport(ExportParam exportParam,HttpServletResponse response) throws InvalidFormatException, IOException, TemplateException, ParseException {
        LineDetailDataCommDTO lineDetailDataCommDTO = new LineDetailDataCommDTO();
        LineDetailDataVO lineDetailDataVO = csLineFeignClient.getLineDetailData(exportParam.getLineId()).getData();
        BeanUtil.copyProperties(lineDetailDataVO,lineDetailDataCommDTO);
        lineDetailDataCommDTO.setIsDip(true);
        monitorEventReportService.getLineExport(exportParam,lineDetailDataCommDTO, response);
    }
}
