| Line 297... |
Line 297... |
| 297 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
297 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
| 298 |
Item item = itemRepository.selectAllByCatalogItemId(priceDrop.getCatalogItemId()).get(0);
|
298 |
Item item = itemRepository.selectAllByCatalogItemId(priceDrop.getCatalogItemId()).get(0);
|
| 299 |
ByteArrayOutputStream baos = getByteArrayOutputStream(priceDrop.getAffectedOn(), priceDrop.getCatalogItemId());
|
299 |
ByteArrayOutputStream baos = getByteArrayOutputStream(priceDrop.getAffectedOn(), priceDrop.getCatalogItemId());
|
| 300 |
final HttpHeaders headers = new HttpHeaders();
|
300 |
final HttpHeaders headers = new HttpHeaders();
|
| 301 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
301 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| 302 |
headers.set("Content-disposition", "inline; filename=pricedrop-" + item.getItemDescriptionNoColor() + "-"
|
302 |
headers.set("Content-disposition", "inline; filename=pricedrop-" + item.getItemDescriptionNoColor().replaceAll("\\s?,\\s?", " ") + "-"
|
| 303 |
+ FormattingUtils.formatDate(priceDrop.getAffectedOn()) + ".csv");
|
303 |
+ FormattingUtils.formatDate(priceDrop.getAffectedOn()) + ".csv");
|
| 304 |
byte[] byteArray = baos.toByteArray();
|
304 |
byte[] byteArray = baos.toByteArray();
|
| 305 |
headers.setContentLength(byteArray.length);
|
305 |
headers.setContentLength(byteArray.length);
|
| 306 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
|
306 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
|
| 307 |
|
307 |
|