Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
68d59e46
Commit
68d59e46
authored
Sep 03, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
a8a5bfa3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
160 additions
and
51 deletions
+160
-51
FirstShopListModule.cs
Mall.Module.TradePavilion/FirstShopListModule.cs
+135
-47
TradeController.cs
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
+25
-4
No files found.
Mall.Module.TradePavilion/FirstShopListModule.cs
View file @
68d59e46
...
@@ -512,7 +512,8 @@ namespace Mall.Module.TradePavilion
...
@@ -512,7 +512,8 @@ namespace Mall.Module.TradePavilion
List
<
ExcelDataSource
>
RList
=
new
List
<
ExcelDataSource
>();
List
<
ExcelDataSource
>
RList
=
new
List
<
ExcelDataSource
>();
var
enrollList
=
firstShop_ListEnrollRepository
.
GetList
(
new
RB_FirstShop_ListEnroll_Extend
()
{
MallBaseId
=
mallBaseId
,
ListId
=
listId
});
var
enrollList
=
firstShop_ListEnrollRepository
.
GetList
(
new
RB_FirstShop_ListEnroll_Extend
()
{
MallBaseId
=
mallBaseId
,
ListId
=
listId
});
if
(
enrollList
.
Any
())
{
if
(
enrollList
.
Any
())
{
string
userIds
=
string
.
Join
(
","
,
enrollList
.
Select
(
x
=>
x
.
UserId
).
Distinct
());
string
userIds
=
string
.
Join
(
","
,
enrollList
.
Select
(
x
=>
x
.
UserId
).
Distinct
());
var
clist
=
companyRepository
.
GetCompanyListRepository
(
new
RB_Company_Extend
()
{
MallBaseId
=
mallBaseId
,
UserIds
=
userIds
});
var
clist
=
companyRepository
.
GetCompanyListRepository
(
new
RB_Company_Extend
()
{
MallBaseId
=
mallBaseId
,
UserIds
=
userIds
});
//查询 品牌/载体 名称 图片
//查询 品牌/载体 名称 图片
...
@@ -574,7 +575,8 @@ namespace Mall.Module.TradePavilion
...
@@ -574,7 +575,8 @@ namespace Mall.Module.TradePavilion
#
endregion
#
endregion
#
region
组装数据
#
region
组装数据
foreach
(
var
item
in
enrollList
)
{
foreach
(
var
item
in
enrollList
)
{
var
cmodel
=
clist
.
Where
(
x
=>
x
.
CreateBy
==
item
.
UserId
).
FirstOrDefault
();
var
cmodel
=
clist
.
Where
(
x
=>
x
.
CreateBy
==
item
.
UserId
).
FirstOrDefault
();
ExcelDataSource
row
=
new
ExcelDataSource
()
ExcelDataSource
row
=
new
ExcelDataSource
()
{
{
...
@@ -654,7 +656,8 @@ namespace Mall.Module.TradePavilion
...
@@ -654,7 +656,8 @@ namespace Mall.Module.TradePavilion
{
{
string
userIds
=
string
.
Join
(
","
,
enrollList
.
Select
(
x
=>
x
.
UserId
).
Distinct
());
string
userIds
=
string
.
Join
(
","
,
enrollList
.
Select
(
x
=>
x
.
UserId
).
Distinct
());
var
clist
=
companyRepository
.
GetCompanyListRepository
(
new
RB_Company_Extend
()
{
MallBaseId
=
mallBaseId
,
UserIds
=
userIds
});
var
clist
=
companyRepository
.
GetCompanyListRepository
(
new
RB_Company_Extend
()
{
MallBaseId
=
mallBaseId
,
UserIds
=
userIds
});
foreach
(
var
item
in
clist
)
{
foreach
(
var
item
in
clist
)
{
ExcelDataSource
rowData
=
new
ExcelDataSource
()
ExcelDataSource
rowData
=
new
ExcelDataSource
()
{
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
...
@@ -1035,7 +1038,9 @@ namespace Mall.Module.TradePavilion
...
@@ -1035,7 +1038,9 @@ namespace Mall.Module.TradePavilion
errorMsg
=
""
;
errorMsg
=
""
;
//存储的临时文件地址
//存储的临时文件地址
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
tempPath
=
rootBook
+
"/upfile/temporary/firstshopenrollzip/"
;
string
timeStr
=
System
.
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssffff"
);
string
endUrl
=
"upfile\\temporary\\firstshopenrollzip\\"
;
string
tempPath
=
Path
.
Combine
(
rootBook
+
endUrl
);
//获取榜单信息
//获取榜单信息
var
listModel
=
firstShop_ListRepository
.
GetList
(
new
RB_FirstShop_List_Extend
{
MallBaseId
=
mallBaseId
,
QIds
=
listIds
});
var
listModel
=
firstShop_ListRepository
.
GetList
(
new
RB_FirstShop_List_Extend
{
MallBaseId
=
mallBaseId
,
QIds
=
listIds
});
...
@@ -1051,21 +1056,8 @@ namespace Mall.Module.TradePavilion
...
@@ -1051,21 +1056,8 @@ namespace Mall.Module.TradePavilion
string
tempFoldr
=
""
;
string
tempFoldr
=
""
;
#
region
解析表单内容
#
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
listItem
in
listModel
)
{
{
foreach
(
var
enrollModel
in
enrollList
.
Where
(
x
=>
x
.
ListId
==
listItem
.
Id
))
//榜单下面的公司
foreach
(
var
enrollModel
in
enrollList
.
Where
(
x
=>
x
.
ListId
==
listItem
.
Id
))
//榜单下面的公司
{
{
if
(
string
.
IsNullOrEmpty
(
enrollModel
.
Content
))
if
(
string
.
IsNullOrEmpty
(
enrollModel
.
Content
))
...
@@ -1078,7 +1070,7 @@ namespace Mall.Module.TradePavilion
...
@@ -1078,7 +1070,7 @@ namespace Mall.Module.TradePavilion
if
(
elist
.
Any
())
if
(
elist
.
Any
())
{
{
var
companyName
=
clist
.
Where
(
x
=>
x
.
CreateBy
==
enrollModel
.
UserId
).
FirstOrDefault
()?.
CompanyName
??
System
.
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
companyName
=
clist
.
Where
(
x
=>
x
.
CreateBy
==
enrollModel
.
UserId
).
FirstOrDefault
()?.
CompanyName
??
System
.
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
templistPath
=
tempPath
+
"file/"
+
listItem
.
ListName
+
"/"
+
companyName
+
"/"
;
//路径
var
templistPath
=
Path
.
Combine
(
tempPath
+
"file\\"
+
timeStr
+
"\\"
+
listItem
.
ListName
+
"\\"
+
companyName
+
"\\"
)
;
//路径
if
(!
Directory
.
Exists
(
templistPath
))
if
(!
Directory
.
Exists
(
templistPath
))
{
{
Directory
.
CreateDirectory
(
templistPath
);
Directory
.
CreateDirectory
(
templistPath
);
...
@@ -1104,7 +1096,7 @@ namespace Mall.Module.TradePavilion
...
@@ -1104,7 +1096,7 @@ namespace Mall.Module.TradePavilion
{
{
Bitmap
bitmap
=
new
Bitmap
(
webResponse
.
GetResponseStream
());
Bitmap
bitmap
=
new
Bitmap
(
webResponse
.
GetResponseStream
());
bitmap
.
Save
(
templistPath
+
Path
.
GetFileName
(
qitem
),
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
bitmap
.
Save
(
templistPath
+
Path
.
GetFileName
(
qitem
),
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -1116,41 +1108,137 @@ namespace Mall.Module.TradePavilion
...
@@ -1116,41 +1108,137 @@ namespace Mall.Module.TradePavilion
else
if
(
itemFile
.
CompKey
==
"VideoUploadComp"
)
else
if
(
itemFile
.
CompKey
==
"VideoUploadComp"
)
{
{
//视频处理
//视频处理
//
foreach (var qitem in obj.FileList)
foreach
(
var
qitem
in
obj
.
FileList
)
//
{
{
// try
try
// {
{
// Uri uri = new Uri(qitem); //imgPath :网络图片地址
HttpWebRequest
request
=
(
HttpWebRequest
)
WebRequest
.
Create
(
qitem
);
// WebRequest webRequest = WebRequest.Create(uri);
request
.
Method
=
"GET"
;
// // byte[] bytes;
byte
[]
fileBytes
;
// using (WebResponse webResponse = webRequest.GetResponse())
using
(
WebResponse
webRes
=
request
.
GetResponse
())
// {
{
// Bitmap bitmap = new Bitmap(webResponse.GetResponseStream());
int
length
=
(
int
)
webRes
.
ContentLength
;
HttpWebResponse
response
=
webRes
as
HttpWebResponse
;
Stream
stream
=
response
.
GetResponseStream
();
var
contentdisposition
=
response
.
Headers
[
"Content-Disposition"
];
var
filename
=
Path
.
GetFileName
(
qitem
);
//读取到内存
MemoryStream
stmMemory
=
new
MemoryStream
();
byte
[]
buffer
=
new
byte
[
length
];
int
i
;
//将字节逐个放入到Byte中
while
((
i
=
stream
.
Read
(
buffer
,
0
,
buffer
.
Length
))
>
0
)
{
stmMemory
.
Write
(
buffer
,
0
,
i
);
}
fileBytes
=
stmMemory
.
ToArray
();
//文件流Byte
FileStream
fs
=
new
FileStream
(
templistPath
+
Path
.
GetFileName
(
qitem
),
FileMode
.
OpenOrCreate
);
stmMemory
.
WriteTo
(
fs
);
stmMemory
.
Close
();
fs
.
Close
();
}
}
catch
(
Exception
ex
)
{
// bitmap.Save(templistPath + Path.GetFileName(qitem), System.Drawing.Imaging.ImageFormat.Jpeg);
}
// }
}
// }
}
// catch (Exception ex)
}
// {
}
}
}
var
templistZipPath
=
Path
.
Combine
(
tempPath
+
"zip\\"
+
timeStr
+
"\\"
);
//路径
if
(!
Directory
.
Exists
(
templistZipPath
))
{
Directory
.
CreateDirectory
(
templistZipPath
);
}
bool
result
=
Common
.
Plugin
.
ZipHelper
.
Zip
(
Path
.
Combine
(
tempPath
+
"file\\"
+
timeStr
),
Path
.
Combine
(
templistZipPath
,
"榜单导出文件夹.zip"
),
ref
tempFoldr
);
if
(
result
)
{
try
{
DirectoryInfo
dir
=
new
DirectoryInfo
(
Path
.
Combine
(
tempPath
+
"file\\"
));
DirectoryInfo
[]
dirArr
=
dir
.
GetDirectories
();
foreach
(
DirectoryInfo
item
in
dirArr
)
{
if
(
item
.
Name
==
timeStr
)
{
foreach
(
FileInfo
fi
in
item
.
GetFiles
())
{
fi
.
Delete
();
}
item
.
Delete
(
true
);
}
}
// }
}
//}
catch
{
LogHelper
.
Write
(
"清理临时文件失败"
);
}
return
Path
.
Combine
(
"/upfile/temporary/firstshopenrollzip/"
+
"zip/"
+
timeStr
+
"/榜单导出文件夹.zip"
);
}
else
{
return
""
;
}
#
endregion
}
/// <summary>
/// 删除生成的zip文件
/// </summary>
/// <param name="enrollId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelFirstShopEnrollZipExport
(
string
Url
)
{
//存储的临时文件地址
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
tempPath
=
Path
.
Combine
(
rootBook
+
Url
.
TrimStart
(
'/'
));
#
region
解析表单内容
string
timeStr
=
Url
.
TrimStart
(
'/'
).
Split
(
"/"
)[
4
];
if
(!
File
.
Exists
(
tempPath
))
{
return
true
;
}
}
else
{
try
{
DirectoryInfo
dir
=
new
DirectoryInfo
(
Path
.
Combine
(
rootBook
+
"upfile\\temporary\\firstshopenrollzip\\"
+
"zip\\"
));
DirectoryInfo
[]
dirArr
=
dir
.
GetDirectories
();
foreach
(
DirectoryInfo
item
in
dirArr
)
{
if
(
item
.
Name
==
timeStr
)
{
foreach
(
FileInfo
fi
in
item
.
GetFiles
())
{
fi
.
Delete
();
}
}
item
.
Delete
(
true
);
}
}
}
}
return
true
;
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
ZipHelper
.
Zip
(
tempPath
+
"file/"
,
tempPath
+
"/zip/ziliao.zip"
,
ref
tempFoldr
);
return
false
;
}
}
// ZipFile.CreateFromDirectory(tempPath+ "file/", tempPath + "/zip/ziliao.zip");
// ZipHelper.ZipDirectory(tempPath, rootBook + "/upfile/temporary/firstshopenrollzip/榜单导出文件夹/ .zip","");
// ZipHelper.Zip(tempPath, "榜单导出文件夹",ref tempFoldr); //打包方法
#
endregion
#
endregion
return
""
;
}
}
}
}
}
}
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
View file @
68d59e46
...
@@ -621,7 +621,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -621,7 +621,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
var
query
=
new
RB_Commerce_Consult_Extend
()
var
query
=
new
RB_Commerce_Consult_Extend
()
{
{
LinkMan
=
parms
.
GetStringValue
(
"LinkMan"
),
LinkMan
=
parms
.
GetStringValue
(
"LinkMan"
),
ActivityId
=
parms
.
GetInt
(
"ActivityId"
)
ActivityId
=
parms
.
GetInt
(
"ActivityId"
)
};
};
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
...
@@ -676,7 +676,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -676,7 +676,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
foreach
(
var
sItem
in
item
.
SignUserList
)
foreach
(
var
sItem
in
item
.
SignUserList
)
{
{
var
excelColumns
=
new
List
<
ExcelColumn
>(
30
);
var
excelColumns
=
new
List
<
ExcelColumn
>(
30
);
if
(
index
==
0
)
if
(
index
==
0
)
{
{
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
item
.
UserName
)
{
Rowspan
=
item
.
RowSpan
});
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
.
CompanyStatusStr
)
{
Rowspan
=
item
.
RowSpan
});
...
@@ -2285,7 +2285,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -2285,7 +2285,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
FileContentResult
GetFirstShopListEnrollToExcel
()
{
public
FileContentResult
GetFirstShopListEnrollToExcel
()
{
string
ExcelName
=
"榜单报名"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
string
ExcelName
=
"榜单报名"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
...
@@ -2548,7 +2549,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -2548,7 +2549,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// <summary>
/// <summary>
/// 报名列表
word
导出
/// 报名列表
批量
导出
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
...
@@ -2574,6 +2575,26 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -2574,6 +2575,26 @@ namespace Mall.WebApi.Controllers.TradePavilion
}
}
}
}
/// <summary>
/// 删除生成的zip文件
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
DelFirstShopEnrollZipExport
()
{
var
req
=
base
.
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
string
ListIds
=
parms
.
GetStringValue
(
"Url"
);
if
(
string
.
IsNullOrWhiteSpace
(
ListIds
))
{
return
ApiResult
.
ParamIsNull
(
"请传递文件路径"
);
}
bool
result
=
firstShopListModule
.
DelFirstShopEnrollZipExport
(
ListIds
);
return
ApiResult
.
Success
(
""
);
}
#
endregion
#
endregion
#
region
心愿单列表
#
region
心愿单列表
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment