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

修改外呼任务管理,我的任务,和备份录音处理(基础数据配置备份录音地址)

lihai лет назад: 7
Родитель
Сommit
5f9c69d4b2

+ 41 - 5
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IndexController.cs

467
 
467
 
468
                         dt = new BLL.T_Call_CallRecords().GetList(n, " UserCode='" + userModel.F_UserCode + "' ", "CallRecordsId desc").Tables[0];
468
                         dt = new BLL.T_Call_CallRecords().GetList(n, " UserCode='" + userModel.F_UserCode + "' ", "CallRecordsId desc").Tables[0];
469
                         var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
469
                         var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
470
+                        var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
470
                         foreach (DataRow dr in dt.Rows)
471
                         foreach (DataRow dr in dt.Rows)
471
                         {
472
                         {
473
+                            //string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
474
+                            //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
475
+                            //{
476
+                            //    var ym = config.F_ParamValue;
477
+                            //    if (ym.Substring(ym.Length - 1) == "/")
478
+                            //    {
479
+                            //        ym = ym.Substring(0, ym.Length - 1);
480
+                            //    }
481
+                            //    dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
482
+                            //}
483
+
484
+                            //2018-05-16 lihai 判断录音是否存在
485
+                            //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
472
                             string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
486
                             string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
473
-                            if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
487
+                            if (path != "")
474
                             {
488
                             {
475
-                                var ym = config.F_ParamValue;
476
-                                if (ym.Substring(ym.Length - 1) == "/")
489
+                                //文件路径
490
+                                var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
491
+                                if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
477
                                 {
492
                                 {
478
-                                    ym = ym.Substring(0, ym.Length - 1);
493
+                                    var ym = config.F_ParamValue;
494
+                                    if (ym.Substring(ym.Length - 1) == "/")
495
+                                    {
496
+                                        ym = ym.Substring(0, ym.Length - 1);
497
+                                    }
498
+                                    dr["FilePath"] = ym + pathfile;
499
+                                }
500
+                                //判断是否录音存在,不存在用备份录音路径
501
+                                bool isfile = FileExistsHelper.RemoteFileExists(dr["FilePath"].ToString());
502
+                                if (!isfile)
503
+                                {
504
+                                    //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
505
+                                    pathfile = pathfile.Replace("Record", "luyin");
506
+                                    if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
507
+                                    {
508
+                                        var ymbak = configbak.F_ParamValue;
509
+                                        if (ymbak.Substring(ymbak.Length - 1) == "/")
510
+                                        {
511
+                                            ymbak = ymbak.Substring(0, ymbak.Length - 1);
512
+                                        }
513
+                                        dr["FilePath"] = ymbak + pathfile;
514
+                                    }
479
                                 }
515
                                 }
480
-                                dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
481
                             }
516
                             }
517
+
482
                         }
518
                         }
483
                         res = Success("成功", dt);
519
                         res = Success("成功", dt);
484
                     }
520
                     }

+ 54 - 11
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/CallPlanController.cs

80
 
80
 
81
             var recordCount = 0;
81
             var recordCount = 0;
82
             var dt = BLL.PagerBLL.GetListPager(
82
             var dt = BLL.PagerBLL.GetListPager(
83
-                             "T_CTI_Task",
83
+                             "T_CTI_Task (NOLOCK) ",
84
                              "TaskID",
84
                              "TaskID",
85
                              "*",
85
                              "*",
86
                              sql,
86
                              sql,
714
 
714
 
715
             var recordCount = 0;
715
             var recordCount = 0;
716
             var dt = BLL.PagerBLL.GetListPager(
716
             var dt = BLL.PagerBLL.GetListPager(
717
-                             " T_Call_TaskTelNum tn left join T_CTI_Task t on t.TaskID=tn.F_TaskId",
717
+                             " T_Call_TaskTelNum (NOLOCK) tn left join T_CTI_Task (NOLOCK) t on t.TaskID=tn.F_TaskId ",
718
                              " F_Id ",
718
                              " F_Id ",
719
                              field,
719
                              field,
720
                               sql,
720
                               sql,
980
             var model = taskBLL.GetModel(id);
980
             var model = taskBLL.GetModel(id);
981
             if (model == null)
981
             if (model == null)
982
                 return Error("外呼任务不存在");
982
                 return Error("外呼任务不存在");
983
-            var obj = DbHelperSQL.GetSingle($"SELECT Count(F_ID) FROM T_Call_TaskTelNum WHERE F_UserId={CurrentUser.UserData.F_UserId} and F_TaskId={model.TaskID} and  F_FPState=1 and F_HCState=0 and F_AllotStatus>0 ");
983
+            var obj = DbHelperSQL.GetSingle($"SELECT Count(F_ID) FROM T_Call_TaskTelNum (NOLOCK) WHERE F_UserId={CurrentUser.UserData.F_UserId} and F_TaskId={model.TaskID} and  F_FPState=1 and F_HCState=0 and F_AllotStatus>0 ");
984
             var sum = obj == null ? 0 : Convert.ToInt32(obj);
984
             var sum = obj == null ? 0 : Convert.ToInt32(obj);
985
             if (sum > 0)
985
             if (sum > 0)
986
                 return Error($"请先完成任务【{model.TaskName}】已获取号码的呼叫任务");
986
                 return Error($"请先完成任务【{model.TaskName}】已获取号码的呼叫任务");
988
             if (num <= 0)
988
             if (num <= 0)
989
                 return Error("已超出最多可获取数据条数,最多可获取数据为50条");
989
                 return Error("已超出最多可获取数据条数,最多可获取数据为50条");
990
             num = Math.Abs(num);
990
             num = Math.Abs(num);
991
-            var res = DbHelperSQL.ExecuteSql($"UPDATE T_Call_TaskTelNum SET F_FPState=1,F_AllotStatus=1,F_UserId={CurrentUser.UserData.F_UserId},F_Username='{CurrentUser.UserData.F_UserName}' WHERE F_Id in(SELECT TOP({(count > num ? num : count)}) F_Id FROM T_Call_TaskTelNum WHERE F_TaskId={id} and F_FPState=0 and F_AllotStatus=0)");
992
-            if (res > 0)
993
-                return Success($"获取到{res}条可用号码");
991
+
992
+            var telnum = DbHelperSQL.GetSingle($"SELECT Count(F_ID) FROM T_Call_TaskTelNum (NOLOCK) WHERE F_TaskId={model.TaskID} and F_FPState=0 and F_AllotStatus=0");
993
+            int telsum = telnum == null ? 0 : Convert.ToInt32(telnum);
994
+            if (telsum > 0)
995
+            {
996
+                //var res = DbHelperSQL.ExecuteSql($"UPDATE T_Call_TaskTelNum SET F_FPState=1,F_AllotStatus=1,F_UserId={CurrentUser.UserData.F_UserId},F_Username='{CurrentUser.UserData.F_UserName}' WHERE F_Id in(SELECT TOP({(count > num ? num : count)}) F_Id FROM T_Call_TaskTelNum WHERE F_TaskId={id} and F_FPState=0 and F_AllotStatus=0)");
997
+                var res = DbHelperSQL.ExecuteSql($"UPDATE T_Call_TaskTelNum SET F_FPState=1,F_AllotStatus=1,F_UserId={CurrentUser.UserData.F_UserId},F_Username='{CurrentUser.UserData.F_UserName}' WHERE F_Id in(SELECT TOP({(count > num ? num : count)}) F_Id FROM T_Call_TaskTelNum (NOLOCK) WHERE F_TaskId={model.TaskID} and F_FPState=0 and F_AllotStatus=0)");
998
+                if (res > 0)
999
+                    return Success($"获取到{res}条可用号码");
1000
+                return Error("未获取到可用号码");
1001
+            }
994
             return Error("未获取到可用号码");
1002
             return Error("未获取到可用号码");
995
         }
1003
         }
996
         /// <summary>
1004
         /// <summary>
1728
                        true,
1736
                        true,
1729
                        out recordCount);
1737
                        out recordCount);
1730
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
1738
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
1739
+            var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
1731
             var callResultList = callResultBLL.DataTableToList(dt);
1740
             var callResultList = callResultBLL.DataTableToList(dt);
1732
             var list = new List<AutoCallRecordDto>();
1741
             var list = new List<AutoCallRecordDto>();
1733
             callResultList.ForEach(x =>
1742
             callResultList.ForEach(x =>
1734
             {
1743
             {
1735
                 var recordPath = "";
1744
                 var recordPath = "";
1736
-                if (!string.IsNullOrWhiteSpace(x.RecordPath) && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
1745
+                //if (!string.IsNullOrWhiteSpace(x.RecordPath) && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
1746
+                //{
1747
+                //    var ym = config.F_ParamValue;
1748
+                //    if (ym.Substring(ym.Length - 1) == "/")
1749
+                //    {
1750
+                //        ym = ym.Substring(0, ym.Length - 1);
1751
+                //    }
1752
+                //    recordPath = ym + x.RecordPath.Substring(x.RecordPath.IndexOf(':') + 1).Replace('\\', '/');
1753
+                //}
1754
+
1755
+                //2018-05-16 lihai 判断录音是否存在
1756
+                //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
1757
+                string path = x.RecordPath ?? "";
1758
+                if (path != "")
1737
                 {
1759
                 {
1738
-                    var ym = config.F_ParamValue;
1739
-                    if (ym.Substring(ym.Length - 1) == "/")
1760
+                    //文件路径
1761
+                    var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
1762
+                    if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
1763
+                    {
1764
+                        var ym = config.F_ParamValue;
1765
+                        if (ym.Substring(ym.Length - 1) == "/")
1766
+                        {
1767
+                            ym = ym.Substring(0, ym.Length - 1);
1768
+                        }
1769
+                        recordPath = ym + pathfile;
1770
+                    }
1771
+                    //判断是否录音存在,不存在用备份录音路径
1772
+                    bool isfile = FileExistsHelper.RemoteFileExists(recordPath);
1773
+                    if (!isfile)
1740
                     {
1774
                     {
1741
-                        ym = ym.Substring(0, ym.Length - 1);
1775
+                        //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
1776
+                        pathfile = pathfile.Replace("Record", "luyin");
1777
+                        if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
1778
+                        {
1779
+                            var ymbak = configbak.F_ParamValue;
1780
+                            if (ymbak.Substring(ymbak.Length - 1) == "/")
1781
+                            {
1782
+                                ymbak = ymbak.Substring(0, ymbak.Length - 1);
1783
+                            }
1784
+                            recordPath = ymbak + pathfile;
1785
+                        }
1742
                     }
1786
                     }
1743
-                    recordPath = ym + x.RecordPath.Substring(x.RecordPath.IndexOf(':') + 1).Replace('\\', '/');
1744
                 }
1787
                 }
1745
 
1788
 
1746
                 list.Add(new AutoCallRecordDto
1789
                 list.Add(new AutoCallRecordDto

+ 80 - 10
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/quality/QCManageController.cs

133
 
133
 
134
                 string path = string.IsNullOrWhiteSpace(d.FilePath) ? "" : d.FilePath;
134
                 string path = string.IsNullOrWhiteSpace(d.FilePath) ? "" : d.FilePath;
135
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
135
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
136
-                if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
136
+                var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
137
+                //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
138
+                //{
139
+                //    var ym = config.F_ParamValue;
140
+                //    if (ym.Substring(ym.Length - 1) == "/")
141
+                //    {
142
+                //        ym = ym.Substring(0, ym.Length - 1);
143
+                //    }
144
+                //    d.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
145
+                //}
146
+
147
+                //2018-05-16 lihai 判断录音是否存在
148
+                //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
149
+                if (path != "")
137
                 {
150
                 {
138
-                    var ym = config.F_ParamValue;
139
-                    if (ym.Substring(ym.Length - 1) == "/")
151
+                    //文件路径
152
+                    var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
153
+                    if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
140
                     {
154
                     {
141
-                        ym = ym.Substring(0, ym.Length - 1);
155
+                        var ym = config.F_ParamValue;
156
+                        if (ym.Substring(ym.Length - 1) == "/")
157
+                        {
158
+                            ym = ym.Substring(0, ym.Length - 1);
159
+                        }
160
+                        d.FilePath = ym + pathfile;
161
+                    }
162
+                    //判断是否录音存在,不存在用备份录音路径
163
+                    bool isfile = FileExistsHelper.RemoteFileExists(d.FilePath);
164
+                    if (!isfile)
165
+                    {
166
+                        //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
167
+                        pathfile = pathfile.Replace("Record", "luyin");
168
+                        if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
169
+                        {
170
+                            var ymbak = configbak.F_ParamValue;
171
+                            if (ymbak.Substring(ymbak.Length - 1) == "/")
172
+                            {
173
+                                ymbak = ymbak.Substring(0, ymbak.Length - 1);
174
+                            }
175
+                            d.FilePath = ymbak + pathfile;
176
+                        }
142
                     }
177
                     }
143
-                    d.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
144
                 }
178
                 }
179
+
145
                 var user = userList.SingleOrDefault(x => x.F_UserCode == d.UserCode);
180
                 var user = userList.SingleOrDefault(x => x.F_UserCode == d.UserCode);
146
                 var dept = deptList.SingleOrDefault(x => x.F_DeptId == (user?.F_DeptId ?? 0));
181
                 var dept = deptList.SingleOrDefault(x => x.F_DeptId == (user?.F_DeptId ?? 0));
147
                 var deptParent = deptList.SingleOrDefault(x => x.F_DeptId == (dept?.F_ParentId ?? 0));
182
                 var deptParent = deptList.SingleOrDefault(x => x.F_DeptId == (dept?.F_ParentId ?? 0));
298
                 int dc = ldList.Where(l => l.F_CallRecordsID == d.CallRecordsId && l.F_OptID == int.Parse(optid) && l.F_IsDownload == true).Count();
333
                 int dc = ldList.Where(l => l.F_CallRecordsID == d.CallRecordsId && l.F_OptID == int.Parse(optid) && l.F_IsDownload == true).Count();
299
                 string path = string.IsNullOrWhiteSpace(d.FilePath) ? "" : d.FilePath;
334
                 string path = string.IsNullOrWhiteSpace(d.FilePath) ? "" : d.FilePath;
300
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
335
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
301
-                if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
336
+                var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
337
+                //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
338
+                //{
339
+                //    var ym = config.F_ParamValue;
340
+                //    if (ym.Substring(ym.Length - 1) == "/")
341
+                //    {
342
+                //        ym = ym.Substring(0, ym.Length - 1);
343
+                //    }
344
+                //    d.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
345
+                //}
346
+
347
+                //2018-05-16 lihai 判断录音是否存在
348
+                //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
349
+                if (path != "")
302
                 {
350
                 {
303
-                    var ym = config.F_ParamValue;
304
-                    if (ym.Substring(ym.Length - 1) == "/")
351
+                    //文件路径
352
+                    var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
353
+                    if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
305
                     {
354
                     {
306
-                        ym = ym.Substring(0, ym.Length - 1);
355
+                        var ym = config.F_ParamValue;
356
+                        if (ym.Substring(ym.Length - 1) == "/")
357
+                        {
358
+                            ym = ym.Substring(0, ym.Length - 1);
359
+                        }
360
+                        d.FilePath = ym + pathfile;
361
+                    }
362
+                    //判断是否录音存在,不存在用备份录音路径
363
+                    bool isfile = FileExistsHelper.RemoteFileExists(d.FilePath);
364
+                    if (!isfile)
365
+                    {
366
+                        //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
367
+                        pathfile = pathfile.Replace("Record", "luyin");
368
+                        if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
369
+                        {
370
+                            var ymbak = configbak.F_ParamValue;
371
+                            if (ymbak.Substring(ymbak.Length - 1) == "/")
372
+                            {
373
+                                ymbak = ymbak.Substring(0, ymbak.Length - 1);
374
+                            }
375
+                            d.FilePath = ymbak + pathfile;
376
+                        }
307
                     }
377
                     }
308
-                    d.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
309
                 }
378
                 }
379
+
310
                 var user = userList.SingleOrDefault(x => x.F_UserCode == d.UserCode);
380
                 var user = userList.SingleOrDefault(x => x.F_UserCode == d.UserCode);
311
                 var dept = deptList.SingleOrDefault(x => x.F_DeptId == user.F_DeptId);
381
                 var dept = deptList.SingleOrDefault(x => x.F_DeptId == user.F_DeptId);
312
                 var deptParent = deptList.SingleOrDefault(x => x.F_DeptId == dept.F_ParentId);
382
                 var deptParent = deptList.SingleOrDefault(x => x.F_DeptId == dept.F_ParentId);

+ 39 - 5
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

332
                     true,
332
                     true,
333
                     out recordCount);
333
                     out recordCount);
334
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
334
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
335
+                var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //2018-05-16 lihai 备份录音服务器地址
335
                 foreach (DataRow dr in dt.Rows)
336
                 foreach (DataRow dr in dt.Rows)
336
                 {
337
                 {
337
                     string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
338
                     string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
338
-                    if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
339
+                    //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
340
+                    //{
341
+                    //    var ym = config.F_ParamValue;
342
+                    //    if (ym.Substring(ym.Length - 1) == "/")
343
+                    //    {
344
+                    //        ym = ym.Substring(0, ym.Length - 1);
345
+                    //    }
346
+                    //    dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
347
+                    //}
348
+
349
+                    //2018-05-16 lihai 判断录音是否存在
350
+                    //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
351
+                    if (path != "")
339
                     {
352
                     {
340
-                        var ym = config.F_ParamValue;
341
-                        if (ym.Substring(ym.Length - 1) == "/")
353
+                        //文件路径
354
+                        var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
355
+                        if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
342
                         {
356
                         {
343
-                            ym = ym.Substring(0, ym.Length - 1);
357
+                            var ym = config.F_ParamValue;
358
+                            if (ym.Substring(ym.Length - 1) == "/")
359
+                            {
360
+                                ym = ym.Substring(0, ym.Length - 1);
361
+                            }
362
+                            dr["FilePath"] = ym + pathfile;
363
+                        }
364
+                        //判断是否录音存在,不存在用备份录音路径
365
+                        bool isfile = FileExistsHelper.RemoteFileExists(dr["FilePath"].ToString());
366
+                        if (!isfile)
367
+                        {
368
+                            //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
369
+                            pathfile = pathfile.Replace("Record", "luyin");
370
+                            if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
371
+                            {
372
+                                var ymbak = configbak.F_ParamValue;
373
+                                if (ymbak.Substring(ymbak.Length - 1) == "/")
374
+                                {
375
+                                    ymbak = ymbak.Substring(0, ymbak.Length - 1);
376
+                                }
377
+                                dr["FilePath"] = ymbak + pathfile;
378
+                            }
344
                         }
379
                         }
345
-                        dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
346
                     }
380
                     }
347
                 }
381
                 }
348
 
382
 

+ 81 - 11
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

126
                 }
126
                 }
127
                 int recordCount = 0;
127
                 int recordCount = 0;
128
                 dt = BLL.PagerBLL.GetListPager(
128
                 dt = BLL.PagerBLL.GetListPager(
129
-                    "T_Call_CallRecords",
129
+                    "T_Call_CallRecords (NOLOCK) ",
130
                     "CallRecordsId",
130
                     "CallRecordsId",
131
                     "*",
131
                     "*",
132
                     sql,
132
                     sql,
137
                     out recordCount);
137
                     out recordCount);
138
                 var callRecordList = callRecordBLL.DataTableToList(dt);
138
                 var callRecordList = callRecordBLL.DataTableToList(dt);
139
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
139
                 var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
140
+                var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
140
                 var users = new BLL.T_Sys_UserAccount().GetModelList("");
141
                 var users = new BLL.T_Sys_UserAccount().GetModelList("");
141
                 var deptList = deptBLL.DataTableToListForLevel(DbHelperSQL.Query("select F_DeptId,F_ParentId,F_DeptName,F_DeptCode,F_Layer,0 lvl FROM T_Sys_Department ").Tables[0]);
142
                 var deptList = deptBLL.DataTableToListForLevel(DbHelperSQL.Query("select F_DeptId,F_ParentId,F_DeptName,F_DeptCode,F_Layer,0 lvl FROM T_Sys_Department ").Tables[0]);
142
                 var resList = new List<CallRecordDto>();
143
                 var resList = new List<CallRecordDto>();
143
                 foreach (var item in callRecordList)
144
                 foreach (var item in callRecordList)
144
                 {
145
                 {
145
                     string path = item.FilePath ?? "";
146
                     string path = item.FilePath ?? "";
146
-                    if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
147
+                    //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
148
+                    //{
149
+                    //    var ym = config.F_ParamValue;
150
+                    //    if (ym.Substring(ym.Length - 1) == "/")
151
+                    //    {
152
+                    //        ym = ym.Substring(0, ym.Length - 1);
153
+                    //    }
154
+                    //    item.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
155
+                    //}
156
+
157
+                    //2018-05-10 lihai 判断录音是否存在
158
+                    //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
159
+                    if (path != "")
147
                     {
160
                     {
148
-                        var ym = config.F_ParamValue;
149
-                        if (ym.Substring(ym.Length - 1) == "/")
161
+                        //文件路径
162
+                        var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
163
+                        if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
150
                         {
164
                         {
151
-                            ym = ym.Substring(0, ym.Length - 1);
165
+                            var ym = config.F_ParamValue;
166
+                            if (ym.Substring(ym.Length - 1) == "/")
167
+                            {
168
+                                ym = ym.Substring(0, ym.Length - 1);
169
+                            }
170
+                            item.FilePath = ym + pathfile;
171
+                        }
172
+                        //判断是否录音存在,不存在用备份录音路径
173
+                        bool isfile = FileExistsHelper.RemoteFileExists(item.FilePath);
174
+                        if (!isfile)
175
+                        {
176
+                            //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
177
+                            pathfile = pathfile.Replace("Record", "luyin");
178
+                            if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
179
+                            {
180
+                                var ymbak = configbak.F_ParamValue;
181
+                                if (ymbak.Substring(ymbak.Length - 1) == "/")
182
+                                {
183
+                                    ymbak = ymbak.Substring(0, ymbak.Length - 1);
184
+                                }
185
+                                item.FilePath = ymbak + pathfile;
186
+                            }
152
                         }
187
                         }
153
-                        item.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
154
                     }
188
                     }
189
+
155
                     string ucode = item.UserCode ?? "";
190
                     string ucode = item.UserCode ?? "";
156
                     string uname = item.UserName ?? "";
191
                     string uname = item.UserName ?? "";
157
                     Model.T_Sys_UserAccount uu = null;
192
                     Model.T_Sys_UserAccount uu = null;
404
                 return Error("通话记录不存在");
439
                 return Error("通话记录不存在");
405
             var filePath = "";
440
             var filePath = "";
406
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
441
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
442
+            var configbak = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPathBak' ").FirstOrDefault(); //备份录音服务器地址
407
             string path = callRecord.FilePath ?? "";
443
             string path = callRecord.FilePath ?? "";
408
-            if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
444
+            //if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
445
+            //{
446
+            //    var ym = config.F_ParamValue;
447
+            //    if (ym.Substring(ym.Length - 1) == "/")
448
+            //    {
449
+            //        ym = ym.Substring(0, ym.Length - 1);
450
+            //    }
451
+            //    filePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
452
+            //}
453
+
454
+            //2018-05-10 lihai 判断录音是否存在
455
+            //特别备注说明:所有备份录音都放到luyin文件夹下,所以FilePath录音目前需要处理
456
+            if (path != "")
409
             {
457
             {
410
-                var ym = config.F_ParamValue;
411
-                if (ym.Substring(ym.Length - 1) == "/")
458
+                //文件路径
459
+                var pathfile = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
460
+                if (config != null && !string.IsNullOrEmpty(config.F_ParamValue))
412
                 {
461
                 {
413
-                    ym = ym.Substring(0, ym.Length - 1);
462
+                    var ym = config.F_ParamValue;
463
+                    if (ym.Substring(ym.Length - 1) == "/")
464
+                    {
465
+                        ym = ym.Substring(0, ym.Length - 1);
466
+                    }
467
+                    filePath = ym + pathfile;
468
+                }
469
+                //判断是否录音存在,不存在用备份录音路径
470
+                bool isfile = FileExistsHelper.RemoteFileExists(filePath);
471
+                if (!isfile)
472
+                {
473
+                    //处理备份录音路径,record,和luyin文件都要过滤掉,配置文件加上ip+luyin
474
+                    pathfile = pathfile.Replace("Record", "luyin");
475
+                    if (configbak != null && !string.IsNullOrEmpty(configbak.F_ParamValue))
476
+                    {
477
+                        var ymbak = configbak.F_ParamValue;
478
+                        if (ymbak.Substring(ymbak.Length - 1) == "/")
479
+                        {
480
+                            ymbak = ymbak.Substring(0, ymbak.Length - 1);
481
+                        }
482
+                        filePath = ymbak + pathfile;
483
+                    }
414
                 }
484
                 }
415
-                filePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
416
             }
485
             }
417
 
486
 
418
 
487
 
426
             return File(myResponseStream, "audio/wav", $"{callRecord.CallNumber}-{callRecord.BeginTime?.ToString("yyyyMMdd") ?? DateTime.Now.ToString("yyyyMMdd")}-{callRecord.UserCode}.wav");
495
             return File(myResponseStream, "audio/wav", $"{callRecord.CallNumber}-{callRecord.BeginTime?.ToString("yyyyMMdd") ?? DateTime.Now.ToString("yyyyMMdd")}-{callRecord.UserCode}.wav");
427
 
496
 
428
         }
497
         }
498
+        
429
     }
499
     }
430
 }
500
 }

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Web.config

18
   </appSettings>
18
   </appSettings>
19
   <connectionStrings>
19
   <connectionStrings>
20
     <!--<add name="ConnectionString" connectionString="Data Source=192.168.4.18;User ID=sa;pwd=800100;Initial Catalog=CallCenter_ZYKJ_Backup20180125;"/>-->
20
     <!--<add name="ConnectionString" connectionString="Data Source=192.168.4.18;User ID=sa;pwd=800100;Initial Catalog=CallCenter_ZYKJ_Backup20180125;"/>-->
21
-    <add name="ConnectionString" connectionString="Data Source=39.153.161.180;User ID=sa;pwd=hykj800100;Initial Catalog=ZYKJ_Backup_20180226;" />
21
+    <add name="ConnectionString" connectionString="Data Source=39.153.161.180;User ID=sa;pwd=hykj800100;Initial Catalog=CallCenter-ZYKJ;" />
22
   </connectionStrings>
22
   </connectionStrings>
23
   <system.web>
23
   <system.web>
24
     <compilation debug="true" targetFramework="4.5"/>
24
     <compilation debug="true" targetFramework="4.5"/>

+ 1 - 2
CallCenterCommon/CallCenter.QuartzService/CallCenter.QuartzService.csproj

50
       <HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
50
       <HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
51
       <Private>True</Private>
51
       <Private>True</Private>
52
     </Reference>
52
     </Reference>
53
-    <Reference Include="Quartz, Version=2.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
53
+    <Reference Include="Quartz">
54
       <HintPath>..\..\packages\Quartz.2.5.0\lib\net40\Quartz.dll</HintPath>
54
       <HintPath>..\..\packages\Quartz.2.5.0\lib\net40\Quartz.dll</HintPath>
55
-      <Private>True</Private>
56
     </Reference>
55
     </Reference>
57
     <Reference Include="System" />
56
     <Reference Include="System" />
58
     <Reference Include="System.Configuration" />
57
     <Reference Include="System.Configuration" />

+ 1 - 0
CallCenterCommon/CallCenter.Utility/CallCenter.Utility.csproj

74
     <Compile Include="DirFileHelper.cs" />
74
     <Compile Include="DirFileHelper.cs" />
75
     <Compile Include="EncryptHelper.cs" />
75
     <Compile Include="EncryptHelper.cs" />
76
     <Compile Include="Extend\ExtLinq.cs" />
76
     <Compile Include="Extend\ExtLinq.cs" />
77
+    <Compile Include="FileExistsHelper.cs" />
77
     <Compile Include="FileUp.cs" />
78
     <Compile Include="FileUp.cs" />
78
     <Compile Include="Linq\PredicateExtensionses.cs" />
79
     <Compile Include="Linq\PredicateExtensionses.cs" />
79
     <Compile Include="SaltAndHashHelper.cs" />
80
     <Compile Include="SaltAndHashHelper.cs" />

+ 52 - 0
CallCenterCommon/CallCenter.Utility/FileExistsHelper.cs

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Net;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace CallCenter.Utility
9
+{
10
+    public class FileExistsHelper
11
+    {
12
+        #region 判断远程文件是否存在
13
+        /// <summary>
14
+        /// 判断远程文件是否存在
15
+        /// </summary>
16
+        /// <param name="fileUrl"></param>
17
+        /// <returns></returns>
18
+        public static bool RemoteFileExists(string fileUrl)
19
+        {
20
+            HttpWebRequest re = null;
21
+            HttpWebResponse res = null;
22
+            try
23
+            {
24
+                re = (HttpWebRequest)WebRequest.Create(fileUrl);
25
+                res = (HttpWebResponse)re.GetResponse();
26
+                if (res.ContentLength != 0)
27
+                {
28
+                    //MessageBox.Show("文件存在");
29
+                    return true;
30
+                }
31
+            }
32
+            catch (Exception)
33
+            {
34
+                //MessageBox.Show("无此文件");
35
+                return false;
36
+            }
37
+            finally
38
+            {
39
+                if (re != null)
40
+                {
41
+                    re.Abort();//销毁关闭连接
42
+                }
43
+                if (res != null)
44
+                {
45
+                    res.Close();//销毁关闭响应
46
+                }
47
+            }
48
+            return false;
49
+        }
50
+        #endregion
51
+    }
52
+}