地铁二期项目正式开始

QualityManagementController.cs 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Data;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using YTSoft.BaseCallCenter.Model;
  7. using YTSoft.BaseCallCenter.MVCWeb.Models;
  8. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  9. {
  10. public class QualityManagementController : BaseController
  11. {
  12. //
  13. // GET: /QualityManagement/
  14. //通话记录
  15. BLL.T_Call_CallRecords_All recordBLL = new BLL.T_Call_CallRecords_All();
  16. //用户列表
  17. BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
  18. //指标分类
  19. BLL.T_QC_IndexCategory qcindexBLL = new BLL.T_QC_IndexCategory();
  20. //列表分类
  21. BLL.T_QC_IndexBase qcindexbaseBLL = new BLL.T_QC_IndexBase();
  22. /// <summary>
  23. /// 初始化列表
  24. /// </summary>
  25. /// <returns></returns>
  26. ///
  27. //指标分类
  28. public ActionResult TargetManagementList()
  29. {
  30. WorkOrderMyModel model = new WorkOrderMyModel();
  31. return View(model);
  32. }
  33. public ActionResult QCIndexEdit()
  34. {
  35. WorkOrderMyModel model = new WorkOrderMyModel();
  36. return View(model);
  37. }
  38. //指标列表
  39. public ActionResult QCIndexList()
  40. {
  41. WorkOrderMyModel model = new WorkOrderMyModel();
  42. return View(model);
  43. }
  44. //质检评分
  45. public ActionResult QualityTestScore()
  46. {
  47. WorkOrderMyModel model = new WorkOrderMyModel();
  48. Model.T_Sys_UserAccount viewModel = new Model.T_Sys_UserAccount();
  49. //获取用户列表
  50. viewModel.UserList = userBLL.GetModelList("F_RemindFlag=0");
  51. return View(viewModel);
  52. }
  53. //质检结果
  54. public ActionResult QcResultList()
  55. {
  56. WorkOrderMyModel model = new WorkOrderMyModel();
  57. return View(model);
  58. }
  59. //
  60. // GET: /QualityManagement/Details/5
  61. /// <summary>
  62. /// 获取通话记录
  63. /// </summary>
  64. /// <param name="page">当前页码</param>
  65. /// <param name="limit">每页数据量</param>
  66. /// <param name="sqlWhere">查询条件</param>
  67. /// <returns></returns>
  68. [ActionName("CallRecordData")]
  69. [HttpGet]
  70. public string CallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType, string callStatus,string userid)
  71. {
  72. //数据结果集
  73. ResponseData dataModel = new ResponseData();
  74. string sql = " and FilePath<>''";
  75. if (!string.IsNullOrEmpty(callnumber))
  76. {
  77. sql += " and CallNumber like '%" + callnumber + "%'";
  78. }
  79. if (!string.IsNullOrEmpty(usercode))
  80. {
  81. sql += " and userid ='" + usercode + "'";
  82. }
  83. if (!string.IsNullOrEmpty(userid))
  84. {
  85. sql += " and userid ='" + userid + "'";
  86. }
  87. if (!string.IsNullOrEmpty(callType))
  88. {
  89. sql += " and CallType =" + callType;
  90. }
  91. if (!string.IsNullOrEmpty(callStatus))
  92. {
  93. sql += " and CallState =" + callStatus;
  94. }
  95. DataTable dt = new DataTable();
  96. int recordCount = 0;
  97. Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
  98. dt = BLL.PagerBLL.GetListPager(
  99. "T_Call_CallRecords",
  100. "CallRecordsId",
  101. @"*,CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew, replace(replace(FilePath,'\','/'),'"+GetSysconfig("newFilePath") +"','"+ GetSysconfig("newPlayPath") + "') as fileurl",
  102. sql,
  103. "ORDER BY CallRecordsId desc",
  104. limit,
  105. page,
  106. true,
  107. out recordCount);
  108. dataModel.code = 0;
  109. dataModel.count = recordCount;
  110. dataModel.data = dt;
  111. string json = JsonConvert.SerializeObject(dataModel);
  112. return json;
  113. }
  114. // GET: /QualityManagement/Details/5
  115. /// <summary>
  116. /// 获取质检结果
  117. /// </summary>
  118. /// <param name="page">当前页码</param>
  119. /// <param name="limit">每页数据量</param>
  120. /// <param name="sqlWhere">查询条件</param>
  121. /// <returns></returns>
  122. [ActionName("QCResultCallRecordData")]
  123. [HttpGet]
  124. public string QCResultCallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType, string callStatus, string userid)
  125. {
  126. //数据结果集
  127. ResponseData dataModel = new ResponseData();
  128. string sql = " and F_QCState<>0 and FilePath<>''";
  129. if (!string.IsNullOrEmpty(callnumber))
  130. {
  131. sql += " and CallNumber like '%" + callnumber + "%'";
  132. }
  133. if (!string.IsNullOrEmpty(usercode))
  134. {
  135. sql += " and userid ='" + usercode + "'";
  136. }
  137. if (!string.IsNullOrEmpty(userid))
  138. {
  139. sql += " and userid ='" + userid + "'";
  140. }
  141. if (!string.IsNullOrEmpty(callType))
  142. {
  143. sql += " and CallType =" + callType;
  144. }
  145. if (!string.IsNullOrEmpty(callStatus))
  146. {
  147. sql += " and CallState =" + callStatus;
  148. }
  149. DataTable dt = new DataTable();
  150. int recordCount = 0;
  151. Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
  152. dt = BLL.PagerBLL.GetListPager(
  153. "T_Call_CallRecords",
  154. "CallRecordsId",
  155. @"*,CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew , replace(replace(FilePath,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "') as fileurl ",
  156. sql,
  157. "ORDER BY CallRecordsId desc",
  158. limit,
  159. page,
  160. true,
  161. out recordCount);
  162. dataModel.code = 0;
  163. dataModel.count = recordCount;
  164. dataModel.data = dt;
  165. string json = JsonConvert.SerializeObject(dataModel);
  166. return json;
  167. }
  168. /// <summary>
  169. /// 获取分类数据
  170. /// </summary>
  171. /// <param name="page">当前页码</param>
  172. /// <param name="limit">每页数据量</param>
  173. /// <returns></returns>
  174. [ActionName("QCindexDate")]
  175. [HttpGet]
  176. public string QCindexDate(DateTime? NowDateTime, int page, int limit, int? parentId)
  177. {
  178. //数据结果集
  179. ResponseData dataModel = new ResponseData();
  180. string sql = "";
  181. if (parentId != null)
  182. {
  183. sql += " and F_ParentId=" + parentId;
  184. }
  185. DataTable dt = new DataTable();
  186. int recordCount = 0;
  187. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  188. dt = BLL.PagerBLL.GetListPager(
  189. "T_QC_IndexCategory",
  190. "F_CategoryId",
  191. "* ,(CASE F_DeleteFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_DeleteFlag",
  192. sql,
  193. "ORDER BY F_CategoryId ",
  194. limit,
  195. page,
  196. true,
  197. out recordCount);
  198. dataModel.code = 0;
  199. dataModel.count = recordCount;
  200. dataModel.data = dt;
  201. return JsonConvert.SerializeObject(dataModel);
  202. }
  203. /// <summary>
  204. /// 获取列表数据
  205. /// </summary>
  206. /// <param name="page">当前页码</param>
  207. /// <param name="limit">每页数据量</param>
  208. /// <returns></returns>
  209. [ActionName("QCindexbaseDate")]
  210. [HttpGet]
  211. public string QCindexbaseDate( int page, int limit, int? parentId)
  212. {
  213. //数据结果集
  214. ResponseData dataModel = new ResponseData();
  215. string sql = "";
  216. if (parentId != null)
  217. {
  218. sql += " and F_ParentId=" + parentId;
  219. }
  220. DataTable dt = new DataTable();
  221. int recordCount = 0;
  222. Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
  223. dt = BLL.PagerBLL.GetListPager(
  224. "T_QC_IndexBase",
  225. "F_IndexId",
  226. "* ,(CASE F_DeleteFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_DeleteFlag",
  227. sql,
  228. "ORDER BY F_IndexId ",
  229. limit,
  230. page,
  231. true,
  232. out recordCount);
  233. dataModel.code = 0;
  234. dataModel.count = recordCount;
  235. dataModel.data = dt;
  236. return JsonConvert.SerializeObject(dataModel);
  237. }
  238. #region 获取指标树
  239. BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
  240. public class DicSeaarchModel
  241. {
  242. public string RootCode
  243. {
  244. get;
  245. set;
  246. }
  247. }
  248. /// <summary>
  249. /// 初始化字典结构
  250. /// </summary>
  251. /// <param name="rootCode"></param>
  252. /// <returns></returns>
  253. public ActionResult MenuTree(string rootCode)
  254. {
  255. DicSeaarchModel model = new DicSeaarchModel();
  256. model.RootCode = rootCode;
  257. return View(model);
  258. }
  259. ///通过部门父级节点获取数据
  260. /// </summary>
  261. /// <param name="fid"></param>
  262. /// <returns></returns>
  263. public string QCGetMenuJsonModel(int parentId)
  264. {
  265. return Newtonsoft.Json.JsonConvert.SerializeObject(qcindexBLL.GetMenuJsonModel(parentId));
  266. }
  267. ///通过部门父级节点获取数据
  268. /// </summary>
  269. /// <param name="fid"></param>
  270. /// <returns></returns>
  271. public string QCindexGetMenuJsonModel(int parentId)
  272. {
  273. return Newtonsoft.Json.JsonConvert.SerializeObject(qcindexbaseBLL.GetMenuJsonModel(parentId));
  274. }
  275. #endregion
  276. /// <summary>
  277. ///指标分类编辑
  278. /// </summary>
  279. /// <param name="editType">类型1、新增 2、修改</param>
  280. /// /// <returns></returns>
  281. public ActionResult TargetManagementEdit(int? categoryId ,int? IndexCategoryId, int editType )
  282. {
  283. try
  284. {
  285. Model.T_QC_IndexCategory viewModel = new Model.T_QC_IndexCategory();
  286. //当前对象实体1新增,2编辑
  287. if (editType == 1)
  288. {
  289. viewModel.F_ParentId = IndexCategoryId;
  290. viewModel.F_Sort = 1;
  291. }
  292. else
  293. {
  294. Model.T_QC_IndexCategory callModel = qcindexBLL.GetModel(int.Parse(categoryId.ToString()));
  295. viewModel = callModel;
  296. }
  297. //获取指标分类
  298. viewModel.IndexCategoryList = qcindexBLL.GetModelList("F_ParentId=0");
  299. return View(viewModel);
  300. }
  301. catch
  302. {
  303. return View();
  304. }
  305. }
  306. /// <summary>
  307. /// 保存编辑
  308. /// </summary>
  309. /// <param name="workOrderBaseModel"></param>
  310. /// <returns></returns>
  311. [AcceptVerbs(HttpVerbs.Post)]
  312. public bool SaveCategoryData(T_QC_IndexCategory qcaModel, string Fl_CategoryId, string F_ParentId )
  313. {
  314. //当前对象实体
  315. if (qcaModel.F_CategoryId > 0)
  316. {
  317. Model.T_QC_IndexCategory qccateModel = qcindexBLL.GetModel(qcaModel.F_CategoryId);
  318. if (Convert.ToInt32(F_ParentId) > 0)
  319. {
  320. qccateModel.F_ParentId = Convert.ToInt32(Fl_CategoryId);
  321. }
  322. else
  323. {
  324. qccateModel.F_ParentId = 0;
  325. }
  326. //qccateModel.F_CategoryName = F_CategoryName;
  327. //qccateModel.F_Sort= Convert.ToInt32( F_Sort);
  328. return qcindexBLL.Update(qccateModel);
  329. }
  330. else
  331. {
  332. return qcindexBLL.Add(qcaModel) > 0;
  333. }
  334. }
  335. /// <summary>
  336. /// 删除功能
  337. /// </summary>
  338. /// <param name="workOrderBaseModel"></param>
  339. /// <returns></returns>
  340. [AcceptVerbs(HttpVerbs.Get)]
  341. public bool DeleteIndexCateData(int categoryId)
  342. {
  343. return qcindexBLL.Delete(categoryId);
  344. }
  345. /// <summary>
  346. /// 保存编辑
  347. /// </summary>
  348. /// <param name="workOrderBaseModel"></param>
  349. /// <returns></returns>
  350. [AcceptVerbs(HttpVerbs.Post)]
  351. public bool SaveQuaData(T_Call_CallRecords_All quaModel,string F_QCScore,string F_QCRemark)
  352. {
  353. //当前对象实体
  354. if (quaModel.CallRecordsId > 0)
  355. {
  356. Model.T_Call_CallRecords_All qcModel = recordBLL.GetModel(quaModel.CallRecordsId);
  357. switch (F_QCRemark)
  358. {
  359. case "1":
  360. qcModel.F_QCRemark ="非常满意";
  361. qcModel.F_QCState = 1;
  362. break;
  363. case "2":
  364. qcModel.F_QCRemark = "基本满意";
  365. qcModel.F_QCState = 2;
  366. break;
  367. case "3":
  368. qcModel.F_QCRemark = "不满意";
  369. qcModel.F_QCState = 3;
  370. break;
  371. default:
  372. qcModel.F_QCRemark = " ";
  373. qcModel.F_QCState = 0;
  374. break;
  375. }
  376. if (Convert.ToInt32(F_QCScore)>0)
  377. {
  378. qcModel.F_QCScore = Convert.ToInt32( F_QCScore);
  379. }
  380. else
  381. {
  382. qcModel.F_QCScore = 0;
  383. }
  384. qcModel.F_QCTime = DateTime.Now;
  385. return recordBLL.Update(qcModel);
  386. }
  387. else
  388. {
  389. return recordBLL.Add(quaModel) > 0;
  390. }
  391. }
  392. /// <summary>
  393. /// 听取录音
  394. /// </summary>
  395. /// <returns></returns>
  396. public ActionResult QCVoicePlay(string type, string callid, int callrecordsid)
  397. {
  398. Models.QCVoicePlayModel model = new QCVoicePlayModel();
  399. model.playpath = "";
  400. model.downpath = "";
  401. try
  402. {
  403. if (callrecordsid != 0)
  404. {
  405. Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
  406. model.CallRecordsId = callModel.CallRecordsId;
  407. model.CallId = callModel.CallId;
  408. model.CallNumber = callModel.CallNumber;
  409. model.UserId = callModel.UserId;
  410. model.UserCode = callModel.UserCode;
  411. model.UserName = callModel.UserName;
  412. model.TalkLongTime = callModel.TalkLongTime;
  413. model.TalkStartTime = callModel.TalkStartTime;
  414. model.TalkEndTime = callModel.TalkEndTime;
  415. model.F_QCRemark = callModel.F_QCRemark;
  416. model.F_QCScore = Convert.ToInt32( callModel.F_QCScore);
  417. model.F_QCState = callModel.F_QCState;
  418. }
  419. model.playpath = QCGetSrc(type, callid);
  420. if (type == "0")
  421. {
  422. model.downpath = model.playpath.Replace("playbyappid", "downbyappid");
  423. }
  424. else
  425. {
  426. model.downpath = model.playpath.Replace("playvoicemail", "downvoicemail");
  427. }
  428. }
  429. catch
  430. { }
  431. return View(model);
  432. }
  433. /// <summary>
  434. /// 听取录音
  435. /// </summary>
  436. /// <returns></returns>
  437. public ActionResult QCVoicePlayNew(string type, string callid, int callrecordsid)
  438. {
  439. Models.QCVoicePlayModel model = new QCVoicePlayModel();
  440. model.playpath = "";
  441. model.downpath = "";
  442. try
  443. {
  444. if (callrecordsid != 0)
  445. {
  446. Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
  447. model.CallRecordsId = callModel.CallRecordsId;
  448. model.CallId = callModel.CallId;
  449. model.CallNumber = callModel.CallNumber;
  450. model.UserId = callModel.UserId;
  451. model.UserCode = callModel.UserCode;
  452. model.UserName = callModel.UserName;
  453. model.TalkLongTime = callModel.TalkLongTime;
  454. model.TalkStartTime = callModel.TalkStartTime;
  455. model.TalkEndTime = callModel.TalkEndTime;
  456. model.F_QCRemark = callModel.F_QCRemark;
  457. model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
  458. model.F_QCState = callModel.F_QCState;
  459. }
  460. model.playpath = callid;
  461. model.downpath = model.playpath;
  462. }
  463. catch
  464. { }
  465. return View(model);
  466. }
  467. /// <summary>
  468. /// 质检结果
  469. /// </summary>
  470. /// <returns></returns>
  471. public ActionResult QCShowVoicePlay(string type, string callid, int callrecordsid)
  472. {
  473. Models.QCVoicePlayModel model = new QCVoicePlayModel();
  474. model.playpath = "";
  475. model.downpath = "";
  476. try
  477. {
  478. if (callrecordsid != 0)
  479. {
  480. Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
  481. model.CallRecordsId = callModel.CallRecordsId;
  482. model.CallId = callModel.CallId;
  483. model.CallNumber = callModel.CallNumber;
  484. model.UserId = callModel.UserId;
  485. model.UserCode = callModel.UserCode;
  486. model.UserName = callModel.UserName;
  487. model.TalkLongTime = callModel.TalkLongTime;
  488. model.TalkStartTime = callModel.TalkStartTime;
  489. model.TalkEndTime = callModel.TalkEndTime;
  490. model.F_QCRemark = callModel.F_QCRemark;
  491. model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
  492. model.F_QCState = callModel.F_QCState;
  493. }
  494. model.playpath = QCGetSrc(type, callid);
  495. if (type == "0")
  496. {
  497. model.downpath = model.playpath.Replace("playbyappid", "downbyappid");
  498. }
  499. else
  500. {
  501. model.downpath = model.playpath.Replace("playvoicemail", "downvoicemail");
  502. }
  503. }
  504. catch
  505. { }
  506. return View(model);
  507. }
  508. /// <summary>
  509. /// 新质检结果
  510. /// </summary>
  511. /// <returns></returns>
  512. public ActionResult QCShowVoicePlayNew(string type, string callid, int callrecordsid)
  513. {
  514. Models.QCVoicePlayModel model = new QCVoicePlayModel();
  515. model.playpath = "";
  516. model.downpath = "";
  517. try
  518. {
  519. if (callrecordsid != 0)
  520. {
  521. Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
  522. model.CallRecordsId = callModel.CallRecordsId;
  523. model.CallId = callModel.CallId;
  524. model.CallNumber = callModel.CallNumber;
  525. model.UserId = callModel.UserId;
  526. model.UserCode = callModel.UserCode;
  527. model.UserName = callModel.UserName;
  528. model.TalkLongTime = callModel.TalkLongTime;
  529. model.TalkStartTime = callModel.TalkStartTime;
  530. model.TalkEndTime = callModel.TalkEndTime;
  531. model.F_QCRemark = callModel.F_QCRemark;
  532. model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
  533. model.F_QCState = callModel.F_QCState;
  534. }
  535. //replace(replace(FilePath, '\',' / '),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')"
  536. model.playpath = callid;
  537. model.downpath = model.playpath;
  538. }
  539. catch
  540. { }
  541. return View(model);
  542. }
  543. public string QCGetSrc(string type, string callid)
  544. {
  545. string res = "";
  546. try
  547. {
  548. string para = "PlayPath";
  549. if (type == "0")
  550. {
  551. para = "PlayPath";
  552. }
  553. else
  554. {
  555. para = "PlayLeaveVoice";
  556. }
  557. BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  558. string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode(para);//CTIIP
  559. string path = callid;
  560. if (path.IndexOf(":") < 0)
  561. {
  562. res = CTIserverIP + path;
  563. }
  564. else
  565. {
  566. res = path.Replace("D:", CTIserverIP);
  567. }
  568. res = HttpUtility.HtmlEncode(res);
  569. }
  570. catch
  571. {
  572. }
  573. return res;
  574. }
  575. }
  576. }