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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.bonus.achieve.service.ICuMemberSettlePeriodService;
import com.hzs.bonus.detail.service.ICuMemberAssessService;
import com.hzs.common.core.constant.TableNameConstants;
import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.domain.member.detail.CuMemberAssess;
import com.hzs.bonus.detail.mapper.CuMemberAssessMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 会员信息-会员考核记录 服务实现类
 */
@Service
public class CuMemberAssessServiceImpl extends ServiceImpl<CuMemberAssessMapper, CuMemberAssess> implements ICuMemberAssessService {

    @Autowired
    private ICuMemberSettlePeriodService iCuMemberSettlePeriodService;

    @Override
    public List<CuMemberAssess> queryCuMemberAssTotal(String startDate, Integer pkCountry) {
        int period = iCuMemberSettlePeriodService.getCuMemberSettlePeriodByDate(startDate).getPkId();
        String tableTable = TableNameConstants.CU_MEMBER_ASSESS + DateUtils.getYear(startDate);
        return baseMapper.queryCuMemberAssTotal(tableTable, period, pkCountry);
    }
}
