高新区管委会,以5.0标准版为基准,从双汇项目拷贝

BusinessDockController.cs 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using CallCenter.Utility;
  2. using CallCenter.Utility.log;
  3. using CallCenterApi.Common;
  4. using CallCenterApi.DB;
  5. using CallCenterApi.Interface.Controllers.Base;
  6. using CallCenterApi.Interface.Controllers.tel;
  7. using Newtonsoft.Json.Linq;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.EnterpriseServices;
  12. using System.Linq;
  13. using System.Transactions;
  14. using System.Web;
  15. using System.Web.Mvc;
  16. namespace CallCenterApi.Interface.Controllers.workorder
  17. {
  18. public class BusinessDockController : BaseController
  19. {
  20. private BLL.T_Sys_SystemConfig configBll = new BLL.T_Sys_SystemConfig();
  21. private AjaxResult ajresult = new AjaxResult();
  22. // private FileUp fileup = new FileUp();
  23. /// <summary>
  24. /// 成功的消息格式化
  25. /// </summary>
  26. /// <param name="message"></param>
  27. /// <returns></returns>
  28. protected virtual ActionResult Process()
  29. {
  30. string methodName = new System.Diagnostics.StackTrace(true).GetFrame(1).GetMethod().Name; //事件源
  31. //验证文件是否存在
  32. // LogInterface.WriteLog(this.GetType().ToString() + " -- " + methodName + "\r\n" + ajresult.state + "|" + ajresult.data + ajresult.message); //日志
  33. var jsonMsg = new AjaxResult { state = ajresult.state, message = ajresult.message, data = ajresult.data }.ToJson();
  34. return Content(jsonMsg);
  35. }
  36. /// <summary>
  37. /// 状态枚举
  38. /// </summary>
  39. enum CodeStatus
  40. {
  41. SUCCESS = 200,
  42. 安全验证未通过 = 400,
  43. 无法预测的程序错误 = 501,
  44. 参数格式错误 = 100,
  45. 必填字段为空 = 101,
  46. 字符串超出长度 = 102,
  47. 数据库错误 = 103,
  48. 执行超时 = 104,
  49. 参数逻辑错误 = 105,
  50. ID不存在 = 106,
  51. 无可上传文件=107,
  52. 执行失败 = 108,
  53. 用户已禁用 = 120,
  54. 异常结果类型 = 500
  55. }
  56. /// <summary>
  57. /// 添加日志
  58. /// </summary>
  59. public void AddGriddingLogs(string uuid, string port_password,
  60. string direction, string msg, string usercode,
  61. string workorderid, string dealman, string result,
  62. string files, string prosituation, string dealcontact,
  63. string connecttime, string connectmode, string replycontent,
  64. string duties, string situation,
  65. string F_resultsCOntent, string F_OperatContent,string F_OperatType,
  66. int state = 0, int feedbackid = 0,
  67. int isproresult = 0, int isstaisfied = 0, int mapid = 0
  68. )
  69. {
  70. Model.T_Bus_WorkOrder_GriddingWO_logs logs = new Model.T_Bus_WorkOrder_GriddingWO_logs();
  71. logs.F_WorkOrderId = workorderid;
  72. logs.F_uuid = uuid;
  73. logs.F_port_password = port_password;
  74. logs.F_MapID = mapid;
  75. logs.F_Direction = direction;
  76. logs.F_AddTime = DateTime.Now;
  77. logs.F_Message = msg;
  78. logs.F_Result = result;
  79. logs.F_Usercode = usercode;
  80. logs.F_dealman = dealman;
  81. logs.F_Files = files;
  82. logs.F_ProSituation = prosituation;
  83. logs.F_DealContact = dealcontact;
  84. logs.F_ConnectTime = connecttime;
  85. logs.F_ConnectMode = connectmode;
  86. logs.F_Duties = duties;
  87. logs.F_Situation = situation;
  88. logs.F_State = state;
  89. logs.F_FeedbackID = feedbackid;
  90. logs.F_IsProResult = isproresult;
  91. logs.F_IsSatisfied = isstaisfied;
  92. //结果返回数据
  93. logs.F_resultsCOntent = F_resultsCOntent;
  94. //操作内容
  95. logs.F_OperatContent = F_OperatContent;
  96. //操作类型
  97. logs.F_OperatType = F_OperatType;
  98. new BLL.T_Bus_WorkOrder_GriddingWO_logs().Add(logs);
  99. }
  100. /// <summary>
  101. /// 查收接口
  102. ///port_password: 对方以相同方式生成的md5 密码
  103. ///uuid: 对方给的随机数
  104. ///usercode:用户账号
  105. ///
  106. /// </summary>
  107. /// <returns></returns>
  108. ///
  109. [AutoComplete(true)]
  110. public ActionResult ReceiveWorkOrder()
  111. {
  112. //string port_password = RequestString.GetFormString("port_password"); //加密信息(安全验证用)
  113. //string uuid = RequestString.GetFormString("uuid"); //客户唯一标识(安全验证用)
  114. //string content = RequestString.GetFormString("content");//查收详情
  115. //string usercode = RequestString.GetFormString("usercode");
  116. //string pid = HttpUtility.UrlDecode(RequestString.GetQueryString("pid"));
  117. string port_password = HttpUtility.UrlDecode(RequestString.GetQueryString("port_password")); //加密信息(安全验证用)
  118. string uuid = HttpUtility.UrlDecode(RequestString.GetQueryString("uuid")); //客户唯一标识(安全验证用)
  119. string content = HttpUtility.UrlDecode(RequestString.GetQueryString("content"));//查收详情
  120. string usercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  121. //using (TransactionScope scope = new TransactionScope(
  122. // TransactionScopeOption.Required, new TimeSpan(6000000000)))
  123. //{
  124. #region 参数验证
  125. if (string.IsNullOrEmpty(uuid))
  126. {
  127. ajresult.state = (int)CodeStatus.ID不存在;
  128. ajresult.message = "客户唯一标识不能为空";
  129. return Process();
  130. }
  131. else if (uuid.Length > 50)
  132. {
  133. ajresult.state = (int)CodeStatus.字符串超出长度;
  134. ajresult.message = "客户唯一标识超出长度";
  135. return Process();
  136. }
  137. //if (string.IsNullOrEmpty(workorderid))
  138. //{
  139. // ajresult.state = (int)CodeStatus.必填字段为空;
  140. // ajresult.message = "工单编号不能为空";
  141. // return Process();
  142. //}
  143. if (string.IsNullOrEmpty(usercode))
  144. {
  145. ajresult.state = (int)CodeStatus.必填字段为空;
  146. ajresult.message = "工号不能为空";
  147. return Process();
  148. }
  149. if (!Common.CodeValidate.ICodeValidateGridding(uuid, port_password))
  150. {
  151. ajresult.state = (int)CodeStatus.安全验证未通过;
  152. ajresult.message = "安全验证未通过";
  153. return Process();
  154. }
  155. #endregion
  156. //通话记录
  157. CallrecordsController wo = new CallrecordsController();
  158. //通话记录 BusinessDockCurrentUserGetList
  159. object[] obj1 = wo.GetBusinessDockList(usercode, content);
  160. if (obj1[0].ToString() == "false")
  161. {
  162. ajresult.state = (int)CodeStatus.执行失败;
  163. ajresult.message = "操作失败," + obj1[1].ToString();
  164. }
  165. else
  166. {
  167. ajresult.state = (int)CodeStatus.SUCCESS;
  168. ajresult.message = "操作成功";
  169. ajresult.data = obj1[2]; //反馈ID
  170. }
  171. //通话记录数据拼接记录查询内容obj1[3]
  172. //添加操作记录
  173. //AddGriddingLogs(uuid, port_password, "search", " Callrecords:" + ajresult.message + "||" + content + "||" + ajresult.state, usercode, "0", "", "", "", "", "", "", "", "", "", "",
  174. // obj1[3].ToString(), "通讯记录", "查询表单",
  175. // 0, 0, 0, 0, 0);
  176. AddGriddingLogs(uuid, port_password, "search", "Callrecords:" + ajresult.message + "||" + content + "||" + ajresult.state, usercode, "0", "", "", "", "", "", "", "", "", "", "",
  177. obj1[3].ToString(), "通讯记录", "查询表单",
  178. 0, 0, 0, 0, 0);
  179. // scope.Complete();
  180. //}
  181. return Process();
  182. }
  183. }
  184. }