package com.red.circle.order.inner.service.impl;

import com.red.circle.order.infra.database.rds.service.count.TotalRechargeService;
import com.red.circle.order.inner.convertor.TotalRechargeInnerConvertor;
import com.red.circle.order.inner.model.dto.UserTotalRechargeDTO;
import com.red.circle.order.inner.service.UserTotalRechargeClientService;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 累计用户充值总额.
 *
 * @author pengliang on 2024/1/23
 */
@Service
@RequiredArgsConstructor
public class UserTotalRechargeClientServiceImpl implements UserTotalRechargeClientService {

  private final TotalRechargeService totalRechargeService;
  private final TotalRechargeInnerConvertor totalRechargeInnerConvertor;

  @Override
  public Map<Long, List<UserTotalRechargeDTO>> mapGroup(Set<Long> userIds) {
    return totalRechargeInnerConvertor.toMapUserTotalRechargeDTO(
        totalRechargeService.mapGroup(userIds)
    );
  }

}
