Subversion Repositories SmartDukaan

Rev

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

Rev 29250 Rev 29292
Line 234... Line 234...
234
			}
234
			}
235
 
235
 
236
			Map<String, Set<Integer>> invoicefofoIdmap = ords.stream().collect(Collectors.groupingBy(
236
			Map<String, Set<Integer>> invoicefofoIdmap = ords.stream().collect(Collectors.groupingBy(
237
					x -> x.getInvoiceNumber(), Collectors.mapping(Order::getRetailerId, Collectors.toSet())));
237
					x -> x.getInvoiceNumber(), Collectors.mapping(Order::getRetailerId, Collectors.toSet())));
238
 
238
 
-
 
239
			LOGGER.info("invoicefofoIdmap" + invoicefofoIdmap);
-
 
240
 
239
			Map<String, Set<String>> airbillInvoiceNumberMap = billedOrderList.stream()
241
			Map<String, Set<String>> airbillInvoiceNumberMap = billedOrderList.stream()
240
					.collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(),
242
					.collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(),
241
							Collectors.mapping(BilledOrderListModel::getInvoiceNumber, Collectors.toSet())));
243
							Collectors.mapping(BilledOrderListModel::getInvoiceNumber, Collectors.toSet())));
242
 
244
 
-
 
245
			LOGGER.info("airbillInvoiceNumberMap" + airbillInvoiceNumberMap);
-
 
246
 
243
			for (Entry<String, Set<String>> aim : airbillInvoiceNumberMap.entrySet()) {
247
			for (Entry<String, Set<String>> aim : airbillInvoiceNumberMap.entrySet()) {
244
				Set<String> InvoceNumbers = aim.getValue();
248
				Set<String> InvoceNumbers = aim.getValue();
245
				Set<Integer> fofoId = new HashSet<>();
249
				Set<Integer> fofoId = new HashSet<>();
246
				for (String InvoceNumber : InvoceNumbers) {
250
				for (String InvoceNumber : InvoceNumbers) {
-
 
251
					if (invoicefofoIdmap.get(InvoceNumber) != null) {
247
					fofoId.addAll(invoicefofoIdmap.get(InvoceNumber));
252
						fofoId.addAll(invoicefofoIdmap.get(InvoceNumber));
248
 
253
					}
249
				}
254
				}
250
				LOGGER.info("fofoId" + fofoId);
255
				LOGGER.info("fofoId" + fofoId);
251
 
256
 
252
				if (fofoId.size() > 1) {
257
				if (fofoId.size() > 1) {
253
					throw new ProfitMandiBusinessException("Uploaded File", "",
258
					throw new ProfitMandiBusinessException("Uploaded File", "",
Line 262... Line 267...
262
 
267
 
263
				if (provider == null) {
268
				if (provider == null) {
264
					throw new ProfitMandiBusinessException("Uploaded File", "", "Provider is not Available");
269
					throw new ProfitMandiBusinessException("Uploaded File", "", "Provider is not Available");
265
				}
270
				}
266
				if (!orders.isEmpty()) {
271
				if (!orders.isEmpty()) {
267
					dispatchNotication = logisticsService.markedOrderShippedDetail(orders, provider,
272
					dispatchNotication = logisticsService.markedOrderShippedDetail(orders, provider, dispatchNotication,
268
							bl.getAirwayBillNumber());
273
							bl.getAirwayBillNumber());
269
 
274
 
270
				} else {
275
				} else {
271
					throw new ProfitMandiBusinessException("Uploaded File", "", "No Order Found");
276
					throw new ProfitMandiBusinessException("Uploaded File", "", "No Order Found");
272
				}
277
				}
273
 
278
 
274
				if (!dispatchNotication.isEmpty()) {
279
				LOGGER.info("dispatchNotication" + dispatchNotication);
-
 
280
			}
275
 
281
 
276
					for (Entry<String, DispatchNotificationModel> dn : dispatchNotication.entrySet()) {
282
			if (!dispatchNotication.isEmpty()) {
277
 
283
 
278
						Provider pr = providerRepository.selectById(dn.getValue().getProviderId());
284
				for (Entry<String, DispatchNotificationModel> dn : dispatchNotication.entrySet()) {
279
 
285
 
280
						Set<String> invoiceNumber = new HashSet<>();
-
 
281
						invoiceNumber.addAll(dn.getValue().getInvoiceNumber());
-
 
282
						SendNotificationModel sendNotificationModel = new SendNotificationModel();
-
 
283
						sendNotificationModel.setCampaignName("Order Shipped");
-
 
284
						sendNotificationModel.setTitle("Order Shipped");
-
 
285
						sendNotificationModel.setMessage(String.format("Dear partner, your items with Invoice Number "
-
 
286
								+ String.join(",", invoiceNumber) + " worth Rs." + dn.getValue().getTotalAmount()
-
 
287
								+ " and qty " + dn.getValue().getTotalQty() + " has been shipped through "
-
 
288
								+ pr.getName() + " via your track id " + dn.getKey() + " and will be delivered by "
-
 
289
								+ dn.getValue().getDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))));
-
 
290
						sendNotificationModel.setType("url");
-
 
291
						sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
-
 
292
						sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
-
 
293
						sendNotificationModel.setMessageType(MessageType.notification);
-
 
294
						int userId = userAccountRepository.selectUserIdByRetailerId(dn.getValue().getFofoId());
286
					Provider pr = providerRepository.selectById(dn.getValue().getProviderId());
295
						sendNotificationModel.setUserIds(Arrays.asList(userId));
-
 
296
						notificationService.sendNotification(sendNotificationModel);
-
 
297
					}
-
 
298
 
287
 
-
 
288
					Set<String> invoiceNumber = new HashSet<>();
-
 
289
					invoiceNumber.addAll(dn.getValue().getInvoiceNumber());
-
 
290
					SendNotificationModel sendNotificationModel = new SendNotificationModel();
-
 
291
					sendNotificationModel.setCampaignName("Order Shipped");
-
 
292
					sendNotificationModel.setTitle("Order Shipped");
-
 
293
					sendNotificationModel.setMessage(String.format("Dear partner, your items with Invoice Number "
-
 
294
							+ String.join(",", invoiceNumber) + " worth Rs." + dn.getValue().getTotalAmount()
-
 
295
							+ " and qty " + dn.getValue().getTotalQty() + " has been shipped through " + pr.getName()
-
 
296
							+ " via your track id " + dn.getKey() + " and will be delivered by "
-
 
297
							+ dn.getValue().getDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))));
-
 
298
					sendNotificationModel.setType("url");
-
 
299
					sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
-
 
300
					sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
-
 
301
					sendNotificationModel.setMessageType(MessageType.notification);
-
 
302
					int userId = userAccountRepository.selectUserIdByRetailerId(dn.getValue().getFofoId());
-
 
303
					sendNotificationModel.setUserIds(Arrays.asList(userId));
-
 
304
					notificationService.sendNotification(sendNotificationModel);
299
				}
305
				}
300
 
306
 
301
				LOGGER.info("dispatchNotication" + dispatchNotication);
-
 
302
			}
307
			}
303
		}
308
		}
304
 
309
 
305
		LOGGER.info("dispatchNotication" + dispatchNotication);
310
		LOGGER.info("dispatchNotication" + dispatchNotication);
306
		LOGGER.info("billedOrderList" + billedOrderList);
311
		LOGGER.info("billedOrderList" + billedOrderList);