package cn.cecep.talroad.controller;

import cn.cecep.talroad.common.core.web.controller.BaseController;
import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.service.IMonitoringMapService;
import cn.cecep.talroad.vo.MapPointVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * @Author: weizhuang
 * ADate:2023/2/15 10:21
 * @Version 1.0
 */
@Api(tags = "A固定源档案-企业监控地图-wz")
@RestController
@RequestMapping("/monitoringMap")
public class MonitoringMapController extends BaseController {

    @Autowired
    private IMonitoringMapService iMonitoringMapService;

    @ApiOperation(value = "门禁点位-弹窗数据")
    @GetMapping("/accessControl/pop/{factoryId}/{accessControlCode}")
    public AjaxResults<Map<String, Object>> pullAccessControlPop(@PathVariable(value = "factoryId") String factoryId,
                                                                 @PathVariable(value = "accessControlCode") String accessControlCode) {
        return AjaxResults.success(iMonitoringMapService.pullAccessControlPop(factoryId, accessControlCode));
    }

    @ApiOperation(value = "地图打点[pointType=门禁、生产监控、煤气放散监控、在线监测、无组织监控、分表计电、视频监控]")
    @GetMapping("/pullPoints/{factoryId}/{pointType}")
    public AjaxResults<List<MapPointVo>> pullPoints(@PathVariable(value = "factoryId") String factoryId,
                                                                 @PathVariable(value = "pointType") String pointType) {
        return AjaxResults.success(iMonitoringMapService.pullPoints(factoryId, pointType));
    }

    @ApiOperation(value = "煤气放散分析大屏-地图点位")
    @GetMapping("/coal/map/points")
    public AjaxResults<List<MapPointVo>> coalMapPoints(@RequestParam(value = "name", required = false) String name) {
        return AjaxResults.success(iMonitoringMapService.coalMapPoints(name));
    }

    @ApiOperation(value = "分表计电-弹窗数据")
    @GetMapping("/fbjd/pop/{factoryId}/{pointCode}")
    public AjaxResults<Map<String, Object>> pullFbjdPop(@PathVariable(value = "factoryId") String factoryId,
                                                                 @PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullFbjdPop(factoryId, pointCode));
    }

    @ApiOperation(value = "无组织监控-弹窗数据")
    @GetMapping("/wzz/pop/{factoryId}/{pointCode}")
    public AjaxResults<Map<String, Object>> pullWzzPop(@PathVariable(value = "factoryId") String factoryId,
                                                        @PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullWzzPop(factoryId, pointCode));
    }

    @ApiOperation(value = "无组织监控-弹窗数据")
    @GetMapping("/wzz/pop/v2/{pointCode}")
    public AjaxResults<Map<String, Object>> pullWzzPop(@PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullWzzPop(null, pointCode));
    }

    @ApiOperation(value = "在线监测-弹窗数据")
    @GetMapping("/online/pop/{factoryId}/{pointCode}")
    public AjaxResults<Map<String, Object>> pullOnlinePop(@PathVariable(value = "factoryId") String factoryId,
                                                       @PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullOnlinePop(factoryId, pointCode));
    }

    @ApiOperation(value = "生产监控-弹窗数据")
    @GetMapping("/produce/pop/{factoryId}/{pointCode}")
    public AjaxResults<Map<String, Object>> pullProducePop(@PathVariable(value = "factoryId") String factoryId,
                                                          @PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullProducePop(factoryId, pointCode));
    }

    @ApiOperation(value = "煤气放散监控-弹窗数据")
    @GetMapping("/coalGas/pop/{factoryId}/{pointCode}")
    public AjaxResults<Map<String, Object>> pullCoalGasPop(@PathVariable(value = "factoryId") String factoryId,
                                                           @PathVariable(value = "pointCode") String pointCode) {
        return AjaxResults.success(iMonitoringMapService.pullCoalGasPop(factoryId, pointCode));
    }

}
