diff --git a/src/main/java/in/koreatech/koin/admin/owner/service/AdminOwnerService.java b/src/main/java/in/koreatech/koin/admin/owner/service/AdminOwnerService.java index 66ebc2d16..3d55e6e6c 100644 --- a/src/main/java/in/koreatech/koin/admin/owner/service/AdminOwnerService.java +++ b/src/main/java/in/koreatech/koin/admin/owner/service/AdminOwnerService.java @@ -2,8 +2,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; -import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -23,7 +21,6 @@ import in.koreatech.koin.admin.user.repository.AdminUserRepository; import in.koreatech.koin.domain.owner.model.Owner; import in.koreatech.koin.domain.owner.model.OwnerIncludingShop; -import in.koreatech.koin.domain.owner.model.OwnerShop; import in.koreatech.koin.domain.shop.model.shop.Shop; import in.koreatech.koin.domain.user.model.UserType; import in.koreatech.koin.global.model.Criteria; @@ -83,15 +80,12 @@ public AdminNewOwnersResponse getNewOwners(OwnersCondition ownersCondition) { List ownerIncludingShops = new ArrayList<>(); for (Owner owner : result.getContent()) { - Optional ownerShopOptional = adminOwnerShopRedisRepository.findById(owner.getId()); - Shop shop = null; - - if (ownerShopOptional.isPresent()) { - OwnerShop ownerShop = ownerShopOptional.get(); - if (!Objects.isNull(ownerShop.getShopId())) { - shop = adminShopRepository.findById(ownerShop.getShopId()).orElse(null); - } - } + Shop shop = adminOwnerShopRedisRepository.findById(owner.getId()) + .map(ownerShop -> { + Integer shopId = ownerShop.getShopId(); + return shopId != null ? adminShopRepository.findById(shopId).orElse(null) : null; + }) + .orElse(null); OwnerIncludingShop ownerIncludingShop = OwnerIncludingShop.of(owner, shop); ownerIncludingShops.add(ownerIncludingShop);