Commit ec25f81b authored by liudong1993's avatar liudong1993

1

parents 5ed8adb0 f7229c80
......@@ -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;
......
......@@ -75,5 +75,11 @@ namespace Mall.Model.Extend.TradePavilion
/// </summary>
public int RankListState { get; set; }
#endregion
/// <summary>
/// 查询多个榜单
/// </summary>
public string QIds { get; set; }
}
}
......@@ -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);
}
......
......@@ -6,6 +6,7 @@ using Mall.Repository.TradePavilion;
using Mall.Repository.User;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using VT.FW.DB;
......@@ -452,17 +453,19 @@ namespace Mall.Module.TradePavilion
public List<RB_FirstShop_ListEnroll_Extend> GetFirstShopEnrollPageList(int pageIndex, int pageSize, out long count, RB_FirstShop_ListEnroll_Extend demodel)
{
var list = firstShop_ListEnrollRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
if (list.Any())
{
string userIds = string.Join(",", list.Select(x => x.UserId).Distinct());
//企业名称
var companylist = companyRepository.GetCompanyListRepository(new RB_Company_Extend() { MallBaseId = demodel.MallBaseId, UserIds = userIds });
foreach (var item in list) {
foreach (var item in list)
{
var companyModel = companylist.Where(x => x.CreateBy == item.UserId).FirstOrDefault();
item.CompanyName = companyModel.CompanyName;
item.Principal = companyModel.Principal;
item.Mobile = companyModel.Mobile;
}
//查询 品牌/载体 名称 图片
var e1list = list.Where(x => x.ObjectType == Common.Enum.TradePavilion.ListObjectTypeEnum.Brand).ToList();
var e2list = list.Where(x => x.ObjectType == Common.Enum.TradePavilion.ListObjectTypeEnum.Carrier).ToList();
......@@ -505,6 +508,7 @@ namespace Mall.Module.TradePavilion
{
List<ExcelDataSource> RList = new List<ExcelDataSource>();
var enrollList = firstShop_ListEnrollRepository.GetList(new RB_FirstShop_ListEnroll_Extend() { MallBaseId = mallBaseId, ListId = listId });
if (enrollList.Any()) {
string userIds = string.Join(",", enrollList.Select(x => x.UserId).Distinct());
var clist = companyRepository.GetCompanyListRepository(new RB_Company_Extend() { MallBaseId = mallBaseId, UserIds = userIds });
......@@ -697,7 +701,8 @@ namespace Mall.Module.TradePavilion
//重置
keyValues.Add(nameof(RB_FirstShop_ListEnroll_Extend.CandidateState), 1);
}
else {
else
{
return "状态有误,请核实后再试";
}
List<WhereHelper> wheres = new List<WhereHelper>() {
......@@ -786,7 +791,8 @@ namespace Mall.Module.TradePavilion
//首先清除历史评比
firstShop_ListEnrollRepository.ClearHostoryAppraisal(listId, mallBaseId);
int RankListState = type == 1 ? 3 : 2;
if (type == 1) {
if (type == 1)
{
//设置榜单为已放榜
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_FirstShop_List_Extend.ListState),Common.Enum.TradePavilion.ListStateEnum.Confirmed},
......@@ -802,7 +808,8 @@ namespace Mall.Module.TradePavilion
};
firstShop_ListRepository.Update(keyValues, wheres);
}
foreach (var item in deList) {
foreach (var item in deList)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_FirstShop_ListEnroll_Extend.Reviews),item.Reviews },
{ nameof(RB_FirstShop_ListEnroll_Extend.Rank),item.Rank },
......@@ -958,7 +965,7 @@ namespace Mall.Module.TradePavilion
if (enrollModel == null) { errorMsg = "报名信息不存在"; return ""; }
//获取榜单信息
var listModel = firstShop_ListRepository.GetEntity(enrollModel.ListId);
if (listModel == null) { errorMsg = "榜单不存在";return ""; }
if (listModel == null) { errorMsg = "榜单不存在"; return ""; }
//创建一个临时文件夹
string tempFoldr = "";
......@@ -975,13 +982,15 @@ namespace Mall.Module.TradePavilion
if (elist.Any())
{
//开始下载图片视频至临时文件
foreach (var item in elist) {
foreach (var item in elist)
{
var obj = JsonHelper.DeserializeObject<UploadItem>(item.CompData.ToString());
if (item.CompKey == "ImageUploadComp")
{
//图片处理
string Name = obj.Name;
foreach (var qitem in obj.FileList) {
foreach (var qitem in obj.FileList)
{
//FileHelper.CreateImage(); 下载腾讯云至本地
}
}
......@@ -1009,5 +1018,96 @@ namespace Mall.Module.TradePavilion
{
return "";
}
/// <summary>
/// 榜单报名下载word 单次
/// </summary>
/// <param name="enrollId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public string GetFirstShopEnrollZipExport(string listIds, int mallBaseId, out string errorMsg)
{
errorMsg = "";
//存储的临时文件地址
string rootBook = AppDomain.CurrentDomain.BaseDirectory;
string tempPath = rootBook + "/upfile/temporary/firstshopenrollzip";
//获取榜单信息
var listModel = firstShop_ListRepository.GetList(new RB_FirstShop_List_Extend { MallBaseId = mallBaseId, QIds = listIds });
if (listModel == null || !listModel.Any()) { errorMsg = "榜单不存在"; return ""; }
var enrollList = firstShop_ListEnrollRepository.GetList(new RB_FirstShop_ListEnroll_Extend { MallBaseId = mallBaseId, ListIds = listIds });
if (enrollList == null || !enrollList.Any()) { errorMsg = "报名信息不存在"; return ""; }
string userIds = string.Join(",", enrollList.Select(x => x.UserId).Distinct());
var clist = companyRepository.GetCompanyListRepository(new RB_Company_Extend() { MallBaseId = mallBaseId, UserIds = userIds });
//创建一个临时文件夹
string tempFoldr = "";
#region 解析表单内容
//foreach (var item in enrollList.Where(x => x.ListId == enrollModel.Id).GroupBy(x => x.UserId))//榜单下面的公司
//{
// var companyName = clist.Where(x => x.CreateBy == item.Key).FirstOrDefault()?.CompanyName ?? System.DateTime.Now.ToString("yyyyMMddHHmmssfff");
// var templistPath = rootBook + "/upfile/temporary/firstshopenrollzip/" + enrollModel.ListName + "/" + companyName;//路径
// if (!Directory.Exists(templistPath))
// {
// Directory.CreateDirectory(templistPath);
// }
//}
foreach (var listItem in listModel)
{
foreach (var enrollModel in enrollList.Where(x => x.ListId == listItem.Id))//榜单下面的公司
{
if (string.IsNullOrEmpty(enrollModel.Content))
{
errorMsg = "报名内容不存在,请核实后再试";
return "";
}
List<FormDataItem> elist = JsonHelper.DeserializeObject<List<FormDataItem>>(enrollModel.Content);
elist = elist.Where(x => x.CompKey == "ImageUploadComp" || x.CompKey == "VideoUploadComp").ToList();
if (elist.Any())
{
var companyName = clist.Where(x => x.CreateBy == enrollModel.UserId).FirstOrDefault()?.CompanyName ?? System.DateTime.Now.ToString("yyyyMMddHHmmssfff");
var templistPath = rootBook + "/upfile/temporary/firstshopenrollzip/" + listItem.ListName + "/" + companyName;//路径
if (!Directory.Exists(templistPath))
{
Directory.CreateDirectory(templistPath);
}
//开始下载图片视频至临时文件
foreach (var itemFile in elist)
{
var obj = JsonHelper.DeserializeObject<UploadItem>(itemFile.CompData.ToString());
if (itemFile.CompKey == "ImageUploadComp")
{
//图片处理
string Name = obj.Name;
foreach (var qitem in obj.FileList)
{
//FileHelper.CreateImage(); 下载腾讯云至本地
}
}
else if (itemFile.CompKey == "VideoUploadComp")
{
//视频处理
}
}
}
}
}
ZipHelper.Zip(tempPath, "榜单导出文件夹",ref tempFoldr); //打包方法
#endregion
return "";
}
}
}
......@@ -123,6 +123,10 @@ where {where} {orderBy}
{
where += $@" and find_in_set('{dmodel.ObjectTypeId}',w.{nameof(RB_FirstShop_List_Extend.ListType)})";
}
if (!string.IsNullOrWhiteSpace(dmodel.QIds))
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.Id)} in ({dmodel.QIds})";
}
if (dmodel.ListState > 0)
{
if (dmodel.ListState == Common.Enum.TradePavilion.ListStateEnum.Enroll)
......
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Mall.Common.API;
using Mall.WebApi.Controllers.User;
using Microsoft.AspNetCore.Mvc;
using NPOI.XWPF.UserModel;
namespace Mall.WebApi.Controllers.Export
{
......
......@@ -613,13 +613,15 @@ 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());
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;
......@@ -629,7 +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>
/// 根据编号获取商会活动报名实体
......@@ -2275,7 +2360,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");
}
......@@ -2285,7 +2370,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
return ApiResult.Success("", path);
}
else {
else
{
return ApiResult.Failed(errmsg);
}
}
......@@ -2295,11 +2381,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 + "]");
......@@ -2459,6 +2547,37 @@ namespace Mall.WebApi.Controllers.TradePavilion
x.ObjectIcon,
}));
}
/// <summary>
/// 报名列表word导出
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetFirstShopEnrollZipExport()
{
var req = base.RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string ListIds = parms.GetStringValue("ListIds");
if (string.IsNullOrWhiteSpace(ListIds))
{
return ApiResult.ParamIsNull("请传递绑定ids");
}
string path = firstShopListModule.GetFirstShopEnrollZipExport(ListIds, req.MallBaseId, out string errmsg);
if (errmsg == "")
{
return ApiResult.Success("", path);
}
else
{
return ApiResult.Failed(errmsg);
}
}
#endregion
#region 心愿单列表
......
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