package com.prolog.rdc.tms.app.controller.web;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.app.model.dto.*;
import com.prolog.rdc.tms.app.model.vo.*;
import com.prolog.rdc.tms.app.service.QueryReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 *
 *
 * 司机APP-综合查询
 *
 * @className :QueryReportController
 * @author :qian.yh
 * @creationTime :2022/07/07
 * @description :
 *
 * @modifier :
 * @modifyTime :
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@Api(tags = "司机APP-综合查询")
@RestController
@RequestMapping("/query_report")
public class QueryReportController {
    @Resource
    private QueryReportService queryReportService;

    @UserLog("配送单查询")
    @ApiOperation(value = "配送单查询", notes = "配送单查询")
    @PostMapping("/delivery_order_query")
    public RestMessage<DeliveryOrderQueryReesponseDTO> deliveryOrderQuery(@RequestBody DeliveryOrderQueryVO deliveryOrderQueryVO) {
        try {
            DeliveryOrderQueryReesponseDTO dtos = queryReportService.deliveryOrderQuery(deliveryOrderQueryVO);
            return RestMessage.newInstance(true, "查询成功", dtos);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }


    @UserLog("派车单汇总查询")
    @ApiOperation(value = "派车单汇总查询", notes = "派车单汇总查询")
    @PostMapping("/dispatch_order_query")
    public RestMessage<DispatchOrderQueryResponseDTO> dispatchOrderQuery(@RequestBody DispatchOrderQueryVO dispatchOrderQueryVO) {
        try {
            DispatchOrderQueryResponseDTO dto = queryReportService.dispatchOrderQuery(dispatchOrderQueryVO);
            return RestMessage.newInstance(true, "查询成功", dto);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }


    @UserLog("派车单明细查询")
    @ApiOperation(value = "派车单明细查询", notes = "派车单明细查询")
    @PostMapping("/dispatch_order_detail_query")
    public RestMessage<List<DispatchOrderDetailQueryDTO>> dispatchOrderDetailQuery(@RequestBody DispatchOrderDetailQueryVO dispatchOrderDetailQueryVO) {
        try {
            List<DispatchOrderDetailQueryDTO> dtos = queryReportService.dispatchOrderDetailQuery(dispatchOrderDetailQueryVO);
            return RestMessage.newInstance(true, "查询成功", dtos);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }


    @UserLog("司机基础信息及任务信息查询接口")
    @ApiOperation(value = "司机基础信息及任务信息查询接口", notes = "司机基础信息及任务信息查询接口")
    @PostMapping("/driver_information_query")
    public RestMessage<DriverInformationQueryDTO> driverInformationQuery(@RequestBody DriverInformationQueryVO driverInformationQueryVO) {
        try {
            DriverInformationQueryDTO dto = queryReportService.driverInformationQuery(driverInformationQueryVO);
            return RestMessage.newInstance(true, "查询成功", dto);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }

    @UserLog("司机车辆信息查询接口")
    @ApiOperation(value = "司机车辆信息查询接口", notes = "司机车辆信息查询接口")
    @PostMapping("/driver_vehicle_query")
    public RestMessage<List<DriverVehicleDTO>> driverVehicleQuery(@RequestBody DriverVehicleQueryVO driverVehicleQueryVO) {
        try {
            List<DriverVehicleDTO> dtos = queryReportService.driverVehicleQuery(driverVehicleQueryVO);
            return RestMessage.newInstance(true, "查询成功", dtos);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }


    @UserLog("司机取号查询接口")
    @ApiOperation(value = "司机取号查询接口", notes = "司机取号查询接口")
    @PostMapping("/driver_get_number_query")
    public RestMessage<List<DriverGetNumberQueryDTO>> driverGetNumberQuery(@RequestBody DriverGetNumberQueryVO driverGetNumberQueryVO) {
        try {
            List<DriverGetNumberQueryDTO> dtos = queryReportService.driverGetNumberQuery(driverGetNumberQueryVO);
            return RestMessage.newInstance(true, "查询成功", dtos);
        } catch (Exception e) {
            e.printStackTrace();
            return RestMessage.newInstance(false, e.getMessage(), null);
        }
    }

}
