package com.yiqi.order.service;

import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yiqi.common.core.domain.R;
import com.yiqi.order.domain.OrderGoods;
import com.yiqi.order.domain.dto.*;
import com.yiqi.order.domain.dto.weapp.AppGoodsOrderInfoQueryDTO;
import com.yiqi.order.domain.dto.weapp.AppOrderGoodsCancelDTO;
import com.yiqi.order.domain.dto.weapp.AppOrderGoodsRefundDTO;
import com.yiqi.order.domain.vo.*;
import com.yiqi.order.domain.vo.weapp.AppGoodsOrderInfoQueryVO;

/**
 * 零售商品订单Service接口
 *
 * @author ruoyi
 * @date 2023-12-06
 */
public interface IOrderGoodsService extends IService<OrderGoods> {


    OrderGoods getByOrderNo(String  orderNo);

    /**
     * 查询零售商品订单
     *
     * @param id 商品订单主键
     * @return 商品订单
     */
    public List<OrderRetailGoodsSkuVO> selectOrderGoodsById(Long id);

    /**
     * 查询零售商品订单
     *
     * @param orderNoList 商品订单主键
     * @return 商品订单
     */
    public List<OrderRetailGoodsSkuVO> selectOrderGoodsByOrderNos(List<String> orderNoList);

    /**
     * APP分页获取订单商品列表
     * @param appGoodsOrderInfoQueryDTO
     * @return
     */
    public List<AppGoodsOrderInfoQueryVO> getGoodsOrderListByApp(AppGoodsOrderInfoQueryDTO appGoodsOrderInfoQueryDTO);

    /**
     * 查询零售商品订单列表
     *
     * @param goodsOrderQueryDTO 商品订单
     * @return 商品订单集合
     */
    public List<GoodsOrderQueryVO> selectOrderGoodsList(GoodsOrderQueryDTO goodsOrderQueryDTO);

    /**
     * 创建零售商品订单
     *
     * @param orderGoodsDTO 零售商品订单
     * @return 零售商品订单
     */
    public OrderGoods cereateRetailOrderGoods(OrderGoodsDTO orderGoodsDTO, List<OrderGoodsSkuInfoVO> orderGoodsSkuInfoVOS);

    /**
     * 获取订单物料信息
     * @param orderGoodsDTO
     * @return
     */
    List<OrderGoodsSkuInfoVO> getSkuInfoList(List<Long> skuIdList, String orderSource);

    /**
     * 支付成功后，处理订单
     *
     * @param orderNo
     * @return
     */
    public R handlePaySuccessUpdateOrderStatus(String orderNo, String outTradeNo);

    /**
     * 快递签收成功后，处理订单
     * @param orderNo
     */
    public void handleDeliverySuccessUpdateOrderStatus(String orderNo);

    /**
     * 零售商品订单-取消订单
     *
     * @param appOrderGoodsCancelDTO
     * @return 结果
     */
    public int cancelOrder(AppOrderGoodsCancelDTO appOrderGoodsCancelDTO);

    /**
     * 零售商品订单-支付失败取消订单
     *
     * @param orderNo
     * @return 结果
     */
    public String handlePayFailCancelOrder(String orderNo);

    /**
     * 零售商品订单-重新支付
     *
     * @param orderGoodsDTO 商品订单
     * @return 结果
     */
    public OrderPayResultVO rePayOrder(OrderGoodsDTO orderGoodsDTO);


    OrderPayResultVO orderGoodsPay(OrderGoodsPayDTO orderGoodsPayDTO);

    /**
     * 零售商品订单-总部出货
     *
     * @param orderGoodsOutGoodsDTO 商品订单
     * @return 结果
     */
    public int outOrderGoods(OrderGoodsOutGoodsDTO orderGoodsOutGoodsDTO) throws Exception;

    /**
     * 生活服务/汽车美容-总部接单
     */
    public int receiveOrder(Long orderId);

    /**
     * 生活服务/汽车美容-确认完成
     */
    public int confirmFinish(Long orderId);

    /**
     * 商品订单-总部撤单申请
     */
    public int refundOrderGoodsApply(OrderGoodsRefundDTO orderGoodsRefundDTO, String sourceType);

    public R refundSuccess(String refundNo, String orderNo);

    public R refundClosed(String refundNo, String orderNo);

    public R refundError(String refundNo, String orderNo);

    /**
     * 商品订单退款审核，审批同意
     */
    public int refundApprovalPass(Long orderId);

    /**
     * 商品订单退款审核，审批驳回
     */
    public int refundApprovalReject(Long orderId);



    /**
     * APP取消退款
     */
    public int cancelRefund(Long orderId);

    /**
     * APP申请退款
     */
    public int applyRefundOrderGoods(AppOrderGoodsRefundDTO appOrderGoodsRefundDTO);

    /**
     * 计算购物车-总价
     * @return
     */
    List<OrderGoodsSkuInfoVO> getOrderSkuInfoByGoodsMarket();

    /**
     * 计算订单物料-总价
     * @return
     */
    List<OrderGoodsSkuInfoVO> getOrderSkuInfoByOrderSkuId(OrderGoodsDTO orderGoodsDTO);

    BigDecimal getDeductAmountByUserPoint();

    /**
     * 查询退款商品订单列表
     *
     * @param goodsOrderRefundQueryDTO 商品订单
     * @return 商品订单集合
     */
    public List<GoodsOrderRefundQueryVO> getRefundOrderGoodsList(GoodsOrderRefundQueryDTO goodsOrderRefundQueryDTO);

    /**
     * 查询商品订单物流轨迹
     */
    public OrderDeliveryPathVO getDeliveryPath(Long orderId) throws Exception;

    /**
     * 查询商品销售统计列表
     *
     * @param queryDTO 查询条件
     * @return 商品销售统计列表
     */
    List<GoodsStatisticsVO> getGoodsStatisticsList(GoodsStatisticsQueryDTO queryDTO);

}
