Commit 074f4b14 authored by 吴春's avatar 吴春

提交代码

parent 038ee419
......@@ -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;
......@@ -507,7 +508,8 @@ 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()) {
if (enrollList.Any())
{
#region 组装头部
var enrollModel = enrollList.FirstOrDefault();
if (string.IsNullOrEmpty(enrollModel.Content))
......@@ -905,13 +907,29 @@ namespace Mall.Module.TradePavilion
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 enrollModel in listModel)
//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))
{
......@@ -922,11 +940,18 @@ namespace Mall.Module.TradePavilion
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 item in elist)
foreach (var itemFile in elist)
{
var obj = JsonHelper.DeserializeObject<UploadItem>(item.CompData.ToString());
if (item.CompKey == "ImageUploadComp")
var obj = JsonHelper.DeserializeObject<UploadItem>(itemFile.CompData.ToString());
if (itemFile.CompKey == "ImageUploadComp")
{
//图片处理
string Name = obj.Name;
......@@ -935,7 +960,7 @@ namespace Mall.Module.TradePavilion
//FileHelper.CreateImage(); 下载腾讯云至本地
}
}
else if (item.CompKey == "VideoUploadComp")
else if (itemFile.CompKey == "VideoUploadComp")
{
//视频处理
......@@ -943,8 +968,9 @@ namespace Mall.Module.TradePavilion
}
}
}
}
//ZipHelper.Zip(); 打包方法
ZipHelper.Zip(tempPath, "榜单导出文件夹",ref tempFoldr); //打包方法
#endregion
return "";
......
......@@ -2433,12 +2433,13 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </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))
if (string.IsNullOrWhiteSpace(ListIds))
{
return ApiResult.ParamIsNull("请传递绑定ids");
}
......
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