地铁二期项目正式开始

CallRecordController.cs 69KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702
  1. using CallCenter.Utility;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. using YTSoft.BaseCallCenter.Model;
  12. using YTSoft.BaseCallCenter.MVCWeb.Commons;
  13. using YTSoft.BaseCallCenter.MVCWeb.Models;
  14. using YTSoft.Common;
  15. using YTSoft.DBUtility;
  16. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  17. {
  18. public class CallRecordController : BaseController
  19. {
  20. //工单信息
  21. BLL.T_Wo_WorkOrderBase orderBLL = new BLL.T_Wo_WorkOrderBase();
  22. //客户信息
  23. BLL.T_Cus_CustomerBase cusBLL = new BLL.T_Cus_CustomerBase();
  24. //部门表
  25. BLL.T_Sys_Department deptBll = new BLL.T_Sys_Department();
  26. //用户表
  27. BLL.T_Sys_UserAccount userBll = new BLL.T_Sys_UserAccount();
  28. //通话记录
  29. BLL.T_Call_CallRecords recordBLL = new BLL.T_Call_CallRecords();
  30. #region 来电弹屏信息
  31. /// <summary>
  32. /// 来电弹屏页面
  33. /// </summary>
  34. /// <param name="workOrderNum">工单编号</param>
  35. /// <returns></returns>
  36. public ActionResult CallScreen(string workOrderNum)
  37. {
  38. //workOrderNum = "12";
  39. //实例化基础信息表
  40. CallScreenModel callScreenModel = new CallScreenModel();
  41. //获取业务工单信息
  42. if (!string.IsNullOrEmpty(workOrderNum))
  43. {
  44. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  45. if (callScreenModel.WorkOrderBaseModel==null)
  46. {
  47. callScreenModel.WorkOrderBaseModel = new Model.T_Wo_WorkOrderBase()
  48. {
  49. CustomerBaseModel = new T_Cus_CustomerBase { F_CustomerId = 0 },
  50. F_WORKORDERID = 0
  51. };
  52. }
  53. //如果电话号码不为空
  54. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  55. {
  56. //获取客户基本信息
  57. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  58. }
  59. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_KSHADDRESSCODE))
  60. {
  61. Model.T_Call_CallRecords callRecordModel = recordBLL.GetModelByCallId(callScreenModel.WorkOrderBaseModel.F_KSHADDRESSCODE);
  62. if (callRecordModel != null)
  63. {
  64. if (callRecordModel.BusinessType != null)
  65. {
  66. //业务选择按键
  67. callScreenModel.SelectBussType = int.Parse(callRecordModel.BusinessType.ToString());
  68. }
  69. else
  70. {
  71. callScreenModel.SelectBussType =1;
  72. }
  73. }
  74. }
  75. }
  76. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();//业务类型字典表
  77. //获取处理年龄段字典表
  78. callScreenModel.AgeModelList = GetCodeType("NLD");
  79. return View(callScreenModel);
  80. }
  81. /// <summary>
  82. /// 业务工单录入页面
  83. /// </summary>
  84. /// <param name="workOrderNum">工单编号</param>
  85. /// <param name="flowid">业务类型</param>
  86. /// <returns></returns>
  87. public ActionResult CallWorkFolw(string workOrderNum, int? flowid)
  88. {
  89. //实例化基础信息表
  90. CallScreenModel callScreenModel = new CallScreenModel();
  91. //选择的业务类型
  92. if (flowid != null && flowid > 0)
  93. {
  94. callScreenModel.Flowid = flowid;
  95. }
  96. else
  97. {
  98. callScreenModel.Flowid = 0;
  99. }
  100. //获取业务工单信息
  101. if (!string.IsNullOrEmpty(workOrderNum))
  102. {
  103. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  104. if (callScreenModel.WorkOrderBaseModel == null)
  105. {
  106. callScreenModel.WorkOrderBaseModel = new Model.T_Wo_WorkOrderBase()
  107. {
  108. CustomerBaseModel = new T_Cus_CustomerBase { F_CustomerId = 0 },
  109. F_WORKORDERID = 0
  110. };
  111. }
  112. //如果电话号码不为空
  113. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  114. {
  115. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  116. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  117. {
  118. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  119. }
  120. else
  121. {
  122. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  123. }
  124. //选择的业务类型
  125. if (flowid != null && flowid > 0)
  126. {
  127. callScreenModel.BussnessContnet = GetTypeContenet(int.Parse(flowid.ToString()), callScreenModel.WorkOrderBaseModel.F_CREATEDATE.ToString());
  128. }
  129. }
  130. else
  131. {
  132. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  133. }
  134. //获取客户基本信息
  135. }
  136. //业务类型字典表
  137. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  138. //获取处理方式字典表
  139. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  140. //获取处理年龄段字典表
  141. callScreenModel.AgeModelList = GetCodeType("NLD");
  142. //获取部门列表
  143. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  144. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + workOrderNum.ToInt32());
  145. return View(callScreenModel);
  146. }
  147. //历史工单表
  148. BLL.T_Wo_WorkOrderHistory historyBll = new BLL.T_Wo_WorkOrderHistory();
  149. /// <summary>
  150. /// 业务工单录入页面
  151. /// </summary>
  152. /// <param name="workOrderNum">工单编号</param>
  153. /// <param name="flowid">业务类型</param>
  154. /// <returns></returns>
  155. public ActionResult EditCallWorkFolw(string workOrderNum)
  156. {
  157. //实例化基础信息表
  158. CallScreenModel callScreenModel = new CallScreenModel();
  159. //获取业务工单信息
  160. if (!string.IsNullOrEmpty(workOrderNum))
  161. {
  162. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  163. //如果电话号码不为空
  164. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  165. {
  166. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  167. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  168. {
  169. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  170. }
  171. else
  172. {
  173. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  174. }
  175. }
  176. else
  177. {
  178. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  179. }
  180. //获取客户基本信息
  181. if (!string.IsNullOrEmpty( callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  182. {
  183. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1,callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  184. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  185. {
  186. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  187. }
  188. else
  189. {
  190. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  191. }
  192. }
  193. }
  194. //业务类型字典表
  195. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  196. //获取处理方式字典表
  197. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  198. //回访满意度
  199. callScreenModel.MYdModelList = GetCodeType("khyjfl");
  200. //获取处理年龄段字典表
  201. callScreenModel.AgeModelList = GetCodeType("NLD");
  202. //获取部门列表
  203. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  204. return View(callScreenModel);
  205. }
  206. /// <summary>
  207. /// 编辑历史工单
  208. /// </summary>
  209. /// <param name="workOrderBaseModel"></param>
  210. /// <returns></returns>
  211. [AcceptVerbs(HttpVerbs.Post)]
  212. public bool workOrderEditData(T_Wo_WorkOrderBase workOrderBaseModel)
  213. {
  214. //工单来源
  215. //workOrderBaseModel.F_REPAIRMANID = 1;
  216. //workOrderBaseModel.F_WORKORDERFROM = "语音";
  217. if (workOrderBaseModel.CustomerBaseModel != null)
  218. {
  219. //最近联络方式
  220. if (workOrderBaseModel.F_REPAIRMANID.ToString() == "4")
  221. {
  222. workOrderBaseModel.CustomerBaseModel.F_Kind = "3";
  223. workOrderBaseModel.F_CUSTOMERTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  224. }
  225. else
  226. {
  227. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  228. }
  229. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  230. //业务类型
  231. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  232. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  233. //修改客户基础信息
  234. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  235. if (cusid > 0)
  236. {
  237. workOrderBaseModel.F_CUSTOMERID = cusid;
  238. }
  239. }
  240. return orderBLL.UpdateHistoryWorkOrderInfoModel(workOrderBaseModel);
  241. }
  242. /// <summary>
  243. /// 撤回历史工单
  244. /// </summary>
  245. /// <param name="workOrderBaseModel"></param>
  246. /// <returns></returns>
  247. [AcceptVerbs(HttpVerbs.Get)]
  248. public bool ResetWorkOrder(int workOrderId)
  249. {
  250. bool result = false;;
  251. string bycode = F_UserCode;
  252. string byname =F_UserName;
  253. int bmid = F_DeptId;
  254. string bmmc = "";
  255. if (F_UserID > 0) {
  256. YTSoft.BaseCallCenter.BLL.T_Sys_Department depBll = new BLL.T_Sys_Department();
  257. List<Model.T_Sys_Department> list = new List<T_Sys_Department>();
  258. list = depBll.GetModelList("F_DeptId=" + bmid);
  259. if (list.Count>0)
  260. {
  261. bmmc = list[0].F_DeptName.ToString();
  262. result= orderBLL.ResetWorkOrder(workOrderId, F_UserID, F_UserName, F_DeptId, bmmc);
  263. }
  264. }
  265. return result;
  266. }
  267. /// <summary>
  268. /// 获取业务术语模板信息
  269. /// </summary>
  270. /// <param name="bussnessType">业务类型</param>
  271. /// <returns></returns>
  272. public string GetTypeContenet(int bussnessType, string creatDateTime)
  273. {
  274. try
  275. {
  276. //模板内容
  277. string bussContent = "";
  278. if (bussnessType > 0)
  279. {
  280. if (bussnessType > 0)
  281. {
  282. BLL.T_Wo_WorkOrderType bll = new BLL.T_Wo_WorkOrderType();
  283. Model.T_Wo_WorkOrderType orderTypeModel = new T_Wo_WorkOrderType();
  284. orderTypeModel = bll.GetModel(bussnessType);
  285. if (orderTypeModel != null && !string.IsNullOrEmpty(orderTypeModel.F_Remark))
  286. {
  287. bussContent += string.Format(orderTypeModel.F_Remark, DateTime.Parse(creatDateTime).ToString("f") + "分");
  288. }
  289. }
  290. }
  291. return bussContent;
  292. }
  293. catch (Exception ex)
  294. {
  295. }
  296. return null;
  297. }
  298. /// <summary>
  299. /// 保存用户信息
  300. /// </summary>
  301. /// <param name="workOrderBaseModel"></param>
  302. /// <returns></returns>
  303. [AcceptVerbs(HttpVerbs.Post)]
  304. public bool SaveCunInfo(T_Cus_CustomerBase CustomerBaseModel)
  305. {
  306. //客户属性
  307. if (string.IsNullOrEmpty(CustomerBaseModel.F_Kind))
  308. {
  309. CustomerBaseModel.F_Kind = "1";
  310. }
  311. if (string.IsNullOrEmpty(CustomerBaseModel.F_CustomerNature))
  312. {
  313. CustomerBaseModel.F_CustomerNature = "语音";
  314. }
  315. if (CustomerBaseModel.F_CustomerId > 0)
  316. {
  317. AddAction("t_cus_customerbase", CustomerBaseModel.F_CustomerId.ToMyString(), "更新客户信息", CustomerBaseModel.F_CustomerName.ToMyString());
  318. AddAction("t_cus_customerbase", CustomerBaseModel.F_CustomerId.ToMyString(), "更新客户信息", "数据:" + JsonConvert.SerializeObject(CustomerBaseModel), "关键信息");
  319. }
  320. else
  321. {
  322. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase modelcus= cusBLL.GetCusInfoModel(CustomerBaseModel.F_Telephone);
  323. if ( modelcus.F_CustomerId>0)
  324. {
  325. }
  326. AddAction("t_cus_customerbase", CustomerBaseModel.F_Telephone, "添加客户信息", CustomerBaseModel.F_CustomerName.ToMyString());
  327. AddAction("t_cus_customerbase", CustomerBaseModel.F_Telephone, "添加客户信息","数据:"+JsonConvert.SerializeObject(CustomerBaseModel), "关键信息");
  328. }
  329. return cusBLL.UpdateCusInfoModel(CustomerBaseModel);
  330. }
  331. /// <summary>
  332. /// 获取员工信息
  333. /// </summary>
  334. /// <param name="deptId">部门id</param>
  335. /// <returns></returns>
  336. public string GetDeptUsers(string deptId)
  337. {
  338. try
  339. {
  340. return JsonConvert.SerializeObject(userBll.GetModelList("F_DeptId=" + deptId));
  341. }
  342. catch (Exception ex)
  343. {
  344. }
  345. return null;
  346. }
  347. #endregion
  348. #region 微博工单
  349. /// <summary>
  350. /// 微信微博工单录入页面
  351. /// </summary>
  352. /// <param name="workOrderNum">工单编号</param>
  353. /// <param name="flowid">业务类型</param>
  354. /// <returns></returns>
  355. public ActionResult WBWorkFlow(string workOrderNum, int? flowid)
  356. {
  357. workOrderNum = "0"; flowid = 0;
  358. //实例化基础信息表
  359. CallScreenModel callScreenModel = new CallScreenModel();
  360. //选择的业务类型
  361. if (flowid != null && flowid > 0)
  362. {
  363. callScreenModel.Flowid = flowid;
  364. }
  365. else
  366. {
  367. callScreenModel.Flowid = 0;
  368. }
  369. //业务类型字典表
  370. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  371. //获取处理方式字典表
  372. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  373. //获取处理年龄段字典表
  374. callScreenModel.AgeModelList = GetCodeType("NLD");
  375. //获取部门列表
  376. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  377. return View(callScreenModel);
  378. }
  379. /// <summary>
  380. /// 微信编辑
  381. /// </summary>
  382. /// <param name="webChartNum">微信号</param>
  383. /// <param name="recordId">历史记录号</param>
  384. /// <param name="recordId">工单id</param>
  385. /// <returns></returns>
  386. public ActionResult WXWorkFlowEdit(int workOrderNum)
  387. {
  388. //实例化基础信息表
  389. CallScreenModel callScreenModel = new CallScreenModel();
  390. if ( workOrderNum > 0)
  391. {
  392. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(workOrderNum);
  393. //获取业务工单信息
  394. if (!string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  395. {
  396. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1, callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  397. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  398. {
  399. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  400. }
  401. else
  402. {
  403. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  404. }
  405. }
  406. else
  407. {
  408. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  409. }
  410. //业务类型字典表
  411. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  412. //获取处理方式字典表
  413. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  414. //获取处理年龄段字典表
  415. callScreenModel.AgeModelList = GetCodeType("NLD");
  416. //获取部门列表
  417. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  418. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + int.Parse(workOrderNum.ToString()));
  419. return View(callScreenModel);
  420. }
  421. return View();
  422. }
  423. /// <summary>
  424. /// 微博编辑
  425. /// </summary>
  426. /// <param name="webChartNum">微信号</param>
  427. /// <param name="recordId">历史记录号</param>
  428. /// <param name="recordId">工单id</param>
  429. /// <returns></returns>
  430. public ActionResult WBWorkFlowEdit(int workOrderNum)
  431. {
  432. //实例化基础信息表
  433. CallScreenModel callScreenModel = new CallScreenModel();
  434. if (workOrderNum > 0)
  435. {
  436. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(workOrderNum);
  437. //获取业务工单信息
  438. if (!string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  439. {//1微信,2微博
  440. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1, callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  441. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  442. {
  443. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  444. }
  445. else
  446. {
  447. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  448. }
  449. }
  450. else
  451. {
  452. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  453. }
  454. //业务类型字典表
  455. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  456. //获取处理方式字典表
  457. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  458. //获取处理年龄段字典表
  459. callScreenModel.AgeModelList = GetCodeType("NLD");
  460. //获取部门列表
  461. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  462. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + int.Parse(workOrderNum.ToString()));
  463. return View(callScreenModel);
  464. }
  465. return View();
  466. }
  467. #endregion
  468. /// <summary>
  469. /// 补录工单处理信息
  470. /// </summary>
  471. /// <param name="workOrderBaseModel"></param>
  472. /// <returns></returns>
  473. [AcceptVerbs(HttpVerbs.Post)]
  474. public bool workOrderAddData(T_Wo_WorkOrderBase workOrderBaseModel)
  475. {
  476. if (workOrderBaseModel.F_REPAIRMANID == 4)
  477. {
  478. workOrderBaseModel.F_WORKORDERFROM = "微博工单";
  479. string wbh = workOrderBaseModel.CustomerBaseModel.F_CustomerEName.ToMyString().Trim();
  480. if (!string.IsNullOrEmpty(wbh))
  481. {
  482. workOrderBaseModel.F_EMPCODE = wbh;
  483. workOrderBaseModel.CustomerBaseModel.F_PostCode = wbh;
  484. }
  485. ////客户等级
  486. workOrderBaseModel.CustomerBaseModel.F_ScaleResume = "1";
  487. workOrderBaseModel.CustomerBaseModel.F_CustomerClass = "一般客户";
  488. }
  489. workOrderBaseModel.F_USERID = F_UserID;//id
  490. workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
  491. workOrderBaseModel.F_REPAIRMANNAME = F_UserName;//姓名
  492. workOrderBaseModel.F_LINKMANTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  493. workOrderBaseModel.F_USERNAME = F_UserName;
  494. workOrderBaseModel.F_DEPTID = F_DeptId;
  495. T_Sys_Department deptmodel = deptBll.GetModel(F_DeptId);
  496. if (deptmodel != null)
  497. {
  498. workOrderBaseModel.F_DEPTCODE = deptmodel.F_DeptName;
  499. }
  500. AddAction("T_Wo_WorkOrderBase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "录入工单", "数据:"+JsonConvert.SerializeObject(workOrderBaseModel), "关键信息");
  501. if (workOrderBaseModel.F_CONTENT == null)
  502. {
  503. workOrderBaseModel.F_CONTENT = "-";
  504. }
  505. if (workOrderBaseModel.F_RETURNVISITCONTENT == null)
  506. {
  507. workOrderBaseModel.F_RETURNVISITCONTENT = "-";
  508. }
  509. if (workOrderBaseModel.CustomerBaseModel != null)
  510. {
  511. //最近联络方式
  512. if (workOrderBaseModel.F_REPAIRMANID == 4)
  513. {
  514. workOrderBaseModel.CustomerBaseModel.F_Kind = "3";
  515. }
  516. else
  517. {
  518. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  519. }
  520. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  521. //业务类型
  522. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  523. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  524. //修改客户基础信息
  525. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  526. if (cusid > 1)
  527. {
  528. workOrderBaseModel.F_CUSTOMERID = cusid;
  529. }
  530. }
  531. if (workOrderBaseModel.F_WORKORDERSTATEID > 0)
  532. {
  533. workOrderBaseModel.F_CODE= orderBLL.GetOrderNumber(workOrderBaseModel.F_REPAIRLEVEL.ToInt32());
  534. if (workOrderBaseModel.F_HOUSING == "表扬" || workOrderBaseModel.F_HOUSING == "咨询" || workOrderBaseModel.F_HOUSING == "挂失")
  535. {
  536. workOrderBaseModel.F_WORKORDERTYPEID = 3;
  537. if (workOrderBaseModel.HistoryOrderList != null && workOrderBaseModel.HistoryOrderList.Count > 0)
  538. {
  539. Dictionary<int, string> dict = new Dictionary<int, string>() { };
  540. for (int i = workOrderBaseModel.HistoryOrderList.Count - 1; i >= 0; i--)
  541. {
  542. T_Wo_WorkOrderHistory modelhis = workOrderBaseModel.HistoryOrderList[i];
  543. Model.T_Sys_Department model = new BLL.T_Sys_Department().GetModel(string.Format("F_DeptId=(select top 1 F_DeptId from T_Sys_UserAccount where F_UserId={0})", modelhis.F_OPTUSERID));
  544. if (model != null && model.F_DeptId > 0)
  545. {
  546. if (dict.ContainsKey(model.F_DeptId))
  547. {
  548. workOrderBaseModel.HistoryOrderList.Remove(workOrderBaseModel.HistoryOrderList[i]);
  549. continue;
  550. }
  551. modelhis.F_OPTBTNID = model.F_DeptId;
  552. modelhis.F_NEXTOWNERARRID = model.F_DeptName;
  553. dict.Add(model.F_DeptId, "1");
  554. }
  555. }
  556. }
  557. }
  558. else if (workOrderBaseModel.F_WORKORDERTYPEID == 3)
  559. {
  560. Model.T_Wo_WorkOrderHistory historyModel = new Model.T_Wo_WorkOrderHistory();
  561. historyModel.F_INSTANCEID = workOrderBaseModel.F_WORKORDERID;
  562. historyModel.F_OPTDATE = DateTime.Now;
  563. historyModel.ReplayTime = DateTime.Now;
  564. historyModel.F_WORKORDERSTATEID = 1;
  565. historyModel.F_StateName = "已处理";
  566. historyModel.NeedReplayTime = workOrderBaseModel.F_REQUESTSERVICETIME;
  567. historyModel.F_OPTUSERID = F_UserID;
  568. historyModel.F_OPTBTNID = F_DeptId;
  569. historyModel.F_UserName = F_UserName;
  570. historyModel.F_REMARK = workOrderBaseModel.F_RETURNVISITCONTENT;
  571. historyModel.F_NEXTOWNERARRID = "计划经营部";
  572. workOrderBaseModel.HistoryOrderList = new List<T_Wo_WorkOrderHistory>();
  573. workOrderBaseModel.HistoryOrderList.Add(historyModel);
  574. }
  575. else
  576. {
  577. if (workOrderBaseModel.HistoryOrderList != null && workOrderBaseModel.HistoryOrderList.Count > 0)
  578. {
  579. Dictionary<int, string> dict = new Dictionary<int, string>() { };
  580. for (int i= workOrderBaseModel.HistoryOrderList.Count-1; i>=0;i--)
  581. {
  582. T_Wo_WorkOrderHistory modelhis = workOrderBaseModel.HistoryOrderList[i];
  583. if (dict.ContainsKey(modelhis.F_OPTUSERID.ToInt32()))
  584. {
  585. workOrderBaseModel.HistoryOrderList.Remove(workOrderBaseModel.HistoryOrderList[i]);
  586. continue;
  587. }
  588. new BLL.T_Com_Class().UpdateRate(F_UserCode, modelhis.F_OPTUSERID.ToInt32());
  589. Model.T_Sys_Department model= new BLL.T_Sys_Department().GetModel(string.Format("F_DeptId=(select top 1 F_DeptId from T_Sys_UserAccount where F_UserId={0})", modelhis.F_OPTUSERID));
  590. if (model != null && model.F_DeptId > 0)
  591. {
  592. modelhis.F_OPTBTNID = model.F_DeptId;
  593. modelhis.F_NEXTOWNERARRID = model.F_DeptName;
  594. }
  595. dict.Add(modelhis.F_OPTUSERID.ToInt32(), "1");
  596. }
  597. }
  598. }
  599. if (workOrderBaseModel.F_WORKORDERTYPEID == 1)
  600. {
  601. AddAction("t_wo_workorderbase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "转单处理工单", workOrderBaseModel.F_CODE);
  602. }
  603. else
  604. {
  605. AddAction("t_wo_workorderbase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "即时处理工单", workOrderBaseModel.F_CODE);
  606. }
  607. }
  608. else
  609. { workOrderBaseModel.F_CODE = ""; }
  610. if (workOrderBaseModel.F_WORKORDERID == 0&& workOrderBaseModel.F_REPAIRMANID == 4)
  611. {
  612. workOrderBaseModel.F_CREATEDATE = DateTime.Now;
  613. workOrderBaseModel.F_HASTENCOUNTS = 0;
  614. int workid = orderBLL.AddWbgd(workOrderBaseModel);
  615. if (workid==0)
  616. {
  617. return false;
  618. }
  619. workOrderBaseModel.F_WORKORDERID = workid;
  620. }
  621. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  622. }
  623. /// <summary>
  624. /// 来电弹屏处理工单
  625. /// </summary>
  626. /// <param name="workOrderBaseModel"></param>
  627. /// <returns></returns>
  628. [AcceptVerbs(HttpVerbs.Post)]
  629. public bool workOrderAddDatanew(T_Wo_WorkOrderBase workOrderBaseModel)
  630. {
  631. bool bl = false;
  632. try
  633. {
  634. //工单来源
  635. workOrderBaseModel.F_REPAIRMANID = 4;
  636. workOrderBaseModel.F_WORKORDERFROM = "微博工单";
  637. string wbh = workOrderBaseModel.CustomerBaseModel.F_CustomerEName.Trim();
  638. if (!string.IsNullOrEmpty(wbh))
  639. {
  640. workOrderBaseModel.F_EMPCODE = wbh;
  641. workOrderBaseModel.CustomerBaseModel.F_PostCode = wbh;
  642. }
  643. //当前用户信息
  644. workOrderBaseModel.F_USERID = F_UserID;//id
  645. workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
  646. workOrderBaseModel.F_REPAIRMANNAME = F_UserName;//姓名
  647. workOrderBaseModel.F_LINKMANTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  648. if (F_UserID > 0)
  649. {
  650. T_Sys_UserAccount usermodel = new T_Sys_UserAccount();
  651. usermodel = userBll.GetModel(F_UserID);
  652. workOrderBaseModel.F_REPAIRMANNAME = usermodel.F_UserName;//姓名
  653. }
  654. if (workOrderBaseModel.CustomerBaseModel != null)
  655. {
  656. //最近联络方式
  657. if (workOrderBaseModel.F_REPAIRMANID.ToString() == "4")
  658. { workOrderBaseModel.CustomerBaseModel.F_Kind = "3"; }
  659. else
  660. {
  661. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  662. }
  663. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  664. //业务类型
  665. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  666. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  667. workOrderBaseModel.CustomerBaseModel.F_CustomerId = Convert.ToInt32(workOrderBaseModel.F_CUSTOMERID);
  668. ////客户等级
  669. workOrderBaseModel.CustomerBaseModel.F_ScaleResume = "1";
  670. workOrderBaseModel.CustomerBaseModel.F_CustomerClass = "一般客户";
  671. //保存工单基础信息
  672. //修改客户基础信息
  673. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  674. if (cusid > 0)
  675. {
  676. workOrderBaseModel.F_CUSTOMERID = cusid;
  677. }
  678. }
  679. if (workOrderBaseModel.F_WORKORDERID == 0)
  680. {
  681. workOrderBaseModel.F_CREATEDATE = DateTime.Now;
  682. workOrderBaseModel.F_HASTENCOUNTS = 0;
  683. bl = orderBLL.AddWbgd(workOrderBaseModel)>0;
  684. }
  685. else
  686. {
  687. try
  688. {
  689. YTSoft.BaseCallCenter.Model.T_Wo_WorkOrderBase m = new YTSoft.BaseCallCenter.BLL.T_Wo_WorkOrderBase().GetModel(workOrderBaseModel.F_WORKORDERID);
  690. workOrderBaseModel.F_LINKMANTELEPHONE = m.F_LINKMANTELEPHONE;
  691. workOrderBaseModel.F_CUSTOMERTELEPHONE = m.F_CUSTOMERTELEPHONE;
  692. workOrderBaseModel.F_NUMBER = m.F_CODE;
  693. }
  694. catch
  695. { }
  696. if (workOrderBaseModel.F_SERVICETYPE == "待处理")
  697. {
  698. workOrderBaseModel.F_WORKORDERNAME = "手工工单";
  699. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  700. }
  701. else
  702. {
  703. workOrderBaseModel.F_WORKORDERNAME = "手工工单";
  704. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  705. }
  706. }
  707. }
  708. catch (Exception ex) { }
  709. return bl;
  710. }
  711. /// <summary>
  712. /// 初始化列表
  713. /// </summary>
  714. /// <returns></returns>
  715. public ActionResult CallRecordList()
  716. {
  717. WorkOrderMyModel model = new WorkOrderMyModel();
  718. return View(model);
  719. }
  720. /// <summary>
  721. /// 听取录音
  722. /// </summary>
  723. /// <returns></returns>
  724. public ActionResult VoicePlay(string type, string callid)
  725. {
  726. Models.VoicePlayModel model = new VoicePlayModel();
  727. model.playpath = type;
  728. AddAction("VoicePlay", callid, "听录音", string.Format("听了callid={0}的录音", callid), "敏感信息");
  729. if (!string.IsNullOrEmpty(callid))
  730. {
  731. if (callid.Contains("http://"))
  732. {
  733. model.downpath = callid;
  734. }
  735. else
  736. {
  737. BLL.rec_file_info busFile = new BLL.rec_file_info();
  738. if (type == "0")
  739. {
  740. //录音
  741. Model.rec_file_info modelfile= busFile.GetModel(callid);
  742. if (modelfile != null)
  743. {
  744. if (modelfile.FileName.Length > 10)
  745. {
  746. model.downpath = string.Format("{0}/oldyuyin/{1}", "http://10.200.46.21:8020", modelfile.FileName);
  747. }
  748. }
  749. }
  750. else if (type == "1")
  751. {
  752. //留言
  753. model.downpath = string.Format("{0}/oldliuyan/{1}", "http://10.200.46.21:8020", callid);// GetSysconfig("newPlayPath")
  754. }
  755. } }
  756. return View(model);
  757. }
  758. public ActionResult VoicePlay1(string type, string callid)
  759. {
  760. VoicePlayModel voicePlayModel = new VoicePlayModel();
  761. voicePlayModel.playpath = "";
  762. voicePlayModel.downpath = "";
  763. try
  764. {
  765. voicePlayModel.playpath = this.GetSrc(type, callid);
  766. voicePlayModel.downpath = !(type == "0") ? voicePlayModel.playpath.Replace("playvoicemail", "downvoicemail") : voicePlayModel.playpath.Replace("playbyappid", "downbyappid");
  767. if (!string.IsNullOrEmpty(voicePlayModel.playpath))
  768. {
  769. StringBuilder stringBuilder = new StringBuilder();
  770. string str = HttpHelper.HttpPost(voicePlayModel.playpath, (object)null);
  771. voicePlayModel.playpath = str;
  772. }
  773. }
  774. catch
  775. {
  776. }
  777. AddAction("VoicePlay1", callid, "听录音", string.Format("听了callid={0}的录音", callid), "敏感信息");
  778. return (ActionResult)this.View((object)voicePlayModel);
  779. }
  780. public string GetSrc(string type, string callid)
  781. {
  782. string s = "";
  783. BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  784. try
  785. {
  786. string valueByParamCode = bll_T_Sys_SystemConfig.GetParamValueByParamCode(!(type == "0") ? "PlayLeaveVoice" : "PlayPath");
  787. string str = callid;
  788. s = str.IndexOf(":") >= 0 ? str.Replace("D:", valueByParamCode) : valueByParamCode + str;
  789. s = HttpUtility.HtmlEncode(s);
  790. }
  791. catch
  792. {
  793. }
  794. return s;
  795. }
  796. //public string GetSrc(string type, string callid)
  797. //{
  798. // string res = "";
  799. // try
  800. // {
  801. // string para = "PlayPath";
  802. // if (type == "0")
  803. // {
  804. // para = "PlayPath";
  805. // }
  806. // else
  807. // {
  808. // para = "PlayLeaveVoice";
  809. // }
  810. // BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  811. // string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode(para);//CTIIP
  812. // string path = callid;
  813. // if (path.IndexOf(":") < 0)
  814. // {
  815. // res = CTIserverIP + path;
  816. // }
  817. // else
  818. // {
  819. // res = path.Replace("D:", CTIserverIP);
  820. // }
  821. // res = HttpUtility.HtmlEncode(res);
  822. // }
  823. // catch
  824. // {
  825. // }
  826. // return res;
  827. //}
  828. /// <summary>
  829. /// 留言管理
  830. /// </summary>
  831. /// <returns></returns>
  832. public ActionResult CallLeaveList()
  833. {
  834. string userid = "0";
  835. YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
  836. try
  837. {
  838. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  839. {
  840. userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
  841. }
  842. int u = Convert.ToInt32(userid);
  843. }
  844. catch
  845. { }
  846. if (userid != "0")
  847. {
  848. p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
  849. if (p_LoginUser != null)
  850. {
  851. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  852. {
  853. p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
  854. }
  855. }
  856. }
  857. else
  858. {
  859. Response.Redirect("/Default/Login");
  860. }
  861. return View(p_LoginUser);
  862. }
  863. /// <summary>
  864. /// 坐席监控
  865. /// </summary>
  866. /// <returns></returns>
  867. public ActionResult SeatMonitoringList()
  868. {
  869. return View();
  870. }
  871. /// <summary>
  872. /// 获取通话记录
  873. /// </summary>
  874. /// <param name="page">当前页码</param>
  875. /// <param name="limit">每页数据量</param>
  876. /// <param name="sqlWhere">查询条件</param>
  877. /// <returns></returns>
  878. [ActionName("CallRecordData")]
  879. [HttpGet]
  880. public string CallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType,
  881. string callStatus, string dateParty,
  882. int F_WORKORDERTYPEID=0,string F_CONTENT="", string F_HOUSING="", string callid="0",string sort="",int ringtimes=0)
  883. {
  884. AddAction("T_Call_CallRecords", callid.ToMyString(), "获取通话记录列表", string.Format("获取{0}通话记录列表", dateParty), "敏感信息");
  885. //数据结果集
  886. ResponseData dataModel = new ResponseData();
  887. string sql = "";
  888. if (callid!="0"&&!string.IsNullOrEmpty(callid))
  889. {
  890. sql += string.Format(" and callid='{0}'", callid);
  891. }
  892. if (ringtimes > 0)
  893. {
  894. sql += string.Format(" and RingLongTime>{0}", ringtimes);
  895. }
  896. if (!string.IsNullOrEmpty(dateParty))
  897. {
  898. string startDate = dateParty.Substring(0, 10);
  899. string endDate = dateParty.Substring(12);
  900. sql += " and BeginTime>= '" + startDate + " 00:00:00" + "'";
  901. sql += " and BeginTime<= '" + endDate + " 23:59:59" + "'";
  902. }
  903. else
  904. {
  905. sql += " and BeginTime>= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00" + "'";
  906. sql += " and BeginTime<= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59" + "'";
  907. }
  908. if (!string.IsNullOrEmpty(callnumber))
  909. {
  910. sql += " and CallNumber like '%" + callnumber.Trim() + "%'";
  911. }
  912. if (!string.IsNullOrEmpty(usercode))
  913. {
  914. sql += " and UserCode like '%" + usercode.Trim() + "%'";
  915. }
  916. //呼叫类型,0呼入1呼出
  917. if (!string.IsNullOrEmpty(callType))
  918. {
  919. sql += " and CallType =" + callType;
  920. }
  921. //呼叫状态,0:未接通电话1已接通电话
  922. if (!string.IsNullOrEmpty(callStatus))
  923. {
  924. sql += " and CallState =" + callStatus;
  925. }
  926. //工单类型 F_HOUSING select F_WORKORDERTYPEID,F_CONTENT,F_HOUSING from T_Wo_WorkOrderBase where 1=1 and F_CONTENT like '%'++'%'
  927. //工单类型
  928. if (!string.IsNullOrEmpty(F_HOUSING))
  929. {
  930. //sql += string.Format(" AND F_WorkOrderTypeId IS NOT null and T2.F_HOUSING='{0}'", F_HOUSING);
  931. string F_HOUSINGint = "0";
  932. switch (F_HOUSING)
  933. {
  934. case "咨询":
  935. F_HOUSINGint = "1";
  936. break;
  937. case "投诉":
  938. F_HOUSINGint = "2";
  939. break;
  940. case "建议":
  941. F_HOUSINGint = "3";
  942. break;
  943. case "表扬":
  944. F_HOUSINGint = "4";
  945. break;
  946. case "挂失":
  947. F_HOUSINGint = "5";
  948. break;
  949. }
  950. sql += string.Format("AND F_ServiceType={0} ", F_HOUSINGint);
  951. }
  952. //呼叫状态,0:未接通电话1已接通电话
  953. if (!string.IsNullOrEmpty(callStatus))
  954. {
  955. sql += " and CallState =" + callStatus;
  956. }
  957. DataTable dt = new DataTable();
  958. int recordCount = 0;
  959. //BLL.T_Call_CallRecords busCall_CallRecords = new BLL.T_Call_CallRecords();
  960. //busCall_CallRecords.GetListByPage();
  961. Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
  962. // dt = BLL.PagerBLL.GetTableList(
  963. // " (T_Call_CallRecords T1 LEFT JOIN T_Wo_WorkOrderBase T2 ON T1.CallId=T2.F_KSHADDRESSCODE ) ",
  964. // "CallRecordsId",
  965. // "T1.*,F_WORKORDERID,F_HOUSING,CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew"
  966. // + @",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where
  967. //CallNumber=F_Telephone) as F_ScaleResume,
  968. //replace(replace(FilePath,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')" +
  969. //@" as fileurl,case
  970. // when BusinessType=1 then '咨询'
  971. // when BusinessType=2 then '建议'
  972. // when BusinessType=3 then '表扬'
  973. // when BusinessType=4 then '挂失'
  974. // when BusinessType=9 then '投诉'
  975. // when T1.F_ServiceType=1 then '咨询'
  976. // when T1.F_ServiceType = 2 then '投诉'
  977. // when T1.F_ServiceType = 3 then '建议'
  978. // when T1.F_ServiceType = 4 then '表扬'
  979. // when T1.F_ServiceType = 5 then '挂失'
  980. // else '' end as
  981. //BType, case when (isnull(BusinessType,0)>0 or isnull(T1.F_ServiceType,0)>0) then '人工服务' else '' end as ywtype ",
  982. // sql,
  983. // // "ORDER BY LongTime,CallRecordsId desc",
  984. // string.IsNullOrEmpty(sort) ? " BeginTime desc": sort + " desc"
  985. // ,
  986. // limit,
  987. // page,
  988. // out recordCount);
  989. dt = BLL.PagerBLL.GetListPager(
  990. " T_Call_CallRecords ",
  991. "CallRecordsId",
  992. "*," +
  993. "(select top 1 F_WORKORDERID from T_Wo_WorkOrderBase where F_KSHADDRESSCODE=CallId) as F_WORKORDERID," +
  994. "CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew"
  995. + @",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where
  996. CallNumber=F_Telephone) as F_ScaleResume,
  997. replace(replace(FilePath,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')" +
  998. @" as fileurl,case
  999. when BusinessType=1 then '咨询'
  1000. when BusinessType=2 then '建议'
  1001. when BusinessType=3 then '表扬'
  1002. when BusinessType=4 then '挂失'
  1003. when BusinessType=9 then '投诉'
  1004. when F_ServiceType=1 then '咨询'
  1005. when F_ServiceType = 2 then '投诉'
  1006. when F_ServiceType = 3 then '建议'
  1007. when F_ServiceType = 4 then '表扬'
  1008. when F_ServiceType = 5 then '挂失'
  1009. else '' end as
  1010. BType, case when (isnull(BusinessType,0)>0 or isnull(F_ServiceType,0)>0) then '人工服务' else '' end as ywtype ",
  1011. sql,
  1012. // "ORDER BY LongTime,CallRecordsId desc",
  1013. string.IsNullOrEmpty(sort) ? "ORDER BY BeginTime desc" : "ORDER BY "+ sort + " desc"
  1014. ,
  1015. limit,
  1016. page,
  1017. true,
  1018. out recordCount);
  1019. dataModel.code = 0;
  1020. dataModel.count = recordCount;
  1021. dataModel.data = dt;
  1022. string json = JsonConvert.SerializeObject(dataModel);
  1023. return json;
  1024. }
  1025. /// <summary>
  1026. /// 获取留言记录
  1027. /// </summary>
  1028. /// <param name="page">当前页码</param>
  1029. /// <param name="limit">每页数据量</param>
  1030. /// <param name="sqlWhere">查询条件</param>
  1031. /// <returns></returns>
  1032. [ActionName("LeaveRecordData")]
  1033. [HttpGet]
  1034. public string LeaveRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string leavedate, string status)
  1035. {
  1036. AddAction("T_Call_LeaveRecord", status, "获取通话记录列表", string.Format("获取{0}留言记录列表", leavedate), "敏感信息");
  1037. //数据结果集
  1038. ResponseData dataModel = new ResponseData();
  1039. string sql = "";
  1040. if (!string.IsNullOrEmpty(callnumber))
  1041. {
  1042. sql += " and F_Phone like '%" + callnumber.Trim() + "%'";
  1043. }
  1044. //if (!string.IsNullOrEmpty(leavedate))
  1045. //{
  1046. // sql += " and datediff(day,'" + leavedate + "',F_LeaveTime)=0 ";
  1047. //}
  1048. string startDate = "";
  1049. string endDate = "";
  1050. if (!string.IsNullOrEmpty(leavedate))
  1051. {
  1052. startDate = leavedate.Substring(0, 10);
  1053. endDate = leavedate.Substring(12);
  1054. sql += " and F_LeaveTime>= '" + startDate + " 00:00:00" + "'";
  1055. sql += " and F_LeaveTime<= '" + endDate + " 23:59:59" + "'";
  1056. }
  1057. else {
  1058. startDate = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd");
  1059. endDate = DateTime.Now.ToString("yyyy-MM-dd");
  1060. sql += " and F_LeaveTime>= '" + startDate + " 00:00:00" + "'";
  1061. sql += " and F_LeaveTime<= '" + endDate + " 23:59:59" + "'";
  1062. }
  1063. if (!string.IsNullOrEmpty(status))
  1064. {
  1065. sql += " and F_Status=" + status + " ";
  1066. }
  1067. DataTable dt = new DataTable();
  1068. int recordCount = 0;
  1069. dt = BLL.PagerBLL.GetListPager(
  1070. "T_Call_LeaveRecord",
  1071. "F_Id",
  1072. "*,CONVERT(varchar,F_LeaveTime, 120 ) as F_LeaveTimeNew,CONVERT(varchar,F_DealTime, 120 ) as F_DealTimeNew"
  1073. + ",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where F_Phone=F_Telephone) as F_ScaleResume ," +
  1074. @"replace(replace(F_RecFileUrl, '\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "') as TheLuyin",
  1075. sql,
  1076. "ORDER BY F_Id desc",
  1077. limit,
  1078. page,
  1079. true,
  1080. out recordCount);
  1081. dataModel.code = 0;
  1082. dataModel.count = recordCount;
  1083. dataModel.data = dt;
  1084. string json = JsonConvert.SerializeObject(dataModel);
  1085. return json;
  1086. }
  1087. /// <summary>
  1088. /// 留言创建工单处理
  1089. /// </summary>
  1090. /// <param name="LeaveOptAjax"></param>
  1091. /// <returns></returns>
  1092. [ActionName("LeaveOptAjax")]
  1093. [HttpGet]
  1094. public string LeaveOptAjax(string optaction, string timeno, string callid, string userid, string usercode, string username, string extnumber, string callernum, string leaveid)
  1095. {
  1096. //&timeno=" + timeno+"&callid=" + callID + "&userid=" + userid + "&usercode=" + usercode
  1097. //+ "&username=" + username + "&extnumber" + extnumber + "&callernum=" + callerNum
  1098. string res = "error";
  1099. try
  1100. {
  1101. switch (optaction)
  1102. {
  1103. case "leaveAddOrderEvent":
  1104. //振铃事件
  1105. res = leaveAddOrderEvent(callid, userid, usercode, username, extnumber, callernum, leaveid);
  1106. break;
  1107. }
  1108. }
  1109. catch
  1110. { }
  1111. return res;
  1112. }
  1113. #region 来电归属地查询
  1114. public string GetPhoneLocation(string phoneNumber, bool isPhone)
  1115. {
  1116. string location = "未知";
  1117. try
  1118. {
  1119. //如果是手机号码
  1120. if (isPhone)
  1121. {
  1122. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  1123. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phoneNumber.Substring(0, 7));
  1124. return mobileModel != null ? (mobileModel.F_CityDes + mobileModel.F_CardDes) : location;
  1125. }
  1126. else//如果是电话号码
  1127. {
  1128. BLL.T_Sys_TelTitleData numbBll = new BLL.T_Sys_TelTitleData();
  1129. List<Model.T_Sys_TelTitleData> mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 4) + "'");
  1130. if (mobileModel == null || mobileModel.Count <= 0)
  1131. mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 3) + "'");
  1132. return mobileModel.Count > 0 ? mobileModel[0].F_TitleName : location;
  1133. }
  1134. }
  1135. catch (System.Exception ex)
  1136. {
  1137. return location;
  1138. }
  1139. }
  1140. #endregion
  1141. #region 自动添加工单
  1142. public bool SubmitOSubmit(string phone, string recordid, string callid, string locationaddress, string userid, string username, string usercode, out int workorderid)
  1143. {
  1144. bool bl = false;
  1145. workorderid = 0;
  1146. try
  1147. {
  1148. Model.T_Wo_WorkOrderBase model = new Model.T_Wo_WorkOrderBase();
  1149. #region 工单信息
  1150. //model.F_WORKORDERTYPEID = Convert.ToInt32(typeid);//类型ID
  1151. model.F_WORKORDERSTATEID = 0;//状态ID
  1152. model.F_REPAIRREQUEST = "未处理";
  1153. model.F_CODE = "";//工单编号
  1154. model.F_WORKORDERNAME = "";//工单名称
  1155. model.F_NUMBER = model.F_CODE;
  1156. //model.F_CUSTOMERNAME = txtCustomerName.Text.Trim();//客户姓名
  1157. model.F_CUSTOMERTELEPHONE = phone.Trim();//客户电话
  1158. model.F_USERID = Convert.ToInt32(userid);//坐席id
  1159. model.F_LINKMAN = usercode.Trim();//坐席工号
  1160. model.F_REPAIRMANNAME = username.Trim();//坐席名称
  1161. model.F_LINKMANTELEPHONE = phone.Trim();//联系人电话
  1162. //model.F_ADSLACCOUNT = hfCallId.Value.Trim();
  1163. model.F_BANDWIDTH = "";
  1164. model.F_STANDARDADDRESS = locationaddress.Trim();
  1165. //model.F_INSTALLADDRESS = F_INSTALLADDRESS;
  1166. model.F_KSHADDRESSCODE = callid;
  1167. model.F_RANGEID = Convert.ToInt32(recordid);
  1168. model.F_PROVINCE = "";
  1169. model.F_CITY = "";
  1170. model.F_AREA = "";
  1171. model.F_ROAD = "";
  1172. model.F_HOUSING = "";
  1173. model.F_REPAIRMANID = 2;
  1174. model.F_WORKORDERFROM = "留言工单";
  1175. //model.F_WORKORDERLEVELID = F_WORKORDERLEVELID;
  1176. model.F_FILEFLAG = 0;
  1177. model.F_CREATEBY = Convert.ToInt32(userid.Trim());
  1178. model.F_CREATEDATE = DateTime.Now;
  1179. model.F_RETURNVISITFLAG = 0;
  1180. model.F_RETURNVISITSTATE = 0;
  1181. model.F_RETURNVISITRESULT = 0;
  1182. model.F_RETURNVISITCONTENT = "";
  1183. model.F_DELETEFLAG = 0;
  1184. model.F_ALLUSETIMES = 0;
  1185. model.F_STARTTIME = DateTime.Now;
  1186. model.F_OVERTIMES = 0;
  1187. model.F_FORMID = 0;
  1188. model.F_HASTENCOUNTS = 0;
  1189. model.F_RANGEX = 0;
  1190. model.F_RANGEY = 0;
  1191. model.F_REPAIRCLOSEMANID = 0;
  1192. model.F_REPAIRCLOSEMANNAME = "";
  1193. model.F_REPAIRCLOSEREASONS = "";
  1194. model.F_REPAIRCLOSEREPTID = 0;
  1195. model.F_REPAIRCLOSEREPT = "";
  1196. #endregion
  1197. int resorderbase = new BLL.T_Wo_WorkOrderBase().Add(model);//添加基本信息
  1198. workorderid = resorderbase;
  1199. if (resorderbase > 0)
  1200. {
  1201. bl = true;
  1202. }
  1203. else
  1204. {
  1205. bl = false;
  1206. }
  1207. }
  1208. catch (Exception ex)
  1209. {
  1210. }
  1211. return bl;
  1212. }
  1213. #endregion
  1214. #region 处理留言创建工单事件
  1215. public string leaveAddOrderEvent(string callid, string userid, string usercode, string username, string extnumber, string callernum, string leaveid)
  1216. {
  1217. string res = "error";
  1218. try
  1219. {
  1220. AddAction("leaveAddOrderEvent", callid, "创建留言工单", string.Format("{0}创建callid={1}留言工单{2}", username, callid, leaveid), "关键信息");
  1221. Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  1222. if (vmodel != null)
  1223. {
  1224. string phone = callernum;
  1225. #region 来电归属地查询
  1226. string location = "";
  1227. //来电归属地查询
  1228. if (phone.Trim().Length == 11 && phone.Substring(0, 1) != "0")
  1229. {
  1230. location = GetPhoneLocation(phone, true);
  1231. }
  1232. else
  1233. {
  1234. location = GetPhoneLocation(phone, false);
  1235. }
  1236. #endregion
  1237. #region 创建工单
  1238. int workorderid = 0;
  1239. bool wobl = SubmitOSubmit(phone, vmodel.CallRecordsId.ToString(), callid, location, userid, username, usercode, out workorderid);
  1240. if (wobl)
  1241. {
  1242. //处理留言
  1243. #region 处理留言
  1244. Model.T_Call_LeaveRecord leavemodel = new BLL.T_Call_LeaveRecord().GetModel(Convert.ToInt32(leaveid));
  1245. if (leavemodel != null)
  1246. {
  1247. //leavemodel.F_CallAppId = workorderid.ToString();
  1248. //leavemodel.F_Status = 1;
  1249. //leavemodel.F_UserId = Convert.ToInt32(userid);
  1250. //leavemodel.F_UserName = username;
  1251. //leavemodel.F_UserCode = usercode;
  1252. //leavemodel.F_DealTime = DateTime.Now;
  1253. //leavemodel.F_DealContent = "留言创建工单";
  1254. //new BLL.T_Call_LeaveRecord().Update(leavemodel);
  1255. string strSql = @"
  1256. update T_Call_LeaveRecord set
  1257. F_CallAppId = " + workorderid.ToString() + @",F_Status = 1,
  1258. F_UserId = " + Convert.ToInt32(userid) + @",F_UserName = '" + username + @"',F_UserCode = '" + usercode + @"',F_DealTime = '" + DateTime.Now + @"',
  1259. F_DealContent = '留言创建工单' where F_Id = " + leavemodel.F_Id;
  1260. int rows = DbHelperSQL.ExecuteSql(strSql);
  1261. }
  1262. #endregion
  1263. try
  1264. {
  1265. Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  1266. modelorder.CallId = callid;
  1267. modelorder.F_WORKORDERID = workorderid;
  1268. modelorder.F_WORKORDERSTATEID = 0;
  1269. new BLL.T_Call_WorkOrder().Add(modelorder);
  1270. }
  1271. catch { }
  1272. res = workorderid.ToString();
  1273. }
  1274. #endregion
  1275. }
  1276. }
  1277. catch (Exception ex)
  1278. {
  1279. //res = ex.ToString();
  1280. }
  1281. return res;
  1282. }
  1283. #endregion
  1284. /// <summary>
  1285. /// 获取坐席监控坐席列表
  1286. /// </summary>
  1287. /// <returns></returns>
  1288. [ActionName("getseatnewlist")]
  1289. [HttpGet]
  1290. public string getseatnewlist()
  1291. {
  1292. string strHtml = "";
  1293. string strList = "";
  1294. DataTable dt = new DataTable();
  1295. try
  1296. {
  1297. AddAction("T_Sys_UserAccount", "0", "获取坐席监控列表", "", "关键信息");
  1298. BLL.T_Sys_UserAccount bll = new BLL.T_Sys_UserAccount();
  1299. dt = bll.GetList(" f_seatflag=1 order by f_userid desc ").Tables[0];
  1300. if (dt.Rows.Count > 0)
  1301. {
  1302. for (int i = 0; i < dt.Rows.Count; i++)
  1303. {
  1304. strList += dt.Rows[i]["F_WorkNumber"] + ",";// "-" + dt.Rows[i]["ExtensionCode"] + ",";
  1305. strHtml += "<div id=\"div_" + dt.Rows[i]["F_WorkNumber"] + "\" style='float: left; width: 120px; height: 120px; text-align: center; padding: 8px;cursor:pointer'>";
  1306. strHtml += "<div style='height: 90px; border: 1px solid #CCCCCC; padding: 3px; text-align: center;cursor:pointer'";
  1307. strHtml += "onmouseover=\"this.style.border='1px solid #3A8BDC'\" onmouseout=\"this.style.border='1px solid #CCCCCC'\">";
  1308. strHtml += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100%\" style=\"text-align: center;cursor:pointer\" ";
  1309. strHtml += " onclick=\"GetOneState('" + dt.Rows[i]["F_WorkNumber"] + "','"+ dt.Rows[i]["ExtensionCode"] + "','" + dt.Rows[i]["F_UserName"] + "')\">";
  1310. strHtml += " <tr><td><input type=\"text\" id=\"" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"display: none\" /><input type=\"text\" id=\"txtSeatState_" + dt.Rows[i]["F_WorkNumber"] + "\" value=\"0\" style=\"display: none\" />";
  1311. strHtml += " <span id=\"span_" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"color: #000000;\">";
  1312. strHtml += dt.Rows[i]["F_WorkNumber"] + "(" + dt.Rows[i]["F_UserName"] + ")</span>";
  1313. strHtml += "</td></tr> <tr> <td><img id=\"img_" + dt.Rows[i]["F_WorkNumber"] + "\" src=\"/Content/images/seatimgs/weiqianru.jpg\" />";
  1314. strHtml += "</td></tr><tr><td><span id=\"span_state_" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"color: #cccccc;\">未签入</span>";
  1315. strHtml += " </td></tr></table></div></div>";
  1316. }
  1317. }
  1318. strList += "!@#";
  1319. strList = strList.Replace(",!@#", "").Replace("!@#", "");
  1320. }
  1321. catch
  1322. {
  1323. }
  1324. finally
  1325. {
  1326. dt.Clear();
  1327. dt.Dispose();
  1328. }
  1329. return strList + "~" + strHtml;
  1330. }
  1331. //外呼判断本地外地以及加前缀返回
  1332. [ActionName("GetCallOutprefix")]
  1333. [HttpGet]
  1334. public string GetCallOutprefix(string phone) {
  1335. AddAction("T_Sys_UserAccount", phone, "外呼获取外呼前缀", phone);
  1336. string phone1 = CallCenter.Utility.RequestString.ToDBC(RequestString.RemoveNotNumber(StringHelper.NoHTML(phone)));
  1337. string tophone = phone1;
  1338. string zipcode = ""; string bfix = ""; string wfix = ""; string fix = "";
  1339. // string userseatgroupid = CurrentUser.UserData.F_SeartGroupID.ToString();
  1340. //if (userseatgroupid != "" && userseatgroupid != "0")
  1341. //{
  1342. //Model.T_Sys_SeatGroup smodel = new BLL.T_Sys_SeatGroup().GetModel(int.Parse(userseatgroupid));
  1343. //if (smodel != null)
  1344. //{
  1345. zipcode = "0371";
  1346. bfix ="9";
  1347. wfix = "90";
  1348. //}
  1349. //}
  1350. int zip = GetZipCodeByPhone(phone1, zipcode);
  1351. #region
  1352. if (zip == 1)
  1353. {//手机本地号码
  1354. fix = bfix;
  1355. }
  1356. else if (zip == 2)
  1357. {//手机外地号码
  1358. fix = wfix;
  1359. }
  1360. else
  1361. {
  1362. tophone = phone1.TrimStart('0');
  1363. if (zip == 3)
  1364. {//本地固话去0加9 比如:988888517,937188888517
  1365. fix = bfix;
  1366. }
  1367. else if (zip == 4)
  1368. {//外地固话前加9 比如:9037188888517
  1369. fix = wfix;
  1370. }
  1371. }
  1372. #endregion
  1373. var obj = new
  1374. {
  1375. phone = fix + tophone,
  1376. fix = fix
  1377. };
  1378. return fix;
  1379. // return Success("外呼号码加前缀" + phone, obj);
  1380. }
  1381. /// <summary>
  1382. /// 根据号码和区号判断号码是否为归属地号码
  1383. /// 返回0为分机号或特殊号码
  1384. /// 返回1为手机本地号码
  1385. /// 返回2为手机外地号码
  1386. /// 返回3为固定电话本地号码
  1387. /// 返回4为固定电话外地号码
  1388. /// </summary>
  1389. /// <param name="phone"></param>
  1390. /// <param name="zipcode"></param>
  1391. /// <returns></returns>
  1392. [NonAction]
  1393. public int GetZipCodeByPhone(string phone, string zipcode)
  1394. {
  1395. int n = 0;
  1396. if (phone.Trim().Length >= 7)
  1397. {
  1398. //7位及7位以上是固定电话或手机
  1399. //判断是否手机
  1400. if (phone.Trim().Length == 11 && phone[0] == '1')
  1401. {//号码为11位,首位是1,为手机号
  1402. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  1403. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList("F_MobileNum='" + phone.Substring(0, 7) + "'").FirstOrDefault();
  1404. if (mobileModel != null)
  1405. {
  1406. if (mobileModel.F_ZipCode.Equals(zipcode))
  1407. {
  1408. return 1;
  1409. }
  1410. else
  1411. {
  1412. return 2;
  1413. }
  1414. }
  1415. }
  1416. else
  1417. {
  1418. if (phone.Trim().Length == 11 && phone.Substring(0, 3).Equals(zipcode))
  1419. {//号码为11位
  1420. //截取前三位区号判断是否本地
  1421. bool resbd3 = phone.Substring(0, 3).Equals(zipcode);
  1422. //截取前四位区号判断是否本地
  1423. bool resbd4 = phone.Substring(0, 4).Equals(zipcode);
  1424. if (resbd3 || resbd4)
  1425. {
  1426. return 3;
  1427. }
  1428. else
  1429. {
  1430. return 4;
  1431. }
  1432. }
  1433. else if (phone.Trim().Length < 11)
  1434. {//号码小于11位,为本地
  1435. return 3;
  1436. }
  1437. else if (phone.Trim().Length > 11 && phone.Substring(0, 4).Equals(zipcode))
  1438. {//号码大于11位,截取前四位区号判断是否本地
  1439. return 3;
  1440. }
  1441. else
  1442. {
  1443. return 4;
  1444. }
  1445. }
  1446. }
  1447. return n;
  1448. }
  1449. /// <summary>
  1450. /// 获取来电业务类型
  1451. /// </summary>
  1452. /// <param name="CallId">通话记录Callid </param>
  1453. /// <returns></returns>
  1454. [ActionName("GetCallType")]
  1455. [HttpGet]
  1456. public string GetCallType(string CallId)
  1457. {
  1458. //数据结果集
  1459. ResponseData dataModel = new ResponseData();
  1460. //来电业务类型
  1461. string sql = " select F_ServiceType from T_Call_CallRecords where CallId='" + CallId + "' order by BeginTime desc ";
  1462. //排队数量
  1463. // string sql2 = " select COUNT(CallId) as CallId from T_Call_CallRecords where F_linenum=1 ";
  1464. DataTable dt = new DataTable();
  1465. DataSet ds = DbHelperSQL.Query(sql);
  1466. dt = ds.Tables[0];
  1467. //来电业务类型
  1468. dataModel.code = Convert.ToInt32(dt.Rows[0]["F_ServiceType"].ToString() == "" ? "0" : dt.Rows[0]["F_ServiceType"].ToString());
  1469. //DataTable dt2 = new DataTable();
  1470. //DataSet ds2 = DbHelperSQL.Query(sql2);
  1471. //dt2 = ds2.Tables[0];
  1472. ////排队数量
  1473. //dataModel.msg = dt2.Rows[0]["CallId"].ToString() == "" ? "0" : dt2.Rows[0]["CallId"].ToString();
  1474. // dataModel.count = recordCount;
  1475. // dataModel.data = dt;
  1476. string json = JsonConvert.SerializeObject(dataModel);
  1477. return json;
  1478. }
  1479. /// <summary>
  1480. /// 获取排队数量
  1481. /// </summary>
  1482. /// <param name="CallId">通话记录Callid </param>
  1483. /// <returns></returns>
  1484. [ActionName("GetCallLineNum")]
  1485. [HttpGet]
  1486. public string GetCallLineNum()
  1487. {
  1488. //数据结果集
  1489. ResponseData dataModel = new ResponseData();
  1490. //排队数量
  1491. string sql2 = " select COUNT(CallId) as CallId from T_Call_CallRecords where F_linenum=1 and isnull(TalkStartTime,0)=0 ";
  1492. DataTable dt2 = new DataTable();
  1493. DataSet ds2 = DbHelperSQL.Query(sql2);
  1494. dt2 = ds2.Tables[0];
  1495. //排队数量
  1496. dataModel.code = Convert.ToInt32(dt2.Rows[0]["CallId"].ToString() == "" ? "0" : dt2.Rows[0]["CallId"].ToString());
  1497. // dataModel.count = recordCount;
  1498. // dataModel.data = dt;
  1499. string json = JsonConvert.SerializeObject(dataModel);
  1500. // return json;
  1501. return dataModel.code.ToString();
  1502. }
  1503. }
  1504. }