| Line 3... |
Line 3... |
| 3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 5 |
import com.spice.profitmandi.dao.cart.CartService;
|
5 |
import com.spice.profitmandi.dao.cart.CartService;
|
| 6 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
6 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 7 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
7 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
8 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 8 |
import com.spice.profitmandi.dao.entity.fofo.RbmRating;
|
9 |
import com.spice.profitmandi.dao.entity.fofo.RbmRating;
|
| 9 |
import com.spice.profitmandi.dao.entity.fofo.SalesRating;
|
10 |
import com.spice.profitmandi.dao.entity.fofo.SalesRating;
|
| 10 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
11 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
| 11 |
import com.spice.profitmandi.dao.entity.transaction.Transaction;
|
12 |
import com.spice.profitmandi.dao.entity.transaction.Transaction;
|
| 12 |
import com.spice.profitmandi.dao.entity.user.User;
|
13 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 13 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
14 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 14 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
15 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 15 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
16 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| - |
|
17 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 16 |
import com.spice.profitmandi.dao.repository.fofo.RbmRatingRepository;
|
18 |
import com.spice.profitmandi.dao.repository.fofo.RbmRatingRepository;
|
| 17 |
import com.spice.profitmandi.dao.repository.fofo.SalesRatingRepository;
|
19 |
import com.spice.profitmandi.dao.repository.fofo.SalesRatingRepository;
|
| 18 |
import com.spice.profitmandi.dao.repository.transaction.LoanRepository;
|
20 |
import com.spice.profitmandi.dao.repository.transaction.LoanRepository;
|
| 19 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
21 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
22 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| Line 71... |
Line 73... |
| 71 |
@Autowired
|
73 |
@Autowired
|
| 72 |
FofoStoreRepository fofoStoreRepository;
|
74 |
FofoStoreRepository fofoStoreRepository;
|
| 73 |
|
75 |
|
| 74 |
public void test() throws Exception {
|
76 |
public void test() throws Exception {
|
| 75 |
System.out.println("test start");
|
77 |
System.out.println("test start");
|
| 76 |
this.sendRbmFeedbackSummaryEmail();
|
- |
|
| 77 |
this.sendSalesFeedbackSummaryEmail();
|
- |
|
| 78 |
System.out.println("test end");
|
78 |
System.out.println("test end");
|
| 79 |
|
79 |
|
| 80 |
}
|
80 |
}
|
| 81 |
|
81 |
|
| 82 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
82 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
| Line 228... |
Line 228... |
| 228 |
this.sendMailHtmlFormat(emailRecipients, emailContent.toString(), null, bcc, subject);
|
228 |
this.sendMailHtmlFormat(emailRecipients, emailContent.toString(), null, bcc, subject);
|
| 229 |
|
229 |
|
| 230 |
LOGGER.info("Consolidated RBM feedback summary email sent.");
|
230 |
LOGGER.info("Consolidated RBM feedback summary email sent.");
|
| 231 |
}
|
231 |
}
|
| 232 |
|
232 |
|
| 233 |
|
233 |
@Autowired
|
| - |
|
234 |
PartnerTypeChangeService partnerTypeChangeService;
|
| 234 |
|
235 |
|
| 235 |
public void sendSalesFeedbackSummaryEmail() throws MessagingException, ProfitMandiBusinessException, IOException {
|
236 |
public void sendSalesFeedbackSummaryEmail() throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 236 |
LocalDateTime startOfMonth = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
237 |
LocalDateTime startOfMonth = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
| 237 |
LocalDateTime endOfMonth = LocalDateTime.now();
|
238 |
LocalDateTime endOfMonth = LocalDateTime.now();
|
| 238 |
String[] bcc = {"tarun.verma@smartdukaan.com"};
|
239 |
String[] bcc = {"tarun.verma@smartdukaan.com"};
|
| - |
|
240 |
// String[] bcc = {"tejus.lohani@smartdukaan.com"};
|
| 239 |
|
241 |
|
| 240 |
// Get all RBM users
|
242 |
// Get all RBM users
|
| 241 |
List<AuthUser> authUsers = csService.getAuthUserIds(
|
243 |
List<AuthUser> authUsers = csService.getAuthUserIds(
|
| 242 |
ProfitMandiConstants.TICKET_CATEGORY_SALES,
|
244 |
ProfitMandiConstants.TICKET_CATEGORY_SALES,
|
| 243 |
Arrays.asList(EscalationType.L1)
|
245 |
Arrays.asList(EscalationType.L1)
|
| Line 290... |
Line 292... |
| 290 |
|
292 |
|
| 291 |
emailContent.append("<table border='1' cellspacing='0' cellpadding='5'>");
|
293 |
emailContent.append("<table border='1' cellspacing='0' cellpadding='5'>");
|
| 292 |
emailContent.append("<tr>")
|
294 |
emailContent.append("<tr>")
|
| 293 |
.append("<th>Sales L1 Name</th>")
|
295 |
.append("<th>Sales L1 Name</th>")
|
| 294 |
.append("<th>Partner Name</th>")
|
296 |
.append("<th>Partner Name</th>")
|
| - |
|
297 |
.append("<th>Partner Category</th>")
|
| 295 |
.append("<th>Rating</th>")
|
298 |
.append("<th>Rating</th>")
|
| 296 |
.append("<th>Comment</th>")
|
299 |
.append("<th>Comment</th>")
|
| 297 |
.append("<th>Date</th>")
|
300 |
.append("<th>Date</th>")
|
| 298 |
.append("</tr>");
|
301 |
.append("</tr>");
|
| 299 |
|
302 |
|
| 300 |
for (SalesRating rating : feedbackList) {
|
303 |
for (SalesRating rating : feedbackList) {
|
| 301 |
String salesL1 = salesL1NameMap.getOrDefault(rating.getSalesL1Id(), "Unknown Sales Person");
|
304 |
String salesL1 = salesL1NameMap.getOrDefault(rating.getSalesL1Id(), "Unknown Sales Person");
|
| 302 |
String partnerName = fofoNameMap.getOrDefault(rating.getFofoId(), "Unknown Partner");
|
305 |
String partnerName = fofoNameMap.getOrDefault(rating.getFofoId(), "Unknown Partner");
|
| - |
|
306 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(rating.getFofoId(), LocalDate.now());
|
| 303 |
emailContent.append("<tr>")
|
307 |
emailContent.append("<tr>")
|
| 304 |
.append("<td>").append(salesL1).append("</td>")
|
308 |
.append("<td>").append(salesL1).append("</td>")
|
| 305 |
.append("<td>").append(partnerName).append("</td>")
|
309 |
.append("<td>").append(partnerName).append("</td>")
|
| - |
|
310 |
.append("<td>").append(partnerType).append("</td>")
|
| 306 |
.append("<td>").append(rating.getRating()).append("</td>")
|
311 |
.append("<td>").append(rating.getRating()).append("</td>")
|
| 307 |
.append("<td>").append(rating.getComment() != null ? rating.getComment() : "-").append("</td>")
|
312 |
.append("<td>").append(rating.getComment() != null ? rating.getComment() : "-").append("</td>")
|
| 308 |
.append("<td>").append(rating.getCreateTimeStamp().toLocalDate()).append("</td>")
|
313 |
.append("<td>").append(rating.getCreateTimeStamp().toLocalDate()).append("</td>")
|
| 309 |
.append("</tr>");
|
314 |
.append("</tr>");
|
| 310 |
}
|
315 |
}
|
| 311 |
|
316 |
|
| 312 |
emailContent.append("</table>");
|
317 |
emailContent.append("</table>");
|
| 313 |
emailContent.append("<br><p>Regards,<br>Smartdukaan Team</p>");
|
318 |
emailContent.append("<br><p>Regards,<br>Smartdukaan Team</p>");
|
| 314 |
emailContent.append("</body></html>");
|
319 |
emailContent.append("</body></html>");
|
| 315 |
|
320 |
|
| 316 |
String subject = "Monthly Sales L1 Feedback Summary - " + LocalDate.now().getMonth();
|
321 |
String subject = "Monthly Sales L1 Feedback Summary Test test - " + LocalDate.now().getMonth();
|
| 317 |
|
322 |
|
| 318 |
List<String> sendTo = new ArrayList<>();
|
323 |
List<String> sendTo = new ArrayList<>();
|
| 319 |
sendTo.add("sm@smartdukaan.com"); //
|
324 |
sendTo.add("sm@smartdukaan.com"); //
|
| 320 |
sendTo.add("chiranjib.sarkar@smartdukaan.com"); //
|
325 |
sendTo.add("chiranjib.sarkar@smartdukaan.com"); //
|
| 321 |
sendTo.add("kamini.sharma@smartdukaan.com"); //
|
326 |
sendTo.add("kamini.sharma@smartdukaan.com"); //
|