Commit 9a905338 authored by liudong1993's avatar liudong1993

点数订单excel导出

parent d56bc07e
......@@ -234,7 +234,6 @@ namespace Mall.WebApi.Controllers.Education
[HttpPost]
public ApiResult GetPointOrderPageList()
{
var parms = RequestParm;
var userInfo = UserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Point_TeacherCourseOrder_Extend demodel = JsonConvert.DeserializeObject<RB_Point_TeacherCourseOrder_Extend>(RequestParm.msg.ToString());
......@@ -314,7 +313,81 @@ namespace Mall.WebApi.Controllers.Education
});
}
/// <summary>
/// 约课订单excel下载
/// </summary>
[HttpPost]
public FileContentResult GetPointOrderListToExcel()
{
var userInfo = UserInfo;
RB_Point_TeacherCourseOrder_Extend demodel = JsonConvert.DeserializeObject<RB_Point_TeacherCourseOrder_Extend>(RequestParm.msg.ToString());
string ExcelName = "约课列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
List<ExcelDataSource> slist = new List<ExcelDataSource>();
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value: "单号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "课程分类") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "课程名称") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "教师") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "学习时间") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "学习时长") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "学习总时长") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "房间信息") { CellWidth = 25, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "总点数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "实际点数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "基础点数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "用户名称") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "报名时间") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "状态") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
}
};
slist.Add(header);
try
{
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
var list = pointModule.GetPointOrderPageList(1, 99999, out long count, demodel);
#region 组装数据
foreach (var item in list)
{
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value:item.ID.ToString()){ },
new ExcelColumn(value:item.CourseClassType.GetEnumName()){ },
new ExcelColumn(value:item.CourseName){ },
new ExcelColumn(value:item.TeacherName){ },
new ExcelColumn(value:item.StudyDate.ToString("yyyy-MM-dd HH:mm")){ },
new ExcelColumn(value:item.StudyDuration.ToString()){ },
new ExcelColumn(value:item.TotalStudyDuration.ToString()){ },
new ExcelColumn(value:item.RoomInfo){ },
new ExcelColumn(value:item.TotalPointNum.ToString()){ },
new ExcelColumn(value:item.ActualPointNum.ToString()){ },
new ExcelColumn(value:item.BasePointNum.ToString()){ },
new ExcelColumn(value:item.UserName + "("+item.UserId.ToString()+")"){ },
new ExcelColumn(value:(item.CreateDate.HasValue ? item.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")){ },
new ExcelColumn(value:item.OrderStaus.GetEnumName()){ },
},
ColumnHight = 30
};
slist.Add(datarow);
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("GetFileFromWebApi_requestData: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
/// <summary>
/// 获取订单状态枚举
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment