Просмотр исходного кода

添加获取部门分机状态接口

baiwenju лет назад: 3
Родитель
Сommit
e4d43182a0

+ 2 - 1
MidWare_WinStandard1.0-zmd/3rd/hybase/PduLinkInc.h

@@ -147,7 +147,7 @@ typedef enum tagPDU_CMD_TYPE
147 147
 	PDU_CMD_AGENT_VIDEO_REQ_EXTEN   = 130,      // 请求注册视频分机号
148 148
 	PDU_CMD_AGENT_VIDEO_REQ_AGENT   = 131,      // 请求空闲坐席
149 149
 	PDU_CMD_AGENT_VIDEO_RECOVER_EXTEN = 132,    // 释放请求的视频分机号
150
-
150
+	PDU_CMD_EXTEN_STATE_LIST_ZMD = 146,      // 驻马店获取分机状态
151 151
 
152 152
 	// ACD命令集(201-300)
153 153
 	PDU_CMD_ACD_AGENT_STATE			= 201,		// ACD通知坐席状态(包括订阅状态,用工号区分自己还是被订阅者)
@@ -184,6 +184,7 @@ typedef enum tagPDU_CMD_TYPE
184 184
 	PDU_CMD_IVR_WAITER_COUNT        = 412,      // IVR通知CTI 当前排队人数   2019-9-6 配合4.0acd返回排队人数
185 185
 	PDU_CMD_ACD_FREEAGENT           = 413,      //ACD通知空闲坐席数量
186 186
 	PDU_CMD_CTI_TRUNKUSE_COUNT      = 414,      //ACD 通知中继利用数
187
+	PDU_CMD_AGENT_GET_AGENTLIST     = 415,      // 获取坐席列表  转移电话时使用
187 188
 
188 189
 	// Stable Core命令集(501-600)
189 190
 	PDU_CMD_SC_RES_DETAIL			= 501,		// SC上报资源明细

+ 27 - 0
MidWare_WinStandard1.0-zmd/3rd/hybase/RcfClient.h

@@ -0,0 +1,27 @@
1
+// pch.h: 这是预编译标头文件。
2
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
3
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
4
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
5
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
6
+
7
+#ifndef PCH_H
8
+#define PCH_H
9
+
10
+// 添加要在此处预编译的标头
11
+#include <string>
12
+#include <vector>
13
+
14
+bool pushAgentList(int agentId, std::string agentList);
15
+bool getAgentList(int agentId, std::string& agentList);
16
+bool pushRedis(std::vector<std::string> & val);
17
+bool pushRedis(std::string & val);
18
+bool pushCallIndex(std::string callIndex);
19
+bool getCallIndex(int index, std::string& callIndex);
20
+bool pushSubmitData(int nEventType, std::string state);
21
+bool getSubmitData(int nEventType, std::string& state);
22
+
23
+// 驻马店专用
24
+bool pushZmdExtenStateList(std::string& extList);
25
+bool getZmdExtenStateList(std::string& extList);
26
+
27
+#endif //PCH_H

+ 3 - 0
MidWare_WinStandard1.0-zmd/3rd/hybase/RcfConfig.yml

@@ -0,0 +1,3 @@
1
+Rcf:
2
+  IP: 127.0.0.1
3
+  PORT: 5001

+ 3 - 1
MidWare_WinStandard1.0-zmd/ACD/ACD.vcxproj

@@ -47,7 +47,7 @@
47 47
   </PropertyGroup>
48 48
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
49 49
     <LinkIncremental>false</LinkIncremental>
50
-    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Microsoft Visual Studio\third-Part\yaml-cpp;C:\Microsoft Visual Studio\third-Part\jsoncpp;C:\Microsoft Visual Studio\third-Part\boost-1_69;$(ProjectDir)</IncludePath>
50
+    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir);$(IncludePath)</IncludePath>
51 51
   </PropertyGroup>
52 52
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
53 53
     <ClCompile>
@@ -131,6 +131,7 @@
131 131
     <ClInclude Include="AgentGroup.h" />
132 132
     <ClInclude Include="AgentOffice.h" />
133 133
     <ClInclude Include="Config.h" />
134
+    <ClInclude Include="DepttelextOffice.h" />
134 135
     <ClInclude Include="StrategyLoopByAgentId.h" />
135 136
     <ClInclude Include="Exten.h" />
136 137
     <ClInclude Include="ExtenCtrl.h" />
@@ -183,6 +184,7 @@
183 184
     <ClCompile Include="AgentGroup.cpp" />
184 185
     <ClCompile Include="AgentOffice.cpp" />
185 186
     <ClCompile Include="Config.cpp" />
187
+    <ClCompile Include="DepttelextOffice.cpp" />
186 188
     <ClCompile Include="StrategyLoopByAgentId.cpp" />
187 189
     <ClCompile Include="Exten.cpp" />
188 190
     <ClCompile Include="ExtenCtrl.cpp" />

+ 9 - 0
MidWare_WinStandard1.0-zmd/ACD/ACD.vcxproj.filters

@@ -50,6 +50,9 @@
50 50
     <Filter Include="BLL\VideoExten">
51 51
       <UniqueIdentifier>{977b6070-655f-4e93-acbf-f9092e970497}</UniqueIdentifier>
52 52
     </Filter>
53
+    <Filter Include="Depttelext">
54
+      <UniqueIdentifier>{2f5fa641-7ccf-4c49-9b22-7a579bccc52d}</UniqueIdentifier>
55
+    </Filter>
53 56
   </ItemGroup>
54 57
   <ItemGroup>
55 58
     <None Include="ReadMe.txt" />
@@ -233,6 +236,9 @@
233 236
     <ClInclude Include="VideoOffice.h">
234 237
       <Filter>BLL\VideoExten</Filter>
235 238
     </ClInclude>
239
+    <ClInclude Include="DepttelextOffice.h">
240
+      <Filter>Depttelext</Filter>
241
+    </ClInclude>
236 242
   </ItemGroup>
237 243
   <ItemGroup>
238 244
     <ClCompile Include="stdafx.cpp">
@@ -371,6 +377,9 @@
371 377
     <ClCompile Include="VideoOffice.cpp">
372 378
       <Filter>BLL\VideoExten</Filter>
373 379
     </ClCompile>
380
+    <ClCompile Include="DepttelextOffice.cpp">
381
+      <Filter>Depttelext</Filter>
382
+    </ClCompile>
374 383
   </ItemGroup>
375 384
   <ItemGroup>
376 385
     <ResourceCompile Include="ACD.rc">

+ 44 - 6
MidWare_WinStandard1.0-zmd/ACD/AcdCore.cpp

@@ -46,6 +46,7 @@ void CAcdCore::__onAgentStateUpdated( UINT AgentId )
46 46
 	// 如果有座席变为空闲,通知来电队列刷新排队
47 47
 	if(State == AGENT_STATE_FREE)
48 48
 		m_QueueMgr.onAgentFree(pAgent);
49
+
49 50
 }
50 51
 
51 52
 /*****************************************************************
@@ -64,6 +65,9 @@ void CAcdCore::__onPhoneStateUpdated( UINT ExtenId )
64 65
 
65 66
 	// 通知事件订阅
66 67
 	m_SubjectRepository.onPhoneStateUpdated(pExten->assoAgent(), pExten->id(), pExten->state());
68
+
69
+	// 2022-09-01 驻马店 保存分机号,坐席状态
70
+	m_DepttelextOffice.UpdateDepttelext(pExten->id(), pExten->state());
67 71
 }
68 72
 
69 73
 /*****************************************************************
@@ -759,14 +763,26 @@ void CAcdCore::__onCmdDataSendToAgent(CPduEntity * a_pCmd)
759 763
 	}
760 764
 	std::vector<int> VecAgentID = m_AgentOffice.getAgentIDAll();
761 765
 
762
-	for (auto iter = VecAgentID.begin(); iter != VecAgentID.end(); iter++)
766
+	bool isSuccess = CNetworkAcd::GetInstance().send2Server(a_pCmd);
767
+	ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Core}: 通知[%d][%s],当前数量:%d"), a_pCmd->GetCmdType(), isSuccess ? "成功" : "失败", count);
768
+}
769
+
770
+void CAcdCore::__onCmdGetAgentList(CPduEntity * a_pCmd)
771
+{
772
+	CString szAgentList;
773
+	m_AgentOffice.getAllAgentStateList(szAgentList);
774
+	int t_agent_id = a_pCmd->GetDataUInt(1);
775
+	if (!pushAgentList(t_agent_id, szAgentList.GetBuffer(0)))  // 如果rcf失败在使用原来参数传递
763 776
 	{
764
-		bool isSuccess = CNetworkAcd::GetInstance().send2Server(a_pCmd);
765
-		if (isSuccess)
766
-			ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Core}: 通知坐席%d 成功,当前数量:%d"), *iter, count);
767
-		else
768
-			ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Core}: 通知坐席%d 失败,当前数量:%d"), *iter, count);
777
+		if (szAgentList.GetLength() >= 512)
778
+		{
779
+			szAgentList = szAgentList.Left(511);
780
+			ILogger::getInstance().log(LOG_CLASS_SOCKET, LOG_LEVEL_WARNING, _T("ACD -> HP-SERVER,坐席[%lu]获取坐席列表字符超出被截取 "), a_pCmd->GetDataUInt(1));
781
+		}
782
+		a_pCmd->SetDataString(2, szAgentList);
769 783
 	}
784
+	szAgentList.ReleaseBuffer();
785
+	CNetworkAcd::GetInstance().send2Server(a_pCmd);
770 786
 }
771 787
 
772 788
 void CAcdCore::__onCmdAgentReqExten(CPduEntity * a_pCmd)
@@ -800,6 +816,13 @@ void CAcdCore::__onCmdAgentRecoverAgent(CPduEntity * a_pCmd)
800 816
 	CNetworkAcd::GetInstance().send2Server(a_pCmd);
801 817
 }
802 818
 
819
+void CAcdCore::__onCmdExtStateList(CPduEntity * a_pCmd)
820
+{
821
+	std::string extStateList = m_DepttelextOffice.GetAllDeptTelext();
822
+	pushZmdExtenStateList(extStateList);
823
+	CNetworkAcd::GetInstance().send2Server(a_pCmd);
824
+}
825
+
803 826
 /*****************************************************************
804 827
 **【函数名称】	stage1Start
805 828
 **【函数功能】	第一阶段启动
@@ -830,6 +853,14 @@ bool CAcdCore::stage1Start( void )
830 853
 		AfxMessageBox("加载视频账号配置信息失败");
831 854
 		return false;
832 855
 	}
856
+	// 加载分机号部门信息失败
857
+	if (!m_DepttelextOffice.InitDepttelext())
858
+	{
859
+		IOtlConnection::getInstance()->Disconnect();
860
+		AfxMessageBox("加载分机部门信息失败");
861
+		return false;
862
+	}
863
+	std::cout << m_DepttelextOffice.GetAllDeptTelext() << std::endl;
833 864
 	return true;
834 865
 }
835 866
 
@@ -1013,6 +1044,10 @@ void CAcdCore::onRecvCommand( CPduEntity* a_pPduEntity )
1013 1044
 		__onCmdDataSendToAgent(a_pPduEntity);
1014 1045
 		break;
1015 1046
 
1047
+	case PDU_CMD_AGENT_GET_AGENTLIST:
1048
+		__onCmdGetAgentList(a_pPduEntity);
1049
+		break;
1050
+
1016 1051
 	case PDU_CMD_AGENT_VIDEO_REQ_EXTEN:      // 请求注册视频分机号
1017 1052
 		__onCmdAgentReqExten(a_pPduEntity);
1018 1053
 		break;
@@ -1022,6 +1057,9 @@ void CAcdCore::onRecvCommand( CPduEntity* a_pPduEntity )
1022 1057
 	case PDU_CMD_AGENT_VIDEO_RECOVER_EXTEN:    // 释放请求的视频分机号
1023 1058
 		__onCmdAgentRecoverAgent(a_pPduEntity);
1024 1059
 		break;
1060
+	case PDU_CMD_EXTEN_STATE_LIST_ZMD:  // 分机状态列表
1061
+		__onCmdExtStateList(a_pPduEntity);
1062
+		break;
1025 1063
 	default:
1026 1064
 		return;
1027 1065
 	} // end switch

+ 6 - 1
MidWare_WinStandard1.0-zmd/ACD/AcdCore.h

@@ -14,6 +14,7 @@
14 14
 #include "SubjectRepository.h"
15 15
 #include "SoftAuther.h"
16 16
 #include "VideoOffice.h"
17
+#include "DepttelextOffice.h"
17 18
 
18 19
 class CAgent;
19 20
 class CExten;
@@ -77,10 +78,14 @@ private:
77 78
 
78 79
 	void __onCmdDataSendToAgent(CPduEntity* a_pCmd);      //向Agent转发当前通话中线路数量
79 80
 
81
+	void __onCmdGetAgentList(CPduEntity* a_pCmd);      // 获取坐席列表
82
+
80 83
 	void __onCmdAgentReqExten(CPduEntity* a_pCmd);       // 请求注册视频分机号
81 84
 	void __onCmdAgentReqAgent(CPduEntity* a_pCmd);       // 请求空闲坐席
82 85
 	void __onCmdAgentRecoverAgent(CPduEntity* a_pCmd);   // 释放请求的视频分机号
83 86
 
87
+	void __onCmdExtStateList(CPduEntity* a_pCmd);        // 获取分机状态列表
88
+
84 89
 private:
85 90
 	CExtenCtrl m_ExtenCtrl;                         // 内线分机管理类
86 91
 	CAgentOffice m_AgentOffice;						// 座席管理类
@@ -88,7 +93,7 @@ private:
88 93
 	CSubjectRepository m_SubjectRepository;			// 发布主题管理类
89 94
 
90 95
 	CVideoOffice m_VideoOffice;                     // 视频账号管理类
91
-
96
+	CDepttelextOffice m_DepttelextOffice;
92 97
 	SoftAuther m_Auther;                 //授权
93 98
 };
94 99
 

+ 18 - 0
MidWare_WinStandard1.0-zmd/ACD/AgentOffice.cpp

@@ -421,6 +421,24 @@ void CAgentOffice::getStateSpecAgentList( AGENT_LIST_SPEC_STATE SpecState, CStri
421 421
 	} // end while
422 422
 }
423 423
 
424
+void CAgentOffice::getAllAgentStateList(CString & AgentList)
425
+{
426
+	CSingleLock Lock(&m_Cs4AgentMap, TRUE);
427
+	UINT Key;
428
+	CAgent* pAgent = NULL;
429
+	CString agent;
430
+	POSITION pos = m_AgentMap.GetStartPosition();
431
+	while (pos != NULL)
432
+	{
433
+		m_AgentMap.GetNextAssoc(pos, Key, pAgent);
434
+		if (pAgent)
435
+		{
436
+			agent.Format("%d,%d,%d,%s|", pAgent->id(), pAgent->assoExten(), pAgent->state(), pAgent->group());
437
+			AgentList += agent;
438
+		}
439
+	}
440
+}
441
+
424 442
 std::vector<int> CAgentOffice::getAgentIDAll()
425 443
 {
426 444
 	UINT id = 0;

+ 6 - 0
MidWare_WinStandard1.0-zmd/ACD/AgentOffice.h

@@ -62,6 +62,12 @@ public:
62 62
 	// 获取指定状态的座席列表
63 63
 	void getStateSpecAgentList(AGENT_LIST_SPEC_STATE SpecState, CString& AgentList);
64 64
 
65
+	// 获取所有坐席状态列表
66
+	void getAllAgentStateList(CString& AgentList);
67
+	
68
+	// 
69
+	
70
+
65 71
 	std::vector<int> getAgentIDAll();   //获取所有座席AgentID
66 72
 
67 73
 	//std::map<UINT, CAgentProperty>& GetAgentPropertyMap();   // 2020-03-05 屏蔽   该方法未找到使用的地方(没有被调用)

+ 82 - 0
MidWare_WinStandard1.0-zmd/ACD/DepttelextOffice.cpp

@@ -0,0 +1,82 @@
1
+#include "stdafx.h"
2
+#include "DepttelextOffice.h"
3
+#include <iostream>
4
+
5
+CDepttelextOffice::~CDepttelextOffice()
6
+{
7
+	auto it = m_DeptTelextmap.begin();
8
+	DeptTelext *pDeptTelext = nullptr;
9
+	while (it != m_DeptTelextmap.end())
10
+	{
11
+		pDeptTelext = it->second;
12
+		if (pDeptTelext) {
13
+			delete pDeptTelext;
14
+			pDeptTelext = nullptr;
15
+		}
16
+		++it;
17
+	}
18
+}
19
+
20
+bool CDepttelextOffice::InitDepttelext()
21
+{
22
+	CString sql;
23
+	sql.Format("SELECT [Id],[Name],[Telephone],[Extension] ,[CreateTime] FROM  [dbo].[tel_depttelext]");
24
+	IOtlConnection* pConn = IOtlConnection::getInstance();
25
+	IOtlRecordset* record = pConn->QueryRecords(sql);
26
+	ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{CDepttelextOffice}: 分机号码列表开始初始化"));
27
+	if (record == NULL)
28
+	{
29
+		return false;
30
+	}
31
+	while (!record->IsEOF())
32
+	{
33
+		record->MoveNextRow();
34
+		 
35
+		DeptTelext *pDeptTelext = new DeptTelext();
36
+		pDeptTelext->Name = record->GetValueStr("Name");
37
+		pDeptTelext->Telephone = record->GetValueStr("Telephone");
38
+		pDeptTelext->Extension = record->GetValueStr("Extension");
39
+		pDeptTelext->State = 8;// 默认移除
40
+
41
+		UINT extenId = _ttoi(pDeptTelext->Extension);
42
+		m_DeptTelextmap.insert(std::make_pair(extenId, pDeptTelext));
43
+
44
+		std::cout << pDeptTelext->Name <<" - "<< extenId << " - " << pDeptTelext->Telephone << " - " << pDeptTelext->Extension << std::endl;
45
+	}
46
+
47
+	ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{CDepttelextOffice}: 分机号码列表结束初始化"));
48
+	IOtlRecordset::DestroyInstance(record);		// 释放记录集
49
+	return true;
50
+	return false;
51
+}
52
+
53
+void CDepttelextOffice::UpdateDepttelext(UINT extno, int state)
54
+{
55
+	auto it = m_DeptTelextmap.find(extno);
56
+	if (it == m_DeptTelextmap.end()) return;
57
+	if (it->second) {
58
+		it->second->State = state;
59
+	}
60
+}
61
+
62
+std::string CDepttelextOffice::GetAllDeptTelext()
63
+{
64
+	Json::Value root;
65
+	Json::Value body;
66
+	Json::FastWriter writer;
67
+
68
+	auto it = m_DeptTelextmap.begin();
69
+	DeptTelext *pDeptTelext = nullptr;
70
+	while (it != m_DeptTelextmap.end()){
71
+		pDeptTelext = it->second;
72
+		if (pDeptTelext) {
73
+			body["Name"] = pDeptTelext->Name.GetBuffer(0);
74
+			body["Telephone"] = pDeptTelext->Telephone.GetBuffer(0);
75
+			body["AgentExten"] = pDeptTelext->Extension.GetBuffer(0);
76
+			body["State"] = pDeptTelext->State;
77
+			root.append(body);
78
+		}
79
+		++it;
80
+	}
81
+	return writer.write(root);
82
+}

+ 27 - 0
MidWare_WinStandard1.0-zmd/ACD/DepttelextOffice.h

@@ -0,0 +1,27 @@
1
+#pragma once
2
+#include <map>
3
+#include <string>
4
+
5
+class CDepttelextOffice
6
+{
7
+public:
8
+	CDepttelextOffice() {};
9
+	~CDepttelextOffice();
10
+
11
+	bool InitDepttelext();
12
+	void UpdateDepttelext(UINT extno, int state);
13
+	std::string GetAllDeptTelext();
14
+
15
+private:
16
+	typedef struct tagtel_depttelext {
17
+		int Id;
18
+		CString Name;
19
+		CString Telephone;
20
+		CString Extension;
21
+		CString AgentID;
22
+		int State;
23
+	}DeptTelext;
24
+
25
+	std::map<UINT, DeptTelext*> m_DeptTelextmap;  // 2022-09-01
26
+};
27
+

+ 5 - 0
MidWare_WinStandard1.0-zmd/ACD/stdafx.h

@@ -54,7 +54,12 @@
54 54
 
55 55
 //#define _VERSION_EHANG
56 56
 
57
+#include <string>
58
+#include <json/json.h>
59
+#pragma comment(lib,"jsoncpp_static.lib")
57 60
 
61
+#include "RcfClient.h"
62
+#pragma comment(lib,"RcfClient.lib")
58 63
 
59 64
 #ifdef _UNICODE
60 65
 #if defined _M_IX86