| Line 816... |
Line 816... |
| 816 |
partnerRowMap.put(partnerSalesTargetRowEntry.getKey(), row);
|
816 |
partnerRowMap.put(partnerSalesTargetRowEntry.getKey(), row);
|
| 817 |
rows.add(row);
|
817 |
rows.add(row);
|
| 818 |
}
|
818 |
}
|
| 819 |
|
819 |
|
| 820 |
String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
820 |
String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| 821 |
Map<String, Set<String>> storeGuysMap = csService.getAuthUserPartnerEmailMapping();
|
821 |
Map<String, Set<Integer>> storeGuysMap = csService.getAuthUserPartnerIdMapping();
|
| 822 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
822 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : storeGuysMap.entrySet()) {
|
| 823 |
if (storeGuyEntry.getValue().size() == 0)
|
823 |
if (storeGuyEntry.getValue().size() == 0)
|
| 824 |
continue;
|
824 |
continue;
|
| 825 |
List<List<?>> storeGuyRows = storeGuyEntry.getValue().stream().map(x -> partnerRowMap.get(x))
|
825 |
List<List<?>> storeGuyRows = storeGuyEntry.getValue().stream().filter(x -> partnerRowMap.containsKey(x)).map(x -> partnerRowMap.get(x))
|
| 826 |
.collect(Collectors.toList());
|
826 |
.collect(Collectors.toList());
|
| 827 |
ByteArrayOutputStream authUserStream = FileUtil.getCSVByteStream(headers, storeGuyRows);
|
827 |
ByteArrayOutputStream authUserStream = FileUtil.getCSVByteStream(headers, storeGuyRows);
|
| 828 |
Attachment attache = new Attachment(fileName, new ByteArrayResource(authUserStream.toByteArray()));
|
828 |
Attachment attache = new Attachment(fileName, new ByteArrayResource(authUserStream.toByteArray()));
|
| 829 |
System.out.println(storeGuyEntry.getValue());
|
829 |
System.out.println(storeGuyEntry.getValue());
|
| 830 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { storeGuyEntry.getKey() }, null,
|
830 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { storeGuyEntry.getKey() }, null,
|