Subversion Repositories SmartDukaan

Rev

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

Rev 30984 Rev 30989
Line 1841... Line 1841...
1841
			sendNotificationModel.setMessageType(MessageType.notification);
1841
			sendNotificationModel.setMessageType(MessageType.notification);
1842
			int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
1842
			int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
1843
			sendNotificationModel.setUserIds(Arrays.asList(userId));
1843
			sendNotificationModel.setUserIds(Arrays.asList(userId));
1844
			notificationService.sendNotification(sendNotificationModel);
1844
			notificationService.sendNotification(sendNotificationModel);
1845
 
1845
 
1846
			// notificationService.sendWhatsappMessage(messageTemplate, title,
1846
			notificationService.sendWhatsappMessage(messageTemplate, title, address.getPhoneNumber());
1847
			// address.getPhoneNumber());
-
 
1848
 
1847
 
1849
		}
1848
		}
1850
		// String saleReport = this.getDailySalesReportHtml(partnerSalesHeadersMap,
1849
		// String saleReport = this.getDailySalesReportHtml(partnerSalesHeadersMap,
1851
		// saleTargetReportModelMap);
1850
		// saleTargetReportModelMap);
1852
		String statewiseSaleReport = this.getStateWiseSales(saleTargetReportModelMap, partnerSalesHeadersMap);
1851
		String statewiseSaleReport = this.getStateWiseSales(saleTargetReportModelMap, partnerSalesHeadersMap);
Line 2655... Line 2654...
2655
			sendNotificationModel.setMessageType(MessageType.reminder);
2654
			sendNotificationModel.setMessageType(MessageType.reminder);
2656
			sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(lead.getAssignTo())));
2655
			sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(lead.getAssignTo())));
2657
			System.out.println(sendNotificationModel);
2656
			System.out.println(sendNotificationModel);
2658
			notificationService.sendNotification(sendNotificationModel);
2657
			notificationService.sendNotification(sendNotificationModel);
2659
			AuthUser authUser = authRepository.selectById(lead.getAssignTo());
2658
			AuthUser authUser = authRepository.selectById(lead.getAssignTo());
2660
			// notificationService.sendWhatsappMessage(notificationMessage, title,
2659
		//	notificationService.sendWhatsappMessage(notificationMessage, title, authUser.getMobileNumber());
2661
			// authUser.getMobileNumber());
-
 
2662
		}
2660
		}
2663
	}
2661
	}
2664
 
2662
 
2665
	public void notifyVisits() throws Exception {
2663
	public void notifyVisits() throws Exception {
2666
		List<FranchiseeVisit> franchiseeVisits = franchiseeVisitRepository
2664
		List<FranchiseeVisit> franchiseeVisits = franchiseeVisitRepository
Line 2699... Line 2697...
2699
			sendNotificationModel.setType("url");
2697
			sendNotificationModel.setType("url");
2700
			sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
2698
			sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
2701
			sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
2699
			sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
2702
			sendNotificationModel.setMessageType(MessageType.reminder);
2700
			sendNotificationModel.setMessageType(MessageType.reminder);
2703
			sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(visit.getAuthId())));
2701
			sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(visit.getAuthId())));
2704
			notificationService.sendNotification(sendNotificationModel);
2702
			//notificationService.sendNotification(sendNotificationModel);
2705
		}
2703
		}
2706
	}
2704
	}
2707
 
2705
 
2708
	public void ticketClosed() throws Exception {
2706
	public void ticketClosed() throws Exception {
2709
 
2707
 
Line 3243... Line 3241...
3243
 
3241
 
3244
					Address address = addressRepository.selectById(user.getAddressId());
3242
					Address address = addressRepository.selectById(user.getAddressId());
3245
 
3243
 
3246
					String title = "Order Delivered";
3244
					String title = "Order Delivered";
3247
 
3245
 
3248
					String message = String.format("Dear partner, our SmartDukaan Order " + aws
3246
					String message = String.format("Dear partner, Your SmartDukaan Order " + aws
3249
							+ " has been delivered to you in a safe sealed bag.");
3247
							+ " has been delivered to you in a safe sealed bag.");
3250
 
3248
 
3251
					SendNotificationModel sendNotificationModel = new SendNotificationModel();
3249
					SendNotificationModel sendNotificationModel = new SendNotificationModel();
3252
					sendNotificationModel.setCampaignName("Order Delivered");
3250
					sendNotificationModel.setCampaignName("Order Delivered");
3253
					sendNotificationModel.setTitle(title);
3251
					sendNotificationModel.setTitle(title);
Line 3258... Line 3256...
3258
					sendNotificationModel.setMessageType(MessageType.notification);
3256
					sendNotificationModel.setMessageType(MessageType.notification);
3259
					int userId = userAccountRepository.selectUserIdByRetailerId(orders.get(0).getRetailerId());
3257
					int userId = userAccountRepository.selectUserIdByRetailerId(orders.get(0).getRetailerId());
3260
					sendNotificationModel.setUserIds(Arrays.asList(userId));
3258
					sendNotificationModel.setUserIds(Arrays.asList(userId));
3261
					notificationService.sendNotification(sendNotificationModel);
3259
					notificationService.sendNotification(sendNotificationModel);
3262
 
3260
 
3263
					// notificationService.sendWhatsappMessage(message, title,
3261
					notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3264
					// address.getPhoneNumber());
-
 
3265
 
3262
 
3266
				}
3263
				}
3267
			}
3264
			}
3268
 
3265
 
3269
		}
3266
		}
Line 3612... Line 3609...
3612
 
3609
 
3613
				Address address = addressRepository.selectById(user.getAddressId());
3610
				Address address = addressRepository.selectById(user.getAddressId());
3614
 
3611
 
3615
				String title = "Alert Credit Outstanding!";
3612
				String title = "Alert Credit Outstanding!";
3616
				String url = "http://app.smartdukaan.com/pages/home/credit";
3613
				String url = "http://app.smartdukaan.com/pages/home/credit";
3617
				String message = "Your total pending Loan amount is Rs. "
3614
				String message = "Your total pending Loan amount is Rs."
3618
						+ FormattingUtils.formatDecimal(Math.abs(partnerLoanAmountEnrty.getValue()));
3615
						+ FormattingUtils.formatDecimal(Math.abs(partnerLoanAmountEnrty.getValue())) + ".";
3619
				notificationService.sendNotification(fofoId, title, MessageType.notification, title, message, url);
3616
				notificationService.sendNotification(fofoId, title, MessageType.notification, title, message, url);
3620
 
3617
 
3621
				// notificationService.sendWhatsappMessage(message, title,
3618
				notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3622
				// address.getPhoneNumber());
-
 
3623
 
3619
 
3624
			}
3620
			}
3625
 
3621
 
3626
		}
3622
		}
3627
 
3623
 
Line 3764... Line 3760...
3764
 
3760
 
3765
			com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(defaultLoan.getFofoId());
3761
			com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(defaultLoan.getFofoId());
3766
 
3762
 
3767
			Address address = addressRepository.selectById(user.getAddressId());
3763
			Address address = addressRepository.selectById(user.getAddressId());
3768
 
3764
 
3769
			String title = "Loan amount overdue!";
3765
			String title = "Loan Amount Overdue!";
3770
			String url = "http://app.smartdukaan.com/pages/home/credit";
3766
			String url = "http://app.smartdukaan.com/pages/home/credit";
3771
			String message = "Your loan due date ("
3767
			String message = "Your loan due date "
3772
					+ defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3768
					+ defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3773
					+ ") has been exceeded. Additional penal interest of " + defaultLoan.getInterestRate()
3769
					+ " has been exceeded. Additional penal interest of " + defaultLoan.getInterestRate()
3774
					+ "%  + and Rs.100 shall be levied on daily basis. " + "Your total pending Loan amount is Rs."
3770
					+ "%  and Rs.100 shall be levied on daily basis." + " Your total pending Loan amount is Rs."
3775
					+ FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3771
					+ FormattingUtils.formatDecimal(Math.abs(amount)) +". !!Pay Now!!";
3776
			notificationService.sendNotification(defaultLoan.getFofoId(), title, MessageType.notification, title,
3772
			notificationService.sendNotification(defaultLoan.getFofoId(), title, MessageType.notification, title,
3777
					message, url);
3773
					message, url);
3778
 
3774
 
3779
			// notificationService.sendWhatsappMessage(message, title,
3775
			notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3780
			// address.getPhoneNumber());
-
 
3781
 
3776
 
3782
		}
3777
		}
3783
	}
3778
	}
3784
 
3779
 
3785
	private String getMessageForDueDateExtend(List<Loan> loans) throws ProfitMandiBusinessException {
3780
	private String getMessageForDueDateExtend(List<Loan> loans) throws ProfitMandiBusinessException {
Line 3843... Line 3838...
3843
					List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(loan.getId());
3838
					List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(loan.getId());
3844
 
3839
 
3845
					double amount = loanStatements.stream().map(x -> x.getAmount())
3840
					double amount = loanStatements.stream().map(x -> x.getAmount())
3846
							.collect(Collectors.summingDouble(x -> x.doubleValue()));
3841
							.collect(Collectors.summingDouble(x -> x.doubleValue()));
3847
 
3842
 
3848
					String title = "Alert!";
-
 
3849
					String url = "http://app.smartdukaan.com/pages/home/credit";
3843
					String url = "http://app.smartdukaan.com/pages/home/credit";
-
 
3844
 
-
 
3845
					String title = "Alert!";
3850
					String message = "Your loan due date ("
3846
					String message = "Your loan due date "
3851
							+ loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3847
							+ loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3852
							+ ") has been exceeded. Additional penal interest of " + loan.getInterestRate()
3848
							+ " has been exceeded. Additional penal interest of " + loan.getInterestRate()
3853
							+ "% shall be levied on daily basis. Your total pending Loan amount is Rs."
3849
							+ "% shall be levied on daily basis. Your total pending loan amount is Rs."
3854
							+ FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3850
							+ FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
-
 
3851
 
3855
					notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title,
3852
					notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title,
3856
							message, url);
3853
							message, url);
3857
 
3854
 
3858
					// notificationService.sendWhatsappMessage(message, title,
3855
					notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3859
					// address.getPhoneNumber());
-
 
3860
 
3856
 
3861
				}
3857
				}
3862
			}
3858
			}
3863
		}
3859
		}
3864
 
3860
 
Line 3895... Line 3891...
3895
					} else {
3891
					} else {
3896
 
3892
 
3897
						message = "Your total pending Loan amount is Rs."
3893
						message = "Your total pending Loan amount is Rs."
3898
								+ FormattingUtils.formatDecimal(Math.abs(amount)) + " is due by "
3894
								+ FormattingUtils.formatDecimal(Math.abs(amount)) + " is due by "
3899
								+ loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3895
								+ loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
3900
								+ ", Pay Now!!";
3896
								+ " , Pay Now!!";
3901
 
3897
 
3902
					}
3898
					}
3903
					notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title,
3899
					notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title,
3904
							message, url);
3900
							message, url);
3905
					// notificationService.sendWhatsappMessage(message, title,
3901
					notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3906
					// address.getPhoneNumber());
-
 
3907
 
3902
 
3908
				}
3903
				}
3909
			}
3904
			}
3910
		}
3905
		}
3911
 
3906