| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- using CallCenter.Utility;
- using CallCenter.Utility.log;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Controllers.tel;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.EnterpriseServices;
- using System.Linq;
- using System.Transactions;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.workorder
- {
- public class BusinessDockController : BaseController
- {
-
- private BLL.T_Sys_SystemConfig configBll = new BLL.T_Sys_SystemConfig();
- private AjaxResult ajresult = new AjaxResult();
- // private FileUp fileup = new FileUp();
-
- /// <summary>
- /// 成功的消息格式化
- /// </summary>
- /// <param name="message"></param>
- /// <returns></returns>
- protected virtual ActionResult Process()
- {
- string methodName = new System.Diagnostics.StackTrace(true).GetFrame(1).GetMethod().Name; //事件源
- //验证文件是否存在
- // LogInterface.WriteLog(this.GetType().ToString() + " -- " + methodName + "\r\n" + ajresult.state + "|" + ajresult.data + ajresult.message); //日志
- var jsonMsg = new AjaxResult { state = ajresult.state, message = ajresult.message, data = ajresult.data }.ToJson();
- return Content(jsonMsg);
- }
-
- /// <summary>
- /// 状态枚举
- /// </summary>
- enum CodeStatus
- {
- SUCCESS = 200,
- 安全验证未通过 = 400,
- 无法预测的程序错误 = 501,
- 参数格式错误 = 100,
- 必填字段为空 = 101,
- 字符串超出长度 = 102,
- 数据库错误 = 103,
- 执行超时 = 104,
- 参数逻辑错误 = 105,
- ID不存在 = 106,
- 无可上传文件=107,
- 执行失败 = 108,
- 用户已禁用 = 120,
-
- 异常结果类型 = 500
- }
- /// <summary>
- /// 添加日志
- /// </summary>
- public void AddGriddingLogs(string uuid, string port_password,
- string direction, string msg, string usercode,
- string workorderid, string dealman, string result,
- string files, string prosituation, string dealcontact,
- string connecttime, string connectmode, string replycontent,
- string duties, string situation,
- string F_resultsCOntent, string F_OperatContent,string F_OperatType,
- int state = 0, int feedbackid = 0,
- int isproresult = 0, int isstaisfied = 0, int mapid = 0
- )
- {
- Model.T_Bus_WorkOrder_GriddingWO_logs logs = new Model.T_Bus_WorkOrder_GriddingWO_logs();
- logs.F_WorkOrderId = workorderid;
- logs.F_uuid = uuid;
- logs.F_port_password = port_password;
- logs.F_MapID = mapid;
- logs.F_Direction = direction;
- logs.F_AddTime = DateTime.Now;
- logs.F_Message = msg;
- logs.F_Result = result;
- logs.F_Usercode = usercode;
- logs.F_dealman = dealman;
- logs.F_Files = files;
- logs.F_ProSituation = prosituation;
- logs.F_DealContact = dealcontact;
- logs.F_ConnectTime = connecttime;
- logs.F_ConnectMode = connectmode;
- logs.F_Duties = duties;
- logs.F_Situation = situation;
- logs.F_State = state;
- logs.F_FeedbackID = feedbackid;
- logs.F_IsProResult = isproresult;
- logs.F_IsSatisfied = isstaisfied;
- //结果返回数据
- logs.F_resultsCOntent = F_resultsCOntent;
- //操作内容
- logs.F_OperatContent = F_OperatContent;
- //操作类型
- logs.F_OperatType = F_OperatType;
- new BLL.T_Bus_WorkOrder_GriddingWO_logs().Add(logs);
- }
- /// <summary>
- /// 查收接口
- ///port_password: 对方以相同方式生成的md5 密码
- ///uuid: 对方给的随机数
- ///usercode:用户账号
- ///
- /// </summary>
- /// <returns></returns>
- ///
- [AutoComplete(true)]
- public ActionResult ReceiveWorkOrder()
- {
- //string port_password = RequestString.GetFormString("port_password"); //加密信息(安全验证用)
- //string uuid = RequestString.GetFormString("uuid"); //客户唯一标识(安全验证用)
- //string content = RequestString.GetFormString("content");//查收详情
- //string usercode = RequestString.GetFormString("usercode");
- //string pid = HttpUtility.UrlDecode(RequestString.GetQueryString("pid"));
- string port_password = HttpUtility.UrlDecode(RequestString.GetQueryString("port_password")); //加密信息(安全验证用)
- string uuid = HttpUtility.UrlDecode(RequestString.GetQueryString("uuid")); //客户唯一标识(安全验证用)
- string content = HttpUtility.UrlDecode(RequestString.GetQueryString("content"));//查收详情
- string usercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- //using (TransactionScope scope = new TransactionScope(
- // TransactionScopeOption.Required, new TimeSpan(6000000000)))
- //{
- #region 参数验证
- if (string.IsNullOrEmpty(uuid))
- {
- ajresult.state = (int)CodeStatus.ID不存在;
- ajresult.message = "客户唯一标识不能为空";
- return Process();
- }
- else if (uuid.Length > 50)
- {
- ajresult.state = (int)CodeStatus.字符串超出长度;
- ajresult.message = "客户唯一标识超出长度";
- return Process();
- }
- //if (string.IsNullOrEmpty(workorderid))
- //{
- // ajresult.state = (int)CodeStatus.必填字段为空;
- // ajresult.message = "工单编号不能为空";
- // return Process();
- //}
- if (string.IsNullOrEmpty(usercode))
- {
- ajresult.state = (int)CodeStatus.必填字段为空;
- ajresult.message = "工号不能为空";
- return Process();
- }
- if (!Common.CodeValidate.ICodeValidateGridding(uuid, port_password))
- {
- ajresult.state = (int)CodeStatus.安全验证未通过;
- ajresult.message = "安全验证未通过";
- return Process();
- }
- #endregion
- //通话记录
- CallrecordsController wo = new CallrecordsController();
- //通话记录 BusinessDockCurrentUserGetList
- object[] obj1 = wo.GetBusinessDockList(usercode, content);
-
- if (obj1[0].ToString() == "false")
- {
- ajresult.state = (int)CodeStatus.执行失败;
- ajresult.message = "操作失败," + obj1[1].ToString();
- }
- else
- {
- ajresult.state = (int)CodeStatus.SUCCESS;
- ajresult.message = "操作成功";
- ajresult.data = obj1[2]; //反馈ID
- }
- //通话记录数据拼接记录查询内容obj1[3]
- //添加操作记录
- //AddGriddingLogs(uuid, port_password, "search", " Callrecords:" + ajresult.message + "||" + content + "||" + ajresult.state, usercode, "0", "", "", "", "", "", "", "", "", "", "",
- // obj1[3].ToString(), "通讯记录", "查询表单",
- // 0, 0, 0, 0, 0);
- AddGriddingLogs(uuid, port_password, "search", "Callrecords:" + ajresult.message + "||" + content + "||" + ajresult.state, usercode, "0", "", "", "", "", "", "", "", "", "", "",
- obj1[3].ToString(), "通讯记录", "查询表单",
- 0, 0, 0, 0, 0);
- // scope.Complete();
- //}
- return Process();
- }
- }
- }
|