Subversion Repositories SmartDukaan

Rev

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

Rev 36997 Rev 36998
Line 1748... Line 1748...
1748
 
1748
 
1749
    @Override
1749
    @Override
1750
    public List<List<String>> getAllRbmCallTargetRawData() throws Exception {
1750
    public List<List<String>> getAllRbmCallTargetRawData() throws Exception {
1751
        List<List<String>> rows = new ArrayList<>();
1751
        List<List<String>> rows = new ArrayList<>();
1752
 
1752
 
1753
        // Get all L1 RBM positions
1753
        // Get all L1 RBM positions (rows are emitted per L1 RBM).
-
 
1754
        // Call-log lookup happens against ALL callers via findAllByDate — so an L2/L3 or admin call
-
 
1755
        // still counts as "tried" for the partner.
1754
        List<Position> allRbmPositions = positionRepository
1756
        List<Position> allRbmPositions = positionRepository
1755
                .selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM).stream()
1757
                .selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM).stream()
1756
                .filter(x -> EscalationType.L1.equals(x.getEscalationType()))
1758
                .filter(x -> EscalationType.L1.equals(x.getEscalationType()))
1757
                .collect(Collectors.toList());
1759
                .collect(Collectors.toList());
1758
 
1760
 
Line 1850... Line 1852...
1850
            retailerMap = retailerService.getFofoRetailers(new ArrayList<>(allFofoIds));
1852
            retailerMap = retailerService.getFofoRetailers(new ArrayList<>(allFofoIds));
1851
        } catch (ProfitMandiBusinessException e) {
1853
        } catch (ProfitMandiBusinessException e) {
1852
            LOGGER.error("Error fetching fofo retailers for all raw data", e);
1854
            LOGGER.error("Error fetching fofo retailers for all raw data", e);
1853
        }
1855
        }
1854
 
1856
 
1855
        // Batch-fetch today's call logs across all L1 RBMs and build a fofoId -> latest AgentCallLog map.
1857
        // Batch-fetch EVERY call log for today (across all callers, not just RBMs) and build a
1856
        // "Latest Call Status" reflects whether the PARTNER was tried at all today, regardless of which
1858
        // fofoId -> latest AgentCallLog map. We use findAllByDate here so that calls placed by
1857
        // RBM placed the call — so a partner shared across RBMs shows a real status if any caller reached them.
1859
        // admins, escalation agents, or anyone whose authId isn't in the RBM position table are
-
 
1860
        // still surfaced. Downstream we only read this map for fofoIds we actually emit, so
-
 
1861
        // extra entries are harmless.
1858
        Map<Integer, AgentCallLog> latestCallByFofo = new HashMap<>();
1862
        Map<Integer, AgentCallLog> latestCallByFofo = new HashMap<>();
1859
        try {
1863
        try {
1860
            List<AgentCallLog> todayCallLogs = agentCallLogRepository.findByAuthIdsAndDate(l1AuthIds, LocalDate.now());
1864
            List<AgentCallLog> todayCallLogs = agentCallLogRepository.findAllByDate(LocalDate.now());
1861
            Set<String> normalizedMobiles = new HashSet<>();
1865
            Set<String> normalizedMobiles = new HashSet<>();
1862
            for (AgentCallLog log : todayCallLogs) {
1866
            for (AgentCallLog log : todayCallLogs) {
1863
                if (log.getCustomerNumber() != null) {
1867
                if (log.getCustomerNumber() != null) {
1864
                    String n = log.getCustomerNumber();
1868
                    String n = log.getCustomerNumber();
1865
                    normalizedMobiles.add(n.startsWith("+91") ? n.substring(3) : n);
1869
                    normalizedMobiles.add(n.startsWith("+91") ? n.substring(3) : n);