|
|
@@ -1,8 +1,10 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
2
|
2
|
using CallCenter.Utility.log;
|
|
|
3
|
+using CallCenterApi.DB;
|
|
3
|
4
|
using CallCenterApi.Interface.Controllers.Base;
|
|
4
|
5
|
using System;
|
|
5
|
6
|
using System.Collections.Generic;
|
|
|
7
|
+using System.Data;
|
|
6
|
8
|
using System.Linq;
|
|
7
|
9
|
using System.Transactions;
|
|
8
|
10
|
using System.Web;
|
|
|
@@ -15,6 +17,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
15
|
17
|
private BLL.T_Sys_DictionaryValue divBLL = new BLL.T_Sys_DictionaryValue();
|
|
16
|
18
|
private BLL.T_Sys_Area areaBLL = new BLL.T_Sys_Area();
|
|
17
|
19
|
BLL.T_Bus_WorkOrder_WXDocking_Map womagpbll = new BLL.T_Bus_WorkOrder_WXDocking_Map();
|
|
|
20
|
+ WxLoginController wlc = new WxLoginController();
|
|
18
|
21
|
|
|
19
|
22
|
private AjaxResult ajresult = new AjaxResult();
|
|
20
|
23
|
/// <summary>
|
|
|
@@ -239,6 +242,259 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
239
|
242
|
}
|
|
240
|
243
|
|
|
241
|
244
|
/// <summary>
|
|
|
245
|
+ /// 获取工单列表
|
|
|
246
|
+ /// </summary>
|
|
|
247
|
+ /// <returns></returns>
|
|
|
248
|
+ [HttpPost]
|
|
|
249
|
+ public ActionResult GetWorderLists(string uuid, string port_password, string openid, string timesamp,string workorderid,string key,string tel,int isdeal=-1, int type=0, int pageno=1,int pagesize=20)
|
|
|
250
|
+ {
|
|
|
251
|
+ using (TransactionScope trans = new TransactionScope())
|
|
|
252
|
+ {
|
|
|
253
|
+ #region 参数验证
|
|
|
254
|
+ if (string.IsNullOrEmpty(uuid))
|
|
|
255
|
+ {
|
|
|
256
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
257
|
+ ajresult.message = "客户唯一标识不能为空";
|
|
|
258
|
+ return Process();
|
|
|
259
|
+ }
|
|
|
260
|
+ else if (uuid.Length > 50)
|
|
|
261
|
+ {
|
|
|
262
|
+ ajresult.state = (int)CodeStatus.字符串超出长度;
|
|
|
263
|
+ ajresult.message = "客户唯一标识超出长度";
|
|
|
264
|
+ return Process();
|
|
|
265
|
+ }
|
|
|
266
|
+ if (string.IsNullOrEmpty(openid))
|
|
|
267
|
+ {
|
|
|
268
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
269
|
+ ajresult.message = "openid不能为空";
|
|
|
270
|
+ return Process();
|
|
|
271
|
+ }
|
|
|
272
|
+ if (string.IsNullOrEmpty(timesamp))
|
|
|
273
|
+ {
|
|
|
274
|
+ ajresult.state = (int)CodeStatus.必填字段为空;
|
|
|
275
|
+ ajresult.message = "时间戳不能为空";
|
|
|
276
|
+ return Process();
|
|
|
277
|
+ }
|
|
|
278
|
+ if (!Common.CodeValidate.ICodeValidateGridding(openid + timesamp + uuid, port_password))
|
|
|
279
|
+ {
|
|
|
280
|
+ ajresult.state = (int)CodeStatus.安全验证未通过;
|
|
|
281
|
+ ajresult.message = "安全验证未通过";
|
|
|
282
|
+ return Process();
|
|
|
283
|
+ }
|
|
|
284
|
+ if (womagpbll.ExistsUUID(uuid)) //uuid是否已存在,防止重复添加
|
|
|
285
|
+ {
|
|
|
286
|
+ ajresult.state = (int)CodeStatus.数据库错误;
|
|
|
287
|
+ ajresult.message = "操作失败,信息已存在";
|
|
|
288
|
+ return Process();
|
|
|
289
|
+ }
|
|
|
290
|
+ #endregion
|
|
|
291
|
+ var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + openid + "' and F_Type=5 order by F_CreateTime desc").FirstOrDefault();
|
|
|
292
|
+ if (wxuser == null)
|
|
|
293
|
+ {
|
|
|
294
|
+ ajresult.state = (int)CodeStatus.用户无效;
|
|
|
295
|
+ ajresult.message = "用户无效";
|
|
|
296
|
+ return Process();
|
|
|
297
|
+ }
|
|
|
298
|
+
|
|
|
299
|
+ #region 筛选工单
|
|
|
300
|
+ var sql = " and (F_IsEnabled=0 or F_IsDelete=0) ";
|
|
|
301
|
+ sql += " and F_WorkOrderId in (select distinct F_WorkOrderId from T_Bus_UserWorkOrder where F_UserId='" + wxuser.F_Id + "') ";
|
|
|
302
|
+ if (!string.IsNullOrWhiteSpace(workorderid))
|
|
|
303
|
+ {
|
|
|
304
|
+ sql += " and F_WorkOrderId like '%" + workorderid + "%' ";
|
|
|
305
|
+ }
|
|
|
306
|
+ if (!string.IsNullOrWhiteSpace(key))
|
|
|
307
|
+ {
|
|
|
308
|
+ sql += " and (F_ComTitle like '%" + key + "%' or F_ComContent like '%" + key + "%') ";
|
|
|
309
|
+ }
|
|
|
310
|
+ if (!string.IsNullOrWhiteSpace(tel))
|
|
|
311
|
+ {
|
|
|
312
|
+ sql += " and (F_CusPhone like '%" + tel + "%' or F_ConPhone like '%" + tel + "%') ";
|
|
|
313
|
+ }
|
|
|
314
|
+ if (isdeal != -1)
|
|
|
315
|
+ {
|
|
|
316
|
+ if (isdeal == 1)
|
|
|
317
|
+ {
|
|
|
318
|
+ sql += " and F_WorkState = '9' ";
|
|
|
319
|
+ }
|
|
|
320
|
+ else
|
|
|
321
|
+ {
|
|
|
322
|
+ sql += " and F_WorkState != '9' ";
|
|
|
323
|
+ }
|
|
|
324
|
+ }
|
|
|
325
|
+ if (type > 0)
|
|
|
326
|
+ {
|
|
|
327
|
+ sql += " and F_InfoType = '" + type + "' ";
|
|
|
328
|
+ }
|
|
|
329
|
+ #endregion
|
|
|
330
|
+
|
|
|
331
|
+ string cols = "F_WorkOrderId,F_ComTitle,F_CreateTime,dbo.GetDictionaryName(F_InfoType) as F_TypeName,(case F_WorkState when 0 then '等待处理' when 9 then '处理完结' else '正在处理' end) F_Status";
|
|
|
332
|
+ int recordCount = 0;
|
|
|
333
|
+ var dt = BLL.PagerBLL.GetListPager(
|
|
|
334
|
+ "T_Bus_WorkOrder",
|
|
|
335
|
+ "F_WorkOrderId",
|
|
|
336
|
+ cols,
|
|
|
337
|
+ sql,
|
|
|
338
|
+ "ORDER BY F_CreateTime DESC",
|
|
|
339
|
+ pagesize,
|
|
|
340
|
+ pageno,
|
|
|
341
|
+ true,
|
|
|
342
|
+ out recordCount);
|
|
|
343
|
+
|
|
|
344
|
+ var obj = new
|
|
|
345
|
+ {
|
|
|
346
|
+ rows = dt,
|
|
|
347
|
+ total = recordCount
|
|
|
348
|
+ };
|
|
|
349
|
+
|
|
|
350
|
+ ajresult.state = (int)CodeStatus.SUCCESS;
|
|
|
351
|
+ ajresult.message = "操作成功";
|
|
|
352
|
+ ajresult.data = obj;
|
|
|
353
|
+
|
|
|
354
|
+ int mapid = AddMap(uuid, port_password, "receive", "GetWorderLists", openid, "");
|
|
|
355
|
+
|
|
|
356
|
+ AddDockingLogs("", "", "", "", "", "", uuid, port_password, "receive", sql+"||"+ajresult.ToJson(), "GetWorderLists", openid, 0, 0, 0, 0, mapid);
|
|
|
357
|
+
|
|
|
358
|
+ trans.Complete();
|
|
|
359
|
+ }
|
|
|
360
|
+ return Process();
|
|
|
361
|
+ }
|
|
|
362
|
+
|
|
|
363
|
+ /// <summary>
|
|
|
364
|
+ /// 获取工单详情
|
|
|
365
|
+ /// </summary>
|
|
|
366
|
+ /// <returns></returns>
|
|
|
367
|
+ [HttpPost]
|
|
|
368
|
+ public ActionResult GetWorderDetail(string uuid, string port_password, string openid, string timesamp, string workorderid)
|
|
|
369
|
+ {
|
|
|
370
|
+ using (TransactionScope trans = new TransactionScope())
|
|
|
371
|
+ {
|
|
|
372
|
+ #region 参数验证
|
|
|
373
|
+ if (string.IsNullOrEmpty(uuid))
|
|
|
374
|
+ {
|
|
|
375
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
376
|
+ ajresult.message = "客户唯一标识不能为空";
|
|
|
377
|
+ return Process();
|
|
|
378
|
+ }
|
|
|
379
|
+ else if (uuid.Length > 50)
|
|
|
380
|
+ {
|
|
|
381
|
+ ajresult.state = (int)CodeStatus.字符串超出长度;
|
|
|
382
|
+ ajresult.message = "客户唯一标识超出长度";
|
|
|
383
|
+ return Process();
|
|
|
384
|
+ }
|
|
|
385
|
+ if (string.IsNullOrEmpty(openid))
|
|
|
386
|
+ {
|
|
|
387
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
388
|
+ ajresult.message = "openid不能为空";
|
|
|
389
|
+ return Process();
|
|
|
390
|
+ }
|
|
|
391
|
+ if (string.IsNullOrEmpty(timesamp))
|
|
|
392
|
+ {
|
|
|
393
|
+ ajresult.state = (int)CodeStatus.必填字段为空;
|
|
|
394
|
+ ajresult.message = "时间戳不能为空";
|
|
|
395
|
+ return Process();
|
|
|
396
|
+ }
|
|
|
397
|
+ if (!Common.CodeValidate.ICodeValidateGridding(openid + timesamp + uuid, port_password))
|
|
|
398
|
+ {
|
|
|
399
|
+ ajresult.state = (int)CodeStatus.安全验证未通过;
|
|
|
400
|
+ ajresult.message = "安全验证未通过";
|
|
|
401
|
+ return Process();
|
|
|
402
|
+ }
|
|
|
403
|
+ if (womagpbll.ExistsUUID(uuid)) //uuid是否已存在,防止重复添加
|
|
|
404
|
+ {
|
|
|
405
|
+ ajresult.state = (int)CodeStatus.数据库错误;
|
|
|
406
|
+ ajresult.message = "操作失败,信息已存在";
|
|
|
407
|
+ return Process();
|
|
|
408
|
+ }
|
|
|
409
|
+ if (string.IsNullOrEmpty(workorderid))
|
|
|
410
|
+ {
|
|
|
411
|
+ ajresult.state = (int)CodeStatus.必填字段为空;
|
|
|
412
|
+ ajresult.message = "工单编号不能为空";
|
|
|
413
|
+ return Process();
|
|
|
414
|
+ }
|
|
|
415
|
+ #endregion
|
|
|
416
|
+ var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + openid + "' and F_Type=5 order by F_CreateTime desc").FirstOrDefault();
|
|
|
417
|
+ if (wxuser == null)
|
|
|
418
|
+ {
|
|
|
419
|
+ ajresult.state = (int)CodeStatus.用户无效;
|
|
|
420
|
+ ajresult.message = "用户无效";
|
|
|
421
|
+ return Process();
|
|
|
422
|
+ }
|
|
|
423
|
+
|
|
|
424
|
+ var tbu = new BLL.T_Bus_UserWorkOrder().GetRecordCount(" F_UserId='" + wxuser.F_Id + "' and F_WorkOrderId='" + workorderid + "' ");
|
|
|
425
|
+ if (tbu <= 0)
|
|
|
426
|
+ {
|
|
|
427
|
+ ajresult.state = (int)CodeStatus.无匹配数据;
|
|
|
428
|
+ ajresult.message = "无匹配数据";
|
|
|
429
|
+ return Process();
|
|
|
430
|
+ }
|
|
|
431
|
+
|
|
|
432
|
+ //string sql = "select F_WorkOrderId,F_ComTitle,F_ComContent,F_CreateTime,dbo.GetDictionaryName(F_InfoType) as F_TypeName,(case F_WorkState when 0 then '等待处理' when 9 then '处理完结' else '正在处理' end) F_Status,dbo.GetAreaName(F_SourceArea) as F_AreaName,F_SourceAddress,F_Result from T_Bus_WorkOrder where F_WorkOrderId ='" + workorderid + "' and (F_IsEnabled=0 or F_IsDelete=0)";
|
|
|
433
|
+
|
|
|
434
|
+
|
|
|
435
|
+ var ordermodel = new BLL.T_Bus_WorkOrder().GetModelList("F_WorkOrderId ='" + workorderid + "' and (F_IsEnabled=0 or F_IsDelete=0)").FirstOrDefault();
|
|
|
436
|
+ if(ordermodel==null)
|
|
|
437
|
+ {
|
|
|
438
|
+ ajresult.state = (int)CodeStatus.无匹配数据;
|
|
|
439
|
+ ajresult.message = "当前工单不存在";
|
|
|
440
|
+ return Process();
|
|
|
441
|
+ }
|
|
|
442
|
+ #region 工单状态
|
|
|
443
|
+ var status = "正在处理";
|
|
|
444
|
+ if (ordermodel.F_WorkState == 0)
|
|
|
445
|
+ status = "等待处理";
|
|
|
446
|
+ if (ordermodel.F_WorkState == 9)
|
|
|
447
|
+ status = "处理完结";
|
|
|
448
|
+ #endregion
|
|
|
449
|
+ #region 绑定类型
|
|
|
450
|
+ var typename = "";
|
|
|
451
|
+ if(ordermodel.F_InfoType!=null)
|
|
|
452
|
+ {
|
|
|
453
|
+ var typemodel = divBLL.GetModel(ordermodel.F_InfoType.Value);
|
|
|
454
|
+ if (typemodel != null)
|
|
|
455
|
+ typename = typemodel.F_Value;
|
|
|
456
|
+ }
|
|
|
457
|
+ #endregion
|
|
|
458
|
+ #region 绑定地区
|
|
|
459
|
+ var areaname = "";
|
|
|
460
|
+ if (ordermodel.F_SourceArea != null)
|
|
|
461
|
+ {
|
|
|
462
|
+ var areamodel = areaBLL.GetModel(ordermodel.F_SourceArea.Value);
|
|
|
463
|
+ if (areamodel != null)
|
|
|
464
|
+ areaname = areamodel.F_AreaName;
|
|
|
465
|
+ }
|
|
|
466
|
+ #endregion
|
|
|
467
|
+
|
|
|
468
|
+ var gclist = new BLL.T_Bus_Operation().GetModelList("F_IsDelete=0 and F_WorkOrderId ='" + workorderid + "' order by F_CreateTime desc").Select(g => { return new { g.F_CreateTime, g.F_Message }; });
|
|
|
469
|
+
|
|
|
470
|
+ var obj = new
|
|
|
471
|
+ {
|
|
|
472
|
+ ordermodel.F_WorkOrderId,
|
|
|
473
|
+ ordermodel.F_ComTitle,
|
|
|
474
|
+ ordermodel.F_ComContent,
|
|
|
475
|
+ ordermodel.F_CreateTime,
|
|
|
476
|
+ ordermodel.F_SourceAddress,
|
|
|
477
|
+ ordermodel.F_Result,
|
|
|
478
|
+ F_AreaName=areaname,
|
|
|
479
|
+ F_TypeName=typename,
|
|
|
480
|
+ F_Status=status,
|
|
|
481
|
+ items = gclist
|
|
|
482
|
+ };
|
|
|
483
|
+
|
|
|
484
|
+ ajresult.state = (int)CodeStatus.SUCCESS;
|
|
|
485
|
+ ajresult.message = "操作成功";
|
|
|
486
|
+ ajresult.data = obj;
|
|
|
487
|
+
|
|
|
488
|
+ int mapid = AddMap(uuid, port_password, "receive", "GetWorderDetail", openid, workorderid);
|
|
|
489
|
+
|
|
|
490
|
+ AddDockingLogs("", "", "", "", "", "", uuid, port_password, "receive", ajresult.ToJson(), "GetWorderDetail", openid, 0, 0, 0, 0, mapid);
|
|
|
491
|
+
|
|
|
492
|
+ trans.Complete();
|
|
|
493
|
+ }
|
|
|
494
|
+ return Process();
|
|
|
495
|
+ }
|
|
|
496
|
+
|
|
|
497
|
+ /// <summary>
|
|
242
|
498
|
/// 添加工单
|
|
243
|
499
|
/// </summary>
|
|
244
|
500
|
/// <returns></returns>
|
|
|
@@ -403,6 +659,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
403
|
659
|
执行失败 = 108,
|
|
404
|
660
|
用户已禁用 = 120,
|
|
405
|
661
|
用户无效=121,
|
|
|
662
|
+ 无匹配数据=122,
|
|
406
|
663
|
|
|
407
|
664
|
异常结果类型 = 500
|
|
408
|
665
|
|