/// <summary> /// 得到短信统计 /// </summary> /// <returns></returns> public ActionResult GetMessageStatList(MessageSearchDTO dto) { ResultData <List <MessageStatModel> > result = new ResultData <List <MessageStatModel> >(); result = SystemProvider.GetMessageStatList(dto); return(Json(new { total = result.Count, rows = result.Object }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出短信统计 /// </summary> /// <param name="dto"></param> /// <returns></returns> public ActionResult ExportMessageStat(MessageSearchDTO dto) { string result = null; dto.page = 1; dto.rows = 10000000; List <MessageStatModel> pp = null; pp = SystemProvider.GetMessageStatList(dto).Object; string strTemplateFile = Server.MapPath(@"~/TempLate/MessageStatTemplate.xlsx"); string strGenarateDir = Server.MapPath(@"~/TempFile"); string strGenarateFile = Guid.NewGuid().ToString("N") + ".xlsx"; string strExportFile = strGenarateDir + "\\" + strGenarateFile; List <object> ratelist = new List <object>(); pp.ForEach(g => { Models.Model.Excel.ExcelMessageStat er = new Models.Model.Excel.ExcelMessageStat(); er.部门 = g.DepartName; er.用户名称 = g.FullName; er.用户类型 = g.UserTypeName; er.手机号 = g.PhoneNumber; er.经销商 = g.UserDistributorstr; er.短信分类 = g.MessageTypeStr; er.发送日期 = g.SendTime.HasValue ? g.SendTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null; ratelist.Add(er); }); if (Common.ExcelHelper.Export(strTemplateFile, strGenarateDir, strGenarateFile, ratelist, "Sheet1")) { result = strGenarateFile; } return(Json(result)); }