Просмотр исходного кода

问题:员工考核分析中的报表统一加上“部门”的筛选条件,目前只有坐席工作量有这一项,其他没有

lihai лет назад: 7
Родитель
Сommit
837c67890c

+ 34 - 19
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/YearContrastController.cs

@@ -15,7 +15,7 @@ namespace CallCenterApi.Interface.Controllers.report
15 15
     public class YearContrastController : BaseController
16 16
     {
17 17
         //呼叫数据对比
18
-        public ActionResult GetDataList(string beginyear,string endyear)
18
+        public ActionResult GetDataList(string beginyear,string endyear, string dpt)
19 19
         {
20 20
             ActionResult res = NoToken("未知错误,请重新登录");
21 21
          
@@ -26,7 +26,7 @@ namespace CallCenterApi.Interface.Controllers.report
26 26
                     var data = new
27 27
                     {
28 28
                         key = beginyear + "客户呼叫数",
29
-                        value = GetKhCall(beginyear).TrimEnd(',').Split(','),
29
+                        value = GetKhCall(beginyear, dpt).TrimEnd(',').Split(','),
30 30
                         type = 0
31 31
                     };
32 32
                     arrlist.Add(data);
@@ -34,7 +34,7 @@ namespace CallCenterApi.Interface.Controllers.report
34 34
                     var data1 = new
35 35
                     {
36 36
                         key = beginyear + "坐席接听数",
37
-                        value = GetZxJt(beginyear).TrimEnd(',').Split(','),
37
+                        value = GetZxJt(beginyear, dpt).TrimEnd(',').Split(','),
38 38
                         type = 0
39 39
                     };
40 40
                     arrlist.Add(data1);
@@ -42,7 +42,7 @@ namespace CallCenterApi.Interface.Controllers.report
42 42
                     var data2 = new
43 43
                     {
44 44
                         key = beginyear + "接通率",
45
-                        value = GetJTL(beginyear).TrimEnd(',').Split(','),
45
+                        value = GetJTL(beginyear, dpt).TrimEnd(',').Split(','),
46 46
                         type = 0
47 47
                     };
48 48
                     arrlist.Add(data2);
@@ -52,7 +52,7 @@ namespace CallCenterApi.Interface.Controllers.report
52 52
                     var data = new
53 53
                     {
54 54
                         key = endyear + "客户呼叫数",
55
-                        value = GetKhCall(endyear).TrimEnd(',').Split(','),
55
+                        value = GetKhCall(endyear, dpt).TrimEnd(',').Split(','),
56 56
                         type = 1
57 57
                     };
58 58
                     arrlist.Add(data);
@@ -60,7 +60,7 @@ namespace CallCenterApi.Interface.Controllers.report
60 60
                     var data1 = new
61 61
                     {
62 62
                         key = endyear + "坐席接听数",
63
-                        value = GetZxJt(endyear).TrimEnd(',').Split(','),
63
+                        value = GetZxJt(endyear, dpt).TrimEnd(',').Split(','),
64 64
                         type = 1
65 65
                     };
66 66
                     arrlist.Add(data1);
@@ -68,7 +68,7 @@ namespace CallCenterApi.Interface.Controllers.report
68 68
                     var data2 = new
69 69
                     {
70 70
                         key = endyear + "接通率",
71
-                        value = GetJTL(endyear).TrimEnd(',').Split(','),
71
+                        value = GetJTL(endyear, dpt).TrimEnd(',').Split(','),
72 72
                         type = 1
73 73
                     };
74 74
                     arrlist.Add(data2);
@@ -80,14 +80,14 @@ namespace CallCenterApi.Interface.Controllers.report
80 80
         }
81 81
 
82 82
         //导出数据
83
-        public ActionResult ExptList(string beginyear, string endyear)
83
+        public ActionResult ExptList(string beginyear, string endyear, string dpt)
84 84
         {
85 85
             ActionResult res = NoToken("未知错误,请重新登录");
86 86
             //if (Request.IsAuthenticated)
87 87
             if(1==1)
88 88
             {
89 89
                 NPOIHelper npoi = new NPOIHelper();
90
-                DataTable dt = GetData(beginyear, endyear);
90
+                DataTable dt = GetData(beginyear, endyear, dpt);
91 91
                 if (npoi.ExportToExcel("呼叫数据分析数据", dt) == "")
92 92
                 {
93 93
                     return Success("导出成功");
@@ -100,7 +100,7 @@ namespace CallCenterApi.Interface.Controllers.report
100 100
             return res;
101 101
         }
102 102
 
103
-        private DataTable GetData(string beginyear, string endyear)
103
+        private DataTable GetData(string beginyear, string endyear, string dpt)
104 104
         {
105 105
             DataTable dtNew = new DataTable();
106 106
             if ((beginyear != null && beginyear.Trim() != "")&&(endyear != null && endyear.Trim() != ""))
@@ -122,13 +122,13 @@ namespace CallCenterApi.Interface.Controllers.report
122 122
                 dtNew.Columns.Add(dc6);
123 123
                 dtNew.Columns.Add(dc7);
124 124
                 #endregion
125
-                string[] bkhcall = GetKhCall(beginyear).Split(',');
126
-                string[] bzxjt = GetZxJt(beginyear).Split(',');
127
-                string[] bjtl = GetJTL(beginyear).Split(',');
125
+                string[] bkhcall = GetKhCall(beginyear,dpt).Split(',');
126
+                string[] bzxjt = GetZxJt(beginyear,dpt).Split(',');
127
+                string[] bjtl = GetJTL(beginyear, dpt).Split(',');
128 128
 
129
-                string[] ekhcall = GetKhCall(endyear).Split(',');
130
-                string[] ezxjt = GetZxJt(endyear).Split(',');
131
-                string[] ejtl = GetJTL(endyear).Split(',');
129
+                string[] ekhcall = GetKhCall(endyear, dpt).Split(',');
130
+                string[] ezxjt = GetZxJt(endyear, dpt).Split(',');
131
+                string[] ejtl = GetJTL(endyear, dpt).Split(',');
132 132
 
133 133
                 for (int i = 0; i < 12; i++)
134 134
                 {
@@ -148,7 +148,7 @@ namespace CallCenterApi.Interface.Controllers.report
148 148
         }
149 149
 
150 150
         //客户呼叫数
151
-        private string GetKhCall(string strtime)
151
+        private string GetKhCall(string strtime, string dpt)
152 152
         {
153 153
             DataTable dt = new DataTable();
154 154
             string str = "";
@@ -160,6 +160,11 @@ namespace CallCenterApi.Interface.Controllers.report
160 160
                 {
161 161
                     strmm = "0" + i;
162 162
                 }
163
+                //2018-07-06 lihai 部门搜索条件
164
+                if (!string.IsNullOrEmpty(dpt))
165
+                {
166
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
167
+                }
163 168
                 if (strtime != "")
164 169
                 {
165 170
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
@@ -191,7 +196,7 @@ namespace CallCenterApi.Interface.Controllers.report
191 196
         }
192 197
 
193 198
         //坐席接听数
194
-        private string GetZxJt(string strtime)
199
+        private string GetZxJt(string strtime, string dpt)
195 200
         {
196 201
             DataTable dt = new DataTable();
197 202
             string str = "";
@@ -203,6 +208,11 @@ namespace CallCenterApi.Interface.Controllers.report
203 208
                 {
204 209
                     strmm = "0" + i;
205 210
                 }
211
+                //2018-07-06 lihai 部门搜索条件
212
+                if (!string.IsNullOrEmpty(dpt))
213
+                {
214
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
215
+                }
206 216
                 if (strtime != "")
207 217
                 {
208 218
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
@@ -234,7 +244,7 @@ namespace CallCenterApi.Interface.Controllers.report
234 244
         }
235 245
 
236 246
         //坐席接听率
237
-        private string GetJTL(string strtime)
247
+        private string GetJTL(string strtime, string dpt)
238 248
         {
239 249
             DataTable dt = new DataTable();
240 250
             string str = "";
@@ -246,6 +256,11 @@ namespace CallCenterApi.Interface.Controllers.report
246 256
                 {
247 257
                     strmm = "0" + i;
248 258
                 }
259
+                //2018-07-06 lihai 部门搜索条件
260
+                if (!string.IsNullOrEmpty(dpt))
261
+                {
262
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
263
+                }
249 264
                 if (strtime != "")
250 265
                 {
251 266
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";

+ 13 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/ZuoXiManYiDuController.cs

@@ -28,24 +28,24 @@ namespace CallCenterApi.Interface.Controllers.report
28 28
             return res;
29 29
         }
30 30
         //获取数据
31
-        public ActionResult GetDataList(string stime, string endtime)
31
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
32 32
         {
33 33
             ActionResult res = NoToken("未知错误,请重新登录");
34 34
 
35 35
             DataTable dtNew = new DataTable();
36
-            dtNew = getData(stime, endtime);
36
+            dtNew = getData(stime, endtime, dpt);
37 37
             res = Success("获取坐席满意度评价情况报表数据成功", dtNew);
38 38
             return res;
39 39
         }
40 40
 
41 41
         //导出数据
42
-        public ActionResult ExptList(string stime, string endtime)
42
+        public ActionResult ExptList(string stime, string endtime, string dpt)
43 43
         {
44 44
             ActionResult res = NoToken("未知错误,请重新登录");
45 45
             if (Request.IsAuthenticated)
46 46
             {
47 47
                 NPOIHelper npoi = new NPOIHelper();
48
-                DataTable dt = getData(stime, endtime);
48
+                DataTable dt = getData(stime, endtime, dpt);
49 49
                 if (npoi.ExportToExcel("坐席满意度评价情况", dt) == "")
50 50
                 {
51 51
                     return Success("导出成功");
@@ -58,7 +58,7 @@ namespace CallCenterApi.Interface.Controllers.report
58 58
             return res;
59 59
         }
60 60
 
61
-        private DataTable getData(string stime, string endtime)
61
+        private DataTable getData(string stime, string endtime, string dpt)
62 62
         {
63 63
             DataTable dtNew = new DataTable();
64 64
             #region
@@ -97,7 +97,14 @@ namespace CallCenterApi.Interface.Controllers.report
97 97
             Dictionary<string, List<List<string>>> body = new Dictionary<string, List<List<string>>>();
98 98
             //坐席
99 99
             //DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_RoleId in (1,4,28,29) and F_DeleteFlag=0").Tables[0];//客服坐席、班长坐席、售前坐席、投诉坐席
100
-            DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_DeleteFlag=0").Tables[0];
100
+
101
+            //2018-07-06 lihai 部门搜索条件
102
+            var sqldtable = "";
103
+            if (!string.IsNullOrEmpty(dpt))
104
+            {
105
+                sqldtable += $" and F_DeptId = {dpt}";
106
+            }
107
+            DataTable dtable = new BLL.T_Sys_UserAccount().GetList($"F_DeleteFlag=0 {sqldtable}").Tables[0];
101 108
             int allcount = dtable.Rows.Count;
102 109
             for (int i = 0; i < allcount; i++)
103 110
             {

+ 12 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/ZuoXiTongHuaController.cs

@@ -30,12 +30,12 @@ namespace CallCenterApi.Interface.Controllers.report
30 30
             return res;
31 31
         }
32 32
         //获取数据
33
-        public ActionResult GetDataList(string stime, string endtime)
33
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
34 34
         {
35 35
             ActionResult res = NoToken("未知错误,请重新登录");
36 36
          
37 37
                 DataTable dtNew = new DataTable();
38
-                dtNew = getData(stime, endtime);
38
+                dtNew = getData(stime, endtime, dpt);
39 39
                 #region
40 40
                 //#region
41 41
                 //DataColumn dc1 = new DataColumn("坐席人员");
@@ -186,13 +186,13 @@ namespace CallCenterApi.Interface.Controllers.report
186 186
         }
187 187
 
188 188
         //导出数据
189
-        public ActionResult ExptList(string stime, string endtime)
189
+        public ActionResult ExptList(string stime, string endtime, string dpt)
190 190
         {
191 191
             ActionResult res = NoToken("未知错误,请重新登录");
192 192
             if (Request.IsAuthenticated)
193 193
             {
194 194
                 NPOIHelper npoi = new NPOIHelper();
195
-                DataTable dt = getData(stime, endtime);
195
+                DataTable dt = getData(stime, endtime, dpt);
196 196
                 if (npoi.ExportToExcel("坐席日通话时长数据", dt) == "")
197 197
                 {
198 198
                     return Success("导出成功");
@@ -211,7 +211,7 @@ namespace CallCenterApi.Interface.Controllers.report
211 211
         /// <param name="stime"></param>
212 212
         /// <param name="endtime"></param>
213 213
         /// <returns></returns>
214
-        private DataTable getData(string stime, string endtime)
214
+        private DataTable getData(string stime, string endtime, string dpt)
215 215
         {
216 216
             DataTable dtNew = new DataTable();
217 217
             #region
@@ -258,7 +258,13 @@ namespace CallCenterApi.Interface.Controllers.report
258 258
             DataTable dt = new DataTable();
259 259
             //2018-05-03 lihai 修改用户条件
260 260
             //string sql = "SELECT  *,(SELECT sum(TalkLongTime)  FROM T_Call_CallRecords where  UserId=T_Sys_UserAccount.F_Userid " + sqltimeCallRecords + ") as counts from T_Sys_UserAccount where F_RoleId in(1,28,29) order by counts desc ";
261
-            string sql = "SELECT  *,(SELECT sum(TalkLongTime)  FROM T_Call_CallRecords where  UserId=T_Sys_UserAccount.F_Userid " + sqltimeCallRecords + ") as counts from T_Sys_UserAccount where f_seatFlag=1 and F_WorkNumber!='' order by counts desc ";
261
+            //2018-07-06 lihai 部门搜索条件
262
+            var sqlUser = "";
263
+            if (!string.IsNullOrEmpty(dpt))
264
+            {
265
+                sqlUser += $" AND F_DeptId = {dpt} ";
266
+            }
267
+            string sql = "SELECT  *,(SELECT sum(TalkLongTime)  FROM T_Call_CallRecords where  UserId=T_Sys_UserAccount.F_Userid " + sqltimeCallRecords + ") as counts from T_Sys_UserAccount where f_seatFlag=1 and F_WorkNumber!='' " + sqlUser + " order by counts desc ";
262 268
             dt = DbHelperSQL.Query(sql).Tables[0];
263 269
             for (int i = 0; i < dt.Rows.Count; i++)
264 270
             {