package com.yiqi.activity.service.impl;

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

import com.yiqi.activity.domain.vo.ActivityRechargeItemVO;
import com.yiqi.common.enums.SourceType;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.activity.mapper.ActivityRechargeItemMapper;
import com.yiqi.activity.domain.ActivityRechargeItem;
import com.yiqi.activity.service.IActivityRechargeItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 充值多送活动Service业务层处理
 *
 * @author xiaohei
 * @date 2023-09-10
 */
@Service
public class ActivityRechargeItemServiceImpl extends ServiceImpl<ActivityRechargeItemMapper,ActivityRechargeItem> implements IActivityRechargeItemService {

    /**
     * 查询充值多送活动
     *
     * @param id 充值多送活动主键
     * @return 充值多送活动
     */
    @Override
    public ActivityRechargeItem selectActivityRechargeItemById(Long id) {
        return baseMapper.selectActivityRechargeItemById(id);
    }

    /**
     * 查询充值多送活动列表
     *
     * @param activityRechargeItem 充值多送活动
     * @return 充值多送活动
     */
    @Override
    public List<ActivityRechargeItemVO> selectActivityRechargeItemList(ActivityRechargeItem activityRechargeItem) {
        return baseMapper.selectActivityRechargeItemList(activityRechargeItem);
    }

    /**
     * 新增充值多送活动
     *
     * @param activityRechargeItem 充值多送活动
     * @return 结果
     */
    @Override
    public int insertActivityRechargeItem(ActivityRechargeItem activityRechargeItem) {
        activityRechargeItem.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(activityRechargeItem);
    }

    /**
     * 修改充值多送活动
     *
     * @param activityRechargeItem 充值多送活动
     * @return 结果
     */
    @Override
    public int updateActivityRechargeItem(ActivityRechargeItem activityRechargeItem) {
        activityRechargeItem.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(activityRechargeItem);
    }

    /**
     * 批量删除充值多送活动
     *
     * @param ids 需要删除的充值多送活动主键
     * @return 结果
     */
    @Override
    public int deleteActivityRechargeItemByIds(Long[] ids) {
        return baseMapper.deleteActivityRechargeItemByIds(ids);
    }

    /**
     * 删除充值多送活动信息
     *
     * @param id 充值多送活动主键
     * @return 结果
     */
    @Override
    public int deleteActivityRechargeItemById(Long id) {
        return baseMapper.deleteActivityRechargeItemById(id);
    }

    @Override
    public ActivityRechargeItem getGiveAmountByActivity(Long rechargeTypeId, Long storeId) {
        return baseMapper.getGiveAmountByActivity(rechargeTypeId, storeId, DateUtils.dateTimeNow("yyyy-MM-dd"));
    }

    @Override
    public List<ActivityRechargeItemVO> getRechargeActivityItemInfo(Long activityId) {
        return baseMapper.getRechargeActivityItemInfo(activityId);
    }


}
