package com.energy.manage.service.controller.analysisresultreport;

import com.energy.manage.common.reponse.ResultResp;
import com.energy.manage.service.controller.base.BaseServiceController;
import com.energy.manage.service.domain.vo.analysis.AnalysisResultReportVo;
import com.energy.manage.service.service.analysis.AnalysisResultReportService;
import com.energy.manage.service.util.IPUtils;
import com.energy.manage.service.util.NetUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author chy
 * @date 2024/9/20 18:17
 * @desc
 */
@RestController
@RequestMapping("/analysisResultReport")
public class AnalysisResultReportController extends BaseServiceController {


    @Autowired
    private AnalysisResultReportService analysisResultReportService;

    /**
     * 批量添加保存报告
     * @param reportVoList
     * @return
     */
    @PostMapping("/saveReportBatch")
    public ResultResp saveReportBatch(@RequestBody List<AnalysisResultReportVo> reportVoList)
    {
        return success(analysisResultReportService.saveReportBatch(reportVoList));
    }

    @GetMapping("/getRportType")
    public ResultResp getRportType(HttpServletRequest request)
    {
        boolean isIntranet = NetUtils.isIntranet(IPUtils.getIpAddr(request));
        return success(analysisResultReportService.getRportType(isIntranet));
    }

}
