Kaynağa Gözat

修改来电弹屏历史工单记录接口 GetOldList

machenyang 8 yıl önce
ebeveyn
işleme
32e9726c68

+ 86 - 77
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -221,94 +221,103 @@ namespace CallCenterApi.Interface.Controllers.tel
221 221
             ActionResult res = NoToken("未知错误,请重新登录");
222 222
             if (Request.IsAuthenticated)
223 223
             {
224
-                string sql = "";
225
-                string sqlcount = "";
226
-                DataTable dt = new DataTable();
224
+                int userId = CurrentUser.UserData.F_UserId;
225
+                if (userId != 0)
226
+                {
227
+                    Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
228
+                    if (ua != null)
229
+                    {
230
+                        string sql = "";
231
+                        string sqlcount = "";
232
+                        DataTable dt = new DataTable();
227 233
 
228
-                string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
229
-                string strcalltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
230
-                string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
231
-                string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
234
+                        string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
235
+                        string strcalltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
236
+                        string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
237
+                        string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
232 238
 
233
-                string strpageindex = RequestString.GetQueryString("page");
234
-                int pageindex = 1;
235
-                string strpagesize = RequestString.GetQueryString("pagesize");
236
-                int pagesize = 10;
239
+                        string strpageindex = RequestString.GetQueryString("page");
240
+                        int pageindex = 1;
241
+                        string strpagesize = RequestString.GetQueryString("pagesize");
242
+                        int pagesize = 10;
237 243
 
238
-                if (strcalltype.Trim() != "" && strcalltype != "undefined")
239
-                {
240
-                    sql += " and CallType=" + strcalltype + " ";
241
-                }
242
-                if (strtel.Trim() != "" && strtel != "undefined")
243
-                {
244
-                    sql += " and CallNumber= '" + strtel.Trim() + "' ";
245
-                    sqlcount += " and CallNumber= '" + strtel.Trim() + "' ";
246
-                }
247
-                //else
248
-                //{
249
-                //    sql += " and 1=0 ";
250
-                //}
251
-                if (strstarttime.Trim() != "" && strstarttime != "undefined")
252
-                {
253
-                    sql += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
254
-                    sqlcount += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
255
-                }
256
-                if (strendtime.Trim() != "" && strendtime != "undefined")
257
-                {
258
-                    sql += " and datediff(day,BeginTime,'" + strendtime + "')>=0   ";
259
-                    sqlcount += " and datediff(day,BeginTime,'" + strendtime + "')>=0   ";
260
-                }
261 244
 
262
-                if (strpageindex.Trim() != "")
263
-                {
264
-                    pageindex = Convert.ToInt32(strpageindex);
265
-                }
245
+                        sql += " and CreateUserID = '" + userId + "'";
266 246
 
267
-                if (strpagesize.Trim() != "")
268
-                {
269
-                    pagesize = Convert.ToInt32(strpagesize);
270
-                }
271
-                int recordCount = 0;
272
-                dt = BLL.PagerBLL.GetListPager(
273
-                    "T_Call_CallRecords",
274
-                    "CallRecordsId",
275
-                    "*",
276
-                    sql,
277
-                    "ORDER BY CallRecordsId desc",
278
-                    pagesize,
279
-                    pageindex,
280
-                    true,
281
-                    out recordCount);
282
-                var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
283
-                foreach (DataRow dr in dt.Rows)
284
-                {
285
-                    string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
286
-                    if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
287
-                    {
288
-                        var ym = config.F_ParamValue;
289
-                        if (ym.Substring(ym.Length - 1) == "/")
247
+                        if (strcalltype.Trim() != "" && strcalltype != "undefined")
290 248
                         {
291
-                            ym = ym.Substring(0, ym.Length - 1);
249
+                            sql += " and CallType=" + strcalltype + " ";
250
+                        }
251
+                        if (strtel.Trim() != "" && strtel != "undefined")
252
+                        {
253
+                            sql += " and CallNumber= '" + strtel.Trim() + "' ";
254
+                            sqlcount += " and CallNumber= '" + strtel.Trim() + "' ";
255
+                        }
256
+                        //else
257
+                        //{
258
+                        //    sql += " and 1=0 ";
259
+                        //}
260
+                        if (strstarttime.Trim() != "" && strstarttime != "undefined")
261
+                        {
262
+                            sql += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
263
+                            sqlcount += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
264
+                        }
265
+                        if (strendtime.Trim() != "" && strendtime != "undefined")
266
+                        {
267
+                            sql += " and datediff(day,BeginTime,'" + strendtime + "')>=0   ";
268
+                            sqlcount += " and datediff(day,BeginTime,'" + strendtime + "')>=0   ";
292 269
                         }
293
-                        dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
294
-                    }
295
-                }
296 270
 
297
-                int hrcount = new BLL.T_Call_CallRecords().GetRecordCount(" calltype=0 " + sqlcount);
298
-                int hccount = new BLL.T_Call_CallRecords().GetRecordCount(" calltype=1 " + sqlcount);
271
+                        if (strpageindex.Trim() != "")
272
+                        {
273
+                            pageindex = Convert.ToInt32(strpageindex);
274
+                        }
299 275
 
300
-                var obj = new
301
-                {
302
-                    state = "success",
303
-                    message = "成功",
304
-                    rows = dt,
305
-                    total = recordCount,
306
-                    hrcount = hrcount,
307
-                    hccount = hccount,
308
-                };
276
+                        if (strpagesize.Trim() != "")
277
+                        {
278
+                            pagesize = Convert.ToInt32(strpagesize);
279
+                        }
280
+                        int recordCount = 0;
281
+                        dt = BLL.PagerBLL.GetListPager(
282
+                            "T_Call_CallRecords",
283
+                            "CallRecordsId",
284
+                            "*",
285
+                            sql,
286
+                            "ORDER BY CallRecordsId desc",
287
+                            pagesize,
288
+                            pageindex,
289
+                            true,
290
+                            out recordCount);
291
+                        var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
292
+                        foreach (DataRow dr in dt.Rows)
293
+                        {
294
+                            string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
295
+                            if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
296
+                            {
297
+                                var ym = config.F_ParamValue;
298
+                                if (ym.Substring(ym.Length - 1) == "/")
299
+                                {
300
+                                    ym = ym.Substring(0, ym.Length - 1);
301
+                                }
302
+                                dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
303
+                            }
304
+                        }
309 305
 
310
-                res = Content(obj.ToJson());
306
+                        int hrcount = new BLL.T_Call_CallRecords().GetRecordCount(" calltype=0 " + sqlcount);
307
+                        int hccount = new BLL.T_Call_CallRecords().GetRecordCount(" calltype=1 " + sqlcount);
311 308
 
309
+                        var obj = new
310
+                        {
311
+                            state = "success",
312
+                            message = "成功",
313
+                            rows = dt,
314
+                            total = recordCount,
315
+                            hrcount = hrcount,
316
+                            hccount = hccount,
317
+                        };
318
+                        res = Content(obj.ToJson());
319
+                    }
320
+                }
312 321
             }
313 322
             return res;
314 323
         }