package com.sqx.modules.errand.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.queryRiderVo;
import com.sqx.modules.datacentre.query.DataCenterQuery;
import com.sqx.modules.errand.dto.*;
import com.sqx.modules.errand.entity.ErrandAddress;
import com.sqx.modules.errand.entity.ErrandEvaluate;
import com.sqx.modules.errand.entity.ErrandRedPacket;
import com.sqx.modules.errand.entity.TbIndent;
import com.sqx.modules.order.entity.TbOrder;

import java.util.List;

public interface TbIndentService extends IService<TbIndent> {

    void noticeAfterTransfer(TbIndent indent,queryRiderVo user);

    queryRiderVo getNewRicherCheck(Long riderUserId);

    List<TbIndent> findIndentsByIds(List<Long> ids);

    TbIndent findIndentByPayOrdersNo(String ordersNo);

    void sendNewIndentMsg(TbIndent indent);

    Result insertIndent(TbOrder order);

    Result findNewIndent(Long userId, String receivingPettern, Integer page, Integer limit, double riderLng, double riderLat, String indentType, String buyType);

    PageUtils findNewIndent(WaitForAcceptOrderQueryDTO queryDTO);

    PageUtils findNewIndentGroupByShop(WaitForAcceptOrderQueryDTO queryDTO);

    Result indentReceiving(Long userId, String indentNumber);

    Result orderIndentReceiving(Long userId, String acquireCode);

    Result riderBuyGoods(TbIndent tbIndent);

    Result findRiderIndent(Long userId, Integer page, Integer limit, String indentState, String keyword);

    Result findRiderIndentByIds(Long userId, Integer page, Integer limit, List<String> indentIds);

    TbIndent indentMessage(String indentNumber, double ol, double od);

    Result riderCancleIndent(String indentNumber, Integer type);

    Result riderDelivery(Long userId, RiderDeliveryDTO deliveryDTO);

    Result orderRiderDelivery(Long userId, OrderRiderDeliveryDTO orderDeliveryDTO);

    Result userDelivery(Long userId, String indentNumber);

    Result userEvaluate(ErrandEvaluate errandEvaluate);

    Result findallIndent(Integer page, Integer limit, Long userId, Long riderUserId, Long shopId, Integer indentType, String ordersNo, Integer status, String riderPhone);

    void finshIndent(Long userId, String indentNumber);

    Result distance(double ol, double od, double dl, double dd);

    Result addUserAddress(Long userId, ErrandAddress errandAddress);

    Result updateAddress(Long userId, ErrandAddress errandAddress);

    Result findUserAddress(Long userId);

    Result findAddressById(Long userId, Integer addressId);

    Result addDefaultAddress(Long userId, Integer addressId);

    Result delUserAddress(Long userId, Integer addressId);

    TbIndent basicsMoney(TbIndent tbIndent);

    Result addIndentBuy(TbIndent tbIndent);

    TbIndent findIndentByIndentNumber(String orderId);

    Result findAllIndent(String indentType, String phone, String indentState, Integer page, Integer limit, String date, String dateType, String riderPhone);

    Result findAllIndents(String indentType, String phone, String indentState, Integer page, Integer limit, String date, String dateType, String riderPhone);

    Result IndentCenter(Integer page, Integer limit, String indentType, String indentNumber, String indentState, String phone, String date, String dateType);

    Result updateIndentState(String indentNumber, String indentState);

    Result adminSoldOutIndent(String indentNumber);

    Result findDataCenter();

    Result taskAnalysis(DataCenterQuery query, String indentState);

    Result selectOrderByStatus(DataCenterQuery query);

    Result findIncome(Long userId, String date, String dateType, Integer page, Integer limit);

    Result findUserIndent(Long userId, Integer page, Integer limit, String indentState);

    TbIndent userIndentMessage(String indentNumber);

    Result find5KmRider(double lng, double lat);

    Result updateCoordinate(Long userId, double lng, double lat);

    UserEntity findUserInfoById(Long userId);

    Result getNewUserRedPacket(Long userId);

    List<ErrandRedPacket> findAllRedPacket(Long userId);

    List<ErrandRedPacket> findRedPacket(Long userId, TbIndent indent);

    Result userCancleIndent(Long userId, String indentNumber);

    TbIndent indentMessageByOrderId(Long orderId, double ol, double od);

    /**
     * 骑手转单
     *
     * @param userId           当前用户id
     * @param transferOrderDTO dto
     */
    void transferOfOrder(Long userId, RiderTransferOrderDTO transferOrderDTO);

    /**
     * 骑手转单
     *
     * @param userId           当前用户id
     * @param transferOrderDTO dto
     */
    void transferByOrderId(Long userId, RiderTransferByOrderIdDTO transferOrderDTO);

    //region 2024-09-12 A-jax 添加方法
    //获取跑腿订单分页数据
    PageUtils selectIndentPage(Integer page, Integer limit, String acquireCode, Long userId);

    //校验订单是否能接
    Result checkIndent(Long userId, String orderId);

    //endregion

    /**
     * 骑手上次签收照片
     *
     * @param userId       用户id
     * @param indentNumber 跑腿订单号
     * @param imgs         图片地址
     */
    void riderUploadDeliveryImg(Long userId, String indentNumber, String imgs);

    TbIndent getByOrderId(String orderId);

    /**
     * 系统取消跑腿订单
     * @param indentNumber 跑腿订单号
     */
    void sysCancelOrder(String indentNumber);

    Result finalizeOrder(Long userId, TbIndent tbIndent);
}
