package com.xhpc.card.controller;

import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.card.domain.CoreParam;
import com.xhpc.card.domain.OrderRatio;
import com.xhpc.card.domain.OrderTrend;
import com.xhpc.card.domain.RealtimeOrders;
import com.xhpc.card.service.XhpcDataBigScreenService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Controller of data big screen
 *
 * @author WH
 * @date 2022/3/9 10:44
 * @since version-1.0
 */
@RestController
@RequestMapping("/big-screen")
public class XhpcDataBigScreenController extends BaseController {

    @Resource
    XhpcDataBigScreenService xhpcDataBigScreenService;

    /**
     * 订单趋势
     * @param coreParam
     * @return
     */
    @GetMapping("/orders-trend")
    public R<OrderTrend> queryOrdersTrend(CoreParam coreParam) {
        return xhpcDataBigScreenService.queryOrderTrend(coreParam);
    }

    /**
     * query realtime orders by coreParam
     * 实时订单
     * @author WH
     * @date 2022/3/16 10:56
     * @since version-1.0
     */
    @GetMapping("/realtimeOrders")
    public R<RealtimeOrders> queryRealtimeOrders(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryRealtimeOrders(coreParam);
    }

    /**
     * Return order ratio
     * 订单来源比例
     * @author WH
     * @date 2022/3/9 15:49
     * @since version-1.0
     */
    @GetMapping("/order-ratio")
    public R<OrderRatio> queryOrderRatio(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryOrderRatio(coreParam);
    }

    /**
     * 枪使用率
     */
    @GetMapping("/terminal-gun")
    public R queryTerminalGun(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryTerminalGun(coreParam);
    }



    /**
     * Return total electric quantity
     * 总电量
     * @author WH
     * @date 2022/3/9 15:49
     * @since version-1.0
     */
    @GetMapping("/electric-quantity")
    public R<Object> queryElectricQuantity(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryElectricQuantity(coreParam);
    }

    /**
     * Return user activation
     * 用户活跃度
     * @author WH
     * @date 2022/3/9 13:53
     * @since version-1.0
     */
    @GetMapping("/user-activation")
    public R<Object> queryUserActivation(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryUserActivation(coreParam);
    }

    /**
     * Return a count of user total
     * 用户总数
     * @author WH
     * @date 2022/3/9 10:43
     * @since version-1.0
     */
    @GetMapping("/user-total-count")
    public R<Object> queryUserTotalCount(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryUserTotalCount(coreParam);
    }

    /**
     * Core interface
     * Return special info of charging station
     * 用于地球返回位置信息 电站信息
     * @author WH
     * @date 2022/3/9 10:42
     * @since version-1.0
     */
    @GetMapping("/core-locations")
    public R<List<Map<String, Object>>> returnCoreLocation(CoreParam coreParam) {

        return xhpcDataBigScreenService.returnCoreLocation(coreParam);
    }

    @GetMapping("/core-chargingStation")
    public R<List<Map<String, Object>>> returnCoreChargingStation(CoreParam coreParam) {

        return xhpcDataBigScreenService.returnCoreChargingStation(coreParam);
    }
    /**
     *  工单
     */
    @GetMapping("/work-order")
    public R queryWorkOrder(CoreParam coreParam) {

        return xhpcDataBigScreenService.queryWorkOrder(coreParam);
    }
}
