package com.fdkankan.platform.goods.controller.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.common.controller.BaseController;
import com.fdkankan.platform.order.service.IExpansionOrderService;
import com.fdkankan.platform.order.service.IVirtualOrderService;
import com.fdkankan.platform.order.vo.ResponseExpansionOrder;
import com.fdkankan.platform.user.request.RequestCamera;
import com.fdkankan.platform.user.request.RequestVirtualOrder;
import com.fdkankan.platform.user.vo.ResponseVirtualOrder;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 设备中心接口-虚拟订单模块
 */
@Log4j2
@RestController
@RequestMapping("/service/platform/device/virtualOrder")
public class DeviceVirtualOrderController extends BaseController {

    @Autowired
    private IVirtualOrderService virtualOrderService;
    @Autowired
    private IExpansionOrderService expansionOrderService;

    /**
     * 虚拟订单列表
     * cameraId     相机id
     * status       状态
     * childName    相机mac地址
     * @return
     */
    @RequestMapping(value = "/chargeList", method = RequestMethod.POST)
    public Page<ResponseVirtualOrder> chargeList(@RequestBody RequestVirtualOrder param) throws Exception {
        return virtualOrderService.chargeList(param, null);
    }

    /**
     * 扩容订单列表
     * cameraId     相机id
     * status       状态
     * childName    相机mac地址
     * @return
     */
    @RequestMapping(value = "/expansionList", method = RequestMethod.POST)
    public Page<ResponseExpansionOrder> expansionList(@RequestBody RequestCamera param) throws Exception {
        return expansionOrderService.getExpansionListByParam(param);
    }

}
