| Line 5... |
Line 5... |
| 5 |
import java.time.LocalDateTime;
|
5 |
import java.time.LocalDateTime;
|
| 6 |
import java.time.LocalTime;
|
6 |
import java.time.LocalTime;
|
| 7 |
import java.util.ArrayList;
|
7 |
import java.util.ArrayList;
|
| 8 |
import java.util.Arrays;
|
8 |
import java.util.Arrays;
|
| 9 |
import java.util.HashMap;
|
9 |
import java.util.HashMap;
|
| 10 |
import java.util.HashSet;
|
- |
|
| 11 |
import java.util.List;
|
10 |
import java.util.List;
|
| 12 |
import java.util.Map;
|
11 |
import java.util.Map;
|
| 13 |
import java.util.Set;
|
12 |
import java.util.Set;
|
| 14 |
import java.util.stream.Collectors;
|
13 |
import java.util.stream.Collectors;
|
| 15 |
|
14 |
|
| Line 19... |
Line 18... |
| 19 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
18 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 20 |
import org.apache.commons.lang.StringUtils;
|
19 |
import org.apache.commons.lang.StringUtils;
|
| 21 |
import org.apache.http.HttpResponse;
|
20 |
import org.apache.http.HttpResponse;
|
| 22 |
import org.apache.logging.log4j.LogManager;
|
21 |
import org.apache.logging.log4j.LogManager;
|
| 23 |
import org.apache.logging.log4j.Logger;
|
22 |
import org.apache.logging.log4j.Logger;
|
| 24 |
import org.json.JSONArray;
|
- |
|
| 25 |
import org.springframework.beans.factory.annotation.Autowired;
|
23 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 26 |
import org.springframework.beans.factory.annotation.Qualifier;
|
24 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 27 |
import org.springframework.core.io.ByteArrayResource;
|
25 |
import org.springframework.core.io.ByteArrayResource;
|
| 28 |
import org.springframework.http.HttpHeaders;
|
26 |
import org.springframework.http.HttpHeaders;
|
| 29 |
import org.springframework.http.HttpStatus;
|
27 |
import org.springframework.http.HttpStatus;
|
| Line 134... |
Line 132... |
| 134 |
@Autowired
|
132 |
@Autowired
|
| 135 |
LineItemImeisRepository lineItemImeisRepository;
|
133 |
LineItemImeisRepository lineItemImeisRepository;
|
| 136 |
|
134 |
|
| 137 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
135 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
| 138 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
136 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
| 139 |
|
- |
|
| 140 |
List<TagListing> tagListings = tagListingRepository.selectAll(false);
|
- |
|
| 141 |
|
- |
|
| 142 |
Map<Integer, String> catalogDescription = new HashMap<>();
|
- |
|
| 143 |
for (TagListing tagListing : tagListings) {
|
- |
|
| 144 |
Item item = itemRepository.selectById(tagListing.getItemId());
|
- |
|
| 145 |
tagListing.setItemDescription(item.getItemDescription());
|
- |
|
| 146 |
catalogDescription.put(item.getCatalogItemId(), item.getItemDescriptionNoColor());
|
- |
|
| 147 |
}
|
- |
|
| 148 |
|
- |
|
| 149 |
|
- |
|
| 150 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
137 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| - |
|
138 |
Set<Integer> catalogIds = priceDrops.stream().map(x->x.getCatalogItemId()).collect(Collectors.toSet());
|
| - |
|
139 |
List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
|
| - |
|
140 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x->x.getCatalogItemId(), x->x.getItemDescriptionNoColor()));
|
| 151 |
model.addAttribute("priceDrops", priceDrops);
|
141 |
model.addAttribute("priceDrops", priceDrops);
|
| 152 |
model.addAttribute("catalogDescription", catalogDescription);
|
142 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 153 |
return "price-drop";
|
143 |
return "price-drop";
|
| 154 |
|
- |
|
| 155 |
}
|
144 |
}
|
| 156 |
|
145 |
|
| 157 |
@RequestMapping(value = "/item-pricing/{itemId}", method = RequestMethod.GET)
|
146 |
@RequestMapping(value = "/item-pricing/{itemId}", method = RequestMethod.GET)
|
| 158 |
public String getItemPricing(HttpServletRequest request, Model model, @PathVariable int itemId) throws Throwable {
|
147 |
public String getItemPricing(HttpServletRequest request, Model model, @PathVariable int itemId) throws Throwable {
|
| 159 |
|
148 |
|