package com.platform.yijia.service.impl;

import com.platform.yijia.dao.ElectronicMembershipCardMapper;
import com.platform.yijia.dao.IntegralRuleMapper;
import com.platform.yijia.pojo.CustomerCardSetting;
import com.platform.yijia.pojo.CustomerCardUseRecord;
import com.platform.yijia.pojo.CustomerElectronicCard;
import com.platform.yijia.pojo.IntegralRule;
import com.platform.yijia.service.ElectronicMembershipCardService;
import com.platform.yijia.service.IntegralRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("electronicMembershipCardService")
public class ElectronicMembershipCardServiceImpl implements ElectronicMembershipCardService {
    @Resource
    private ElectronicMembershipCardMapper electronicMembershipCardMapper;

    //根据小程序用户openId查询客户电子会员卡信息-
    @Override
    public CustomerElectronicCard getElectronicCardInfoByMinaOpenId(CustomerElectronicCard customerElectronicCard) {
        return electronicMembershipCardMapper.getElectronicCardInfoByMinaOpenId(customerElectronicCard);
    }

    //插入电子会员卡
    @Override
    public void insetElectronicCard(CustomerElectronicCard customerElectronicCard) {
        electronicMembershipCardMapper.insetElectronicCard(customerElectronicCard);
    }

    //根据unionId和油品类型获取用户用要充值电子会员卡(储蓄卡)信息
    @Override
    public CustomerElectronicCard getElectronicCardInfoByUnionId(CustomerElectronicCard customerElectronicCard) {
        return electronicMembershipCardMapper.getElectronicCardInfoByUnionId(customerElectronicCard);
    }

    //查询油站电子会员卡（储蓄卡）充值设置规则
    @Override
    public List<CustomerCardSetting> getCardRechargeSettingList(CustomerCardSetting customerCardSetting) {
        return electronicMembershipCardMapper.getCardRechargeSettingList(customerCardSetting);
    }

    //根据unionId更新客户余额
    @Override
    public void updateElectronicCardInfoByUnionId(CustomerElectronicCard customerElectronicCard) {
        electronicMembershipCardMapper.updateElectronicCardInfoByUnionId(customerElectronicCard);
    }

    //查询油站的会员卡启用标识 （1、启动 2，停用)
    @Override
    public String getStationCardEnabledFlag(Integer stationId) {
        return electronicMembershipCardMapper.getStationCardEnabledFlag(stationId);
    }

    //根据订单号查询用户的充值记录
    @Override
    public CustomerCardUseRecord getCardRecordByOrderNo(CustomerCardUseRecord customerCardUseRecord) {
        return electronicMembershipCardMapper.getCardRecordByOrderNo(customerCardUseRecord);
    }

    //根据订单号更新客户充值记录
    @Override
    public void updateCardRecordStatusByOrderNo(CustomerCardUseRecord customerCardUseRecord) {
        electronicMembershipCardMapper.updateCardRecordStatusByOrderNo(customerCardUseRecord);
    }

    //获取用户储蓄卡的使用记录
    @Override
    public List<CustomerCardUseRecord> getCardUseRecordList(CustomerCardUseRecord customerCardUseRecord) {
        return electronicMembershipCardMapper.getCardUseRecordList(customerCardUseRecord);
    }

    //获取用户储蓄卡列表
    @Override
    public List<CustomerElectronicCard> getElectronicCardList(CustomerElectronicCard customerElectronicCard) {
        return electronicMembershipCardMapper.getElectronicCardList(customerElectronicCard);
    }

    //更新电子会员卡（储蓄卡）的信息
    @Override
    public void updateElectronicCardInfo(CustomerElectronicCard customerElectronicCard) {
        electronicMembershipCardMapper.updateElectronicCardInfo(customerElectronicCard);
    }

    //新增电子会员卡的充值使用记录
    @Override
    public void insetCardUseRecordRecharge(CustomerCardUseRecord customerCardUseRecord) {
        electronicMembershipCardMapper.insetCardUseRecordRecharge(customerCardUseRecord);
    }

    //新增电子会员卡的消费使用记录
    @Override
    public void insetCardUseRecordConsumption(CustomerCardUseRecord customerCardUseRecord) {
        electronicMembershipCardMapper.insetCardUseRecordConsumption(customerCardUseRecord);
    }

    //获取活用要充值电子会员卡的信息
    @Override
    public CustomerElectronicCard getElectronicCardInfo(CustomerElectronicCard customerElectronicCard) {
        return electronicMembershipCardMapper.getElectronicCardInfo(customerElectronicCard);
    }
}
