Commit 038ee419 authored by 吴春's avatar 吴春
parents d1b322a4 090ed4e7
......@@ -369,7 +369,7 @@ namespace Mall.Module.TradePavilion
if (demodel.Id > 0)
{
#region 验证
var valistList = firstShop_ListEnrollRepository.GetList(new RB_FirstShop_ListEnroll_Extend() { MallBaseId = demodel.MallBaseId, UserId = demodel.UserId, ObjectType = demodel.ObjectType, ObjectId = demodel.ObjectId });
var valistList = firstShop_ListEnrollRepository.GetList(new RB_FirstShop_ListEnroll_Extend() { MallBaseId = demodel.MallBaseId, ListId = demodel.ListId, UserId = demodel.UserId, ObjectType = demodel.ObjectType, ObjectId = demodel.ObjectId });
if (valistList.Where(x => x.Id != demodel.Id).Any())
{
return "该品牌/载体已报名,无法重复报名";
......@@ -496,6 +496,46 @@ namespace Mall.Module.TradePavilion
return list;
}
#region 报名excel导出
/// <summary>
/// 单榜单excel导出
/// </summary>
/// <param name="listId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<ExcelDataSource> GetFirstShopListEnrollToExcel(int listId, int mallBaseId)
{
List<ExcelDataSource> RList = new List<ExcelDataSource>();
var enrollList = firstShop_ListEnrollRepository.GetList(new RB_FirstShop_ListEnroll_Extend() { MallBaseId = mallBaseId, ListId = listId });
if (enrollList.Any()) {
#region 组装头部
var enrollModel = enrollList.FirstOrDefault();
if (string.IsNullOrEmpty(enrollModel.Content))
{
return new List<ExcelDataSource>();
}
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value: "企业名称") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
},
ColumnHight = 30
};
List<FormDataItem> elist = JsonHelper.DeserializeObject<List<FormDataItem>>(enrollModel.Content);
if (elist.Any())
{
foreach (var item in elist)
{
var obj = JsonHelper.DeserializeObject<UploadItem>(item.CompData.ToString());
header.ExcelRows.Add(new ExcelColumn(value: obj.Name) { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
}
}
#endregion
}
return RList;
}
#endregion
/// <summary>
/// 设置报名状态
/// </summary>
......
......@@ -613,7 +613,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// 获取商会活动报名分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetCommerceConsultStaticPage()
[HttpPost]
public ApiResult GetConsultStaticPage()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
JObject parms = JObject.Parse(RequestParm.msg.ToString());
......@@ -630,7 +631,6 @@ namespace Mall.WebApi.Controllers.TradePavilion
}
/// <summary>
/// 根据编号获取商会活动报名实体
/// </summary>
......@@ -2195,6 +2195,41 @@ namespace Mall.WebApi.Controllers.TradePavilion
return ApiResult.Success("", pageModel);
}
/// <summary>
/// 获取榜单
/// </summary>
/// <returns></returns>
[HttpPost]
public FileContentResult GetFirstShopListEnrollToExcel() {
string ExcelName = "榜单报名" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
List<ExcelDataSource> slist = new List<ExcelDataSource>();
var req = base.RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int ListId = parms.GetInt("ListId", 0);//榜单id
if (ListId <= 0)
{
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
try
{
List<ExcelDataSource> RList = firstShopListModule.GetFirstShopListEnrollToExcel(ListId, req.MallBaseId);
slist.AddRange(RList);
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("GetFirstShopListEnrollToExcel: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
/// <summary>
/// 报名列表word导出
/// </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