package com.tuoheng.admin.service.report;

import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import com.tuoheng.admin.service.report.export.ExportInspectionHandleReportService;
import com.tuoheng.admin.service.report.export.ExportInspectionReportService;
import com.tuoheng.admin.service.report.generate.GenerateReportService;
import com.tuoheng.admin.service.report.query.QueryInspectionHandleReportService;
import com.tuoheng.admin.service.report.query.QueryInspectionReportService;
import com.tuoheng.admin.service.report.query.QueryReportPageListService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Service
public class IReportServiceImpl implements IReportService{

    @Autowired
    private GenerateReportService generateReportService;

    @Autowired
    private QueryReportPageListService queryReportPageListService;

    @Autowired
    private QueryInspectionReportService queryInspectionReportService;

    @Autowired
    private QueryInspectionHandleReportService queryInspectionHandleReportService;

    @Autowired
    private ExportInspectionReportService exportInspectionReportService;

    @Autowired
    private ExportInspectionHandleReportService exportInspectionHandleReportService;

    /**
     *
     * 生成报告
     *
     * @param id
     * @return
     */
    @Override
    public JsonResult generate(String id) {
        return generateReportService.generateByManual(id);
    }

    /**
     *
     * 查询报告分页列表
     *
     * @return
     */
    @Override
    public JsonResult getPageList(QueryReportPageListRequest request) {
        return queryReportPageListService.getPageList(request);
    }

    /**
     *
     * 查询巡检报告
     *
     * @return
     */
    @Override
    public JsonResult getInspectionReport(String id) {
        return queryInspectionReportService.getInspectionReport(id);
    }

    /**
     *
     * 查询巡检处理报告
     *
     * @return
     */
    @Override
    public JsonResult getInspectionHandleReport(String id) {
        return queryInspectionHandleReportService.getInspectionHandleReport(id);
    }

    /**
     *
     * 导出巡检报告
     *
     * @return
     */
    @Override
    public void exportInspectionReport(HttpServletRequest request, HttpServletResponse response, String id) {
        exportInspectionReportService.exportReport(response, id);
    }

    /**
     *
     * 导出巡检处理报告
     *
     * @return
     */
    @Override
    public void exportInspectionHandleReport(HttpServletRequest request, HttpServletResponse response, String id) {
        exportInspectionHandleReportService.exportReport(response, id);
    }
}
