地铁二期项目正式开始

CustomerController.cs 8.2KB

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