package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.IOrderQueryService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.vo.HolderDetailExRedisVo;
import com.muchinfo.mtp3pojos.vo.query.order.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/queryOrder")
@Api(value = "订单查询API", description = "订单查询管理")
public class OrderQueryController {

    @Resource
    private IOrderQueryService iOrderQueryService;

    @RequestMapping(method = RequestMethod.GET, value = "/query")
    @ApiOperation("订单管理--> 订单查询 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<OrderQueryResult> query(OrderQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.query(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryDetail")
    @ApiOperation("订单管理--> 订单查询 --> 获取详情")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrderQueryResult> queryDetail(OrderQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.queryDetail(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/export")
    @ApiOperation("订单管理--> 订单查询 --> 导出")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult export(OrderQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.export(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryTerOrder")
    @ApiOperation("订单管理--> 终止单查询 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<TerOrderQueryResult> queryTerOrder(TerOrderQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.queryTerOrder(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/terOrderExport")
    @ApiOperation("订单管理--> 终止单查询 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult terOrderExport(TerOrderQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.terOrderExport(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryDeliveryOrder")
    @ApiOperation("订单管理--> 交收单管理 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<DeliveryOrderResult> queryDeliveryOrder(DeliveryOrderParam param, HttpServletRequest request) {
        return iOrderQueryService.queryDeliveryOrder(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/deliveryOrderDetail")
    @ApiOperation("订单管理--> 交收单管理 --> 获取详情")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<DeliveryOrderResult> deliveryOrderDetail(DeliveryOrderParam param, HttpServletRequest request) {
        return iOrderQueryService.deliveryOrderDetail(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/deliveryOrderExport")
    @ApiOperation("订单管理--> 交收单管理 --> 导出")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult deliveryOrderExport(DeliveryOrderParam param, HttpServletRequest request) {
        return iOrderQueryService.deliveryOrderExport(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryOrderDate")
    @ApiOperation("订单管理--> 订单日报表 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<OrderDateQueryResult> queryOrderDate(OrderDateQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.queryOrderDate(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/orderDateExport")
    @ApiOperation("订单管理--> 订单日报表 --> 导出")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult orderDateExport(OrderDateQueryParam param, HttpServletRequest request) {
        return iOrderQueryService.orderDateExport(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryForcedOrder")
    @ApiOperation("订单管理--> 强制终止单 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<ForcedOrderResult> queryForcedOrder(ForcedOrderParam param, HttpServletRequest request) {
        return iOrderQueryService.queryForcedOrder(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/forcedOrderExport")
    @ApiOperation("订单管理--> 强制终止单 --> 导出")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult forcedOrderExport(ForcedOrderParam param, HttpServletRequest request) {
        return iOrderQueryService.forcedOrderExport(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/forcedOrderRecover")
    @ApiOperation("订单管理--> 强制终止单 --> 斩仓恢复")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult forcedOrderRecover(String closeid, HttpServletRequest request) {
        return iOrderQueryService.forcedOrderRecover(closeid, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/monitorddjkCount")
    @ApiOperation("订单管理--> 订单监控 --> 获取总数据")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<MonitorddjkCountResult> monitorddjkCount(MonitorddjkParam param, HttpServletRequest request) {
        return iOrderQueryService.monitorddjkCount(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/monitorddjk")
    @ApiOperation("订单管理--> 订单监控 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public PageResult<HolderDetailExRedisVo> monitorddjk(MonitorddjkParam param, HttpServletRequest request) {
        return iOrderQueryService.monitorddjk(param, request);
    }
}
