package com.njcn.harmonic.controller.distribution;


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.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

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

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

    /**
     * 查询查询监测点稳态指标 日/月点数
     */
    @PostMapping("/getPwRStatHarmonicOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询稳态累计超标监测点数")
    @ApiImplicitParam(name = "param", value = "累计超标监测点数参数", required = true)
    public HttpResult<List<RArrayVO>> getPwRStatHarmonicOrg(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwRStatHarmonicOrg");
        List<RArrayVO> org = null;
        String string = param.getType().toString();
        switch (string) {
            //查询各单位累计超标监测点数-年数据
            case BizParamConstant.STAT_BIZ_YEAR:
                org = rStatHarmonicOrgYService.getPwRStatHarmonicYOldAll(param, 2);
                break;
            //查询各单位累计超标监测点数-季数据
            case BizParamConstant.STAT_BIZ_QUARTER:
                org = rStatHarmonicOrgQService.getPwRStatHarmonicQAll(param);
                break;
            //查询各单位累计超标监测点数-月数据
            case BizParamConstant.STAT_BIZ_MONTH:
                org = rStatHarmonicOrgMService.getPwRStatHarmonicMAll(param);
                break;
            default:
                break;
        }
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, org, methodDescribe);
    }


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

}

