package com.iformall.controller.datatower;

import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.service.DataTowerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(description = "数据塔台")
@RestController
@RequestMapping("datatower")
public class DataTowerController extends BaseController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private DataTowerService dataTowerService;

    @ApiOperation("查询运营")
    @GetMapping("/queryRunningPotal")
    @SystemControllerLog(description = "数据塔台-查询运营")
    public ResultData queryRunningPotal() {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunningPotal");

        Map<String, Object> data = dataTowerService.queryRunningPotal(getTenantId());

        return new ResultData(data);
    }

    @ApiOperation("查询运营")
    @GetMapping("/queryRunningMobile")
    @SystemControllerLog(description = "数据塔台-查询运营")
    public ResultData queryRunningMobile() {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunningMobile");

        Map<String, Object> data = dataTowerService.queryRunningMobile(getTenantId());

        return new ResultData(data);
    }


    @ApiOperation("查询运营")
    @GetMapping("/queryRunning")
    @SystemControllerLog(description = "数据塔台-查询运营")
    public ResultData queryRunning() {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunning");

        Map<String, Object> data = dataTowerService.queryRunning(getTenantId());

        return new ResultData(data);
    }


    @ApiOperation("查询车流")
    @GetMapping("/queryCar")
    @SystemControllerLog(description = "数据塔台-查询车流")
    public ResultData queryCar() {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryCar");

        Map<String, Object> data = dataTowerService.queryCar(getTenantId());

        return new ResultData(data);
    }

    @ApiOperation("查询客流")
    @GetMapping("/queryCustomer")
    @SystemControllerLog(description = "数据塔台-查询客流")
    public ResultData queryCustomer() {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryCustomer");

        Map<String, Object> data = dataTowerService.queryCustomer(getTenantId());

        return new ResultData(data);
    }

    @ApiOperation("查询客流")
    @GetMapping("/queryCustomerData")
    @SystemControllerLog(description = "数据塔台-查询客流")
    public ResultData queryCustomerData(@RequestParam Map<String,String> params) {
        logger.debug("[" + getIpAddr() + "] DataTowerController::queryCustomer");

        return dataTowerService.queryCustomerData(getTenantId(), params);
    }


}
