|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
2
|
2
|
using CallCenterApi.Common;
|
|
|
3
|
+using CallCenterApi.DB;
|
|
3
|
4
|
using CallCenterApi.Interface.Controllers.Base;
|
|
4
|
5
|
using System;
|
|
5
|
6
|
using System.Collections.Generic;
|
|
|
@@ -14,7 +15,7 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
14
|
15
|
public class CallrecordsController : BaseController
|
|
15
|
16
|
{
|
|
16
|
17
|
//获取通话记录列表
|
|
17
|
|
- public ActionResult GetList(string phone, string usercode)
|
|
|
18
|
+ public ActionResult GetList(string phone, string usercode,int isdc=0)
|
|
18
|
19
|
{
|
|
19
|
20
|
string sql = "";
|
|
20
|
21
|
DataTable dt = new DataTable();
|
|
|
@@ -134,67 +135,89 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
134
|
135
|
{
|
|
135
|
136
|
pagesize = Convert.ToInt32(strpagesize);
|
|
136
|
137
|
}
|
|
137
|
|
- int recordCount = 0;
|
|
138
|
|
- dt = BLL.PagerBLL.GetListPager(
|
|
139
|
|
- "T_Call_CallRecords WITH(NOLOCK)",
|
|
140
|
|
- "CallRecordsId",
|
|
141
|
|
- "*,dbo.GetUserName(UserCode) as UserName",
|
|
142
|
|
- sql,
|
|
143
|
|
- "ORDER BY CallRecordsId desc",
|
|
144
|
|
- pagesize,
|
|
145
|
|
- pageindex,
|
|
146
|
|
- true,
|
|
147
|
|
- out recordCount);
|
|
148
|
|
-
|
|
149
|
|
- var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
150
|
|
- // var usercodes= (from r in dt.AsEnumerable() select r.Field<string>("UserCode")).ToList<string>().Distinct();
|
|
151
|
|
- // var users = new BLL.T_Sys_UserAccount().GetModelList(" F_UserCode in ('" + string.Join("','", usercodes) + "')");
|
|
152
|
|
- dt.Columns.Add("TypeName",typeof( string));
|
|
153
|
|
- dt.Columns.Add("WorkOrderId", typeof(string));
|
|
154
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
138
|
+ if (isdc > 0)
|
|
|
139
|
+ {
|
|
|
140
|
+ var dtdc = DbHelperSQL.Query(" select ROW_NUMBER() OVER(ORDER BY CallRecordsId desc) 编号, CallNumber 电话号码,(case CallType when 0 then '呼入' else '呼出' end ) 呼叫方向,(case CallState when 0 then ( case CallType when 0 then (case when isnull(UserCode,'')!='' then '主动放弃' else '未接通' end) else '未接通' end ) else '已接通' end ) 呼叫状态,UserCode 坐席工号,dbo.GetUserName(UserCode) as 坐席姓名, "
|
|
|
141
|
+ + "BeginTime 开始时间,TalkStartTime 通话开始时间 ,TalkEndTime " +
|
|
|
142
|
+ " 通话结束时间 ,EndTime 结束时间 ,LongTime 通话时长 ,PhoneType " +
|
|
|
143
|
+ "电话类别, (select top 1 F_WorkOrderId from T_Bus_WorkOrder WITH(NOLOCK) where F_CallRecordId=a.CallRecordsId and F_IsDelete=0) " +
|
|
|
144
|
+ "工单号"
|
|
|
145
|
+ + " from T_Call_CallRecords a WITH(NOLOCK) where 1=1 " + sql+ "ORDER BY CallRecordsId desc").Tables[0];
|
|
|
146
|
+ var msg = new NPOIHelper().ExportToExcel("通话记录", dtdc);
|
|
|
147
|
+ if (msg == "")
|
|
|
148
|
+ {
|
|
|
149
|
+ return Success("导出成功");
|
|
|
150
|
+ }
|
|
|
151
|
+ else
|
|
|
152
|
+ {
|
|
|
153
|
+ return Error("导出失败");
|
|
|
154
|
+ }
|
|
|
155
|
+ }
|
|
|
156
|
+ else
|
|
155
|
157
|
{
|
|
156
|
|
- string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
|
|
157
|
|
- if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
|
158
|
+ int recordCount = 0;
|
|
|
159
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
160
|
+ "T_Call_CallRecords WITH(NOLOCK)",
|
|
|
161
|
+ "CallRecordsId",
|
|
|
162
|
+ "*,dbo.GetUserName(UserCode) as UserName",
|
|
|
163
|
+ sql,
|
|
|
164
|
+ "ORDER BY CallRecordsId desc",
|
|
|
165
|
+ pagesize,
|
|
|
166
|
+ pageindex,
|
|
|
167
|
+ true,
|
|
|
168
|
+ out recordCount);
|
|
|
169
|
+
|
|
|
170
|
+ var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
|
171
|
+ // var usercodes= (from r in dt.AsEnumerable() select r.Field<string>("UserCode")).ToList<string>().Distinct();
|
|
|
172
|
+ // var users = new BLL.T_Sys_UserAccount().GetModelList(" F_UserCode in ('" + string.Join("','", usercodes) + "')");
|
|
|
173
|
+ dt.Columns.Add("TypeName", typeof(string));
|
|
|
174
|
+ dt.Columns.Add("WorkOrderId", typeof(string));
|
|
|
175
|
+ foreach (DataRow dr in dt.Rows)
|
|
158
|
176
|
{
|
|
159
|
|
- var ym = config.F_ParamValue;
|
|
160
|
|
- if (ym.Substring(ym.Length - 1) == "/")
|
|
|
177
|
+ string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
|
|
|
178
|
+ if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
161
|
179
|
{
|
|
162
|
|
- ym = ym.Substring(0, ym.Length - 1);
|
|
|
180
|
+ var ym = config.F_ParamValue;
|
|
|
181
|
+ if (ym.Substring(ym.Length - 1) == "/")
|
|
|
182
|
+ {
|
|
|
183
|
+ ym = ym.Substring(0, ym.Length - 1);
|
|
|
184
|
+ }
|
|
|
185
|
+
|
|
|
186
|
+ string lujing = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
|
187
|
+ string wlpath = ym + lujing;
|
|
|
188
|
+
|
|
|
189
|
+ //if (!CommonHelper.FileIsExist(wlpath))
|
|
|
190
|
+ //{
|
|
|
191
|
+ // wlpath = lujing;
|
|
|
192
|
+ //}
|
|
|
193
|
+ dr["FilePath"] = wlpath;
|
|
163
|
194
|
}
|
|
164
|
195
|
|
|
165
|
|
- string lujing = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
166
|
|
- string wlpath = ym + lujing;
|
|
167
|
|
-
|
|
168
|
|
- //if (!CommonHelper.FileIsExist(wlpath))
|
|
169
|
|
- //{
|
|
170
|
|
- // wlpath = lujing;
|
|
171
|
|
- //}
|
|
172
|
|
- dr["FilePath"] = wlpath;
|
|
173
|
|
- }
|
|
174
|
|
-
|
|
175
|
196
|
|
|
176
|
|
- if (dr["F_CallInType"] != null && dr["F_CallInType"].ToString() != "")
|
|
177
|
|
- {
|
|
178
|
|
- int tid = Int32.Parse(dr["F_CallInType"].ToString());
|
|
179
|
|
- var tn = new BLL.T_Sys_DictionaryValue().GetModel(tid);
|
|
180
|
|
- if (tn != null)
|
|
|
197
|
+ if (dr["F_CallInType"] != null && dr["F_CallInType"].ToString() != "")
|
|
181
|
198
|
{
|
|
182
|
|
- dr["TypeName"] = tn.F_Value;
|
|
|
199
|
+ int tid = Int32.Parse(dr["F_CallInType"].ToString());
|
|
|
200
|
+ var tn = new BLL.T_Sys_DictionaryValue().GetModel(tid);
|
|
|
201
|
+ if (tn != null)
|
|
|
202
|
+ {
|
|
|
203
|
+ dr["TypeName"] = tn.F_Value;
|
|
|
204
|
+ }
|
|
183
|
205
|
}
|
|
184
|
|
- }
|
|
185
|
206
|
|
|
186
|
|
- dr["WorkOrderId"] = DB.DbHelperSQL.GetSingle(" select top 1 F_WorkOrderId from T_Bus_WorkOrder WITH(NOLOCK) where F_CallRecordId='" + dr["CallRecordsId"].ToString() + "' and F_IsDelete=0 ");
|
|
187
|
|
- }
|
|
|
207
|
+ dr["WorkOrderId"] = DB.DbHelperSQL.GetSingle(" select top 1 F_WorkOrderId from T_Bus_WorkOrder WITH(NOLOCK) where F_CallRecordId='" + dr["CallRecordsId"].ToString() + "' and F_IsDelete=0 ");
|
|
|
208
|
+ }
|
|
188
|
209
|
|
|
189
|
|
- var obj = new
|
|
190
|
|
- {
|
|
191
|
|
- state = "success",
|
|
192
|
|
- message = "成功",
|
|
193
|
|
- rows = dt,
|
|
194
|
|
- total = recordCount
|
|
195
|
|
- };
|
|
|
210
|
+ var obj = new
|
|
|
211
|
+ {
|
|
|
212
|
+ state = "success",
|
|
|
213
|
+ message = "成功",
|
|
|
214
|
+ rows = dt,
|
|
|
215
|
+ total = recordCount
|
|
|
216
|
+ };
|
|
196
|
217
|
|
|
197
|
|
- return Content(obj.ToJson());
|
|
|
218
|
+ return Content(obj.ToJson());
|
|
|
219
|
+ }
|
|
|
220
|
+
|
|
198
|
221
|
|
|
199
|
222
|
|
|
200
|
223
|
}
|
|
|
@@ -324,28 +347,32 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
324
|
347
|
pagesize = Convert.ToInt32(strpagesize);
|
|
325
|
348
|
}
|
|
326
|
349
|
int recordCount = 0;
|
|
327
|
|
- dt = BLL.PagerBLL.GetListPager(
|
|
328
|
|
- "T_Call_CallRecords WITH(NOLOCK)",
|
|
329
|
|
- "CallRecordsId",
|
|
330
|
|
- "*",
|
|
331
|
|
- sql,
|
|
332
|
|
- "ORDER BY CallRecordsId desc",
|
|
333
|
|
- pagesize,
|
|
334
|
|
- pageindex,
|
|
335
|
|
- true,
|
|
336
|
|
- out recordCount);
|
|
337
|
|
-
|
|
338
|
|
- List<Model.T_Call_CallRecords> callList = new BLL.T_Call_CallRecords().DataTableToList(dt);
|
|
339
|
|
-
|
|
340
|
|
- var obj = new
|
|
341
|
|
- {
|
|
342
|
|
- state = "success",
|
|
343
|
|
- message = "成功",
|
|
344
|
|
- rows = callList,
|
|
345
|
|
- total = recordCount
|
|
346
|
|
- };
|
|
347
|
|
-
|
|
348
|
|
- return Content(obj.ToJson());
|
|
|
350
|
+
|
|
|
351
|
+
|
|
|
352
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
353
|
+ "T_Call_CallRecords WITH(NOLOCK)",
|
|
|
354
|
+ "CallRecordsId",
|
|
|
355
|
+ "*",
|
|
|
356
|
+ sql,
|
|
|
357
|
+ "ORDER BY CallRecordsId desc",
|
|
|
358
|
+ pagesize,
|
|
|
359
|
+ pageindex,
|
|
|
360
|
+ true,
|
|
|
361
|
+ out recordCount);
|
|
|
362
|
+
|
|
|
363
|
+ List<Model.T_Call_CallRecords> callList = new BLL.T_Call_CallRecords().DataTableToList(dt);
|
|
|
364
|
+
|
|
|
365
|
+ var obj = new
|
|
|
366
|
+ {
|
|
|
367
|
+ state = "success",
|
|
|
368
|
+ message = "成功",
|
|
|
369
|
+ rows = callList,
|
|
|
370
|
+ total = recordCount
|
|
|
371
|
+ };
|
|
|
372
|
+
|
|
|
373
|
+ return Content(obj.ToJson());
|
|
|
374
|
+
|
|
|
375
|
+
|
|
349
|
376
|
|
|
350
|
377
|
}
|
|
351
|
378
|
|