|
|
@@ -328,7 +328,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
328
|
328
|
}
|
|
329
|
329
|
#endregion
|
|
330
|
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";
|
|
|
331
|
+ string cols = "F_WorkOrderId,F_ComTitle,F_CreateTime,F_InfoType,dbo.GetDictionaryName(F_InfoType) as F_TypeName,(case F_WorkState when 0 then 0 when 9 then 2 else 1 end) F_Statu,(case F_WorkState when 0 then '等待处理' when 9 then '处理完结' else '正在处理' end) F_Status";
|
|
332
|
332
|
int recordCount = 0;
|
|
333
|
333
|
var dt = BLL.PagerBLL.GetListPager(
|
|
334
|
334
|
"T_Bus_WorkOrder",
|
|
|
@@ -440,11 +440,11 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
440
|
440
|
return Process();
|
|
441
|
441
|
}
|
|
442
|
442
|
#region 工单状态
|
|
443
|
|
- var status = "正在处理";
|
|
|
443
|
+ var status = "正在处理"; var statu = 1;
|
|
444
|
444
|
if (ordermodel.F_WorkState == 0)
|
|
445
|
|
- status = "等待处理";
|
|
|
445
|
+ { status = "等待处理"; statu = 0; }
|
|
446
|
446
|
if (ordermodel.F_WorkState == 9)
|
|
447
|
|
- status = "处理完结";
|
|
|
447
|
+ { status = "处理完结"; statu = 2; }
|
|
448
|
448
|
#endregion
|
|
449
|
449
|
#region 绑定类型
|
|
450
|
450
|
var typename = "";
|
|
|
@@ -464,9 +464,23 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
464
|
464
|
areaname = areamodel.F_AreaName;
|
|
465
|
465
|
}
|
|
466
|
466
|
#endregion
|
|
|
467
|
+ #region 绑定关键词
|
|
|
468
|
+ var keyname = "";
|
|
|
469
|
+ if (ordermodel.F_Key != null)
|
|
|
470
|
+ {
|
|
|
471
|
+ var keymodel = divBLL.GetModel(int.Parse(ordermodel.F_Key));
|
|
|
472
|
+ if (keymodel != null)
|
|
|
473
|
+ keyname = keymodel.F_Value;
|
|
|
474
|
+ }
|
|
|
475
|
+
|
|
|
476
|
+ #endregion
|
|
467
|
477
|
|
|
468
|
478
|
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
|
479
|
|
|
|
480
|
+ var fileurl = new List<FileModel>();
|
|
|
481
|
+ if (!string.IsNullOrWhiteSpace(ordermodel.F_File))
|
|
|
482
|
+ fileurl = GetFileData(ordermodel.F_File);
|
|
|
483
|
+
|
|
470
|
484
|
var obj = new
|
|
471
|
485
|
{
|
|
472
|
486
|
ordermodel.F_WorkOrderId,
|
|
|
@@ -475,9 +489,17 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
475
|
489
|
ordermodel.F_CreateTime,
|
|
476
|
490
|
ordermodel.F_SourceAddress,
|
|
477
|
491
|
ordermodel.F_Result,
|
|
478
|
|
- F_AreaName=areaname,
|
|
479
|
|
- F_TypeName=typename,
|
|
480
|
|
- F_Status=status,
|
|
|
492
|
+ ordermodel.F_Key,
|
|
|
493
|
+ F_KeyName = keyname,
|
|
|
494
|
+ F_AreaID = ordermodel.F_SourceArea,
|
|
|
495
|
+ F_AreaName = areaname,
|
|
|
496
|
+ F_Type = ordermodel.F_InfoType,
|
|
|
497
|
+ F_TypeName = typename,
|
|
|
498
|
+ F_Status = status,
|
|
|
499
|
+ F_Statu = statu,
|
|
|
500
|
+ ordermodel.F_IsProtect,
|
|
|
501
|
+ F_Fileid = ordermodel.F_File,
|
|
|
502
|
+ F_FileUrl = fileurl,
|
|
481
|
503
|
items = gclist
|
|
482
|
504
|
};
|
|
483
|
505
|
|
|
|
@@ -579,6 +601,116 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
579
|
601
|
return Process();
|
|
580
|
602
|
}
|
|
581
|
603
|
|
|
|
604
|
+ /// <summary>
|
|
|
605
|
+ /// 上传附件接口
|
|
|
606
|
+ /// </summary>
|
|
|
607
|
+ /// <returns></returns>
|
|
|
608
|
+ [HttpPost]
|
|
|
609
|
+ public ActionResult UploadUrl(string uuid, string port_password, string openid, string timesamp, string dataurl)
|
|
|
610
|
+ {
|
|
|
611
|
+ using (TransactionScope trans = new TransactionScope())
|
|
|
612
|
+ {
|
|
|
613
|
+ #region 参数验证
|
|
|
614
|
+ if (string.IsNullOrEmpty(uuid))
|
|
|
615
|
+ {
|
|
|
616
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
617
|
+ ajresult.message = "客户唯一标识不能为空";
|
|
|
618
|
+ return Process();
|
|
|
619
|
+ }
|
|
|
620
|
+ else if (uuid.Length > 50)
|
|
|
621
|
+ {
|
|
|
622
|
+ ajresult.state = (int)CodeStatus.字符串超出长度;
|
|
|
623
|
+ ajresult.message = "客户唯一标识超出长度";
|
|
|
624
|
+ return Process();
|
|
|
625
|
+ }
|
|
|
626
|
+ if (string.IsNullOrEmpty(openid))
|
|
|
627
|
+ {
|
|
|
628
|
+ ajresult.state = (int)CodeStatus.ID不存在;
|
|
|
629
|
+ ajresult.message = "openid不能为空";
|
|
|
630
|
+ return Process();
|
|
|
631
|
+ }
|
|
|
632
|
+ if (string.IsNullOrEmpty(timesamp))
|
|
|
633
|
+ {
|
|
|
634
|
+ ajresult.state = (int)CodeStatus.必填字段为空;
|
|
|
635
|
+ ajresult.message = "时间戳不能为空";
|
|
|
636
|
+ return Process();
|
|
|
637
|
+ }
|
|
|
638
|
+ if (!Common.CodeValidate.ICodeValidateGridding(openid + timesamp + uuid, port_password))
|
|
|
639
|
+ {
|
|
|
640
|
+ ajresult.state = (int)CodeStatus.安全验证未通过;
|
|
|
641
|
+ ajresult.message = "安全验证未通过";
|
|
|
642
|
+ return Process();
|
|
|
643
|
+ }
|
|
|
644
|
+ if (womagpbll.ExistsUUID(uuid)) //uuid是否已存在,防止重复添加
|
|
|
645
|
+ {
|
|
|
646
|
+ ajresult.state = (int)CodeStatus.数据库错误;
|
|
|
647
|
+ ajresult.message = "操作失败,信息已存在";
|
|
|
648
|
+ return Process();
|
|
|
649
|
+ }
|
|
|
650
|
+ #endregion
|
|
|
651
|
+ var resid = ""; int mapid = 0;
|
|
|
652
|
+ var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + openid + "' and F_Type=5 order by F_CreateTime desc").FirstOrDefault();
|
|
|
653
|
+ if (wxuser == null)
|
|
|
654
|
+ {
|
|
|
655
|
+ ajresult.state = (int)CodeStatus.用户无效;
|
|
|
656
|
+ ajresult.message = "用户无效";
|
|
|
657
|
+ return Process();
|
|
|
658
|
+ }
|
|
|
659
|
+
|
|
|
660
|
+ string path = "/Upload/Gridding/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
|
|
|
661
|
+ var url = dataurl.Split('|');
|
|
|
662
|
+ FileUp fileup = new FileUp();
|
|
|
663
|
+ if (url.Count() <= 0)
|
|
|
664
|
+ {
|
|
|
665
|
+ ajresult.state = (int)CodeStatus.无可上传文件;
|
|
|
666
|
+ ajresult.message = "无可上传文件";
|
|
|
667
|
+ return Process();
|
|
|
668
|
+ }
|
|
|
669
|
+ foreach (var item in url)
|
|
|
670
|
+ {
|
|
|
671
|
+ var filename = fileup.GetFileName(item);
|
|
|
672
|
+ var fileext = fileup.GetExt(item);
|
|
|
673
|
+ ImageUpload iu = new ImageUpload();
|
|
|
674
|
+ iu.SavePath = path;
|
|
|
675
|
+ var re = iu.downloadurl(item, filename);
|
|
|
676
|
+
|
|
|
677
|
+ if (re == "")
|
|
|
678
|
+ {
|
|
|
679
|
+ #region 附件保存
|
|
|
680
|
+ Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
|
681
|
+ model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
|
682
|
+ model_T_Sys_Accessories.F_FileName = filename;//附件名称
|
|
|
683
|
+ model_T_Sys_Accessories.F_FileType = fileext;//附件类型
|
|
|
684
|
+ model_T_Sys_Accessories.F_FileUrl = path + filename;//附件地址
|
|
|
685
|
+ model_T_Sys_Accessories.F_Size = 0;//iu.FileSize;
|
|
|
686
|
+ model_T_Sys_Accessories.F_UserCode = wxuser.F_Id.ToString();//上传人
|
|
|
687
|
+ var assid = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
|
688
|
+ model_T_Sys_Accessories.F_FileId = assid;
|
|
|
689
|
+ #endregion
|
|
|
690
|
+ if (assid > 0)
|
|
|
691
|
+ {
|
|
|
692
|
+ resid = resid + assid.ToString() + ",";
|
|
|
693
|
+ }
|
|
|
694
|
+ else
|
|
|
695
|
+ continue;
|
|
|
696
|
+ }
|
|
|
697
|
+ }
|
|
|
698
|
+ resid = resid.Trim(',');
|
|
|
699
|
+ #region 接收信息保存
|
|
|
700
|
+ mapid = AddMap(uuid, port_password, "receive", "UploadUrl", openid, "");
|
|
|
701
|
+ #endregion
|
|
|
702
|
+
|
|
|
703
|
+ ajresult.state = (int)CodeStatus.SUCCESS;
|
|
|
704
|
+ ajresult.message = "操作成功";
|
|
|
705
|
+ ajresult.data = resid; //反馈ID
|
|
|
706
|
+
|
|
|
707
|
+ //接收信息日志保存
|
|
|
708
|
+ AddDockingLogs("", "", "", dataurl, "", "", uuid, port_password, "receive", ajresult.ToJson(), "UploadUrl", openid, 0, 0, 0, 0, mapid);
|
|
|
709
|
+ trans.Complete();
|
|
|
710
|
+ }
|
|
|
711
|
+ return Process();
|
|
|
712
|
+ }
|
|
|
713
|
+
|
|
582
|
714
|
#region 私有方法
|
|
583
|
715
|
/// <summary>
|
|
584
|
716
|
/// 成功的消息格式化
|
|
|
@@ -637,6 +769,31 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
637
|
769
|
|
|
638
|
770
|
new BLL.T_Bus_WorkOrder_WXDocking_logs().Add(logs);
|
|
639
|
771
|
}
|
|
|
772
|
+
|
|
|
773
|
+ /// <summary>
|
|
|
774
|
+ /// 获取附件数据
|
|
|
775
|
+ /// </summary>
|
|
|
776
|
+ /// <param name="ids">附件id,多个用英文逗号,隔开</param>
|
|
|
777
|
+ /// <param name="prefix">前缀</param>
|
|
|
778
|
+ /// <returns></returns>
|
|
|
779
|
+ protected List<FileModel> GetFileData(string ids)
|
|
|
780
|
+ {
|
|
|
781
|
+ var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
|
782
|
+
|
|
|
783
|
+ List<Model.T_Sys_Accessories> filelist = new BLL.T_Sys_Accessories().GetModelList(" F_FileId in (" + ids + ") ");
|
|
|
784
|
+
|
|
|
785
|
+ List<FileModel> fileslist = new List<FileModel>();
|
|
|
786
|
+ foreach (var item in filelist)
|
|
|
787
|
+ {
|
|
|
788
|
+ var model = new FileModel();
|
|
|
789
|
+ model.id = item.F_FileId;
|
|
|
790
|
+ model.url = config.F_ParamValue + item.F_FileUrl;
|
|
|
791
|
+ model.addtime = item.F_AddTime.Value;
|
|
|
792
|
+
|
|
|
793
|
+ fileslist.Add(model);
|
|
|
794
|
+ }
|
|
|
795
|
+ return fileslist;
|
|
|
796
|
+ }
|
|
640
|
797
|
#endregion
|
|
641
|
798
|
}
|
|
642
|
799
|
|
|
|
@@ -664,4 +821,11 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
664
|
821
|
异常结果类型 = 500
|
|
665
|
822
|
|
|
666
|
823
|
}
|
|
|
824
|
+
|
|
|
825
|
+ public class FileModel
|
|
|
826
|
+ {
|
|
|
827
|
+ public int id { get; set; }
|
|
|
828
|
+ public string url { get; set; }
|
|
|
829
|
+ public DateTime addtime { get; set; }
|
|
|
830
|
+ }
|
|
667
|
831
|
}
|