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
912de17b
Commit
912de17b
authored
Dec 11, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入调整
parent
4b801e40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
377 additions
and
147 deletions
+377
-147
NPOIHelper.cs
Mall.Common/Plugin/NPOIHelper.cs
+230
-143
BrandHelper.cs
Mall.DataHelper/Import/BrandHelper.cs
+128
-0
RB_Brand_Enterprise_Extend.cs
....Model/Extend/TradePavilion/RB_Brand_Enterprise_Extend.cs
+1
-1
RB_MiniProgramRepository.cs
Mall.Repository/User/RB_MiniProgramRepository.cs
+2
-2
YBTradeController.cs
Mall.WebApi/Controllers/TradePavilion/YBTradeController.cs
+1
-1
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+15
-0
No files found.
Mall.Common/Plugin/NPOIHelper.cs
View file @
912de17b
This diff is collapsed.
Click to expand it.
Mall.DataHelper/Import/BrandHelper.cs
0 → 100644
View file @
912de17b
using
Mall.Common
;
using
Mall.Model.Extend.Product
;
using
Mall.Model.Extend.TradePavilion
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Text
;
namespace
Mall.DataHelper.Import
{
/// <summary>
/// 品牌导入帮助类
/// </summary>
public
class
BrandHelper
{
/// <summary>
/// 导入模板
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public
static
List
<
RB_Brand_Enterprise_Extend
>
ImportYBBrandData
(
string
fileName
,
string
tempFilePath
)
{
//图片所在的列
List
<
int
>
imgColList
=
new
List
<
int
>();
imgColList
.
Add
(
1
);
List
<
RB_Brand_Enterprise_Extend
>
list
=
new
List
<
RB_Brand_Enterprise_Extend
>();
DataTable
dt
=
Mall
.
Common
.
Plugin
.
NPOIHelper
.
ImportYBExceltoDt
(
fileName
,
0
,
1
,
true
,
imgColList
:
imgColList
,
tempFilePath
:
tempFilePath
);
if
(
dt
!=
null
&&
dt
.
Rows
.
Count
>
0
)
{
foreach
(
DataRow
dr
in
dt
.
Rows
)
{
list
.
Add
(
DataRowToModel
(
dr
));
}
}
return
list
;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
public
static
RB_Brand_Enterprise_Extend
DataRowToModel
(
DataRow
dr
)
{
RB_Brand_Enterprise_Extend
model
=
new
RB_Brand_Enterprise_Extend
();
if
(
dr
!=
null
)
{
if
(
dr
.
Table
.
Columns
.
Contains
(
"品牌名称"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"品牌名称"
].
ToString
().
Trim
()))
{
model
.
BrandName
=
dr
[
"品牌名称"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"Logo"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"Logo"
].
ToString
().
Trim
()))
{
model
.
Logo
=
dr
[
"Logo"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"介绍图"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"介绍图"
].
ToString
().
Trim
()))
{
model
.
Banner
=
dr
[
"介绍图"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"品牌视频地址"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"品牌视频地址"
].
ToString
().
Trim
()))
{
model
.
VideoUrl
=
dr
[
"品牌视频地址"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"品牌分类"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"品牌分类"
].
ToString
().
Trim
()))
{
model
.
CategoryName
=
dr
[
"品牌分类"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"店铺数量"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"店铺数量"
].
ToString
().
Trim
()))
{
Int32
.
TryParse
(
dr
[
"店铺数量"
].
ToString
(),
out
int
ShopNum
);
model
.
ShopNum
=
ShopNum
;
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"建筑面积(㎡)"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"建筑面积(㎡)"
].
ToString
().
Trim
()))
{
var
tempArray
=
dr
[
"建筑面积(㎡)"
].
ToString
().
Split
(
'-'
);
if
(
tempArray
!=
null
&&
tempArray
.
Length
==
2
)
{
decimal
.
TryParse
(
tempArray
[
0
].
ToString
(),
out
decimal
BuiltUpArea
);
model
.
BuiltUpArea
=
BuiltUpArea
;
decimal
.
TryParse
(
tempArray
[
1
].
ToString
(),
out
decimal
EndBuiltUpArea
);
model
.
EndBuiltUpArea
=
EndBuiltUpArea
;
}
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"需求面积(㎡)"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"需求面积(㎡)"
].
ToString
().
Trim
()))
{
var
tempArray
=
dr
[
"需求面积(㎡)"
].
ToString
().
Split
(
'-'
);
if
(
tempArray
!=
null
&&
tempArray
.
Length
==
2
)
{
decimal
.
TryParse
(
tempArray
[
0
].
ToString
(),
out
decimal
AreaRequirement
);
model
.
AreaRequirement
=
AreaRequirement
;
decimal
.
TryParse
(
tempArray
[
1
].
ToString
(),
out
decimal
EndAreaRequirement
);
model
.
EndAreaRequirement
=
EndAreaRequirement
;
}
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"客群定位"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"客群定位"
].
ToString
().
Trim
()))
{
model
.
CustomerType
=
dr
[
"客群定位"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"品牌定位"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"品牌定位"
].
ToString
().
Trim
()))
{
model
.
BrandType
=
dr
[
"品牌定位"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"合作条件"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"合作条件"
].
ToString
().
Trim
()))
{
model
.
Cooperation
=
dr
[
"合作条件"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"物业需求"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"物业需求"
].
ToString
().
Trim
()))
{
model
.
PropertyDemand
=
dr
[
"物业需求"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"配套需求"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"配套需求"
].
ToString
().
Trim
()))
{
model
.
Complementary
=
dr
[
"配套需求"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"品牌简介"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"品牌简介"
].
ToString
().
Trim
()))
{
model
.
Introduce
=
dr
[
"品牌简介"
].
ToString
();
}
}
return
model
;
}
}
}
Mall.Model/Extend/TradePavilion/RB_Brand_Enterprise_Extend.cs
View file @
912de17b
...
...
@@ -7,7 +7,7 @@ using System.Text;
namespace
Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 【商载通】 品牌
、企业服务
扩展 实体表
/// 【商载通】 品牌 扩展 实体表
/// </summary>
public
class
RB_Brand_Enterprise_Extend
:
RB_Brand_Enterprise
{
...
...
Mall.Repository/User/RB_MiniProgramRepository.cs
View file @
912de17b
...
...
@@ -77,10 +77,10 @@ namespace Mall.Repository.User
if
(
query
.
MiniAppId
!=
null
&&
!
string
.
IsNullOrEmpty
(
query
.
MiniAppId
))
{
builder
.
AppendFormat
(
" AND MiniAppId=@MiniAppId "
);
parameters
.
Add
(
"MiniAppId"
,
query
.
MiniAppId
.
Trim
());
parameters
.
Add
(
"MiniAppId"
,
query
.
MiniAppId
.
Trim
());
}
}
return
Get
<
RB_MiniProgram_Extend
>(
builder
.
ToString
(),
parameters
).
FirstOrDefault
();
return
Get
<
RB_MiniProgram_Extend
>(
builder
.
ToString
(),
parameters
).
FirstOrDefault
();
}
/// <summary>
...
...
Mall.WebApi/Controllers/TradePavilion/YBTradeController.cs
View file @
912de17b
...
...
@@ -530,7 +530,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
ServiceId
=
parms
.
GetInt
(
"ServiceId"
),
Name
=
parms
.
GetStringValue
(
"Name"
),
Introduction
=
parms
.
GetStringValue
(
"
FullBIntroductionrandName
"
),
Introduction
=
parms
.
GetStringValue
(
"
Introduction
"
),
DevIntention
=
parms
.
GetStringValue
(
"DevIntention"
),
Address
=
parms
.
GetStringValue
(
"Address"
),
LatAndLon
=
parms
.
GetStringValue
(
"LatAndLon"
),
...
...
Mall.WebApi/Controllers/User/TenantController.cs
View file @
912de17b
...
...
@@ -22,6 +22,8 @@ using Mall.Model.Extend.AppletWeChat;
using
Mall.Module.User
;
using
Dnc.Api.Throttle
;
using
Mall.WebApi.Helper
;
using
Mall.DataHelper.Import
;
using
System.IO
;
namespace
Mall.WebApi.Controllers.User
{
...
...
@@ -2196,5 +2198,18 @@ namespace Mall.WebApi.Controllers.User
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
}
#
endregion
/// <summary>
/// 测试宜宾品牌数据导入
/// </summary>
/// <returns></returns>
public
ApiResult
TestYBBrandImport
()
{
string
rootPath
=
Path
.
Combine
(
Directory
.
GetCurrentDirectory
(),
"upfile"
);
string
filePath
=
rootPath
+
@"\宜宾模板文件.xlsx"
;
string
tempPath
=
rootPath
+
@"\TempImg"
;
var
list
=
BrandHelper
.
ImportYBBrandData
(
filePath
,
tempPath
);
return
ApiResult
.
Success
(
data
:
Common
.
Plugin
.
JsonHelper
.
Serialize
(
list
));
}
}
}
\ No newline at end of file
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