Subversion Repositories SmartDukaan

Rev

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

Rev 34571 Rev 34575
Line 66... Line 66...
66
    @Override
66
    @Override
67
    public void sendMailToRBM(double netAmountInHand, double totalPayableAmount, int fofoId) throws Exception {
67
    public void sendMailToRBM(double netAmountInHand, double totalPayableAmount, int fofoId) throws Exception {
68
        User user = userRepository.selectById(fofoId);
68
        User user = userRepository.selectById(fofoId);
69
        int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
69
        int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
70
        AuthUser authUser = authRepository.selectById(rbmId);
70
        AuthUser authUser = authRepository.selectById(rbmId);
-
 
71
        String[] emailTo;
-
 
72
        String[] ccTo;
-
 
73
        if (authUser == null){
-
 
74
            emailTo = new String[] { "sdtech@smartdukaan.com", "mohit.gulati@smartdukaan.com", "manish.gupta1@smartdukaan.com" };
-
 
75
            ccTo = new String[]{};
-
 
76
        } else {
-
 
77
            emailTo = new String[] { user.getEmailId(), "sdtech@smartdukaan.com" };
-
 
78
            ccTo = new String[]{authUser.getEmailId()};
-
 
79
        }
71
 
80
 
72
        String[] emailTo = new String[] { authUser.getEmailId() };
-
 
73
        //String[] emailTo = new String[] { "vjangra856@gmail.com" };
-
 
74
 
-
 
75
        String[] ccTo = {user.getEmailId()};
-
 
76
        String subject = "Dispatch On Hold(Bidding)";
81
        String subject = "Dispatch On Hold(Bidding)";
77
        String message = String.format(
82
        String message = String.format(
78
                "Dear Team,\n\n"
83
                "Dear %s,<br>"
79
                        + "This is to inform you that the material for %s, valued at Rs.%s, "
84
                    + "This is to inform you that the material for %s, valued at Rs.%s, <br>"
80
                        + "is on hold until the payment against the stock is received. Kindly "
85
                    + "is on hold until the payment against the stock is received. Kindly <br>"
81
                        + "top up your wallet with an amount of Rs.%s to proceed with the dispatch.",
86
                    + "top up your wallet with an amount of Rs.%s to proceed with the dispatch.",
82
                user.getName(), totalPayableAmount, (totalPayableAmount - netAmountInHand)
87
                user.getName(), user.getName(), totalPayableAmount, (totalPayableAmount - netAmountInHand)
83
        );
88
        );
84
 
89
 
85
        Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
90
        Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
86
    }
91
    }
87
 
92
 
88
    @Override
93
    @Override
89
    public void sendSummaryMailToUserAndManagers(int userId, List<Bid> bids, Liquidation liquidation) throws Exception {
94
    public void sendSummaryMailToUserAndManagers(int userId, List<Bid> bids, Liquidation liquidation) throws Exception {
90
        if (bids.size() > 0) {
95
        if (bids.size() > 0) {
91
            String content = this.generateContent(bids, liquidation, ProfitMandiConstants.BID_ENUM.CLOSED);
96
            String content = this.generateContent(bids, liquidation, ProfitMandiConstants.BID_ENUM.CLOSED);
92
            AuthUser authUser = authRepository.selectById(userId);
97
            AuthUser authUser = authRepository.selectById(userId);
93
            String[] emailTo = {authUser.getEmailId(), "sourcing@smartdukaan.com", "vikas.jangra@smartdukaan.com"};
98
            String[] emailTo = {authUser.getEmailId(), "sourcing@smartdukaan.com", "sdtech@smartdukaan.com"};
94
 
99
 
95
            String[] ccTo = authService.getAllManagers(userId).stream().map(AuthUser::getEmailId).toArray(String[]::new);
100
            String[] ccTo = authService.getAllManagers(userId).stream().map(AuthUser::getEmailId).toArray(String[]::new);
96
            String subject = "Liquidation Report";
101
            String subject = "Liquidation Report";
97
            String message = "Dear Team,\n\n"
102
            String message = "Dear Team,\n\n"
98
                    + "Liquidation has been completed. Here is the summary:\n\n"
103
                    + "Liquidation has been completed. Here is the summary:\n\n"