Subversion Repositories SmartDukaan

Rev

Rev 36210 | Rev 36225 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36210 Rev 36212
Line 725... Line 725...
725
            }
725
            }
726
        }
726
        }
727
        LOGGER.info("RBM Call Target - L2 calling lists populated from RBM_L2_ESCALATION remarks");
727
        LOGGER.info("RBM Call Target - L2 calling lists populated from RBM_L2_ESCALATION remarks");
728
 
728
 
729
        // Populate L3 calling list based on partners whose latest remark is RBM_L3_ESCALATION
729
        // Populate L3 calling list based on partners whose latest remark is RBM_L3_ESCALATION
730
        // Find the L1 who originally has the partner, then traverse: L1 -> L2 (manager) -> L3 (manager's manager)
730
        // Find the L1 who originally has the partner, then:
-
 
731
        // Case 1: L1 -> L3 directly (if L1's manager IS L3)
-
 
732
        // Case 2: L1 -> L2 -> L3 (if L1's manager is L2, then L2's manager is L3)
731
        for (Map.Entry<Integer, PartnerCollectionRemark> entry : allPartnerCollectionRemarks.entrySet()) {
733
        for (Map.Entry<Integer, PartnerCollectionRemark> entry : allPartnerCollectionRemarks.entrySet()) {
732
            Integer fofoId = entry.getKey();
734
            Integer fofoId = entry.getKey();
733
            PartnerCollectionRemark remark = entry.getValue();
735
            PartnerCollectionRemark remark = entry.getValue();
734
 
736
 
735
            if (CollectionRemark.RBM_L3_ESCALATION.equals(remark.getRemark())) {
737
            if (CollectionRemark.RBM_L3_ESCALATION.equals(remark.getRemark())) {
736
                // Find which L1 RBM originally has this partner assigned
738
                // Find which L1 RBM originally has this partner assigned
737
                for (int l1AuthId : l1AuthIds) {
739
                for (int l1AuthId : l1AuthIds) {
738
                    List<Integer> l1FofoIds = rbmToFofoIdsMap.getOrDefault(l1AuthId, Collections.emptyList());
740
                    List<Integer> l1FofoIds = rbmToFofoIdsMap.getOrDefault(l1AuthId, Collections.emptyList());
739
                    if (l1FofoIds.contains(fofoId)) {
741
                    if (l1FofoIds.contains(fofoId)) {
740
                        // Get L1's manager (L2)
-
 
741
                        AuthUser l1User = authUserMap.get(l1AuthId);
742
                        AuthUser l1User = authUserMap.get(l1AuthId);
742
                        if (l1User != null) {
743
                        if (l1User != null) {
743
                            int l2ManagerId = l1User.getManagerId();
744
                            int l1ManagerId = l1User.getManagerId();
-
 
745
                            // Case 1: L1's manager IS L3 directly (L1 → L3, no L2 in between)
-
 
746
                            if (l3AuthIdToFofoIds.containsKey(l1ManagerId)) {
-
 
747
                                l3AuthIdToFofoIds.get(l1ManagerId).add(fofoId);
-
 
748
                                LOGGER.debug("L3 Calling List (direct): fofoId={} -> L1={} -> L3={}",
744
                            AuthUser l2User = authUserMap.get(l2ManagerId);
749
                                        fofoId, l1AuthId, l1ManagerId);
-
 
750
                            } else {
745
                            // Get L2's manager (L3)
751
                                // Case 2: L1 -> L2 -> L3
-
 
752
                                AuthUser l2User = authUserMap.get(l1ManagerId);
746
                            if (l2User != null && l3AuthIdToFofoIds.containsKey(l2User.getManagerId())) {
753
                                if (l2User != null && l3AuthIdToFofoIds.containsKey(l2User.getManagerId())) {
747
                                int l3ManagerId = l2User.getManagerId();
754
                                    int l3ManagerId = l2User.getManagerId();
748
                                l3AuthIdToFofoIds.get(l3ManagerId).add(fofoId);
755
                                    l3AuthIdToFofoIds.get(l3ManagerId).add(fofoId);
749
                                LOGGER.debug("L3 Calling List: fofoId={} -> L1={} -> L2={} -> L3={}",
756
                                    LOGGER.debug("L3 Calling List: fofoId={} -> L1={} -> L2={} -> L3={}",
750
                                        fofoId, l1AuthId, l2ManagerId, l3ManagerId);
757
                                            fofoId, l1AuthId, l1ManagerId, l3ManagerId);
-
 
758
                                }
751
                            }
759
                            }
752
                        }
760
                        }
753
                        break; // Found the L1 for this fofoId
761
                        break; // Found the L1 for this fofoId
754
                    }
762
                    }
755
                }
763
                }