package com.xhpc.order.controller;

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.order.api.XhpcChargeOrderController;
import com.xhpc.order.service.IXhpcStopChargingOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * program: ruoyi
 * User: HongYun
 * Date:2021-09-07 15
 */
@RestController
@RequestMapping(value = "/stopChargingOrder")
public class XhpcStopChargingOrderController extends BaseController {

    @Autowired
    private IXhpcStopChargingOrderService iXhpcStopChargingOrderService;

    @Autowired
    private XhpcChargeOrderController xhpcChargeOrderController;

    @GetMapping("/list")
    public TableDataInfo list(Long userId, Long chargingStationId, Long terminalId){
        startPage();
        return getDataTable(iXhpcStopChargingOrderService.list(userId, chargingStationId, terminalId));
    }

    /**
     * 停止充电
     * @param userId
     * @param terminalSerialNumber   终端编码
     * @param chargingOrderId   充电id
     * @return
     */
    @GetMapping("/stopUp")
    public AjaxResult stopUp(@RequestParam Long userId, @RequestParam String terminalSerialNumber, @RequestParam Long chargingOrderId){

        return xhpcChargeOrderController.stopUp(userId, terminalSerialNumber, chargingOrderId);
    }
}
