package com.ruoyi.mall.service;

import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ApiResult;
import com.ruoyi.mall.domain.MallOrderBack;
import com.ruoyi.mall.domain.MallOrderBackDto;
import com.ruoyi.mall.domain.MallOrderOrder;
import com.ruoyi.mall.domain.MallOrderbackGoods;
import com.ruoyi.mall.domain.dto.MallOrderOrderDTO;
import com.ruoyi.mall.domain.dto.MallOrderOrderPO;
import com.ruoyi.mall.domain.vo.MallOrderGoodsExportVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单Service接口
 *
 * @author chang
 * @date 2021-11-25
 */
public interface IMallOrderOrderService {
    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    public MallOrderOrder selectMallOrderOrderById(Long id);


    public List<MallOrderOrder> selectMallOrderOrderByTotalOrderSn(String totalOrderSn);

    /**
     * 订单超时一天自动收货
     *
     * @return 订单
     */
    public void orderTimeout(String redisKey);

    /**
     * 订单超时未支付取消
     * 每分钟执行一次
     */
    public void orderCancel(String redisKey);

    /**
     * 查询订单列表
     *
     * @param mallOrderOrder 订单
     * @return 订单集合
     */
    public List<MallOrderOrder> selectMallOrderOrderList(MallOrderOrder mallOrderOrder);

    /**
     * 新增订单
     *
     * @param mallOrderOrder 订单
     * @return 结果
     */
    public int insertMallOrderOrder(MallOrderOrder mallOrderOrder);

    /**
     * 批量配送
     *
     * @return 结果
     */
    public AjaxResult deliveryByOrderIds(Integer[] orderIds);

    /**
     * 批量打印
     *
     * @return 结果
     */
    public AjaxResult batchPrintData(Long[] orderIds);

    /**
     * 修改订单
     *
     * @param mallOrderOrder 订单
     * @return 结果
     */
    public int updateMallOrderOrder(MallOrderOrder mallOrderOrder);

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键集合
     * @return 结果
     */
    public int deleteMallOrderOrderByIds(Long[] ids);

    /**
     * 删除订单信息
     *
     * @param id 订单主键
     * @return 结果
     */
    public int deleteMallOrderOrderById(Long id);

    /**
     * 再来一单
     */
    public ApiResult oneMoreOrder(Map<String, Object> params);

    /**
     * 商品生成订单
     */
    public MallOrderOrder creatOrderByGoods(Map<String, Object> params);

    /**
     * 购物车生成订单
     */
    public List<MallOrderOrder> creatOrderByCartIds(Map<String, Object> params);

    /*
     * 订单编号 查询订单
     * */
    public MallOrderOrder queryByOrderSn(String orderNo);

    //修改订单状态前，查看之前的订单状态是否异常
    public Boolean orderStatusRoute(int i, String orderId);

    public Boolean refundStatusRoute(int i, String refundId);

    public PageInfo<MallOrderOrder> selectOrdersByType(String pageNum, String pageSize, String type, String userId, Integer deliveryType);

    public void cancelOrder();

    public void updateRefundRestlt(MallOrderBack orderBack, MallOrderOrder orderOrder);

    public ApiResult updateMallOrderOrderByCancle(MallOrderOrder order);

    public int checkTotleCount();

    public BigDecimal checkTotlePrice();

    public BigDecimal checkYearDate(String year);

    public BigDecimal checkYearAndMonth(String year, String month, String day);

    public int checkCountYearAndMonth(String year, String month, String day);

    /**
     * 查询退货订单
     *
     * @param id 订单主键
     * @return 订单
     */
    public MallOrderOrder selectMallOrderBackById(Long id);

    /**
     * 导出订单列表
     *
     * @param orderIds 订单ID
     * @return 订单集合
     */
    public List<MallOrderGoodsExportVO> selectExportOrderMallOrderOrderList(Long[] orderIds);


    public List<MallOrderGoodsExportVO> selectExportOrderList(MallOrderOrder mallOrderOrder);


    public void change();

    /**
     * 修改订单
     *
     * @param resourceDTO 订单
     * @return 结果
     */
    public ApiResult uploadOnlineOrderRemarks(MallOrderOrderDTO resourceDTO);

    PageInfo<MallOrderBackDto> selectBackOrdersByType(String pageNum, String pageSize, String type, String userId, int deliveryType);
//
//    ApiResult examineorderadmin(MallOrderOrderPO resourceDTO);

}
