package com.xhpc.activity.controller;


import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.activity.service.StationLogService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/log/station")
public class StationLogController extends BaseController {


    @Resource
    StationLogService stationLogService;

    @GetMapping("/getPage")
    public TableDataInfo getPilePage(
                                     HttpServletRequest request,
                                     @RequestParam(required = false) String tenantId,
                                     @RequestParam(required = false) Integer number,
                                     @RequestParam(required = false) Long operatorId,
                                     @RequestParam(required = false) Long chargingStationId) {
        startPage();
        Map<String, Object> params = new HashMap<>();
        params.put("operatorId", operatorId);
        params.put("number", number);
        params.put("tenantId", tenantId);
        params.put("chargingStationId", chargingStationId);
        return getDataTable(stationLogService.getStationPage(request,params));
    }



    @GetMapping("/detail")
    public TableDataInfo getPileDetailPage(@RequestParam("stationId") Long stationId) {

        startPage();
        return getDataTable(stationLogService.getStationRatePage(stationId));
    }


    @GetMapping("/rate/detail")
    public AjaxResult getRateInfo(@RequestParam("rateId") Integer rateId) {
        return AjaxResult.success(stationLogService.getRateInfo(rateId));
    }
}
