| Line 20... |
Line 20... |
| 20 |
import org.apache.http.HttpResponse;
|
20 |
import org.apache.http.HttpResponse;
|
| 21 |
import org.apache.logging.log4j.LogManager;
|
21 |
import org.apache.logging.log4j.LogManager;
|
| 22 |
import org.apache.logging.log4j.Logger;
|
22 |
import org.apache.logging.log4j.Logger;
|
| 23 |
import org.springframework.beans.factory.annotation.Autowired;
|
23 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24 |
import org.springframework.beans.factory.annotation.Qualifier;
|
24 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
25 |
import org.springframework.cache.annotation.Cacheable;
|
| 25 |
import org.springframework.core.io.ByteArrayResource;
|
26 |
import org.springframework.core.io.ByteArrayResource;
|
| 26 |
import org.springframework.http.HttpHeaders;
|
27 |
import org.springframework.http.HttpHeaders;
|
| 27 |
import org.springframework.http.HttpStatus;
|
28 |
import org.springframework.http.HttpStatus;
|
| 28 |
import org.springframework.http.ResponseEntity;
|
29 |
import org.springframework.http.ResponseEntity;
|
| 29 |
import org.springframework.stereotype.Controller;
|
30 |
import org.springframework.stereotype.Controller;
|
| Line 133... |
Line 134... |
| 133 |
LineItemImeisRepository lineItemImeisRepository;
|
134 |
LineItemImeisRepository lineItemImeisRepository;
|
| 134 |
|
135 |
|
| 135 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
136 |
@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
|
| 136 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
137 |
public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
| 137 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
138 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| 138 |
Set<Integer> catalogIds = priceDrops.stream().map(x->x.getCatalogItemId()).collect(Collectors.toSet());
|
139 |
Set<Integer> catalogIds = priceDrops.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
|
| 139 |
List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
|
140 |
List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
|
| 140 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x->x.getCatalogItemId(), x->x.getItemDescriptionNoColor()));
|
141 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
| - |
|
142 |
x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
|
| 141 |
model.addAttribute("priceDrops", priceDrops);
|
143 |
model.addAttribute("priceDrops", priceDrops);
|
| 142 |
model.addAttribute("catalogDescription", catalogDescription);
|
144 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 143 |
return "price-drop";
|
145 |
return "price-drop";
|
| 144 |
}
|
146 |
}
|
| 145 |
|
147 |
|
| Line 170... |
Line 172... |
| 170 |
return "response";
|
172 |
return "response";
|
| 171 |
}
|
173 |
}
|
| 172 |
|
174 |
|
| 173 |
@RequestMapping(value = "/item", method = RequestMethod.GET)
|
175 |
@RequestMapping(value = "/item", method = RequestMethod.GET)
|
| 174 |
public String getItemPricing(HttpServletRequest request, Model model, @RequestParam String query) throws Throwable {
|
176 |
public String getItemPricing(HttpServletRequest request, Model model, @RequestParam String query) throws Throwable {
|
| 175 |
List<ItemDescriptionModel> customItems = itemRepository.selectPartnerItemsBySearchTerm(query, 20).stream()
|
- |
|
| 176 |
.map(x -> {
|
- |
|
| 177 |
ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
|
177 |
List<ItemDescriptionModel> partnersItemDescription = this.getAllPartnerItemStringDescription()
|
| 178 |
itemDescriptionModel.setItemId(x.getId());
|
- |
|
| 179 |
itemDescriptionModel.setItemDescription(x.getItemDescription() + "(" + x.getId() + ")");
|
178 |
.parallelStream().filter(x -> !x.getItemDescription().matches(query)).collect(Collectors.toList());
|
| 180 |
return itemDescriptionModel;
|
- |
|
| 181 |
}).collect(Collectors.toList());
|
- |
|
| 182 |
|
179 |
|
| 183 |
model.addAttribute("response", mvcResponseSender.createResponseString(customItems));
|
180 |
model.addAttribute("response", mvcResponseSender.createResponseString(partnersItemDescription));
|
| 184 |
return "response";
|
181 |
return "response";
|
| 185 |
}
|
182 |
}
|
| 186 |
|
183 |
|
| - |
|
184 |
@Cacheable(value = "fofoItems", cacheManager = "thirtyMinsTimeOutCacheManager")
|
| - |
|
185 |
private List<ItemDescriptionModel> getAllPartnerItemStringDescription() {
|
| - |
|
186 |
return itemRepository.selectPartnerItems(0).stream().map(x -> {
|
| - |
|
187 |
String itemDescription = x.getItemDescription() + "(" + x.getId() + ")";
|
| - |
|
188 |
ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
|
| - |
|
189 |
itemDescriptionModel.setItemDescription(itemDescription);
|
| - |
|
190 |
itemDescriptionModel.setItemId(x.getId());
|
| - |
|
191 |
return itemDescriptionModel;
|
| - |
|
192 |
}).collect(Collectors.toList());
|
| - |
|
193 |
}
|
| - |
|
194 |
|
| 187 |
/*
|
195 |
/*
|
| - |
|
196 |
* IN-Request-20181101-0125
|
| - |
|
197 |
*
|
| 188 |
* @RequestMapping(value = "/price-drop/imes1/download") public
|
198 |
* @RequestMapping(value = "/price-drop/imes1/download") public
|
| 189 |
* ResponseEntity<ByteArrayResource> downloadPriceDropImeis1(HttpServletRequest
|
199 |
* ResponseEntity<ByteArrayResource> downloadPriceDropImeis1(HttpServletRequest
|
| 190 |
* request,
|
200 |
* request,
|
| 191 |
*
|
201 |
*
|
| 192 |
* @RequestParam LocalDateTime affectedDate, @RequestParam int itemId) throws
|
202 |
* @RequestParam LocalDateTime affectedDate, @RequestParam int itemId) throws
|