zhengbingbing лет назад: 7
Родитель
Сommit
fc777c2af5

+ 3 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/CallOutReportController.cs

@@ -206,8 +206,9 @@ namespace CallCenterApi.Interface.Controllers.report
206 206
                     DataRow dr = dtnew.NewRow();
207 207
                     dr["xiangzhen"] = itemconf.F_Name;
208 208
                     //根据乡镇获取总数
209
-                    int totalnum= otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId+"' ");
210
-                    
209
+                    //int totalnum= otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId+"' ");
210
+                    int totalnum = ansBLL.GetRecordCount("  F_OptOn between '" + sdate + "' and '" + edate + "' and F_Answer='" + itemconf.F_Name + "' ");
211
+
211 212
                     leiji += totalnum;
212 213
                     dr["zongshu"] = totalnum;
213 214
 

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/SwitchedlossCallController.cs

@@ -266,7 +266,7 @@ namespace CallCenterApi.Interface.Controllers.report
266 266
             for (DateTime t = beginTime; t <= endTime; t = t.AddDays(1))
267 267
             {
268 268
                 string key = t.ToString("{yyyyMMdd}");
269
-                int callConnectCount = dt.Select("begintime >='" + t.ToString() + "' and begintime<'" + t.AddDays(1).ToString() + "' and CallState=1").Length;
269
+                int callConnectCount = dt.Select("begintime >='" + t.ToString() + "' and begintime<'" + t.AddDays(1).ToString() + "' and CallState=1 and dealtype<>1").Length;
270 270
                 int callLossCount = dt.Select("begintime >='" + t.ToString() + "' and begintime<'" + t.AddDays(1).ToString() + "' and CallState=0 and dealtype=5").Length;
271 271
 
272 272
                 if ((callConnectCount + callLossCount) != 0)

+ 168 - 62
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/YearContrastController.cs

@@ -14,6 +14,7 @@ namespace CallCenterApi.Interface.Controllers.report
14 14
     //[Authority]
15 15
     public class YearContrastController : BaseController
16 16
     {
17
+        BLL.T_Call_CallRecords crbll = new BLL.T_Call_CallRecords();
17 18
         //呼叫数据对比
18 19
         public ActionResult GetDataList(string beginyear,string endyear)
19 20
         {
@@ -147,10 +148,10 @@ namespace CallCenterApi.Interface.Controllers.report
147 148
             return dtNew;
148 149
         }
149 150
 
151
+        #region 通话记录表读取
150 152
         //客户呼叫数
151 153
         private string GetKhCall(string strtime)
152 154
         {
153
-            DataTable dt = new DataTable();
154 155
             string str = "";
155 156
             for (int i = 1; i <= 12; i++)
156 157
             {
@@ -162,30 +163,17 @@ namespace CallCenterApi.Interface.Controllers.report
162 163
                 }
163 164
                 if (strtime != "")
164 165
                 {
165
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
166
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
166
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
167
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
167 168
                 }
168 169
 
169
-                dt = DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in  where 1=1 " + sqltimeCallRecords).Tables[0];
170
-                if (dt != null && dt.Rows.Count > 0)
171
-                {
172
-                    if (dt.Rows[0]["ct"].ToString() != "")
173
-                    {
174
-                        str += dt.Rows[0]["ct"].ToString() + ",";
175
-                    }
176
-                    else
177
-                    {
178
-                        str += "0,";
179
-                    }
180
-                }
181
-                else
182
-                {
183
-                    str += "0,";
184
-                }
170
+                int count = crbll.GetRecordCount(" CallType=0 " + sqltimeCallRecords);
171
+
172
+                str += count.ToString() + ",";
185 173
             }
186 174
             if (str != "")
187 175
             {
188
-                str.Remove(str.Length - 1);
176
+                str.TrimEnd(',');
189 177
             }
190 178
             return str;
191 179
         }
@@ -193,7 +181,6 @@ namespace CallCenterApi.Interface.Controllers.report
193 181
         //坐席接听数
194 182
         private string GetZxJt(string strtime)
195 183
         {
196
-            DataTable dt = new DataTable();
197 184
             string str = "";
198 185
             for (int i = 1; i <= 12; i++)
199 186
             {
@@ -205,30 +192,17 @@ namespace CallCenterApi.Interface.Controllers.report
205 192
                 }
206 193
                 if (strtime != "")
207 194
                 {
208
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
209
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
195
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
196
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
210 197
                 }
198
+                int count = crbll.GetRecordCount(" CallType=0 and CallState=1 and DealType=6 " + sqltimeCallRecords);
199
+
200
+                str += count.ToString() + ",";
211 201
 
212
-                dt = DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords).Tables[0];
213
-                if (dt != null && dt.Rows.Count > 0)
214
-                {
215
-                    if (dt.Rows[0]["ct"].ToString() != "")
216
-                    {
217
-                        str += dt.Rows[0]["ct"].ToString() + ",";
218
-                    }
219
-                    else
220
-                    {
221
-                        str += "0,";
222
-                    }
223
-                }
224
-                else
225
-                {
226
-                    str += "0,";
227
-                }
228 202
             }
229 203
             if (str != "")
230 204
             {
231
-                str.Remove(str.Length - 1);
205
+                str.TrimEnd(',');
232 206
             }
233 207
             return str;
234 208
         }
@@ -248,43 +222,175 @@ namespace CallCenterApi.Interface.Controllers.report
248 222
                 }
249 223
                 if (strtime != "")
250 224
                 {
251
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
252
-                    sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
225
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
226
+                    sqltimeCallRecords += " and CONVERT(varchar , begintime, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
253 227
                 }
254 228
 
255
-                dt = DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords + ") as jt from rep_trunk_call_in  where 1=1  " + sqltimeCallRecords).Tables[0];
229
+                int count = crbll.GetRecordCount(" CallType=0 " + sqltimeCallRecords);
230
+                int jtcount = crbll.GetRecordCount(" CallType=0 and CallState=1 and DealType=6 " + sqltimeCallRecords);
256 231
 
257
-                int ibgnjt = 0;
258 232
                 double ibgnjtl = 0.00;
259
-
260
-                if (dt != null && dt.Rows.Count > 0)
233
+                if (count > 0)
261 234
                 {
262
-
263
-                    if (dt.Rows[0]["jt"].ToString() != "")
264
-                    {
265
-                        ibgnjt = int.Parse(dt.Rows[0]["jt"].ToString());
266
-                    }
267
-
268
-                    if (dt.Rows[0]["ct"].ToString() != "" && dt.Rows[0]["ct"].ToString() != "0")
269
-                    {
270
-                        ibgnjtl = ibgnjt / Convert.ToDouble(dt.Rows[0]["ct"].ToString());
271
-                        str += (ibgnjtl * 100).ToString("0.00") + ",";
272
-                    }
273
-                    else
274
-                    {
275
-                        str += "0.00,";
276
-                    }
235
+                    ibgnjtl = jtcount / double.Parse(count.ToString());
236
+                    str += (ibgnjtl * 100).ToString("0.00") + ",";
277 237
                 }
278 238
                 else
279 239
                 {
280 240
                     str += "0.00,";
281 241
                 }
242
+
282 243
             }
283 244
             if (str != "")
284 245
             {
285
-                str.Remove(str.Length - 1);
246
+                str.TrimEnd(',');
286 247
             }
287 248
             return str;
288 249
         }
250
+        #endregion
251
+
252
+        //注释掉读取中间件表的数据,从通话记录表读取 
253
+        //zhengbingbing 20180516
254
+        #region 中间件读取
255
+        //客户呼叫数
256
+        //private string GetKhCall(string strtime)
257
+        //{
258
+        //    DataTable dt = new DataTable();
259
+        //    string str = "";
260
+        //    for (int i = 1; i <= 12; i++)
261
+        //    {
262
+        //        string sqltimeCallRecords = "";
263
+        //        string strmm = i.ToString();
264
+        //        if (i <= 9)
265
+        //        {
266
+        //            strmm = "0" + i;
267
+        //        }
268
+        //        if (strtime != "")
269
+        //        {
270
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
271
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
272
+        //        }
273
+
274
+        //        dt = DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in  where 1=1 " + sqltimeCallRecords).Tables[0];
275
+        //        if (dt != null && dt.Rows.Count > 0)
276
+        //        {
277
+        //            if (dt.Rows[0]["ct"].ToString() != "")
278
+        //            {
279
+        //                str += dt.Rows[0]["ct"].ToString() + ",";
280
+        //            }
281
+        //            else
282
+        //            {
283
+        //                str += "0,";
284
+        //            }
285
+        //        }
286
+        //        else
287
+        //        {
288
+        //            str += "0,";
289
+        //        }
290
+        //    }
291
+        //    if (str != "")
292
+        //    {
293
+        //        str.Remove(str.Length - 1);
294
+        //    }
295
+        //    return str;
296
+        //}
297
+
298
+        ////坐席接听数
299
+        //private string GetZxJt(string strtime)
300
+        //{
301
+        //    DataTable dt = new DataTable();
302
+        //    string str = "";
303
+        //    for (int i = 1; i <= 12; i++)
304
+        //    {
305
+        //        string sqltimeCallRecords = "";
306
+        //        string strmm = i.ToString();
307
+        //        if (i <= 9)
308
+        //        {
309
+        //            strmm = "0" + i;
310
+        //        }
311
+        //        if (strtime != "")
312
+        //        {
313
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
314
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
315
+        //        }
316
+
317
+        //        dt = DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords).Tables[0];
318
+        //        if (dt != null && dt.Rows.Count > 0)
319
+        //        {
320
+        //            if (dt.Rows[0]["ct"].ToString() != "")
321
+        //            {
322
+        //                str += dt.Rows[0]["ct"].ToString() + ",";
323
+        //            }
324
+        //            else
325
+        //            {
326
+        //                str += "0,";
327
+        //            }
328
+        //        }
329
+        //        else
330
+        //        {
331
+        //            str += "0,";
332
+        //        }
333
+        //    }
334
+        //    if (str != "")
335
+        //    {
336
+        //        str.Remove(str.Length - 1);
337
+        //    }
338
+        //    return str;
339
+        //}
340
+
341
+        ////坐席接听率
342
+        //private string GetJTL(string strtime)
343
+        //{
344
+        //    DataTable dt = new DataTable();
345
+        //    string str = "";
346
+        //    for (int i = 1; i <= 12; i++)
347
+        //    {
348
+        //        string sqltimeCallRecords = "";
349
+        //        string strmm = i.ToString();
350
+        //        if (i <= 9)
351
+        //        {
352
+        //            strmm = "0" + i;
353
+        //        }
354
+        //        if (strtime != "")
355
+        //        {
356
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
357
+        //            sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
358
+        //        }
359
+
360
+        //        dt = DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords + ") as jt from rep_trunk_call_in  where 1=1  " + sqltimeCallRecords).Tables[0];
361
+
362
+        //        int ibgnjt = 0;
363
+        //        double ibgnjtl = 0.00;
364
+
365
+        //        if (dt != null && dt.Rows.Count > 0)
366
+        //        {
367
+
368
+        //            if (dt.Rows[0]["jt"].ToString() != "")
369
+        //            {
370
+        //                ibgnjt = int.Parse(dt.Rows[0]["jt"].ToString());
371
+        //            }
372
+
373
+        //            if (dt.Rows[0]["ct"].ToString() != "" && dt.Rows[0]["ct"].ToString() != "0")
374
+        //            {
375
+        //                ibgnjtl = ibgnjt / Convert.ToDouble(dt.Rows[0]["ct"].ToString());
376
+        //                str += (ibgnjtl * 100).ToString("0.00") + ",";
377
+        //            }
378
+        //            else
379
+        //            {
380
+        //                str += "0.00,";
381
+        //            }
382
+        //        }
383
+        //        else
384
+        //        {
385
+        //            str += "0.00,";
386
+        //        }
387
+        //    }
388
+        //    if (str != "")
389
+        //    {
390
+        //        str.Remove(str.Length - 1);
391
+        //    }
392
+        //    return str;
393
+        //}
394
+        #endregion
289 395
     }
290 396
 }