zhoufan лет назад: 7
Родитель
Сommit
3d2ea94489

+ 20 - 16
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IndexController.cs

@@ -166,8 +166,7 @@ namespace CallCenterApi.Interface.Controllers
166 166
             if (Request.IsAuthenticated)
167 167
             {
168 168
                 int userId = CurrentUser.UserData.F_UserId;
169
-                string usercode = CurrentUser.UserData.F_UserCode;
170
-                int roleid = CurrentUser.UserData.F_RoleId;
169
+                Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
171 170
                 if (userId != 0)
172 171
                 {
173 172
                     var date = DateTime.Now;
@@ -175,25 +174,30 @@ namespace CallCenterApi.Interface.Controllers
175 174
                     string strMonth = date.ToString("yyyy-MM");
176 175
 
177 176
                     string uwhere = " 1=1 ";
178
-                    if (roleid != 17)
177
+                    if (userModel.rolecode != "XTGLY")
179 178
                     {
180
-                        uwhere += " and UserCode='" + usercode + "' ";
179
+                        uwhere += " and UserCode='" + userModel.F_UserCode + "' ";
180
+                    }
181
+
182
+                    if (!string.IsNullOrEmpty(userModel.groupcode))
183
+                    {
184
+                        uwhere += " and groupcode = '" + userModel.groupcode + "' ";
181 185
                     }
182 186
 
183 187
                     BLL.T_Call_CallRecords bll = new BLL.T_Call_CallRecords();
184
-                    //var dayinlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='1' ");
185
-                    //var dayoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='1' ");
186
-                    //var moninlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' and CallState='1' ");
187
-                    //var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' and CallState='1' ");
188
-                    //int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' and CallState='0' ").Tables[0].Rows.Count;
188
+                    var dayinlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='1' ");
189
+                    var dayoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='1' ");
190
+                    var moninlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' and CallState='1' ");
191
+                    var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' and CallState='1' ");
192
+                    int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' and CallState='0' ").Tables[0].Rows.Count;
189 193
 
190
-                    //2018-05-03 lihai 首页统计问题
191
-                    var dayinlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
192
-                    var dayoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
193
-                    var moninlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
194
-                    var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
194
+                    ////2018-05-03 lihai 首页统计问题
195
+                    //var dayinlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
196
+                    //var dayoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
197
+                    //var moninlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
198
+                    //var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
195 199
 
196
-                    int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' ").Tables[0].Rows.Count;
200
+                    //int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='0' ").Tables[0].Rows.Count;
197 201
 
198 202
                     var obj = new
199 203
                     {
@@ -201,7 +205,7 @@ namespace CallCenterApi.Interface.Controllers
201 205
                         dayout = new { count = dayoutlist.Count, totaltime = DateTimeConvert.parseTimeSeconds(int.Parse(dayoutlist.Select(p => p.TalkLongTime).Sum().ToString()), 0) },
202 206
                         monin = new { count = moninlist.Count, totaltime = DateTimeConvert.parseTimeSeconds(int.Parse(moninlist.Select(p => p.TalkLongTime).Sum().ToString()),0) },
203 207
                         monout = new { count = monoutlist.Count, totaltime = DateTimeConvert.parseTimeSeconds(int.Parse(monoutlist.Select(p => p.TalkLongTime).Sum().ToString()),0) },
204
-                        daynocon = daynocon
208
+                        daynocon
205 209
                     };
206 210
                     res = Success("成功", obj);
207 211
                 }

+ 9 - 103
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -17,24 +17,11 @@ namespace CallCenterApi.Interface.Controllers.tel
17 17
         //获取通话记录列表
18 18
         public ActionResult GetList(string phone, string usercode)
19 19
         {
20
-            //ActionResult res = NoToken("未知错误,请重新登录");
21
-            //if (Request.IsAuthenticated)
22
-            //{              
20
+            int userId = CurrentUser.UserData.F_UserId;
21
+            Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
23 22
 
24
-            //}
25
-            //return res;
26 23
             string sql = "";
27
-            int roleid = 0, deptid = 0;
28
-            string currcode = string.Empty;
29
-            string deptcode = string.Empty;
30
-            DataTable dt = new DataTable();
31
-            if (Request.IsAuthenticated)
32
-            {
33
-                roleid = CurrentUser.UserData.F_RoleId;
34
-                currcode = CurrentUser.UserData.F_UserCode;
35
-                deptid = CurrentUser.UserData.F_DeptId;
36
-                deptcode = CurrentUser.UserData.F_DeptCode;
37
-            }
24
+            
38 25
             string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
39 26
             string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
40 27
             string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
@@ -47,73 +34,10 @@ namespace CallCenterApi.Interface.Controllers.tel
47 34
             string strpagesize = RequestString.GetQueryString("pagesize");
48 35
             int pagesize = 10;
49 36
 
50
-            //if (roleid != 0)
51
-            //{
52
-            //    if (roleid != 17)
53
-            //    {
54
-            //        if (deptcode.IndexOf("|533|") > 0)
55
-            //        {
56
-            //            sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + deptid + ")";
57
-            //        }
58
-            //        if (deptcode.IndexOf("|531|") > 0)
59
-            //        {
60
-            //            if (roleid == 32)
61
-            //            {
62
-            //                usercode = CurrentUser.UserData.F_UserCode;
63
-            //                sql += " and UserCode='" + usercode + "'";
64
-            //            }
65
-            //            else
66
-            //            {
67
-            //                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 + "%')) ";
68
-            //            }
69
-            //        }
70
-            //    }
71
-            //}
72
-            ////20180515 坐席能看到同组的 
73
-            //var usergroup = new BLL.T_Sys_UserAccount().GetModel(currcode) == null ? "" : new BLL.T_Sys_UserAccount().GetModel(currcode).F_SeartGroup;
74
-            //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);
75
-            //var str = "";
76
-            //if (usercodes != null)
77
-            //{
78
-            //    foreach (var item in usercodes)
79
-            //    {
80
-            //        str += item.ToString() + ',';
81
-            //    }
82
-            //    str = str.TrimEnd(',');
83
-            //    sql += " and UserCode in (" + str + ") ";
84
-            //}
85
-            //else
86
-            //    sql += " and UserCode='" + usercode + "' ";
87
-            #region 2018-05-30 lihai 坐席能看到同组的通话记录
88
-            int seartGroupId = 0;
89
-            var modelUser = new BLL.T_Sys_UserAccount().GetModel(currcode);
90
-            if (modelUser != null)
91
-                seartGroupId = modelUser.F_SeartGroupID ?? 0;
92
-            if (seartGroupId != 0)
37
+            if (!string.IsNullOrEmpty(userModel.groupcode))
93 38
             {
94
-                //groupcode判断是市场部或客服部的通话记录
95
-                var modelSeartGroup = new BLL.T_Sys_SeatGroup().GetModel(seartGroupId);
96
-                if (modelSeartGroup != null)
97
-                {
98
-                    sql += " and groupcode = '" + modelSeartGroup.F_ZXZCode + "' ";
99
-                    //if (modelSeartGroup.F_ZXZCode == "SCZ")
100
-                    //{
101
-                    //    sql += " and groupcode = 'SCZ' ";
102
-                    //}
103
-                    //else
104
-                    //{
105
-                    //    sql += " and groupcode = 'KFZ' ";
106
-                    //}
107
-                }
108
-                //else
109
-                //    sql += " and UserCode='" + usercode + "' ";
39
+                sql += " and groupcode = '" + userModel.groupcode + "' ";
110 40
             }
111
-            //else
112
-            //{
113
-            //    //找不到对应坐席组
114
-            //    sql += " and UserCode='" + usercode + "' ";
115
-            //}
116
-            #endregion
117 41
 
118 42
             if (usercode != null && usercode.Trim() != "")
119 43
             {
@@ -121,7 +45,7 @@ namespace CallCenterApi.Interface.Controllers.tel
121 45
             }
122 46
             if (dept != null && dept.Trim() != "")
123 47
             {
124
-                sql += " and UserCode in (select F_UserCode from T_Sys_UserAccount where F_DeptId=" + dept.Trim() + ")";
48
+                sql += " and F_DeptId='" + dept.Trim() + "'";
125 49
             }
126 50
             if (dealtype != null && dealtype.Trim() != "")
127 51
             {
@@ -159,10 +83,10 @@ namespace CallCenterApi.Interface.Controllers.tel
159 83
                 pagesize = Convert.ToInt32(strpagesize);
160 84
             }
161 85
             int recordCount = 0;
162
-            dt = BLL.PagerBLL.GetListPager(
163
-                "T_Call_CallRecords left join T_Sys_UserAccount on UserCode=F_UserCode",
86
+            DataTable dt = BLL.PagerBLL.GetListPager(
87
+                "T_Call_CallRecords left join T_Sys_UserAccount on UserCode=F_UserCode  ",
164 88
                 "CallRecordsId",
165
-                "T_Call_CallRecords.*,T_Sys_UserAccount.F_SeartGroup",
89
+                "T_Call_CallRecords.*,T_Sys_UserAccount.F_UserName as UserName,T_Sys_UserAccount.F_SeartGroup,T_Sys_UserAccount.F_DeptId",
166 90
                 sql,
167 91
                 "ORDER BY CallRecordsId desc",
168 92
                 pagesize,
@@ -188,24 +112,6 @@ namespace CallCenterApi.Interface.Controllers.tel
188 112
                     }
189 113
                     dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
190 114
                 }
191
-                string ucode = dr["UserCode"] != null ? dr["UserCode"].ToString() : "";
192
-                string uname = dr["UserName"] != null ? dr["UserName"].ToString() : "";
193
-                if (ucode != "")
194
-                {
195
-                    if (uname == "")
196
-                    {
197
-                        var uu = users.Where(u => u.F_UserCode.Equals(ucode)).FirstOrDefault();
198
-                        if (uu != null)
199
-                            dr["UserName"] = uu.F_UserName;
200
-                    }
201
-                }
202
-                var modelCustomer = listCustomer.FirstOrDefault(x => x.F_Telephone == dr["CallNumber"].ToString());
203
-                if (modelCustomer != null)
204
-                {
205
-                    dr["CusName"] = modelCustomer.F_CustomerName;           //客户姓名
206
-                    dr["CusDepName"] = modelCustomer.F_CustomerIndustry;    //来电单位
207
-                }
208
-                //dr["CusName"] = new BLL.T_Cus_CustomerBase().GetModelList("F_Telephone='" + dr["CallNumber"] + "' and F_DeleteFlag=0").FirstOrDefault() == null ? "" : new BLL.T_Cus_CustomerBase().GetModelList("F_Telephone='" + dr["CallNumber"] + "'").FirstOrDefault().F_CustomerName;
209 115
             }
210 116
 
211 117
             var obj = new