package com.jsowell.pile.service;

import com.jsowell.common.core.page.PageResponse;
import com.jsowell.pile.domain.OrderPileOccupy;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;

import java.util.List;
import java.util.Map;

public interface OrderPileOccupyService{
    int deleteByPrimaryKey(Integer id);

    int insert(OrderPileOccupy record);

    int insertOrUpdate(OrderPileOccupy record);

    int insertOrUpdateSelective(OrderPileOccupy record);

    int insertSelective(OrderPileOccupy record);

    OrderPileOccupy selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(OrderPileOccupy record);

    int updateByPrimaryKey(OrderPileOccupy record);

    int updateBatch(List<OrderPileOccupy> list);

    int updateBatchSelective(List<OrderPileOccupy> list);

    int batchInsert(List<OrderPileOccupy> list);

    OrderPileOccupy queryByOccupyCode(String occupyCode);

    /**
     * 查询占桩订单列表
     *
     * @param orderPileOccupy 占桩订单
     * @return 占桩订单集合
     */
    public List<OrderPileOccupy> selectOrderPileOccupyList(OrderPileOccupy orderPileOccupy);

    List<OrderPileOccupy> queryOccupyOrderList(QueryOccupyOrderDTO dto);

    /**
     * 生成占桩订单
     */
    String generateOccupyPileOrder(GenerateOccupyOrderDTO dto);

    /**
     * 停止并计算占桩订单
     * @param pileSn
     * @param connectorCode
     */
    void stopOccupyPileOrder(String pileSn, String connectorCode);

    /**
     * 通过memberid查询挂起状态订单
     * @param memberId
     * @return
     */
    List<OrderPileOccupy> queryHangUpOrderByMemberId(String memberId);

    /**
     * 通过memberId查询未支付状态订单
     * @param memberId
     * @return
     */
    OrderPileOccupy queryUnPayOrderByMemberId(String memberId);

    Map<String, Object> payOccupyPileOrder(PayOrderDTO dto);

    /**
     * 查询占桩订单列表
     * @param dto
     * @return
     */
    PageResponse getOccupyOrderInfo(QueryOccupyOrderDTO dto);

    /**
     * 根据桩编号、枪口号查询最近一条占桩订单
     * @param pileSn
     * @param connectorCode
     * @return
     */
    OrderPileOccupy getDraftOccupyOrder(String pileSn, String connectorCode);

    /**
     * 控制地锁方法
     * @param dto
     */
    void remoteGroundLock(RemoteGroundLockDTO dto);

    /**
     * 获取占桩订单详情
     * @param occupyCode
     */
    OccupyOrderDetailVO getOccupyOrderDetail(String occupyCode);

    /**
     * 使该笔订单免费/修改订单金额（后管用）
     * @param dto
     * @return
     */
    int updateOrderInfoForWeb(MakeOrderFreeDTO dto);

    void closeOccupyPileOrder(String pileSn, String connectorCode);
}
