Subversion Repositories SmartDukaan

Rev

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

Rev 35867 Rev 35868
Line 1... Line 1...
1
package com.spice.profitmandi.web.service;
1
package com.spice.profitmandi.web.service;
2
 
2
 
3
import org.hibernate.Session;
-
 
4
import org.hibernate.SessionFactory;
-
 
5
import org.springframework.beans.factory.annotation.Autowired;
-
 
6
import org.springframework.stereotype.Service;
3
import org.springframework.stereotype.Service;
7
 
4
 
8
import javax.annotation.PostConstruct;
-
 
9
import java.time.LocalDateTime;
-
 
10
import java.util.ArrayList;
-
 
11
import java.util.List;
-
 
12
import java.util.Map;
-
 
13
import java.util.concurrent.ConcurrentHashMap;
-
 
14
 
-
 
15
@Service
5
@Service
16
public class AgentLiveStatusService {
6
public class AgentLiveStatusService {
17
 
7
/*
18
    // In-memory map to store agent status by authId
8
    // In-memory map to store agent status by authId
19
    private final Map<Integer, AgentStatus> agentStatusMap = new ConcurrentHashMap<>();
9
    private final Map<Integer, AgentStatus> agentStatusMap = new ConcurrentHashMap<>();
20
    // Caller ID (Knowlarity SR Number) to Auth ID mapping (loaded from sip_master)
10
    // Caller ID (Knowlarity SR Number) to Auth ID mapping (loaded from sip_master)
21
    private final Map<String, Integer> callerIdToAuthIdMap = new ConcurrentHashMap<>();
11
    private final Map<String, Integer> callerIdToAuthIdMap = new ConcurrentHashMap<>();
22
    // SR Number to Auth ID mapping (loaded from sip_master)
12
    // SR Number to Auth ID mapping (loaded from sip_master)
Line 26... Line 16...
26
    @Autowired
16
    @Autowired
27
    private SessionFactory sessionFactory;
17
    private SessionFactory sessionFactory;
28
    private String lastError = null;
18
    private String lastError = null;
29
    private int lastQueryCount = 0;
19
    private int lastQueryCount = 0;
30
 
20
 
31
    /**
21
    *//**
32
     * Load mapping from sip_master table on startup
22
     * Load mapping from sip_master table on startup
33
     * caller_id in sip_master = SR Number on Knowlarity dashboard
23
     * caller_id in sip_master = SR Number on Knowlarity dashboard
34
     * sip_master has auth_id directly
24
     * sip_master has auth_id directly
35
     */
25
     *//*
36
    @PostConstruct
26
    @PostConstruct
37
    public void loadMappingFromDatabase() {
27
    public void loadMappingFromDatabase() {
38
        try {
28
        try {
39
            Session session = sessionFactory.openSession();
29
            Session session = sessionFactory.openSession();
40
 
30
 
Line 83... Line 73...
83
 
73
 
84
    public int getLastQueryCount() {
74
    public int getLastQueryCount() {
85
        return lastQueryCount;
75
        return lastQueryCount;
86
    }
76
    }
87
 
77
 
88
    /**
78
    *//**
89
     * Reload mapping from database (can be called via API)
79
     * Reload mapping from database (can be called via API)
90
     */
80
     *//*
91
    public void reloadMapping() {
81
    public void reloadMapping() {
92
        callerIdToAuthIdMap.clear();
82
        callerIdToAuthIdMap.clear();
93
        srNumberToAuthIdMap.clear();
83
        srNumberToAuthIdMap.clear();
94
        agentNameToAuthIdMap.clear();
84
        agentNameToAuthIdMap.clear();
95
        lastError = null;
85
        lastError = null;
Line 241... Line 231...
241
        }
231
        }
242
 
232
 
243
        public void setLastUpdated(LocalDateTime lastUpdated) {
233
        public void setLastUpdated(LocalDateTime lastUpdated) {
244
            this.lastUpdated = lastUpdated;
234
            this.lastUpdated = lastUpdated;
245
        }
235
        }
246
    }
236
    }*/
247
}
237
}