Subversion Repositories SmartDukaan

Rev

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

Rev 32842 Rev 32850
Line 4603... Line 4603...
4603
                }
4603
                }
4604
            }
4604
            }
4605
        }*/
4605
        }*/
4606
        //Send single whatsapp to tv
4606
        //Send single whatsapp to tv
4607
        String title = "SD Credit Alert!";
4607
        String title = "SD Credit Alert!";
4608
        Loan singLeLoan = defaultLoans.get(0);
4608
        boolean notYetSent = true;
4609
        List<LoanStatement> loanStatements1 = loanStatementRepository.selectByLoanId(singLeLoan.getId());
-
 
4610
        double amount1 = loanStatements1.stream().map(LoanStatement::getAmount).collect(Collectors.summingDouble(BigDecimal::doubleValue));
-
 
4611
        notificationService.sendWhatsappMessage(getWhatsAppMessageForDueDateExtend(singLeLoan, amount1), title, "9911565032");
-
 
4612
 
-
 
4613
        for (Loan defaultLoan : defaultLoans) {
4609
        for (Loan defaultLoan : defaultLoans) {
4614
            List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
4610
            List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
4615
 
4611
 
4616
            double amount = loanStatements.stream().map(LoanStatement::getAmount).collect(Collectors.summingDouble(BigDecimal::doubleValue));
4612
            double amount = loanStatements.stream().map(LoanStatement::getAmount).collect(Collectors.summingDouble(BigDecimal::doubleValue));
4617
 
4613
 
Line 4621... Line 4617...
4621
 
4617
 
4622
            //String url = "http://app.smartdukaan.com/pages/home/credit";
4618
            //String url = "http://app.smartdukaan.com/pages/home/credit";
4623
 
4619
 
4624
            String message = getMessageForDueDateExtend(defaultLoan, amount);
4620
            String message = getMessageForDueDateExtend(defaultLoan, amount);
4625
            String whatsAppMessage = getWhatsAppMessageForDueDateExtend(defaultLoan, amount);
4621
            String whatsAppMessage = getWhatsAppMessageForDueDateExtend(defaultLoan, amount);
-
 
4622
            if(whatsAppMessage != null) {
4626
            notificationService.sendWhatsappMessage(whatsAppMessage, title, address.getPhoneNumber());
4623
                notificationService.sendWhatsappMessage(whatsAppMessage, title, address.getPhoneNumber());
-
 
4624
                if(notYetSent) {
-
 
4625
                    notificationService.sendWhatsappMessage(whatsAppMessage, title, "9911565032");
-
 
4626
                    notYetSent = false;
-
 
4627
                }
-
 
4628
            }
-
 
4629
 
4627
            String[] email = {user.getEmailId()};
4630
            String[] email = {user.getEmailId()};
4628
            sendMailOfHtmlFormat(mailSender, email, message, null, "Loan Alert - SmartDukaan");
4631
            sendMailOfHtmlFormat(mailSender, email, message, null, "Loan Alert - SmartDukaan");
4629
        }
4632
        }
4630
    }
4633
    }
4631
 
4634