| Line 186... |
Line 186... |
| 186 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
186 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
| 187 |
x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
|
187 |
x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
|
| 188 |
|
188 |
|
| 189 |
List<List<?>> rows = new ArrayList<>();
|
189 |
List<List<?>> rows = new ArrayList<>();
|
| 190 |
for (PriceDrop priceDrop : priceDrops) {
|
190 |
for (PriceDrop priceDrop : priceDrops) {
|
| 191 |
rows.add(Arrays.asList(priceDrop.getId(), catalogDescription.get(priceDrop.getCatalogItemId()), priceDrop.getTp(), priceDrop.getOldDp(), priceDrop.getMop(),
|
191 |
rows.add(Arrays.asList(priceDrop.getId(), priceDrop.getCatalogItemId(), catalogDescription.get(priceDrop.getCatalogItemId()), priceDrop.getTp(), priceDrop.getOldDp(), priceDrop.getMop(),
|
| 192 |
priceDrop.getAmount(), priceDrop.getNewDp(), FormattingUtils.formatDate(priceDrop.getAffectedOn()), FormattingUtils.formatDate(priceDrop.getCreatedOn())
|
192 |
priceDrop.getAmount(), priceDrop.getNewDp(), FormattingUtils.formatDate(priceDrop.getAffectedOn()), FormattingUtils.formatDate(priceDrop.getCreatedOn())
|
| 193 |
));
|
193 |
));
|
| 194 |
|
194 |
|
| 195 |
}
|
195 |
}
|
| 196 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
196 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
| 197 |
Arrays.asList("Drop Id", "Item Name", "TP", "DP", "Mop", "Price Drop",
|
197 |
Arrays.asList("Drop Id", "Catalog Id", "Item Name", "TP", "DP", "Mop", "Price Drop",
|
| 198 |
"New DP", "Affected On", "Created On"),
|
198 |
"New DP", "Affected On", "Created On"),
|
| 199 |
rows);
|
199 |
rows);
|
| 200 |
ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Price Drop ");
|
200 |
ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Price Drop ");
|
| 201 |
return responseEntity;
|
201 |
return responseEntity;
|
| 202 |
}
|
202 |
}
|