package com.project.zcustom.controller.service;

import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.controller.core.BaseController;
import com.project.zcustom.service.basics.IPlatAppOrgService;
import com.project.zcustom.service.build.IPlatBuildParamsService;
import com.project.zcustom.service.build.IPlatBuildYearTrendService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 楼宇接口Controller
 *
 * @author change
 * @date 2024-10-21
 */
@RestController
@RequestMapping("/build")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PlatBuildController extends BaseController {

    private final IPlatBuildYearTrendService iPlatBuildYearTrendService;
    private final IPlatBuildParamsService iPlatBuildParamsService;
    private final IPlatAppOrgService iPlatAppOrgService;



    @RequestMapping("/carbonEmissionStatistics")
    public AjaxResult carbonEmissionStatistics() {
        return AjaxResult.success("查询成功", iPlatBuildYearTrendService.getLineStatisticsYearTrendData(0));
    }

    @RequestMapping("/powerForMonth")
    public AjaxResult powerForMonth() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.powerForMonth());
    }

    @RequestMapping("/energyForYear")
    public AjaxResult energyForYear() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.energyForYear());
    }

    @RequestMapping("/energyStatistics")
    public AjaxResult energyStatistics() {
        return AjaxResult.success("查询成功", iPlatBuildYearTrendService.getLineStatisticsYearTrendData(1));
    }

    @RequestMapping("/useHeatGas")
    public AjaxResult useHeatGas(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.useHeatGas(appOrg));
    }

    @RequestMapping("/dataCenterRoom")
    public AjaxResult dataCenterRoom(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.dataCenterRoom(appOrg));
    }

    @RequestMapping("/powerForYear")
    public AjaxResult powerForYear() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.powerForYear());
    }

    @RequestMapping("/electricityStatistics")
    public AjaxResult electricityStatistics() {
        return AjaxResult.success("查询成功", iPlatBuildYearTrendService.getLineStatisticsYearTrendData(2));
    }

    @RequestMapping("/heatingEnergy")
    public AjaxResult heatingEnergy(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.heatingEnergy(appOrg));
    }

    @RequestMapping("/gasInfo")
    public AjaxResult gasInfo(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.gasInfo(appOrg));
    }

    @RequestMapping("/resourceInfo")
    public AjaxResult resourceInfo(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.resourceInfo(appOrg));
    }

    @RequestMapping("/greenPowerInfo")
    public AjaxResult greenPowerInfo(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.greenPowerInfo(appOrg));
    }

    @RequestMapping("/waterForYear")
    public AjaxResult waterForYear() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.waterForYear());
    }

    @RequestMapping("/waterStatistics")
    public AjaxResult waterStatistics() {
        return AjaxResult.success("查询成功", iPlatBuildYearTrendService.getLineStatisticsYearTrendData(3));
    }

    @RequestMapping("/officeCarbonForYear")
    public AjaxResult officeCarbonForYear() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.officeCarbonForYear());
    }

    @RequestMapping("/nonHeatingEnergyForYear")
    public AjaxResult nonHeatingEnergyForYear() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.nonHeatingEnergyForYear());
    }

    @RequestMapping("/usePowerStatistics")
    public AjaxResult usePowerStatistics() {
        return AjaxResult.success("查询成功", iPlatBuildYearTrendService.getLineStatisticsYearTrendData(4));
    }

    @RequestMapping("/officeCarbonForFloor")
    public AjaxResult officeCarbonForFloor() {
        return AjaxResult.success("查询成功", iPlatBuildParamsService.selectPlatBuildParamsListByField("type","12"));
    }
}
