|
|
@@ -11,6 +11,7 @@ using System.Linq;
|
|
11
|
11
|
using System.Web;
|
|
12
|
12
|
using System.Web.Mvc;
|
|
13
|
13
|
using System.Transactions;
|
|
|
14
|
+using System.IO;
|
|
14
|
15
|
|
|
15
|
16
|
namespace CallCenterApi.Interface.Controllers.weixin
|
|
16
|
17
|
{
|
|
|
@@ -205,41 +206,41 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
205
|
206
|
string cusphone = RequestString.GetFormString("cusphone");//GetFormString
|
|
206
|
207
|
|
|
207
|
208
|
string content = RequestString.GetFormString("content");
|
|
208
|
|
- //string files = RequestString.GetFormString("files");
|
|
|
209
|
+ string files = RequestString.GetFormString("files");
|
|
209
|
210
|
int type = RequestString.GetInt("type", 3);//默认为3投诉建议
|
|
210
|
211
|
|
|
211
|
212
|
string stropenid = HttpUtility.UrlDecode(RequestString.GetFormString("openid"));
|
|
212
|
213
|
var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + stropenid.Trim() + "' and F_Type=1 ").FirstOrDefault();
|
|
213
|
214
|
string fileids = "";
|
|
214
|
215
|
#region 上传附件
|
|
215
|
|
- HttpFileCollection files = RequestString.GetFiles();
|
|
216
|
|
- if (files.Count > 0)
|
|
217
|
|
- {
|
|
218
|
|
- List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
|
|
219
|
|
- string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
|
|
220
|
|
- for (int i = 0; i < files.Count; i++)
|
|
221
|
|
- {
|
|
222
|
|
- HttpPostedFile file = files[i];
|
|
223
|
|
- FileUp fu = new FileUp();
|
|
224
|
|
-
|
|
225
|
|
- string name = fu.Upload(file, path);
|
|
226
|
|
-
|
|
227
|
|
- Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
228
|
|
- model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
229
|
|
- model_T_Sys_Accessories.F_FileName = name;//附件名称
|
|
230
|
|
- model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
|
|
231
|
|
- model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
|
|
232
|
|
- model_T_Sys_Accessories.F_Size = file.ContentLength;
|
|
233
|
|
- int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
234
|
|
- model_T_Sys_Accessories.F_FileId = id;
|
|
235
|
|
- acs.Add(model_T_Sys_Accessories);
|
|
236
|
|
- fileids += id.ToString() + ",";
|
|
237
|
|
- }
|
|
238
|
|
- }
|
|
|
216
|
+ //HttpFileCollection files = RequestString.GetFiles();
|
|
|
217
|
+ //if (files.Count > 0)
|
|
|
218
|
+ //{
|
|
|
219
|
+ // List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
|
|
|
220
|
+ // string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy/MM/dd") + "/";
|
|
|
221
|
+ // for (int i = 0; i < files.Count; i++)
|
|
|
222
|
+ // {
|
|
|
223
|
+ // HttpPostedFile file = files[i];
|
|
|
224
|
+ // FileUp fu = new FileUp();
|
|
|
225
|
+
|
|
|
226
|
+ // string name = fu.Upload(file, path);
|
|
|
227
|
+
|
|
|
228
|
+ // Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
|
229
|
+ // model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
|
230
|
+ // model_T_Sys_Accessories.F_FileName = name;//附件名称
|
|
|
231
|
+ // model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
|
|
|
232
|
+ // model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
|
|
|
233
|
+ // model_T_Sys_Accessories.F_Size = file.ContentLength;
|
|
|
234
|
+ // int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
|
235
|
+ // model_T_Sys_Accessories.F_FileId = id;
|
|
|
236
|
+ // acs.Add(model_T_Sys_Accessories);
|
|
|
237
|
+ // fileids += id.ToString() + ",";
|
|
|
238
|
+ // }
|
|
|
239
|
+ //}
|
|
239
|
240
|
#endregion
|
|
240
|
241
|
|
|
241
|
242
|
workorder.WorkOrderController wo = new workorder.WorkOrderController();
|
|
242
|
|
- string workorderid = wo.AddWorkOrders(type, cusname, cusphone, content, fileids.Trim(','));
|
|
|
243
|
+ string workorderid = wo.AddWorkOrders(type, cusname, cusphone, content, files);
|
|
243
|
244
|
if (string.IsNullOrEmpty(workorderid))
|
|
244
|
245
|
{
|
|
245
|
246
|
return Error("新增失败");
|
|
|
@@ -259,7 +260,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
259
|
260
|
/// 获取工单详情
|
|
260
|
261
|
/// </summary>
|
|
261
|
262
|
/// <returns></returns>
|
|
262
|
|
- //[WechatActionFilter]
|
|
|
263
|
+ [WechatActionFilter]
|
|
263
|
264
|
public ActionResult GetWorkOrder()
|
|
264
|
265
|
{
|
|
265
|
266
|
string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
|
|
|
@@ -270,7 +271,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
270
|
271
|
|
|
271
|
272
|
if (tbu.Rows.Count > 0)
|
|
272
|
273
|
{
|
|
273
|
|
- string sql = "select * "
|
|
|
274
|
+ string sql = "select *,dbo.GetUserName(CreateUser) as CreateUserName "
|
|
274
|
275
|
+ " from T_Wo_WorkOrder where id =" + strworkorderid + " ";
|
|
275
|
276
|
var dt = DbHelperSQL.Query(sql).Tables[0];
|
|
276
|
277
|
if (dt.Rows.Count > 0)
|
|
|
@@ -328,49 +329,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
328
|
329
|
}
|
|
329
|
330
|
|
|
330
|
331
|
}
|
|
331
|
|
-
|
|
332
|
|
- /// <summary>
|
|
333
|
|
- /// 获取工单数量
|
|
334
|
|
- /// </summary>
|
|
335
|
|
- /// <returns></returns>
|
|
336
|
|
- [WechatActionFilter]
|
|
337
|
|
- public ActionResult GetWorkOrderCount()
|
|
338
|
|
- {
|
|
339
|
|
- string stropenid = HttpUtility.UrlDecode(RequestString.GetQueryString("openid"));
|
|
340
|
|
- int type = RequestString.GetInt("type", 0);
|
|
341
|
|
-
|
|
342
|
|
- var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + stropenid.Trim() + "' and F_Type=1 ").FirstOrDefault();
|
|
343
|
|
-
|
|
344
|
|
- string where = " WorkOrderID in (select F_WorkOrderId from T_WO_UserWorkOrder where F_UserId='" + wxuser.F_Id + "') ";
|
|
345
|
|
-
|
|
346
|
|
-
|
|
347
|
|
- string sql = " select count(1) from T_WO_UserWorkOrder where F_UserId='" + wxuser.F_Id + "' ";
|
|
348
|
|
- string sqlblz = " select count(1) from T_Wo_WorkOrder where " + where + " and State!=2 ";
|
|
349
|
|
- string sqlybl = " select count(1) from T_Wo_WorkOrder where " + where + " and State =2 ";
|
|
350
|
|
-
|
|
351
|
|
- string sqltype = " select F_ValueId,F_Value,(select COUNT(1) from T_Wo_WorkOrder where 1=1 ";
|
|
352
|
|
- if (type == 1)
|
|
353
|
|
- {
|
|
354
|
|
- sqltype += " and State!=2";
|
|
355
|
|
- }
|
|
356
|
|
- else if (type == 2)
|
|
357
|
|
- {
|
|
358
|
|
- sqltype += " and State=2";
|
|
359
|
|
- }
|
|
360
|
|
- sqltype += " and TypeClass=F_ValueId and " + where + ") Count from dbo.T_Sys_DictionaryValue where F_ItemId=2 and F_State=0 ";
|
|
361
|
|
-
|
|
362
|
|
- DataTable dt = DbHelperSQL.Query(sqltype).Tables[0];
|
|
363
|
|
-
|
|
364
|
|
- var obj = new
|
|
365
|
|
- {
|
|
366
|
|
- total = DbHelperSQL.GetSingle(sql).ToString(),
|
|
367
|
|
- blzcount = DbHelperSQL.GetSingle(sqlblz).ToString(),
|
|
368
|
|
- yblcount = DbHelperSQL.GetSingle(sqlybl).ToString(),
|
|
369
|
|
- typedata = dt
|
|
370
|
|
- };
|
|
371
|
|
-
|
|
372
|
|
- return Success("成功", obj);
|
|
373
|
|
- }
|
|
|
332
|
+
|
|
374
|
333
|
#endregion
|
|
375
|
334
|
|
|
376
|
335
|
#region 获取下拉框
|
|
|
@@ -479,6 +438,80 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
479
|
438
|
}
|
|
480
|
439
|
return dt;
|
|
481
|
440
|
}
|
|
|
441
|
+
|
|
|
442
|
+ /// <summary>
|
|
|
443
|
+ /// 上传附件
|
|
|
444
|
+ /// </summary>
|
|
|
445
|
+ /// <returns></returns>
|
|
|
446
|
+ public ActionResult UpdateFile()
|
|
|
447
|
+ {
|
|
|
448
|
+ //string stropenid = HttpUtility.UrlDecode(RequestString.GetFormString("openid"));
|
|
|
449
|
+ string fileurl = HttpUtility.UrlDecode(RequestString.GetFormString("fileurl"));
|
|
|
450
|
+ string filename = HttpUtility.UrlDecode(RequestString.GetFormString("filename"));
|
|
|
451
|
+ string filesize = HttpUtility.UrlDecode(RequestString.GetFormString("filesize"));
|
|
|
452
|
+ string filetype = HttpUtility.UrlDecode(RequestString.GetFormString("filetype"));
|
|
|
453
|
+
|
|
|
454
|
+ FileUp fu = new FileUp();
|
|
|
455
|
+ string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy/MM/dd") + "/";
|
|
|
456
|
+ #region
|
|
|
457
|
+ if (fileurl.Trim() != "" && fileurl != "undefined")
|
|
|
458
|
+ {
|
|
|
459
|
+ byte[] by = fu.GetBinaryFile(fileurl);
|
|
|
460
|
+
|
|
|
461
|
+ fu.SaveFile(by, path, filename, filetype);
|
|
|
462
|
+ Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
|
463
|
+ model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
|
464
|
+ model_T_Sys_Accessories.F_FileName = filename;//附件名称
|
|
|
465
|
+ model_T_Sys_Accessories.F_FileType = filetype;//附件类型
|
|
|
466
|
+ model_T_Sys_Accessories.F_FileUrl = path + filename;//附件地址
|
|
|
467
|
+ model_T_Sys_Accessories.F_Size = long.Parse(filesize);
|
|
|
468
|
+ //model_T_Sys_Accessories.F_UserCode = stropenid;//上传人
|
|
|
469
|
+ int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
|
470
|
+ if (id > 0)
|
|
|
471
|
+ {
|
|
|
472
|
+ return Success("文件日志都成功", id);
|
|
|
473
|
+ }
|
|
|
474
|
+ else
|
|
|
475
|
+ return Success("文件成功");
|
|
|
476
|
+ }
|
|
|
477
|
+ else
|
|
|
478
|
+ {
|
|
|
479
|
+ return Error("请选择要上传的文件");
|
|
|
480
|
+ }
|
|
|
481
|
+ #endregion
|
|
|
482
|
+
|
|
|
483
|
+ #region 多个上传
|
|
|
484
|
+
|
|
|
485
|
+ //HttpFileCollection files = RequestString.GetFiles();
|
|
|
486
|
+ //if (files.Count > 0)
|
|
|
487
|
+ //{
|
|
|
488
|
+ // List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
|
|
|
489
|
+
|
|
|
490
|
+ // for (int i = 0; i < files.Count; i++)
|
|
|
491
|
+ // {
|
|
|
492
|
+
|
|
|
493
|
+ // HttpPostedFile file = files[i];
|
|
|
494
|
+ // string name = fu.Upload(file, path);
|
|
|
495
|
+ // Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
|
496
|
+ // model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
|
497
|
+ // model_T_Sys_Accessories.F_FileName = name;//附件名称
|
|
|
498
|
+ // model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
|
|
|
499
|
+ // model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
|
|
|
500
|
+ // model_T_Sys_Accessories.F_Size = file.ContentLength;
|
|
|
501
|
+ // //model_T_Sys_Accessories.F_UserCode = stropenid;//上传人
|
|
|
502
|
+ // int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
|
503
|
+ // model_T_Sys_Accessories.F_FileId = id;
|
|
|
504
|
+ // acs.Add(model_T_Sys_Accessories);
|
|
|
505
|
+ // }
|
|
|
506
|
+
|
|
|
507
|
+ // return Success("成功", acs);
|
|
|
508
|
+ //}
|
|
|
509
|
+ //else
|
|
|
510
|
+ //{
|
|
|
511
|
+ // return Error("请选择要上传的文件");
|
|
|
512
|
+ //}
|
|
|
513
|
+ #endregion
|
|
|
514
|
+ }
|
|
482
|
515
|
#endregion
|
|
483
|
516
|
}
|
|
484
|
517
|
}
|