package com.red.circle.other.app.command.user.query;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.convertor.user.UserBankIdentityInfoAppConvertor;
import com.red.circle.other.app.dto.clientobject.user.user.BankIdentityInfoCO;
import com.red.circle.other.infra.database.rds.service.user.user.BankIdentityInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 获取最新提交信息.
 *
 * @author pengliang on 2023/6/15
 */
@Component
@RequiredArgsConstructor
public class UserBankIdentityLatestQryExe {

  private final BankIdentityInfoService bankIdentityInfoService;
  private final UserBankIdentityInfoAppConvertor userBankIdentityInfoAppConvertor;

  public BankIdentityInfoCO execute(AppExtCommand cmd) {
    return userBankIdentityInfoAppConvertor.toBankIdentityInfoCO(
        bankIdentityInfoService.getLatest(cmd.requiredReqUserId()));
  }

}
