Pārlūkot izejas kodu

Merge branch 'master' of http://192.168.1.222:3000/lihai/Synear_API

mengjie 5 gadi atpakaļ
vecāks
revīzija
96f8277673

+ 2 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Configs/system.config

@@ -33,4 +33,6 @@
33 33
   <!-- ================== 5:Redis配置 ================== -->
34 34
   <add key="Redis_Server" value="192.168.4.18" />
35 35
   <add key="Redis_Port" value="6379" />
36
+  <!-- 录音存储地址 -->
37
+  <add key="Sound_recording" value="D:\\CallCenter_Sound\" />
36 38
 </appSettings>

+ 206 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -5,7 +5,9 @@ using CallCenterApi.Interface.Controllers.Base;
5 5
 using System;
6 6
 using System.Collections.Generic;
7 7
 using System.Data;
8
+using System.IO;
8 9
 using System.Linq;
10
+using System.Net;
9 11
 using System.Web;
10 12
 using System.Web.Mvc;
11 13
 
@@ -126,6 +128,210 @@ namespace CallCenterApi.Interface.Controllers.tel
126 128
         }
127 129
 
128 130
         /// <summary>
131
+        /// 批量下载录音文件 - 调用接口
132
+        /// </summary>
133
+        /// <param name="phone"></param>
134
+        /// <param name="usercode"></param>
135
+        /// <returns></returns>
136
+        public ActionResult Sound(string phone, string usercode, int seartgroupid)
137
+        {
138
+            string sql = "";
139
+            string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
140
+            string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
141
+            string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
142
+            string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
143
+            string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
144
+            string dealtype = HttpUtility.UrlDecode(RequestString.GetQueryString("dealtype"));
145
+            
146
+            Model.T_Sys_SeatGroup groupModel = new BLL.T_Sys_SeatGroup().GetModel(seartgroupid);
147
+
148
+            if (groupModel != null)
149
+            {
150
+                if (!string.IsNullOrEmpty(groupModel.F_ZXZCode))
151
+                {
152
+                    sql += " and groupcode = '" + groupModel.F_ZXZCode + "' ";
153
+                }
154
+            }
155
+            //if (!string.IsNullOrEmpty(groupcode))
156
+            //{
157
+            //    sql += " and groupcode = '" + groupcode + "' ";
158
+            //}
159
+            if (usercode != null && usercode.Trim() != "")
160
+            {
161
+                sql += " and UserCode='" + usercode + "'";
162
+            }
163
+            if (dept != null && dept.Trim() != "")
164
+            {
165
+                sql += " and F_DeptId='" + dept.Trim() + "'";
166
+            }
167
+            if (dealtype != null && dealtype.Trim() != "")
168
+            {
169
+                //处理方式
170
+                sql += " and DealType = " + dealtype + " ";
171
+            }
172
+            if (phone != null && phone.Trim() != "")
173
+            {
174
+                sql += " and CallNumber like '%" + phone + "%'";
175
+            }
176
+            if (callstate.Trim() != "")
177
+            {
178
+                sql += " and CallState='" + callstate + "'";
179
+            }
180
+            if (calltype.Trim() != "")
181
+            {
182
+                sql += " and CallType='" + calltype + "'";
183
+            }
184
+            if (starttime.Trim() != "")
185
+            {
186
+                sql += " and datediff(day,BeginTime,'" + starttime + "')<=0 ";
187
+            }
188
+            if (endtime.Trim() != "")
189
+            {
190
+                sql += " and datediff(day,BeginTime,'" + endtime + "')>=0 ";
191
+            }
192
+            var CallList = new BLL.T_Call_CallRecords().GetModelList("FilePath !='' " + sql);
193
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
194
+            var obj = new
195
+            {
196
+                state = "success",
197
+                message = "成功",
198
+                CallList,
199
+                config
200
+            };
201
+            return Content(obj.ToJson());
202
+        }
203
+
204
+        /// <summary>
205
+        /// 批量下载录音文件
206
+        /// </summary>
207
+        /// <param name="filePath"></param>
208
+        /// <param name="phone"></param>
209
+        /// <param name="usercode"></param>
210
+        /// <returns></returns>
211
+        public ActionResult ExitSound(string filePath, string phone, string usercode)
212
+        {
213
+          //   string filePath = Configs.GetValue("Sound_recording");
214
+            System.IO.DriveInfo[] allDrives = System.IO.DriveInfo.GetDrives();
215
+            filePath = filePath + "CallCenter_Sound";
216
+            filePath = Configs.GetValue("Sound_recording");
217
+            // int userId = CurrentUser.UserData.F_UserId;
218
+            //   Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
219
+
220
+            string sql = "";
221
+
222
+            string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
223
+            string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
224
+            string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
225
+            string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
226
+            string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
227
+            string dealtype = HttpUtility.UrlDecode(RequestString.GetQueryString("dealtype"));
228
+            //if (!string.IsNullOrEmpty(userModel.groupcode))
229
+            //{
230
+            //    sql += " and groupcode = '" + userModel.groupcode + "' ";
231
+            //}
232
+
233
+            if (usercode != null && usercode.Trim() != "")
234
+            {
235
+                sql += " and UserCode='" + usercode + "'";
236
+            }
237
+            if (dept != null && dept.Trim() != "")
238
+            {
239
+                sql += " and F_DeptId='" + dept.Trim() + "'";
240
+            }
241
+            if (dealtype != null && dealtype.Trim() != "")
242
+            {
243
+                //处理方式
244
+                sql += " and DealType = " + dealtype + " ";
245
+            }
246
+            if (phone != null && phone.Trim() != "")
247
+            {
248
+                sql += " and CallNumber like '%" + phone + "%'";
249
+            }
250
+            if (callstate.Trim() != "")
251
+            {
252
+                sql += " and CallState='" + callstate + "'";
253
+            }
254
+            if (calltype.Trim() != "")
255
+            {
256
+                sql += " and CallType='" + calltype + "'";
257
+            }
258
+            if (starttime.Trim() != "")
259
+            {
260
+                sql += " and datediff(day,BeginTime,'" + starttime + "')<=0 ";
261
+            }
262
+            if (endtime.Trim() != "")
263
+            {
264
+                sql += " and datediff(day,BeginTime,'" + endtime + "')>=0 ";
265
+            }
266
+            var CallList = new BLL.T_Call_CallRecords().GetModelList("FilePath !='' "+ sql);
267
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
268
+            // 如果文件不存在,创建文件; 如果存在,跳过 
269
+            try
270
+            {
271
+                if (!Directory.Exists(filePath))
272
+                {
273
+                    Directory.CreateDirectory(filePath);
274
+                }
275
+                if (CallList!=null )
276
+                {
277
+                    foreach (var it in CallList)
278
+                    {
279
+                        string FilePath = "";
280
+                        if (it.FilePath != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
281
+                        {
282
+                            var ym = config.F_ParamValue;
283
+                            if (ym.Substring(ym.Length - 1) == "/")
284
+                            {
285
+                                ym = ym.Substring(0, ym.Length - 1);
286
+                            }
287
+                            FilePath = ym + it.FilePath.Substring(it.FilePath.IndexOf(':') + 1).Replace('\\', '/');
288
+                        }
289
+                      
290
+                       
291
+                        string filename = "l"+ it.FilePath.Split ('l')[1];
292
+                        filename = filename.Split('.')[0] + "_" + it.CallNumber + ".mp3";
293
+                        try
294
+                        {
295
+                            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(FilePath);
296
+                            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
297
+                            Stream responseStream = response.GetResponseStream();
298
+                            string[] sArray = filename.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
299
+                            string flie =  filePath +"\\"+ sArray[0] + "\\" + sArray[1] + "\\" + sArray[2];
300
+                            if (!Directory.Exists(flie))
301
+                            {
302
+                                Directory.CreateDirectory(flie);
303
+                            }
304
+                            if (System.IO.File.Exists(flie + "\\" + sArray[3]))
305
+                            {
306
+                                continue;
307
+                            }
308
+                            Stream stream = new FileStream(flie + "\\"+ sArray[3], FileMode.Create);
309
+                            byte[] bArr = new byte[1024];
310
+                            int size = responseStream.Read(bArr, 0, bArr.Length);
311
+                            while (size > 0)
312
+                            {
313
+                                stream.Write(bArr, 0, size);
314
+                                size = responseStream.Read(bArr, 0, bArr.Length);
315
+                            }
316
+                            stream.Close();
317
+                            responseStream.Close();
318
+                        }
319
+                        catch (Exception e)
320
+                        {
321
+                            continue;
322
+                        }
323
+                    }
324
+                }
325
+                return Success("导出成功");
326
+            }
327
+
328
+            catch (Exception e)
329
+            {
330
+                throw;
331
+            }
332
+        }
333
+
334
+        /// <summary>
129 335
         /// 获取实体
130 336
         /// </summary>
131 337
         /// <param name="id"></param>

+ 92 - 0
sql/号码归属地_T_Sys_MobileData.sql

@@ -0,0 +1,92 @@
1
+
2
+
3
+SELECT * INTO T_Sys_MobileData_20190826 FROM dbo.T_Sys_MobileData
4
+
5
+--号码段归属地 - 数据更新 - 15614650809 0574    0574 浙江-宁波	联通130卡用户 -> 0531 山东 济南  中国联通
6
+IF EXISTS (SELECT 1 FROM dbo.T_Sys_MobileData where F_MobileNum = '1561465' AND F_ZipCode = '0574')
7
+BEGIN
8
+	UPDATE dbo.T_Sys_MobileData SET F_ZipCode = '0531',F_CityDes = '山东-济南',F_CardDes = '中国联通' WHERE F_MobileNum = '1561465'
9
+END
10
+
11
+--号码段归属地 - 数据更新 - 17324811889  0396	河南 驻马店市 电信173卡  -> 0371 河南 郑州  中国电信
12
+IF EXISTS (SELECT 1 FROM dbo.T_Sys_MobileData where F_MobileNum = '1732481' AND F_ZipCode = '0396')
13
+BEGIN
14
+	UPDATE dbo.T_Sys_MobileData SET F_ZipCode = '0371',F_CityDes = '河南-郑州',F_CardDes = '中国电信' WHERE F_MobileNum = '1732481'
15
+END
16
+
17
+--号码段归属地 - 数据添加 17539834958 19844999375 17630723821
18
+IF  NOT EXISTS (SELECT 1 FROM dbo.T_Sys_MobileData where F_MobileNum = '1753983')
19
+BEGIN
20
+	INSERT INTO dbo.T_Sys_MobileData
21
+	        ( F_MobileNum ,
22
+	          F_ZipCode ,
23
+	          F_CityDes ,
24
+	          F_CardDes ,
25
+	          F_CreateUser ,
26
+	          F_CreateTime ,
27
+	          F_IsDelete ,
28
+	          F_DeleteUser ,
29
+	          F_DeleteTime
30
+	        )
31
+	VALUES  ( '1753983' , -- F_MobileNum - varchar(20)
32
+	          '0373' , -- F_ZipCode - varchar(10)
33
+	          '河南 新乡' , -- F_CityDes - varchar(50)
34
+	          '中国联通' , -- F_CardDes - varchar(50)
35
+	          '8000' , -- F_CreateUser - varchar(50)
36
+	          '2019-09-10 03:12:38' , -- F_CreateTime - datetime
37
+	          0 , -- F_IsDelete - int
38
+	          NULL , -- F_DeleteUser - varchar(50)
39
+	          NULL  -- F_DeleteTime - datetime
40
+	        )
41
+END
42
+
43
+IF  NOT EXISTS (SELECT 1 FROM dbo.T_Sys_MobileData where F_MobileNum = '1984499')
44
+BEGIN
45
+	INSERT INTO dbo.T_Sys_MobileData
46
+	        ( F_MobileNum ,
47
+	          F_ZipCode ,
48
+	          F_CityDes ,
49
+	          F_CardDes ,
50
+	          F_CreateUser ,
51
+	          F_CreateTime ,
52
+	          F_IsDelete ,
53
+	          F_DeleteUser ,
54
+	          F_DeleteTime
55
+	        )
56
+	VALUES  ( '1984499' , -- F_MobileNum - varchar(20)
57
+	          '0319' , -- F_ZipCode - varchar(10)
58
+	          '河北 邢台' , -- F_CityDes - varchar(50)
59
+	          '中国移动' , -- F_CardDes - varchar(50)
60
+	          '8000' , -- F_CreateUser - varchar(50)
61
+	          '2019-09-10 03:12:38' , -- F_CreateTime - datetime
62
+	          0 , -- F_IsDelete - int
63
+	          NULL , -- F_DeleteUser - varchar(50)
64
+	          NULL  -- F_DeleteTime - datetime
65
+	        )
66
+END
67
+
68
+IF  NOT EXISTS (SELECT 1 FROM dbo.T_Sys_MobileData where F_MobileNum = '1763072')
69
+BEGIN
70
+	INSERT INTO dbo.T_Sys_MobileData
71
+	        ( F_MobileNum ,
72
+	          F_ZipCode ,
73
+	          F_CityDes ,
74
+	          F_CardDes ,
75
+	          F_CreateUser ,
76
+	          F_CreateTime ,
77
+	          F_IsDelete ,
78
+	          F_DeleteUser ,
79
+	          F_DeleteTime
80
+	        )
81
+	VALUES  ( '1763072' , -- F_MobileNum - varchar(20)
82
+	          '0373' , -- F_ZipCode - varchar(10)
83
+	          '河北 新乡' , -- F_CityDes - varchar(50)
84
+	          '中国联通' , -- F_CardDes - varchar(50)
85
+	          '8000' , -- F_CreateUser - varchar(50)
86
+	          '2019-09-10 03:12:38' , -- F_CreateTime - datetime
87
+	          0 , -- F_IsDelete - int
88
+	          NULL , -- F_DeleteUser - varchar(50)
89
+	          NULL  -- F_DeleteTime - datetime
90
+	        )
91
+END
92
+

BIN
文档/操作说明书/思念呼叫中心管理系统操作手册20190118.docx