| Line 1403... |
Line 1403... |
| 1403 |
sendNotificationModel
|
1403 |
sendNotificationModel
|
| 1404 |
.setMessage(String.format("Smartphones Rs.%.0f, Insurance Rs.%.0f, Total Rs.%.0f till %s.",
|
1404 |
.setMessage(String.format("Smartphones Rs.%.0f, Insurance Rs.%.0f, Total Rs.%.0f till %s.",
|
| 1405 |
model.getSmartphoneSale(), model.getInsuranceSale(), model.getTotalSale(),
|
1405 |
model.getSmartphoneSale(), model.getInsuranceSale(), model.getTotalSale(),
|
| 1406 |
String.format(timeString, now.format(timeFormatter))));
|
1406 |
String.format(timeString, now.format(timeFormatter))));
|
| 1407 |
sendNotificationModel.setType("url");
|
1407 |
sendNotificationModel.setType("url");
|
| 1408 |
sendNotificationModel.setUrl("http://app.profitmandi.com/pages/home/notifications");
|
1408 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/notifications");
|
| 1409 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
1409 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 1410 |
sendNotificationModel.setMessageType(MessageType.notification);
|
1410 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 1411 |
int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
|
1411 |
int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
|
| 1412 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
1412 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 1413 |
notificationService.sendNotification(sendNotificationModel);
|
1413 |
notificationService.sendNotification(sendNotificationModel);
|
| Line 1595... |
Line 1595... |
| 1595 |
|
1595 |
|
| 1596 |
public void sendNotification() throws Exception {
|
1596 |
public void sendNotification() throws Exception {
|
| 1597 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllByTimestamp();
|
1597 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllByTimestamp();
|
| 1598 |
if (!pushNotifications.isEmpty()) {
|
1598 |
if (!pushNotifications.isEmpty()) {
|
| 1599 |
for (PushNotifications pushNotification : pushNotifications) {
|
1599 |
for (PushNotifications pushNotification : pushNotifications) {
|
| 1600 |
LOGGER.info("pushNotification {}", pushNotification);
|
- |
|
| 1601 |
Device device = deviceRepository.selectById(pushNotification.getDeviceId());
|
1600 |
Device device = deviceRepository.selectById(pushNotification.getDeviceId());
|
| 1602 |
NotificationCampaign notificationCampaign = notificationCampaignRepository
|
1601 |
NotificationCampaign notificationCampaign = notificationCampaignRepository
|
| 1603 |
.selectById(pushNotification.getNotificationCampaignid());
|
1602 |
.selectById(pushNotification.getNotificationCampaignid());
|
| 1604 |
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls()
|
1603 |
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls()
|
| 1605 |
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();
|
1604 |
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();
|
| Line 1870... |
Line 1869... |
| 1870 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
1869 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 1871 |
sendNotificationModel.setCampaignName("Stock Alert");
|
1870 |
sendNotificationModel.setCampaignName("Stock Alert");
|
| 1872 |
sendNotificationModel.setTitle("Alert");
|
1871 |
sendNotificationModel.setTitle("Alert");
|
| 1873 |
sendNotificationModel.setMessage(notificationMessage);
|
1872 |
sendNotificationModel.setMessage(notificationMessage);
|
| 1874 |
sendNotificationModel.setType("url");
|
1873 |
sendNotificationModel.setType("url");
|
| 1875 |
sendNotificationModel.setUrl("http://app.profitmandi.com/pages/home/notifications");
|
1874 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/notifications");
|
| 1876 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
1875 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 1877 |
sendNotificationModel.setMessageType(MessageType.notification);
|
1876 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 1878 |
int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
|
1877 |
int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
|
| 1879 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
1878 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 1880 |
notificationService.sendNotification(sendNotificationModel);
|
1879 |
notificationService.sendNotification(sendNotificationModel);
|
| Line 2109... |
Line 2108... |
| 2109 |
}
|
2108 |
}
|
| 2110 |
}
|
2109 |
}
|
| 2111 |
|
2110 |
|
| 2112 |
}
|
2111 |
}
|
| 2113 |
|
2112 |
|
| 2114 |
/*public void checkPriceDrop() throws Exception {
|
- |
|
| 2115 |
List<PriceDrop> priceDrops = priceDropRepository.selectAllIncomplete();
|
- |
|
| 2116 |
for(PriceDrop pd : priceDrops) {
|
- |
|
| 2117 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByPriceDropId(pd.getId());
|
- |
|
| 2118 |
List<String> approvedSerialNumbers = priceDropIMEIs.stream()
|
- |
|
| 2119 |
.filter(x->x.getStatus().equals(PriceDropImeiStatus.APPROVED))
|
- |
|
| 2120 |
.map(x->x.getImei()).collect(Collectors.toList());
|
- |
|
| 2121 |
List<ActivatedImei> activatedImeis = activatedImeiRepository.selectBySerialNumbers(approvedSerialNumbers);
|
- |
|
| 2122 |
activatedImeis.stream().forEach(x->x.get);
|
- |
|
| 2123 |
}
|
- |
|
| 2124 |
}*/
|
- |
|
| 2125 |
|
- |
|
| 2126 |
}
|
- |
|
| 2127 |
|
2113 |
}
|
| - |
|
2114 |
|