地铁二期项目正式开始

CustomerController.cs 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. using YTSoft.BaseCallCenter.MVCWeb.Models;
  9. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  10. {
  11. public class CustomerController : BaseController
  12. {
  13. //
  14. // GET: /Customer/
  15. BLL.T_Cus_CustomerBase cusBLL = new BLL.T_Cus_CustomerBase();
  16. public ActionResult CustomerAllList(int cusType)
  17. {
  18. CusPageModel model = new CusPageModel();
  19. model.cusType = cusType;
  20. return View(model);
  21. }
  22. /// <summary>
  23. /// 添加修改 视图
  24. /// </summary>
  25. /// <returns></returns>
  26. public ActionResult Add()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 客户状态修改
  32. /// </summary>
  33. /// <param name="model"></param>
  34. /// <returns></returns>
  35. public bool SaveReceivedData(string keyList, int status)
  36. {
  37. return cusBLL.EditCustonStatus(keyList, status);
  38. }
  39. #region 加载客户列表
  40. /// <summary>
  41. /// 加载客户列表
  42. /// </summary>
  43. /// <param name="page">当前页码</param>
  44. /// <param name="limit">每页数据量</param>
  45. /// <param name="sqlWhere">查询条件</param>
  46. /// <returns></returns>
  47. [ActionName("LoadCustomerALLList")]
  48. [HttpGet]
  49. public string LoadCustomerALLList(DateTime? NowDateTime, string cusType, int page, int limit, string cusName, string cusNum)
  50. {
  51. //数据结果集
  52. ResponseData dataModel = new ResponseData();
  53. string sql = "";
  54. sql += " and F_DeleteFlag=0 ";
  55. //语音客户
  56. if (cusType == "1")
  57. {
  58. sql += " and F_Kind=1 ";
  59. }
  60. //微信客户
  61. if (cusType == "2")
  62. {
  63. sql += " and F_Kind=2 ";
  64. }
  65. //微博客户
  66. if (cusType == "3")
  67. {
  68. sql += " and F_Kind=3 ";
  69. }
  70. //特别客户
  71. if (cusType == "4")
  72. {
  73. sql += " and F_ScaleResume=2";
  74. }
  75. //黑名单客户
  76. if (cusType == "5")
  77. {
  78. sql += " and F_ScaleResume=3";
  79. }
  80. //白名单客户
  81. if (cusType == "6")
  82. {
  83. sql += " and F_ScaleResume=4";
  84. }
  85. if (!string.IsNullOrEmpty(cusName))
  86. {
  87. sql += " and F_CustomerName like '%" + cusName.Trim() + "%' ";
  88. }
  89. if (!string.IsNullOrEmpty(cusNum))
  90. {
  91. // sql += " and( F_Telephone like '%" + cusNum + "%' or F_Mobile like '%" + cusNum + "%' )";
  92. sql += " and F_Telephone like '%" + cusNum.Trim() + "%'";
  93. }
  94. DataTable dt = new DataTable();
  95. int recordCount = 0;
  96. Model.PageData<Model.T_Cus_CustomerBase> pageModel = new Model.PageData<Model.T_Cus_CustomerBase>();
  97. dt = BLL.PagerBLL.GetListPager(
  98. "T_Cus_CustomerBase",
  99. "F_CustomerId",
  100. "*,CONVERT(varchar,F_ModifiedOn, 120 ) as F_ModifiedOnNew "
  101. ,
  102. sql,
  103. "ORDER BY F_CustomerId desc",
  104. limit,
  105. page,
  106. true,
  107. out recordCount);
  108. dataModel.code = 0;
  109. dataModel.count = recordCount;
  110. dataModel.data = dt;
  111. return JsonConvert.SerializeObject(dataModel);
  112. }
  113. [ActionName("GetCustomerModel")]
  114. [HttpGet]
  115. public string GetCustomerModel(int id)
  116. {
  117. if (id == 0)
  118. {
  119. return Error("id不能为空");
  120. }
  121. BLL.T_Cus_CustomerBase busCus_CustomerBase = new BLL.T_Cus_CustomerBase();
  122. Model.T_Cus_CustomerBase model= busCus_CustomerBase.GetModel(id);
  123. int count = 0;
  124. if (model != null)
  125. count = 1;
  126. return Success("成功", model, count);
  127. }
  128. #endregion
  129. #region 客户工单信息
  130. /// <summary>
  131. /// 获取所有工单信息
  132. /// </summary>
  133. /// <returns></returns>
  134. public ActionResult CusOrderList(string callNumber)
  135. {
  136. ViewCusOrderModel cusModel = new ViewCusOrderModel();
  137. cusModel.F_Telephone = callNumber;
  138. cusModel.SeatFlag = F_SeatFlag;
  139. return View(cusModel);
  140. }
  141. /// <summary>
  142. /// 获取工单信息
  143. /// </summary>
  144. /// <param name="page">当前页码</param>
  145. /// <param name="limit">每页数据量</param>
  146. /// <param name="sqlWhere">查询条件</param>
  147. /// <returns></returns>
  148. [ActionName("CusOrderData")]
  149. [HttpGet]
  150. public string CusOrderData(int page, int limit, string cusNumber)
  151. {
  152. //数据结果集
  153. ResponseData dataModel = new ResponseData();
  154. string sql = "";
  155. //客户电话
  156. if (!string.IsNullOrEmpty(cusNumber))
  157. {
  158. sql += " and t.F_CUSTOMERTELEPHONE = '" + cusNumber.Trim() + "'";
  159. }
  160. else
  161. {
  162. sql += " and t.F_CUSTOMERTELEPHONE='-1'";
  163. }
  164. string tableNew = string.Format("(select DISTINCT t.* from T_Wo_WorkOrderBase t LEFT JOIN T_Wo_WorkOrderHistory h ON t.F_WORKORDERID=h.F_INSTANCEID LEFT JOIN T_Sys_UserAccount u ON t.F_USERID= u.F_UserId where (u.F_DeptId={0} OR h.F_OPTBTNID={0})) as t", F_DeptId);
  165. DataTable dt = new DataTable();
  166. int recordCount = 0;
  167. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  168. dt = BLL.PagerBLL.GetListPager(
  169. tableNew,
  170. "F_WORKORDERID",
  171. " t.*,CONVERT(varchar,t.F_CREATEDATE, 120 ) as F_CREATEDATENew"
  172. + " ,(CASE F_WORKORDERFROM WHEN '留言工单' THEN (SELECT F_RecFileUrl FROM dbo.T_Call_LeaveRecord WHERE F_CallId=t.F_KSHADDRESSCODE) WHEN '语音工单' THEN (SELECT FilePath FROM dbo.T_Call_CallRecords WHERE CallId=t.F_KSHADDRESSCODE) ELSE NULL END ) as FilePath",
  173. sql,
  174. "ORDER BY t.F_CREATEDATE desc",
  175. limit,
  176. page,
  177. true,
  178. out recordCount);
  179. dataModel.code = 0;
  180. dataModel.count = recordCount;
  181. dataModel.data = dt;
  182. return JsonConvert.SerializeObject(dataModel);
  183. }
  184. [ActionName("GetCusDatabyNumber")]
  185. [HttpGet]
  186. public string GetCusDatabyNumber( string cusNumber)
  187. {
  188. //数据结果集
  189. ResponseData dataModel = new ResponseData();
  190. // cusBLL.GetCusInfoModel(cusNumber);
  191. return JsonConvert.SerializeObject(cusBLL.GetCusInfoModel(cusNumber));
  192. }
  193. //
  194. /// <summary>
  195. /// 保存编辑客户
  196. /// </summary>
  197. /// <param name="workOrderBaseModel"></param>
  198. /// <returns></returns>
  199. //[AcceptVerbs(HttpVerbs.Post)]
  200. //public bool SaveRepositoryCategoryContentData(T_RepositoryInformation categoryContentModel)
  201. //{
  202. // categoryContentModel.F_CreateBy = F_UserID;
  203. // if (categoryContentModel.F_RepositoryId > 0)
  204. // {
  205. // return reposCategoryContentBLL.Update(categoryContentModel);
  206. // }
  207. // else
  208. // {
  209. // return reposCategoryContentBLL.Add(categoryContentModel) > 0;
  210. // }
  211. //}
  212. #endregion
  213. }
  214. public class ViewCusOrderModel
  215. {
  216. public string F_Telephone
  217. {
  218. get;
  219. set;
  220. }
  221. public bool SeatFlag
  222. {
  223. get;
  224. set;
  225. }
  226. }
  227. }