Skip to content

Commit

Permalink
chore: 리뷰반영
Browse files Browse the repository at this point in the history
  • Loading branch information
Soundbar91 committed Jan 17, 2025
1 parent c1c4184 commit 12fc4e0
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -83,15 +80,12 @@ public AdminNewOwnersResponse getNewOwners(OwnersCondition ownersCondition) {

List<OwnerIncludingShop> ownerIncludingShops = new ArrayList<>();
for (Owner owner : result.getContent()) {
Optional<OwnerShop> 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);
Expand Down

0 comments on commit 12fc4e0

Please sign in to comment.