duhongyu 6 gadi atpakaļ
vecāks
revīzija
4111d1d97a

+ 72 - 11
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -126,16 +126,77 @@ namespace CallCenterApi.Interface.Controllers.tel
126 126
 
127 127
             return Content(obj.ToJson());
128 128
         }
129
-   
130
-        private string filePath = Configs.GetValue("Sound_recording");
129
+      public ActionResult Sound(string phone, string usercode)
130
+        {
131
+            string sql = "";
132
+            string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
133
+            string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
134
+            string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
135
+            string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
136
+            string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
137
+            string dealtype = HttpUtility.UrlDecode(RequestString.GetQueryString("dealtype"));
138
+            //if (!string.IsNullOrEmpty(userModel.groupcode))
139
+            //{
140
+            //    sql += " and groupcode = '" + userModel.groupcode + "' ";
141
+            //}
142
+
143
+            if (usercode != null && usercode.Trim() != "")
144
+            {
145
+                sql += " and UserCode='" + usercode + "'";
146
+            }
147
+            if (dept != null && dept.Trim() != "")
148
+            {
149
+                sql += " and F_DeptId='" + dept.Trim() + "'";
150
+            }
151
+            if (dealtype != null && dealtype.Trim() != "")
152
+            {
153
+                //处理方式
154
+                sql += " and DealType = " + dealtype + " ";
155
+            }
156
+            if (phone != null && phone.Trim() != "")
157
+            {
158
+                sql += " and CallNumber like '%" + phone + "%'";
159
+            }
160
+            if (callstate.Trim() != "")
161
+            {
162
+                sql += " and CallState='" + callstate + "'";
163
+            }
164
+            if (calltype.Trim() != "")
165
+            {
166
+                sql += " and CallType='" + calltype + "'";
167
+            }
168
+            if (starttime.Trim() != "")
169
+            {
170
+                sql += " and datediff(day,BeginTime,'" + starttime + "')<=0 ";
171
+            }
172
+            if (endtime.Trim() != "")
173
+            {
174
+                sql += " and datediff(day,BeginTime,'" + endtime + "')>=0 ";
175
+            }
176
+            var CallList = new BLL.T_Call_CallRecords().GetModelList("FilePath !='' " + sql);
177
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
178
+            var obj = new
179
+            {
180
+                state = "success",
181
+                message = "成功",
182
+                CallList,
183
+                config
184
+            };
185
+            return Content(obj.ToJson());
186
+        }
131 187
         /// <summary>
132 188
         /// 导出录音文件
133 189
         /// </summary>
134 190
         /// <returns></returns>
135
-        public ActionResult ExitSound(string phone, string usercode)
191
+
192
+        public ActionResult ExitSound(string filePath, string phone, string usercode)
136 193
         {
137
-            int userId = CurrentUser.UserData.F_UserId;
138
-            Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
194
+          //   string filePath = Configs.GetValue("Sound_recording");
195
+            System.IO.DriveInfo[] allDrives = System.IO.DriveInfo.GetDrives();
196
+            filePath = filePath + "CallCenter_Sound";
197
+            filePath = Configs.GetValue("Sound_recording");
198
+            // int userId = CurrentUser.UserData.F_UserId;
199
+            //   Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
139 200
 
140 201
             string sql = "";
141 202
 
@@ -145,10 +206,10 @@ namespace CallCenterApi.Interface.Controllers.tel
145 206
             string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
146 207
             string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
147 208
             string dealtype = HttpUtility.UrlDecode(RequestString.GetQueryString("dealtype"));
148
-            if (!string.IsNullOrEmpty(userModel.groupcode))
149
-            {
150
-                sql += " and groupcode = '" + userModel.groupcode + "' ";
151
-            }
209
+            //if (!string.IsNullOrEmpty(userModel.groupcode))
210
+            //{
211
+            //    sql += " and groupcode = '" + userModel.groupcode + "' ";
212
+            //}
152 213
 
153 214
             if (usercode != null && usercode.Trim() != "")
154 215
             {
@@ -185,7 +246,7 @@ namespace CallCenterApi.Interface.Controllers.tel
185 246
             }
186 247
             var CallList = new BLL.T_Call_CallRecords().GetModelList("FilePath !='' "+ sql);
187 248
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
188
-            // 如果文件不存在,创建文件; 如果存在,覆盖文件 
249
+            // 如果文件不存在,创建文件; 如果存在,跳过 
189 250
             try
190 251
             {
191 252
                 if (!Directory.Exists(filePath))
@@ -216,7 +277,7 @@ namespace CallCenterApi.Interface.Controllers.tel
216 277
                             HttpWebResponse response = request.GetResponse() as HttpWebResponse;
217 278
                             Stream responseStream = response.GetResponseStream();
218 279
                             string[] sArray = filename.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
219
-                            string flie = @"" + filePath +"\\"+ sArray[0] + "\\" + sArray[1] + "\\" + sArray[2];
280
+                            string flie =  filePath +"\\"+ sArray[0] + "\\" + sArray[1] + "\\" + sArray[2];
220 281
                             if (!Directory.Exists(flie))
221 282
                             {
222 283
                                 Directory.CreateDirectory(flie);