| Line 136... |
Line 136... |
| 136 |
|
136 |
|
| 137 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
137 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
| 138 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
138 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
| 139 |
|
139 |
|
| 140 |
List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
140 |
List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
| 141 |
Map<Integer, TagListing> tagListingMap = new HashMap<>();
|
- |
|
| 142 |
Set<ItemDescriptionModel> customItems = new HashSet<>();
|
- |
|
| 143 |
List<ItemDescriptionModel> newCustomItems = new ArrayList<>();
|
- |
|
| 144 |
List<Item> items = itemRepository.selectRecentItems(100);
|
- |
|
| 145 |
for (Item item : items) {
|
- |
|
| 146 |
ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
|
- |
|
| 147 |
itemDescriptionModel.setItemId(item.getId());
|
- |
|
| 148 |
itemDescriptionModel.setItemDescription(item.getItemDescription() + "(" + item.getId() + ")");
|
- |
|
| 149 |
newCustomItems.add(itemDescriptionModel);
|
- |
|
| 150 |
}
|
- |
|
| 151 |
|
141 |
|
| 152 |
Map<Integer, String> catalogDescription = new HashMap<>();
|
142 |
Map<Integer, String> catalogDescription = new HashMap<>();
|
| 153 |
for (TagListing tagListing : tagListings) {
|
143 |
for (TagListing tagListing : tagListings) {
|
| 154 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
144 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
| 155 |
tagListing.setItemDescription(item.getItemDescription());
|
145 |
tagListing.setItemDescription(item.getItemDescription());
|
| 156 |
tagListingMap.put(tagListing.getItemId(), tagListing);
|
- |
|
| 157 |
ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
|
- |
|
| 158 |
itemDescriptionModel.setItemId(tagListing.getItemId());
|
- |
|
| 159 |
itemDescriptionModel
|
- |
|
| 160 |
.setItemDescription(tagListing.getItemDescription() + "(" + tagListing.getItemId() + ")");
|
- |
|
| 161 |
customItems.add(itemDescriptionModel);
|
- |
|
| 162 |
catalogDescription.put(item.getCatalogItemId(), item.getItemDescriptionNoColor());
|
146 |
catalogDescription.put(item.getCatalogItemId(), item.getItemDescriptionNoColor());
|
| 163 |
}
|
147 |
}
|
| 164 |
|
148 |
|
| 165 |
newCustomItems.addAll(customItems);
|
- |
|
| 166 |
|
149 |
|
| 167 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
150 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| 168 |
model.addAttribute("tagListingMap", tagListingMap);
|
- |
|
| 169 |
model.addAttribute("customItems", new JSONArray(customItems).toString());
|
- |
|
| 170 |
model.addAttribute("newCustomItems", new JSONArray(newCustomItems).toString());
|
- |
|
| 171 |
model.addAttribute("priceDrops", priceDrops);
|
151 |
model.addAttribute("priceDrops", priceDrops);
|
| 172 |
model.addAttribute("catalogDescription", catalogDescription);
|
152 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 173 |
return "price-drop";
|
153 |
return "price-drop";
|
| 174 |
|
154 |
|
| 175 |
}
|
155 |
}
|