package com.trade.client.trade.salesorder.controller;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

import com.trade.service.trade.salesorder.service.ISalesOrderLogisticsService;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsDtlVO;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsSearch;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsVO;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.trade.client.security.utils.UserUtils;
import com.trade.common.core.domain.ResponseResult;

/**
 * <p>
 * 销售订单物流 C端控制器
 * </p>
 */
@RestController
@RequestMapping("/salesOrderLogistics")
@Validated
public class SalesOrderLogisticsController {

    @Resource
    private ISalesOrderLogisticsService salesOrderLogisticsService;

    /**
     * 销售订单物流-list
     */
    @RequestMapping("/list")
    public ResponseResult<PageInfo<SalesOrderLogisticsVO>> list(SalesOrderLogisticsSearch search) {
        search.setCustomerUserId(UserUtils.getCustomerUserId());
        return ResponseResult.success(salesOrderLogisticsService.queryListBySearch(search));
    }

    /**
     * 销售订单物流-详情
     * 
     * @param orderNo 订单编号
     */
    @RequestMapping("/detail")
    public ResponseResult<SalesOrderLogisticsDtlVO> detail(@NotBlank(message = "订单编号不能为空") String orderNo) {
        return ResponseResult.success(salesOrderLogisticsService.getDetailByOrderNo(orderNo));
    }
}
