package com.njcn.event.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.event.pojo.param.EventTypeParam;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO;
import com.njcn.event.service.majornetwork.RStatEventOrgMService;
import com.njcn.event.service.majornetwork.RStatEventOrgQService;
import com.njcn.event.service.majornetwork.RStatEventOrgYService;
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.*;

import java.util.List;

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

    private final RStatEventOrgYService rStatEventOrgYService;
    private final RStatEventOrgQService rStatEventOrgQService;
    private final RStatEventOrgMService rStatEventOrgMService;


    /**
     * 查询查询监测点暂态指标 日/月点数
     */
    @GetMapping("/getAllRStatEventOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询暂态累计超标监测点数")
    public HttpResult<List<RArrayVO>> getAllRStatEventOrg(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatEventOrg");
        List<RArrayVO> rStatHarmonicOrgAll = null;
        String string = param.getType().toString();
        switch (string) {
            //查询超标监测点数-年数据
            case BizParamConstant.STAT_BIZ_YEAR:
                rStatHarmonicOrgAll = rStatEventOrgYService.getRStatEventOrgOldYAll(param,1);
                break;
            //查询超标监测点数-季数据
            case BizParamConstant.STAT_BIZ_QUARTER:
                rStatHarmonicOrgAll = rStatEventOrgQService.getRStatEventOrgQAll(param);
                break;
            //查询超标监测点数-月数据
            case BizParamConstant.STAT_BIZ_MONTH:
                rStatHarmonicOrgAll = rStatEventOrgMService.getRStatEventOrgMAll(param);
                break;
            default:
                break;
        }
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicOrgAll, methodDescribe);
    }

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

    @PostMapping("/getEventOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询当前部门暂态指标信息")
    public HttpResult<List<RArrayVO>> getEventOrg(@RequestBody EventTypeParam param) {
        String methodDescribe = getMethodDescribe("getEventOrg");
        List<RArrayVO>   list = rStatEventOrgMService.getEventOrg(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }
}

