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

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

import java.util.List;

/**
 * 服务实现类
 */
@Service
public class CuMemberTradeDetailServiceImpl extends ServiceImpl<CuMemberTradeDetailMapper, CuMemberTradeDetail> implements ICuMemberTradeDetailService {

    @Autowired
    private CuMemberBonusSettle cuMemberBonusSettle;

    @Override
    public void batchInsertCuMemberTradeDetail(List<CuMemberTradeDetail> cuMemberTradeDetailList) {
        List<List<?>> cutList = cuMemberBonusSettle.handleCutList(cuMemberTradeDetailList);
        cutList.forEach(memberTradeDetailList ->
                baseMapper.batchInsertCuMemberTradeDetail(memberTradeDetailList));
    }

    @Override
    public void updateCuMemberTradeDetailByPeriod(Integer startPeriod, Integer endPeriod, Integer pkCountry) {
        baseMapper.updateCuMemberTradeDetailByPeriod(startPeriod, endPeriod, pkCountry);
    }

}
