| Line 632... |
Line 632... |
| 632 |
driver.manage().deleteAllCookies();
|
632 |
driver.manage().deleteAllCookies();
|
| 633 |
// Specifiying pageLoadTimeout and Implicit wait
|
633 |
// Specifiying pageLoadTimeout and Implicit wait
|
| 634 |
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
|
634 |
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
|
| 635 |
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
635 |
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
| 636 |
|
636 |
|
| 637 |
Map<String, List<Integer>> authUserPartnerIdMapping = csService.getAuthUserPartnerIdMapping();
|
637 |
Map<String, Set<Integer>> authUserPartnerIdMapping = csService.getAuthUserPartnerIdMapping();
|
| 638 |
Set<Integer> allPartners = new HashSet<>();
|
638 |
Set<Integer> allPartners = new HashSet<>();
|
| 639 |
Map<Integer, File> partnerSnapshotMap = new HashMap<>();
|
639 |
Map<Integer, File> partnerSnapshotMap = new HashMap<>();
|
| 640 |
authUserPartnerIdMapping.values().stream().forEach(x -> allPartners.addAll(x));
|
640 |
authUserPartnerIdMapping.values().stream().forEach(x -> allPartners.addAll(x));
|
| 641 |
for (int fofoId : allPartners) {
|
641 |
for (int fofoId : allPartners) {
|
| 642 |
driver.get("https://partners.smartdukaan.com/12dashboard34?fofoId=" + fofoId);
|
642 |
driver.get("https://partners.smartdukaan.com/12dashboard34?fofoId=" + fofoId);
|
| 643 |
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
|
643 |
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
|
| 644 |
partnerSnapshotMap.put(fofoId, file);
|
644 |
partnerSnapshotMap.put(fofoId, file);
|
| 645 |
|
645 |
|
| 646 |
}
|
646 |
}
|
| 647 |
for (Map.Entry<String, List<Integer>> entry : authUserPartnerIdMapping.entrySet()) {
|
647 |
for (Map.Entry<String, Set<Integer>> entry : authUserPartnerIdMapping.entrySet()) {
|
| 648 |
String email = entry.getKey();
|
648 |
String email = entry.getKey();
|
| 649 |
LOGGER.info("Sending mail start to {}", email);
|
649 |
LOGGER.info("Sending mail start to {}", email);
|
| 650 |
List<Integer> partnerIds = entry.getValue();
|
650 |
Set<Integer> partnerIds = entry.getValue();
|
| 651 |
StringBuffer body = new StringBuffer();
|
651 |
StringBuffer body = new StringBuffer();
|
| 652 |
Map<Integer, File> emailSnapshotMap = new HashMap<>();
|
652 |
Map<Integer, File> emailSnapshotMap = new HashMap<>();
|
| 653 |
for (int fofoId : partnerIds) {
|
653 |
for (int fofoId : partnerIds) {
|
| 654 |
body.append(String.format("<br/><img src=\"cid:%d\"/>", fofoId));
|
654 |
body.append(String.format("<br/><img src=\"cid:%d\"/>", fofoId));
|
| 655 |
emailSnapshotMap.put(fofoId, partnerSnapshotMap.get(fofoId));
|
655 |
emailSnapshotMap.put(fofoId, partnerSnapshotMap.get(fofoId));
|