| Line 790... |
Line 790... |
| 790 |
}
|
790 |
}
|
| 791 |
|
791 |
|
| 792 |
}
|
792 |
}
|
| 793 |
}
|
793 |
}
|
| 794 |
if (upgradedCount > 0) {
|
794 |
if (upgradedCount > 0) {
|
| 795 |
sendMailOfHtmlFormat(googleMailSender, new String[]{"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "Few Partners Category have been Upgraded");
|
795 |
sendMailOfHtmlFormat(gmailRelaySender, new String[]{"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "Few Partners Category have been Upgraded");
|
| 796 |
} else {
|
796 |
} else {
|
| 797 |
sendMailOfHtmlFormat(googleMailSender, new String[]{"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "No partners Category have been upgraded today");
|
797 |
sendMailOfHtmlFormat(gmailRelaySender, new String[]{"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "No partners Category have been upgraded today");
|
| 798 |
}
|
798 |
}
|
| 799 |
}
|
799 |
}
|
| 800 |
|
800 |
|
| 801 |
@Autowired
|
801 |
@Autowired
|
| 802 |
private PartnerStatsService partnerStatsService;
|
802 |
private PartnerStatsService partnerStatsService;
|
| Line 1346... |
Line 1346... |
| 1346 |
sdCreditService.settleLoan(x);
|
1346 |
sdCreditService.settleLoan(x);
|
| 1347 |
} catch (ProfitMandiBusinessException e) {
|
1347 |
} catch (ProfitMandiBusinessException e) {
|
| 1348 |
throw new RuntimeException(e);
|
1348 |
throw new RuntimeException(e);
|
| 1349 |
}
|
1349 |
}
|
| 1350 |
});*/
|
1350 |
});*/
|
| 1351 |
//Utils.sendMailWithAttachments(googleMailSender, new String[]{"amit.gupta@smartdukaan.com"}, null, "DTDC AWb", "PFA");*/
|
1351 |
//Utils.sendMailWithAttachments(gmailRelaySender, new String[]{"amit.gupta@smartdukaan.com"}, null, "DTDC AWb", "PFA");*/
|
| 1352 |
}
|
1352 |
}
|
| 1353 |
|
1353 |
|
| 1354 |
private void regenerateDCInvoices() {
|
1354 |
private void regenerateDCInvoices() {
|
| 1355 |
List<String> dcInvoiceNumbers = Arrays.asList(
|
1355 |
List<String> dcInvoiceNumbers = Arrays.asList(
|
| 1356 |
"DCNSUPDL5", "DCNSUPDL4", "DCNSLCK2", "DCNSUPDL3",
|
1356 |
"DCNSUPDL5", "DCNSUPDL4", "DCNSLCK2", "DCNSUPDL3",
|
| Line 1865... |
Line 1865... |
| 1865 |
rows.add(row);
|
1865 |
rows.add(row);
|
| 1866 |
}
|
1866 |
}
|
| 1867 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
1867 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 1868 |
String[] sendToArray = new String[]{"kamini.sharma@smartdukaan.com", "praveen.sharma@smartdukaan.com"};
|
1868 |
String[] sendToArray = new String[]{"kamini.sharma@smartdukaan.com", "praveen.sharma@smartdukaan.com"};
|
| 1869 |
String fileName = "Imeis need Rebilling -" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
1869 |
String fileName = "Imeis need Rebilling -" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| 1870 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, new String[]{"tarun.verma@smartdukaan.com"}, "Samsung Rebilling IMEI Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
1870 |
Utils.sendMailWithAttachment(gmailRelaySender, sendToArray, new String[]{"tarun.verma@smartdukaan.com"}, "Samsung Rebilling IMEI Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
| 1871 |
}
|
1871 |
}
|
| 1872 |
}
|
1872 |
}
|
| 1873 |
|
1873 |
|
| 1874 |
public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
|
1874 |
public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
|
| 1875 |
LocalDate yesterDay = LocalDate.now().minusDays(1);
|
1875 |
LocalDate yesterDay = LocalDate.now().minusDays(1);
|
| Line 1918... |
Line 1918... |
| 1918 |
if (sendTo == null) {
|
1918 |
if (sendTo == null) {
|
| 1919 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMapping().entrySet()) {
|
1919 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMapping().entrySet()) {
|
| 1920 |
List<List<?>> filteredRows = storeGuyEntry.getValue().stream().map(x -> partnerRowsMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
1920 |
List<List<?>> filteredRows = storeGuyEntry.getValue().stream().map(x -> partnerRowsMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 1921 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
1921 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
| 1922 |
String[] sendToArray = new String[]{storeGuyEntry.getKey()};
|
1922 |
String[] sendToArray = new String[]{storeGuyEntry.getKey()};
|
| 1923 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
1923 |
Utils.sendMailWithAttachment(gmailRelaySender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
| 1924 |
}
|
1924 |
}
|
| 1925 |
sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com", "amit.gupta@shop2020.in", "manish.gupta1@smartdukaan.com", "niranjan.kala@smartdukaan.com");
|
1925 |
sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com", "amit.gupta@shop2020.in", "manish.gupta1@smartdukaan.com", "niranjan.kala@smartdukaan.com");
|
| 1926 |
}
|
1926 |
}
|
| 1927 |
|
1927 |
|
| 1928 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
1928 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 1929 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
1929 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
| 1930 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
1930 |
Utils.sendMailWithAttachment(gmailRelaySender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
| 1931 |
|
1931 |
|
| 1932 |
}
|
1932 |
}
|
| 1933 |
|
1933 |
|
| 1934 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
1934 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
| 1935 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
1935 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| Line 2704... |
Line 2704... |
| 2704 |
baos = FileUtil.getCSVByteStream(headers, rows);
|
2704 |
baos = FileUtil.getCSVByteStream(headers, rows);
|
| 2705 |
} catch (Exception e2) {
|
2705 |
} catch (Exception e2) {
|
| 2706 |
e2.printStackTrace();
|
2706 |
e2.printStackTrace();
|
| 2707 |
}
|
2707 |
}
|
| 2708 |
Attachment attachment = new Attachment("PartnerSalePerformance.csv", new ByteArrayResource(baos.toByteArray()));
|
2708 |
Attachment attachment = new Attachment("PartnerSalePerformance.csv", new ByteArrayResource(baos.toByteArray()));
|
| 2709 |
Utils.sendHtmlMailWithAttachments(googleMailSender, new String[]{email}, null, "Statewise " + subject, statewiseSaleReport, attachment);
|
2709 |
Utils.sendHtmlMailWithAttachments(gmailRelaySender, new String[]{email}, null, "Statewise " + subject, statewiseSaleReport, attachment);
|
| 2710 |
}
|
2710 |
}
|
| 2711 |
}
|
2711 |
}
|
| 2712 |
}
|
2712 |
}
|
| 2713 |
|
2713 |
|
| 2714 |
|
2714 |
|
| Line 3157... |
Line 3157... |
| 3157 |
|
3157 |
|
| 3158 |
for (Map.Entry<String, List<List<?>>> entry : emailRowsMap.entrySet()) {
|
3158 |
for (Map.Entry<String, List<List<?>>> entry : emailRowsMap.entrySet()) {
|
| 3159 |
try {
|
3159 |
try {
|
| 3160 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, entry.getValue());
|
3160 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, entry.getValue());
|
| 3161 |
String[] sendToArray = new String[]{entry.getKey()};
|
3161 |
String[] sendToArray = new String[]{entry.getKey()};
|
| 3162 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Stock Alert", "PFA",
|
3162 |
Utils.sendMailWithAttachment(gmailRelaySender, sendToArray, null, "Stock Alert", "PFA",
|
| 3163 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
3163 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
| 3164 |
} catch (Exception e) {
|
3164 |
} catch (Exception e) {
|
| 3165 |
LOGGER.error("Failed to send email to {}", entry.getKey(), e);
|
3165 |
LOGGER.error("Failed to send email to {}", entry.getKey(), e);
|
| 3166 |
}
|
3166 |
}
|
| 3167 |
}
|
3167 |
}
|
| Line 3282... |
Line 3282... |
| 3282 |
sb.append("</body></html>");
|
3282 |
sb.append("</body></html>");
|
| 3283 |
|
3283 |
|
| 3284 |
String subject = "Lead Updates Summary";
|
3284 |
String subject = "Lead Updates Summary";
|
| 3285 |
String[] email = Arrays.asList(authUser.getEmailId()).toArray(new String[1]);
|
3285 |
String[] email = Arrays.asList(authUser.getEmailId()).toArray(new String[1]);
|
| 3286 |
//String[] email = Arrays.asList("amit.gupta@smartdukaan.com").toArray(new String[1]);
|
3286 |
//String[] email = Arrays.asList("amit.gupta@smartdukaan.com").toArray(new String[1]);
|
| 3287 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
3287 |
this.sendMailOfHtmlFormat(gmailRelaySender, email, sb.toString(), null, subject);
|
| 3288 |
//break;
|
3288 |
//break;
|
| 3289 |
}
|
3289 |
}
|
| 3290 |
}
|
3290 |
}
|
| 3291 |
|
3291 |
|
| 3292 |
}
|
3292 |
}
|
| Line 3629... |
Line 3629... |
| 3629 |
}
|
3629 |
}
|
| 3630 |
sb.append("</tbody></table><br><br>");
|
3630 |
sb.append("</tbody></table><br><br>");
|
| 3631 |
String subject = "Partner Problem Alert!";
|
3631 |
String subject = "Partner Problem Alert!";
|
| 3632 |
String[] email = sendTo.toArray(new String[sendTo.size()]);
|
3632 |
String[] email = sendTo.toArray(new String[sendTo.size()]);
|
| 3633 |
|
3633 |
|
| 3634 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
3634 |
this.sendMailOfHtmlFormat(gmailRelaySender, email, sb.toString(), null, subject);
|
| 3635 |
|
3635 |
|
| 3636 |
Map<Integer, List<Integer>> authUserPartnerMapping = csService.getAuthUserIdPartnerIdMapping();
|
3636 |
Map<Integer, List<Integer>> authUserPartnerMapping = csService.getAuthUserIdPartnerIdMapping();
|
| 3637 |
|
3637 |
|
| 3638 |
for (Entry<Integer, List<Integer>> authUserPartner : authUserPartnerMapping.entrySet()) {
|
3638 |
for (Entry<Integer, List<Integer>> authUserPartner : authUserPartnerMapping.entrySet()) {
|
| 3639 |
AuthUser authUser = authRepository.selectById(authUserPartner.getKey());
|
3639 |
AuthUser authUser = authRepository.selectById(authUserPartner.getKey());
|
| Line 3662... |
Line 3662... |
| 3662 |
}
|
3662 |
}
|
| 3663 |
|
3663 |
|
| 3664 |
}
|
3664 |
}
|
| 3665 |
sbbuilder.append("</tbody></table><br><br>");
|
3665 |
sbbuilder.append("</tbody></table><br><br>");
|
| 3666 |
|
3666 |
|
| 3667 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{authUser.getEmailId()}, sbbuilder.toString(), null, subject);
|
3667 |
this.sendMailOfHtmlFormat(gmailRelaySender, new String[]{authUser.getEmailId()}, sbbuilder.toString(), null, subject);
|
| 3668 |
}
|
3668 |
}
|
| 3669 |
|
3669 |
|
| 3670 |
}
|
3670 |
}
|
| 3671 |
}
|
3671 |
}
|
| 3672 |
}
|
3672 |
}
|
| Line 4315... |
Line 4315... |
| 4315 |
}
|
4315 |
}
|
| 4316 |
}
|
4316 |
}
|
| 4317 |
if (!filteredRows.isEmpty()) {
|
4317 |
if (!filteredRows.isEmpty()) {
|
| 4318 |
String[] email = new String[]{storeGuyEntry.getKey(),"neeraj.gupta@smartdukaan.com"};
|
4318 |
String[] email = new String[]{storeGuyEntry.getKey(),"neeraj.gupta@smartdukaan.com"};
|
| 4319 |
String messageText = this.getMessageForDueDateExtend(filteredRows);
|
4319 |
String messageText = this.getMessageForDueDateExtend(filteredRows);
|
| 4320 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, subject);
|
4320 |
this.sendMailOfHtmlFormat(gmailRelaySender, email, messageText, null, subject);
|
| 4321 |
|
4321 |
|
| 4322 |
}
|
4322 |
}
|
| 4323 |
|
4323 |
|
| 4324 |
}
|
4324 |
}
|
| 4325 |
String messageText = this.getMessageForDueDateExtend(defaultLoans);
|
4325 |
String messageText = this.getMessageForDueDateExtend(defaultLoans);
|
| 4326 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com", "rahul.latwal@smartdukaan.com", "dilbag.singh@smartdukaan.com"}, messageText, null, subject);
|
4326 |
this.sendMailOfHtmlFormat(gmailRelaySender, new String[]{"puneet.wahi@smartdukaan.com", "rahul.latwal@smartdukaan.com", "dilbag.singh@smartdukaan.com"}, messageText, null, subject);
|
| 4327 |
|
4327 |
|
| 4328 |
for (Loan defaultLoan : defaultLoans) {
|
4328 |
for (Loan defaultLoan : defaultLoans) {
|
| 4329 |
double principal = defaultLoan.getPendingAmount().doubleValue();
|
4329 |
double principal = defaultLoan.getPendingAmount().doubleValue();
|
| 4330 |
double interest = defaultLoan.getInterestAccrued().doubleValue() - defaultLoan.getInterestPaid().doubleValue();
|
4330 |
double interest = defaultLoan.getInterestAccrued().doubleValue() - defaultLoan.getInterestPaid().doubleValue();
|
| 4331 |
double total = principal + interest;
|
4331 |
double total = principal + interest;
|
| Line 4498... |
Line 4498... |
| 4498 |
String[] email = new String[]{storeGuyEntry.getKey(),"neeraj.gupta@smartdukaan.com"};
|
4498 |
String[] email = new String[]{storeGuyEntry.getKey(),"neeraj.gupta@smartdukaan.com"};
|
| 4499 |
|
4499 |
|
| 4500 |
if (attachment1 != null) {
|
4500 |
if (attachment1 != null) {
|
| 4501 |
mailOutboxService.queueMailWithAttachmentsViaGoogle(email, null, null, "Partner Credit Report", messageText, true, "ScheduledTasks.sendDueDateCrossLoanAlert", attachment1);
|
4501 |
mailOutboxService.queueMailWithAttachmentsViaGoogle(email, null, null, "Partner Credit Report", messageText, true, "ScheduledTasks.sendDueDateCrossLoanAlert", attachment1);
|
| 4502 |
} else {
|
4502 |
} else {
|
| 4503 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, "Due Date Cross");
|
4503 |
this.sendMailOfHtmlFormat(gmailRelaySender, email, messageText, null, "Due Date Cross");
|
| 4504 |
|
4504 |
|
| 4505 |
}
|
4505 |
}
|
| 4506 |
|
4506 |
|
| 4507 |
}
|
4507 |
}
|
| 4508 |
|
4508 |
|
| Line 4517... |
Line 4517... |
| 4517 |
}
|
4517 |
}
|
| 4518 |
|
4518 |
|
| 4519 |
if (attachment != null) {
|
4519 |
if (attachment != null) {
|
| 4520 |
mailOutboxService.queueMailWithAttachmentsViaGoogle(new String[]{"sdtech@smartdukaan.com"}, null, null, "Partner Credit Report", messageText, true, "ScheduledTasks.sendDueDateCrossLoanAlert", attachment);
|
4520 |
mailOutboxService.queueMailWithAttachmentsViaGoogle(new String[]{"sdtech@smartdukaan.com"}, null, null, "Partner Credit Report", messageText, true, "ScheduledTasks.sendDueDateCrossLoanAlert", attachment);
|
| 4521 |
} else {
|
4521 |
} else {
|
| 4522 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"sdtech@smartdukaan.com"}, messageText, null, "Due Date Cross");
|
4522 |
this.sendMailOfHtmlFormat(gmailRelaySender, new String[]{"sdtech@smartdukaan.com"}, messageText, null, "Due Date Cross");
|
| 4523 |
}
|
4523 |
}
|
| 4524 |
|
4524 |
|
| 4525 |
|
4525 |
|
| 4526 |
if (!dueDateCrossLoans.isEmpty()) {
|
4526 |
if (!dueDateCrossLoans.isEmpty()) {
|
| 4527 |
for (Loan loan : dueDateCrossLoans) {
|
4527 |
for (Loan loan : dueDateCrossLoans) {
|
| Line 4850... |
Line 4850... |
| 4850 |
|
4850 |
|
| 4851 |
boolean partnerYearMonth = partnerYearMonthData.values().stream().allMatch(Objects::isNull);
|
4851 |
boolean partnerYearMonth = partnerYearMonthData.values().stream().allMatch(Objects::isNull);
|
| 4852 |
|
4852 |
|
| 4853 |
if (!partnerDateWise && !partnerYearMonth) {
|
4853 |
if (!partnerDateWise && !partnerYearMonth) {
|
| 4854 |
String sb = this.getMessageHygieneAlertForPartner(partnerYearMonthData, partnerDateWiseData);
|
4854 |
String sb = this.getMessageHygieneAlertForPartner(partnerYearMonthData, partnerDateWiseData);
|
| 4855 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{email}, sb, null, subject);
|
4855 |
this.sendMailOfHtmlFormat(gmailRelaySender, new String[]{email}, sb, null, subject);
|
| 4856 |
}
|
4856 |
}
|
| 4857 |
|
4857 |
|
| 4858 |
}
|
4858 |
}
|
| 4859 |
|
4859 |
|
| 4860 |
}
|
4860 |
}
|
| Line 5173... |
Line 5173... |
| 5173 |
|
5173 |
|
| 5174 |
sb.append("</tr>\n");
|
5174 |
sb.append("</tr>\n");
|
| 5175 |
|
5175 |
|
| 5176 |
}
|
5176 |
}
|
| 5177 |
|
5177 |
|
| 5178 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{email}, sb.toString(), null, subject);
|
5178 |
this.sendMailOfHtmlFormat(gmailRelaySender, new String[]{email}, sb.toString(), null, subject);
|
| 5179 |
// this.sendMailOfHtmlFormat("tejbeer.kaur@smartdukaan.com", sb.toString(),
|
5179 |
// this.sendMailOfHtmlFormat("tejbeer.kaur@smartdukaan.com", sb.toString(),
|
| 5180 |
// null, subject);
|
5180 |
// null, subject);
|
| 5181 |
|
5181 |
|
| 5182 |
}
|
5182 |
}
|
| 5183 |
|
5183 |
|