Subversion Repositories SmartDukaan

Rev

Rev 36561 | Rev 36584 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36561 Rev 36581
Line 2636... Line 2636...
2636
        sender.send(message);
2636
        sender.send(message);
2637
    }
2637
    }
2638
 
2638
 
2639
    public void sendNotification() throws Exception {
2639
    public void sendNotification() throws Exception {
2640
        LOGGER.info("FCM sendNotification");
2640
        LOGGER.info("FCM sendNotification");
2641
        List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllPendingNotifications();
2641
        List<PushNotifications> pushNotifications = pushNotificationRepository.selectPendingNotifications(500);
2642
        if (!pushNotifications.isEmpty()) {
2642
        if (!pushNotifications.isEmpty()) {
2643
            InputStream serviceAccount = getClass().getClassLoader().getResourceAsStream("service-account.json");
2643
            InputStream serviceAccount = getClass().getClassLoader().getResourceAsStream("service-account.json");
2644
            GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
2644
            GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
2645
            googleCredentials.refreshIfExpired();
2645
            googleCredentials.refreshIfExpired();
2646
            String accessToken = googleCredentials.getAccessToken().getTokenValue();
2646
            String accessToken = googleCredentials.getAccessToken().getTokenValue();
Line 5643... Line 5643...
5643
                "ScheduledTasks.sendUpdateMobileBrandMarketShareQuaterlyMail"
5643
                "ScheduledTasks.sendUpdateMobileBrandMarketShareQuaterlyMail"
5644
        );
5644
        );
5645
    }
5645
    }
5646
 
5646
 
5647
 
5647
 
-
 
5648
    @Scheduled(fixedRate = 1800000)
-
 
5649
    public void refreshSnapshotAgeing() {
-
 
5650
        try {
-
 
5651
            sessionFactory.getCurrentSession().createNativeQuery(
-
 
5652
                    "UPDATE inventory.currentinventorysnapshot cis " +
-
 
5653
                    "JOIN ( " +
-
 
5654
                    "    SELECT itemId, currentWarehouseId, " +
-
 
5655
                    "           MIN(rootInvoiceDate) AS oldest, " +
-
 
5656
                    "           MAX(rootInvoiceDate) AS newest " +
-
 
5657
                    "    FROM warehouse.inventoryItem " +
-
 
5658
                    "    WHERE currentQuantity > 0 AND rootInvoiceDate IS NOT NULL " +
-
 
5659
                    "    GROUP BY itemId, currentWarehouseId " +
-
 
5660
                    ") agg ON agg.itemId = cis.item_id AND agg.currentWarehouseId = cis.warehouse_id " +
-
 
5661
                    "SET cis.oldest_invoice_date = agg.oldest, " +
-
 
5662
                    "    cis.newest_invoice_date = agg.newest"
-
 
5663
            ).executeUpdate();
-
 
5664
            LOGGER.info("Snapshot ageing refreshed");
-
 
5665
        } catch (Exception e) {
-
 
5666
            LOGGER.error("Error refreshing snapshot ageing", e);
-
 
5667
        }
-
 
5668
    }
-
 
5669
 
5648
}
5670
}
5649
// 2284"
5671
// 2284"
5650
5672