| Line 978... |
Line 978... |
| 978 |
|
978 |
|
| 979 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
979 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
| 980 |
ptam.setFofoId(fofoId);
|
980 |
ptam.setFofoId(fofoId);
|
| 981 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
981 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
| 982 |
ptam.setMobile(customRetailer.getMobileNumber());
|
982 |
ptam.setMobile(customRetailer.getMobileNumber());
|
| - |
|
983 |
ptam.setActivationType(customRetailer.getActivationType());
|
| 983 |
|
984 |
|
| 984 |
// Set ASM/RBM/BM names
|
985 |
// Set ASM/RBM/BM names
|
| 985 |
Map<String, Integer> roleMap = bmAsmRbmMap.get(fofoId);
|
986 |
Map<String, Integer> roleMap = bmAsmRbmMap.get(fofoId);
|
| 986 |
if (roleMap != null) {
|
987 |
if (roleMap != null) {
|
| 987 |
Integer asmId = roleMap.get("ASM");
|
988 |
Integer asmId = roleMap.get("ASM");
|
| Line 1197... |
Line 1198... |
| 1197 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
|
1198 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
|
| 1198 |
|
1199 |
|
| 1199 |
LOGGER.info("positions {}", positions);
|
1200 |
LOGGER.info("positions {}", positions);
|
| 1200 |
|
1201 |
|
| 1201 |
boolean isRBMAndL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L1.equals(position.getEscalationType()));
|
1202 |
boolean isRBMAndL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L1.equals(position.getEscalationType()));
|
| - |
|
1203 |
boolean isRBMAndL2 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L2.equals(position.getEscalationType()));
|
| - |
|
1204 |
boolean isRBMAndL3 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L3.equals(position.getEscalationType()));
|
| 1202 |
boolean isRBMAndNotL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && !EscalationType.L1.equals(position.getEscalationType()));
|
1205 |
boolean isRBMAndNotL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && !EscalationType.L1.equals(position.getEscalationType()));
|
| 1203 |
|
1206 |
|
| 1204 |
LOGGER.info("isRBMAndL1{}", isRBMAndL1);
|
1207 |
LOGGER.info("isRBMAndL1{}, isRBMAndL2{}, isRBMAndL3{}", isRBMAndL1, isRBMAndL2, isRBMAndL3);
|
| 1205 |
|
1208 |
|
| 1206 |
boolean isSales = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
|
1209 |
boolean isSales = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
|
| 1207 |
|
1210 |
|
| 1208 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
1211 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
| 1209 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
1212 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
| Line 1223... |
Line 1226... |
| 1223 |
/*filteredPtams = ptams.stream()
|
1226 |
/*filteredPtams = ptams.stream()
|
| 1224 |
.filter(ptam -> !(CollectionRemark.SALES_ESCALATION.equals(ptam.getRemark())))
|
1227 |
.filter(ptam -> !(CollectionRemark.SALES_ESCALATION.equals(ptam.getRemark())))
|
| 1225 |
.collect(Collectors.toList());*/
|
1228 |
.collect(Collectors.toList());*/
|
| 1226 |
} else if (isSales) {
|
1229 |
} else if (isSales) {
|
| 1227 |
filteredPtams = ptams.stream()
|
1230 |
filteredPtams = ptams.stream()
|
| 1228 |
.filter(ptam -> !(CollectionRemark.RBM_L2_ESCALATION.equals(ptam.getRemark())))
|
1231 |
.filter(ptam -> !(CollectionRemark.RBM_L2_ESCALATION.equals(ptam.getRemark()) || CollectionRemark.RBM_L3_ESCALATION.equals(ptam.getRemark())))
|
| 1229 |
.collect(Collectors.toList());
|
1232 |
.collect(Collectors.toList());
|
| 1230 |
} else {
|
1233 |
} else {
|
| 1231 |
filteredPtams = ptams;
|
1234 |
filteredPtams = ptams;
|
| 1232 |
}
|
1235 |
}
|
| 1233 |
tm.setRBMAndL1(isRBMAndL1);
|
1236 |
tm.setRBMAndL1(isRBMAndL1);
|
| - |
|
1237 |
tm.setRBMAndL2(isRBMAndL2);
|
| - |
|
1238 |
tm.setRBMAndL3(isRBMAndL3);
|
| 1234 |
tm.setRBMAndNotL1(isRBMAndNotL1);
|
1239 |
tm.setRBMAndNotL1(isRBMAndNotL1);
|
| 1235 |
tm.setSales(isSales);
|
1240 |
tm.setSales(isSales);
|
| 1236 |
|
1241 |
|
| 1237 |
// Calculate category counts
|
1242 |
// Calculate category counts
|
| 1238 |
Map<String, Long> categoryCounts = filteredPtams.stream()
|
1243 |
Map<String, Long> categoryCounts = filteredPtams.stream()
|
| Line 1417... |
Line 1422... |
| 1417 |
|
1422 |
|
| 1418 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
1423 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
| 1419 |
ptam.setFofoId(fofoId);
|
1424 |
ptam.setFofoId(fofoId);
|
| 1420 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
1425 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
| 1421 |
ptam.setMobile(customRetailer.getMobileNumber());
|
1426 |
ptam.setMobile(customRetailer.getMobileNumber());
|
| - |
|
1427 |
ptam.setActivationType(customRetailer.getActivationType());
|
| 1422 |
|
1428 |
|
| 1423 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
1429 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
| 1424 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
1430 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
| 1425 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
1431 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
| 1426 |
}
|
1432 |
}
|
| Line 1596... |
Line 1602... |
| 1596 |
|
1602 |
|
| 1597 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
|
1603 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
|
| 1598 |
LOGGER.info("positions {}", positions);
|
1604 |
LOGGER.info("positions {}", positions);
|
| 1599 |
|
1605 |
|
| 1600 |
boolean isRBMAndL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L1.equals(position.getEscalationType()));
|
1606 |
boolean isRBMAndL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L1.equals(position.getEscalationType()));
|
| - |
|
1607 |
boolean isRBMAndL2 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L2.equals(position.getEscalationType()));
|
| - |
|
1608 |
boolean isRBMAndL3 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L3.equals(position.getEscalationType()));
|
| 1601 |
boolean isRBMAndNotL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && !EscalationType.L1.equals(position.getEscalationType()));
|
1609 |
boolean isRBMAndNotL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && !EscalationType.L1.equals(position.getEscalationType()));
|
| 1602 |
LOGGER.info("isRBMAndL1{}", isRBMAndL1);
|
1610 |
LOGGER.info("isRBMAndL1{}, isRBMAndL2{}, isRBMAndL3{}", isRBMAndL1, isRBMAndL2, isRBMAndL3);
|
| 1603 |
|
1611 |
|
| 1604 |
boolean isSales = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
|
1612 |
boolean isSales = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
|
| 1605 |
|
1613 |
|
| 1606 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
1614 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
| 1607 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
1615 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
| Line 1614... |
Line 1622... |
| 1614 |
filteredPtams = ptams;
|
1622 |
filteredPtams = ptams;
|
| 1615 |
} else if (isRBMAndNotL1) {
|
1623 |
} else if (isRBMAndNotL1) {
|
| 1616 |
filteredPtams = ptams;
|
1624 |
filteredPtams = ptams;
|
| 1617 |
} else if (isSales) {
|
1625 |
} else if (isSales) {
|
| 1618 |
filteredPtams = ptams.stream()
|
1626 |
filteredPtams = ptams.stream()
|
| 1619 |
.filter(ptam -> !(CollectionRemark.RBM_L2_ESCALATION.equals(ptam.getRemark())))
|
1627 |
.filter(ptam -> !(CollectionRemark.RBM_L2_ESCALATION.equals(ptam.getRemark()) || CollectionRemark.RBM_L3_ESCALATION.equals(ptam.getRemark())))
|
| 1620 |
.collect(Collectors.toList());
|
1628 |
.collect(Collectors.toList());
|
| 1621 |
} else {
|
1629 |
} else {
|
| 1622 |
filteredPtams = ptams;
|
1630 |
filteredPtams = ptams;
|
| 1623 |
}
|
1631 |
}
|
| 1624 |
tm.setRBMAndL1(isRBMAndL1);
|
1632 |
tm.setRBMAndL1(isRBMAndL1);
|
| - |
|
1633 |
tm.setRBMAndL2(isRBMAndL2);
|
| - |
|
1634 |
tm.setRBMAndL3(isRBMAndL3);
|
| 1625 |
tm.setRBMAndNotL1(isRBMAndNotL1);
|
1635 |
tm.setRBMAndNotL1(isRBMAndNotL1);
|
| 1626 |
tm.setSales(isSales);
|
1636 |
tm.setSales(isSales);
|
| 1627 |
|
1637 |
|
| 1628 |
Map<String, Long> categoryCounts = filteredPtams.stream()
|
1638 |
Map<String, Long> categoryCounts = filteredPtams.stream()
|
| 1629 |
.collect(Collectors.groupingBy(
|
1639 |
.collect(Collectors.groupingBy(
|