| Line 1611... |
Line 1611... |
| 1611 |
}
|
1611 |
}
|
| 1612 |
|
1612 |
|
| 1613 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
1613 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
| 1614 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
1614 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| 1615 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
1615 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
| - |
|
1616 |
Map<String, SaleRoles> partnerEmailABMMap = new HashMap<>();
|
| 1616 |
|
1617 |
|
| 1617 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM));
|
1618 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM,ProfitMandiConstants.TICKET_CATEGORY_ABM));
|
| 1618 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
1619 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 1619 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
1620 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
| 1620 |
for (Position position : positions) {
|
1621 |
for (Position position : positions) {
|
| 1621 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
1622 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
| 1622 |
if (crList == null)
|
1623 |
if (crList == null)
|
| Line 1657... |
Line 1658... |
| 1657 |
saleRoles.getL2().add(name);
|
1658 |
saleRoles.getL2().add(name);
|
| 1658 |
}*/
|
1659 |
}*/
|
| 1659 |
}
|
1660 |
}
|
| 1660 |
}
|
1661 |
}
|
| 1661 |
|
1662 |
|
| - |
|
1663 |
if (position.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_ABM) {
|
| - |
|
1664 |
for (CustomRetailer cr : crList) {
|
| - |
|
1665 |
if (!partnerEmailABMMap.containsKey(cr.getEmail())) {
|
| - |
|
1666 |
partnerEmailABMMap.put(cr.getEmail(), new SaleRoles());
|
| - |
|
1667 |
}
|
| - |
|
1668 |
SaleRoles saleRoles = partnerEmailABMMap.get(cr.getEmail());
|
| - |
|
1669 |
AuthUser authUser = authUsersMap.get(position.getAuthUserId());
|
| - |
|
1670 |
if (authUser == null) {
|
| - |
|
1671 |
continue;
|
| - |
|
1672 |
}
|
| - |
|
1673 |
String name = authUser.getFirstName() + " " + authUser.getLastName();
|
| - |
|
1674 |
if (position.getEscalationType().equals(EscalationType.L1) || position.getEscalationType().equals(EscalationType.L1)) {
|
| - |
|
1675 |
saleRoles.getL1().add(name);
|
| - |
|
1676 |
}
|
| - |
|
1677 |
else if (position.getEscalationType().equals(EscalationType.L2)) {
|
| - |
|
1678 |
saleRoles.getL2().add(name);
|
| - |
|
1679 |
}
|
| - |
|
1680 |
}
|
| - |
|
1681 |
}
|
| - |
|
1682 |
|
| 1662 |
}
|
1683 |
}
|
| 1663 |
|
1684 |
|
| 1664 |
Set<CustomRetailer> allCrList = new HashSet<>();
|
1685 |
Set<CustomRetailer> allCrList = new HashSet<>();
|
| 1665 |
for (List<CustomRetailer> cr : positionIdRetailerMap.values()) {
|
1686 |
for (List<CustomRetailer> cr : positionIdRetailerMap.values()) {
|
| 1666 |
allCrList.addAll(cr);
|
1687 |
allCrList.addAll(cr);
|
| Line 2275... |
Line 2296... |
| 2275 |
Exception {
|
2296 |
Exception {
|
| 2276 |
String timeString = "Today %s";
|
2297 |
String timeString = "Today %s";
|
| 2277 |
LocalDateTime now = LocalDateTime.now();
|
2298 |
LocalDateTime now = LocalDateTime.now();
|
| 2278 |
|
2299 |
|
| 2279 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
|
2300 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
|
| 2280 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
|
2301 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
|
| 2281 |
|
2302 |
|
| 2282 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
2303 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
| 2283 |
|
2304 |
|
| 2284 |
for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
|
2305 |
for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
|
| 2285 |
String email = storeGuyEntry.getKey();
|
2306 |
String email = storeGuyEntry.getKey();
|
| Line 3439... |
Line 3460... |
| 3439 |
|
3460 |
|
| 3440 |
}
|
3461 |
}
|
| 3441 |
}
|
3462 |
}
|
| 3442 |
if (!salesEscalatedRemarksMap.isEmpty()) {
|
3463 |
if (!salesEscalatedRemarksMap.isEmpty()) {
|
| 3443 |
//
|
3464 |
//
|
| 3444 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM), true).entrySet()) {
|
3465 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_RBM), true).entrySet()) {
|
| 3445 |
List<PartnerCollectionRemark> filteredRows = storeGuyEntry.getValue().stream()
|
3466 |
List<PartnerCollectionRemark> filteredRows = storeGuyEntry.getValue().stream()
|
| 3446 |
.map(x -> salesEscalatedRemarksMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
3467 |
.map(x -> salesEscalatedRemarksMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 3447 |
String subject = "Partners escalated to Sales";
|
3468 |
String subject = "Partners escalated to Sales";
|
| 3448 |
String messageText = this.getMessageForSalesEscalatedPartners(filteredRows);
|
3469 |
String messageText = this.getMessageForSalesEscalatedPartners(filteredRows);
|
| 3449 |
|
3470 |
|
| Line 3475... |
Line 3496... |
| 3475 |
ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
3496 |
ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
| 3476 |
List<NonSdBuying> nonSdByuingActiveList = nonSdBuyingRepository.selectAllActiveNonSDBuyingList(true);
|
3497 |
List<NonSdBuying> nonSdByuingActiveList = nonSdBuyingRepository.selectAllActiveNonSDBuyingList(true);
|
| 3477 |
Map<Integer, NonSdBuying> unAuthorizedBuyingMap = nonSdByuingActiveList.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3498 |
Map<Integer, NonSdBuying> unAuthorizedBuyingMap = nonSdByuingActiveList.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3478 |
|
3499 |
|
| 3479 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
3500 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
| 3480 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES), true).entrySet()) {
|
3501 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM), true).entrySet()) {
|
| 3481 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
3502 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
| 3482 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
3503 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 3483 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
3504 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
| 3484 |
String subject = "Unauthorized Buying";
|
3505 |
String subject = "Unauthorized Buying";
|
| 3485 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
3506 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
| Line 3827... |
Line 3848... |
| 3827 |
|
3848 |
|
| 3828 |
public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws
|
3849 |
public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws
|
| 3829 |
ProfitMandiBusinessException, MessagingException, IOException {
|
3850 |
ProfitMandiBusinessException, MessagingException, IOException {
|
| 3830 |
String subject = "Default Partners";
|
3851 |
String subject = "Default Partners";
|
| 3831 |
|
3852 |
|
| 3832 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
3853 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 3833 |
|
3854 |
|
| 3834 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
3855 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 3835 |
List<Loan> filteredRows = new ArrayList<>();
|
3856 |
List<Loan> filteredRows = new ArrayList<>();
|
| 3836 |
for (Loan loan : defaultLoans) {
|
3857 |
for (Loan loan : defaultLoans) {
|
| 3837 |
|
3858 |
|
| Line 3991... |
Line 4012... |
| 3991 |
}
|
4012 |
}
|
| 3992 |
|
4013 |
|
| 3993 |
}
|
4014 |
}
|
| 3994 |
|
4015 |
|
| 3995 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws Exception {
|
4016 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws Exception {
|
| 3996 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4017 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 3997 |
|
4018 |
|
| 3998 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
4019 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 3999 |
List<Loan> filteredRows = new ArrayList<>();
|
4020 |
List<Loan> filteredRows = new ArrayList<>();
|
| 4000 |
for (Loan loan : dueDateCrossLoans) {
|
4021 |
for (Loan loan : dueDateCrossLoans) {
|
| 4001 |
|
4022 |
|
| Line 4563... |
Line 4584... |
| 4563 |
|
4584 |
|
| 4564 |
public void monthlyTargetForInternalTeam() throws MessagingException, ProfitMandiBusinessException, IOException {
|
4585 |
public void monthlyTargetForInternalTeam() throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 4565 |
|
4586 |
|
| 4566 |
LocalDateTime curDate = LocalDateTime.now();
|
4587 |
LocalDateTime curDate = LocalDateTime.now();
|
| 4567 |
|
4588 |
|
| 4568 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4589 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 4569 |
|
4590 |
|
| 4570 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
4591 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
| 4571 |
|
4592 |
|
| 4572 |
List<MonthlyTarget> monthlyTargets = monthlyTargetRepository.selectByDate(YearMonth.now());
|
4593 |
List<MonthlyTarget> monthlyTargets = monthlyTargetRepository.selectByDate(YearMonth.now());
|
| 4573 |
|
4594 |
|
| Line 4739... |
Line 4760... |
| 4739 |
|
4760 |
|
| 4740 |
List<Integer> categoryIds = Arrays.asList(
|
4761 |
List<Integer> categoryIds = Arrays.asList(
|
| 4741 |
ProfitMandiConstants.TICKET_CATEGORY_CATEGORY,
|
4762 |
ProfitMandiConstants.TICKET_CATEGORY_CATEGORY,
|
| 4742 |
ProfitMandiConstants.TICKET_CATEGORY_RBM,
|
4763 |
ProfitMandiConstants.TICKET_CATEGORY_RBM,
|
| 4743 |
ProfitMandiConstants.TICKET_CATEGORY_SALES,
|
4764 |
ProfitMandiConstants.TICKET_CATEGORY_SALES,
|
| - |
|
4765 |
ProfitMandiConstants.TICKET_CATEGORY_ABM,
|
| 4744 |
ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS,
|
4766 |
ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS,
|
| 4745 |
ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4767 |
ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 4746 |
|
4768 |
|
| 4747 |
/*for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
4769 |
/*for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 4748 |
List<Loan> filteredRows = defaultLoans.stream()
|
4770 |
List<Loan> filteredRows = defaultLoans.stream()
|