package com.njcn.harmonic.controller.majornetwork;


import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.RStatHarmonicMParam;
import com.njcn.harmonic.pojo.vo.RArrayVO;
import com.njcn.harmonic.pojo.vo.RIconVO;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgMService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgQService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-14
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-各单位分类总览")
@RequestMapping("/harmonic/rStatHarmonicOrg")
public class RStatHarmonicOrgController extends BaseController {

    private final RStatHarmonicOrgYService rStatHarmonicOrgYService;
    private final RStatHarmonicOrgQService rStatHarmonicOrgQService;
    private final RStatHarmonicOrgMService rStatHarmonicOrgMService;

    /**
     * 查询查询监测点稳态指标 日/月点数
     */
    @GetMapping("/getAllRStatHarmonicOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询稳态累计超标监测点数")
    public HttpResult<List<RArrayVO>> getAllRStatHarmonicOrg(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatHarmonicOrg");
        List<RArrayVO> rStatHarmonicOrgMAll = null;
        String string = param.getType().toString();
        switch (string) {
            //查询各单位累计超标监测点数-年数据
            case BizParamConstant.STAT_BIZ_YEAR:
                rStatHarmonicOrgMAll = rStatHarmonicOrgYService.getPwRStatHarmonicYOldAll(param, 1);
                break;
            //查询各单位累计超标监测点数-季数据
            case BizParamConstant.STAT_BIZ_QUARTER:
                rStatHarmonicOrgMAll = rStatHarmonicOrgQService.getRStatHarmonicQAll(param);
                break;
            //查询各单位累计超标监测点数-月数据
            case BizParamConstant.STAT_BIZ_MONTH:
                rStatHarmonicOrgMAll = rStatHarmonicOrgMService.getRStatHarmonicMAll(param);
                break;
            default:
                break;
        }
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicOrgMAll, methodDescribe);
    }


    /**
     * 查询查询监测点稳态指标 日/月点数
     */
    @GetMapping("/getAllRStatHarmonicOrgIcon")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询稳态各单位超标监测统计图")
    public HttpResult<List<RIconVO>> getAllRStatHarmonicOrgIcon(RStatHarmonicMParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatHarmonicOrgIcon");
        List<RIconVO> getAllRStatHarmonicOrgIcon = null;
        String string = param.getType().toString();
        switch (string) {
            //查询各单位累计超标监测点数统计图-年数据
            case BizParamConstant.STAT_BIZ_YEAR:
                getAllRStatHarmonicOrgIcon = rStatHarmonicOrgYService.getPwRStatHarmonicOrgYOldIcon(param, 1);
                break;
            //查询各单位累计超标监测点数-季数据
            case BizParamConstant.STAT_BIZ_QUARTER:
                getAllRStatHarmonicOrgIcon = rStatHarmonicOrgQService.getRStatHarmonicOrgQIcon(param);
                break;
            //查询各单位累计超标监测点数-月数据
            case BizParamConstant.STAT_BIZ_MONTH:
                getAllRStatHarmonicOrgIcon = rStatHarmonicOrgMService.getRStatHarmonicOrgMIcon(param);
                break;
            default:
                break;
        }
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, getAllRStatHarmonicOrgIcon, methodDescribe);
    }

}

