package com.njcn.device.pms.controller.majornetwork;


import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.SpecialAnalysisParam;
import com.njcn.device.pms.pojo.vo.SpecialAnalysisMonitorVO;
import com.njcn.device.pms.service.majornetwork.SpecialAnalysisService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 专项分析-地图展示数据
 * </p>
 *
 * @author wr
 * @since 2022-11-30
 */
@RestController
@Api(tags = "专项分析-地图展示数据")
@RequiredArgsConstructor
@RequestMapping("/SpecialAnalysisController")
public class SpecialAnalysisController extends BaseController {

    private final SpecialAnalysisService specialAnalysisService;

    /**
     * 获取专项分析-地图展示数据
     *
     * @param param 前端传入参数
     * @return 专项分析-地图展示数据
     */
    @PostMapping("/getMapDisplay")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("地图展示数据-地图监测点(风电场，光伏电站，冶炼负荷)")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<SpecialAnalysisMonitorVO> getMapDisplay(@RequestBody SpecialAnalysisParam param) {
        String methodDescribe = getMethodDescribe("getMapDisplay");
        SpecialAnalysisMonitorVO sm = specialAnalysisService.getMonitorList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sm, methodDescribe);
    }

    /**
     * 获取专项分析-地图展示数据
     *
     * @param param 前端传入参数
     * @return 专项分析-地图展示数据
     */
    @PostMapping("/getYoYList")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("地图展示数据-数据同比环比(风电场，光伏电站，冶炼负荷)")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<SpecialAnalysisMonitorVO.CompareDetailVO> getYoYList(@RequestBody SpecialAnalysisParam.CompareDateParam param) {
        String methodDescribe = getMethodDescribe("getYoYList");
        SpecialAnalysisMonitorVO.CompareDetailVO vo = specialAnalysisService.getYoYList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
    }

    /**
     * 获取专项分析-地图展示数据
     *
     * @return 专项分析-地图展示数据
     */
    @PostMapping("/getDisplayRailway")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("地图展示数据-地图监测点(电气化铁路)")
    public HttpResult<Map<String, List<SpecialAnalysisMonitorVO.SpecialAnalysisRailwayVO>>> getDisplayRailway() {
        String methodDescribe = getMethodDescribe("getDisplayRailway");
        Map<String, List<SpecialAnalysisMonitorVO.SpecialAnalysisRailwayVO>> sm = specialAnalysisService.getDisplayRailway();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sm, methodDescribe);
    }

    /**
     * 获取专项分析-地图展示数据
     *
     * @param param 前端传入参数
     * @return 专项分析-地图展示数据
     */
    @PostMapping("/getMapDisplayRailway")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("地图展示数据-按电压展示数据(电气铁路)")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SpecialAnalysisMonitorVO.CompareVO>> getMapDisplayRailway(@RequestBody SpecialAnalysisParam.CompareParam param) {
        String methodDescribe = getMethodDescribe("getMapDisplayRailway");
        List<SpecialAnalysisMonitorVO.CompareVO> sm = specialAnalysisService.getMapDisplayRailway(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sm, methodDescribe);
    }

    /**
     * 获取专项分析-地图展示数据
     *
     * @param param 前端传入参数
     * @return 专项分析-地图展示数据
     */
    @PostMapping("/getWiringTypeRailway")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("地图展示数据-按接线类型展示(电气化铁路)")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SpecialAnalysisMonitorVO.WiringTypeDetail>> getWiringTypeRailway(@RequestBody SpecialAnalysisParam.CompareDateParam param) {
        String methodDescribe = getMethodDescribe("getWiringTypeRailway");
        List<SpecialAnalysisMonitorVO.WiringTypeDetail> sm = specialAnalysisService.getWiringTypeRailway(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sm, methodDescribe);
    }


}

