package cn.cecep.talroad.controller;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.common.security.utils.SecurityUtils;
import cn.cecep.talroad.service.HomePageMapService;
import cn.cecep.talroad.vo.BMainEmissionAndstatusScaleVo;
import cn.cecep.talroad.vo.DistributionOfMajorEmittersVo;
import cn.cecep.talroad.vo.EnvironmentCreditPropVo;
import cn.cecep.talroad.vo.ImportPollutionDischargeVo;
import cn.cecep.talroad.vo.homepage.HpmCompanyOverviewVo;
import cn.cecep.talroad.vo.homepage.HpmMeriRatingOverviewVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * * 开发公司：中节能天融科技有限公司
 * 企业基本信息Controller 控制层
 *
 * @author szhpt
 * @date 2023-01-11*/
@Api(tags = "企业精准画像")
@RestController
@RequestMapping("/pcFactoryAccuratePortrait")
public class PcFactoryAccuratePortraitController {

    @Autowired
    private HomePageMapService homePageMapService;

    @ApiOperation(value = "企业总览")
    @GetMapping("/companyOverview")
    public AjaxResults<HpmCompanyOverviewVo> companyOverview() {
        String regionCode = SecurityUtils.getLoginUser().getSysUser().getRegionCode();
        return AjaxResults.success(homePageMapService.selectCompanyOverview(null,regionCode));
    }

    @ApiOperation(value = "排放大户分布")
    @GetMapping("/rankingStat")
    @ApiImplicitParam(name = "pollutantType", value = "污染物类型", dataType = "String", required = true)
    public AjaxResults<DistributionOfMajorEmittersVo> rankingStat(String pollutantType) {
        String regionCode = SecurityUtils.getLoginUser().getSysUser().getRegionCode();
        return AjaxResults.success(homePageMapService.selectRankingStat(pollutantType, regionCode));
    }

    @ApiOperation(value = "排放监测及排放情况-大气和废水手工自动占比")
    @GetMapping("/emissionAndstatusScale")
    public AjaxResults<BMainEmissionAndstatusScaleVo> emissionAndstatusScale() {
        return AjaxResults.success(homePageMapService.selectEmissionAndstatusScale(null));
    }

    @ApiOperation(value = "排放监测及排放情况 - 涉水涉气监控类型")
    @GetMapping("/emissionMonitoringType")
    public AjaxResults<HpmCompanyOverviewVo> emissionMonitoringType() {
        ConcurrentHashMap<Object, Object> concurrentHashMap = new ConcurrentHashMap<>();
        return AjaxResults.success(homePageMapService.selectCompanyOverview(null,null));
    }

    @ApiOperation(value = "排放监测及排放情况 - 超标数量柱状图")
    @GetMapping("/emissionMonitoringOverstep")
    public AjaxResults<HpmCompanyOverviewVo> emissionMonitoringOverstep() {
        return AjaxResults.success(homePageMapService.selectCompanyOverview(null,null));
    }

    @ApiOperation(value = "企业管理特征总览 - 重点排污单位")
    @GetMapping("/companyOverview/importPollutionDischarge")
    public AjaxResults<List<ImportPollutionDischargeVo>> importPollutionDischarge() {
        String regionCode = SecurityUtils.getLoginUser().getSysUser().getRegionCode();
        return AjaxResults.success(homePageMapService.selectImportPollutionDischarge(regionCode));
    }

    @ApiOperation(value = "企业绩效评级")
    @GetMapping("/meritRatingOverview")
    public AjaxResults<HpmMeriRatingOverviewVo> meritRatingOverview() {
        String regionCode = SecurityUtils.getLoginUser().getSysUser().getRegionCode();
        HpmMeriRatingOverviewVo hrov = homePageMapService.selectMeritRatingOverview(null,regionCode);
        return AjaxResults.success(hrov);
    }

    @ApiOperation(value = "生态环境信用占比")
    @GetMapping("/proportionOfEcologicalEnvironmentCredit")
    public AjaxResults<EnvironmentCreditPropVo> proportionOfEcologicalEnvironmentCredit() {
        return AjaxResults.success(homePageMapService.selectProportionOfEcologicalEnvironmentCredit());
    }

    @ApiOperation(value = "超低排放管理")
    @GetMapping("/ultraLowEmissions")
    public AjaxResults<HpmCompanyOverviewVo> ultraLowEmissions() {
        return AjaxResults.success(homePageMapService.selectCompanyOverview(null,null));
    }

}
