package com.xinelu.applet.controller.logistics;

import com.xinelu.applet.service.logistics.LogisticsService;
import com.xinelu.common.annotation.MobileRequestAuthorization;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description 快递鸟物流查询接口控制器
 * @Author 纪寒
 * @Date 2022-11-01 13:33:31
 * @Version 1.0
 */
@RestController
@RequestMapping("/nurseApp/logistics")
public class LogisticsController extends BaseController {

    @Resource
    private LogisticsService logisticsService;

    /**
     * 根据快递单号查询物流信息
     *
     * @param orderNo   订单单号
     * @param expressNo 快递单号
     * @return 物流信息
     * @throws Exception 异常信息
     */
    @MobileRequestAuthorization
    @GetMapping("/queryLogisticsInfo")
    public AjaxResult queryLogisticsInfo(String orderNo, String expressNo) throws Exception {
        if (StringUtils.isBlank(orderNo)) {
            return AjaxResult.error("请选择要查询的订单信息！");
        }
        if (StringUtils.isBlank(expressNo)) {
            return AjaxResult.error("请选择要查询的快递单号！");
        }
        return logisticsService.queryLogisticsInfo(orderNo, expressNo);
    }
}
