package com.hzs.bonus.account.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.bonus.account.service.ICuMemberTradeService;
import com.hzs.bonus.achieve.service.impl.CuMemberBonusSettle;
import com.hzs.common.domain.member.account.CuMemberTrade;
import com.hzs.bonus.account.mapper.CuMemberTradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 会员交易明细 服务实现类
 */
@Service
public class CuMemberTradeServiceImpl extends ServiceImpl<CuMemberTradeMapper, CuMemberTrade> implements ICuMemberTradeService {

    @Autowired
    private CuMemberBonusSettle cuMemberBonusSettle;

    @Override
    public List<Long> batchQueryCuMemberTradeSeq(Integer rowNum) {
        return baseMapper.batchQueryCuMemberTradeSeq(rowNum);
    }

    @Override
    public void batchInsertCuMemberTrade(List<CuMemberTrade> cuMemberTradeList) {
        List<List<?>> cutList = cuMemberBonusSettle.handleCutList(cuMemberTradeList);
        cutList.forEach(memberTradeList ->
                baseMapper.batchInsertCuMemberTrade(memberTradeList));
    }

}
