地铁二期项目正式开始

CustomerController.cs 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. AddAction("t_cus_customerbase", keyList, "修改客户状态",status.ToMyString());
  38. return cusBLL.EditCustonStatus(keyList, status);
  39. }
  40. #region 加载客户列表
  41. /// <summary>
  42. /// 加载客户列表
  43. /// </summary>
  44. /// <param name="page">当前页码</param>
  45. /// <param name="limit">每页数据量</param>
  46. /// <param name="sqlWhere">查询条件</param>
  47. /// <returns></returns>
  48. [ActionName("LoadCustomerALLList")]
  49. [HttpGet]
  50. public string LoadCustomerALLList(DateTime? NowDateTime, string cusType, int page, int limit, string cusName, string cusNum)
  51. {
  52. //数据结果集
  53. ResponseData dataModel = new ResponseData();
  54. string sql = "";
  55. sql += " and F_DeleteFlag=0 ";
  56. //语音客户
  57. if (cusType == "1")
  58. {
  59. sql += " and F_Kind=1 ";
  60. }
  61. //微信客户
  62. if (cusType == "2")
  63. {
  64. sql += " and F_Kind=2 ";
  65. }
  66. //微博客户
  67. if (cusType == "3")
  68. {
  69. sql += " and F_Kind=3 ";
  70. }
  71. //特别客户
  72. if (cusType == "4")
  73. {
  74. sql += " and F_ScaleResume=2";
  75. }
  76. //黑名单客户
  77. if (cusType == "5")
  78. {
  79. sql += " and F_ScaleResume=3";
  80. }
  81. //白名单客户
  82. if (cusType == "6")
  83. {
  84. sql += " and F_ScaleResume=4";
  85. }
  86. if (!string.IsNullOrEmpty(cusName))
  87. {
  88. sql += " and F_CustomerName like '%" + cusName.Trim() + "%' ";
  89. }
  90. if (!string.IsNullOrEmpty(cusNum))
  91. {
  92. // sql += " and( F_Telephone like '%" + cusNum + "%' or F_Mobile like '%" + cusNum + "%' )";
  93. sql += " and F_Telephone like '%" + cusNum.Trim() + "%'";
  94. }
  95. DataTable dt = new DataTable();
  96. int recordCount = 0;
  97. Model.PageData<Model.T_Cus_CustomerBase> pageModel = new Model.PageData<Model.T_Cus_CustomerBase>();
  98. dt = BLL.PagerBLL.GetListPager(
  99. "T_Cus_CustomerBase",
  100. "F_CustomerId",
  101. "*,CONVERT(varchar,F_ModifiedOn, 120 ) as F_ModifiedOnNew "
  102. ,
  103. sql,
  104. "ORDER BY F_CustomerId desc",
  105. limit,
  106. page,
  107. true,
  108. out recordCount);
  109. dataModel.code = 0;
  110. dataModel.count = recordCount;
  111. dataModel.data = dt;
  112. return JsonConvert.SerializeObject(dataModel);
  113. }
  114. [ActionName("GetCustomerModel")]
  115. [HttpGet]
  116. public string GetCustomerModel(int id)
  117. {
  118. if (id == 0)
  119. {
  120. return Error("id不能为空");
  121. }
  122. BLL.T_Cus_CustomerBase busCus_CustomerBase = new BLL.T_Cus_CustomerBase();
  123. Model.T_Cus_CustomerBase model= busCus_CustomerBase.GetModel(id);
  124. int count = 0;
  125. if (model != null)
  126. count = 1;
  127. return Success("成功", model, count);
  128. }
  129. #endregion
  130. #region 客户工单信息
  131. /// <summary>
  132. /// 获取所有工单信息
  133. /// </summary>
  134. /// <returns></returns>
  135. public ActionResult CusOrderList(string callNumber)
  136. {
  137. ViewCusOrderModel cusModel = new ViewCusOrderModel();
  138. cusModel.F_Telephone = callNumber;
  139. cusModel.SeatFlag = F_SeatFlag;
  140. return View(cusModel);
  141. }
  142. /// <summary>
  143. /// 获取工单信息
  144. /// </summary>
  145. /// <param name="page">当前页码</param>
  146. /// <param name="limit">每页数据量</param>
  147. /// <param name="sqlWhere">查询条件</param>
  148. /// <returns></returns>
  149. [ActionName("CusOrderData")]
  150. [HttpGet]
  151. public string CusOrderData(int page, int limit, string cusNumber)
  152. {
  153. //数据结果集
  154. ResponseData dataModel = new ResponseData();
  155. string sql = "";
  156. //客户电话
  157. if (!string.IsNullOrEmpty(cusNumber))
  158. {
  159. sql += " and t.F_CUSTOMERTELEPHONE = '" + cusNumber.Trim() + "'";
  160. }
  161. else
  162. {
  163. sql += " and t.F_CUSTOMERTELEPHONE='-1'";
  164. }
  165. 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);
  166. DataTable dt = new DataTable();
  167. int recordCount = 0;
  168. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  169. dt = BLL.PagerBLL.GetListPager(
  170. tableNew,
  171. "F_WORKORDERID",
  172. " t.*,CONVERT(varchar,t.F_CREATEDATE, 120 ) as F_CREATEDATENew"
  173. + " ,(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",
  174. sql,
  175. "ORDER BY t.F_CREATEDATE desc",
  176. limit,
  177. page,
  178. true,
  179. out recordCount);
  180. dataModel.code = 0;
  181. dataModel.count = recordCount;
  182. dataModel.data = dt;
  183. return JsonConvert.SerializeObject(dataModel);
  184. }
  185. [ActionName("GetCusDatabyNumber")]
  186. [HttpGet]
  187. public string GetCusDatabyNumber( string cusNumber)
  188. {
  189. //数据结果集
  190. ResponseData dataModel = new ResponseData();
  191. // cusBLL.GetCusInfoModel(cusNumber);
  192. return JsonConvert.SerializeObject(cusBLL.GetCusInfoModel(cusNumber));
  193. }
  194. //
  195. /// <summary>
  196. /// 保存编辑客户
  197. /// </summary>
  198. /// <param name="workOrderBaseModel"></param>
  199. /// <returns></returns>
  200. //[AcceptVerbs(HttpVerbs.Post)]
  201. //public bool SaveRepositoryCategoryContentData(T_RepositoryInformation categoryContentModel)
  202. //{
  203. // categoryContentModel.F_CreateBy = F_UserID;
  204. // if (categoryContentModel.F_RepositoryId > 0)
  205. // {
  206. // return reposCategoryContentBLL.Update(categoryContentModel);
  207. // }
  208. // else
  209. // {
  210. // return reposCategoryContentBLL.Add(categoryContentModel) > 0;
  211. // }
  212. //}
  213. #endregion
  214. }
  215. public class ViewCusOrderModel
  216. {
  217. public string F_Telephone
  218. {
  219. get;
  220. set;
  221. }
  222. public bool SeatFlag
  223. {
  224. get;
  225. set;
  226. }
  227. }
  228. }