package com.red.circle.wallet.app.command.bank.query;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.wallet.infra.database.mongo.service.bank.UserBankBalanceService;
import java.math.BigDecimal;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 用户银行账户余额查询.
 *
 * @author pengliang on 2023/2/20
 */
@Component
@RequiredArgsConstructor
public class UserBankBalanceQryExe {

  private final UserBankBalanceService userBankBalanceService;

  public BigDecimal execute(AppExtCommand cmd) {
    return userBankBalanceService.getBalance(cmd.requiredReqUserId()).getAccurateBalance();
  }

}
