| Line 165... |
Line 165... |
| 165 |
System.out.println("test end");
|
165 |
System.out.println("test end");
|
| 166 |
|
166 |
|
| 167 |
}
|
167 |
}
|
| 168 |
|
168 |
|
| 169 |
public void generateBiReport() throws Exception {
|
169 |
public void generateBiReport() throws Exception {
|
| 170 |
this.generateBiReportHierarchyWise();
|
- |
|
| 171 |
this.generateBiReportForAllPartner();
|
170 |
this.generateBiReportExcel();
|
| 172 |
}
|
171 |
}
|
| 173 |
|
172 |
|
| 174 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
173 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
| 175 |
sdCreditService.createLoanForBilling(transactionId, invoiceAmount, invoiceNumber);
|
174 |
sdCreditService.createLoanForBilling(transactionId, invoiceAmount, invoiceNumber);
|
| 176 |
|
175 |
|
| Line 452... |
Line 451... |
| 452 |
this.sendMailHtmlFormat(emailRecipients, emailContent.toString(), null, bcc, subject);
|
451 |
this.sendMailHtmlFormat(emailRecipients, emailContent.toString(), null, bcc, subject);
|
| 453 |
|
452 |
|
| 454 |
LOGGER.info("Consolidated Sales L1 feedback summary email sent.");
|
453 |
LOGGER.info("Consolidated Sales L1 feedback summary email sent.");
|
| 455 |
}
|
454 |
}
|
| 456 |
|
455 |
|
| 457 |
public void generateBiReportHierarchyWise() throws Exception{
|
456 |
public Map<String, Set<Integer>> generateBiReportHierarchyWise() throws Exception{
|
| 458 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM);
|
457 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM,ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 459 |
|
- |
|
| 460 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
458 |
Map<String, Set<Integer>> storeGuyEntry = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
| 461 |
String storeGuyEmail = storeGuyEntry.getKey();
|
459 |
return storeGuyEntry;
|
| 462 |
Set<Integer> fofoIds = storeGuyEntry.getValue();
|
- |
|
| 463 |
List<Integer> fofoIdList = new ArrayList<>(fofoIds);
|
- |
|
| 464 |
Map<Integer,CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(fofoIdList);
|
- |
|
| 465 |
String[] sendToArray = new String[]{storeGuyEmail};
|
- |
|
| 466 |
this.generateBiReportExcel(customRetailerMap,sendToArray);
|
- |
|
| 467 |
|
- |
|
| 468 |
}
|
- |
|
| 469 |
}
|
- |
|
| 470 |
|
- |
|
| 471 |
public void generateBiReportForAllPartner() throws Exception{
|
- |
|
| 472 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
|
- |
|
| 473 |
String[] sendToArray = new String[]{"ranu.rajput@smartdukaan.com","ashutosh.verma@smartdukaan.com","sm@smartdukaan.com","raj.singh@smartdukaan.com"};
|
- |
|
| 474 |
this.generateBiReportExcel(customRetailers,sendToArray);
|
- |
|
| 475 |
}
|
460 |
}
|
| 476 |
|
461 |
|
| 477 |
|
462 |
|
| 478 |
|
463 |
|
| 479 |
public void generateBiReportExcel( Map<Integer,CustomRetailer> customRetailers,String[] sendToArray) throws Exception {
|
464 |
public void generateBiReportExcel() throws Exception {
|
| 480 |
|
465 |
|
| 481 |
LocalDateTime startOfToday;
|
466 |
LocalDateTime startOfToday;
|
| 482 |
LocalDateTime previousDay;
|
467 |
LocalDateTime previousDay;
|
| 483 |
|
468 |
|
| 484 |
if (LocalDate.now().getDayOfMonth() == 1) {
|
469 |
if (LocalDate.now().getDayOfMonth() == 1) {
|
| Line 490... |
Line 475... |
| 490 |
// Otherwise, use today
|
475 |
// Otherwise, use today
|
| 491 |
startOfToday = LocalDate.now().atStartOfDay();
|
476 |
startOfToday = LocalDate.now().atStartOfDay();
|
| 492 |
previousDay = startOfToday.with(LocalTime.MAX).minusDays(1);
|
477 |
previousDay = startOfToday.with(LocalTime.MAX).minusDays(1);
|
| 493 |
}
|
478 |
}
|
| 494 |
|
479 |
|
| - |
|
480 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
|
| - |
|
481 |
|
| 495 |
List<Integer> retailerIds = customRetailers.values().stream()
|
482 |
List<Integer> retailerIds = customRetailers.values().stream()
|
| 496 |
.filter(retailer -> {
|
483 |
.filter(retailer -> {
|
| 497 |
String storeCode = retailer.getCode(); // adjust method name if different
|
484 |
String storeCode = retailer.getCode(); // adjust method name if different
|
| 498 |
return !storeCode.equalsIgnoreCase("UPGBN640") && !storeCode.equalsIgnoreCase("HRYN039");
|
485 |
return !storeCode.equalsIgnoreCase("UPGBN640") && !storeCode.equalsIgnoreCase("HRYN039");
|
| 499 |
})
|
486 |
})
|
| Line 1198... |
Line 1185... |
| 1198 |
fofoDayBeforeYesterdaySecondaryMap.get(fofoId)
|
1185 |
fofoDayBeforeYesterdaySecondaryMap.get(fofoId)
|
| 1199 |
));
|
1186 |
));
|
| 1200 |
rows.add(row);
|
1187 |
rows.add(row);
|
| 1201 |
}
|
1188 |
}
|
| 1202 |
|
1189 |
|
| - |
|
1190 |
Map<String, Set<Integer>> storeGuyMap = this.generateBiReportHierarchyWise();
|
| - |
|
1191 |
|
| - |
|
1192 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
|
| - |
|
1193 |
String storeGuyEmail = storeGuyEntry.getKey();
|
| - |
|
1194 |
Set<Integer> fofoIds = storeGuyEntry.getValue();
|
| - |
|
1195 |
String[] sendToArray = new String[]{storeGuyEmail};
|
| - |
|
1196 |
|
| - |
|
1197 |
List<List<?>> filteredRows = rows.stream()
|
| - |
|
1198 |
.filter(row -> row.size() > 5 && fofoIds.contains((Integer) row.get(5)))
|
| - |
|
1199 |
.collect(Collectors.toList());
|
| - |
|
1200 |
this.sendMailToUser(headerGroup,filteredRows,sendToArray);
|
| - |
|
1201 |
}
|
| - |
|
1202 |
|
| - |
|
1203 |
this.sendMailToUser(headerGroup,rows,new String[]{"ranu.rajput@smartdukaan.com"});
|
| 1203 |
|
1204 |
|
| 1204 |
this.sendMailToUser(headerGroup,rows,sendToArray);
|
- |
|
| 1205 |
|
1205 |
|
| 1206 |
}
|
1206 |
}
|
| 1207 |
|
1207 |
|
| 1208 |
private void sendMailToUser(List<List<String>> headerGroup,List<List<?>> rows, String[] sendToArray ) throws Exception {
|
1208 |
private void sendMailToUser(List<List<String>> headerGroup,List<List<?>> rows, String[] sendToArray ) throws Exception {
|
| 1209 |
// Send to email
|
1209 |
// Send to email
|