package com.tofly.xrtygis.custom.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.service.CustomTheMapService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 综合展示-专题图
 *
 * @author 陈浩
 * @date 2021/4/15
 */
@RestController
@AllArgsConstructor
@RequestMapping("/theMap")
@Api(tags = "综合展示-专题图")
public class CustomTheMapController {

    private final CustomTheMapService customTheMapService;

    @GetMapping("/getAllAreaWater")
    @ApiOperation("专题图-查看全部片区水量")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year",value = "年份,可传多个",required = true,dataType = "string"),
            @ApiImplicitParam(name = "startMon",value = "开始月份",required = true,dataType = "string"),
            @ApiImplicitParam(name = "endMon",value = "结束月份",required = true,dataType = "string")
    })
    public ResultRespone getAllAreaWater(Page page, String year, String startMon, String endMon) {
        return ResultRespone.success(customTheMapService.getAllAreaWater(page, year, startMon, endMon));
    }

    @GetMapping("/areaComparison")
    @ApiOperation("专题图-片区水量同期比对")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startyear",value = "开始年份",required = true,dataType = "string"),
            @ApiImplicitParam(name = "endyear",value = "结束年份",required = true,dataType = "string"),
            @ApiImplicitParam(name = "month",value = "月份",required = true,dataType = "string")
    })
    public ResultRespone areaComparison(Page page, String startyear, String endyear, String month){
        return ResultRespone.success(customTheMapService.areaComparison(page, startyear, endyear, month));
    }

    @GetMapping("/viewWaterAbout")
    @ApiOperation("水质水压专题图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tycd", value = "指标类别编码", required = true, dataType = "string"),
            @ApiImplicitParam(name = "start", value = "开始时间（精确到秒）", required = true, dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束时间（精确到秒）", required = true, dataType = "string")
    })
    public ResultRespone viewWaterAbout(String tycd, String start, String end) {
        return ResultRespone.success(customTheMapService.viewWaterTheMap(tycd, start, end));
    }

    @GetMapping("/viewStation")
    @ApiOperation("查看测站坐标信息")
    public ResultRespone viewStationInfo(String tycd,String start,String end){
        return ResultRespone.success(customTheMapService.viewStationInfo(tycd,start,end));
    }

    @GetMapping("getAreaWater")
    @ApiOperation("获取片区水量")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "level",value = "等级",required = true,dataType = "string"),
            @ApiImplicitParam(name = "year",value = "年份",required = true,dataType = "string"),
            @ApiImplicitParam(name = "month",value = "月份（如01，06）",required = true,dataType = "string")
    })
    public ResultRespone getAreaWater(String level, String year, String month){
        return ResultRespone.success(customTheMapService.getAreaWater(level, year, month));
    }

}
