/**
 * @filename:BPurchaseOrderController.java 2024-09-12
 * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.admin.order.controller;

import javax.annotation.Resource;
import com.trade.admin.order.service.BPurchaseOrderService;
import com.trade.service.order.dto.PurchaseOrderLogisticsSearchDto;
import com.trade.service.order.vo.PurchaseOrderDetailsVo;
import com.trade.service.order.vo.PurchaseOrderLogisticsPageVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.trade.common.core.domain.ResponseResult;
import com.trade.common.core.page.GridPage;
import com.trade.service.order.dto.PurchaseSearchDto;
import com.trade.service.order.vo.PurchaseOrderVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 说明： 合同文件信息API接口层
 * </P>
 * 
 * @version: v1.0.0
 * @author: wanglang
 * @time 2024-09-12
 */
@Api(tags = "采购订单信息", value = "采购订单信息")
@RestController
@RequestMapping("/purchaseOrder")
public class BPurchaseOrderController {

    @Resource
    private BPurchaseOrderService purchaseOrderService;

    /**
     * 获取采购订单
     *
     * @param purchaseSearch 采购订单条件
     * @return 采购订单
     */
    @ApiOperation(value = "获取采购订单", notes = "获取采购订单")
    @PostMapping("/get/page")
    @PreAuthorize("@ss.hasPermi('purchase:order:pageList')")
    public ResponseResult<GridPage<PurchaseOrderVo>> getPurchaseOrderPage(
            @RequestBody PurchaseSearchDto purchaseSearch) {
        return ResponseResult.success(purchaseOrderService.queryListByPage(purchaseSearch));
    }

    /**
     * 获取采购订单详情
     *
     * @param orderId 订单id
     * @return 采购订单详情
     */
    @ApiOperation(value = "获取采购订单详情", notes = "获取采购订单详情")
    @GetMapping("/get/{orderId}")
    @PreAuthorize("@ss.hasPermi('purchase:order:details')")
    public ResponseResult<PurchaseOrderDetailsVo> getSalesContractDetails(@PathVariable Long orderId) {
        return ResponseResult.success(purchaseOrderService.getDetailsById(orderId));
    }

    /**
     * 获取采购订单物流信息
     *
     * @param orderLogisticsSearch 物流信息条件
     * @return 获取采购订单物流信息
     */
    @ApiOperation(value = "获取采购订单物流信息", notes = "获取采购订单物流信息")
    @PostMapping("/get/logisticsPage")
    @PreAuthorize("@ss.hasPermi('purchase:order:logisticsPage')")
    public ResponseResult<GridPage<PurchaseOrderLogisticsPageVo>> getOrderLogisticsByPage(
            @RequestBody PurchaseOrderLogisticsSearchDto orderLogisticsSearch) {
        return ResponseResult.success(purchaseOrderService.queryOrderLogisticsByPage(orderLogisticsSearch));
    }
}
