Subversion Repositories SmartDukaan

Rev

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

Rev 30066 Rev 30217
Line 85... Line 85...
85
		notificationCampaignRepository.persist(nc);
85
		notificationCampaignRepository.persist(nc);
86
 
86
 
87
		UserCampaign uc = null;
87
		UserCampaign uc = null;
88
 
88
 
89
		Set<Integer> userIds = new HashSet<>();
89
		Set<Integer> userIds = new HashSet<>();
90
		if(sendNotificationModel.getUserIds() != null && sendNotificationModel.getUserIds().size() > 0) {
90
		if (sendNotificationModel.getUserIds() != null && sendNotificationModel.getUserIds().size() > 0) {
91
			userIds.addAll(sendNotificationModel.getUserIds());
91
			userIds.addAll(sendNotificationModel.getUserIds());
92
		}
92
		}
93
 
93
 
94
		if(sendNotificationModel.getStateIds() !=null && sendNotificationModel.getStateIds().size() > 0) {
94
		if (sendNotificationModel.getStateIds() != null && sendNotificationModel.getStateIds().size() > 0) {
95
			userIds.addAll(fofoStoreRepository.selectByWarehouseIds(sendNotificationModel.getStateIds()).stream()
95
			userIds.addAll(fofoStoreRepository.selectByWarehouseIds(sendNotificationModel.getStateIds()).stream()
96
					.map(x -> x.getId()).collect(Collectors.toList()));
96
					.map(x -> x.getId()).collect(Collectors.toList()));
97
		}
97
		}
98
 
98
 
99
		LOGGER.info("userIds" + userIds);
99
		LOGGER.info("userIds" + userIds);
Line 115... Line 115...
115
	}
115
	}
116
 
116
 
117
	@Override
117
	@Override
118
	public void sendNotificationToAll(SendNotificationModel sendNotificationModel) throws ProfitMandiBusinessException {
118
	public void sendNotificationToAll(SendNotificationModel sendNotificationModel) throws ProfitMandiBusinessException {
119
		sendNotificationModel.setUserIds(fofoStoreRepository.selectAllDtrUserIds());
119
		sendNotificationModel.setUserIds(fofoStoreRepository.selectAllDtrUserIds());
-
 
120
		Set<AuthUser> authUsers = new HashSet<>(
120
		Set<AuthUser> authUsers = new HashSet<>(csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM));
121
				csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM));
121
		authUsers.addAll(csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY));
122
		authUsers.addAll(csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY));
122
		authUsers.addAll(csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES));
123
		authUsers.addAll(csService.getAuthUserByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES));
123
		List<String> emailIds = authUsers.stream().map(x -> x.getEmailId()).collect(Collectors.toList());
124
		List<String> emailIds = authUsers.stream().map(x -> x.getEmailId()).collect(Collectors.toList());
-
 
125
		emailIds.add("devki.nandan@smartdukaan.com");
124
		List<User> systemUsers = dtrUserRepository.selectAllByEmailIds(emailIds);
126
		List<User> systemUsers = dtrUserRepository.selectAllByEmailIds(emailIds);
-
 
127
		sendNotificationModel.getUserIds()
125
		sendNotificationModel.getUserIds().addAll(systemUsers.stream().map(x -> x.getId()).collect(Collectors.toList()));
128
				.addAll(systemUsers.stream().map(x -> x.getId()).collect(Collectors.toList()));
126
		this.sendNotification(sendNotificationModel);
129
		this.sendNotification(sendNotificationModel);
127
	}
130
	}
128
 
131
 
129
	@Override
132
	@Override
130
	public void sendNotification(int fofoId, String campaignName, MessageType messageType, String title, String message) throws ProfitMandiBusinessException {
133
	public void sendNotification(int fofoId, String campaignName, MessageType messageType, String title, String message)
-
 
134
			throws ProfitMandiBusinessException {
131
		SendNotificationModel sendNotificationModel = this.getDefaultNotificationModel();
135
		SendNotificationModel sendNotificationModel = this.getDefaultNotificationModel();
132
		sendNotificationModel.setCampaignName(campaignName);
136
		sendNotificationModel.setCampaignName(campaignName);
133
		sendNotificationModel.setMessageType(messageType);
137
		sendNotificationModel.setMessageType(messageType);
134
		sendNotificationModel.setTitle(title);
138
		sendNotificationModel.setTitle(title);
135
		sendNotificationModel.setMessage(message);
139
		sendNotificationModel.setMessage(message);