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

DockingController.cs 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using CallCenter.Utility;
  2. using CallCenterApi.Interface.Controllers.Base;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace CallCenterApi.Interface.Controllers.Docking
  12. {
  13. public class DockingController : BaseController
  14. {
  15. #region 获取第三方数据
  16. /// <summary>
  17. /// 获取企业列表信息
  18. /// </summary>
  19. /// <returns></returns>
  20. public ActionResult SendGetCompanylist(string name,int pageno=1,int pagesize=100)
  21. {
  22. string strURL = "http://222.143.48.99:82/api/acase-main/company/page?";
  23. strURL += "&current="+ pageno;
  24. strURL += "&size="+ pagesize;
  25. if (!string.IsNullOrWhiteSpace(name))
  26. strURL += "&name=" + name;
  27. string strHTML = HttpMethods.HttpGet(strURL);
  28. JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
  29. if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
  30. {
  31. return Success("成功", jo1["data"]);
  32. }
  33. else
  34. return Error("失败");
  35. }
  36. /// <summary>
  37. /// 企业信息添加
  38. /// </summary>
  39. /// <returns></returns>
  40. public ActionResult SendAddCompany(string name)
  41. {
  42. string strURL = "http://222.143.48.99:82/api/acase-main/company/save";
  43. var m = new {
  44. id=0,//"id":"唯一标识",
  45. linkman="",//"linkman":"联系人",
  46. mobile = "",//"mobile":"联系电话",
  47. name = name,//"name":"企业名称",
  48. creditCore = "",//"creditCore":"统一社会信用代码",
  49. type = "",//"type":"类型",
  50. legalRepresentative = "",//"legalRepresentative":"法定代表人",
  51. registeredCapital = "",//"registeredCapital":"注册资本",
  52. currency = "",//"currency":"币种",
  53. foundingTime = "",//"foundingTime":"成立日期",
  54. businessTimeBegin = "",//"businessTimeBegin":"营业期限开始",
  55. businessTimeEnd = "",//"businessTimeEnd":"营业期限结束",
  56. auditTime = "",//"auditTime":"核准日期",
  57. regDepartmentId = "",//"regDepartmentId":"登记机关",
  58. address = "",//"address":"登记地址",
  59. tradeAddres = "",//"tradeAddres":"经营地址",
  60. agentName = "",//"agentName":"代理人名字",
  61. agentIdcard = "",//"agentIdcard":"代理人身份证",
  62. tradeArea = "",//"tradeArea":"经营范围",
  63. isLocal = "",//"isLocal":"是否本地注册(1:本地,2:非本地)",
  64. unitType = "",//"unitType":"企业状态1.存续、2.在业、3.吊销、4.注销、5.迁入、6.迁出、7.停业、8.清算"
  65. };
  66. string json1 = JsonConvert.SerializeObject(m);
  67. string strHTML = HttpMethods.HttpPost(strURL, json1, "application/json");
  68. JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
  69. if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
  70. {
  71. return Success("成功", jo1["data"]);
  72. }
  73. else
  74. return Error("失败");
  75. }
  76. #endregion
  77. #region 第三方使用接口
  78. /// <summary>
  79. /// 对接方获取通话记录
  80. /// </summary>
  81. /// <returns></returns>
  82. public ActionResult ReceiveCallRecords(string CallNumber, int pageindex = 1, int pagesize = 10)
  83. {
  84. var sql = "";
  85. if (!string.IsNullOrEmpty(CallNumber))
  86. {
  87. sql += " and CallNumber like '%" + CallNumber + "%'";
  88. }
  89. string cols = "CallRecordsId,CallNumber,CallType,CallState,DealType,BeginTime,TalkStartTime,TalkEndTime,TalkLongTime,UserCode,T_Sys_UserAccount.F_UserName as UserName,(select d.f_deptName from T_Sys_UserAccount u,[dbo].[T_Sys_Department] d where u.F_DeptId=d.F_DeptId and u.F_UserCode= UserCode) AS CusDepName,(select COUNT(1) from dbo.T_Rec_RegRecords where F_CallId = T_Call_CallRecords.CallId) as IsWorkeorder,FilePath";
  90. var recordCount = 0;
  91. DataTable dt = BLL.PagerBLL.GetListPager(
  92. "T_Call_CallRecords WITH(NOLOCK) left join T_Sys_UserAccount on UserCode=F_UserCode ",
  93. "CallRecordsId",
  94. cols,
  95. sql,
  96. "ORDER BY BeginTime desc",
  97. pagesize,
  98. pageindex,
  99. true,
  100. out recordCount);
  101. var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  102. foreach (DataRow dr in dt.Rows)
  103. {
  104. string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
  105. if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
  106. {
  107. var ym = config.F_ParamValue;
  108. if (ym.Substring(ym.Length - 1) == "/")
  109. {
  110. ym = ym.Substring(0, ym.Length - 1);
  111. }
  112. dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
  113. }
  114. }
  115. var obj = new
  116. {
  117. rows = dt,
  118. total = recordCount
  119. };
  120. return Success("通话记录获取成功", obj);
  121. }
  122. /// <summary>
  123. /// 对接方获取登记记录
  124. /// </summary>
  125. /// <param name="phone"></param>
  126. /// <param name="key"></param>
  127. /// <param name="pageindex"></param>
  128. /// <param name="pagesize"></param>
  129. /// <returns></returns>
  130. public ActionResult ReceiveRegRecords(string phone,string key, int pageindex = 1, int pagesize = 10)
  131. {
  132. string sql = "";
  133. if (!string.IsNullOrWhiteSpace(key))
  134. {
  135. sql += " and (F_RecCode like '%" + key.Trim() + "%' or F_Complained like '%" + key.Trim() + "%' or F_Content like '%" + key.Trim() + "%' or F_Remark like '%" + key.Trim() + "%')";
  136. }
  137. if (!string.IsNullOrWhiteSpace(phone))
  138. {
  139. sql += " and F_Tel like '%" + phone.Trim() + "%' ";
  140. }
  141. DataTable dt = new DataTable();
  142. string cols = "F_RecCode,(select F_Name from T_Cus_Customer where F_Id=F_CusID) CusName,(select F_Phone from T_Cus_Customer where F_Id=F_CusID) CusPhone,F_Type,F_Complained,F_Content,F_Remark,dbo.GetUserName(F_CreateBy) CreateByName,F_CreateOn ";
  143. //登记编号,姓名,联系电话,登记类型,被投诉单位,登记内容,备注,创建人,创建时间
  144. var recordCount = 0;
  145. dt = BLL.PagerBLL.GetListPager(
  146. "T_Rec_RegRecords",
  147. "F_ID",
  148. cols,
  149. sql,
  150. "ORDER BY F_CreateOn desc",
  151. pagesize,
  152. pageindex,
  153. true,
  154. out recordCount);
  155. var obj = new
  156. {
  157. rows = dt,
  158. total = recordCount
  159. };
  160. return Success("登记记录获取成功", obj);
  161. }
  162. #endregion
  163. }
  164. }