| Line 882... |
Line 882... |
| 882 |
continue;
|
882 |
continue;
|
| 883 |
}
|
883 |
}
|
| 884 |
|
884 |
|
| 885 |
List<Integer> l2FofoIdList = l2AuthIdToFofoIds.getOrDefault(l2AuthId, Collections.emptyList());
|
885 |
List<Integer> l2FofoIdList = l2AuthIdToFofoIds.getOrDefault(l2AuthId, Collections.emptyList());
|
| 886 |
|
886 |
|
| 887 |
// Filter to only external, ACTIVE stores with collection plan
|
887 |
// For L2, use all escalated ticket fofoIds as target (no collection plan filter)
|
| 888 |
Map<Integer, Integer> finalAllCollectionRankMap2 = allCollectionRankMap;
|
- |
|
| 889 |
Map<Integer, FofoStore> finalFofoStoresMap2 = fofoStoresMap;
|
- |
|
| 890 |
List<Integer> validL2FofoIds = l2FofoIdList.stream()
|
888 |
Set<Integer> l2TargetFofoIds = new HashSet<>(l2FofoIdList);
|
| 891 |
.filter(fofoId -> {
|
- |
|
| 892 |
FofoStore store = finalFofoStoresMap2.get(fofoId);
|
- |
|
| 893 |
if (store == null || store.isInternal()) {
|
- |
|
| 894 |
return false;
|
- |
|
| 895 |
}
|
- |
|
| 896 |
if (!ActivationType.ACTIVE.equals(store.getActivationType())) {
|
- |
|
| 897 |
return false;
|
- |
|
| 898 |
}
|
- |
|
| 899 |
return finalAllCollectionRankMap2.containsKey(fofoId);
|
- |
|
| 900 |
})
|
- |
|
| 901 |
.collect(Collectors.toList());
|
- |
|
| 902 |
|
889 |
|
| 903 |
RbmCallTargetModel l2Model = new RbmCallTargetModel();
|
890 |
RbmCallTargetModel l2Model = new RbmCallTargetModel();
|
| 904 |
l2Model.setAuthId(l2AuthId);
|
891 |
l2Model.setAuthId(l2AuthId);
|
| 905 |
l2Model.setRbmName(authUser.getFullName() + " (L2)");
|
892 |
l2Model.setRbmName(authUser.getFullName() + " (L2)");
|
| 906 |
l2Model.setL2Position(true);
|
893 |
l2Model.setL2Position(true);
|
| 907 |
l2Model.setL2CallingList(l2FofoIdList.size());
|
894 |
l2Model.setL2CallingList(l2FofoIdList.size());
|
| 908 |
// Partner count = total assigned partners (same as L1 source)
|
895 |
// Partner count = total assigned partners (same as L1 source)
|
| 909 |
List<Integer> l2AssignedFofoIds = rbmToFofoIdsMap.getOrDefault(l2AuthId, Collections.emptyList());
|
896 |
List<Integer> l2AssignedFofoIds = rbmToFofoIdsMap.getOrDefault(l2AuthId, Collections.emptyList());
|
| 910 |
l2Model.setPartnerCount(l2AssignedFofoIds.size());
|
897 |
l2Model.setPartnerCount(l2AssignedFofoIds.size());
|
| 911 |
|
898 |
|
| 912 |
if (!validL2FofoIds.isEmpty()) {
|
- |
|
| 913 |
// Categorize using same logic as L1
|
- |
|
| 914 |
Set<Integer> l2PlanToday = new HashSet<>();
|
- |
|
| 915 |
Set<Integer> l2CarryForward = new HashSet<>();
|
- |
|
| 916 |
Set<Integer> l2Untouched = new HashSet<>();
|
- |
|
| 917 |
Set<Integer> l2ZeroBilling = new HashSet<>();
|
- |
|
| 918 |
Set<Integer> l2FuturePlan = new HashSet<>();
|
- |
|
| 919 |
Set<Integer> l2Normal = new HashSet<>();
|
- |
|
| 920 |
|
- |
|
| 921 |
for (Integer fofoId : validL2FofoIds) {
|
- |
|
| 922 |
int rank = allCollectionRankMap.getOrDefault(fofoId, 5);
|
- |
|
| 923 |
boolean hasZeroBilling = !allMtdBilledFofoIds.contains(fofoId);
|
- |
|
| 924 |
|
- |
|
| 925 |
if (rank == 1) {
|
- |
|
| 926 |
l2PlanToday.add(fofoId);
|
- |
|
| 927 |
} else if (rank == 2) {
|
- |
|
| 928 |
l2CarryForward.add(fofoId);
|
- |
|
| 929 |
} else if (rank == 3) {
|
- |
|
| 930 |
l2Untouched.add(fofoId);
|
- |
|
| 931 |
} else if (hasZeroBilling) {
|
- |
|
| 932 |
l2ZeroBilling.add(fofoId);
|
- |
|
| 933 |
} else if (rank == 4) {
|
- |
|
| 934 |
l2FuturePlan.add(fofoId);
|
- |
|
| 935 |
} else {
|
- |
|
| 936 |
l2Normal.add(fofoId);
|
899 |
// L2 Target = all escalated ticket fofoIds
|
| 937 |
}
|
- |
|
| 938 |
}
|
- |
|
| 939 |
|
- |
|
| 940 |
l2Model.setPlanToday(l2PlanToday.size());
|
- |
|
| 941 |
l2Model.setCarryForward(l2CarryForward.size());
|
- |
|
| 942 |
l2Model.setUntouched(l2Untouched.size());
|
- |
|
| 943 |
l2Model.setZeroBilling(l2ZeroBilling.size());
|
- |
|
| 944 |
l2Model.setFuturePlan(l2FuturePlan.size());
|
- |
|
| 945 |
l2Model.setNormal(l2Normal.size());
|
- |
|
| 946 |
|
- |
|
| 947 |
long l2TodayTarget = l2PlanToday.size() + l2CarryForward.size()
|
- |
|
| 948 |
+ l2ZeroBilling.size() + l2Untouched.size();
|
- |
|
| 949 |
l2Model.setTodayTargetOfCall(l2TodayTarget);
|
900 |
l2Model.setTodayTargetOfCall(l2TargetFofoIds.size());
|
| 950 |
|
901 |
|
| 951 |
// Value Achieved
|
- |
|
| 952 |
Set<Integer> l2TodayTargetPartners = new HashSet<>();
|
902 |
// Value Achieved = distinct fofoIds from today's remarks that are in escalated tickets
|
| 953 |
l2TodayTargetPartners.addAll(l2PlanToday);
|
- |
|
| 954 |
l2TodayTargetPartners.addAll(l2CarryForward);
|
- |
|
| 955 |
l2TodayTargetPartners.addAll(l2ZeroBilling);
|
- |
|
| 956 |
l2TodayTargetPartners.addAll(l2Untouched);
|
- |
|
| 957 |
|
- |
|
| 958 |
List<PartnerCollectionRemark> l2TodayRemarks = remarksByAuthId.getOrDefault(l2AuthId, Collections.emptyList());
|
903 |
List<PartnerCollectionRemark> l2TodayRemarks = remarksByAuthId.getOrDefault(l2AuthId, Collections.emptyList());
|
| 959 |
long l2ValueAchieved = l2TodayRemarks.stream()
|
904 |
long l2ValueAchieved = l2TodayRemarks.stream()
|
| 960 |
.map(PartnerCollectionRemark::getFofoId)
|
905 |
.map(PartnerCollectionRemark::getFofoId)
|
| 961 |
.filter(l2TodayTargetPartners::contains)
|
906 |
.filter(l2TargetFofoIds::contains)
|
| 962 |
.distinct()
|
907 |
.distinct()
|
| 963 |
.count();
|
908 |
.count();
|
| 964 |
l2Model.setValueTargetAchieved(l2ValueAchieved);
|
909 |
l2Model.setValueTargetAchieved(l2ValueAchieved);
|
| 965 |
|
- |
|
| 966 |
// Moved to Future
|
- |
|
| 967 |
Set<Integer> l2TodayRemarkedFofoIds = l2TodayRemarks.stream()
|
- |
|
| 968 |
.map(PartnerCollectionRemark::getFofoId)
|
- |
|
| 969 |
.collect(Collectors.toSet());
|
- |
|
| 970 |
long l2MovedToFuture = l2FuturePlan.stream()
|
- |
|
| 971 |
.filter(l2TodayRemarkedFofoIds::contains)
|
- |
|
| 972 |
.count();
|
- |
|
| 973 |
l2Model.setMovedToFuture(l2MovedToFuture);
|
- |
|
| 974 |
}
|
- |
|
| 975 |
|
910 |
|
| 976 |
l2Model.setOutOfSequenceCount(outOfSequenceCountByAuthId.getOrDefault(l2AuthId, 0L));
|
911 |
l2Model.setOutOfSequenceCount(outOfSequenceCountByAuthId.getOrDefault(l2AuthId, 0L));
|
| 977 |
rbmCallTargetModels.add(l2Model);
|
912 |
rbmCallTargetModels.add(l2Model);
|
| 978 |
}
|
913 |
}
|
| 979 |
|
914 |
|