Przeglądaj źródła

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

lihai 7 lat temu
rodzic
commit
837c67890c

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

15
     public class YearContrastController : BaseController
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
             ActionResult res = NoToken("未知错误,请重新登录");
20
             ActionResult res = NoToken("未知错误,请重新登录");
21
          
21
          
26
                     var data = new
26
                     var data = new
27
                     {
27
                     {
28
                         key = beginyear + "客户呼叫数",
28
                         key = beginyear + "客户呼叫数",
29
-                        value = GetKhCall(beginyear).TrimEnd(',').Split(','),
29
+                        value = GetKhCall(beginyear, dpt).TrimEnd(',').Split(','),
30
                         type = 0
30
                         type = 0
31
                     };
31
                     };
32
                     arrlist.Add(data);
32
                     arrlist.Add(data);
34
                     var data1 = new
34
                     var data1 = new
35
                     {
35
                     {
36
                         key = beginyear + "坐席接听数",
36
                         key = beginyear + "坐席接听数",
37
-                        value = GetZxJt(beginyear).TrimEnd(',').Split(','),
37
+                        value = GetZxJt(beginyear, dpt).TrimEnd(',').Split(','),
38
                         type = 0
38
                         type = 0
39
                     };
39
                     };
40
                     arrlist.Add(data1);
40
                     arrlist.Add(data1);
42
                     var data2 = new
42
                     var data2 = new
43
                     {
43
                     {
44
                         key = beginyear + "接通率",
44
                         key = beginyear + "接通率",
45
-                        value = GetJTL(beginyear).TrimEnd(',').Split(','),
45
+                        value = GetJTL(beginyear, dpt).TrimEnd(',').Split(','),
46
                         type = 0
46
                         type = 0
47
                     };
47
                     };
48
                     arrlist.Add(data2);
48
                     arrlist.Add(data2);
52
                     var data = new
52
                     var data = new
53
                     {
53
                     {
54
                         key = endyear + "客户呼叫数",
54
                         key = endyear + "客户呼叫数",
55
-                        value = GetKhCall(endyear).TrimEnd(',').Split(','),
55
+                        value = GetKhCall(endyear, dpt).TrimEnd(',').Split(','),
56
                         type = 1
56
                         type = 1
57
                     };
57
                     };
58
                     arrlist.Add(data);
58
                     arrlist.Add(data);
60
                     var data1 = new
60
                     var data1 = new
61
                     {
61
                     {
62
                         key = endyear + "坐席接听数",
62
                         key = endyear + "坐席接听数",
63
-                        value = GetZxJt(endyear).TrimEnd(',').Split(','),
63
+                        value = GetZxJt(endyear, dpt).TrimEnd(',').Split(','),
64
                         type = 1
64
                         type = 1
65
                     };
65
                     };
66
                     arrlist.Add(data1);
66
                     arrlist.Add(data1);
68
                     var data2 = new
68
                     var data2 = new
69
                     {
69
                     {
70
                         key = endyear + "接通率",
70
                         key = endyear + "接通率",
71
-                        value = GetJTL(endyear).TrimEnd(',').Split(','),
71
+                        value = GetJTL(endyear, dpt).TrimEnd(',').Split(','),
72
                         type = 1
72
                         type = 1
73
                     };
73
                     };
74
                     arrlist.Add(data2);
74
                     arrlist.Add(data2);
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
             ActionResult res = NoToken("未知错误,请重新登录");
85
             ActionResult res = NoToken("未知错误,请重新登录");
86
             //if (Request.IsAuthenticated)
86
             //if (Request.IsAuthenticated)
87
             if(1==1)
87
             if(1==1)
88
             {
88
             {
89
                 NPOIHelper npoi = new NPOIHelper();
89
                 NPOIHelper npoi = new NPOIHelper();
90
-                DataTable dt = GetData(beginyear, endyear);
90
+                DataTable dt = GetData(beginyear, endyear, dpt);
91
                 if (npoi.ExportToExcel("呼叫数据分析数据", dt) == "")
91
                 if (npoi.ExportToExcel("呼叫数据分析数据", dt) == "")
92
                 {
92
                 {
93
                     return Success("导出成功");
93
                     return Success("导出成功");
100
             return res;
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
             DataTable dtNew = new DataTable();
105
             DataTable dtNew = new DataTable();
106
             if ((beginyear != null && beginyear.Trim() != "")&&(endyear != null && endyear.Trim() != ""))
106
             if ((beginyear != null && beginyear.Trim() != "")&&(endyear != null && endyear.Trim() != ""))
122
                 dtNew.Columns.Add(dc6);
122
                 dtNew.Columns.Add(dc6);
123
                 dtNew.Columns.Add(dc7);
123
                 dtNew.Columns.Add(dc7);
124
                 #endregion
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
                 for (int i = 0; i < 12; i++)
133
                 for (int i = 0; i < 12; i++)
134
                 {
134
                 {
148
         }
148
         }
149
 
149
 
150
         //客户呼叫数
150
         //客户呼叫数
151
-        private string GetKhCall(string strtime)
151
+        private string GetKhCall(string strtime, string dpt)
152
         {
152
         {
153
             DataTable dt = new DataTable();
153
             DataTable dt = new DataTable();
154
             string str = "";
154
             string str = "";
160
                 {
160
                 {
161
                     strmm = "0" + i;
161
                     strmm = "0" + i;
162
                 }
162
                 }
163
+                //2018-07-06 lihai 部门搜索条件
164
+                if (!string.IsNullOrEmpty(dpt))
165
+                {
166
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
167
+                }
163
                 if (strtime != "")
168
                 if (strtime != "")
164
                 {
169
                 {
165
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
170
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
191
         }
196
         }
192
 
197
 
193
         //坐席接听数
198
         //坐席接听数
194
-        private string GetZxJt(string strtime)
199
+        private string GetZxJt(string strtime, string dpt)
195
         {
200
         {
196
             DataTable dt = new DataTable();
201
             DataTable dt = new DataTable();
197
             string str = "";
202
             string str = "";
203
                 {
208
                 {
204
                     strmm = "0" + i;
209
                     strmm = "0" + i;
205
                 }
210
                 }
211
+                //2018-07-06 lihai 部门搜索条件
212
+                if (!string.IsNullOrEmpty(dpt))
213
+                {
214
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
215
+                }
206
                 if (strtime != "")
216
                 if (strtime != "")
207
                 {
217
                 {
208
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
218
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
234
         }
244
         }
235
 
245
 
236
         //坐席接听率
246
         //坐席接听率
237
-        private string GetJTL(string strtime)
247
+        private string GetJTL(string strtime, string dpt)
238
         {
248
         {
239
             DataTable dt = new DataTable();
249
             DataTable dt = new DataTable();
240
             string str = "";
250
             string str = "";
246
                 {
256
                 {
247
                     strmm = "0" + i;
257
                     strmm = "0" + i;
248
                 }
258
                 }
259
+                //2018-07-06 lihai 部门搜索条件
260
+                if (!string.IsNullOrEmpty(dpt))
261
+                {
262
+                    sqltimeCallRecords += " and AgentID='" + dpt + "' ";
263
+                }
249
                 if (strtime != "")
264
                 if (strtime != "")
250
                 {
265
                 {
251
                     sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
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
             return res;
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
             ActionResult res = NoToken("未知错误,请重新登录");
33
             ActionResult res = NoToken("未知错误,请重新登录");
34
 
34
 
35
             DataTable dtNew = new DataTable();
35
             DataTable dtNew = new DataTable();
36
-            dtNew = getData(stime, endtime);
36
+            dtNew = getData(stime, endtime, dpt);
37
             res = Success("获取坐席满意度评价情况报表数据成功", dtNew);
37
             res = Success("获取坐席满意度评价情况报表数据成功", dtNew);
38
             return res;
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
             ActionResult res = NoToken("未知错误,请重新登录");
44
             ActionResult res = NoToken("未知错误,请重新登录");
45
             if (Request.IsAuthenticated)
45
             if (Request.IsAuthenticated)
46
             {
46
             {
47
                 NPOIHelper npoi = new NPOIHelper();
47
                 NPOIHelper npoi = new NPOIHelper();
48
-                DataTable dt = getData(stime, endtime);
48
+                DataTable dt = getData(stime, endtime, dpt);
49
                 if (npoi.ExportToExcel("坐席满意度评价情况", dt) == "")
49
                 if (npoi.ExportToExcel("坐席满意度评价情况", dt) == "")
50
                 {
50
                 {
51
                     return Success("导出成功");
51
                     return Success("导出成功");
58
             return res;
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
             DataTable dtNew = new DataTable();
63
             DataTable dtNew = new DataTable();
64
             #region
64
             #region
97
             Dictionary<string, List<List<string>>> body = new Dictionary<string, List<List<string>>>();
97
             Dictionary<string, List<List<string>>> body = new Dictionary<string, List<List<string>>>();
98
             //坐席
98
             //坐席
99
             //DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_RoleId in (1,4,28,29) and F_DeleteFlag=0").Tables[0];//客服坐席、班长坐席、售前坐席、投诉坐席
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
             int allcount = dtable.Rows.Count;
108
             int allcount = dtable.Rows.Count;
102
             for (int i = 0; i < allcount; i++)
109
             for (int i = 0; i < allcount; i++)
103
             {
110
             {

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

30
             return res;
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
             ActionResult res = NoToken("未知错误,请重新登录");
35
             ActionResult res = NoToken("未知错误,请重新登录");
36
          
36
          
37
                 DataTable dtNew = new DataTable();
37
                 DataTable dtNew = new DataTable();
38
-                dtNew = getData(stime, endtime);
38
+                dtNew = getData(stime, endtime, dpt);
39
                 #region
39
                 #region
40
                 //#region
40
                 //#region
41
                 //DataColumn dc1 = new DataColumn("坐席人员");
41
                 //DataColumn dc1 = new DataColumn("坐席人员");
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
             ActionResult res = NoToken("未知错误,请重新登录");
191
             ActionResult res = NoToken("未知错误,请重新登录");
192
             if (Request.IsAuthenticated)
192
             if (Request.IsAuthenticated)
193
             {
193
             {
194
                 NPOIHelper npoi = new NPOIHelper();
194
                 NPOIHelper npoi = new NPOIHelper();
195
-                DataTable dt = getData(stime, endtime);
195
+                DataTable dt = getData(stime, endtime, dpt);
196
                 if (npoi.ExportToExcel("坐席日通话时长数据", dt) == "")
196
                 if (npoi.ExportToExcel("坐席日通话时长数据", dt) == "")
197
                 {
197
                 {
198
                     return Success("导出成功");
198
                     return Success("导出成功");
211
         /// <param name="stime"></param>
211
         /// <param name="stime"></param>
212
         /// <param name="endtime"></param>
212
         /// <param name="endtime"></param>
213
         /// <returns></returns>
213
         /// <returns></returns>
214
-        private DataTable getData(string stime, string endtime)
214
+        private DataTable getData(string stime, string endtime, string dpt)
215
         {
215
         {
216
             DataTable dtNew = new DataTable();
216
             DataTable dtNew = new DataTable();
217
             #region
217
             #region
258
             DataTable dt = new DataTable();
258
             DataTable dt = new DataTable();
259
             //2018-05-03 lihai 修改用户条件
259
             //2018-05-03 lihai 修改用户条件
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 ";
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
             dt = DbHelperSQL.Query(sql).Tables[0];
268
             dt = DbHelperSQL.Query(sql).Tables[0];
263
             for (int i = 0; i < dt.Rows.Count; i++)
269
             for (int i = 0; i < dt.Rows.Count; i++)
264
             {
270
             {