package com.yiqi.order.service.impl;

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

import cn.hutool.json.JSONUtil;
import com.yiqi.common.enums.OrderRefundStatus;
import com.yiqi.common.enums.PayType;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import com.yiqi.order.domain.dto.PayRefundDTO;
import com.yiqi.order.service.IPayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.order.mapper.OrderRechargeInstalmentMapper;
import com.yiqi.order.domain.OrderRechargeInstalment;
import com.yiqi.order.service.IOrderRechargeInstalmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 充值订单分段支付记录Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-30
 */
@Service
public class OrderRechargeInstalmentServiceImpl extends ServiceImpl<OrderRechargeInstalmentMapper, OrderRechargeInstalment> implements IOrderRechargeInstalmentService {

    private static final Logger log = LoggerFactory.getLogger(OrderRechargeInstalmentServiceImpl.class);

    @Autowired
    private IPayService payService;

    @Override
    public BigDecimal getTotalPayAmount(String orderNo) {
        return baseMapper.getTotalPayAmount(orderNo);
    }

    /**
     * 查询充值订单分段支付记录
     *
     * @param id 充值订单分段支付记录主键
     * @return 充值订单分段支付记录
     */
    @Override
    public OrderRechargeInstalment selectOrderRechargeInstalmentById(Long id) {
        return baseMapper.selectOrderRechargeInstalmentById(id);
    }

    /**
     * 查询充值订单分段支付记录列表
     *
     * @param orderRechargeInstalment 充值订单分段支付记录
     * @return 充值订单分段支付记录
     */
    @Override
    public List<OrderRechargeInstalment> selectOrderRechargeInstalmentList(OrderRechargeInstalment orderRechargeInstalment) {
        return baseMapper.selectOrderRechargeInstalmentList(orderRechargeInstalment);
    }

    /**
     * 新增充值订单分段支付记录
     *
     * @param orderRechargeInstalment 充值订单分段支付记录
     * @return 结果
     */
    @Override
    public int insertOrderRechargeInstalment(OrderRechargeInstalment orderRechargeInstalment) {
        orderRechargeInstalment.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertOrderRechargeInstalment(orderRechargeInstalment);
    }

    /**
     * 修改充值订单分段支付记录
     *
     * @param orderRechargeInstalment 充值订单分段支付记录
     * @return 结果
     */
    @Override
    public int updateOrderRechargeInstalment(OrderRechargeInstalment orderRechargeInstalment) {
        orderRechargeInstalment.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateOrderRechargeInstalment(orderRechargeInstalment);
    }

    /**
     * 批量删除充值订单分段支付记录
     *
     * @param ids 需要删除的充值订单分段支付记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderRechargeInstalmentByIds(Long[] ids) {
        return baseMapper.deleteOrderRechargeInstalmentByIds(ids);
    }

    /**
     * 删除充值订单分段支付记录信息
     *
     * @param id 充值订单分段支付记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderRechargeInstalmentById(Long id) {
        return baseMapper.deleteOrderRechargeInstalmentById(id);
    }


}
