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

import com.red.circle.common.business.dto.cmd.UserIdCmd;
import com.red.circle.other.infra.database.rds.service.user.user.CpApplyService;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * cp申请查询.
 *
 * @author pengliang on 2021/7/14
 */
@Component
@RequiredArgsConstructor
public class CpApplyIdQryExe {

  private final CpApplyService cpApplyService;

  public String execute(UserIdCmd cmd) {
    return Optional.ofNullable(cpApplyService.getId(cmd.requiredReqUserId(), cmd.getUserId()))
        .map(String::valueOf)
        .orElse(null);
  }

}
