package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.log.annotation.Log;
import com.usky.common.log.enums.BusinessType;
import com.usky.fire.domain.BaseGgpFacility;
import com.usky.fire.service.ReportIndexResultService;
import com.usky.fire.service.vo.CompanyDataVo;
import com.usky.fire.service.vo.IndexResultVo;
import com.usky.fire.service.vo.ReportResultVO;
import com.usky.fire.service.vo.ResultStatisticsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 指数结果表 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-06-27
 */
@RestController
@RequestMapping("/reportIndexResult")
public class ReportIndexResultController {
    @Autowired
    private ReportIndexResultService reportIndexResultService;
    /**
     * 报告指数结果
     *
     * @return
     */
    @GetMapping("/countResult")
    public ApiResult<Void> countResult() {
        reportIndexResultService.reportIndexResult();
        return ApiResult.success();
    }

    /**
     * 报告指数结果-查询
     *
     * @param id   对象ID
     * @param createDate   生成日期
     * @return
     */
    @GetMapping("/indexResultSelect")
    public ApiResult<List<IndexResultVo>> indexResultSelect(@RequestParam(value = "id", required = false) Integer id,
                                                            @RequestParam(value = "createDate", required = false) String createDate) {
        return ApiResult.success(reportIndexResultService.indexResultSelect(id,createDate));
    }

    /**
     * 报告对比
     *
     * @param reportResultVO
     * @return
     */
    @PostMapping("/reportContrast")
    public ApiResult<List<Object>> reportContrast(@RequestBody ReportResultVO reportResultVO) {
        return ApiResult.success(reportIndexResultService.reportContrast(reportResultVO));
    }

    /**
     * 企业自主管理大屏-企业自主情况查询
     *
     * @param id   对象ID
     * @param createDate   生成日期
     * @return
     */
    @GetMapping("/resultStatistic")
    public ApiResult<List<ResultStatisticsVO>> resultStatistic(@RequestParam(value = "id", required = false) Integer id,
                                                               @RequestParam(value = "createDate", required = false) String createDate) {
        return ApiResult.success(reportIndexResultService.resultStatistic(id,createDate));
    }

    /**
     * 企业自主管理大屏-四色分级撒点
     * @param riskGrade   风险等级
     * @return
     */
    @GetMapping("/riskGradeScatter")
    public ApiResult<List<Object>> riskGradeScatter(@RequestParam(value = "riskGrade") Integer riskGrade) {
        return ApiResult.success(reportIndexResultService.riskGradeScatter(riskGrade));
    }
}

