Преглед на файлове

外呼任务代码调整

yuqian преди 8 години
родител
ревизия
1d711e807c

+ 4 - 1
CallCenterApi/CallCenterApi.BLL/CallResult.cs

31
             }
31
             }
32
             return modelList;
32
             return modelList;
33
         }
33
         }
34
-
34
+        public Model.CallResult GetModel(string callId)
35
+        {
36
+            return dal.GetModel(callId);
37
+        }
35
 
38
 
36
         #endregion  BasicMethod
39
         #endregion  BasicMethod
37
         #region  ExtensionMethod
40
         #region  ExtensionMethod

+ 4 - 0
CallCenterApi/CallCenterApi.BLL/T_Call_TaskTelNum.cs

130
         {
130
         {
131
             return dal.GetList(strWhere);
131
             return dal.GetList(strWhere);
132
         }
132
         }
133
+        public DataSet GetPhoneList(string strWhere)
134
+        {
135
+            return dal.GetPhoneList(strWhere);
136
+        }
133
         /// <summary>
137
         /// <summary>
134
         /// 获得前几行数据
138
         /// 获得前几行数据
135
         /// </summary>
139
         /// </summary>

+ 21 - 4
CallCenterApi/CallCenterApi.DAL/CallRecords.cs

2
 using System;
2
 using System;
3
 using System.Collections.Generic;
3
 using System.Collections.Generic;
4
 using System.Data;
4
 using System.Data;
5
+using System.Data.SqlClient;
5
 using System.Linq;
6
 using System.Linq;
6
 using System.Text;
7
 using System.Text;
7
 
8
 
23
                 model.Id = row["Id"] == DBNull.Value ? 0 : Convert.ToInt32(row["Id"]);
24
                 model.Id = row["Id"] == DBNull.Value ? 0 : Convert.ToInt32(row["Id"]);
24
                 model.TaskId = row["itemid"] == DBNull.Value ? 0 : Convert.ToInt32(row["itemid"]);
25
                 model.TaskId = row["itemid"] == DBNull.Value ? 0 : Convert.ToInt32(row["itemid"]);
25
                 model.CallNumber = row["Callee"] == DBNull.Value ? "" : row["Callee"].ToString();
26
                 model.CallNumber = row["Callee"] == DBNull.Value ? "" : row["Callee"].ToString();
26
-                model.Usercode = row["AgentId"] == DBNull.Value ? "" : row["AgentId"].ToString();
27
+                model.Usercode = row["agentid"] == DBNull.Value ? "" : row["agentid"].ToString();
27
                 model.StartDate = row["StartDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["StartDate"].ToString());
28
                 model.StartDate = row["StartDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["StartDate"].ToString());
28
                 model.GetInAgentDate = row["GetInAgentDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["GetInAgentDate"].ToString());
29
                 model.GetInAgentDate = row["GetInAgentDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["GetInAgentDate"].ToString());
29
                 model.EndDate = row["EndDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["EndDate"].ToString());
30
                 model.EndDate = row["EndDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["EndDate"].ToString());
30
                 model.RecordPath = row["RecordPath"] == DBNull.Value ? "" : row["RecordPath"].ToString();
31
                 model.RecordPath = row["RecordPath"] == DBNull.Value ? "" : row["RecordPath"].ToString();
31
                 model.Username = row["Username"] == DBNull.Value ? "" : row["Username"].ToString();
32
                 model.Username = row["Username"] == DBNull.Value ? "" : row["Username"].ToString();
32
-                model.State = row["State"] == DBNull.Value ? "" : row["State"].ToString();
33
-                model.TalkTime = row["TalkTime"] == DBNull.Value ? 0 : Convert.ToInt32(row["TalkTime"]);
33
+                model.State = row["calltype"] == DBNull.Value ? "" : row["calltype"].ToString();
34
+                model.TalkTime = row["talktime"] == DBNull.Value ? 0 : Convert.ToInt32(row["talktime"]);
35
+            }
36
+            return model;
37
+        }
38
+        public Model.CallResult GetModel(string callId)
39
+        {
40
+            string sql = "select itemid,RecordPath from CallResult where id=@callid";
41
+            var ds = DbHelperSQL.Query(sql, new SqlParameter[] {
42
+                new SqlParameter("@callid",callId)
43
+            });
44
+            var model = new Model.CallResult();
45
+            if (ds.Tables.Count > 0)
46
+            {
47
+                if (ds.Tables[0].Rows.Count > 0)
48
+                {
49
+                    model.TaskId = ds.Tables[0].Rows[0]["itemid"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["itemid"]);
50
+                    model.RecordPath = ds.Tables[0].Rows[0]["RecordPath"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["RecordPath"].ToString();
51
+                }
34
             }
52
             }
35
             return model;
53
             return model;
36
         }
54
         }
37
-
38
         #endregion  BasicMethod
55
         #endregion  BasicMethod
39
         #region  ExtensionMethod
56
         #region  ExtensionMethod
40
 
57
 

+ 27 - 7
CallCenterApi/CallCenterApi.DAL/T_CTI_TaskDaily.cs

16
         public DataSet GetList(string strWhere)
16
         public DataSet GetList(string strWhere)
17
         {
17
         {
18
             StringBuilder strSql = new StringBuilder();
18
             StringBuilder strSql = new StringBuilder();
19
-            strSql.Append("select [Date],TaskId,AllCount,CalledCount,connectedCount,ConnectedAgentCount,UpdateTime ");
19
+            strSql.Append("select [Date],TaskId,TaskName,AllCount,CalledCount,connectedCount,ConnectedAgentCount ");
20
             strSql.Append(" FROM T_CTI_TaskDaily ");
20
             strSql.Append(" FROM T_CTI_TaskDaily ");
21
             if (strWhere.Trim() != "")
21
             if (strWhere.Trim() != "")
22
             {
22
             {
33
         public DataSet GetList()
33
         public DataSet GetList()
34
         {
34
         {
35
             StringBuilder strSql = new StringBuilder();
35
             StringBuilder strSql = new StringBuilder();
36
-            strSql.Append("SELECT Date,Sum(AllCount)as AllCount,Sum(CalledCount)as CalledCount,sum(connectedcount)as connectedcount, sum(connectedagentcount)as connectedagentcount FROM T_CTI_TaskDaily group by Date");
36
+            strSql.Append("SELECT Date,Sum(CalledCount)as CalledCount,sum(connectedcount)as connectedcount, sum(connectedagentcount)as connectedagentcount FROM T_CTI_TaskDaily group by Date");
37
             return DbHelperSQL.Query(strSql.ToString());
37
             return DbHelperSQL.Query(strSql.ToString());
38
         }
38
         }
39
         /// <summary>
39
         /// <summary>
49
                 {
49
                 {
50
                     model.TaskId = Convert.ToInt32(row["TaskId"]);
50
                     model.TaskId = Convert.ToInt32(row["TaskId"]);
51
                 }
51
                 }
52
-                model.AllCount = Convert.ToInt32(row["AllCount"]);
53
-                model.CalledCount = Convert.ToInt32(row["CalledCount"]);
54
-                model.ConnectedCount = Convert.ToInt32(row["ConnectedCount"]);
55
-                model.ConnectedAgentCount = Convert.ToInt32(row["ConnectedAgentCount"]);
56
-                model.UpdateTime = Convert.ToDateTime(row["UpdateTime"]);
52
+                if (columns["TaskName"] != null)
53
+                {
54
+                    model.TaskName = row["TaskName"].ToString();
55
+                }
56
+                if (columns["AllCount"] != null)
57
+                {
58
+                    model.AllCount = row["AllCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["AllCount"]);
59
+                }
60
+                if (columns["CalledCount"] != null)
61
+                {
62
+                    model.CalledCount = row["CalledCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["CalledCount"]);
63
+                }
64
+                if (columns["ConnectedCount"] != null)
65
+                {
66
+                    model.ConnectedCount = row["ConnectedCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["ConnectedCount"]);
67
+                }
68
+                if (columns["ConnectedAgentCount"] != null)
69
+                {
70
+                    model.ConnectedAgentCount = row["ConnectedAgentCount"] == DBNull.Value ? 0 : Convert.ToInt32(row["ConnectedAgentCount"]);
71
+                }
72
+
73
+
74
+
75
+
76
+                //model.UpdateTime = Convert.ToDateTime(row["UpdateTime"]);
57
             }
77
             }
58
             return model;
78
             return model;
59
         }
79
         }

+ 11 - 1
CallCenterApi/CallCenterApi.DAL/T_Call_TaskTelNum.cs

842
             strSql.Append(" order by " + filedOrder);
842
             strSql.Append(" order by " + filedOrder);
843
             return DbHelperSQL.Query(strSql.ToString());
843
             return DbHelperSQL.Query(strSql.ToString());
844
         }
844
         }
845
-
845
+        public DataSet GetPhoneList(string strWhere)
846
+        {
847
+            StringBuilder strSql = new StringBuilder();
848
+            strSql.Append("select F_Phone ");
849
+            strSql.Append(" FROM T_Call_TaskTelNum ");
850
+            if (strWhere.Trim() != "")
851
+            {
852
+                strSql.Append(" where " + strWhere);
853
+            }
854
+            return DbHelperSQL.Query(strSql.ToString());
855
+        }
846
         /// <summary>
856
         /// <summary>
847
         /// 获取记录总数
857
         /// 获取记录总数
848
         /// </summary>
858
         /// </summary>

+ 1 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/CallCenterApi.Interface.csproj

278
     </Compile>
278
     </Compile>
279
     <Compile Include="Models\Common\FormsPrincipal.cs" />
279
     <Compile Include="Models\Common\FormsPrincipal.cs" />
280
     <Compile Include="Models\Common\ListBase.cs" />
280
     <Compile Include="Models\Common\ListBase.cs" />
281
+    <Compile Include="Models\Dto\AutoCallResordDto.cs" />
281
     <Compile Include="Models\Dto\CallPlan.cs" />
282
     <Compile Include="Models\Dto\CallPlan.cs" />
282
     <Compile Include="Models\Dto\CategoryDto.cs" />
283
     <Compile Include="Models\Dto\CategoryDto.cs" />
283
     <Compile Include="Models\Dto\ModuleInfoDto.cs" />
284
     <Compile Include="Models\Dto\ModuleInfoDto.cs" />

+ 52 - 38
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SeatGroupController.cs

21
         public ActionResult GetList()
21
         public ActionResult GetList()
22
         {
22
         {
23
             ActionResult res = NoToken("未知错误,请重新登录");
23
             ActionResult res = NoToken("未知错误,请重新登录");
24
-            
25
-                DataTable dt = new DataTable();
26
-                string strpageindex = RequestString.GetQueryString("page");
27
-                int pageindex = 1;
28
-                string strpagesize = RequestString.GetQueryString("pagesize");
29
-                int pagesize = 10;
30
-
31
-                string sql = "";
32
-                if (strpageindex.Trim() != "")
33
-                {
34
-                    pageindex = Convert.ToInt32(strpageindex);
35
-                }
36
-
37
-                if (strpagesize.Trim() != "")
38
-                {
39
-                    pagesize = Convert.ToInt32(strpagesize);
40
-                }
41
-                int recordCount = 0;
42
-                dt = BLL.PagerBLL.GetListPager(
43
-                    "T_Sys_SeatGroup",
44
-                    "F_ZXZID",
45
-                    "*",
46
-                    sql,
47
-                    "ORDER BY F_ZXZID desc",
48
-                    pagesize,
49
-                    pageindex,
50
-                    true,
51
-                    out recordCount);
52
-
53
-                var obj = new
54
-                {
55
-                    rows = dt,
56
-                    total = recordCount
57
-                };
58
-
59
-                res = Content(obj.ToJson());
60
-         
24
+
25
+            DataTable dt = new DataTable();
26
+            string strpageindex = RequestString.GetQueryString("page");
27
+            int pageindex = 1;
28
+            string strpagesize = RequestString.GetQueryString("pagesize");
29
+            int pagesize = 10;
30
+
31
+            string sql = "";
32
+            if (strpageindex.Trim() != "")
33
+            {
34
+                pageindex = Convert.ToInt32(strpageindex);
35
+            }
36
+
37
+            if (strpagesize.Trim() != "")
38
+            {
39
+                pagesize = Convert.ToInt32(strpagesize);
40
+            }
41
+            int recordCount = 0;
42
+            dt = BLL.PagerBLL.GetListPager(
43
+                "T_Sys_SeatGroup",
44
+                "F_ZXZID",
45
+                "*",
46
+                sql,
47
+                "ORDER BY F_ZXZID desc",
48
+                pagesize,
49
+                pageindex,
50
+                true,
51
+                out recordCount);
52
+
53
+            var obj = new
54
+            {
55
+                rows = dt,
56
+                total = recordCount
57
+            };
58
+
59
+            res = Content(obj.ToJson());
60
+
61
             return res;
61
             return res;
62
         }
62
         }
63
 
63
 
64
+        /// <summary>
65
+        /// 获取坐席组列表
66
+        /// </summary>
67
+        /// <returns></returns>
68
+        public ActionResult GetListDrop()
69
+        {
70
+            var list = seatBLL.DataTableToList(seatBLL.GetAllList().Tables[0]);
71
+            return Success("获取成功", list.Select(x => new
72
+            {
73
+                id = x.F_ZXZID,
74
+                name = x.F_ZXZName
75
+            }));
76
+        }
77
+
64
         //获取坐席组列表
78
         //获取坐席组列表
65
         public ActionResult GetSeatList()
79
         public ActionResult GetSeatList()
66
         {
80
         {
194
             return NoToken("未知错误,请重新登录");
208
             return NoToken("未知错误,请重新登录");
195
         }
209
         }
196
 
210
 
197
-        
211
+
198
     }
212
     }
199
 }
213
 }

+ 292 - 81
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/CallPlanController.cs

26
         private BLL.CallResult callResultBLL = new BLL.CallResult();
26
         private BLL.CallResult callResultBLL = new BLL.CallResult();
27
         private BLL.T_CTI_TaskDaily taskDailyBLL = new BLL.T_CTI_TaskDaily();
27
         private BLL.T_CTI_TaskDaily taskDailyBLL = new BLL.T_CTI_TaskDaily();
28
         private BLL.T_CTI_TaskPhonePart taskPhonePartBLL = new BLL.T_CTI_TaskPhonePart();
28
         private BLL.T_CTI_TaskPhonePart taskPhonePartBLL = new BLL.T_CTI_TaskPhonePart();
29
-
29
+        private BLL.T_Sys_SeatGroup seatGroupBLL = new BLL.T_Sys_SeatGroup();
30
+        private BLL.T_Sys_SystemConfig systemConfigBLL = new BLL.T_Sys_SystemConfig();
30
 
31
 
31
         #region 外呼任务
32
         #region 外呼任务
32
         /// <summary>
33
         /// <summary>
60
             var list = new List<CallPlanDto>();
61
             var list = new List<CallPlanDto>();
61
 
62
 
62
             //查询坐席组
63
             //查询坐席组
63
-            var agentGroupList = dictValueBLL.DataTableToList(dictValueBLL.GetList(" F_DictionaryFlag='ZXZ'").Tables[0]);
64
+            var agentGroupList = seatGroupBLL.DataTableToList(seatGroupBLL.GetList("").Tables[0]);
64
             //查询坐席
65
             //查询坐席
65
             var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
66
             var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
66
 
67
 
67
             foreach (var model in modelList)
68
             foreach (var model in modelList)
68
             {
69
             {
70
+                //计算数据
69
                 string calledRate = "0";
71
                 string calledRate = "0";
70
                 var allcount = model.y_HMCount ?? 0;
72
                 var allcount = model.y_HMCount ?? 0;
71
                 float calledcount = model.y_HCCount ?? 0;
73
                 float calledcount = model.y_HCCount ?? 0;
72
-                calledRate = allcount == 0 ? "" : calledcount / allcount * 100 + "%";
74
+                calledRate = allcount == 0 ? "" : (calledcount / allcount * 100).ToString("f2") + "%";
73
 
75
 
74
                 string connectedRate = "0";
76
                 string connectedRate = "0";
75
                 float connected = model.y_YJCount ?? 0;
77
                 float connected = model.y_YJCount ?? 0;
76
-                connectedRate = calledcount == 0 ? "0" : connected / calledcount * 100 + "%";
78
+                connectedRate = calledcount == 0 ? "0" : (connected / calledcount * 100).ToString("f2") + "%";
77
 
79
 
78
-                var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 ").Tables[0];
80
+                var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0  and F_TaskId=" + model.TaskID).Tables[0];
79
                 float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
81
                 float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
80
                 var connectedAgentRate = "0";
82
                 var connectedAgentRate = "0";
81
-                connectedAgentRate = connected == 0 ? "0" : connectedAgentCount / connected * 100 + "%";
83
+                connectedAgentRate = connected == 0 ? "0" : (connectedAgentCount / connected * 100).ToString("f2") + "%";
82
 
84
 
83
-                var agentGroup = agentGroupList.SingleOrDefault(x => x.F_DictionaryValueId == model.AgentGroupId);
84
-                var agentCount = agentList.Where(x => x.F_GroupId == (agentGroup?.F_DictionaryValueId ?? 0)).Count();
85
+                var agentGroupStr = model.AgentGroupId == -999 ? "不转坐席" : "";
86
+                var agentGroup = agentGroupList.SingleOrDefault(x => x.F_ZXZID == model.AgentGroupId);
87
+                var agentCount = agentList.Where(x => x.F_SeartGroupID == (agentGroup?.F_ZXZID ?? 0)).Count();
85
                 list.Add(new CallPlanDto
88
                 list.Add(new CallPlanDto
86
                 {
89
                 {
87
                     id = model.TaskID,
90
                     id = model.TaskID,
99
                     endtime1 = model.EndTime1.ToString("HH:mm:ss"),
102
                     endtime1 = model.EndTime1.ToString("HH:mm:ss"),
100
                     starttime2 = model.StartTime2.ToString("HH:mm:ss"),
103
                     starttime2 = model.StartTime2.ToString("HH:mm:ss"),
101
                     endtime2 = model.EndTime2.ToString("HH:mm:ss"),
104
                     endtime2 = model.EndTime2.ToString("HH:mm:ss"),
102
-                    agentgroup = agentGroup?.F_Name ?? "",//坐席组
105
+                    agentgroup = agentGroup?.F_ZXZName ?? agentGroupStr,//坐席组
106
+                    agentgroupid = model.AgentGroupId,
103
                     agentcount = agentCount,//坐席组人数
107
                     agentcount = agentCount,//坐席组人数
104
                     allcount = model.y_HMCount ?? 0,     //号码总数
108
                     allcount = model.y_HMCount ?? 0,     //号码总数
105
                     calledcount = model.y_HCCount ?? 0,  //已呼个数
109
                     calledcount = model.y_HCCount ?? 0,  //已呼个数
130
             //if (!Request.IsAuthenticated)
134
             //if (!Request.IsAuthenticated)
131
             //    return NoToken("未知错误,请重新登录");
135
             //    return NoToken("未知错误,请重新登录");
132
             var model = taskBLL.GetModel(id);
136
             var model = taskBLL.GetModel(id);
133
-
137
+            if (model == null)
138
+                return Error("预测外呼任务不存在");
134
             //计算数据
139
             //计算数据
135
             string calledRate = "0";
140
             string calledRate = "0";
136
             var allcount = model.y_HMCount ?? 0;
141
             var allcount = model.y_HMCount ?? 0;
137
             float calledcount = model.y_HCCount ?? 0;
142
             float calledcount = model.y_HCCount ?? 0;
138
-            calledRate = allcount == 0 ? "" : calledcount / allcount * 100 + "%";
143
+            calledRate = allcount == 0 ? "" : (calledcount / allcount * 100).ToString("f2") + "%";
139
 
144
 
140
             string connectedRate = "0";
145
             string connectedRate = "0";
141
             float connected = model.y_YJCount ?? 0;
146
             float connected = model.y_YJCount ?? 0;
142
-            connectedRate = calledcount == 0 ? "0" : connected / calledcount * 100 + "%";
147
+            connectedRate = calledcount == 0 ? "0" : (connected / calledcount * 100).ToString("f2") + "%";
143
 
148
 
144
-            var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 ").Tables[0];
149
+            var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 and F_TaskId=" + model.TaskID).Tables[0];
145
             float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
150
             float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
146
             var connectedAgentRate = "0";
151
             var connectedAgentRate = "0";
147
-            connectedAgentRate = connected == 0 ? "0" : connectedAgentCount / connected * 100 + "%";
152
+            connectedAgentRate = connected == 0 ? "0" : (connectedAgentCount / connected * 100).ToString("f2") + "%";
148
 
153
 
149
             //查询坐席组
154
             //查询坐席组
150
-            var agentGroupList = dictValueBLL.DataTableToList(dictValueBLL.GetList(" F_DictionaryFlag='ZXZ'").Tables[0]);
155
+            var agentGroupList = seatGroupBLL.DataTableToList(seatGroupBLL.GetList("").Tables[0]);
151
             //查询坐席
156
             //查询坐席
152
             var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
157
             var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
153
 
158
 
154
 
159
 
155
-            var agentGroup = agentGroupList.SingleOrDefault(x => x.F_DictionaryValueId == model.AgentGroupId);
156
-            var agentCount = agentList.Where(x => x.F_GroupId == (agentGroup?.F_DictionaryValueId ?? 0)).Count();
160
+            var agentGroupStr = model.AgentGroupId == -999 ? "不转坐席" : "";
161
+            var agentGroup = agentGroupList.SingleOrDefault(x => x.F_ZXZID == model.AgentGroupId);
162
+            var agentCount = agentList.Where(x => x.F_SeartGroupID == (agentGroup?.F_ZXZID ?? 0)).Count();
157
 
163
 
158
             return Success("获取成功", new CallPlanDto
164
             return Success("获取成功", new CallPlanDto
159
             {
165
             {
164
                 addtime = Convert.ToDateTime(model.AddTime).ToString("yyyy-MM-dd HH:mm:ss"),
170
                 addtime = Convert.ToDateTime(model.AddTime).ToString("yyyy-MM-dd HH:mm:ss"),
165
                 talkid = model.y_TkModelId ?? 0,
171
                 talkid = model.y_TkModelId ?? 0,
166
                 pre = model.Pre, //线路前缀
172
                 pre = model.Pre, //线路前缀
173
+                recordpathid = model.RecordFileId,
174
+                concurrencytypestr = model.ConcurrencyType == 0 ? "并发数" : "并发速率",
167
                 concurrencytype = model.ConcurrencyType,
175
                 concurrencytype = model.ConcurrencyType,
168
                 concurrency = model.Concurrency,
176
                 concurrency = model.Concurrency,
169
                 planstartdate = model.PlanStartDate.ToString("yyyy-MM-dd"),
177
                 planstartdate = model.PlanStartDate.ToString("yyyy-MM-dd"),
172
                 endtime1 = model.EndTime1.ToString("HH:mm"),
180
                 endtime1 = model.EndTime1.ToString("HH:mm"),
173
                 starttime2 = model.StartTime2.ToString("HH:mm"),
181
                 starttime2 = model.StartTime2.ToString("HH:mm"),
174
                 endtime2 = model.EndTime2.ToString("HH:mm"),
182
                 endtime2 = model.EndTime2.ToString("HH:mm"),
175
-                agentgroupid = agentGroup?.F_DictionaryValueId ?? 0,
176
-                agentgroup = agentGroup?.F_Name ?? "",//坐席组
183
+                agentgroup = agentGroup?.F_ZXZName ?? agentGroupStr,//坐席组
184
+                agentgroupid = model.AgentGroupId,
177
                 agentcount = agentCount,//坐席组人数
185
                 agentcount = agentCount,//坐席组人数
178
                 allcount = model.y_HMCount ?? 0,     //号码总数
186
                 allcount = model.y_HMCount ?? 0,     //号码总数
179
                 calledcount = model.y_HCCount ?? 0,  //已呼个数
187
                 calledcount = model.y_HCCount ?? 0,  //已呼个数
215
                     return Error("输入的并发数和进号速率必须不小于1");
223
                     return Error("输入的并发数和进号速率必须不小于1");
216
                 model.ConcurrencyType = input.ConcurrencyType;
224
                 model.ConcurrencyType = input.ConcurrencyType;
217
                 model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
225
                 model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
226
+                model.RecordFileId = input.RecordPathId;
218
                 model.y_HMCount = 0;
227
                 model.y_HMCount = 0;
219
                 model.y_HCCount = 0;
228
                 model.y_HCCount = 0;
220
                 model.y_YJCount = 0;
229
                 model.y_YJCount = 0;
234
                 model.y_NoAnswerCount = 0;
243
                 model.y_NoAnswerCount = 0;
235
                 model.y_ShutDownCount = 0;
244
                 model.y_ShutDownCount = 0;
236
                 model.PlanStartDate = input.PlanStartDate;
245
                 model.PlanStartDate = input.PlanStartDate;
237
-                model.PlanEndDate = input.PlanEndDate;
246
+                model.PlanEndDate = input.PlanEndDate.AddDays(1).AddSeconds(-1);
238
                 model.StartTime1 = input.StartTime1;
247
                 model.StartTime1 = input.StartTime1;
239
                 model.EndTime1 = input.EndTime1;
248
                 model.EndTime1 = input.EndTime1;
240
                 model.StartTime2 = input.StartTime2;
249
                 model.StartTime2 = input.StartTime2;
292
                                 break;
301
                                 break;
293
                             case 4: //从Excel中导入
302
                             case 4: //从Excel中导入
294
                                 NPOIHelper npoi = new NPOIHelper();
303
                                 NPOIHelper npoi = new NPOIHelper();
295
-                                var dtExcel = npoi.ExcelToTable(input.FilePath, 0);
304
+                                var dtExcel = npoi.ExcelToTable(input.PhoneStr, 1);
296
 
305
 
297
                                 break;
306
                                 break;
298
                         }
307
                         }
326
             model.TaskType = input.Type;
335
             model.TaskType = input.Type;
327
             model.AgentGroupId = input.AgentGroupId;
336
             model.AgentGroupId = input.AgentGroupId;
328
             model.y_TkModelId = input.PagerId;
337
             model.y_TkModelId = input.PagerId;
329
-            model.Pre = input.Pre;
338
+            //model.Pre = input.Pre;
330
             if (input.ConcurrencyType == 0)
339
             if (input.ConcurrencyType == 0)
331
             {
340
             {
332
                 var num = 0;
341
                 var num = 0;
339
             model.ConcurrencyType = input.ConcurrencyType;
348
             model.ConcurrencyType = input.ConcurrencyType;
340
             model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
349
             model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
341
             model.PlanStartDate = input.PlanStartDate;
350
             model.PlanStartDate = input.PlanStartDate;
342
-            model.PlanEndDate = input.PlanEndDate;
351
+            model.PlanEndDate = input.PlanEndDate.AddDays(1).AddSeconds(-1);
343
             model.StartTime1 = input.StartTime1;
352
             model.StartTime1 = input.StartTime1;
344
             model.EndTime1 = input.EndTime1;
353
             model.EndTime1 = input.EndTime1;
345
             model.StartTime2 = input.StartTime2;
354
             model.StartTime2 = input.StartTime2;
346
             model.EndTime2 = input.EndTime2;
355
             model.EndTime2 = input.EndTime2;
356
+            model.RecordFileId = input.RecordPathId;
347
             if (taskBLL.Update(model))
357
             if (taskBLL.Update(model))
348
                 return Success("修改成功");
358
                 return Success("修改成功");
349
             return Error("修改失败");
359
             return Error("修改失败");
381
         /// <param name="id"></param>
391
         /// <param name="id"></param>
382
         /// <param name="concurrency"></param>
392
         /// <param name="concurrency"></param>
383
         /// <returns></returns>
393
         /// <returns></returns>
384
-        public ActionResult UpdateConcurrency(long id, float concurrency)
394
+        public ActionResult UpdateConcurrency(long id, float concurrency, int concurrencyType = 0)
385
         {
395
         {
386
             //if (!Request.IsAuthenticated)
396
             //if (!Request.IsAuthenticated)
387
             //    return NoToken("未知错误,请重新登录");
397
             //    return NoToken("未知错误,请重新登录");
388
             var model = taskBLL.GetModel(id);
398
             var model = taskBLL.GetModel(id);
389
             if (model == null)
399
             if (model == null)
390
                 return Error("该外呼任务不存在");
400
                 return Error("该外呼任务不存在");
391
-            var num = 0;
392
-            if (!int.TryParse(concurrency.ToString(), out num))
393
-                return Error("并发数必须为不小于1的整数");
394
-            model.Concurrency = (int)concurrency;
401
+            if (concurrencyType == 0)
402
+            {
403
+                var num = 0;
404
+                if (!int.TryParse(concurrency.ToString(), out num))
405
+                    return Error("并发数必须为不小于1的整数");
406
+                concurrency = num;
407
+            }
408
+            if (concurrency < 1)
409
+                return Error("输入的并发数和进号速率必须不小于1");
410
+            model.ConcurrencyType = concurrencyType;
411
+            model.Concurrency = concurrency;
395
             if (taskBLL.Update(model))
412
             if (taskBLL.Update(model))
396
                 return Success("修改成功");
413
                 return Success("修改成功");
397
             return Error("修改失败");
414
             return Error("修改失败");
408
             if (num > 0)
425
             if (num > 0)
409
             {
426
             {
410
                 var task = taskBLL.GetModel(id);
427
                 var task = taskBLL.GetModel(id);
411
-
412
-
413
                 return Success("删除成功");
428
                 return Success("删除成功");
414
             }
429
             }
415
             return Error("删除失败");
430
             return Error("删除失败");
416
         }
431
         }
432
+        /// <summary>
433
+        /// 去除号码前缀
434
+        /// </summary>
435
+        /// <param name="callId"></param>
436
+        /// <param name="tel"></param>
437
+        /// <returns></returns>
438
+        public ActionResult RemovePre(string callId, string tel)
439
+        {
440
+            //if (!Request.IsAuthenticated)
441
+            //    return NoToken("未知错误,请重新登录");
442
+            var callResult = callResultBLL.GetModel(callId);
443
+            if (callResult == null)
444
+                return Error("通话记录未正常添加");
445
+            var task = taskBLL.GetModel(callResult.TaskId);
446
+            if (task == null)
447
+                return Error("任务不存在");
448
+            var len = task.Pre.Length;
449
+            return Success("去除成功", tel.Substring(len));
450
+        }
451
+        /// <summary>
452
+        /// 更新外呼任务状态
453
+        /// </summary>
454
+        /// <returns></returns>
455
+        public ActionResult UpdateCallPlanState()
456
+        {
457
+            StringBuilder sb = new StringBuilder();
458
+            var log = LogFactory.GetLogger(this.GetType().ToString());
459
+            var list = taskBLL.DataTableToList(taskBLL.GetList(" state>=0 ").Tables[0]);
460
+            foreach (var task in list)
461
+            {
462
+                if (task.PlanStartDate <= DateTime.Now && task.PlanEndDate > DateTime.Now)
463
+                {
464
+                    if (task.State == 2)
465
+                    {
466
+                        if (task.PlanStartDate < DateTime.Now && DateTime.Now < task.StartTime1)
467
+                        {
468
+                            task.State = 0;
469
+                            if (!taskBLL.Update(task))
470
+                                return Error($"更新自动外呼任务状态为0=待处理失败,ID={task.TaskID},Name={task.TaskName}");
471
+                            log.Info($"更新自动外呼任务状态为0=待处理成功,ID={task.TaskID},Name={task.TaskName}");
472
+                        }
473
+                    }
474
+                    if (task.State == 0)
475
+                    {
476
+                        if ((DateTime.Now >= task.StartTime1 && DateTime.Now < task.EndTime1) || (DateTime.Now > task.StartTime2 && DateTime.Now < task.EndTime2))
477
+                        {
478
+                            task.State = 1;
479
+                            if (!taskBLL.Update(task))
480
+                                return Error($"更新自动外呼任务状态为1=处理中失败,ID={task.TaskID},Name={task.TaskName}");
481
+                            log.Info($"更新自动外呼任务状态为1=处理中成功,ID={task.TaskID},Name={task.TaskName}");
482
+
483
+                        }
484
+                    }
485
+                    if (task.State == 1)
486
+                    {
487
+                        if (task.PlanEndDate < DateTime.Now)
488
+                        {
489
+                            task.State = 0;
490
+                            if (!taskBLL.Update(task))
491
+                                return Error($"更新自动外呼任务状态为2=暂停失败,ID={task.TaskID},Name={task.TaskName}");
492
+                            log.Info($"更新自动外呼任务状态为2=暂停成功,ID={task.TaskID},Name={task.TaskName}");
493
+                        }
494
+                    }
495
+                }
496
+            }
497
+            return Success("处理完成");
498
+        }
417
         #endregion
499
         #endregion
418
 
500
 
419
-        #region 导入导出数据
501
+        #region 导入导出号码
420
         /// <summary>
502
         /// <summary>
421
         /// 导入号码信息
503
         /// 导入号码信息
422
         /// </summary>
504
         /// </summary>
477
             switch (type)
559
             switch (type)
478
             {
560
             {
479
                 case 1:
561
                 case 1:
480
-                    var dt1 = taskTellNumBLL.GetList(" F_TaskId=" + task.TaskID + "  and F_HCState=1 and  F_YJState=0 ").Tables[0];
562
+                    var dt1 = taskTellNumBLL.GetPhoneList(" F_TaskId=" + task.TaskID + "  and F_HCState=1 and  (F_YJState=0 or F_YJState is null) ").Tables[0];
481
                     var msg1 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出未接通号码", dt1);
563
                     var msg1 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出未接通号码", dt1);
482
                     return !string.IsNullOrWhiteSpace(msg1) ? Error(msg1) : Success("导出成功");
564
                     return !string.IsNullOrWhiteSpace(msg1) ? Error(msg1) : Success("导出成功");
483
                 case 2:
565
                 case 2:
484
-                    var dt2 = taskTellNumBLL.GetList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and  F_YJState=1 ").Tables[0];
566
+                    var dt2 = taskTellNumBLL.GetPhoneList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and  F_YJState=1 ").Tables[0];
485
                     var msg2 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出已接通号码", dt2);
567
                     var msg2 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出已接通号码", dt2);
486
                     return !string.IsNullOrWhiteSpace(msg2) ? Error(msg2) : Success("导出成功");
568
                     return !string.IsNullOrWhiteSpace(msg2) ? Error(msg2) : Success("导出成功");
487
             }
569
             }
509
         /// 获取自动放音文件
591
         /// 获取自动放音文件
510
         /// </summary>
592
         /// </summary>
511
         /// <returns></returns>
593
         /// <returns></returns>
512
-        public ActionResult GetRecordList()
594
+        public ActionResult GetRecordList(FilterTalkRecord filter)
513
         {
595
         {
514
             //if (!Request.IsAuthenticated)
596
             //if (!Request.IsAuthenticated)
515
             //    return NoToken("未知错误,请重新登录");
597
             //    return NoToken("未知错误,请重新登录");
516
-            var list = taskRecordBLL.DataTableToList(taskRecordBLL.GetList("").Tables[0]).Select(x => new
598
+            var recordCount = 0;
599
+            var dt = BLL.PagerBLL.GetListPager(
600
+                 "T_CTI_TaskRecord ",
601
+                 "id",
602
+                 "*",
603
+                 "",
604
+                 "ORDER BY id desc",
605
+                 filter.PageSize,
606
+                 filter.PageIndex,
607
+                 true,
608
+                 out recordCount);
609
+
610
+
611
+            var list = taskRecordBLL.DataTableToList(dt).Select(x => new
517
             {
612
             {
518
                 id = x.Id,
613
                 id = x.Id,
519
                 name = x.Name,
614
                 name = x.Name,
520
                 recordpath = x.RecordPath,
615
                 recordpath = x.RecordPath,
521
                 recordtime = x.RecordTime,
616
                 recordtime = x.RecordTime,
522
             });
617
             });
523
-            return Success("成功", list.ToList());
618
+            var obj = new
619
+            {
620
+                rows = list,
621
+                total = recordCount
622
+            };
623
+            return Content(obj.ToJson());
524
         }
624
         }
525
         /// <summary>
625
         /// <summary>
526
         /// 获取录音
626
         /// 获取录音
553
             Model.T_CTI_TaskRecord model = new Model.T_CTI_TaskRecord();
653
             Model.T_CTI_TaskRecord model = new Model.T_CTI_TaskRecord();
554
             if (input.Id <= 0)
654
             if (input.Id <= 0)
555
             {
655
             {
556
-                var file = Request.Files[0];
656
+                var dir = Server.MapPath("~/UploadRecord/");
557
 
657
 
658
+                if (!Directory.Exists(dir))
659
+                {
660
+                    Directory.CreateDirectory(dir);
661
+                }
662
+                var file = Request.Files[0];
663
+                if (file.ContentType != "audio/x-wav" && file.ContentType != "audio/wav")
664
+                    return Error("上传录音格式必须为.wav");
558
 
665
 
666
+                var name = DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N").Substring(0, 10) + ".wav";
667
+                var path = dir + name;
668
+                Request.Files[0].SaveAs(path);
559
 
669
 
670
+                FileInfo fileInfo = new FileInfo(path);
671
+                var fileName = FileUp.UploadFile(fileInfo, "/", "120.194.141.197", "Administrator", "hykj@800100");
560
 
672
 
673
+                var sysConfig = systemConfigBLL.GetModel(40);
674
+                if (sysConfig == null)
675
+                    return Error("自动放音录音路径查询失败");
561
                 model.Name = input.Name;
676
                 model.Name = input.Name;
562
-                model.RecordPath = input.RecordPath;
563
-                model.RecordTime = input.RecordTime;
677
+                model.RecordPath = sysConfig.F_ParamValue + fileName;
678
+                //model.RecordTime = input.RecordTime;
564
                 model.Remark = input.Remark;
679
                 model.Remark = input.Remark;
565
 
680
 
566
                 if (taskRecordBLL.Add(model) > 0)
681
                 if (taskRecordBLL.Add(model) > 0)
567
                     return Success("添加成功");
682
                     return Success("添加成功");
568
                 return Error("添加失败");
683
                 return Error("添加失败");
569
             }
684
             }
570
-            return Success("");
685
+            return Success("添加失败");
571
         }
686
         }
572
         #endregion
687
         #endregion
573
 
688
 
574
-        #region 话务统计
689
+        #region 话单查询
575
         /// <summary>
690
         /// <summary>
576
         /// 话务分析
691
         /// 话务分析
577
         /// </summary>
692
         /// </summary>
588
 
703
 
589
             //}
704
             //}
590
 
705
 
591
-            var fir = taskDailyBLL.DataTableToList(taskDailyBLL.GetList("").Tables[0]);
592
-            var sec = taskPhonePartBLL.DataTableToList(taskPhonePartBLL.GetList("").Tables[0]);
706
+            var fir = taskPhonePartBLL.DataTableToList(taskPhonePartBLL.GetList("").Tables[0]);
707
+            var sec = taskDailyBLL.DataTableToList(taskDailyBLL.GetList("").Tables[0]);
593
             var thi = taskDailyBLL.DataTableToList(taskDailyBLL.GetList().Tables[0]);
708
             var thi = taskDailyBLL.DataTableToList(taskDailyBLL.GetList().Tables[0]);
594
 
709
 
595
-
596
             var obj = new
710
             var obj = new
597
             {
711
             {
598
-                fir = fir,
599
-                sec = sec,
600
-                thi = thi
712
+                fir = fir.Select(x => new
713
+                {
714
+                    date = x.Date.ToString("yyyy-MM-dd"),
715
+                    phonepart = x.PhonePart,
716
+                    province = x.Province,
717
+                    city = x.City,
718
+                    connectedcount = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
719
+                    connectedagentcount = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
720
+                }),
721
+                sec = sec.Select(x => new
722
+                {
723
+                    date = x.Date.ToString("yyyy-MM-dd"),
724
+                    allcount = x.AllCount,
725
+                    calledcount = x.CalledCount,
726
+                    connectedcount = x.ConnectedCount,
727
+                    connectedagentcount = x.ConnectedAgentCount,
728
+                    connectedrate = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
729
+                    connectedagentrate = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
730
+                    taskid = x.TaskId,
731
+                    taskname = x.TaskName
732
+
733
+                }),
734
+                thi = thi.Select(x => new
735
+                {
736
+                    date = x.Date.ToString("yyyy-MM-dd"),
737
+                    allcount = x.AllCount,
738
+                    calledcount = x.CalledCount,
739
+                    connectedcount = x.ConnectedCount,
740
+                    connectedagentcount = x.ConnectedAgentCount,
741
+                    connectedrate = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
742
+                    connectedagentrate = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
743
+                    taskid = x.TaskId,
744
+                    taskname = x.TaskName
745
+                })
601
             };
746
             };
602
 
747
 
603
 
748
 
611
         {
756
         {
612
             //if (!Request.IsAuthenticated)
757
             //if (!Request.IsAuthenticated)
613
             //    return NoToken("未知错误,请重新登录");
758
             //    return NoToken("未知错误,请重新登录");
759
+            var sort = "ORDER BY startdate desc";
760
+            if (!string.IsNullOrWhiteSpace(filter.SortField))
761
+            {
762
+                var arr = filter.SortField.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
763
+                EnumTalkRecordsSortField e;
764
+                if (!Enum.TryParse(arr[0], out e))
765
+                    return Error("排序字段参数错误");
766
+                sort = "ORDER BY " + e.ToString() + " " + arr[1];
767
+            }
768
+
769
+            StringBuilder where = new StringBuilder();
614
 
770
 
615
-            var sql = "";
616
 
771
 
617
-            // 未接通   F_YJState=0
618
-            // 接通未转入坐席 F_YJState=0 
619
-            // 接通未分配坐席 
620
-            // 接通且分配坐席  F_YJState=1 and agentid>0
772
+            if (!string.IsNullOrWhiteSpace(filter.UserCode))
773
+            {
774
+                where.Append(" and agentid=" + filter.UserCode);
775
+            }
776
+            if (!string.IsNullOrWhiteSpace(filter.Phone))
777
+            {
778
+                where.Append(" and callee like '%" + filter.Phone + "%'");
779
+            }
780
+            if (filter.CallType != 0)
781
+            {
782
+                where.Append(" and calltype=" + filter.CallType);
783
+            }
784
+
785
+            if (!string.IsNullOrWhiteSpace(filter.TalkTime))
786
+            {
787
+                var arr = filter.TalkTime.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
788
+                if (arr.Length == 2)
789
+                {
790
+                    if (arr[0] == "1")
791
+                    {
792
+                        where.Append(" and talktime>" + arr[1]);
793
+                    }
794
+                    else if (arr[0] == "2")
795
+                    {
796
+                        where.Append(" and talktime=" + arr[1]);
797
+                    }
798
+                    else if (arr[0] == "3")
799
+                    {
800
+                        where.Append(" and talktime<" + arr[1]);
801
+                    }
802
+                    else { }
803
+                }
804
+            }
805
+
806
+            if (filter.StartTime == null || filter.EndTime == null)
807
+            {
808
+                filter.StartTime = DateTime.Now.AddDays(-3);
809
+                filter.EndTime = DateTime.Now;
810
+            }
811
+            where.Append(" and datediff(s,'" + filter.StartTime + "',getdate())>=0 and datediff(s,getdate(),'" + filter.EndTime + "')>=0 ");
812
+
813
+
814
+
815
+            // 全部=0
816
+            // 未接通=1       
817
+            // 接通排队=2
818
+            // 接通未转入坐席=3
819
+            // 接通且分配坐席=4  
621
             int recordCount = 0;
820
             int recordCount = 0;
622
             Model.PageData<Model.CallResult> pageModel = new Model.PageData<Model.CallResult>();
821
             Model.PageData<Model.CallResult> pageModel = new Model.PageData<Model.CallResult>();
623
             StringBuilder fields = new StringBuilder();
822
             StringBuilder fields = new StringBuilder();
624
-            fields.Append(" cr.id,cr.itemid,cr.callee,cr.agentid,ua.f_username as username ,cr.recordpath  ");
625
-            fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.StartDate)>0 then cr.StartDate else null end) as startdate ");
626
-            fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.GetInAgentDate)>0 then cr.GetInAgentDate else null end) as getinagentdate ");
627
-            fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.EndDate)>0 then cr.EndDate else null end) as enddate ");
628
-            fields.Append(", (case when t.F_YJState=0 then '未接通'  when (t.F_YJState=1 and cr.AgentId>0) then '接通且转坐席' end ) as state ");
629
-            fields.Append(", (case when datediff(s,cr.GetInAgentDate,cr.endDate)<0 then 0 else datediff(s,cr.GetInAgentDate,cr.endDate) end) as talktime");
630
             var dt = BLL.PagerBLL.GetListPager(
823
             var dt = BLL.PagerBLL.GetListPager(
631
-                    " CallResult cr left join T_Sys_UserAccount ua on cr.agentId=ua.f_usercode left join T_Call_TaskTelNum t ON t.F_Id=cr.Id ",
632
-                    "cr.Id",
633
-                    fields.ToString(),
634
-                    sql,
635
-                    "ORDER BY cr.Id desc",
636
-                    filter.PageSize,
637
-                    filter.PageIndex,
638
-                    true,
639
-                    out recordCount);
640
-            var list = callResultBLL.DataTableToList(dt).Select(x => new
824
+                       "V_AutoCallResult",
825
+                       "V_AutoCallResult.id",
826
+                       "V_AutoCallResult.id,itemid, callee, agentid, username,startdate,enddate,getinagentdate,calltype,talktime,RecordPath",
827
+                       where.ToString(),
828
+                       sort,
829
+                       filter.PageSize,
830
+                       filter.PageIndex,
831
+                       true,
832
+                       out recordCount);
833
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
834
+            var callResultList = callResultBLL.DataTableToList(dt);
835
+            var list = new List<AutoCallRecordDto>();
836
+            callResultList.ForEach(x =>
641
             {
837
             {
642
-                id = x.Id,
643
-                taskid = x.TaskId,
644
-                callnumber = x.CallNumber,
645
-                usercode = x.Usercode == "0" ? "" : x.Usercode,
646
-                startdate = x.StartDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
647
-                getinagentdate = x.GetInAgentDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
648
-                enddate = x.EndDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
649
-                recordpath = x.RecordPath,
650
-                username = x.Username,
651
-                state = x.State,
652
-                talktime = x.TalkTime > 0 ? x.TalkTime.ToString() : ""
838
+                var recordPath = "";
839
+                if (!string.IsNullOrWhiteSpace(x.RecordPath) && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
840
+                {
841
+                    var ym = config.F_ParamValue;
842
+                    if (ym.Substring(ym.Length - 1) == "/")
843
+                    {
844
+                        ym = ym.Substring(0, ym.Length - 1);
845
+                    }
846
+                    recordPath = ym + x.RecordPath.Substring(x.RecordPath.IndexOf(':') + 1).Replace('\\', '/');
847
+                }
848
+
849
+                list.Add(new AutoCallRecordDto
850
+                {
851
+                    id = x.Id,
852
+                    taskid = x.TaskId,
853
+                    callnumber = x.CallNumber,
854
+                    usercode = x.Usercode == "0" ? "" : x.Usercode,
855
+                    startdate = x.StartDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
856
+                    getinagentdate = x.GetInAgentDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
857
+                    enddate = x.EndDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
858
+                    recordpath = recordPath,
859
+                    username = x.Username,
860
+                    state = x.State,
861
+                    talktime = x.TalkTime > 0 ? x.TalkTime.ToString() : ""
862
+                });
653
             });
863
             });
864
+
654
             var obj = new
865
             var obj = new
655
             {
866
             {
656
                 rows = list,
867
                 rows = list,
661
         #endregion
872
         #endregion
662
 
873
 
663
         #region 过滤号码
874
         #region 过滤号码
875
+
876
+
664
         #region 过滤号码-数据源
877
         #region 过滤号码-数据源
665
         /// <summary>
878
         /// <summary>
666
         /// 过滤号码
879
         /// 过滤号码
684
             return dt;
897
             return dt;
685
         }
898
         }
686
         #endregion
899
         #endregion
687
-
688
         #region 过滤号码-前三个月
900
         #region 过滤号码-前三个月
689
         private DataTable PhoneNumFilterMonth(DataTable dt, string phone = "F_Phone")
901
         private DataTable PhoneNumFilterMonth(DataTable dt, string phone = "F_Phone")
690
         {
902
         {
706
         #endregion
918
         #endregion
707
         #endregion
919
         #endregion
708
 
920
 
709
-
710
     }
921
     }
711
 }
922
 }

+ 23 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Dto/AutoCallResordDto.cs

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web;
5
+
6
+namespace CallCenterApi.Interface.Models.Dto
7
+{
8
+    public class AutoCallRecordDto
9
+    {
10
+        public int id { get; set; }
11
+        public int taskid { get; set; }
12
+        public string callnumber { get; set; }
13
+        public string usercode { get; set; }
14
+        public string startdate { get; set; }
15
+        public string getinagentdate { get; set; }
16
+        public string enddate { get; set; }
17
+        public string recordpath { get; set; }
18
+        public string username { get; set; }
19
+        public string state { get; set; }
20
+        public string talktime { get; set; }
21
+
22
+    }
23
+}

+ 2 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Dto/CallPlan.cs

14
         public string addtime { get; set; }
14
         public string addtime { get; set; }
15
         public long talkid { get; set; }
15
         public long talkid { get; set; }
16
         public string pre { get; set; }
16
         public string pre { get; set; }
17
+        public int recordpathid { get; set; }
18
+        public string concurrencytypestr { get; set; }
17
         public int concurrencytype { get; set; }
19
         public int concurrencytype { get; set; }
18
         public float concurrency { get; set; }
20
         public float concurrency { get; set; }
19
         public string planstartdate { get; set; }
21
         public string planstartdate { get; set; }

+ 11 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Filter/FilterTalkRecord.cs

45
         public string TalkTime { get; set; }
45
         public string TalkTime { get; set; }
46
 
46
 
47
     }
47
     }
48
+
49
+    public enum EnumTalkRecordsSortField
50
+    {
51
+        id = 1,
52
+        callee = 2,
53
+        agentid = 3,
54
+        startdate = 4,
55
+        getinagentdate = 5,
56
+        enddate = 6,
57
+        talktime = 7
58
+    }
48
 }
59
 }

+ 1 - 1
CallCenterApi/CallCenterApi.Model/T_CTI_Task.cs

309
         /// 坐席组Id
309
         /// 坐席组Id
310
         /// </summary>
310
         /// </summary>
311
         public int AgentGroupId { get; set; }
311
         public int AgentGroupId { get; set; }
312
-
312
+        public int RecordFileId { get; set; }
313
         #endregion Model
313
         #endregion Model
314
 
314
 
315
     }
315
     }

+ 2 - 1
CallCenterApi/CallCenterApi.Model/T_CTI_TaskDaily.cs

10
     {
10
     {
11
         public DateTime Date { get; set; }
11
         public DateTime Date { get; set; }
12
         public int TaskId { get; set; }
12
         public int TaskId { get; set; }
13
+        public string TaskName { get; set; }
13
         public int AllCount { get; set; }
14
         public int AllCount { get; set; }
14
         public int CalledCount { get; set; }
15
         public int CalledCount { get; set; }
15
         public int ConnectedCount { get; set; }
16
         public int ConnectedCount { get; set; }
16
         public int ConnectedAgentCount { get; set; }
17
         public int ConnectedAgentCount { get; set; }
17
-        public DateTime UpdateTime { get; set; }
18
+
18
     }
19
     }
19
 }
20
 }