ソースを参照

增加话务日志,调整外线号码

zhengbingbing 7 年 前
コミット
c6b3168824

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.BLL/CallCenterApi.BLL.csproj

@@ -76,6 +76,7 @@
76 76
     <Compile Include="T_SMS_SendSMSTask.cs" />
77 77
     <Compile Include="T_SMS_SentSMS.cs" />
78 78
     <Compile Include="T_SMS_Template.cs" />
79
+    <Compile Include="T_Sys_CallOptLogs.cs" />
79 80
     <Compile Include="T_Sys_Department.cs" />
80 81
     <Compile Include="T_Sys_DictionaryBase.cs" />
81 82
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 158 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Sys_CallOptLogs.cs

@@ -0,0 +1,158 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace CallCenterApi.BLL
9
+{
10
+    /// <summary>
11
+	/// T_Sys_CallOptLogs
12
+	/// </summary>
13
+	public partial class T_Sys_CallOptLogs
14
+    {
15
+        private readonly CallCenterApi.DAL.T_Sys_CallOptLogs dal = new CallCenterApi.DAL.T_Sys_CallOptLogs();
16
+        public T_Sys_CallOptLogs()
17
+        { }
18
+        #region  BasicMethod
19
+        /// <summary>
20
+        /// 是否存在该记录
21
+        /// </summary>
22
+        public bool Exists(int F_Id)
23
+        {
24
+            return dal.Exists(F_Id);
25
+        }
26
+
27
+        /// <summary>
28
+        /// 增加一条数据
29
+        /// </summary>
30
+        public int Add(CallCenterApi.Model.T_Sys_CallOptLogs model)
31
+        {
32
+            return dal.Add(model);
33
+        }
34
+
35
+        /// <summary>
36
+        /// 更新一条数据
37
+        /// </summary>
38
+        public bool Update(CallCenterApi.Model.T_Sys_CallOptLogs model)
39
+        {
40
+            return dal.Update(model);
41
+        }
42
+
43
+        /// <summary>
44
+        /// 删除一条数据
45
+        /// </summary>
46
+        public bool Delete(int F_Id)
47
+        {
48
+
49
+            return dal.Delete(F_Id);
50
+        }
51
+        /// <summary>
52
+        /// 删除一条数据
53
+        /// </summary>
54
+        public bool DeleteList(string F_Idlist)
55
+        {
56
+            return dal.DeleteList(F_Idlist);
57
+        }
58
+
59
+        /// <summary>
60
+        /// 得到一个对象实体
61
+        /// </summary>
62
+        public CallCenterApi.Model.T_Sys_CallOptLogs GetModel(int F_Id)
63
+        {
64
+
65
+            return dal.GetModel(F_Id);
66
+        }
67
+
68
+        /// <summary>
69
+        /// 获得数据列表
70
+        /// </summary>
71
+        public DataSet GetList(string strWhere)
72
+        {
73
+            return dal.GetList(strWhere);
74
+        }
75
+        /// <summary>
76
+        /// 获得前几行数据
77
+        /// </summary>
78
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
79
+        {
80
+            return dal.GetList(Top, strWhere, filedOrder);
81
+        }
82
+        /// <summary>
83
+        /// 获得数据列表
84
+        /// </summary>
85
+        public List<CallCenterApi.Model.T_Sys_CallOptLogs> GetModelList(string strWhere)
86
+        {
87
+            DataSet ds = dal.GetList(strWhere);
88
+            return DataTableToList(ds.Tables[0]);
89
+        }
90
+        /// <summary>
91
+        /// 获得数据列表
92
+        /// </summary>
93
+        public List<CallCenterApi.Model.T_Sys_CallOptLogs> DataTableToList(DataTable dt)
94
+        {
95
+            List<CallCenterApi.Model.T_Sys_CallOptLogs> modelList = new List<CallCenterApi.Model.T_Sys_CallOptLogs>();
96
+            int rowsCount = dt.Rows.Count;
97
+            if (rowsCount > 0)
98
+            {
99
+                CallCenterApi.Model.T_Sys_CallOptLogs model;
100
+                for (int n = 0; n < rowsCount; n++)
101
+                {
102
+                    model = dal.DataRowToModel(dt.Rows[n]);
103
+                    if (model != null)
104
+                    {
105
+                        modelList.Add(model);
106
+                    }
107
+                }
108
+            }
109
+            return modelList;
110
+        }
111
+
112
+        /// <summary>
113
+        /// 获得数据列表
114
+        /// </summary>
115
+        public DataSet GetAllList()
116
+        {
117
+            return GetList("");
118
+        }
119
+
120
+        /// <summary>
121
+        /// 分页获取数据列表
122
+        /// </summary>
123
+        public int GetRecordCount(string strWhere)
124
+        {
125
+            return dal.GetRecordCount(strWhere);
126
+        }
127
+        /// <summary>
128
+        /// 分页获取数据列表
129
+        /// </summary>
130
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
131
+        {
132
+            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
133
+        }
134
+
135
+        #endregion  BasicMethod
136
+        #region  ExtensionMethod
137
+        /// <summary>
138
+        /// 添加操作日志
139
+        /// 参数:OptBy,OptName,type,fname,Descript
140
+        /// </summary>
141
+        public int AddCallLog(int iOptBy, string sOptName, string type, string fname, string sDescript,int state=0)
142
+        {
143
+            Model.T_Sys_CallOptLogs _model = new Model.T_Sys_CallOptLogs();
144
+
145
+            _model.F_OptBy = iOptBy;
146
+            _model.F_OptOn = DateTime.Now;
147
+            _model.F_OptName = sOptName;
148
+            _model.F_Descript = sDescript;
149
+            _model.F_Name = fname;
150
+            _model.F_Type = type;
151
+            _model.F_State = state;
152
+
153
+            return dal.Add(_model);
154
+        }
155
+        
156
+        #endregion  ExtensionMethod
157
+    }
158
+}

+ 14 - 6
codegit/CallCenterApi/CallCenterApi.Common/DTRequest.cs

@@ -370,13 +370,21 @@ namespace CallCenterApi.Common
370 370
         /// <returns>当前页面客户端的IP</returns>
371 371
         public static string GetIP()
372 372
         {
373
-            string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
374
-            if (string.IsNullOrEmpty(result))
375
-                result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
376
-            if (string.IsNullOrEmpty(result))
373
+            string result = String.Empty;
374
+            result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
375
+            if (null == result || result == String.Empty)
376
+            {
377
+                result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
378
+            }
379
+            if (null == result || result == String.Empty)
380
+            {
377 381
                 result = HttpContext.Current.Request.UserHostAddress;
378
-            if (string.IsNullOrEmpty(result) || !Utils.IsIP(result))
379
-                return "127.0.0.1";
382
+            }
383
+            result = result == "::1" ? "127.0.0.1" : result;
384
+            if (null == result || result == String.Empty || !Utils.IsIP(result))
385
+            {
386
+                return "0.0.0.0";
387
+            }
380 388
             return result;
381 389
         }
382 390
     }

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.DAL/CallCenterApi.DAL.csproj

@@ -76,6 +76,7 @@
76 76
     <Compile Include="T_SMS_SendSMSTask.cs" />
77 77
     <Compile Include="T_SMS_SentSMS.cs" />
78 78
     <Compile Include="T_SMS_Template.cs" />
79
+    <Compile Include="T_Sys_CallOptLogs.cs" />
79 80
     <Compile Include="T_Sys_Department.cs" />
80 81
     <Compile Include="T_Sys_DictionaryBase.cs" />
81 82
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 330 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Sys_CallOptLogs.cs

@@ -0,0 +1,330 @@
1
+using CallCenterApi.DB;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Data.SqlClient;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+
10
+namespace CallCenterApi.DAL
11
+{
12
+    /// <summary>
13
+	/// 数据访问类:T_Sys_CallOptLogs
14
+	/// </summary>
15
+	public partial class T_Sys_CallOptLogs
16
+    {
17
+        public T_Sys_CallOptLogs()
18
+        { }
19
+        #region  BasicMethod
20
+        /// <summary>
21
+        /// 是否存在该记录
22
+        /// </summary>
23
+        public bool Exists(int F_Id)
24
+        {
25
+            StringBuilder strSql = new StringBuilder();
26
+            strSql.Append("select count(1) from T_Sys_CallOptLogs");
27
+            strSql.Append(" where F_Id=@F_Id");
28
+            SqlParameter[] parameters = {
29
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
30
+            };
31
+            parameters[0].Value = F_Id;
32
+
33
+            return DbHelperSQL.Exists(strSql.ToString(), parameters);
34
+        }
35
+
36
+
37
+        /// <summary>
38
+        /// 增加一条数据
39
+        /// </summary>
40
+        public int Add(CallCenterApi.Model.T_Sys_CallOptLogs model)
41
+        {
42
+            StringBuilder strSql = new StringBuilder();
43
+            strSql.Append("insert into T_Sys_CallOptLogs(");
44
+            strSql.Append("F_OptBy,F_OptOn,F_OptName,F_Type,F_Name,F_Descript,F_State,F_OptTime)");
45
+            strSql.Append(" values (");
46
+            strSql.Append("@F_OptBy,@F_OptOn,@F_OptName,@F_Type,@F_Name,@F_Descript,@F_State,@F_OptTime)");
47
+            strSql.Append(";select @@IDENTITY");
48
+            SqlParameter[] parameters = {
49
+                    new SqlParameter("@F_OptBy", SqlDbType.Int,4),
50
+                    new SqlParameter("@F_OptOn", SqlDbType.DateTime),
51
+                    new SqlParameter("@F_OptName", SqlDbType.NVarChar,50),
52
+                    new SqlParameter("@F_Type", SqlDbType.NVarChar,50),
53
+                    new SqlParameter("@F_Name", SqlDbType.NVarChar,50),
54
+                    new SqlParameter("@F_Descript", SqlDbType.NVarChar,2000),
55
+                    new SqlParameter("@F_State", SqlDbType.SmallInt,2),
56
+                    new SqlParameter("@F_OptTime", SqlDbType.Int,4)};
57
+            parameters[0].Value = model.F_OptBy;
58
+            parameters[1].Value = model.F_OptOn;
59
+            parameters[2].Value = model.F_OptName;
60
+            parameters[3].Value = model.F_Type;
61
+            parameters[4].Value = model.F_Name;
62
+            parameters[5].Value = model.F_Descript;
63
+            parameters[6].Value = model.F_State;
64
+            parameters[7].Value = model.F_OptTime;
65
+
66
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
67
+            if (obj == null)
68
+            {
69
+                return 0;
70
+            }
71
+            else
72
+            {
73
+                return Convert.ToInt32(obj);
74
+            }
75
+        }
76
+        /// <summary>
77
+        /// 更新一条数据
78
+        /// </summary>
79
+        public bool Update(CallCenterApi.Model.T_Sys_CallOptLogs model)
80
+        {
81
+            StringBuilder strSql = new StringBuilder();
82
+            strSql.Append("update T_Sys_CallOptLogs set ");
83
+            strSql.Append("F_OptBy=@F_OptBy,");
84
+            strSql.Append("F_OptOn=@F_OptOn,");
85
+            strSql.Append("F_OptName=@F_OptName,");
86
+            strSql.Append("F_Type=@F_Type,");
87
+            strSql.Append("F_Name=@F_Name,");
88
+            strSql.Append("F_Descript=@F_Descript,");
89
+            strSql.Append("F_State=@F_State,");
90
+            strSql.Append("F_OptTime=@F_OptTime");
91
+            strSql.Append(" where F_Id=@F_Id");
92
+            SqlParameter[] parameters = {
93
+                    new SqlParameter("@F_OptBy", SqlDbType.Int,4),
94
+                    new SqlParameter("@F_OptOn", SqlDbType.DateTime),
95
+                    new SqlParameter("@F_OptName", SqlDbType.NVarChar,50),
96
+                    new SqlParameter("@F_Type", SqlDbType.NVarChar,50),
97
+                    new SqlParameter("@F_Name", SqlDbType.NVarChar,50),
98
+                    new SqlParameter("@F_Descript", SqlDbType.NVarChar,2000),
99
+                    new SqlParameter("@F_State", SqlDbType.SmallInt,2),
100
+                    new SqlParameter("@F_OptTime", SqlDbType.Int,4),
101
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)};
102
+            parameters[0].Value = model.F_OptBy;
103
+            parameters[1].Value = model.F_OptOn;
104
+            parameters[2].Value = model.F_OptName;
105
+            parameters[3].Value = model.F_Type;
106
+            parameters[4].Value = model.F_Name;
107
+            parameters[5].Value = model.F_Descript;
108
+            parameters[6].Value = model.F_State;
109
+            parameters[7].Value = model.F_OptTime;
110
+            parameters[8].Value = model.F_Id;
111
+
112
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
113
+            if (rows > 0)
114
+            {
115
+                return true;
116
+            }
117
+            else
118
+            {
119
+                return false;
120
+            }
121
+        }
122
+
123
+        /// <summary>
124
+        /// 删除一条数据
125
+        /// </summary>
126
+        public bool Delete(int F_Id)
127
+        {
128
+
129
+            StringBuilder strSql = new StringBuilder();
130
+            strSql.Append("delete from T_Sys_CallOptLogs ");
131
+            strSql.Append(" where F_Id=@F_Id");
132
+            SqlParameter[] parameters = {
133
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
134
+            };
135
+            parameters[0].Value = F_Id;
136
+
137
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
138
+            if (rows > 0)
139
+            {
140
+                return true;
141
+            }
142
+            else
143
+            {
144
+                return false;
145
+            }
146
+        }
147
+        /// <summary>
148
+        /// 批量删除数据
149
+        /// </summary>
150
+        public bool DeleteList(string F_Idlist)
151
+        {
152
+            StringBuilder strSql = new StringBuilder();
153
+            strSql.Append("delete from T_Sys_CallOptLogs ");
154
+            strSql.Append(" where F_Id in (" + F_Idlist + ")  ");
155
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
156
+            if (rows > 0)
157
+            {
158
+                return true;
159
+            }
160
+            else
161
+            {
162
+                return false;
163
+            }
164
+        }
165
+
166
+
167
+        /// <summary>
168
+        /// 得到一个对象实体
169
+        /// </summary>
170
+        public CallCenterApi.Model.T_Sys_CallOptLogs GetModel(int F_Id)
171
+        {
172
+
173
+            StringBuilder strSql = new StringBuilder();
174
+            strSql.Append("select  top 1 F_Id,F_OptBy,F_OptOn,F_OptName,F_Type,F_Name,F_Descript,F_State,F_OptTime from T_Sys_CallOptLogs ");
175
+            strSql.Append(" where F_Id=@F_Id");
176
+            SqlParameter[] parameters = {
177
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
178
+            };
179
+            parameters[0].Value = F_Id;
180
+
181
+            CallCenterApi.Model.T_Sys_CallOptLogs model = new CallCenterApi.Model.T_Sys_CallOptLogs();
182
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
183
+            if (ds.Tables[0].Rows.Count > 0)
184
+            {
185
+                return DataRowToModel(ds.Tables[0].Rows[0]);
186
+            }
187
+            else
188
+            {
189
+                return null;
190
+            }
191
+        }
192
+
193
+
194
+        /// <summary>
195
+        /// 得到一个对象实体
196
+        /// </summary>
197
+        public CallCenterApi.Model.T_Sys_CallOptLogs DataRowToModel(DataRow row)
198
+        {
199
+            CallCenterApi.Model.T_Sys_CallOptLogs model = new CallCenterApi.Model.T_Sys_CallOptLogs();
200
+            if (row != null)
201
+            {
202
+                if (row["F_Id"] != null && row["F_Id"].ToString() != "")
203
+                {
204
+                    model.F_Id = int.Parse(row["F_Id"].ToString());
205
+                }
206
+                if (row["F_OptBy"] != null && row["F_OptBy"].ToString() != "")
207
+                {
208
+                    model.F_OptBy = int.Parse(row["F_OptBy"].ToString());
209
+                }
210
+                if (row["F_OptOn"] != null && row["F_OptOn"].ToString() != "")
211
+                {
212
+                    model.F_OptOn = DateTime.Parse(row["F_OptOn"].ToString());
213
+                }
214
+                if (row["F_OptName"] != null)
215
+                {
216
+                    model.F_OptName = row["F_OptName"].ToString();
217
+                }
218
+                if (row["F_Type"] != null)
219
+                {
220
+                    model.F_Type = row["F_Type"].ToString();
221
+                }
222
+                if (row["F_Name"] != null)
223
+                {
224
+                    model.F_Name = row["F_Name"].ToString();
225
+                }
226
+                if (row["F_Descript"] != null)
227
+                {
228
+                    model.F_Descript = row["F_Descript"].ToString();
229
+                }
230
+                if (row["F_State"] != null && row["F_State"].ToString() != "")
231
+                {
232
+                    model.F_State = int.Parse(row["F_State"].ToString());
233
+                }
234
+                if (row["F_OptTime"] != null && row["F_OptTime"].ToString() != "")
235
+                {
236
+                    model.F_OptTime = int.Parse(row["F_OptTime"].ToString());
237
+                }
238
+            }
239
+            return model;
240
+        }
241
+
242
+        /// <summary>
243
+        /// 获得数据列表
244
+        /// </summary>
245
+        public DataSet GetList(string strWhere)
246
+        {
247
+            StringBuilder strSql = new StringBuilder();
248
+            strSql.Append("select F_Id,F_OptBy,F_OptOn,F_OptName,F_Type,F_Name,F_Descript,F_State,F_OptTime ");
249
+            strSql.Append(" FROM T_Sys_CallOptLogs ");
250
+            if (strWhere.Trim() != "")
251
+            {
252
+                strSql.Append(" where " + strWhere);
253
+            }
254
+            return DbHelperSQL.Query(strSql.ToString());
255
+        }
256
+
257
+        /// <summary>
258
+        /// 获得前几行数据
259
+        /// </summary>
260
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
261
+        {
262
+            StringBuilder strSql = new StringBuilder();
263
+            strSql.Append("select ");
264
+            if (Top > 0)
265
+            {
266
+                strSql.Append(" top " + Top.ToString());
267
+            }
268
+            strSql.Append(" F_Id,F_OptBy,F_OptOn,F_OptName,F_Type,F_Name,F_Descript,F_State,F_OptTime ");
269
+            strSql.Append(" FROM T_Sys_CallOptLogs ");
270
+            if (strWhere.Trim() != "")
271
+            {
272
+                strSql.Append(" where " + strWhere);
273
+            }
274
+            strSql.Append(" order by " + filedOrder);
275
+            return DbHelperSQL.Query(strSql.ToString());
276
+        }
277
+
278
+        /// <summary>
279
+        /// 获取记录总数
280
+        /// </summary>
281
+        public int GetRecordCount(string strWhere)
282
+        {
283
+            StringBuilder strSql = new StringBuilder();
284
+            strSql.Append("select count(1) FROM T_Sys_CallOptLogs ");
285
+            if (strWhere.Trim() != "")
286
+            {
287
+                strSql.Append(" where " + strWhere);
288
+            }
289
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
290
+            if (obj == null)
291
+            {
292
+                return 0;
293
+            }
294
+            else
295
+            {
296
+                return Convert.ToInt32(obj);
297
+            }
298
+        }
299
+        /// <summary>
300
+        /// 分页获取数据列表
301
+        /// </summary>
302
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
303
+        {
304
+            StringBuilder strSql = new StringBuilder();
305
+            strSql.Append("SELECT * FROM ( ");
306
+            strSql.Append(" SELECT ROW_NUMBER() OVER (");
307
+            if (!string.IsNullOrEmpty(orderby.Trim()))
308
+            {
309
+                strSql.Append("order by T." + orderby);
310
+            }
311
+            else
312
+            {
313
+                strSql.Append("order by T.F_Id desc");
314
+            }
315
+            strSql.Append(")AS Row, T.*  from T_Sys_CallOptLogs T ");
316
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
317
+            {
318
+                strSql.Append(" WHERE " + strWhere);
319
+            }
320
+            strSql.Append(" ) TT");
321
+            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
322
+            return DbHelperSQL.Query(strSql.ToString());
323
+        }
324
+        
325
+        #endregion  BasicMethod
326
+        #region  ExtensionMethod
327
+
328
+        #endregion  ExtensionMethod
329
+    }
330
+}

+ 2 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/CallCenterApi.Interface.csproj

@@ -193,6 +193,7 @@
193 193
     <Compile Include="Controllers\quality\QCManageController.cs" />
194 194
     <Compile Include="Controllers\report\BusinessController.cs" />
195 195
     <Compile Include="Controllers\report\CallInController.cs" />
196
+    <Compile Include="Controllers\report\CallManageController.cs" />
196 197
     <Compile Include="Controllers\report\DaysTalkTimeController.cs" />
197 198
     <Compile Include="Controllers\report\GDLXSJController.cs" />
198 199
     <Compile Include="Controllers\report\GDLXYQController.cs" />
@@ -307,6 +308,7 @@
307 308
     <Folder Include="Views\Callblack\" />
308 309
     <Folder Include="Views\CallIn\" />
309 310
     <Folder Include="Views\Callleave\" />
311
+    <Folder Include="Views\CallManage\" />
310 312
     <Folder Include="Views\CallOutOpt\" />
311 313
     <Folder Include="Views\CallOutScreen\" />
312 314
     <Folder Include="Views\CallPlan\" />

+ 2 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -220,11 +220,8 @@ namespace CallCenterApi.Interface.Controllers
220 220
                 userAccountModel.F_DeleteFlag = 0;
221 221
                 if (input.HjType != null)
222 222
                     userAccountModel.F_HJType = input.HjType;
223
-                if (input.IsSeat)
224
-                {
225
-                    if (input.WXNo != null)
226
-                        userAccountModel.F_WXNo = input.WXNo.Trim();
227
-                }
223
+                if (input.WXNo != null)
224
+                    userAccountModel.F_WXNo = input.WXNo.Trim();
228 225
                 //if (input.SeartGroupID != 0)
229 226
                 if (input.GroupId != 0)
230 227
                 {

+ 259 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/CallManageController.cs

@@ -0,0 +1,259 @@
1
+using CallCenter.Utility;
2
+using CallCenterApi.Common;
3
+using CallCenterApi.DB;
4
+using CallCenterApi.Interface.Controllers.Base;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Web;
9
+using System.Web.Mvc;
10
+
11
+namespace CallCenterApi.Interface.Controllers.report
12
+{
13
+    public class CallManageController : BaseController
14
+    {
15
+        public static int validDays = 30; //过期时间(分钟)
16
+       
17
+        /// <summary>
18
+        /// 话务量实时数据统计
19
+        /// </summary>
20
+        /// <param name="callState">是否接通,为空表示所有来电,1表示接通来电</param>
21
+        /// <returns></returns>
22
+        public ActionResult GetCallCount()
23
+        {
24
+            ActionResult res = NoToken("未知错误,请重新登录");
25
+            string daystr = DateTime.Now.ToShortDateString();
26
+            //callState=1表示接通量,为空表示来电量
27
+            int[] hours = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
28
+            int[] callincounts = new int[24];
29
+            int[] callConnCounts = new int[24];
30
+
31
+            for (int i = 0; i < 24; i++)
32
+            {
33
+                DateTime beginTime = Convert.ToDateTime(daystr + " " + i + ":00:00");
34
+                //来电量
35
+                string callinsql = "select count(*) from T_Call_CallRecords where 1=1 and begintime >='" + beginTime.ToString() + "' and  beginTime<'" + beginTime.AddHours(1) + "'";
36
+                int callinCount = int.Parse(DbHelperSQL.GetSingle(callinsql).ToString());
37
+                
38
+                callincounts[i] = callinCount;
39
+                //接通量
40
+                string callconnsql = "select count(*) from T_Call_CallRecords where 1=1 and begintime >='" + beginTime.ToString() + "' and  beginTime<'" + beginTime.AddHours(1) + "' and callstate=1";
41
+                int connCount = int.Parse(DbHelperSQL.GetSingle(callconnsql).ToString());
42
+                callConnCounts[i] = connCount;
43
+            }
44
+            var obj = new
45
+            {
46
+                hour = hours,
47
+                callin = callincounts,
48
+                callconn = callConnCounts,
49
+            };
50
+            res = Success("获取成功", obj);
51
+            return res;
52
+        }
53
+        /// <summary>
54
+        /// 话务量总体统计
55
+        /// </summary>
56
+        /// <returns></returns>
57
+        public ActionResult GetCallTotal()
58
+        {
59
+            ActionResult res = NoToken("未知错误,请重新登录");
60
+            DateTime beginday = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
61
+            //每日来话量
62
+            //int DayCallIn = 0;
63
+            //接通量
64
+            //int DayCallInConnect = 0;
65
+            //接通率
66
+            string CallInConnectRate = "0";
67
+            int DayCallIn = int.Parse(DbHelperSQL.GetSingle("select count(*) from T_Call_CallRecords where 1=1 and calltype=1 and begintime>='" + beginday.ToShortDateString() + " 00:00:00' and begintime<='" + beginday.ToShortDateString() + " 23:59:59' ").ToString());
68
+            int DayCallInConnect = int.Parse(DbHelperSQL.GetSingle("select count(*) from T_Call_CallRecords where 1=1 and calltype=1 and callstate=1 and begintime>='" + beginday.ToShortDateString() + " 00:00:00' and begintime<='" + beginday.ToShortDateString() + " 23:59:59' ").ToString());
69
+            if (DayCallIn != 0)
70
+            {
71
+                CallInConnectRate = ((double)DayCallInConnect / DayCallIn * 100).ToString();
72
+            }
73
+            //平均通话时长统计
74
+            double avgTalkTime = 0;
75
+            string avgtime = DB.DbHelperSQL.Query("select AVG(TalkLongTime) as avgTalkLongTime from T_Call_CallRecords where 1=1 and begintime >='" + beginday.ToShortDateString() + " 00:00:00' and  beginTime<'" + beginday.AddDays(1).ToString() + "'").Tables[0].Rows[0][0].ToString();
76
+            if (!string.IsNullOrEmpty(avgtime))
77
+            {
78
+                avgTalkTime = double.Parse(avgtime);
79
+            }
80
+            var obj = new
81
+            {
82
+                daycallin = DayCallIn,
83
+                daycallconn = DayCallInConnect,
84
+                daycallrate = CallInConnectRate,
85
+                avgtime = avgTalkTime
86
+            };
87
+            res = Success("获取成功", obj);
88
+            return res;
89
+        }
90
+        /// <summary>
91
+        /// 坐席闲忙比例
92
+        /// </summary>
93
+        /// <returns></returns>
94
+        public ActionResult FreeBusyRate()
95
+        {
96
+            ActionResult res = NoToken("未知错误,请重新登录");
97
+            int[] hours = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
98
+            //1: 登陆中、2:空闲、3:通话中、4:话后处理、5:小休、6:被请求
99
+            string[] states = new string[] { "空闲", "通话中", "小休" };
100
+            int[] state = new int[3] { 2, 3, 5 };
101
+            int[] freecounts = new int[24];
102
+            int[] callingcounts = new int[24];
103
+            int[] restcounts = new int[24];
104
+            double[] freerate = new double[24];
105
+            double[] callingrate = new double[24];
106
+            double[] restrate = new double[24];
107
+            string daystr = DateTime.Now.ToShortDateString();
108
+            foreach (var item in state)
109
+            {
110
+                for (int i = 0; i < 24; i++)
111
+                {
112
+                    int fcount = 0;
113
+                    int icount = 0;
114
+                    int rcount = 0;
115
+                    DateTime beginTime = Convert.ToDateTime(daystr + " " + i + ":00:00");
116
+                    int drstate = int.Parse(DbHelperSQL.GetSingle("select count(*) from rep_agent_state where OccurTime>='" + beginTime.ToString() + "' and OccurTime<'" + beginTime.AddHours(1).ToString() + "' and State=" + item).ToString());
117
+                    if (item == 2)
118
+                    {
119
+                        fcount = drstate;
120
+                    }
121
+                    freecounts[i] = fcount;
122
+                    if (item == 3)
123
+                    {
124
+                        icount = drstate;
125
+                    }
126
+                    callingcounts[i] = icount;
127
+                    if (item == 5)
128
+                    {
129
+                        rcount = drstate;
130
+                    }
131
+                    restcounts[i] = rcount;
132
+                }
133
+            }
134
+            for (int k = 0; k < 24; k++)
135
+            {
136
+                int[] total = new int[24];
137
+                total[k] = freecounts[k] + callingcounts[k] + restcounts[k];
138
+                freerate[k] = 0;
139
+                callingrate[k] = 0;
140
+                restrate[k] = 0;
141
+                if (total[k] > 0)
142
+                {
143
+                    freerate[k] = freecounts[k] / total[k] * 100;
144
+                    callingrate[k] = callingcounts[k] / total[k] * 100;
145
+                    restrate[k] = restcounts[k] / total[k] * 100;
146
+                }
147
+            }
148
+            var obj = new
149
+            {
150
+                hour = hours,
151
+                callstate = states,
152
+                freerates = freerate,
153
+                callinrates = callingrate,
154
+                restrates = restrate
155
+            };
156
+            res = Success("获取成功", obj);
157
+            return res;
158
+        }
159
+        /// <summary>
160
+        /// 平均通话时长统计
161
+        /// </summary>
162
+        /// <returns></returns>
163
+        public ActionResult GetCallTime()
164
+        {
165
+            ActionResult res = NoToken("未知错误,请重新登录");
166
+            int[] hours = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
167
+            double[] callavgtime = new double[24];
168
+            int userAccountList = int.Parse(DbHelperSQL.GetSingle("select count(*) from T_Sys_UserAccount where 1=1 and F_SeatFlag=1 and F_DeleteFlag=0").ToString());
169
+            string daystr = DateTime.Now.ToShortDateString();
170
+
171
+            for (int i = 0; i < 24; i++)
172
+            {
173
+                double avgTime = 0;
174
+                DateTime beginTime = Convert.ToDateTime(daystr + " " + i.ToString().PadLeft(2, '0') + ":00:00");
175
+                string sql = "select count(*) from T_Call_CallRecords where 1=1 and begintime >='" + beginTime.ToString() + "' and  beginTime<'" + beginTime.AddHours(1).ToString() + "' ";
176
+                int Count = int.Parse(DbHelperSQL.GetSingle(sql).ToString());
177
+                if (userAccountList > 0)
178
+                {
179
+                    avgTime = double.Parse((Count / userAccountList).ToString());
180
+                }
181
+                callavgtime[i] = avgTime;
182
+            }
183
+            var obj = new
184
+            {
185
+                avgtime = callavgtime
186
+            };
187
+            res = Success("获取成功", obj);
188
+            return res;
189
+        }
190
+        /// <summary>
191
+        /// 呼入接通/未接通量统计(没有挂断量)
192
+        /// </summary>
193
+        /// <returns></returns>
194
+        public ActionResult GetCallState()
195
+        {
196
+            ActionResult res = NoToken("未知错误,请重新登录");
197
+            string daystr = DateTime.Now.ToShortDateString();
198
+            string[] callstate = { "接通量", "未接量" };
199
+            int[] hours = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
200
+            int[] callConncounts = new int[24];
201
+            int[] callUnConnCounts = new int[24];
202
+            //callState=1表示接通量
203
+            for (int i = 0; i < 24; i++)
204
+            {
205
+                DateTime beginTime = Convert.ToDateTime(daystr + " " + i + ":00:00");
206
+                string sqlConn = "select count(*) from T_Call_CallRecords where 1=1 and begintime >='" + beginTime.ToString() + "' and  beginTime<'" + beginTime.AddHours(1) + "' and callstate=1";
207
+                int callconncount = int.Parse(DbHelperSQL.GetSingle(sqlConn).ToString());
208
+                callConncounts[i] = callconncount;
209
+                string sqlUnConn = "select count(*) from T_Call_CallRecords where 1=1 and begintime >='" + beginTime.ToString() + "' and  beginTime<'" + beginTime.AddHours(1) + "' and callstate=0";
210
+                int callunconncount = int.Parse(DbHelperSQL.GetSingle(sqlUnConn).ToString());
211
+                callUnConnCounts[i] = callunconncount;
212
+            }
213
+            var obj = new
214
+            {
215
+                callstates = callstate,
216
+                hour = hours,
217
+                callconn = callConncounts,
218
+                callunconn = callUnConnCounts
219
+            };
220
+            res = Success("获取成功", obj);
221
+            return res;
222
+        }
223
+        /// <summary>
224
+        /// 获取坐席人数
225
+        /// </summary>
226
+        /// <returns></returns>
227
+        public ActionResult GetSeatCount()
228
+        {
229
+            ActionResult res = NoToken("未知错误,请重新登录");
230
+            int SeatCount = 0;
231
+            if (string.IsNullOrEmpty("SeatCount"))
232
+            {
233
+                return null;
234
+            }
235
+            object SeatCounts = CacheHelper.Get("SeatCount");
236
+
237
+            if (SeatCounts != null)
238
+            {
239
+                int.TryParse(SeatCounts.ToString(), out SeatCount);
240
+            }
241
+            var obj = new
242
+            {
243
+                seatcount = SeatCount
244
+            };
245
+            res = Success("获取成功", obj);
246
+            return res;
247
+        }
248
+
249
+        //保存 坐席人数
250
+        private ActionResult InsertSeatingCount()
251
+        {
252
+            string str = "";
253
+            string SeatCounts = RequestString.GetQueryString("SeatCounts");
254
+            CacheHelper.Remove("SeatCounts");
255
+            CacheHelper.Insert("SeatCounts", SeatCounts, validDays);
256
+            return Content(str);
257
+        }
258
+    }
259
+}

+ 95 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -938,5 +938,100 @@ namespace CallCenterApi.Interface.Controllers.tel
938 938
             }
939 939
             return res;
940 940
         }
941
+
942
+        #region 话务日志
943
+        BLL.T_Sys_CallOptLogs bll = new BLL.T_Sys_CallOptLogs();
944
+        /// <summary>
945
+        /// 话务日志
946
+        /// </summary>
947
+        /// <returns></returns>
948
+        public ActionResult AddCallLogs(string telno, string Status, bool becallcome, string hjbh)
949
+        {
950
+            ActionResult res = NoToken("未知错误,请重新登录");
951
+            if (Request.IsAuthenticated)
952
+            {
953
+                int userId = CurrentUser.UserData.F_UserId;
954
+                string userCode = CurrentUser.UserData.F_UserCode;
955
+                
956
+                #region 日志描述
957
+                string des = "来电号码为:" + telno + ";";
958
+                des += "状态为:" + Status.Replace("0", "振铃").Replace("1", "摘机").Replace("2", "挂机") + ",";
959
+                des += "bool:" + (becallcome ? "来电" : "去电") + ";";
960
+                des += "坐席工号:" + userCode + ",";
961
+                des += "呼叫编号:" + hjbh;
962
+                #endregion
963
+                try
964
+                {
965
+                    int r = bll.AddCallLog(userId, userCode, DTRequest.GetIP(), "状态改变事件已经触发", des, 0);
966
+                    if (r > 0)
967
+                        res = Success("状态改变事件记录日志成功");
968
+                    else
969
+                        res = Error("日志记录失败");
970
+                }
971
+                catch (Exception ex)
972
+                {
973
+                    res = Error("来电弹屏事件异常:" + ex.Message);
974
+                }
975
+            }
976
+            return res;
977
+        }
978
+        /// <summary>
979
+        /// 置忙日志
980
+        /// </summary>
981
+        public ActionResult AddTelBusyDelgate()
982
+        {
983
+            ActionResult res = NoToken("未知错误,请重新登录");
984
+            if (Request.IsAuthenticated)
985
+            {
986
+                string userCode = CurrentUser.UserData.F_UserCode;
987
+                int userId = CurrentUser.UserData.F_UserId;
988
+                try
989
+                {
990
+                    int r=bll.AddCallLog(userId, userCode, DTRequest.GetIP(), "置忙", "", 1);
991
+                    if (r > 0)
992
+                        res = Success("置忙日志记录成功", r);
993
+                    else
994
+                        res = Error("日志记录失败");
995
+                }
996
+                catch (Exception ex)
997
+                {
998
+                    res = Error("置忙异常:" + ex.Message);
999
+                }
1000
+            }
1001
+            return res;
1002
+        }
1003
+        /// <summary>
1004
+        /// 示闲日志
1005
+        /// </summary>
1006
+        public ActionResult UpdateTelFreeDelgate(string calllogid)
1007
+        {
1008
+            ActionResult res = NoToken("未知错误,请重新登录");
1009
+            if (Request.IsAuthenticated)
1010
+            {
1011
+                try
1012
+                {
1013
+                    if (calllogid != "")
1014
+                    {
1015
+                        //获取原实体对象
1016
+                        Model.T_Sys_CallOptLogs model = bll.GetModel(Convert.ToInt32(calllogid));
1017
+                        model.F_Descript = "置忙结束转化为示闲";
1018
+                        model.F_State = 2;
1019
+                        TimeSpan span = DateTime.Now - DateTime.Parse(model.F_OptOn.ToString());
1020
+                        model.F_OptTime = Convert.ToInt32(span.TotalSeconds);
1021
+                        bool r = bll.Update(model);
1022
+                        if (r)
1023
+                            res = Success("状态改变事件记录日志成功");
1024
+                        else
1025
+                            res = Error("日志记录失败");
1026
+                    }
1027
+                }
1028
+                catch (Exception ex)
1029
+                {
1030
+                    res = Error("示闲异常:" + ex.Message);
1031
+                }
1032
+            }
1033
+            return res;
1034
+        }
1035
+        #endregion
941 1036
     }
942 1037
 }

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.Model/CallCenterApi.Model.csproj

@@ -81,6 +81,7 @@
81 81
     <Compile Include="T_SMS_SendSMSTask.cs" />
82 82
     <Compile Include="T_SMS_SentSMS.cs" />
83 83
     <Compile Include="T_SMS_Template.cs" />
84
+    <Compile Include="T_Sys_CallOptLogs.cs" />
84 85
     <Compile Include="T_Sys_Department.cs" />
85 86
     <Compile Include="T_Sys_DictionaryBase.cs" />
86 87
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 101 - 0
codegit/CallCenterApi/CallCenterApi.Model/T_Sys_CallOptLogs.cs

@@ -0,0 +1,101 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace CallCenterApi.Model
8
+{
9
+    /// <summary>
10
+	/// T_Sys_CallOptLogs:话务日志(属性说明自动提取数据库字段的描述信息)
11
+	/// </summary>
12
+	[Serializable]
13
+    public partial class T_Sys_CallOptLogs
14
+    {
15
+        public T_Sys_CallOptLogs()
16
+        { }
17
+        #region Model
18
+        private int _f_id;
19
+        private int? _f_optby;
20
+        private DateTime? _f_opton;
21
+        private string _f_optname;
22
+        private string _f_type;
23
+        private string _f_name;
24
+        private string _f_descript;
25
+        private int? _f_state;
26
+        private int? _f_opttime;
27
+        /// <summary>
28
+        /// 
29
+        /// </summary>
30
+        public int F_Id
31
+        {
32
+            set { _f_id = value; }
33
+            get { return _f_id; }
34
+        }
35
+        /// <summary>
36
+        /// 
37
+        /// </summary>
38
+        public int? F_OptBy
39
+        {
40
+            set { _f_optby = value; }
41
+            get { return _f_optby; }
42
+        }
43
+        /// <summary>
44
+        /// 
45
+        /// </summary>
46
+        public DateTime? F_OptOn
47
+        {
48
+            set { _f_opton = value; }
49
+            get { return _f_opton; }
50
+        }
51
+        /// <summary>
52
+        /// 
53
+        /// </summary>
54
+        public string F_OptName
55
+        {
56
+            set { _f_optname = value; }
57
+            get { return _f_optname; }
58
+        }
59
+        /// <summary>
60
+        /// 
61
+        /// </summary>
62
+        public string F_Type
63
+        {
64
+            set { _f_type = value; }
65
+            get { return _f_type; }
66
+        }
67
+        /// <summary>
68
+        /// 
69
+        /// </summary>
70
+        public string F_Name
71
+        {
72
+            set { _f_name = value; }
73
+            get { return _f_name; }
74
+        }
75
+        /// <summary>
76
+        /// 
77
+        /// </summary>
78
+        public string F_Descript
79
+        {
80
+            set { _f_descript = value; }
81
+            get { return _f_descript; }
82
+        }
83
+        /// <summary>
84
+        /// 
85
+        /// </summary>
86
+        public int? F_State
87
+        {
88
+            set { _f_state = value; }
89
+            get { return _f_state; }
90
+        }
91
+        /// <summary>
92
+        /// 
93
+        /// </summary>
94
+        public int? F_OptTime
95
+        {
96
+            set { _f_opttime = value; }
97
+            get { return _f_opttime; }
98
+        }
99
+        #endregion Model
100
+    }
101
+}