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
3ff6093a
Commit
3ff6093a
authored
Jun 10, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
3c95394c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
596 additions
and
136 deletions
+596
-136
BusinessExportEnum.cs
Mall.Common/Enum/TradePavilion/BusinessExportEnum.cs
+129
-0
ExcelTempLateHelper.cs
Mall.Common/Plugin/ExcelTempLateHelper.cs
+225
-124
RB_Brand_Extend.cs
Mall.Model/Extend/TradePavilion/RB_Brand_Extend.cs
+5
-0
RB_BrandRepository.cs
Mall.Repository/TradePavilion/RB_BrandRepository.cs
+43
-4
AppletTradeController.cs
...WebApi/Controllers/TradePavilion/AppletTradeController.cs
+15
-5
TradeController.cs
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
+179
-3
No files found.
Mall.Common/Enum/TradePavilion/BusinessExportEnum.cs
0 → 100644
View file @
3ff6093a
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Common.Plugin
;
namespace
Mall.Common.Enum.TradePavilion
{
/// <summary>
/// 品牌下载枚举列表
/// </summary>
public
enum
BusinessExportEnum
{
/// <summary>
/// 品牌分类
/// </summary>
[
EnumField
(
"品牌分类"
)]
ClassName
=
1
,
/// <summary>
/// 品牌全名
/// </summary>
[
EnumField
(
"品牌全名"
)]
FullBrandName
=
2
,
/// <summary>
/// 品牌名
/// </summary>
[
EnumField
(
"品牌名"
)]
BrandName
=
3
,
/// <summary>
/// 品牌视频
/// </summary>
[
EnumField
(
"品牌视频"
)]
VideoUrl
=
4
,
/// <summary>
/// 店铺数量
/// </summary>
[
EnumField
(
"店铺数量"
)]
ShopNum
=
5
,
/// <summary>
/// 建筑面积
/// </summary>
[
EnumField
(
"建筑面积"
)]
BuiltUpArea
=
6
,
/// <summary>
/// 需求面积
/// </summary>
[
EnumField
(
"需求面积"
)]
AreaRequirement
=
7
,
/// <summary>
/// 客群定位
/// </summary>
[
EnumField
(
"客群定位"
)]
CustomerType
=
8
,
/// <summary>
/// 品牌定位
/// </summary>
[
EnumField
(
"品牌定位"
)]
BrandType
=
9
,
/// <summary>
/// 拓店区域
/// </summary>
[
EnumField
(
"拓店区域"
)]
StoreExpansion
=
10
,
/// <summary>
/// 商铺性质
/// </summary>
[
EnumField
(
"商铺性质"
)]
ProjectType
=
11
,
/// <summary>
/// 店铺开口尺寸
/// </summary>
[
EnumField
(
"店铺开口尺寸"
)]
IsShopSize
=
12
,
/// <summary>
/// 燃气
/// </summary>
[
EnumField
(
"燃气"
)]
RanQi
=
13
,
/// <summary>
/// 排烟量
/// </summary>
[
EnumField
(
"排烟量"
)]
PaiYan
=
14
,
/// <summary>
/// 电量
/// </summary>
[
EnumField
(
"电量"
)]
IsDianLiang
=
15
,
/// <summary>
/// 上下水
/// </summary>
[
EnumField
(
"上下水"
)]
Plumbing
=
16
,
/// <summary>
/// 管径
/// </summary>
[
EnumField
(
"管径"
)]
Caliber
=
17
,
/// <summary>
/// 排污
/// </summary>
[
EnumField
(
"排污"
)]
Sewage
=
18
,
/// <summary>
/// 空调
/// </summary>
[
EnumField
(
"空调"
)]
KongTiao
=
19
,
/// <summary>
/// 新风
/// </summary>
[
EnumField
(
"新风"
)]
XinFeng
=
20
,
/// <summary>
/// 广告
/// </summary>
[
EnumField
(
"广告"
)]
Advertising
=
21
,
/// <summary>
/// 其他
/// </summary>
[
EnumField
(
"其他"
)]
Other
=
22
,
/// <summary>
/// Logo
/// </summary>
[
EnumField
(
"Logo"
)]
Logo
=
23
,
}
}
Mall.Common/Plugin/ExcelTempLateHelper.cs
View file @
3ff6093a
...
...
@@ -3,7 +3,10 @@ using NPOI.HSSF.Util;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Linq
;
namespace
Mall.Common.Plugin
{
...
...
@@ -19,7 +22,7 @@ namespace Mall.Common.Plugin
/// <param name="list">模板数据</param>
/// <param name="isTempLate">是否模板导出</param>
/// <param name="tempLatePath">模板文件路劲</param>
public
static
byte
[]
ToExcel
(
List
<
ExcelDataSource
>
list
,
bool
isTempLate
=
false
,
string
tempLatePath
=
""
)
public
static
byte
[]
ToExcel
(
List
<
ExcelDataSource
>
list
,
bool
isTempLate
=
false
,
string
tempLatePath
=
""
)
{
HSSFWorkbook
workbook
=
null
;
HSSFSheet
sheet
=
null
;
...
...
@@ -217,6 +220,9 @@ namespace Mall.Common.Plugin
}
}
/// <summary>
/// 模板导出
/// </summary>
...
...
@@ -248,6 +254,7 @@ namespace Mall.Common.Plugin
//单元格样式
HSSFCellStyle
fCellStyle
=
(
HSSFCellStyle
)
workbook
.
CreateCellStyle
();
//循环添加行
foreach
(
var
item
in
list
)
{
...
...
@@ -264,6 +271,57 @@ namespace Mall.Common.Plugin
//循环添加列
foreach
(
var
subItem
in
item
.
ExcelRows
)
{
if
(
subItem
.
Pic
==
1
&&
!
string
.
IsNullOrWhiteSpace
(
subItem
.
Value
))
{
HSSFPatriarch
patriarch
=
(
HSSFPatriarch
)
sheet
.
CreateDrawingPatriarch
();
//System.Net.WebRequest request = System.Net.WebRequest.Create(subItem.Value);
//System.Net.WebResponse response = request.GetResponse();
//Stream responseStream = response.GetResponseStream();
try
{
//byte[] bytes = new byte[1024];
//int osize = responseStream.Read(bytes, 0, (int)bytes.Length);
//while (osize > 0)
//{
// responseStream.Write(bytes, 0, osize);
// osize = responseStream.Read(bytes, 0, (int)bytes.Length);//读取当前字节流的总长度
//}
//responseStream.Flush();
int
pictureIdx
=
workbook
.
AddPicture
(
bytes
,
PictureType
.
JPEG
);
// byte[] bytes = System.IO.File.ReadAllBytes(subItem.Value);
// int pictureIdx = workbook.AddPicture(bytes, PictureType.JPEG);
// 插图片的位置 HSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2) 后面再作解释
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
columnsIndex
,
rowIndex
,
columnsIndex
+
1
,
rowIndex
+
1
);
//把图片插到相应的位置
HSSFPicture
pict
=
(
HSSFPicture
)
patriarch
.
CreatePicture
(
anchor
,
pictureIdx
);
}
finally
{
// 释放资源
//if (responseStream != null) responseStream.Close();
//if (response != null) { response.Close(); response.Dispose(); }
//if (request != null) { request.Abort(); }
}
// SetPic(workbook, patriarch, subItem.Value, sheet, rowIndex, columnsIndex);
}
else
{
var
cell
=
dataRow
.
CreateCell
(
columnsIndex
);
fCellStyle
.
WrapText
=
true
;
...
...
@@ -401,6 +459,8 @@ namespace Mall.Common.Plugin
}
cell
.
SetCellValue
(
subItem
.
Value
==
null
?
""
:
subItem
.
Value
);
}
}
rowIndex
++;
}
...
...
@@ -414,6 +474,40 @@ namespace Mall.Common.Plugin
}
private
static
void
SetPic
(
HSSFWorkbook
workbook
,
HSSFPatriarch
patriarch
,
string
path
,
ISheet
sheet
,
int
rowline
,
int
col
)
{
try
{
if
(
string
.
IsNullOrEmpty
(
path
))
return
;
System
.
Net
.
WebRequest
request
=
System
.
Net
.
WebRequest
.
Create
(
path
);
System
.
Net
.
WebResponse
response
=
request
.
GetResponse
();
Stream
responseStream
=
response
.
GetResponseStream
();
int
buffersize
=
1024
;
byte
[]
buffer
=
new
byte
[
buffersize
];
int
count
=
responseStream
.
Read
(
buffer
,
0
,
buffersize
);
while
(
count
>
0
)
{
count
=
responseStream
.
Read
(
buffer
,
0
,
buffersize
);
}
int
pictureIdx
=
workbook
.
AddPicture
(
buffer
,
PictureType
.
JPEG
);
// byte[] bytes = System.IO.File.ReadAllBytes(path);
// int pictureIdx = workbook.AddPicture(bytes, PictureType.JPEG);
// 插图片的位置 HSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2) 后面再作解释
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
70
,
10
,
0
,
0
,
col
,
rowline
,
col
+
1
,
rowline
+
1
);
//把图片插到相应的位置
HSSFPicture
pict
=
(
HSSFPicture
)
patriarch
.
CreatePicture
(
anchor
,
pictureIdx
);
}
catch
(
System
.
Exception
ex
)
{
return
;
}
}
#
region
[
颜色:
16
进制转成
RGB
]
/// <summary>
/// [颜色:16进制转成RGB]
...
...
@@ -505,11 +599,13 @@ namespace Mall.Common.Plugin
/// <param name="colspan">跨列(默认一列,不跨列)</param>
/// <param name="rowspan">跨行(默认一行,不跨行)</param>
/// <param name="selfBgColorIndex">自定义单元格背景颜色(索引)</param>
public
ExcelColumn
(
string
value
=
""
,
int
colspan
=
1
,
int
rowspan
=
1
,
short
selfBgColorIndex
=
0
)
/// <param name="isPic">0-不是图片,1-是图片</param>
public
ExcelColumn
(
string
value
=
""
,
int
colspan
=
1
,
int
rowspan
=
1
,
short
selfBgColorIndex
=
0
,
int
isPic
=
0
)
{
this
.
Value
=
value
;
this
.
Colspan
=
colspan
;
this
.
Rowspan
=
rowspan
;
this
.
Pic
=
isPic
;
this
.
SelfBgColorIndex
=
selfBgColorIndex
;
}
...
...
@@ -580,6 +676,11 @@ namespace Mall.Common.Plugin
/// 字体大小
/// </summary>
public
short
FontSize
{
get
;
set
;
}
/// <summary>
/// 1-是图片
/// </summary>
public
int
Pic
{
get
;
set
;
}
}
/// <summary>
...
...
Mall.Model/Extend/TradePavilion/RB_Brand_Extend.cs
View file @
3ff6093a
...
...
@@ -27,5 +27,10 @@ namespace Mall.Model.Extend.TradePavilion
/// 收藏id
/// </summary>
public
int
CollectId
{
get
;
set
;
}
/// <summary>
/// 导出枚举ids
/// </summary>
public
List
<
int
>
ExcelEnumIds
{
get
;
set
;
}
}
}
Mall.Repository/TradePavilion/RB_BrandRepository.cs
View file @
3ff6093a
...
...
@@ -137,6 +137,11 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
BrandClassId
),
query
.
BrandClassId
);
}
if
(
query
.
ProjectType
.
HasValue
&&
query
.
ProjectType
>
0
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
ProjectType
),
(
int
)
query
.
ProjectType
);
}
}
return
Get
<
RB_Brand_Extend
>(
builder
.
ToString
(),
parameters
).
FirstOrDefault
();
}
...
...
@@ -167,10 +172,6 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
ID
>
0
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
ID
),
query
.
ID
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
MallBaseId
),
query
.
MallBaseId
);
...
...
@@ -184,6 +185,44 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
BrandClassId
),
query
.
BrandClassId
);
}
if
(
query
.
ProjectType
.
HasValue
&&
query
.
ProjectType
>
0
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
ProjectType
),
(
int
)
query
.
ProjectType
);
}
if
(
query
.
RanQi
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
RanQi
),
query
.
RanQi
);
}
if
(
query
.
KongTiao
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
KongTiao
),
query
.
KongTiao
);
}
if
(
query
.
XinFeng
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
XinFeng
),
query
.
XinFeng
);
}
if
(
query
.
Plumbing
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
Plumbing
),
query
.
Plumbing
);
}
if
(
query
.
Caliber
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
Caliber
),
query
.
Caliber
);
}
if
(
query
.
Sewage
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
Sewage
),
query
.
Sewage
);
}
if
(
query
.
PaiYan
>
-
1
)
{
builder
.
AppendFormat
(
" AND a.{0}={1} "
,
nameof
(
RB_Brand_Extend
.
PaiYan
),
query
.
PaiYan
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
DianLiang
))
{
builder
.
AppendFormat
(
" AND a.{0} LIKE @DianLiang "
,
nameof
(
RB_Brand_Extend
.
DianLiang
));
parameters
.
Add
(
"DianLiang"
,
"%"
+
query
.
DianLiang
.
Trim
()
+
"%"
);
}
}
return
Get
<
RB_Brand_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
...
...
Mall.WebApi/Controllers/TradePavilion/AppletTradeController.cs
View file @
3ff6093a
...
...
@@ -871,7 +871,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
item
.
BannerList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
Banner
);
}
else
{
else
{
item
.
BannerList
=
new
List
<
string
>();
}
}
...
...
@@ -1134,7 +1135,13 @@ namespace Mall.WebApi.Controllers.TradePavilion
};
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
query
.
RanQi
=
-
1
;
query
.
KongTiao
=
-
1
;
query
.
XinFeng
=
-
1
;
query
.
Plumbing
=
-
1
;
query
.
Caliber
=
-
1
;
query
.
PaiYan
=
-
1
;
query
.
Sewage
=
-
1
;
var
extModel
=
carrierModule
.
GetBrand
(
query
);
if
(!
string
.
IsNullOrWhiteSpace
(
extModel
.
Banner
))
...
...
@@ -1171,6 +1178,9 @@ namespace Mall.WebApi.Controllers.TradePavilion
var
list
=
carrierModule
.
GetBrandClassList
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
}
#
endregion
#
region
关注
...
...
@@ -1186,9 +1196,9 @@ namespace Mall.WebApi.Controllers.TradePavilion
JObject
jobj
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
query
=
new
RB_Collect_Extend
()
{
Id
=
jobj
.
GetInt
(
"Id"
),
Type
=
jobj
.
GetInt
(
"Type"
),
SourceId
=
jobj
.
GetInt
(
"SourceId"
),
Id
=
jobj
.
GetInt
(
"Id"
),
Type
=
jobj
.
GetInt
(
"Type"
),
SourceId
=
jobj
.
GetInt
(
"SourceId"
),
};
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
...
...
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
View file @
3ff6093a
This diff is collapsed.
Click to expand it.
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