| Line 3875... |
Line 3875... |
| 3875 |
|
3875 |
|
| 3876 |
orders.forEach(x -> x.setShipmentHold(false));
|
3876 |
orders.forEach(x -> x.setShipmentHold(false));
|
| 3877 |
orders = orders.stream().filter(x -> x.getRefundTimestamp() != null).collect(Collectors.toList());
|
3877 |
orders = orders.stream().filter(x -> x.getRefundTimestamp() != null).collect(Collectors.toList());
|
| 3878 |
if (orders.size() > 0) {
|
3878 |
if (orders.size() > 0) {
|
| 3879 |
|
3879 |
|
| 3880 |
double totalAmount = orders.stream().collect(Collectors.summingDouble(x -> x.getTotalAmount()));
|
3880 |
double totalAmount = orders.stream().collect(Collectors.summingDouble(x -> x.getTotalAmount()));
|
| 3881 |
|
3881 |
|
| 3882 |
List<String> authUserEmail = csService.getAuthUserIdByPartnerId(orders.get(0).getRetailerId()).stream().map(x -> x.getEmailId()).collect(Collectors.toList());
|
3882 |
List<String> authUserEmail = csService.getAuthUserIdByPartnerId(orders.get(0).getRetailerId()).stream().map(x -> x.getEmailId()).collect(Collectors.toList());
|
| 3883 |
authUserEmail.add("vinay.p@smartdukaan.com");
|
3883 |
authUserEmail.add("vinay.p@smartdukaan.com");
|
| 3884 |
authUserEmail.add("shivam.gupta@smartdukaan.com");
|
3884 |
authUserEmail.add("shivam.gupta@smartdukaan.com");
|
| 3885 |
|
3885 |
|
| 3886 |
String[] emailTo = authUserEmail.toArray(new String[authUserEmail.size()]);
|
3886 |
String[] emailTo = authUserEmail.toArray(new String[authUserEmail.size()]);
|
| 3887 |
|
3887 |
|
| 3888 |
String[] ccTo = {"tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com"};
|
3888 |
String[] ccTo = {"tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com"};
|
| 3889 |
|
3889 |
|
| 3890 |
String subject = "Dispatch held orders of - " + (orders.get(0).getRetailerName());
|
3890 |
String subject = "Dispatch held orders of - " + (orders.get(0).getRetailerName());
|
| 3891 |
String message = String.format("Dear Team, \n" + "kindly note the material for the " + orders.get(0).getRetailerName() + "of Rs." + totalAmount + "is unhold now and needs to be dispatched.");
|
3891 |
String message = String.format("Dear Team, \n" + "kindly note the material for the " + orders.get(0).getRetailerName() + "of Rs." + totalAmount + "is unhold now and needs to be dispatched.");
|
| 3892 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
3892 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
| 3893 |
}
|
3893 |
}
|
| 3894 |
|
3894 |
|
| 3895 |
|
3895 |
|
| 3896 |
}
|
3896 |
}
|
| 3897 |
|
3897 |
|
| Line 4080... |
Line 4080... |
| 4080 |
|
4080 |
|
| 4081 |
filteredRows.add(loan);
|
4081 |
filteredRows.add(loan);
|
| 4082 |
}
|
4082 |
}
|
| 4083 |
}
|
4083 |
}
|
| 4084 |
if (!filteredRows.isEmpty()) {
|
4084 |
if (!filteredRows.isEmpty()) {
|
| - |
|
4085 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
| 4085 |
String messageText = this.getMessageForDueDateExtend(filteredRows);
|
4086 |
String messageText = this.getMessageForDueDateExtend(filteredRows);
|
| 4086 |
String[] email = new String[]{storeGuyEntry.getKey(),"puneet.wahi@smartdukaan.com"};
|
- |
|
| 4087 |
|
- |
|
| 4088 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, subject);
|
4087 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, subject);
|
| 4089 |
|
4088 |
|
| 4090 |
}
|
4089 |
}
|
| 4091 |
|
4090 |
|
| 4092 |
}
|
4091 |
}
|
| - |
|
4092 |
String messageText = this.getMessageForDueDateExtend(defaultLoans);
|
| - |
|
4093 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com"}, messageText, null, subject);
|
| 4093 |
|
4094 |
|
| 4094 |
for (Loan defaultLoan : defaultLoans) {
|
4095 |
for (Loan defaultLoan : defaultLoans) {
|
| 4095 |
List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
|
4096 |
List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
|
| 4096 |
|
4097 |
|
| 4097 |
double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
|
4098 |
double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
|
| Line 4233... |
Line 4234... |
| 4233 |
}
|
4234 |
}
|
| 4234 |
|
4235 |
|
| 4235 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws Exception {
|
4236 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws Exception {
|
| 4236 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4237 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 4237 |
|
4238 |
|
| - |
|
4239 |
List<Loan> filteredRows = new ArrayList<>();
|
| 4238 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
4240 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 4239 |
List<Loan> filteredRows = new ArrayList<>();
|
- |
|
| 4240 |
for (Loan loan : dueDateCrossLoans) {
|
4241 |
for (Loan loan : dueDateCrossLoans) {
|
| 4241 |
|
4242 |
|
| 4242 |
if (storeGuyEntry.getValue().contains(loan.getFofoId())) {
|
4243 |
if (storeGuyEntry.getValue().contains(loan.getFofoId())) {
|
| 4243 |
|
4244 |
|
| 4244 |
filteredRows.add(loan);
|
4245 |
filteredRows.add(loan);
|
| 4245 |
}
|
4246 |
}
|
| 4246 |
}
|
4247 |
}
|
| 4247 |
if (!filteredRows.isEmpty()) {
|
4248 |
if (!filteredRows.isEmpty()) {
|
| 4248 |
String messageText = this.getMessageForDueDateCross(filteredRows);
|
4249 |
String messageText = this.getMessageForDueDateCross(filteredRows);
|
| 4249 |
String[] email = new String[]{storeGuyEntry.getKey(),"puneet.wahi@smartdukaan.com"};
|
4250 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
| 4250 |
|
4251 |
|
| 4251 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, "Due Date Cross");
|
4252 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, "Due Date Cross");
|
| 4252 |
|
4253 |
|
| 4253 |
}
|
4254 |
}
|
| 4254 |
|
4255 |
|
| 4255 |
}
|
4256 |
}
|
| - |
|
4257 |
String messageText = this.getMessageForDueDateCross(filteredRows);
|
| - |
|
4258 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com"}, messageText, null, "Due Date Cross");
|
| - |
|
4259 |
|
| - |
|
4260 |
|
| - |
|
4261 |
|
| 4256 |
if (!dueDateCrossLoans.isEmpty()) {
|
4262 |
if (!dueDateCrossLoans.isEmpty()) {
|
| 4257 |
for (Loan loan : dueDateCrossLoans) {
|
4263 |
for (Loan loan : dueDateCrossLoans) {
|
| 4258 |
|
4264 |
|
| 4259 |
long noOfdaysBetween = ChronoUnit.DAYS.between(loan.getDueDate().toLocalDate(), LocalDate.now());
|
4265 |
long noOfdaysBetween = ChronoUnit.DAYS.between(loan.getDueDate().toLocalDate(), LocalDate.now());
|
| 4260 |
|
4266 |
|