using Core.Web.App_Start; using Core.Web.Controllers; using Core.Web.WebHelper; using CRM.Core.BLL.FB; using CRM.Core.BLL.Quality; using CRM.Core.Common.Layui; using CRM.Core.DTO; using CRM.Core.Model; using CRM.Core.Model.Entity; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using WX.CRM.Common; namespace WX.CRM.WEB.Controllers.Quality { public class ComplainCustomerController : BaseController { ValidationErrors errors = new ValidationErrors(); QC_CUSTOMERCOMPLAIN_BL qc_CustomerComplain_BL = new QC_CUSTOMERCOMPLAIN_BL(); QC_COMPLAINTDICT_BL qc_ComplainDict_BL = new QC_COMPLAINTDICT_BL(); #region 首页 [AuthorizeRedirect(RightsConfig.CONST_投诉列表, ToolBarConfig.CONST_NotButton, true)] public ActionResult Index() { List levelList = qc_ComplainDict_BL.GetList_ComplaintDict().OrderBy(m => m.ORD).ToList(); List list = new List(); List ItemList = new List(); foreach (QC_COMPLAINTDICT m in levelList) { list.Add(new SelectListItem() { Text = m.DICTDESC, Value = m.DICTVALUE.ToString() }); } ViewBag.ComplainLevelList = list; return View(); } #endregion #region 列表 [HttpPost] [AuthorizeRedirect(RightsConfig.CONST_投诉列表, ToolBarConfig.CONST_NotButton, false)] public JsonResult GetHtmlList(Laypage pg, string columns) { string resid = Request["ResId"]; string stime = Request["STime"]; string etime = Request["ETime"]; string fromType = Request["ComplainFromType"]; string level = Request["ComplainLevel"]; //string groupId = Request["groupId"]; //decimal userId = Request["userId"].GetDecimal(0); decimal status = Request["status"].GetDecimal(-1); DateTime? time1 = null; DateTime? time2 = null; if (!string.IsNullOrWhiteSpace(stime)) time1 = Convert.ToDateTime(stime); if (!string.IsNullOrWhiteSpace(etime)) time2 = Convert.ToDateTime(etime).AddDays(1); try { var list = qc_CustomerComplain_BL.GetList_CustomerComplain(ref pg, resid, fromType, level, status, time1, time2); var data = new LayuiData() { msg = "数据加载成功!", count = pg.count, code = 0, data = list }; return Json(data, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error("ComplainCustomerController【GetHtmlList】:" + ex.Message + ex.StackTrace); return Json(new { }, JsonRequestBehavior.AllowGet); } } #endregion [HttpGet] public ActionResult MemoList() { return View(); } [HttpPost] public JsonResult MemoListHtml(string memoId, string deptcode) { try { ConStringHelper.CompanyCode companyCode = (ConStringHelper.CompanyCode)Enum.Parse(typeof(ConStringHelper.CompanyCode), deptcode); Ord_ServiceMemo_BL serviceBL = new Ord_ServiceMemo_BL(companyCode); var list = serviceBL.GetServiceMemoList(memoId); var data = new { msg = "数据加载成功!", count = 1, code = 0, data = list }; return Json(data, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); return Json(new { }, JsonRequestBehavior.AllowGet); } } [HttpGet] public ActionResult RecordList() { return View(); } [HttpPost] public JsonResult RecordListHtml(string recordId, string deptcode) { try { ConStringHelper.CompanyCode companyCode = (ConStringHelper.CompanyCode)Enum.Parse(typeof(ConStringHelper.CompanyCode), deptcode); Csvr_CallRecord_BL callRecordBL = new Csvr_CallRecord_BL(companyCode); var list = callRecordBL.GetRecordList(recordId); var data = new { msg = "数据加载成功!", count = 1, code = 0, data = list }; return Json(data, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); return Json(new { }, JsonRequestBehavior.AllowGet); } } [HttpPost] public JsonResult RecordPlay(long recordid, string deptcode) { try { ConStringHelper.CompanyCode companyCode = (ConStringHelper.CompanyCode)Enum.Parse(typeof(ConStringHelper.CompanyCode), deptcode); Csvr_CallRecord_BL callRecordBL = new Csvr_CallRecord_BL(companyCode); var host = "http://1.202.216.226:808"; var model = callRecordBL.Get(p => p.recordid == recordid); if (model == null) return Json(new retMsg { result = false, retcode = 0, retmsg = "未能找到记录,请稍后重试!" }, JsonRequestBehavior.AllowGet); var url = host + model.filename; return Json(new retMsg { result = true, retcode = 1, retmsg = url }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); return Json(new retMsg { result = false, retmsg = ex.ToString() }, JsonRequestBehavior.AllowGet); } } } }