|
|
@@ -2,6 +2,7 @@
|
|
2
|
2
|
using CallCenterApi.Common;
|
|
3
|
3
|
using CallCenterApi.DB;
|
|
4
|
4
|
using CallCenterApi.Interface.Controllers.Base;
|
|
|
5
|
+using CallCenterApi.Interface.Models.Dto;
|
|
5
|
6
|
using System;
|
|
6
|
7
|
using System.Collections.Generic;
|
|
7
|
8
|
using System.Data;
|
|
|
@@ -17,6 +18,7 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
17
|
18
|
public class CallrecordsController : BaseController
|
|
18
|
19
|
{
|
|
19
|
20
|
private readonly BLL.T_Sys_Department deptBLL = new BLL.T_Sys_Department();
|
|
|
21
|
+ private readonly BLL.T_Call_CallRecords callRecordBLL = new BLL.T_Call_CallRecords();
|
|
20
|
22
|
//获取通话记录列表
|
|
21
|
23
|
public ActionResult GetList(string phone, string usercode)
|
|
22
|
24
|
{
|
|
|
@@ -40,12 +42,12 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
40
|
42
|
string strpagesize = RequestString.GetQueryString("pagesize");
|
|
41
|
43
|
int pagesize = 10;
|
|
42
|
44
|
|
|
43
|
|
- //17=系统管理员,36=客服,37=组长,38=组员,39=业主,40=话务员,41=客服主管,43=分公司市场部主任,45=业务稽核,46=集团客户部,
|
|
44
|
|
- //47 =网络部,48=市场部经理,50=业务支撑中心,51=市场部,52=客户服务中心,53=总经理,54=副总经理,55=业务负责人,56=投诉处理员,57=基础业务主管,
|
|
|
45
|
+ //36 = 旗区分公司客户经理,37 = 组长,38 = 组员,39 = 分公司社会渠道业主,40 = 分公司自营渠道话务员,41 = 分公司客服主管,43 = 分公司市场部主任,
|
|
|
46
|
+ //45 = 分公司业务稽核,46 = 市公司集团客户部,47 = 市公司网络部,48 = 市场部客服中心经理,50 = 市公司业务支撑中心,51 = 市公司业务负责人,52 = 客户服务中心,
|
|
|
47
|
+ //53 = 分公司总经理,54 = 分公司副总经理,55 = 分公司业务负责人,56 = 分公司投诉处理员,57 = 分公司基础业务主管,58 = 社会渠道话务员,60 = 市公司市场部经理,
|
|
45
|
48
|
|
|
46
|
|
- //var deptCodeObj = DbHelperSQL.GetSingle($"with cte(F_DeptId,F_ParentId,F_DeptCode,F_Layer,lvl) as( select F_DeptId,F_ParentId,F_DeptCode,F_Layer,0 lvl from T_Sys_Department where F_DeptId={deptid} union all select dept.F_DeptId,dept.F_ParentId,dept.F_DeptCode,dept.F_Layer,lvl+1 from T_Sys_Department dept inner join cte on dept.F_DeptId = cte.F_ParentId) select top 1 F_DeptId,F_DeptCode from cte where F_Layer=1 order by lvl");
|
|
47
|
|
- //var deptCurrentCompany = deptList.Where(x => x.Layer == 1).OrderByDescending(x => x.Level).FirstOrDefault();
|
|
48
|
|
- //var deptModelCode = deptCodeObj?.ToString() ?? "";
|
|
|
49
|
+ var depts = deptBLL.DataTableToListForLevel(DbHelperSQL.Query($"with cte(F_DeptId,F_DeptName,F_ParentId,F_DeptCode,F_Layer,lvl) as( select F_DeptId,F_DeptName,F_ParentId,F_DeptCode,F_Layer,0 lvl from T_Sys_Department union all select dept.F_DeptId,dept.F_DeptName,dept.F_ParentId,dept.F_DeptCode,dept.F_Layer,lvl+1 from T_Sys_Department dept inner join cte on dept.F_DeptId = cte.F_ParentId) select F_DeptId,F_ParentId,F_DeptName,F_DeptCode,F_Layer,lvl from cte ").Tables[0]);
|
|
|
50
|
+ var deptCompany = depts.Where(x => x.Layer == 1).OrderBy(x => x.Level).FirstOrDefault();
|
|
49
|
51
|
if (roleid != 0)
|
|
50
|
52
|
{
|
|
51
|
53
|
if (roleid != 17)
|
|
|
@@ -53,14 +55,13 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
53
|
55
|
//各分公司
|
|
54
|
56
|
if (deptCode.Replace("|0|1|", "").Length > 0)
|
|
55
|
57
|
{
|
|
56
|
|
- if (roleid == 36 || roleid == 38 || roleid == 40)
|
|
|
58
|
+ if (roleid == 36 || roleid == 38 || roleid == 40 || roleid == 58)
|
|
57
|
59
|
{
|
|
58
|
|
- usercode = CurrentUser.UserData.F_UserCode;
|
|
59
|
|
- sql += " and UserCode='" + usercode + "'";
|
|
|
60
|
+ sql += " and UserCode='" + CurrentUser.UserData.F_UserCode + "'";
|
|
60
|
61
|
}
|
|
61
|
62
|
else
|
|
62
|
63
|
{
|
|
63
|
|
- sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptID in (select F_DeptId from T_Sys_Department where F_DeptCode like '" + deptCode + "%')) ";
|
|
|
64
|
+ sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptID in (select F_DeptId from T_Sys_Department where F_DeptCode like '" + (deptCompany?.DeptCode ?? deptCode) + "%')) ";
|
|
64
|
65
|
}
|
|
65
|
66
|
}
|
|
66
|
67
|
//总公司
|
|
|
@@ -124,21 +125,23 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
124
|
125
|
}
|
|
125
|
126
|
int recordCount = 0;
|
|
126
|
127
|
dt = BLL.PagerBLL.GetListPager(
|
|
127
|
|
- "T_Call_CallRecords left join T_Sys_UserAccount ON T_Sys_UserAccount.F_UserCode=T_Call_CallRecords.UserCode left join T_Sys_Department ON T_Sys_UserAccount.F_DeptId=T_Sys_Department.F_DeptId ",
|
|
|
128
|
+ "T_Call_CallRecords",
|
|
128
|
129
|
"CallRecordsId",
|
|
129
|
|
- "*,T_Sys_UserAccount.F_UserName,T_Sys_Department.F_DeptName,(SELECT F_DeptName from T_Sys_Department t where t.F_DeptId=T_Sys_Department.F_ParentId) as ParentName ",
|
|
|
130
|
+ "*",
|
|
130
|
131
|
sql,
|
|
131
|
132
|
"ORDER BY CallRecordsId desc",
|
|
132
|
133
|
pagesize,
|
|
133
|
134
|
pageindex,
|
|
134
|
135
|
true,
|
|
135
|
136
|
out recordCount);
|
|
136
|
|
-
|
|
|
137
|
+ var callRecordList = callRecordBLL.DataTableToList(dt);
|
|
137
|
138
|
var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
138
|
139
|
var users = new BLL.T_Sys_UserAccount().GetModelList("");
|
|
139
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
140
|
+ 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]);
|
|
|
141
|
+ var resList = new List<CallRecordDto>();
|
|
|
142
|
+ foreach (var item in callRecordList)
|
|
140
|
143
|
{
|
|
141
|
|
- string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
|
|
|
144
|
+ string path = item.FilePath ?? "";
|
|
142
|
145
|
if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
143
|
146
|
{
|
|
144
|
147
|
var ym = config.F_ParamValue;
|
|
|
@@ -146,26 +149,58 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
146
|
149
|
{
|
|
147
|
150
|
ym = ym.Substring(0, ym.Length - 1);
|
|
148
|
151
|
}
|
|
149
|
|
- dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
|
152
|
+ item.FilePath = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
150
|
153
|
}
|
|
151
|
|
- string ucode = dr["UserCode"] != null ? dr["UserCode"].ToString() : "";
|
|
152
|
|
- string uname = dr["UserName"] != null ? dr["UserName"].ToString() : "";
|
|
153
|
|
- if (ucode != "")
|
|
|
154
|
+ string ucode = item.UserCode ?? "";
|
|
|
155
|
+ string uname = item.UserName ?? "";
|
|
|
156
|
+ Model.T_Sys_UserAccount uu = null;
|
|
|
157
|
+ uu = users.Where(u => u.F_UserCode.Equals(item.UserCode)).FirstOrDefault();
|
|
|
158
|
+ if (uu != null)
|
|
|
159
|
+ item.UserName = uu.F_UserName;
|
|
|
160
|
+
|
|
|
161
|
+ Model.T_Sys_DepartmentLevel deptCategory = new Model.T_Sys_DepartmentLevel();
|
|
|
162
|
+ Model.T_Sys_DepartmentLevel channelCategory = new Model.T_Sys_DepartmentLevel();
|
|
|
163
|
+ if (uu != null)
|
|
154
|
164
|
{
|
|
155
|
|
- if (uname == "")
|
|
156
|
|
- {
|
|
157
|
|
- var uu = users.Where(u => u.F_UserCode.Equals(ucode)).FirstOrDefault();
|
|
158
|
|
- if (uu != null)
|
|
159
|
|
- dr["UserName"] = uu.F_UserName;
|
|
160
|
|
- }
|
|
|
165
|
+ var depId = uu.F_DeptId;
|
|
|
166
|
+ channelCategory = deptList.SingleOrDefault(x => x.Layer == 3 && x.DeptId == depId);
|
|
|
167
|
+ deptCategory = deptList.SingleOrDefault(x => x.Layer == 2 && (channelCategory?.ParentId ?? 0) == x.DeptId);
|
|
|
168
|
+
|
|
|
169
|
+
|
|
161
|
170
|
}
|
|
|
171
|
+
|
|
|
172
|
+
|
|
|
173
|
+ resList.Add(new CallRecordDto
|
|
|
174
|
+ {
|
|
|
175
|
+ CallId = item.CallId,
|
|
|
176
|
+ CallNumber = item.CallNumber,
|
|
|
177
|
+ FilePath = item.FilePath,
|
|
|
178
|
+ CallType = item.CallType,
|
|
|
179
|
+ DealType = item.DealType,
|
|
|
180
|
+ CallState = item.CallState,
|
|
|
181
|
+ IsDeal = item.IsDeal,
|
|
|
182
|
+ UserCode = item.UserCode,
|
|
|
183
|
+ UserName = item.UserName,
|
|
|
184
|
+ BeginTime = item.BeginTime,
|
|
|
185
|
+ RingStartTime = item.RingStartTime,
|
|
|
186
|
+ TalkStartTime = item.TalkStartTime,
|
|
|
187
|
+ TalkEndTime = item.TalkEndTime,
|
|
|
188
|
+ RingLongTime = item.RingLongTime,
|
|
|
189
|
+ TalkLongTime = item.TalkLongTime,
|
|
|
190
|
+ CompanyName = deptCompany?.DeptName ?? "",
|
|
|
191
|
+ CategoryName = deptCategory?.DeptName ?? "",
|
|
|
192
|
+ ChannelName = channelCategory?.DeptName ?? "",
|
|
|
193
|
+ });
|
|
|
194
|
+
|
|
162
|
195
|
}
|
|
163
|
196
|
|
|
|
197
|
+
|
|
|
198
|
+
|
|
164
|
199
|
var obj = new
|
|
165
|
200
|
{
|
|
166
|
201
|
state = "success",
|
|
167
|
202
|
message = "成功",
|
|
168
|
|
- rows = dt,
|
|
|
203
|
+ rows = resList,
|
|
169
|
204
|
total = recordCount
|
|
170
|
205
|
};
|
|
171
|
206
|
|
|
|
@@ -195,43 +230,28 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
195
|
230
|
string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
|
|
196
|
231
|
string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
|
|
197
|
232
|
|
|
|
233
|
+
|
|
|
234
|
+ //36 = 旗区分公司客户经理,37 = 组长,38 = 组员,39 = 分公司社会渠道业主,40 = 分公司自营渠道话务员,41 = 分公司客服主管,43 = 分公司市场部主任,
|
|
|
235
|
+ //45 = 分公司业务稽核,46 = 市公司集团客户部,47 = 市公司网络部,48 = 市场部客服中心经理,50 = 市公司业务支撑中心,51 = 市公司业务负责人,52 = 客户服务中心,
|
|
|
236
|
+ //53 = 分公司总经理,54 = 分公司副总经理,55 = 分公司业务负责人,56 = 分公司投诉处理员,57 = 分公司基础业务主管,58 = 社会渠道话务员,60 = 市公司市场部经理,
|
|
|
237
|
+
|
|
|
238
|
+ var depts = deptBLL.DataTableToListForLevel(DbHelperSQL.Query($"with cte(F_DeptId,F_DeptName,F_ParentId,F_DeptCode,F_Layer,lvl) as( select F_DeptId,F_DeptName,F_ParentId,F_DeptCode,F_Layer,0 lvl from T_Sys_Department union all select dept.F_DeptId,dept.F_DeptName,dept.F_ParentId,dept.F_DeptCode,dept.F_Layer,lvl+1 from T_Sys_Department dept inner join cte on dept.F_DeptId = cte.F_ParentId) select F_DeptId,F_ParentId,F_DeptName,F_DeptCode,F_Layer,lvl from cte ").Tables[0]);
|
|
|
239
|
+ var deptCompany = depts.Where(x => x.Layer == 1).OrderBy(x => x.Level).FirstOrDefault();
|
|
|
240
|
+
|
|
198
|
241
|
if (roleid != 0)
|
|
199
|
242
|
{
|
|
200
|
243
|
if (roleid != 17)
|
|
201
|
244
|
{
|
|
202
|
|
- //if (deptcode.IndexOf("|533|") > 0)
|
|
203
|
|
- //{
|
|
204
|
|
- // sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + deptid + ")";
|
|
205
|
|
- //}
|
|
206
|
|
- //if (deptcode.IndexOf("|531|") > 0)
|
|
207
|
|
- //{
|
|
208
|
|
- // if (roleid == 32)
|
|
209
|
|
- // {
|
|
210
|
|
- // usercode = CurrentUser.UserData.F_UserCode;
|
|
211
|
|
- // sql += " and UserCode='" + usercode + "'";
|
|
212
|
|
- // }
|
|
213
|
|
- // else
|
|
214
|
|
- // {
|
|
215
|
|
- // sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptID in (select F_DeptId from T_Sys_Department where F_DeptCode like '" + deptcode + "%')) ";
|
|
216
|
|
- // }
|
|
217
|
|
- //}
|
|
218
|
|
- //else
|
|
219
|
|
- //{
|
|
220
|
|
- // sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + deptid + ")";
|
|
221
|
|
- //}
|
|
222
|
|
-
|
|
223
|
|
-
|
|
224
|
245
|
//各分公司
|
|
225
|
246
|
if (deptCode.Replace("|0|1|", "").Length > 0)
|
|
226
|
247
|
{
|
|
227
|
|
- if (roleid == 36 || roleid == 38 || roleid == 40)
|
|
|
248
|
+ if (roleid == 36 || roleid == 38 || roleid == 40 || roleid == 50)
|
|
228
|
249
|
{
|
|
229
|
|
- usercode = CurrentUser.UserData.F_UserCode;
|
|
230
|
|
- sql += " and UserCode='" + usercode + "'";
|
|
|
250
|
+ sql += " and UserCode='" + CurrentUser.UserData.F_UserCode + "'";
|
|
231
|
251
|
}
|
|
232
|
252
|
else
|
|
233
|
253
|
{
|
|
234
|
|
- sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptID in (select F_DeptId from T_Sys_Department where F_DeptCode like '" + deptCode + "%')) ";
|
|
|
254
|
+ sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptID in (select F_DeptId from T_Sys_Department where F_DeptCode like '" + (deptCompany?.DeptCode ?? deptCode) + "%')) ";
|
|
235
|
255
|
}
|
|
236
|
256
|
}
|
|
237
|
257
|
}
|
|
|
@@ -291,6 +311,11 @@ namespace CallCenterApi.Interface.Controllers.tel
|
|
291
|
311
|
string[] ccc = {
|
|
292
|
312
|
"电话号码","呼叫方向","呼叫状态","是否处理","坐席工号","坐席姓名",
|
|
293
|
313
|
"开始时间","通话开始时间","通话结束时间","结束时间","通话时长"
|
|
|
314
|
+ //号码、呼叫方向、呼叫状态、坐席工号、坐席姓名、
|
|
|
315
|
+ //分机号、所属公司、分类、渠道名称、
|
|
|
316
|
+ //开始通话时间、结束通话时间、通话时长。
|
|
|
317
|
+
|
|
|
318
|
+
|
|
294
|
319
|
};
|
|
295
|
320
|
return ccc;
|
|
296
|
321
|
}
|