Commit f7229c80 authored by 吴春's avatar 吴春
parents 074f4b14 315cee32
......@@ -103,7 +103,7 @@ namespace Mall.Common.Plugin
{
Type type = obj.GetType();
FieldInfo fild = type.GetField(obj.ToString());
if (fild.IsDefined(typeof(EnumFieldAttribute), true))
if (fild!=null &&fild.IsDefined(typeof(EnumFieldAttribute), true))
{
EnumFieldAttribute enumField = (EnumFieldAttribute)fild.GetCustomAttribute(typeof(EnumFieldAttribute), true);
return enumField.Name;
......
......@@ -123,7 +123,7 @@ namespace Mall.Module.TradePavilion
CompanyName = authModel?.CompanyName ?? "",
FirstShopTypeName = FirstShopTypeName,
AuthName = AuthName,
RowSpan=1,
RowSpan=0,
SignUserList = new List<SignUserItem>(),
};
var tempList = subList?.Where(qitem => qitem.UserId == item.UserId && qitem.ActivityId == item.ActivityId)?.ToList();
......@@ -144,7 +144,7 @@ namespace Mall.Module.TradePavilion
};
activity.SignUserList.Add(signUser);
}
activity.RowSpan = tempList.Count;
activity.RowSpan = tempList.Count > 1 ? tempList.Count : 0;
}
result.Add(activity);
}
......
......@@ -613,14 +613,15 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// 获取商会活动报名分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpPost]
public ApiResult GetConsultStaticPage()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_Commerce_Consult_Extend()
{
LinkMan = parms.GetStringValue("LinkMan")
LinkMan = parms.GetStringValue("LinkMan"),
ActivityId=parms.GetInt("ActivityId")
};
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
......@@ -630,6 +631,90 @@ namespace Mall.WebApi.Controllers.TradePavilion
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public FileContentResult DownLoadConsultStatic()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
pageModel.pageSize = 100000;
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_Commerce_Consult_Extend()
{
LinkMan = parms.GetStringValue("LinkMan"),
ActivityId = parms.GetInt("ActivityId")
};
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = consultModule.GetCommerceConsultPageModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
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 = 25, 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 = 20, 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 = 30, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
},
};
slist.Add(header);
try
{
#region 组装数据
foreach (var item in list)
{
int index = 0;
foreach (var sItem in item.SignUserList)
{
var excelColumns = new List<ExcelColumn>(30);
if (index == 0 )
{
excelColumns.Add(new ExcelColumn(value: item.UserName) { Rowspan = item.RowSpan });
excelColumns.Add(new ExcelColumn(value: item.CompanyStatusStr) { Rowspan = item.RowSpan });
excelColumns.Add(new ExcelColumn(value: item.CompanyName) { Rowspan = item.RowSpan });
excelColumns.Add(new ExcelColumn(value: item.AuthName) { Rowspan = item.RowSpan });
}
else
{
excelColumns.Add(new ExcelColumn(value: ""));
excelColumns.Add(new ExcelColumn(value: ""));
excelColumns.Add(new ExcelColumn(value: ""));
excelColumns.Add(new ExcelColumn(value: ""));
}
excelColumns.Add(new ExcelColumn(value: sItem.CompanyName));
excelColumns.Add(new ExcelColumn(value: sItem.Nature));
excelColumns.Add(new ExcelColumn(value: sItem.LinkMan));
excelColumns.Add(new ExcelColumn(value: sItem.LinkTel));
excelColumns.Add(new ExcelColumn(value: sItem.Post));
excelColumns.Add(new ExcelColumn(value: sItem.CountryInfo));
index++;
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = excelColumns
};
slist.Add(datarow);
}
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("DownLoadConsultStatic_requestData: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
/// <summary>
/// 根据编号获取商会活动报名实体
......@@ -2240,7 +2325,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
var req = base.RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int EnrollId = parms.GetInt("EnrollId", 0);
if (EnrollId <=0)
if (EnrollId <= 0)
{
return ApiResult.ParamIsNull("请传递报名id");
}
......@@ -2250,7 +2335,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
return ApiResult.Success("", path);
}
else {
else
{
return ApiResult.Failed(errmsg);
}
}
......@@ -2260,11 +2346,13 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFirstShopEnrollWordExportBatch() {
public ApiResult GetFirstShopEnrollWordExportBatch()
{
var req = base.RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string EnrollIds = parms.GetStringValue("EnrollIds");//报名ids 英文逗号分隔
if (string.IsNullOrEmpty(EnrollIds)) {
if (string.IsNullOrEmpty(EnrollIds))
{
return ApiResult.ParamIsNull("请传递报名ids");
}
List<int> EnrollIdList = JsonHelper.DeserializeObject<List<int>>("[" + EnrollIds + "]");
......
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