瀏覽代碼

通话记录导出增加客户姓名

MicroWin10-1604\Administrator 7 年之前
父節點
當前提交
c62ccd6922

+ 6 - 1
codegit/CallCenterApi/CallCenterApi.DAL/T_Call_CallRecords.cs

@@ -992,7 +992,12 @@ namespace CallCenterApi.DAL
992 992
         public DataSet GetListExpt(string strWhere)
993 993
         {
994 994
             StringBuilder strSql = new StringBuilder();
995
-            strSql.Append(" select callnumber,filepath,");
995
+            strSql.Append(" select ");
996
+            //20180523 通话记录导出增加客户姓名
997
+            strSql.Append(" (select d.F_CustomerName from T_Cus_CustomerBase d ");
998
+            strSql.Append(" where d.F_Telephone=c.CallNumber) cusname, ");
999
+            strSql.Append(" callnumber, ");
1000
+            strSql.Append("filepath,");
996 1001
             strSql.Append(" case calltype when 1 then '呼出' else '呼入' end calltypes, ");
997 1002
             strSql.Append(" (select d.f_deptName from T_Sys_UserAccount u,[dbo].[T_Sys_Department] d ");
998 1003
             strSql.Append(" where u.F_DeptId=d.F_DeptId and u.F_UserCode= c.UserCode) udept, ");

+ 64 - 19
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -188,6 +188,7 @@ namespace CallCenterApi.Interface.Controllers.tel
188 188
                 int userid = CurrentUser.UserData.F_UserId;
189 189
                 int roleid = CurrentUser.UserData.F_RoleId;
190 190
                 int deptid = CurrentUser.UserData.F_DeptId;
191
+                string currcode = CurrentUser.UserData.F_UserCode;
191 192
                 string deptcode = CurrentUser.UserData.F_DeptCode;
192 193
                 string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
193 194
                 string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
@@ -195,28 +196,72 @@ namespace CallCenterApi.Interface.Controllers.tel
195 196
                 string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
196 197
                 string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
197 198
 
198
-                if (roleid != 0)
199
+                //if (roleid != 0)
200
+                //{
201
+                //    if (roleid != 17)
202
+                //    {
203
+                //        if (deptcode.IndexOf("|533|") > 0)
204
+                //        {
205
+                //            sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + deptid + ")";
206
+                //        }
207
+                //        if (deptcode.IndexOf("|531|") > 0)
208
+                //        {
209
+                //            if (roleid == 32)
210
+                //            {
211
+                //                usercode = CurrentUser.UserData.F_UserCode;
212
+                //                sql += " and UserCode='" + usercode + "'";
213
+                //            }
214
+                //            else
215
+                //            {
216
+                //                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 + "%')) ";
217
+                //            }
218
+                //        }
219
+                //    }
220
+                //}
221
+
222
+                //if (usercode != null && usercode.Trim() != "")
223
+                //{
224
+                //    sql += " and UserCode='" + usercode + "'";
225
+                //}
226
+                //if (dept != null && dept.Trim() != "")
227
+                //{
228
+                //    sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + dept.Trim() + ")";
229
+                //}
230
+                //if (phone != null && phone.Trim() != "")
231
+                //{
232
+                //    sql += " and CallNumber like '%" + phone + "%'";
233
+                //}
234
+                //if (callstate.Trim() != "")
235
+                //{
236
+                //    sql += " and CallState='" + callstate + "'";
237
+                //}
238
+                //if (calltype.Trim() != "")
239
+                //{
240
+                //    sql += " and CallType='" + calltype + "'";
241
+                //}
242
+                //if (starttime.Trim() != "")
243
+                //{
244
+                //    sql += " and datediff(day,BeginTime,'" + starttime + "')<=0 ";
245
+                //}
246
+                //if (endtime.Trim() != "")
247
+                //{
248
+                //    sql += " and datediff(day,BeginTime,'" + endtime + "')>=0 ";
249
+                //}
250
+                //20180515 坐席能看到同组的 
251
+                var usergroup = new BLL.T_Sys_UserAccount().GetModel(currcode) == null ? "" : new BLL.T_Sys_UserAccount().GetModel(currcode).F_SeartGroup;
252
+                var usercodes = new BLL.T_Sys_UserAccount().GetModelList("F_SeartGroup='" + usergroup + "'") == null ? null : new BLL.T_Sys_UserAccount().GetModelList("F_SeartGroup='" + usergroup + "'").Select(p => p.F_UserCode);
253
+                var str = "";
254
+                if (usercodes != null)
199 255
                 {
200
-                    if (roleid != 17)
256
+                    foreach (var item in usercodes)
201 257
                     {
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
-                        }
258
+                        str += item.ToString() + ',';
218 259
                     }
260
+                    str = str.TrimEnd(',');
261
+                    sql += " and UserCode in (" + str + ") ";
219 262
                 }
263
+                else
264
+                    sql += " and UserCode='" + usercode + "' ";
220 265
 
221 266
                 if (usercode != null && usercode.Trim() != "")
222 267
                 {
@@ -266,7 +311,7 @@ namespace CallCenterApi.Interface.Controllers.tel
266 311
         private string[] col()
267 312
         {
268 313
             string[] ccc = {
269
-                   "电话号码","录音","呼叫方向","部门","呼叫状态","坐席工号","坐席姓名",
314
+                   "客户姓名","电话号码","录音","呼叫方向","部门","呼叫状态","坐席工号","坐席姓名",
270 315
                   "开始时间","通话开始时间","通话结束时间","通话时长"
271 316
             };
272 317
             return ccc;