public JsonResult SelectRebateConfig(Status status, string orderId, string phone, string wxId, string remarks, string wxName, string timeType, DateTime?startTime, DateTime?endTime, string principalPerson, string rebateMoney, string source, int?installShopId, int pageIndex = 1, int pageSize = 10) { RebateConfigManager manager = new RebateConfigManager(); var result = manager.SelectRebateConfig(status, orderId, phone, wxId, remarks, timeType, startTime, endTime, wxName, principalPerson, rebateMoney, source, installShopId, pageIndex, pageSize); return(Json(result, JsonRequestBehavior.AllowGet)); }
//public JsonResult UpdateRebateTimeToComplete() //{ // RebateConfigManager manager = new RebateConfigManager(); // if (UserPower.Contains(User.Identity.Name)) // { // var result = manager.UpdateRebateTimeToComplete(); // return Json(JsonConvert.SerializeObject(result), JsonRequestBehavior.AllowGet); // } // else // { // return Json(false, JsonRequestBehavior.AllowGet); // } //} //public JsonResult UpdateWxName(string pkidStr) //{ // var result = false; // var msg = string.Empty; // RebateConfigManager manager = new RebateConfigManager(); // if (UserPower.Contains(User.Identity.Name)) // { // var data = manager.UpdateWxName(pkidStr.Split(',').ToList()); // result = data.Item1; // msg = data.Item2; // } // return Json(new { result = result, msg = msg }, JsonRequestBehavior.AllowGet); //} public FileResult ExportRebateConfigInfo(Status status, string orderId, string phone, string wxId, string remarks, string timeType, DateTime?startTime, string wxName, DateTime?endTime, string principalPerson, string rebateMoney, string source, int?installShopId, int pageIndex = 1, int pageSize = 10) { var workBook = new XSSFWorkbook(); var sheet = workBook.CreateSheet(); var row = sheet.CreateRow(0); var cellNum = 0; row.CreateCell(cellNum++).SetCellValue("返现编号"); row.CreateCell(cellNum++).SetCellValue("订单号"); //row.CreateCell(cellNum++).SetCellValue("手机号"); //row.CreateCell(cellNum++).SetCellValue("微信号"); row.CreateCell(cellNum++).SetCellValue("微信昵称"); row.CreateCell(cellNum++).SetCellValue("状态"); row.CreateCell(cellNum++).SetCellValue("百度ID"); row.CreateCell(cellNum++).SetCellValue("百度吧名"); row.CreateCell(cellNum++).SetCellValue("红包专员"); row.CreateCell(cellNum++).SetCellValue("用户名称"); row.CreateCell(cellNum++).SetCellValue("车牌号"); row.CreateCell(cellNum++).SetCellValue("来源"); row.CreateCell(cellNum++).SetCellValue("内容链接"); row.CreateCell(cellNum++).SetCellValue("返现金额"); row.CreateCell(cellNum++).SetCellValue("返现时间"); row.CreateCell(cellNum++).SetCellValue("备注"); row.CreateCell(cellNum++).SetCellValue("申请时间"); row.CreateCell(cellNum++).SetCellValue("审核时间"); row.CreateCell(cellNum++).SetCellValue("拒绝原因"); row.CreateCell(cellNum++).SetCellValue("新老数据"); cellNum = 0; sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); sheet.SetColumnWidth(cellNum++, 18 * 256); RebateConfigManager manager = new RebateConfigManager(); List <RebateConfigModel> result = new List <RebateConfigModel>(); result = manager.SelectRebateConfig(status, orderId, phone, wxId, remarks, timeType, startTime, endTime, wxName, principalPerson, rebateMoney, source, installShopId, pageIndex, 9999999); if (result != null && result.Any()) { for (var i = 0; i < result.Count(); i++) { cellNum = 0; NPOI.SS.UserModel.IRow rowTemp = sheet.CreateRow(i + 1); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].PKID); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].OrderId); //rowTemp.CreateCell(cellNum++).SetCellValue(result[i].UserPhone); //rowTemp.CreateCell(cellNum++).SetCellValue(result[i].WXId); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].WXName); rowTemp.CreateCell(cellNum++).SetCellValue(ConvertStatus(result[i].Status)); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].BaiDuId); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].BaiDuName); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].PrincipalPerson); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].UserName); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].CarNumber); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].Source); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].ContentUrl); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].RebateMoney.ToString("f2")); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].RebateTime?.ToString() ?? string.Empty); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].Remarks); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].CreateTime.ToString()); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].CheckTime.ToString()); rowTemp.CreateCell(cellNum++).SetCellValue(result[i].RefusalReason?.ToString() ?? string.Empty); rowTemp.CreateCell(cellNum++).SetCellValue(!string.IsNullOrEmpty(result[i].OpenId) ? "新" : "老"); } } var ms = new MemoryStream(); workBook.Write(ms); return(File(ms.ToArray(), "application/x-xls", $"{DateTime.Now.ToString("yyyy年MM月dd日HH时mm分ss秒")}.xlsx")); }