-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMenuInfoOnMapDto.java
More file actions
53 lines (48 loc) · 1.99 KB
/
MenuInfoOnMapDto.java
File metadata and controls
53 lines (48 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.ourmenu.backend.domain.menu.dto;
import com.ourmenu.backend.domain.cache.application.UrlConverterService;
import com.ourmenu.backend.domain.menu.domain.Menu;
import com.ourmenu.backend.domain.menu.domain.MenuImg;
import com.ourmenu.backend.domain.tag.domain.MenuTag;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
public class MenuInfoOnMapDto {
private Long menuId;
private String menuTitle;
private Integer menuPrice;
private String storeTitle;
private String menuPinImgUrl;
private List<String> menuTagImgUrls;
private List<String> menuImgUrls;
private MenuFolderInfoOnMapDto menuFolderInfo;
private Long mapId;
private Double mapX;
private Double mapY;
public static MenuInfoOnMapDto of(Menu menu, List<MenuTag> menuTags, List<MenuImg> menuImgs,
MenuFolderInfoOnMapDto menuFolderInfo, UrlConverterService urlConverterService) {
String menuPinImgUrl = urlConverterService.getMenuPinMapUrl(menu.getPin());
List<String> menuTagImgUrls = menuTags.stream()
.map(MenuTag::getTag)
.map(urlConverterService::getOrangeTagImgUrl)
.toList();
return MenuInfoOnMapDto.builder()
.menuId(menu.getId())
.menuTitle(menu.getTitle())
.menuPrice(menu.getPrice())
.storeTitle(menu.getStore().getTitle())
.menuPinImgUrl(menuPinImgUrl)
.menuTagImgUrls(menuTagImgUrls)
.menuImgUrls(menuImgs.stream()
.map(MenuImg::getImgUrl)
.collect(Collectors.toList())
)
.menuFolderInfo(menuFolderInfo)
.mapId(menu.getStore().getMap().getId())
.mapX(menu.getStore().getMap().getLocation().getX())
.mapY(menu.getStore().getMap().getLocation().getY())
.build();
}
}