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
Show 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
using
NPOI.HPSF
;
using
NPOI.HSSF.UserModel
;
using
NPOI.HSSF.Util
;
using
NPOI.SS.Formula.Eval
;
using
NPOI.SS.Formula.Eval
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
NPOI.XSSF.UserModel
;
using
NPOI.XWPF.UserModel
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
using
System.Web
;
namespace
Mall.Common.Plugin
{
...
...
@@ -130,7 +120,8 @@ namespace Mall.Common.Plugin
{
if
(
row
.
GetCell
(
j
)
!=
null
)
{
switch
(
row
.
GetCell
(
j
).
CellType
)
CellType
CellTypeEnum
=
row
.
GetCell
(
j
).
CellType
;
switch
(
CellTypeEnum
)
{
case
CellType
.
String
:
String
str
=
row
.
GetCell
(
j
).
StringCellValue
;
...
...
@@ -216,174 +207,270 @@ namespace Mall.Common.Plugin
#
endregion
/// <summary>
///
判断是否为数字
///
读取excel
/// </summary>
/// <param name="message"></param>
/// <param name="result"></param>
/// <param name="strFileName">excel文件路径</param>
/// <param name="SheetIndex">需要导出的sheet序号</param>
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">列头</param>
/// <param name="imgColList">图片所在的列</param>
/// <param name="imgColList">图片保存路径</param>
/// <returns></returns>
public
static
bool
IsNumeric
(
String
message
,
out
double
result
)
public
static
DataTable
ImportYBExceltoDt
(
String
strFileName
,
int
SheetIndex
,
int
HeaderRowIndex
,
bool
needHeader
,
List
<
int
>
imgColList
=
null
,
string
tempFilePath
=
""
)
{
Regex
rex
=
new
Regex
(
@"^[-]?\d+[.]?\d*$"
);
result
=
-
1
;
if
(
rex
.
IsMatch
(
message
))
IWorkbook
wb
;
using
(
FileStream
file
=
new
FileStream
(
strFileName
,
FileMode
.
Open
,
FileAccess
.
Read
))
{
result
=
double
.
Parse
(
message
);
return
true
;
wb
=
WorkbookFactory
.
Create
(
file
);
}
else
return
false
;
ISheet
sheet
=
wb
.
GetSheetAt
(
SheetIndex
);
DataTable
table
=
YBImportDt
(
sheet
,
HeaderRowIndex
,
needHeader
,
imgColList
:
imgColList
,
tempFilePath
:
tempFilePath
)
;
return
table
;
}
/// <summary>
///
excel 指定行插入数据
///
将制定sheet中的数据导出到datatable中
/// </summary>
/// <param name="dtSource"></param>
/// <param name="SheetName"></param>
/// <param name="Path"></param>
/// <param name="NewPath"></param>
/// <param name="rowIndex"></param>
/// <param name="FontName"></param>
/// <param name="FontHeight"></param>
/// <param name="height"></param>
public
static
void
ExportInsert
(
DataTable
dtSource
,
string
SheetName
,
string
Path
,
string
NewPath
,
int
rowIndex
=
0
,
string
FontName
=
"宋体"
,
double
FontHeight
=
0
,
short
height
=
0
)
{
FileStream
file
=
new
FileStream
(
Path
,
FileMode
.
Open
,
FileAccess
.
Read
);
XSSFWorkbook
workbook
=
new
XSSFWorkbook
(
file
);
XSSFSheet
sheet
=
workbook
.
GetSheet
(
SheetName
)
as
XSSFSheet
;
foreach
(
DataRow
row
in
dtSource
.
Rows
)
/// <param name="sheet">需要导出的sheet</param>
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">是否导出表头</param>
/// <returns></returns>
static
DataTable
YBImportDt
(
ISheet
sheet
,
int
HeaderRowIndex
,
bool
needHeader
,
List
<
int
>
imgColList
=
null
,
string
tempFilePath
=
""
)
{
#
region
填充内容
XSSFRow
dataRow
=
sheet
.
CreateRow
(
rowIndex
)
as
XSSFRow
;
if
(
height
>
0
)
DataTable
table
=
new
DataTable
();
IRow
headerRow
;
int
cellCount
;
try
{
List
<
NImgItem
>
imgList
=
new
List
<
NImgItem
>();
if
(
imgColList
!=
null
&&
imgColList
.
Count
>
0
)
{
dataRow
.
Height
=
height
;
imgList
=
ReadImageXSSF
(
sheet
,
tempFilePath
);
//新版本的Excel(.xlsx)
}
foreach
(
DataColumn
column
in
dtSource
.
Columns
)
if
(
HeaderRowIndex
<
0
||
!
needHeader
)
{
XSSFCell
newCell
=
dataRow
.
CreateCell
(
column
.
Ordinal
)
as
XSSFCell
;
ICellStyle
style
=
workbook
.
CreateCellStyle
();
style
.
WrapText
=
true
;
//自动换行
IFont
font
=
workbook
.
CreateFont
();
font
.
FontName
=
FontName
;
if
(
FontHeight
>
0
)
headerRow
=
sheet
.
GetRow
(
0
);
cellCount
=
headerRow
.
LastCellNum
;
for
(
int
i
=
headerRow
.
FirstCellNum
;
i
<=
cellCount
;
i
++)
{
font
.
FontHeight
=
FontHeight
;
DataColumn
column
=
new
DataColumn
(
Convert
.
ToString
(
i
));
table
.
Columns
.
Add
(
column
);
}
style
.
SetFont
(
font
);
style
.
Alignment
=
HorizontalAlignment
.
Center
;
newCell
.
CellStyle
=
style
;
String
drValue
=
row
[
column
].
ToString
();
newCell
.
SetCellValue
(
drValue
);
}
else
{
headerRow
=
sheet
.
GetRow
(
HeaderRowIndex
);
cellCount
=
headerRow
.
LastCellNum
;
#
endregion
rowIndex
++;
for
(
int
i
=
headerRow
.
FirstCellNum
;
i
<=
cellCount
;
i
++)
{
if
(
headerRow
.
GetCell
(
i
)
==
null
)
{
if
(
table
.
Columns
.
IndexOf
(
Convert
.
ToString
(
i
))
>
0
)
{
DataColumn
column
=
new
DataColumn
(
Convert
.
ToString
(
"重复列名"
+
i
));
table
.
Columns
.
Add
(
column
);
}
FileStream
out1
=
new
FileStream
(
NewPath
,
FileMode
.
Create
);
workbook
.
Write
(
out1
);
workbook
.
Close
(
);
out1
.
Close
(
);
else
{
DataColumn
column
=
new
DataColumn
(
Convert
.
ToString
(
i
)
);
table
.
Columns
.
Add
(
column
);
}
/// <summary>
/// 测试插入数据 月度考勤专用
/// </summary>
/// <param name="dtSource"></param>
/// <param name="SheetName"></param>
/// <param name="Path"></param>
/// <param name="NewPath"></param>
/// <param name="rowIndex"></param>
/// <param name="FontName"></param>
/// <param name="FontHeight"></param>
/// <param name="height"></param>
public
static
void
ExportInsertAndMergeCells
(
DataTable
dtSource
,
string
SheetName
,
string
Path
,
string
NewPath
,
int
rowIndex
=
0
,
string
FontName
=
"宋体"
,
double
FontHeight
=
0
,
short
height
=
0
)
{
FileStream
file
=
new
FileStream
(
Path
,
FileMode
.
Open
,
FileAccess
.
Read
);
XSSFWorkbook
workbook
=
new
XSSFWorkbook
(
file
);
XSSFSheet
sheet
=
workbook
.
GetSheet
(
SheetName
)
as
XSSFSheet
;
string
OldDepStr
=
""
;
int
startNum
=
rowIndex
;
int
EndNum
=
dtSource
.
Rows
.
Count
+
rowIndex
;
foreach
(
DataRow
row
in
dtSource
.
Rows
)
{
#
region
填充内容
XSSFRow
dataRow
=
sheet
.
CreateRow
(
rowIndex
)
as
XSSFRow
;
if
(
height
>
0
)
}
else
if
(
table
.
Columns
.
IndexOf
(
headerRow
.
GetCell
(
i
).
ToString
())
>
0
)
{
dataRow
.
Height
=
height
;
DataColumn
column
=
new
DataColumn
(
Convert
.
ToString
(
"重复列名"
+
i
));
table
.
Columns
.
Add
(
column
);
}
foreach
(
DataColumn
column
in
dtSource
.
Columns
)
else
{
DataColumn
column
=
new
DataColumn
(
headerRow
.
GetCell
(
i
).
ToString
());
table
.
Columns
.
Add
(
column
);
}
}
}
int
rowCount
=
sheet
.
LastRowNum
;
for
(
int
i
=
(
HeaderRowIndex
+
1
);
i
<=
sheet
.
LastRowNum
;
i
++)
{
XSSFCell
newCell
=
dataRow
.
CreateCell
(
column
.
Ordinal
)
as
XSSFCell
;
ICellStyle
style
=
workbook
.
CreateCellStyle
();
style
.
WrapText
=
true
;
//自动换行
IFont
font
=
workbook
.
CreateFont
();
font
.
FontName
=
FontName
;
if
(
FontHeight
>
0
)
try
{
IRow
row
;
if
(
sheet
.
GetRow
(
i
)
==
null
)
{
font
.
FontHeight
=
FontHeight
;
row
=
sheet
.
CreateRow
(
i
)
;
}
style
.
SetFont
(
font
);
style
.
Alignment
=
HorizontalAlignment
.
Center
;
style
.
VerticalAlignment
=
NPOI
.
SS
.
UserModel
.
VerticalAlignment
.
Center
;
newCell
.
CellStyle
=
style
;
String
drValue
=
row
[
column
].
ToString
();
newCell
.
SetCellValue
(
drValue
);
else
{
row
=
sheet
.
GetRow
(
i
);
}
#
endregion
//合并单元格
if
(
row
[
"部门"
].
ToString
()
!=
OldDepStr
)
DataRow
dataRow
=
table
.
NewRow
();
for
(
int
j
=
row
.
FirstCellNum
;
j
<=
cellCount
;
j
++)
{
try
{
OldDepStr
=
row
[
"部门"
].
ToString
();
if
(
OldDepStr
==
""
)
if
(
imgColList
!=
null
&&
imgColList
.
Count
>
0
&&
imgColList
.
Contains
(
j
))
{
var
region
=
new
CellRangeAddress
(
startNum
,
rowIndex
-
1
,
2
,
2
);
sheet
.
AddMergedRegion
(
region
);
startNum
=
rowIndex
;
var
tempImg
=
imgList
.
Where
(
qitem
=>
qitem
.
RowNum
==
i
&&
qitem
.
ColNum
==
j
)?.
FirstOrDefault
();
dataRow
[
j
]
=
tempImg
?.
ImgPath
??
""
;
}
else
{
if
(
startNum
!=
rowIndex
)
if
(
row
.
GetCell
(
j
)
!=
null
)
{
if
(
OldDepStr
!=
""
)
CellType
CellTypeEnum
=
row
.
GetCell
(
j
).
CellType
;
switch
(
CellTypeEnum
)
{
var
region
=
new
CellRangeAddress
(
startNum
,
rowIndex
-
1
,
2
,
2
);
sheet
.
AddMergedRegion
(
region
);
case
CellType
.
String
:
String
str
=
row
.
GetCell
(
j
).
StringCellValue
;
if
(
str
!=
null
&&
str
.
Length
>
0
)
{
dataRow
[
j
]
=
str
.
ToString
();
}
else
{
startNum
=
rowIndex
+
1
;
dataRow
[
j
]
=
null
;
}
startNum
=
rowIndex
;
break
;
case
CellType
.
Numeric
:
if
(
DateUtil
.
IsCellDateFormatted
(
row
.
GetCell
(
j
)))
{
dataRow
[
j
]
=
DateTime
.
FromOADate
(
row
.
GetCell
(
j
).
NumericCellValue
);
}
else
{
dataRow
[
j
]
=
Convert
.
ToDouble
(
row
.
GetCell
(
j
).
NumericCellValue
);
}
break
;
case
CellType
.
Boolean
:
dataRow
[
j
]
=
Convert
.
ToString
(
row
.
GetCell
(
j
).
BooleanCellValue
);
break
;
case
CellType
.
Error
:
dataRow
[
j
]
=
ErrorEval
.
GetText
(
row
.
GetCell
(
j
).
ErrorCellValue
);
break
;
case
CellType
.
Formula
:
switch
(
row
.
GetCell
(
j
).
CachedFormulaResultType
)
{
case
CellType
.
String
:
String
strFORMULA
=
row
.
GetCell
(
j
).
StringCellValue
;
if
(
strFORMULA
!=
null
&&
strFORMULA
.
Length
>
0
)
{
dataRow
[
j
]
=
strFORMULA
.
ToString
();
}
else
{
if
(
OldDepStr
==
""
)
dataRow
[
j
]
=
null
;
}
break
;
case
CellType
.
Numeric
:
dataRow
[
j
]
=
Convert
.
ToString
(
row
.
GetCell
(
j
).
NumericCellValue
);
break
;
case
CellType
.
Boolean
:
dataRow
[
j
]
=
Convert
.
ToString
(
row
.
GetCell
(
j
).
BooleanCellValue
);
break
;
case
CellType
.
Error
:
dataRow
[
j
]
=
ErrorEval
.
GetText
(
row
.
GetCell
(
j
).
ErrorCellValue
);
break
;
default
:
dataRow
[
j
]
=
""
;
break
;
}
break
;
default
:
dataRow
[
j
]
=
""
;
break
;
}
}
}
}
catch
(
Exception
exception
)
{
startNum
=
rowIndex
+
1
;
LogHelper
.
Write
(
exception
,
"YBImportDt_1"
);
}
}
table
.
Rows
.
Add
(
dataRow
);
}
catch
(
Exception
exception
)
{
LogHelper
.
Write
(
exception
,
"YBImportDt_2"
);
}
}
}
rowIndex
++;
if
(
EndNum
==
rowIndex
&&
startNum
!=
rowIndex
)
{
//最后一条数据
var
region
=
new
CellRangeAddress
(
startNum
,
rowIndex
-
1
,
2
,
2
);
sheet
.
AddMergedRegion
(
region
);
catch
(
Exception
exception
)
{
LogHelper
.
Write
(
exception
,
"YBImportDt_3"
);
}
return
table
;
}
FileStream
out1
=
new
FileStream
(
NewPath
,
FileMode
.
Create
);
workbook
.
Write
(
out1
);
workbook
.
Close
();
out1
.
Close
();
/// <summary>
/// 读取excel .xlsx文件内图片
/// </summary>
/// <param name="sheet"></param>
/// <param name="_sDirImg"></param>
static
List
<
NImgItem
>
ReadImageXSSF
(
ISheet
sheet
,
string
_sDirImg
)
{
List
<
NImgItem
>
imgList
=
new
List
<
NImgItem
>();
if
(!
Directory
.
Exists
(
_sDirImg
))
{
DirectoryInfo
directoryInfo
=
new
DirectoryInfo
(
_sDirImg
);
directoryInfo
.
Create
();
}
// 读取图像信息
foreach
(
XSSFShape
shape
in
((
XSSFDrawing
)
sheet
.
DrawingPatriarch
).
GetShapes
())
{
if
(
shape
is
XSSFPicture
)
{
XSSFPicture
picture
=
(
XSSFPicture
)
shape
;
// 获取图片所在单元格的行号和列号
int
rowIndex
=
picture
.
GetPreferredSize
().
Row1
;
int
colIndex
=
picture
.
GetPreferredSize
().
Col1
;
// 获取图像文件格式
string
imageFormat
=
picture
.
PictureData
.
MimeType
switch
{
"image/jpeg"
=>
"jpeg"
,
"image/png"
=>
"png"
,
"image/gif"
=>
"gif"
,
"image/bmp"
=>
"bmp"
,
_
=>
"jpg"
};
// 保存图像文件
string
outputFileName
=
_sDirImg
+
@"\"
+
$"
{
rowIndex
}
-
{
colIndex
}
-
{
Guid
.
NewGuid
()}
.
{
imageFormat
}
"
;
using
(
FileStream
imageFile
=
new
FileStream
(
outputFileName
,
FileMode
.
Create
))
{
imageFile
.
Write
(
picture
.
PictureData
.
Data
,
0
,
picture
.
PictureData
.
Data
.
Length
);
}
imgList
.
Add
(
new
NImgItem
()
{
RowNum
=
rowIndex
,
ColNum
=
colIndex
,
ImgPath
=
outputFileName
});
}
}
return
imgList
;
}
}
/// <summary>
/// 解析NPOI中的图片
/// </summary>
class
NImgItem
{
/// <summary>
/// 行号
/// </summary>
public
int
RowNum
{
get
;
set
;
}
/// <summary>
/// 列号
/// </summary>
public
int
ColNum
{
get
;
set
;
}
/// <summary>
/// 图片地址
/// </summary>
public
string
ImgPath
{
get
;
set
;
}
}
}
\ No newline at end of file
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
...
...
@@ -80,7 +80,7 @@ namespace Mall.Repository.User
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