| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- using Newtonsoft.Json;
- using System;
- using System.Data;
- using System.Web;
- using System.Web.Mvc;
- using YTSoft.BaseCallCenter.Model;
- using YTSoft.BaseCallCenter.MVCWeb.Models;
- namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
- {
- public class QualityManagementController : BaseController
- {
- //
- // GET: /QualityManagement/
- //通话记录
- BLL.T_Call_CallRecords_All recordBLL = new BLL.T_Call_CallRecords_All();
- //用户列表
- BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
- //指标分类
- BLL.T_QC_IndexCategory qcindexBLL = new BLL.T_QC_IndexCategory();
- //列表分类
- BLL.T_QC_IndexBase qcindexbaseBLL = new BLL.T_QC_IndexBase();
- /// <summary>
- /// 初始化列表
- /// </summary>
- /// <returns></returns>
- ///
-
- //指标分类
- public ActionResult TargetManagementList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- public ActionResult QCIndexEdit()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- //指标列表
- public ActionResult QCIndexList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- //质检评分
- public ActionResult QualityTestScore()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- Model.T_Sys_UserAccount viewModel = new Model.T_Sys_UserAccount();
- //获取用户列表
- viewModel.UserList = userBLL.GetModelList("F_RemindFlag=0");
- return View(viewModel);
- }
-
- //质检结果
- public ActionResult QcResultList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- //
- // GET: /QualityManagement/Details/5
- /// <summary>
- /// 获取通话记录
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <param name="sqlWhere">查询条件</param>
- /// <returns></returns>
- [ActionName("CallRecordData")]
- [HttpGet]
- public string CallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType, string callStatus,string userid)
- {
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = " and FilePath<>''";
- if (!string.IsNullOrEmpty(callnumber))
- {
- sql += " and CallNumber like '%" + callnumber + "%'";
- }
-
- if (!string.IsNullOrEmpty(usercode))
- {
- sql += " and userid ='" + usercode + "'";
- }
- if (!string.IsNullOrEmpty(userid))
- {
- sql += " and userid ='" + userid + "'";
- }
- if (!string.IsNullOrEmpty(callType))
- {
- sql += " and CallType =" + callType;
- }
- if (!string.IsNullOrEmpty(callStatus))
- {
- sql += " and CallState =" + callStatus;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Call_CallRecords",
- "CallRecordsId",
- @"*,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",
- sql,
- "ORDER BY CallRecordsId desc",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- string json = JsonConvert.SerializeObject(dataModel);
- return json;
- }
- // GET: /QualityManagement/Details/5
- /// <summary>
- /// 获取质检结果
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <param name="sqlWhere">查询条件</param>
- /// <returns></returns>
- [ActionName("QCResultCallRecordData")]
- [HttpGet]
- public string QCResultCallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType, string callStatus, string userid)
- {
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = " and F_QCState<>0 and FilePath<>''";
- if (!string.IsNullOrEmpty(callnumber))
- {
- sql += " and CallNumber like '%" + callnumber + "%'";
- }
- if (!string.IsNullOrEmpty(usercode))
- {
- sql += " and userid ='" + usercode + "'";
- }
- if (!string.IsNullOrEmpty(userid))
- {
- sql += " and userid ='" + userid + "'";
- }
- if (!string.IsNullOrEmpty(callType))
- {
- sql += " and CallType =" + callType;
- }
- if (!string.IsNullOrEmpty(callStatus))
- {
- sql += " and CallState =" + callStatus;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Call_CallRecords",
- "CallRecordsId",
- @"*,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 ",
- sql,
- "ORDER BY CallRecordsId desc",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- string json = JsonConvert.SerializeObject(dataModel);
- return json;
- }
- /// <summary>
- /// 获取分类数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("QCindexDate")]
- [HttpGet]
- public string QCindexDate(DateTime? NowDateTime, int page, int limit, int? parentId)
- {
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_QC_IndexCategory",
- "F_CategoryId",
- "* ,(CASE F_DeleteFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_DeleteFlag",
- sql,
- "ORDER BY F_CategoryId ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- /// <summary>
- /// 获取列表数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("QCindexbaseDate")]
- [HttpGet]
- public string QCindexbaseDate( int page, int limit, int? parentId)
- {
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_QC_IndexBase",
- "F_IndexId",
- "* ,(CASE F_DeleteFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_DeleteFlag",
- sql,
- "ORDER BY F_IndexId ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
-
- #region 获取指标树
- BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
- public class DicSeaarchModel
- {
- public string RootCode
- {
- get;
- set;
- }
- }
- /// <summary>
- /// 初始化字典结构
- /// </summary>
- /// <param name="rootCode"></param>
- /// <returns></returns>
- public ActionResult MenuTree(string rootCode)
- {
- DicSeaarchModel model = new DicSeaarchModel();
- model.RootCode = rootCode;
- return View(model);
- }
- ///通过部门父级节点获取数据
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string QCGetMenuJsonModel(int parentId)
- {
- return Newtonsoft.Json.JsonConvert.SerializeObject(qcindexBLL.GetMenuJsonModel(parentId));
- }
- ///通过部门父级节点获取数据
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string QCindexGetMenuJsonModel(int parentId)
- {
- return Newtonsoft.Json.JsonConvert.SerializeObject(qcindexbaseBLL.GetMenuJsonModel(parentId));
- }
- #endregion
- /// <summary>
- ///指标分类编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult TargetManagementEdit(int? categoryId ,int? IndexCategoryId, int editType )
- {
- try
- {
- Model.T_QC_IndexCategory viewModel = new Model.T_QC_IndexCategory();
- //当前对象实体1新增,2编辑
- if (editType == 1)
- {
- viewModel.F_ParentId = IndexCategoryId;
- viewModel.F_Sort = 1;
-
- }
- else
- {
- Model.T_QC_IndexCategory callModel = qcindexBLL.GetModel(int.Parse(categoryId.ToString()));
- viewModel = callModel;
- }
- //获取指标分类
- viewModel.IndexCategoryList = qcindexBLL.GetModelList("F_ParentId=0");
- return View(viewModel);
-
- }
- catch
- {
- return View();
- }
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveCategoryData(T_QC_IndexCategory qcaModel, string Fl_CategoryId, string F_ParentId )
- {
- //当前对象实体
- if (qcaModel.F_CategoryId > 0)
- {
- Model.T_QC_IndexCategory qccateModel = qcindexBLL.GetModel(qcaModel.F_CategoryId);
-
- if (Convert.ToInt32(F_ParentId) > 0)
- {
- qccateModel.F_ParentId = Convert.ToInt32(Fl_CategoryId);
- }
- else
- {
- qccateModel.F_ParentId = 0;
- }
- //qccateModel.F_CategoryName = F_CategoryName;
- //qccateModel.F_Sort= Convert.ToInt32( F_Sort);
- return qcindexBLL.Update(qccateModel);
- }
- else
- {
- return qcindexBLL.Add(qcaModel) > 0;
- }
- }
- /// <summary>
- /// 删除功能
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteIndexCateData(int categoryId)
- {
- return qcindexBLL.Delete(categoryId);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveQuaData(T_Call_CallRecords_All quaModel,string F_QCScore,string F_QCRemark)
- {
-
- //当前对象实体
- if (quaModel.CallRecordsId > 0)
- {
- Model.T_Call_CallRecords_All qcModel = recordBLL.GetModel(quaModel.CallRecordsId);
- switch (F_QCRemark)
- {
- case "1":
- qcModel.F_QCRemark ="非常满意";
- qcModel.F_QCState = 1;
- break;
- case "2":
- qcModel.F_QCRemark = "基本满意";
- qcModel.F_QCState = 2;
- break;
- case "3":
- qcModel.F_QCRemark = "不满意";
- qcModel.F_QCState = 3;
- break;
- default:
- qcModel.F_QCRemark = " ";
- qcModel.F_QCState = 0;
- break;
- }
- if (Convert.ToInt32(F_QCScore)>0)
- {
- qcModel.F_QCScore = Convert.ToInt32( F_QCScore);
- }
- else
- {
- qcModel.F_QCScore = 0;
- }
- qcModel.F_QCTime = DateTime.Now;
- return recordBLL.Update(qcModel);
- }
- else
- {
- return recordBLL.Add(quaModel) > 0;
- }
-
- }
-
- /// <summary>
- /// 听取录音
- /// </summary>
- /// <returns></returns>
- public ActionResult QCVoicePlay(string type, string callid, int callrecordsid)
- {
- Models.QCVoicePlayModel model = new QCVoicePlayModel();
- model.playpath = "";
- model.downpath = "";
- try
- {
- if (callrecordsid != 0)
- {
- Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
- model.CallRecordsId = callModel.CallRecordsId;
- model.CallId = callModel.CallId;
- model.CallNumber = callModel.CallNumber;
- model.UserId = callModel.UserId;
- model.UserCode = callModel.UserCode;
- model.UserName = callModel.UserName;
- model.TalkLongTime = callModel.TalkLongTime;
- model.TalkStartTime = callModel.TalkStartTime;
- model.TalkEndTime = callModel.TalkEndTime;
- model.F_QCRemark = callModel.F_QCRemark;
- model.F_QCScore = Convert.ToInt32( callModel.F_QCScore);
- model.F_QCState = callModel.F_QCState;
- }
-
- model.playpath = QCGetSrc(type, callid);
- if (type == "0")
- {
- model.downpath = model.playpath.Replace("playbyappid", "downbyappid");
-
- }
- else
- {
- model.downpath = model.playpath.Replace("playvoicemail", "downvoicemail");
- }
- }
- catch
- { }
-
- return View(model);
- }
- /// <summary>
- /// 听取录音
- /// </summary>
- /// <returns></returns>
- public ActionResult QCVoicePlayNew(string type, string callid, int callrecordsid)
- {
- Models.QCVoicePlayModel model = new QCVoicePlayModel();
- model.playpath = "";
- model.downpath = "";
- try
- {
- if (callrecordsid != 0)
- {
- Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
- model.CallRecordsId = callModel.CallRecordsId;
- model.CallId = callModel.CallId;
- model.CallNumber = callModel.CallNumber;
- model.UserId = callModel.UserId;
- model.UserCode = callModel.UserCode;
- model.UserName = callModel.UserName;
- model.TalkLongTime = callModel.TalkLongTime;
- model.TalkStartTime = callModel.TalkStartTime;
- model.TalkEndTime = callModel.TalkEndTime;
- model.F_QCRemark = callModel.F_QCRemark;
- model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
- model.F_QCState = callModel.F_QCState;
- }
- model.playpath = callid;
- model.downpath = model.playpath;
- }
- catch
- { }
- return View(model);
- }
- /// <summary>
- /// 质检结果
- /// </summary>
- /// <returns></returns>
- public ActionResult QCShowVoicePlay(string type, string callid, int callrecordsid)
- {
- Models.QCVoicePlayModel model = new QCVoicePlayModel();
- model.playpath = "";
- model.downpath = "";
- try
- {
- if (callrecordsid != 0)
- {
- Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
- model.CallRecordsId = callModel.CallRecordsId;
- model.CallId = callModel.CallId;
- model.CallNumber = callModel.CallNumber;
- model.UserId = callModel.UserId;
- model.UserCode = callModel.UserCode;
- model.UserName = callModel.UserName;
- model.TalkLongTime = callModel.TalkLongTime;
- model.TalkStartTime = callModel.TalkStartTime;
- model.TalkEndTime = callModel.TalkEndTime;
- model.F_QCRemark = callModel.F_QCRemark;
- model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
- model.F_QCState = callModel.F_QCState;
- }
- model.playpath = QCGetSrc(type, callid);
- if (type == "0")
- {
- model.downpath = model.playpath.Replace("playbyappid", "downbyappid");
- }
- else
- {
- model.downpath = model.playpath.Replace("playvoicemail", "downvoicemail");
- }
- }
- catch
- { }
- return View(model);
- }
- /// <summary>
- /// 新质检结果
- /// </summary>
- /// <returns></returns>
- public ActionResult QCShowVoicePlayNew(string type, string callid, int callrecordsid)
- {
- Models.QCVoicePlayModel model = new QCVoicePlayModel();
- model.playpath = "";
- model.downpath = "";
- try
- {
- if (callrecordsid != 0)
- {
- Model.T_Call_CallRecords_All callModel = recordBLL.GetModel(callrecordsid);
- model.CallRecordsId = callModel.CallRecordsId;
- model.CallId = callModel.CallId;
- model.CallNumber = callModel.CallNumber;
- model.UserId = callModel.UserId;
- model.UserCode = callModel.UserCode;
- model.UserName = callModel.UserName;
- model.TalkLongTime = callModel.TalkLongTime;
- model.TalkStartTime = callModel.TalkStartTime;
- model.TalkEndTime = callModel.TalkEndTime;
- model.F_QCRemark = callModel.F_QCRemark;
- model.F_QCScore = Convert.ToInt32(callModel.F_QCScore);
- model.F_QCState = callModel.F_QCState;
- }
- //replace(replace(FilePath, '\',' / '),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')"
- model.playpath = callid;
- model.downpath = model.playpath;
- }
- catch
- { }
- return View(model);
- }
- public string QCGetSrc(string type, string callid)
- {
- string res = "";
- try
- {
- string para = "PlayPath";
- if (type == "0")
- {
- para = "PlayPath";
- }
- else
- {
- para = "PlayLeaveVoice";
- }
- BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
- string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode(para);//CTIIP
- string path = callid;
- if (path.IndexOf(":") < 0)
- {
- res = CTIserverIP + path;
- }
- else
- {
- res = path.Replace("D:", CTIserverIP);
- }
- res = HttpUtility.HtmlEncode(res);
- }
- catch
- {
- }
- return res;
- }
-
- }
- }
|