| Line 1582... |
Line 1582... |
| 1582 |
|
1582 |
|
| 1583 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive()).map(x -> x.getId())
|
1583 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive()).map(x -> x.getId())
|
| 1584 |
.collect(Collectors.toList());
|
1584 |
.collect(Collectors.toList());
|
| 1585 |
Map<Integer, List<FocusedModelShortageModel>> focusedModelShortageReportMap = new HashMap<>();
|
1585 |
Map<Integer, List<FocusedModelShortageModel>> focusedModelShortageReportMap = new HashMap<>();
|
| 1586 |
for (Integer fofoId : fofoIds) {
|
1586 |
for (Integer fofoId : fofoIds) {
|
| 1587 |
// int fofoId = 175120474;
|
- |
|
| 1588 |
if (!focusedModelShortageReportMap.containsKey(fofoId)) {
|
1587 |
if (!focusedModelShortageReportMap.containsKey(fofoId)) {
|
| 1589 |
focusedModelShortageReportMap.put(fofoId, new ArrayList<>());
|
1588 |
focusedModelShortageReportMap.put(fofoId, new ArrayList<>());
|
| 1590 |
}
|
1589 |
}
|
| 1591 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
1590 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 1592 |
Map<Integer, Integer> processingOrderMap = null;
|
1591 |
Map<Integer, Integer> processingOrderMap = null;
|
| Line 1668... |
Line 1667... |
| 1668 |
|
1667 |
|
| 1669 |
if (!focusedModelShortageModel.isEmpty()) {
|
1668 |
if (!focusedModelShortageModel.isEmpty()) {
|
| 1670 |
String subject = "Stock Alert";
|
1669 |
String subject = "Stock Alert";
|
| 1671 |
String messageText = this.getMessage(focusedModelShortageModel);
|
1670 |
String messageText = this.getMessage(focusedModelShortageModel);
|
| 1672 |
|
1671 |
|
| 1673 |
this.sendMailWithAttachments(subject, messageText, "tejbeer1710@gmail.com"); // change Email
|
1672 |
this.sendMailWithAttachments(subject, messageText, customRetailer.getEmail());
|
| 1674 |
String notificationMessage = this.getNotificationMessage(focusedModelShortageModel);
|
1673 |
String notificationMessage = this.getNotificationMessage(focusedModelShortageModel);
|
| 1675 |
|
1674 |
|
| 1676 |
LOGGER.info("notificationMessage" + notificationMessage);
|
1675 |
LOGGER.info("notificationMessage" + notificationMessage);
|
| 1677 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
1676 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
| 1678 |
|
1677 |
|
| Line 1691... |
Line 1690... |
| 1691 |
nc.setCreatedTimestamp(LocalDateTime.now());
|
1690 |
nc.setCreatedTimestamp(LocalDateTime.now());
|
| 1692 |
nc.setMessageType(MessageType.notification);
|
1691 |
nc.setMessageType(MessageType.notification);
|
| 1693 |
notificationCampaignRepository.persist(nc);
|
1692 |
notificationCampaignRepository.persist(nc);
|
| 1694 |
LOGGER.info("nc" + nc);
|
1693 |
LOGGER.info("nc" + nc);
|
| 1695 |
LOGGER.info("fofoID" + fofoId);
|
1694 |
LOGGER.info("fofoID" + fofoId);
|
| 1696 |
int userId = userAccountRepository.selectUserIdByRetailerId(175120474);
|
1695 |
int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
|
| 1697 |
LOGGER.info("userId" + userId);
|
1696 |
LOGGER.info("userId" + userId);
|
| 1698 |
|
1697 |
|
| 1699 |
UserCampaign uc = new UserCampaign();
|
1698 |
UserCampaign uc = new UserCampaign();
|
| 1700 |
uc.setCampaignId(nc.getId());
|
1699 |
uc.setCampaignId(nc.getId());
|
| 1701 |
uc.setUserId(userId);
|
1700 |
uc.setUserId(userId);
|
| Line 1704... |
Line 1703... |
| 1704 |
List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
|
1703 |
List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
|
| 1705 |
LocalDateTime.now().minusMonths(3), LocalDateTime.now());
|
1704 |
LocalDateTime.now().minusMonths(3), LocalDateTime.now());
|
| 1706 |
pushNotification(nc.getId(), devices);
|
1705 |
pushNotification(nc.getId(), devices);
|
| 1707 |
|
1706 |
|
| 1708 |
}
|
1707 |
}
|
| - |
|
1708 |
|
| 1709 |
}
|
1709 |
}
|
| 1710 |
|
1710 |
|
| 1711 |
String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
1711 |
String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| 1712 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
1712 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| 1713 |
Map<String, List<List<? extends Serializable>>> emailRowsMap = new HashMap<>();
|
1713 |
Map<String, List<List<? extends Serializable>>> emailRowsMap = new HashMap<>();
|
| Line 1738... |
Line 1738... |
| 1738 |
baos = FileUtil.getCSVByteStream(headers, e.getValue());
|
1738 |
baos = FileUtil.getCSVByteStream(headers, e.getValue());
|
| 1739 |
} catch (Exception e2) {
|
1739 |
} catch (Exception e2) {
|
| 1740 |
// TODO Auto-generated catch block
|
1740 |
// TODO Auto-generated catch block
|
| 1741 |
e2.printStackTrace();
|
1741 |
e2.printStackTrace();
|
| 1742 |
}
|
1742 |
}
|
| 1743 |
String[] sendToArray = new String[] {
|
1743 |
String[] sendToArray = new String[] { e.getKey() };
|
| 1744 |
// e.getKey()
|
- |
|
| 1745 |
"tejbeer1710@gmail.com" };
|
- |
|
| 1746 |
try {
|
1744 |
try {
|
| 1747 |
|
1745 |
|
| 1748 |
LOGGER.info("email" + e.getKey());
|
1746 |
LOGGER.info("email" + e.getKey());
|
| 1749 |
LOGGER.info("list" + e.getValue());
|
1747 |
LOGGER.info("list" + e.getValue());
|
| 1750 |
|
1748 |
|