Subversion Repositories SmartDukaan

Rev

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

Rev 25721 Rev 25722
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;
1587
			if (!focusedModelShortageReportMap.containsKey(fofoId)) {
1588
			if (!focusedModelShortageReportMap.containsKey(fofoId)) {
1588
				focusedModelShortageReportMap.put(fofoId, new ArrayList<>());
1589
				focusedModelShortageReportMap.put(fofoId, new ArrayList<>());
1589
			}
1590
			}
1590
			CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1591
			CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1591
			Map<Integer, Integer> processingOrderMap = null;
1592
			Map<Integer, Integer> processingOrderMap = null;
Line 1667... Line 1668...
1667
 
1668
 
1668
			if (!focusedModelShortageModel.isEmpty()) {
1669
			if (!focusedModelShortageModel.isEmpty()) {
1669
				String subject = "Stock Alert";
1670
				String subject = "Stock Alert";
1670
				String messageText = this.getMessage(focusedModelShortageModel);
1671
				String messageText = this.getMessage(focusedModelShortageModel);
1671
 
1672
 
1672
				this.sendMailWithAttachments(subject, messageText, customRetailer.getEmail());
1673
				this.sendMailWithAttachments(subject, messageText, "tejbeer1710@gmail.com"); // change Email
1673
				String notificationMessage = this.getNotificationMessage(focusedModelShortageModel);
1674
				String notificationMessage = this.getNotificationMessage(focusedModelShortageModel);
1674
 
1675
 
1675
				LOGGER.info("notificationMessage" + notificationMessage);
1676
				LOGGER.info("notificationMessage" + notificationMessage);
1676
				SimpleCampaignParams scp = new SimpleCampaignParams();
1677
				SimpleCampaignParams scp = new SimpleCampaignParams();
1677
 
1678
 
Line 1690... Line 1691...
1690
				nc.setCreatedTimestamp(LocalDateTime.now());
1691
				nc.setCreatedTimestamp(LocalDateTime.now());
1691
				nc.setMessageType(MessageType.notification);
1692
				nc.setMessageType(MessageType.notification);
1692
				notificationCampaignRepository.persist(nc);
1693
				notificationCampaignRepository.persist(nc);
1693
				LOGGER.info("nc" + nc);
1694
				LOGGER.info("nc" + nc);
1694
				LOGGER.info("fofoID" + fofoId);
1695
				LOGGER.info("fofoID" + fofoId);
1695
				int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
1696
				int userId = userAccountRepository.selectUserIdByRetailerId(175120474);
1696
				LOGGER.info("userId" + userId);
1697
				LOGGER.info("userId" + userId);
1697
 
1698
 
1698
				UserCampaign uc = new UserCampaign();
1699
				UserCampaign uc = new UserCampaign();
1699
				uc.setCampaignId(nc.getId());
1700
				uc.setCampaignId(nc.getId());
1700
				uc.setUserId(userId);
1701
				uc.setUserId(userId);
Line 1703... Line 1704...
1703
				List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
1704
				List<Device> devices = deviceRepository.selectByUserIdAndModifiedTimestamp(userId,
1704
						LocalDateTime.now().minusMonths(3), LocalDateTime.now());
1705
						LocalDateTime.now().minusMonths(3), LocalDateTime.now());
1705
				pushNotification(nc.getId(), devices);
1706
				pushNotification(nc.getId(), devices);
1706
 
1707
 
1707
			}
1708
			}
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[] { e.getKey() };
1743
			String[] sendToArray = new String[] {
-
 
1744
					// e.getKey()
-
 
1745
					"tejbeer1710@gmail.com" };
1744
			try {
1746
			try {
1745
 
1747
 
1746
				LOGGER.info("email" + e.getKey());
1748
				LOGGER.info("email" + e.getKey());
1747
				LOGGER.info("list" + e.getValue());
1749
				LOGGER.info("list" + e.getValue());
1748
 
1750