37
37
import ru .mystamps .web .Url ;
38
38
import ru .mystamps .web .dao .dto .CollectionInfoDto ;
39
39
import ru .mystamps .web .dao .dto .SeriesInCollectionDto ;
40
+ import ru .mystamps .web .dao .dto .SeriesInCollectionWithPriceDto ;
40
41
import ru .mystamps .web .service .CategoryService ;
41
42
import ru .mystamps .web .service .CollectionService ;
42
43
import ru .mystamps .web .service .CountryService ;
@@ -53,6 +54,7 @@ public class CollectionController {
53
54
private final SeriesService seriesService ;
54
55
private final MessageSource messageSource ;
55
56
57
+ // @todo #884 /collection/{slug}: add a link to collection estimation page
56
58
@ GetMapping (Url .INFO_COLLECTION_PAGE )
57
59
public String showInfoBySlug (
58
60
@ PathVariable ("slug" ) String slug ,
@@ -101,6 +103,38 @@ public String showInfoBySlug(
101
103
102
104
return "collection/info" ;
103
105
}
106
+
107
+ // @todo #884 Add integration tests for collection estimation page
108
+ @ GetMapping (Url .ESTIMATION_COLLECTION_PAGE )
109
+ public String showPrices (
110
+ @ PathVariable ("slug" ) String slug ,
111
+ Model model ,
112
+ Locale userLocale ,
113
+ HttpServletResponse response )
114
+ throws IOException {
115
+
116
+ if (slug == null ) {
117
+ response .sendError (HttpServletResponse .SC_NOT_FOUND );
118
+ return null ;
119
+ }
120
+
121
+ // TODO: we need only ownerName, without id and slug
122
+ CollectionInfoDto collection = collectionService .findBySlug (slug );
123
+ if (collection == null ) {
124
+ response .sendError (HttpServletResponse .SC_NOT_FOUND );
125
+ return null ;
126
+ }
127
+
128
+ String owner = collection .getOwnerName ();
129
+ model .addAttribute ("ownerName" , owner );
130
+
131
+ String lang = LocaleUtils .getLanguageOrNull (userLocale );
132
+ List <SeriesInCollectionWithPriceDto > seriesOfCollection =
133
+ collectionService .findSeriesWithPricesBySlug (slug , lang );
134
+ model .addAttribute ("seriesOfCollection" , seriesOfCollection );
135
+
136
+ return "collection/estimation" ;
137
+ }
104
138
105
139
@ GetMapping (Url .INFO_COLLECTION_BY_ID_PAGE )
106
140
public View showInfoById (
0 commit comments