Subversion Repositories SmartDukaan

Rev

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

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