mengjie %!s(int64=6) %!d(string=před) roky
rodič
revize
0786138988

+ 13 - 1
CallCenterApi.DAL/T_Branch_List.cs

322
                 {
322
                 {
323
                     model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
323
                     model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
324
                 }
324
                 }
325
+                if (row["F_IsDP"] != null && row["F_IsDP"].ToString() != "")
326
+                {
327
+                    model.F_IsDP = int.Parse(row["F_IsDP"].ToString());
328
+                }
329
+                if (row["F_IsSQ"] != null && row["F_IsSQ"].ToString() != "")
330
+                {
331
+                    model.F_IsSQ = int.Parse(row["F_IsSQ"].ToString());
332
+                }
333
+                if (row["F_AreaId"] != null)
334
+                {
335
+                    model.F_AreaId = row["F_AreaId"].ToString();
336
+                }
325
             }
337
             }
326
             return model;
338
             return model;
327
         }
339
         }
332
         public DataSet GetList(string strWhere)
344
         public DataSet GetList(string strWhere)
333
         {
345
         {
334
             StringBuilder strSql = new StringBuilder();
346
             StringBuilder strSql = new StringBuilder();
335
-            strSql.Append("select F_ID,F_Code,F_Name,F_Password,F_Address,F_ConName,F_ConPhone,F_ConTel,F_ConEmail,F_Url,F_Sign,F_WebSocketUrl,F_Phone,F_State,F_CreateTime,F_CreateUser,F_IsDelete,F_DeleteUser,F_DeleteTime ");
347
+            strSql.Append("select F_ID,F_Code,F_Name,F_Password,F_Address,F_ConName,F_ConPhone,F_ConTel,F_ConEmail,F_Url,F_Sign,F_WebSocketUrl,F_Phone,F_State,F_CreateTime,F_CreateUser,F_IsDelete,F_DeleteUser,F_DeleteTime,F_IsDP,F_IsSQ,F_AreaId ");
336
             strSql.Append(" FROM T_Branch_List ");
348
             strSql.Append(" FROM T_Branch_List ");
337
             if (strWhere.Trim() != "")
349
             if (strWhere.Trim() != "")
338
             {
350
             {

+ 284 - 91
CallCenterApi.Interface/Controllers/InfoController.cs

39
             {               
39
             {               
40
                 date = DateTime.Now;
40
                 date = DateTime.Now;
41
             }
41
             }
42
-            
42
+            int backtotal = 0;
43
             //string sqlwhere = " F_IsDelete=0 ";
43
             //string sqlwhere = " F_IsDelete=0 ";
44
             string sqlwhere = " F_IsDP=1 ";//大屏展示用到的
44
             string sqlwhere = " F_IsDP=1 ";//大屏展示用到的
45
+            if (branchcode == "sqs12345")
46
+            {
47
+                branchcode = "";
48
+                sqlwhere += " and F_IsSQS='0";
49
+            }
45
             if (!string.IsNullOrEmpty(branchcode))
50
             if (!string.IsNullOrEmpty(branchcode))
46
             {
51
             {
47
                 sqlwhere += " and F_Code='" + branchcode + "'";
52
                 sqlwhere += " and F_Code='" + branchcode + "'";
48
             }
53
             }
49
-
54
+            else
55
+            {
56
+                backtotal = 1;
57
+              
58
+                    sqlwhere += " and F_IsSQ!=1";
59
+                
60
+            }
61
+            int first = 1;
50
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
62
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
51
             decimal[,] countstotal=new decimal [10,24];//用于计算累计值//固定了10个市县区
63
             decimal[,] countstotal=new decimal [10,24];//用于计算累计值//固定了10个市县区
52
             decimal[] tcountstotal = new decimal[10];
64
             decimal[] tcountstotal = new decimal[10];
53
             string[] cols=new string [10];
65
             string[] cols=new string [10];
66
+            string[] colsx = new string[1];//用于县数据相加
67
+
54
             //List<object> items;
68
             //List<object> items;
55
             List<List<Dictionary<string, object>>> items = new List<List<Dictionary<string, object>>>();
69
             List<List<Dictionary<string, object>>> items = new List<List<Dictionary<string, object>>>();
56
             //IEnumerable<List<Dictionary<string, object>>> items;
70
             //IEnumerable<List<Dictionary<string, object>>> items;
80
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
94
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
81
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
95
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
82
                     {
96
                     {
83
-
97
+                        if (first == 1)
98
+                        {
99
+                            string a = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["cols"].ToString(), "[\r\n\t  ]", "");
100
+                            a = a.Replace("[", "");
101
+                            a = a.Replace("]", "");
102
+                            a = a.Replace("\"", "");
103
+                            cols = a.Split(',');
104
+                        }
105
+                        else
106
+                        {
107
+                            string a = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["cols"].ToString(), "[\r\n\t  ]", "");
108
+                            a = a.Replace("[", "");
109
+                            a = a.Replace("]", "");
110
+                            a = a.Replace("\"", "");
111
+                            colsx = a.Split(',');
112
+                        }
84
                         //string x = jo0["data"].ToString();
113
                         //string x = jo0["data"].ToString();
85
                         for (int i = 0; i < 10;i++)
114
                         for (int i = 0; i < 10;i++)
86
                         {
115
                         {
116
+                            
87
                             string y = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["counts"][i].ToString(), "[\r\n\t  ]", "");
117
                             string y = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["counts"][i].ToString(), "[\r\n\t  ]", "");
88
                             y = y.Replace("[", "");
118
                             y = y.Replace("[", "");
89
                             y = y.Replace("]", "");
119
                             y = y.Replace("]", "");
90
                             string[] z = y.Split(',');
120
                             string[] z = y.Split(',');
121
+
91
                             for (int m = 0; m < z.Length; m++)
122
                             for (int m = 0; m < z.Length; m++)
92
                             {
123
                             {
93
-                                countstotal[i,m] += decimal.Parse(z[m]);
124
+                                if (first == 1)
125
+                                {
126
+                                    countstotal[i, m] = decimal.Parse(z[m]);
127
+                                }
128
+                                else if (backtotal == 1)
129
+                                {
130
+                                    if (cols[i] == colsx[0])
131
+                                    {
132
+                                        countstotal[i, m] += decimal.Parse(z[m]);
133
+                                    }
134
+                                }
135
+                            }
136
+                            
137
+                                string p = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["tcounts"].ToString(), "[\r\n\t  ]", "");
138
+                                p = p.Replace("[", "");
139
+                                p = p.Replace("]", "");
140
+                                string[] q = p.Split(',');
141
+                            if (backtotal == 1)
142
+                            {
143
+                                if (cols[i] == colsx[0])
144
+                                {
145
+                                    tcountstotal[i] += decimal.Parse(q[0]);
146
+                                }
147
+                            }
148
+                            else
149
+                            {
150
+                                tcountstotal[i] += decimal.Parse(q[i]);
94
                             }
151
                             }
95
 
152
 
96
-                            string p = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["tcounts"].ToString(), "[\r\n\t  ]", "");
97
-                            p = p.Replace("[", "");
98
-                            p = p.Replace("]", "");
99
-                            string[] q = p.Split(',');
100
-                            tcountstotal[i] += decimal.Parse(q[i]);
101
 
153
 
102
                             //item计算
154
                             //item计算
103
-                            var rtlist = jo0["data"]["items"][0].ToJson().ToList<Dictionary<string, object>>();
104
-                            for(int r=0;r<rtlist .Count;r++)
155
+                            if (backtotal == 1)
105
                             {
156
                             {
106
-                                decimal zh = 0;
107
-                                if (items.Count > i)
157
+                                if (cols[i] == colsx[0])
108
                                 {
158
                                 {
109
-                                    zh = decimal.Parse(items[i][r]["Count"].ToString());
159
+                                    var rtlist = jo0["data"]["items"][0].ToJson().ToList<Dictionary<string, object>>();
160
+                                    for (int r = 0; r < rtlist.Count; r++)
161
+                                    {
162
+                                        decimal zh = 0;
163
+                                        if (items.Count > i)
164
+                                        {
165
+                                            zh = decimal.Parse(items[i][r]["Count"].ToString());
166
+                                        }
167
+                                        rtlist[r]["Count"] = zh + decimal.Parse(rtlist[r]["Count"].ToString());
168
+                                    }
169
+                                    //List<Dictionary<string, object>> li = new List<Dictionary<string, object>>();
170
+                                    //li.AddRange(rtlist );
171
+                                    items.Add(rtlist);
110
                                 }
172
                                 }
111
-                                rtlist[r]["Count"] = zh+decimal.Parse(rtlist[r]["Count"].ToString ());
112
                             }
173
                             }
113
-                            //List<Dictionary<string, object>> li = new List<Dictionary<string, object>>();
114
-                            //li.AddRange(rtlist );
115
-                            items.Add(rtlist );
174
+                            else
175
+                            {
176
+                                var rtlist = jo0["data"]["items"][i].ToJson().ToList<Dictionary<string, object>>();
177
+                                items.Add(rtlist);
178
+                            }
116
                         }
179
                         }
117
-                        string a = System.Text.RegularExpressions.Regex.Replace(jo0["data"]["cols"].ToString(), "[\r\n\t  ]", "");
118
-                        a = a.Replace("[", "");
119
-                        a = a.Replace("]", "");
120
-                        a = a.Replace("\"", "");
121
-                        cols = a.Split(',');
180
+                        first = 0;
122
                       
181
                       
123
                         
182
                         
124
                     }
183
                     }
137
         }
196
         }
138
 
197
 
139
         /// <summary>
198
         /// <summary>
140
-        /// 获取来源百分比
199
+        /// 获取受理区域数量
141
         /// </summary>
200
         /// </summary>
142
         /// <param name="branchcode"></param>
201
         /// <param name="branchcode"></param>
143
         /// <param name="start"></param>
202
         /// <param name="start"></param>
144
         /// <param name="end"></param>
203
         /// <param name="end"></param>
145
         /// <returns></returns>
204
         /// <returns></returns>
146
-        public ActionResult GetSourcePercentByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
205
+        public ActionResult GetAreaCountByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
147
         {
206
         {
148
 
207
 
149
             if (start == null && end == null)
208
             if (start == null && end == null)
155
             {
214
             {
156
                 if (start == null) { start = DateTime.Now; }
215
                 if (start == null) { start = DateTime.Now; }
157
                 if (end == null) { end = DateTime.Now; }
216
                 if (end == null) { end = DateTime.Now; }
158
-                
159
-            }
160
 
217
 
218
+            }
219
+            int backtotal = 0;
161
             string sqlwhere = " F_IsDP=1 ";
220
             string sqlwhere = " F_IsDP=1 ";
221
+            if (branchcode == "sqs12345")
222
+            {
223
+                branchcode = "";
224
+            }
162
             if (!string.IsNullOrEmpty(branchcode))
225
             if (!string.IsNullOrEmpty(branchcode))
163
             {
226
             {
164
                 sqlwhere += " and F_Code='" + branchcode + "'";
227
                 sqlwhere += " and F_Code='" + branchcode + "'";
165
             }
228
             }
229
+            else
230
+            {
231
+                backtotal = 1;
232
+               
233
+                    sqlwhere += " and F_IsSQ!=1";
234
+               
235
+            }
236
+
166
             #region 定义新表
237
             #region 定义新表
167
             DataTable dtnew = new DataTable();
238
             DataTable dtnew = new DataTable();
168
-            dtnew.Columns.Add("Id");
169
-            dtnew.Columns.Add("Source");
239
+            dtnew.Columns.Add("F_AreaId");
240
+            dtnew.Columns.Add("AreaName");
170
             dtnew.Columns.Add("Count");
241
             dtnew.Columns.Add("Count");
171
-            dtnew.Columns.Add("Percent");
172
-            
242
+
173
             int first = 1;
243
             int first = 1;
174
-            decimal totalcount = 0;//用于计算百分比
175
             #endregion
244
             #endregion
176
 
245
 
177
             ArrayList result = new ArrayList();
246
             ArrayList result = new ArrayList();
187
                         areaid = l.F_AreaId;
256
                         areaid = l.F_AreaId;
188
                     }
257
                     }
189
                     string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
258
                     string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
190
-                    string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&areaid=" + areaid + "&isdpjk=1" + "&signcode=" + signcode;
259
+                    string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&areaid=" + areaid + "&backtotal=" + backtotal + "&isdpjk=1" + "&signcode=" + signcode;
191
 
260
 
192
                     string ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams);//.ToObject<AjaxResult>();
261
                     string ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams);//.ToObject<AjaxResult>();
193
                     if (!string.IsNullOrEmpty(branchcode))
262
                     if (!string.IsNullOrEmpty(branchcode))
197
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
266
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
198
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
267
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
199
                     {
268
                     {
200
-                        
201
                         if (first == 1)
269
                         if (first == 1)
202
                         {
270
                         {
203
                             DataTable dt = HeadToDataTable(jo0["data"].ToString(), "Item");
271
                             DataTable dt = HeadToDataTable(jo0["data"].ToString(), "Item");
211
                         }
279
                         }
212
                         else
280
                         else
213
                         {
281
                         {
214
-                            //前部分相加
215
-                            DataTable dt1 = HeadToDataTable(jo0["data"].ToString(), "Item");
216
-                            for (int i = 0; i < dt1.Rows.Count; i++)
282
+                            for (int m = 0; m < dtnew.Rows.Count; m++)
217
                             {
283
                             {
218
-                                decimal t = decimal.Parse(dtnew.Rows[i][2].ToString()) + decimal.Parse(dt1.Rows[i][2].ToString());
219
-                                totalcount += t;
220
-                                 dtnew.Rows[i][2] = t;                               
221
-                            }
222
-                            //后半部分两个datatable相加    
223
-                            
224
-                            for (int i = 0; i < dtnew.Rows.Count; i++)
225
-                            {
226
-                                DataTable dtitem = new DataTable();
227
-                                string c = jo0["data"][i]["Item"].ToString();
228
-                                DataTable dt = HeadToDataTable(jo0["data"][i]["Item"].ToString(), "Item");
229
-                                dtitem = dt;
230
-                                DataTable dtold = HeadToDataTable(dtnew.Rows[i]["Item"].ToString(), "Item");
231
-                                for (int j = 0; j < dtold.Rows.Count; j++)
284
+                                
285
+                                //前部分相加
286
+                                DataTable dt1 = HeadToDataTable(jo0["data"].ToString(), "Item");
287
+                                for (int i = 0; i < dt1.Rows.Count; i++)
232
                                 {
288
                                 {
233
-                                    dtitem.Rows[j][1] = decimal.Parse(dtold.Rows[j][1].ToString()) + decimal.Parse(dt.Rows[j][1].ToString());
289
+                                    if (dtnew.Rows[m][1].ToString() == dt1.Rows[i][1].ToString())
290
+                                    {
291
+                                        decimal t = decimal.Parse(dtnew.Rows[i][2].ToString()) + decimal.Parse(dt1.Rows[i][2].ToString());
292
+                                        dtnew.Rows[i][2] = t;
293
+
294
+                                        //后半部分两个datatable相加    
295
+
296
+
297
+                                        DataTable dtitem = new DataTable();
298
+                                        string c = jo0["data"][i]["Item"].ToString();
299
+                                        DataTable dt = HeadToDataTable(jo0["data"][i]["Item"].ToString(), "Item");
300
+                                        dtitem = dt;
301
+                                        DataTable dtold = HeadToDataTable(dtnew.Rows[i]["Item"].ToString(), "Item");
302
+                                        for (int j = 0; j < dtold.Rows.Count; j++)
303
+                                        {
304
+                                            dtitem.Rows[j][1] = decimal.Parse(dtold.Rows[j][1].ToString()) + decimal.Parse(dt.Rows[j][1].ToString());
305
+                                        }
306
+                                        dtnew.Rows[i]["Item"] = dtitem;
307
+                                    }
234
                                 }
308
                                 }
235
-                                dtnew.Rows[i]["Item"] = dtitem;                       
236
                             }
309
                             }
237
                         }
310
                         }
238
-                        //var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
239
-                        //result.AddRange(rtlist);
240
                     }
311
                     }
241
                 }
312
                 }
242
             }
313
             }
243
-            //计算百分比
244
-            if (totalcount > 0)
245
-            {
246
-                for (int m = 0; m < dtnew.Rows.Count; m++)
247
-                {
248
-                    dtnew.Rows[m]["Percent"] = Math.Round(decimal.Parse(dtnew.Rows[m]["Count"].ToString()) / totalcount * 100, 2);
249
-                }
250
-            }
251
-            return Success("成功", dtnew );
314
+            return Success("成功", dtnew);
252
         }
315
         }
253
 
316
 
254
         /// <summary>
317
         /// <summary>
255
-        /// 获取受理区域数量
318
+        /// 获取来源百分比
256
         /// </summary>
319
         /// </summary>
257
         /// <param name="branchcode"></param>
320
         /// <param name="branchcode"></param>
258
         /// <param name="start"></param>
321
         /// <param name="start"></param>
259
         /// <param name="end"></param>
322
         /// <param name="end"></param>
260
         /// <returns></returns>
323
         /// <returns></returns>
261
-        public ActionResult GetAreaCountByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
324
+        public ActionResult GetSourcePercentByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
262
         {
325
         {
263
 
326
 
264
             if (start == null && end == null)
327
             if (start == null && end == null)
270
             {
333
             {
271
                 if (start == null) { start = DateTime.Now; }
334
                 if (start == null) { start = DateTime.Now; }
272
                 if (end == null) { end = DateTime.Now; }
335
                 if (end == null) { end = DateTime.Now; }
273
-
336
+                
274
             }
337
             }
275
 
338
 
276
             string sqlwhere = " F_IsDP=1 ";
339
             string sqlwhere = " F_IsDP=1 ";
340
+            if (branchcode == "sqs12345")
341
+            {
342
+                branchcode = "";
343
+            }
277
             if (!string.IsNullOrEmpty(branchcode))
344
             if (!string.IsNullOrEmpty(branchcode))
278
             {
345
             {
279
                 sqlwhere += " and F_Code='" + branchcode + "'";
346
                 sqlwhere += " and F_Code='" + branchcode + "'";
280
             }
347
             }
281
-
348
+            else
349
+            {
350
+                sqlwhere += " and F_IsSQ!=1";
351
+            }
282
             #region 定义新表
352
             #region 定义新表
283
             DataTable dtnew = new DataTable();
353
             DataTable dtnew = new DataTable();
284
-            dtnew.Columns.Add("F_AreaId");
285
-            dtnew.Columns.Add("AreaName");
354
+            dtnew.Columns.Add("Id");
355
+            dtnew.Columns.Add("Source");
286
             dtnew.Columns.Add("Count");
356
             dtnew.Columns.Add("Count");
357
+            dtnew.Columns.Add("Percent");
287
             
358
             
288
             int first = 1;
359
             int first = 1;
360
+            decimal totalcount = 0;//用于计算百分比
289
             #endregion
361
             #endregion
290
 
362
 
291
             ArrayList result = new ArrayList();
363
             ArrayList result = new ArrayList();
311
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
383
                     JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
312
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
384
                     if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
313
                     {
385
                     {
386
+                        
314
                         if (first == 1)
387
                         if (first == 1)
315
                         {
388
                         {
316
                             DataTable dt = HeadToDataTable(jo0["data"].ToString(), "Item");
389
                             DataTable dt = HeadToDataTable(jo0["data"].ToString(), "Item");
329
                             for (int i = 0; i < dt1.Rows.Count; i++)
402
                             for (int i = 0; i < dt1.Rows.Count; i++)
330
                             {
403
                             {
331
                                 decimal t = decimal.Parse(dtnew.Rows[i][2].ToString()) + decimal.Parse(dt1.Rows[i][2].ToString());
404
                                 decimal t = decimal.Parse(dtnew.Rows[i][2].ToString()) + decimal.Parse(dt1.Rows[i][2].ToString());
332
-                                dtnew.Rows[i][2] = t;
405
+                                totalcount += t;
406
+                                 dtnew.Rows[i][2] = t;                               
333
                             }
407
                             }
334
                             //后半部分两个datatable相加    
408
                             //后半部分两个datatable相加    
335
-
409
+                            
336
                             for (int i = 0; i < dtnew.Rows.Count; i++)
410
                             for (int i = 0; i < dtnew.Rows.Count; i++)
337
                             {
411
                             {
338
                                 DataTable dtitem = new DataTable();
412
                                 DataTable dtitem = new DataTable();
344
                                 {
418
                                 {
345
                                     dtitem.Rows[j][1] = decimal.Parse(dtold.Rows[j][1].ToString()) + decimal.Parse(dt.Rows[j][1].ToString());
419
                                     dtitem.Rows[j][1] = decimal.Parse(dtold.Rows[j][1].ToString()) + decimal.Parse(dt.Rows[j][1].ToString());
346
                                 }
420
                                 }
347
-                                dtnew.Rows[i]["Item"] = dtitem;
421
+                                dtnew.Rows[i]["Item"] = dtitem;                       
348
                             }
422
                             }
349
                         }
423
                         }
424
+                        //var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
425
+                        //result.AddRange(rtlist);
350
                     }
426
                     }
351
                 }
427
                 }
352
             }
428
             }
429
+            //计算百分比
430
+            if (totalcount > 0)
431
+            {
432
+                for (int m = 0; m < dtnew.Rows.Count; m++)
433
+                {
434
+                    dtnew.Rows[m]["Percent"] = Math.Round(decimal.Parse(dtnew.Rows[m]["Count"].ToString()) / totalcount * 100, 2);
435
+                }
436
+            }
353
             return Success("成功", dtnew );
437
             return Success("成功", dtnew );
354
         }
438
         }
355
 
439
 
440
+        
441
+
356
         /// <summary>
442
         /// <summary>
357
         /// 获取来源数量百分比
443
         /// 获取来源数量百分比
358
         /// </summary>
444
         /// </summary>
376
             }
462
             }
377
 
463
 
378
             string sqlwhere = " F_IsDP=1 ";
464
             string sqlwhere = " F_IsDP=1 ";
465
+            if (branchcode == "sqs12345")
466
+            {
467
+                branchcode = "";
468
+            }
379
             if (!string.IsNullOrEmpty(branchcode))
469
             if (!string.IsNullOrEmpty(branchcode))
380
             {
470
             {
381
                 sqlwhere += " and F_Code='" + branchcode + "'";
471
                 sqlwhere += " and F_Code='" + branchcode + "'";
382
             }
472
             }
473
+            else
474
+            {
475
+                sqlwhere += " and F_IsSQ!=1";
476
+            }
383
 
477
 
384
             #region 定义新表
478
             #region 定义新表
385
             DataTable dtnew = new DataTable();
479
             DataTable dtnew = new DataTable();
442
                 }
536
                 }
443
             }
537
             }
444
             //计算百分比
538
             //计算百分比
445
-            dtnew.Columns.Add("Percent", typeof(object));
539
+            //dtnew.Columns.Add("Percent", typeof(object));
446
             if (totalcount > 0)
540
             if (totalcount > 0)
447
             {
541
             {
448
                 for (int m = 0; m < dtnew.Rows.Count; m++)
542
                 for (int m = 0; m < dtnew.Rows.Count; m++)
450
                     dtnew.Rows[m]["Percent"] = Math.Round(decimal.Parse(dtnew.Rows[m]["Count"].ToString()) / totalcount * 100, 2).ToString ()+"%";
544
                     dtnew.Rows[m]["Percent"] = Math.Round(decimal.Parse(dtnew.Rows[m]["Count"].ToString()) / totalcount * 100, 2).ToString ()+"%";
451
                 }
545
                 }
452
             }
546
             }
453
-            return Success("成功", result);
547
+            return Success("成功", dtnew);
454
         }
548
         }
455
         #endregion
549
         #endregion
456
 
550
 
462
         /// <returns></returns>
556
         /// <returns></returns>
463
         public ActionResult GetStateCountMonthByDate(string branchcode, string areaid)
557
         public ActionResult GetStateCountMonthByDate(string branchcode, string areaid)
464
         {
558
         {
465
-
559
+            if (branchcode == "sqs12345")
560
+            {
561
+                branchcode = "";
562
+            }
466
             string sqlwhere = " F_IsDP=1 ";
563
             string sqlwhere = " F_IsDP=1 ";
467
             if (!string.IsNullOrEmpty(branchcode))
564
             if (!string.IsNullOrEmpty(branchcode))
468
             {
565
             {
469
                 sqlwhere += " and F_Code='" + branchcode + "'";
566
                 sqlwhere += " and F_Code='" + branchcode + "'";
470
             }
567
             }
568
+            else
569
+            {
570
+                sqlwhere += " and F_IsSQ!=1";
571
+            }
471
             decimal[,] countstotal = new decimal[10, 12];//用于计算累计值
572
             decimal[,] countstotal = new decimal[10, 12];//用于计算累计值
472
             string[] cols = new string[10];
573
             string[] cols = new string[10];
473
             string[] months = new string[12];
574
             string[] months = new string[12];
542
         /// <returns></returns>
643
         /// <returns></returns>
543
         public ActionResult GetDeptCountByDateNew(string branchcode, DateTime? start, DateTime? end, string areaid, int deptid = 0)
644
         public ActionResult GetDeptCountByDateNew(string branchcode, DateTime? start, DateTime? end, string areaid, int deptid = 0)
544
         {
645
         {
545
-
646
+            if (branchcode == "sqs12345")
647
+            {
648
+                branchcode = "";
649
+            }
546
             if (start == null && end == null)
650
             if (start == null && end == null)
547
             {
651
             {
548
                 start = DateTime.Now;
652
                 start = DateTime.Now;
560
             {
664
             {
561
                 sqlwhere += " and F_Code='" + branchcode + "'";
665
                 sqlwhere += " and F_Code='" + branchcode + "'";
562
             }
666
             }
667
+            else
668
+            {
669
+                sqlwhere += " and F_IsSQ!=1";
670
+            }
563
 
671
 
564
             ArrayList result = new ArrayList();
672
             ArrayList result = new ArrayList();
565
             var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
673
             var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
596
         /// <returns></returns>
704
         /// <returns></returns>
597
         public ActionResult GetDealCount24ByDate(string branchcode, DateTime? date, string areaid)
705
         public ActionResult GetDealCount24ByDate(string branchcode, DateTime? date, string areaid)
598
         {
706
         {
599
-
707
+            if (branchcode == "sqs12345")
708
+            {
709
+                branchcode = "";
710
+            }
600
             if (date == null)
711
             if (date == null)
601
             {
712
             {
602
                 date = DateTime.Now;
713
                 date = DateTime.Now;
607
             {
718
             {
608
                 sqlwhere += " and F_Code='" + branchcode + "'";
719
                 sqlwhere += " and F_Code='" + branchcode + "'";
609
             }
720
             }
721
+            else
722
+            {
723
+                sqlwhere += " and F_IsSQ!=1";
724
+            }
610
 
725
 
611
             int[] hours = Enumerable.Range(7, 12).ToArray<int>();
726
             int[] hours = Enumerable.Range(7, 12).ToArray<int>();
612
             int[] acounts = new int[12];
727
             int[] acounts = new int[12];
671
         /// <returns></returns>
786
         /// <returns></returns>
672
         public ActionResult GetStateCountByMonth(string branchcode, string month, string day, string areaid)
787
         public ActionResult GetStateCountByMonth(string branchcode, string month, string day, string areaid)
673
         {
788
         {
789
+            if (branchcode == "sqs12345")
790
+            {
791
+                branchcode = "";
792
+            }
674
             if (string.IsNullOrEmpty(month))
793
             if (string.IsNullOrEmpty(month))
675
             {
794
             {
676
                 month = DateTime.Now.ToString("yyyy-MM");
795
                 month = DateTime.Now.ToString("yyyy-MM");
684
             {
803
             {
685
                 sqlwhere += " and F_Code='" + branchcode + "'";
804
                 sqlwhere += " and F_Code='" + branchcode + "'";
686
             }
805
             }
806
+            else
807
+            {
808
+                sqlwhere += " and F_IsSQ!=1";
809
+            }
687
             #region 定义新表
810
             #region 定义新表
688
             DataTable dtnew = new DataTable();
811
             DataTable dtnew = new DataTable();
689
             dtnew.Columns.Add("State");
812
             dtnew.Columns.Add("State");
752
         /// <returns></returns>
875
         /// <returns></returns>
753
         public ActionResult GetTypeCountMonthByDate(string branchcode, string start, string end, string areaid)
876
         public ActionResult GetTypeCountMonthByDate(string branchcode, string start, string end, string areaid)
754
         {
877
         {
755
-
878
+            if (branchcode == "sqs12345")
879
+            {
880
+                branchcode = "";
881
+            }
756
             string sqlwhere = " F_IsDP=1 ";
882
             string sqlwhere = " F_IsDP=1 ";
757
             if (!string.IsNullOrEmpty(branchcode))
883
             if (!string.IsNullOrEmpty(branchcode))
758
             {
884
             {
759
                 sqlwhere += " and F_Code='" + branchcode + "'";
885
                 sqlwhere += " and F_Code='" + branchcode + "'";
760
             }
886
             }
887
+            else
888
+            {
889
+                sqlwhere += " and F_IsSQ!=1";
890
+            }
761
             #region 变量定义
891
             #region 变量定义
762
             DateTime startdate = DateTime.Now.AddMonths(-12);
892
             DateTime startdate = DateTime.Now.AddMonths(-12);
763
             DateTime enddate = DateTime.Now;
893
             DateTime enddate = DateTime.Now;
847
         /// <returns></returns>
977
         /// <returns></returns>
848
         public ActionResult GetKeyCountByDateNew(string branchcode, DateTime? start, DateTime? end, string areaid, int keyid = 0)
978
         public ActionResult GetKeyCountByDateNew(string branchcode, DateTime? start, DateTime? end, string areaid, int keyid = 0)
849
         {
979
         {
850
-
980
+            if (branchcode == "sqs12345")
981
+            {
982
+                branchcode = "";
983
+            }
851
             if (start == null && end == null)
984
             if (start == null && end == null)
852
             {
985
             {
853
                 start = DateTime.Now;
986
                 start = DateTime.Now;
865
             {
998
             {
866
                 sqlwhere += " and F_Code='" + branchcode + "'";
999
                 sqlwhere += " and F_Code='" + branchcode + "'";
867
             }
1000
             }
1001
+            else
1002
+            {
1003
+                sqlwhere += " and F_IsSQ!=1";
1004
+            }
868
 
1005
 
869
             #region 定义新表
1006
             #region 定义新表
870
             DataTable dtnew = new DataTable();
1007
             DataTable dtnew = new DataTable();
948
 
1085
 
949
                 //dtTemp.Columns.Add(autoColumn);
1086
                 //dtTemp.Columns.Add(autoColumn);
950
 
1087
 
951
-                dtTemp.Columns["排名"].SetOrdinal(0);
1088
+                //dtTemp.Columns["排名"].SetOrdinal(0);
952
 
1089
 
953
                 for (int i = 0; i < dtTemp.Rows.Count; i++)
1090
                 for (int i = 0; i < dtTemp.Rows.Count; i++)
954
                 {
1091
                 {
955
-                    dtTemp.Rows[i][0] = i + 1;
1092
+                    dtTemp.Rows[i]["排名"] = i + 1;
956
                 }
1093
                 }
957
 
1094
 
958
             }
1095
             }
969
         /// <returns></returns>
1106
         /// <returns></returns>
970
         public ActionResult GetTypeCountByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
1107
         public ActionResult GetTypeCountByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
971
         {
1108
         {
972
-
1109
+            if (branchcode == "sqs12345")
1110
+            {
1111
+                branchcode = "";
1112
+            }
973
             if (start == null && end == null)
1113
             if (start == null && end == null)
974
             {
1114
             {
975
                 start = DateTime.Now;
1115
                 start = DateTime.Now;
987
             {
1127
             {
988
                 sqlwhere += " and F_Code='" + branchcode + "'";
1128
                 sqlwhere += " and F_Code='" + branchcode + "'";
989
             }
1129
             }
1130
+            else
1131
+            {
1132
+                sqlwhere += " and F_IsSQ!=1";
1133
+            }
990
 
1134
 
991
             #region 定义新表
1135
             #region 定义新表
992
             DataTable dtnew = new DataTable();
1136
             DataTable dtnew = new DataTable();
1058
         /// <returns></returns>
1202
         /// <returns></returns>
1059
         public ActionResult GetUserStateCount24ByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
1203
         public ActionResult GetUserStateCount24ByDate(string branchcode, DateTime? start, DateTime? end, string areaid)
1060
         {
1204
         {
1061
-
1205
+            if (branchcode == "sqs12345")
1206
+            {
1207
+                branchcode = "";
1208
+            }
1062
             if (start == null && end == null)
1209
             if (start == null && end == null)
1063
             {
1210
             {
1064
                 start = DateTime.Now;
1211
                 start = DateTime.Now;
1076
             {
1223
             {
1077
                 sqlwhere += " and F_Code='" + branchcode + "'";
1224
                 sqlwhere += " and F_Code='" + branchcode + "'";
1078
             }
1225
             }
1226
+            else
1227
+            {
1228
+                sqlwhere += " and F_IsSQ!=1";
1229
+            }
1079
 
1230
 
1080
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1231
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1081
             double[] kxpercents = new double[24];
1232
             double[] kxpercents = new double[24];
1191
         /// <returns></returns>
1342
         /// <returns></returns>
1192
         public ActionResult GetTelCount24ByDate(string branchcode, DateTime? date, string areaid)
1343
         public ActionResult GetTelCount24ByDate(string branchcode, DateTime? date, string areaid)
1193
         {
1344
         {
1194
-
1345
+            if (branchcode == "sqs12345")
1346
+            {
1347
+                branchcode = "";
1348
+            }
1195
             if (date == null)
1349
             if (date == null)
1196
             {
1350
             {
1197
                 date = DateTime.Now;
1351
                 date = DateTime.Now;
1202
             {
1356
             {
1203
                 sqlwhere += " and F_Code='" + branchcode + "'";
1357
                 sqlwhere += " and F_Code='" + branchcode + "'";
1204
             }
1358
             }
1359
+            else
1360
+            {
1361
+                sqlwhere += " and F_IsSQ!=1";
1362
+            }
1205
 
1363
 
1206
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1364
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1207
             int[] rcounts = new int[24];//来电数量
1365
             int[] rcounts = new int[24];//来电数量
1290
         /// <returns></returns>
1448
         /// <returns></returns>
1291
         public ActionResult GetTelCountByDate(string branchcode, DateTime? date, string areaid)
1449
         public ActionResult GetTelCountByDate(string branchcode, DateTime? date, string areaid)
1292
         {
1450
         {
1293
-
1451
+            if (branchcode == "sqs12345")
1452
+            {
1453
+                branchcode = "";
1454
+            }
1294
             if (date == null)
1455
             if (date == null)
1295
             {
1456
             {
1296
                 date = DateTime.Now;
1457
                 date = DateTime.Now;
1301
             {
1462
             {
1302
                 sqlwhere += " and F_Code='" + branchcode + "'";
1463
                 sqlwhere += " and F_Code='" + branchcode + "'";
1303
             }
1464
             }
1465
+            else
1466
+            {
1467
+                sqlwhere += " and F_IsSQ!=1";
1468
+            }
1304
 
1469
 
1305
             decimal hwcon=0;
1470
             decimal hwcon=0;
1306
             decimal lhcon = 0;
1471
             decimal lhcon = 0;
1373
         /// <returns></returns>
1538
         /// <returns></returns>
1374
         public ActionResult GetTypeCountNew(string branchcode, string areaid)
1539
         public ActionResult GetTypeCountNew(string branchcode, string areaid)
1375
         {
1540
         {
1376
-
1541
+            if (branchcode == "sqs12345")
1542
+            {
1543
+                branchcode = "";
1544
+            }
1377
             string sqlwhere = " F_IsDP=1 ";
1545
             string sqlwhere = " F_IsDP=1 ";
1378
             if (!string.IsNullOrEmpty(branchcode))
1546
             if (!string.IsNullOrEmpty(branchcode))
1379
             {
1547
             {
1380
                 sqlwhere += " and F_Code='" + branchcode + "'";
1548
                 sqlwhere += " and F_Code='" + branchcode + "'";
1381
             }
1549
             }
1550
+            else
1551
+            {
1552
+                sqlwhere += " and F_IsSQ!=1";
1553
+            }
1382
 
1554
 
1383
             #region 定义新表
1555
             #region 定义新表
1384
             DataTable dtnew = new DataTable();
1556
             DataTable dtnew = new DataTable();
1466
         /// <returns></returns>
1638
         /// <returns></returns>
1467
         public ActionResult GetTelRate24ByDate(string branchcode, DateTime? date, string areaid)
1639
         public ActionResult GetTelRate24ByDate(string branchcode, DateTime? date, string areaid)
1468
         {
1640
         {
1469
-
1641
+            if (branchcode == "sqs12345")
1642
+            {
1643
+                branchcode = "";
1644
+            }
1470
             if (date == null)
1645
             if (date == null)
1471
             {
1646
             {
1472
                 date = DateTime.Now;
1647
                 date = DateTime.Now;
1477
             {
1652
             {
1478
                 sqlwhere += " and F_Code='" + branchcode + "'";
1653
                 sqlwhere += " and F_Code='" + branchcode + "'";
1479
             }
1654
             }
1655
+            else
1656
+            {
1657
+                sqlwhere += " and F_IsSQ!=1";
1658
+            }
1480
 
1659
 
1481
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1660
             int[] hours = Enumerable.Range(0, 24).ToArray<int>();
1482
             int[] jt = new int[24];
1661
             int[] jt = new int[24];
1613
                                     DataRow dataRow = dataTable.NewRow();
1792
                                     DataRow dataRow = dataTable.NewRow();
1614
                                     foreach (var li in cname )
1793
                                     foreach (var li in cname )
1615
                                     {
1794
                                     {
1616
-                                        dataRow[li] = dictionary[li];
1795
+                                        if (dictionary[li] == null)
1796
+                                        {
1797
+                                            dataRow[li] = -1;
1798
+                                        }
1799
+                                        else
1800
+                                        {
1801
+                                            dataRow[li] = dictionary[li];
1802
+                                        }
1803
+                                        
1617
                                     }
1804
                                     }
1618
                                     //dataRow[root] = dictionary[root];
1805
                                     //dataRow[root] = dictionary[root];
1619
                                     foreach (string key in dic.Keys)
1806
                                     foreach (string key in dic.Keys)
1692
                             
1879
                             
1693
                             foreach (var li in cname)
1880
                             foreach (var li in cname)
1694
                             {
1881
                             {
1695
-
1696
-                                dataRow[li] = dictionary[li];
1882
+                                if (dictionary[li] == null)
1883
+                                {
1884
+                                    dataRow[li] = -1;
1885
+                                }
1886
+                                else
1887
+                                {
1888
+                                    dataRow[li] = dictionary[li];
1889
+                                }
1697
                             }
1890
                             }
1698
                             //dataRow[root] = dictionary[root];                          
1891
                             //dataRow[root] = dictionary[root];                          
1699
                             
1892
                             

+ 22 - 2
CallCenterApi.Model/T_Branch_List.cs

29
         private int? _f_isdelete;
29
         private int? _f_isdelete;
30
         private string _f_deleteuser;
30
         private string _f_deleteuser;
31
         private DateTime? _f_deletetime;
31
         private DateTime? _f_deletetime;
32
-        private string  _f_areaid;
32
+        private string    _f_areaid;
33
+        private int _f_isdp;
34
+        private int _f_issq;
33
         /// <summary>
35
         /// <summary>
34
         /// 
36
         /// 
35
         /// </summary>
37
         /// </summary>
186
         /// <summary>
188
         /// <summary>
187
         /// 
189
         /// 
188
         /// </summary>
190
         /// </summary>
189
-        public string F_AreaId
191
+        public string  F_AreaId
190
         {
192
         {
191
             set { _f_areaid = value; }
193
             set { _f_areaid = value; }
192
             get { return _f_areaid; }
194
             get { return _f_areaid; }
193
         }
195
         }
196
+
197
+        /// <summary>
198
+        /// 
199
+        /// </summary>
200
+        public int F_IsDP
201
+        {
202
+            set { _f_isdp = value; }
203
+            get { return _f_isdp; }
204
+        }
205
+
206
+        /// <summary>
207
+        /// 
208
+        /// </summary>
209
+        public int F_IsSQ
210
+        {
211
+            set { _f_issq = value; }
212
+            get { return _f_issq; }
213
+        }
194
         #endregion Model
214
         #endregion Model
195
 
215
 
196
     }
216
     }