| Line 505... |
Line 505... |
| 505 |
new String[] { "amit.gupta@shop2020.in", "adeel.yazdani@smartdukaan.com" }, null,
|
505 |
new String[] { "amit.gupta@shop2020.in", "adeel.yazdani@smartdukaan.com" }, null,
|
| 506 |
"Partner Excess Amount", "PFA", "ListofSchemes.csv", new ByteArrayResource(baos.toByteArray()));
|
506 |
"Partner Excess Amount", "PFA", "ListofSchemes.csv", new ByteArrayResource(baos.toByteArray()));
|
| 507 |
|
507 |
|
| 508 |
}
|
508 |
}
|
| 509 |
|
509 |
|
| 510 |
public void processScheme(int offset) throws Exception {
|
510 |
public void processScheme(int offset, boolean dryRun) throws Exception {
|
| 511 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
|
511 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
|
| 512 |
LocalDateTime endDate = startDate.plusDays(30);
|
512 |
LocalDateTime endDate = startDate.plusDays(30);
|
| 513 |
processScheme(startDate, endDate);
|
513 |
processScheme(startDate, endDate, dryRun);
|
| 514 |
}
|
514 |
}
|
| 515 |
|
515 |
|
| 516 |
public void processScheme(int offset, int durationDays) throws Exception {
|
516 |
public void processScheme(int offset, int durationDays, boolean dryRun) throws Exception {
|
| 517 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
|
517 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
|
| 518 |
LocalDateTime endDate = startDate.plusDays(durationDays);
|
518 |
LocalDateTime endDate = startDate.plusDays(durationDays);
|
| 519 |
processScheme(startDate, endDate);
|
519 |
processScheme(startDate, endDate, dryRun);
|
| 520 |
}
|
520 |
}
|
| 521 |
|
521 |
|
| 522 |
public void processScheme() throws Exception {
|
522 |
public void processScheme(boolean dryRun) throws Exception {
|
| 523 |
LocalDateTime fromDate = LocalDateTime.now().minusDays(30);
|
523 |
LocalDateTime fromDate = LocalDateTime.now().minusDays(30);
|
| 524 |
processScheme(fromDate, LocalDateTime.now());
|
524 |
processScheme(fromDate, LocalDateTime.now(), dryRun);
|
| 525 |
}
|
525 |
}
|
| 526 |
|
526 |
|
| 527 |
public void processScheme(LocalDateTime startDate, LocalDateTime endDate) throws Exception {
|
527 |
public void processScheme(LocalDateTime startDate, LocalDateTime endDate, boolean dryRun) throws Exception {
|
| 528 |
LOGGER.info("Started execution at {}", LocalDateTime.now());
|
528 |
LOGGER.info("Started execution at {}", LocalDateTime.now());
|
| 529 |
System.out.println(
|
529 |
System.out.println(
|
| 530 |
"InventoryId\tSerialNumber\tItem Id\tScheme Id\tScheme Name\tScheme Type\tAmount Type\tDP\tTaxable\tScheme Amount\tAmount Paid");
|
530 |
"InventoryId\tSerialNumber\tItem Id\tScheme Id\tScheme Name\tScheme Type\tAmount Type\tDP\tTaxable\tScheme Amount\tAmount Paid");
|
| 531 |
try {
|
531 |
try {
|
| 532 |
List<Purchase> purchases = purchaseRepository.selectAllBetweenPurchaseDate(startDate, endDate);
|
532 |
List<Purchase> purchases = purchaseRepository.selectAllBetweenPurchaseDate(startDate, endDate);
|
| Line 548... |
Line 548... |
| 548 |
for (UserWalletHistory uwh : uwhs) {
|
548 |
for (UserWalletHistory uwh : uwhs) {
|
| 549 |
System.out.println(String.format("%d\t%d\t%s\t%s\t%s", uwh.getAmount(), uwh.getReference(),
|
549 |
System.out.println(String.format("%d\t%d\t%s\t%s\t%s", uwh.getAmount(), uwh.getReference(),
|
| 550 |
uwh.getReferenceType(), uwh.getTimestamp().toString(), uwh.getDescription()));
|
550 |
uwh.getReferenceType(), uwh.getTimestamp().toString(), uwh.getDescription()));
|
| 551 |
}
|
551 |
}
|
| 552 |
LOGGER.info("Schemes process successfully.");
|
552 |
LOGGER.info("Schemes process successfully.");
|
| - |
|
553 |
if(dryRun) {
|
| 553 |
throw new Exception();
|
554 |
throw new Exception();
|
| - |
|
555 |
}
|
| 554 |
}
|
556 |
}
|
| 555 |
|
557 |
|
| 556 |
public void processRechargeCashback() throws Throwable {
|
558 |
public void processRechargeCashback() throws Throwable {
|
| 557 |
LocalDateTime cashbackTime = LocalDateTime.now();
|
559 |
LocalDateTime cashbackTime = LocalDateTime.now();
|
| 558 |
int referenceId = (int) Timestamp.valueOf(cashbackTime).getTime() / 1000;
|
560 |
int referenceId = (int) Timestamp.valueOf(cashbackTime).getTime() / 1000;
|
| Line 765... |
Line 767... |
| 765 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
767 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
| 766 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
768 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
| 767 |
"focostockreport.xml", params);
|
769 |
"focostockreport.xml", params);
|
| 768 |
Attachment attache = new Attachment(
|
770 |
Attachment attache = new Attachment(
|
| 769 |
"partner-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
771 |
"partner-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
| - |
|
772 |
System.out.println(storeGuyEntry.getValue());
|
| 770 |
Utils.sendMailWithAttachments(googleMailSender, storeGuyEntry.getValue().toArray(new String[] {}), null,
|
773 |
Utils.sendMailWithAttachments(googleMailSender, storeGuyEntry.getValue().toArray(new String[] {}), null,
|
| 771 |
"Partner Stock Report", "PFA", attache);
|
774 |
"Partner Stock Report", "PFA", attache);
|
| 772 |
}
|
775 |
}
|
| 773 |
|
776 |
|
| 774 |
}
|
777 |
}
|
| Line 1325... |
Line 1328... |
| 1325 |
mailSender.send(message);
|
1328 |
mailSender.send(message);
|
| 1326 |
}
|
1329 |
}
|
| 1327 |
|
1330 |
|
| 1328 |
public void sendNotification() throws Exception {
|
1331 |
public void sendNotification() throws Exception {
|
| 1329 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllByTimestamp();
|
1332 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllByTimestamp();
|
| 1330 |
|
- |
|
| 1331 |
LOGGER.info("pushNotifications" + pushNotifications);
|
- |
|
| 1332 |
if (!pushNotifications.isEmpty()) {
|
1333 |
if (!pushNotifications.isEmpty()) {
|
| 1333 |
for (PushNotifications pushNotification : pushNotifications) {
|
1334 |
for (PushNotifications pushNotification : pushNotifications) {
|
| 1334 |
Device device = deviceRepository.selectById(pushNotification.getDeviceId());
|
1335 |
Device device = deviceRepository.selectById(pushNotification.getDeviceId());
|
| 1335 |
NotificationCampaign notificationCampaign = notificationCampaignRepository
|
1336 |
NotificationCampaign notificationCampaign = notificationCampaignRepository
|
| 1336 |
.selectById(pushNotification.getNotificationCampaignid());
|
1337 |
.selectById(pushNotification.getNotificationCampaignid());
|