package com.fs.store.service;

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

import com.alibaba.fastjson.JSONObject;
import com.fs.api.param.OrderListParam;
import com.fs.api.vo.OrderListVO;
import com.fs.common.core.domain.R;
import com.fs.company.domain.CompanyUser;
import com.fs.store.domain.FsStoreOrder;
import com.fs.store.dto.ExpressNotifyDTO;
import com.fs.store.dto.ExpressResultDTO;
import com.fs.store.dto.FsStoreOrderComputeDTO;
import com.fs.store.dto.StoreOrderExpressExportDTO;
import com.fs.store.param.*;
import com.fs.store.vo.*;

/**
 * 订单Service接口
 *
 * @author fs
 * @date 2022-03-15
 */
public interface IFsStoreOrderService
{

    /**
     * 查询订单
     *
     * @param id 订单ID
     * @return 订单
     */
    public FsStoreOrder selectFsStoreOrderById(Long id);

    /**
     * 查询订单列表
     *
     * @param fsStoreOrder 订单
     * @return 订单集合
     */
    public List<FsStoreOrder> selectFsStoreOrderList(FsStoreOrder fsStoreOrder);

    /**
     * 新增订单
     *
     * @param fsStoreOrder 订单
     * @return 结果
     */
    public int insertFsStoreOrder(FsStoreOrder fsStoreOrder);

    /**
     * 修改订单
     *
     * @param fsStoreOrder 订单
     * @return 结果
     */
    public int updateFsStoreOrder(FsStoreOrder fsStoreOrder);

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单ID
     * @return 结果
     */
    public int deleteFsStoreOrderByIds(Long[] ids);

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

    List<FsStoreOrderVO> selectFsStoreOrderListVO(FsStoreOrderParam param);

    List<FsStoreOrderVO> selectFsStoreOrderAllListVO(FsStoreOrderParam param);

    List<FsStoreOrderVO> selectPayRemainListVO(FsStoreOrderParam param);


    List<FsPromotionOrderVO> selectFsPromotionOrderListVO(FsStoreOrderParam param);

    R confirmOrder(long uid, FsStoreConfirmOrderParam cartParam);

    FsStoreOrderComputeDTO computedOrder(long parseLong, FsStoreOrderComputedParam param);

    R createOrder(long userId, FsStoreOrderCreateParam param);

    void cancelOrder(Long orderId);

    void refundPrescribeOrder(Long orderId);

    void refundOrder(Long orderId);

    void deliveryOrder(String orderCode,String deliveryId,String deliverCode,String deliverName);

    void updateDeliveryOrder(Long id,String deliveryId,String deliverCode,String deliverName);

    List<FsMyStoreOrderListQueryVO> selectFsMyStoreOrderListVO(FsMyStoreOrderQueryParam param);

    FsStoreOrder selectFsStoreOrderByOrderCode(String orderCode);

    R getExpress(FsStoreOrder order);
    R getExpressMulti(FsStoreOrder order);

    R createUserOrder(FsStoreOrderCreateUserParam param);

    List<FsMyStoreOrderListQueryVO> selectFsCompanyStoreOrderListVO(FsMyStoreOrderQueryParam param);

    FsStoreOrder selectFsStoreOrderByExtendOrderId(String orderId);

    List<FsStoreOrderTuiVO> selectFsStoreOrderTuiListVO(String userId);

    R confirmPackageOrder(long userId, FsStoreConfirmPackageIdOrderParam param);

    R createPackageOrder(long userId, FsStorePackageOrderCreateParam param);

    R finishOrder(Long orderId);

    String payConfirm(Integer type,Long orderId,String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);

    Integer selectFsStoreOrderCount(long userId, int status);

    R computedPackageOrder(long userId, FsStoreComputedPackageIdOrderParam param);

    FsStoreOrder selectFsStoreOrderByDeliveryId(String logisticCode);

    String importExpress(List<StoreOrderExpressExportDTO> list, boolean updateSupport) throws InterruptedException;

    void createOmsOrder(Long orderId) throws ParseException;

    FsStoreOrderVO selectFsStoreOrderVOByOrderCode(String orderCode);

    Long selectFsStoreOrderTotalCount(int type,Long companyId);

    R editTuiMoney(FsStoreOrderEditTuiMoneyParam param);

    List<OrderListVO> selectCompanyStoreOrderListAPI(OrderListParam param);

    List<FsStoreOrder> selectFsStoreOrderByCompanyId(Long companyId);

    List<FsStoreOrder> selectFsStoreOrderListByDeliveryId(String logisticCode);

    R refundOrderMoney(Long orderId);

    R updateExpress(FsStoreOrderExpressEditParam param);

    R syncExpress(FsStoreOrderExpressEditParam param);

    R addTuiMoney(FsStoreOrderAddTuiMoneyParam param);

    R createSalesOrder(CompanyUser companyUser, String cateIds);

    R getSalesOrder(String createOrderKey);

    R addUserCart(long userId, String createOrderKey);

    R updateSalseOrderMoney(String createOrderKey, BigDecimal money);

    Integer selectFsStoreOrderCountByType(Long companyId, long userId, int type);

    List<FsCustomerStoreOrderListQueryVO> selectFsCustomerStoreOrderListQuery(FsCustomerStoreOrderListQueryParam param);

    List<JSONObject> selectFsStoreOrderCounts(Map<String, Object> toMap);

    List<FsStoreOrderStatisticsVO> selectFsStoreOrderStatisticsList(FsStoreStatisticsParam param);

    List<FsStoreOrderExportVO> selectFsStoreOrderListVOByExport(FsStoreOrderParam param);

    List<FsStoreOrderPromotionExportVO> selectFsPromotionOrderListVOByExport(FsStoreOrderParam param);

    List<FsStorePayRemainOrderExportVO> selectFsStorePayRemainOrderListVOByExport(FsStoreOrderParam param);

    List<FsStoreOrder> selectFsStoreOrderListByFinish7Day();

    List<FsStoreOrderVO> selectFsCustomerStoreOrderListVO(FsStoreOrderParam param);

    String payRemainConfirm(String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);

    R auditPayRemain(Long orderId);

    Boolean isEntityNull(FsStoreOrderParam param);

    int uploadCredentials(FsStoreOrder order);

    String getCredentialsById(Long id);

    List<Long> selectFsStoreOrderToPushByIds(String startTime);

    List<FsStoreOrder> selectFsStoreOrderItemJson();

    int uploadItemJson(FsStoreOrder order);

    ExpressResultDTO updateDeliveryItem(ExpressNotifyDTO notifyDTO);

}
