diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java index 13cb7a7..5d37045 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/cabinet/smartCabinet/SmartCabinetApplicationService.java @@ -54,14 +54,15 @@ public class SmartCabinetApplicationService { .map(SmartCabinetDTO::new) .collect(Collectors.toList()); - dtoList.forEach(dto -> - dto.setShopName( - shopEntities.stream() - .filter(shop -> shop.getShopId().equals(dto.getShopId())) - .findFirst() - .map(ShopEntity::getShopName) - .orElse("")) - ); + dtoList.forEach(dto -> { + ShopEntity shopDo = shopEntities.stream() + .filter(shop -> shop.getShopId().equals(dto.getShopId())) + .findFirst().orElse(null); + if (shopDo != null) { + dto.setShopName(shopDo.getShopName()); + dto.setMode(shopDo.getMode()); + } + }); return new PageDTO<>(dtoList, page.getTotal()); } @@ -72,14 +73,15 @@ public class SmartCabinetApplicationService { .map(SmartCabinetDTO::new) .collect(Collectors.toList()); - dtoList.forEach(dto -> - dto.setShopName( - shopEntities.stream() - .filter(shop -> shop.getShopId().equals(dto.getShopId())) - .findFirst() - .map(ShopEntity::getShopName) - .orElse("")) - ); + dtoList.forEach(dto -> { + ShopEntity shopDo = shopEntities.stream() + .filter(shop -> shop.getShopId().equals(dto.getShopId())) + .findFirst().orElse(null); + if (shopDo != null) { + dto.setShopName(shopDo.getShopName()); + dto.setMode(shopDo.getMode()); + } + }); return dtoList; }