| Line 129... |
Line 129... |
| 129 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
129 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
| 130 |
|
130 |
|
| 131 |
List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
131 |
List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
| 132 |
Map<Integer, TagListing> tagListingMap = new HashMap<>();
|
132 |
Map<Integer, TagListing> tagListingMap = new HashMap<>();
|
| 133 |
List<ItemDescriptionModel> customItems = new ArrayList<>();
|
133 |
List<ItemDescriptionModel> customItems = new ArrayList<>();
|
| - |
|
134 |
List<ItemDescriptionModel> newCustomItems = new ArrayList<>();
|
| - |
|
135 |
List<Item> items = itemRepository.selectRecentItems(50);
|
| - |
|
136 |
|
| - |
|
137 |
for(Item item: items) {
|
| - |
|
138 |
ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
|
| - |
|
139 |
itemDescriptionModel.setItemId(item.getId());
|
| - |
|
140 |
itemDescriptionModel.setItemDescription(item.getItemDescription() + "(" + item.getId() + ")");
|
| - |
|
141 |
newCustomItems.add(itemDescriptionModel);
|
| - |
|
142 |
}
|
| - |
|
143 |
|
| 134 |
Map<Integer, String> catalogDescription = new HashMap<>();
|
144 |
Map<Integer, String> catalogDescription = new HashMap<>();
|
| 135 |
for (TagListing tagListing : tagListings) {
|
145 |
for (TagListing tagListing : tagListings) {
|
| 136 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
146 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
| 137 |
tagListing.setItemDescription(item.getItemDescription());
|
147 |
tagListing.setItemDescription(item.getItemDescription());
|
| 138 |
tagListingMap.put(tagListing.getItemId(), tagListing);
|
148 |
tagListingMap.put(tagListing.getItemId(), tagListing);
|
| Line 145... |
Line 155... |
| 145 |
}
|
155 |
}
|
| 146 |
|
156 |
|
| 147 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
157 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| 148 |
model.addAttribute("tagListingMap", tagListingMap);
|
158 |
model.addAttribute("tagListingMap", tagListingMap);
|
| 149 |
model.addAttribute("customItems", new JSONArray(customItems).toString());
|
159 |
model.addAttribute("customItems", new JSONArray(customItems).toString());
|
| - |
|
160 |
model.addAttribute("newCustomItems", new JSONArray(newCustomItems).toString());
|
| 150 |
model.addAttribute("priceDrops", priceDrops);
|
161 |
model.addAttribute("priceDrops", priceDrops);
|
| 151 |
model.addAttribute("catalogDescription", catalogDescription);
|
162 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 152 |
return "price-drop";
|
163 |
return "price-drop";
|
| 153 |
|
164 |
|
| 154 |
}
|
165 |
}
|