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
2e109c47
Commit
2e109c47
authored
Dec 10, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增楼宇、企业服务相关接口
parent
926aa3df
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1508 additions
and
1 deletion
+1508
-1
RB_Building.cs
Mall.Model/Entity/TradePavilion/RB_Building.cs
+169
-0
RB_EnterpriseServices.cs
Mall.Model/Entity/TradePavilion/RB_EnterpriseServices.cs
+139
-0
RB_Building_Extend.cs
Mall.Model/Extend/TradePavilion/RB_Building_Extend.cs
+15
-0
RB_EnterpriseServices_Extend.cs
...odel/Extend/TradePavilion/RB_EnterpriseServices_Extend.cs
+15
-0
BuildingCarrierModule.cs
Mall.Module.TradePavilion/BuildingCarrierModule.cs
+201
-1
RB_BuildingRepository.cs
Mall.Repository/TradePavilion/RB_BuildingRepository.cs
+63
-0
RB_EnterpriseServicesRepository.cs
...pository/TradePavilion/RB_EnterpriseServicesRepository.cs
+59
-0
YBTradeController.cs
Mall.WebApi/Controllers/TradePavilion/YBTradeController.cs
+847
-0
No files found.
Mall.Model/Entity/TradePavilion/RB_Building.cs
0 → 100644
View file @
2e109c47
using
Mall.Common.Enum
;
using
System
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 活力楼宇实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Building
{
/// <summary>
/// 楼宇主键Id
/// </summary>
public
int
BuildId
{
get
;
set
;
}
/// <summary>
/// 楼宇名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 楼宇图片
/// </summary>
public
string
Banner
{
get
;
set
;
}
/// <summary>
/// 楼宇位置
/// </summary>
public
string
Address
{
get
;
set
;
}
/// <summary>
/// 经纬度
/// </summary>
public
string
LatAndLon
{
get
;
set
;
}
/// <summary>
/// 投运时间
/// </summary>
public
string
OperationTime
{
get
;
set
;
}
/// <summary>
/// 楼宇等级
/// </summary>
public
int
CategoryId
{
get
;
set
;
}
/// <summary>
/// 面积
/// </summary>
public
string
Areas
{
get
;
set
;
}
/// <summary>
/// 楼栋数
/// </summary>
public
string
BuildingNum
{
get
;
set
;
}
/// <summary>
/// 楼层数
/// </summary>
public
int
FloorNum
{
get
;
set
;
}
/// <summary>
/// 电梯数
/// </summary>
public
int
ElevatorNum
{
get
;
set
;
}
/// <summary>
/// 层高
/// </summary>
public
decimal
FloorHeight
{
get
;
set
;
}
/// <summary>
/// 开发商
/// </summary>
public
string
Developers
{
get
;
set
;
}
/// <summary>
/// 物业公司
/// </summary>
public
string
PropertyComp
{
get
;
set
;
}
/// <summary>
/// 销售自持比例
/// </summary>
public
string
SaleOrSelf
{
get
;
set
;
}
/// <summary>
/// 是否统一运营(1-是,0-否)
/// </summary>
public
int
IsAllOperate
{
get
;
set
;
}
/// <summary>
/// 建设时间
/// </summary>
public
string
ConstructionTime
{
get
;
set
;
}
/// <summary>
/// 物业费(元/㎡)
/// </summary>
public
decimal
PropertyFee
{
get
;
set
;
}
/// <summary>
/// 月租金(元/㎡)
/// </summary>
public
decimal
RentFee
{
get
;
set
;
}
/// <summary>
/// 产业方向
/// </summary>
public
string
IndustryDirection
{
get
;
set
;
}
/// <summary>
/// 目标企业招引需求
/// </summary>
public
string
BrandDemand
{
get
;
set
;
}
/// <summary>
/// 其他需求
/// </summary>
public
string
Other
{
get
;
set
;
}
/// <summary>
/// 联系人
/// </summary>
public
string
ContactName
{
get
;
set
;
}
/// <summary>
/// 联系电话
/// </summary>
public
string
ContactPhone
{
get
;
set
;
}
/// <summary>
/// 商户号id
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateDate
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 修改时间
/// </summary>
public
DateTime
UpdateDate
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
}
}
Mall.Model/Entity/TradePavilion/RB_EnterpriseServices.cs
0 → 100644
View file @
2e109c47
using
Mall.Common.Enum
;
using
System
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 企业服务实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_EnterpriseServices
{
/// <summary>
/// 企业服务主键Id
/// </summary>
public
int
ServiceId
{
get
;
set
;
}
/// <summary>
/// 企业名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 企业图片
/// </summary>
public
string
Banner
{
get
;
set
;
}
/// <summary>
/// 企业简介
/// </summary>
public
string
Introduction
{
get
;
set
;
}
/// <summary>
/// 企业发展意向
/// </summary>
public
string
DevIntention
{
get
;
set
;
}
/// <summary>
/// 楼宇位置
/// </summary>
public
string
Address
{
get
;
set
;
}
/// <summary>
/// 经纬度
/// </summary>
public
string
LatAndLon
{
get
;
set
;
}
/// <summary>
/// 投运时间
/// </summary>
public
string
OperationTime
{
get
;
set
;
}
/// <summary>
/// 楼宇等级
/// </summary>
public
int
CategoryId
{
get
;
set
;
}
/// <summary>
/// 楼宇装修
/// </summary>
public
string
Renovation
{
get
;
set
;
}
/// <summary>
/// 支付方式
/// </summary>
public
string
Payment
{
get
;
set
;
}
/// <summary>
/// 交房日期
/// </summary>
public
string
HandoverDate
{
get
;
set
;
}
/// <summary>
/// 意向楼层
/// </summary>
public
int
IntentionalFloor
{
get
;
set
;
}
/// <summary>
/// 电梯数
/// </summary>
public
int
ElevatorNum
{
get
;
set
;
}
/// <summary>
/// 物业费(元/㎡)
/// </summary>
public
decimal
PropertyFee
{
get
;
set
;
}
/// <summary>
/// 月租金(元/㎡)
/// </summary>
public
decimal
RentFee
{
get
;
set
;
}
/// <summary>
/// 联系人
/// </summary>
public
string
ContactName
{
get
;
set
;
}
/// <summary>
/// 联系电话
/// </summary>
public
string
ContactPhone
{
get
;
set
;
}
/// <summary>
/// 商户号id
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateDate
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 修改时间
/// </summary>
public
DateTime
UpdateDate
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
}
}
Mall.Model/Extend/TradePavilion/RB_Building_Extend.cs
0 → 100644
View file @
2e109c47
using
Mall.Model.Entity.TradePavilion
;
namespace
Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 活力楼宇扩展实体类
/// </summary>
public
class
RB_Building_Extend
:
RB_Building
{
/// <summary>
/// 分类名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
}
}
Mall.Model/Extend/TradePavilion/RB_EnterpriseServices_Extend.cs
0 → 100644
View file @
2e109c47
using
Mall.Model.Entity.TradePavilion
;
namespace
Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 企业服务扩展实体类
/// </summary>
public
class
RB_EnterpriseServices_Extend
:
RB_EnterpriseServices
{
/// <summary>
/// 分类名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
}
}
Mall.Module.TradePavilion/BuildingCarrierModule.cs
View file @
2e109c47
...
...
@@ -10,7 +10,9 @@ using RabbitMQ.Client.Framing.Impl;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB
;
using
VT.FW.DB.Dapper
;
using
static
ICSharpCode
.
SharpZipLib
.
Zip
.
ExtendedUnixData
;
namespace
Mall.Module.TradePavilion
...
...
@@ -44,6 +46,16 @@ namespace Mall.Module.TradePavilion
/// </summary>
private
readonly
RB_Visit_LogRepository
visit_LogRepository
=
new
RB_Visit_LogRepository
();
/// <summary>
/// 活力楼宇仓储层
/// </summary>
private
readonly
RB_BuildingRepository
buildingRepository
=
new
RB_BuildingRepository
();
/// <summary>
/// 企业服务仓储层
/// </summary>
private
readonly
RB_EnterpriseServicesRepository
enterpriseServicesRepository
=
new
RB_EnterpriseServicesRepository
();
/// <summary>
/// 获取载体、楼宇分页列表
/// </summary>
...
...
@@ -247,7 +259,7 @@ namespace Mall.Module.TradePavilion
public
List
<
RB_Brand_Enterprise_Extend
>
GetBrandEnterprisePageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Brand_Enterprise_Extend
query
)
{
var
list
=
brand_EnterpriseRepository
.
GetBrandEnterprisePageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Any
())
if
(
list
!=
null
&&
list
.
Any
())
{
foreach
(
var
item
in
list
)
{
...
...
@@ -354,5 +366,193 @@ namespace Mall.Module.TradePavilion
bool
flag
=
brand_EnterpriseRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Brand_Enterprise_Extend
.
ID
),
ID
));
return
flag
;
}
#
region
活力楼宇
/// <summary>
/// 获取活力楼宇分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Building_Extend
>
GetBuildingPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Building_Extend
query
)
{
return
buildingRepository
.
GetBuildingPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 新增修改活力楼宇
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetBuildingModule
(
RB_Building_Extend
model
)
{
bool
flag
;
if
(
model
.
BuildId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Building_Extend
.
Name
),
model
.
Name
},
{
nameof
(
RB_Building_Extend
.
Banner
),
model
.
Banner
},
{
nameof
(
RB_Building_Extend
.
Address
),
model
.
Address
},
{
nameof
(
RB_Building_Extend
.
LatAndLon
),
model
.
LatAndLon
},
{
nameof
(
RB_Building_Extend
.
OperationTime
),
model
.
OperationTime
},
{
nameof
(
RB_Building_Extend
.
CategoryId
),
model
.
CategoryId
},
{
nameof
(
RB_Building_Extend
.
Areas
),
model
.
Areas
},
{
nameof
(
RB_Building_Extend
.
BuildingNum
),
model
.
BuildingNum
},
{
nameof
(
RB_Building_Extend
.
FloorNum
),
model
.
FloorNum
},
{
nameof
(
RB_Building_Extend
.
ElevatorNum
),
model
.
ElevatorNum
},
{
nameof
(
RB_Building_Extend
.
FloorHeight
),
model
.
FloorHeight
},
{
nameof
(
RB_Building_Extend
.
Developers
),
model
.
Developers
},
{
nameof
(
RB_Building_Extend
.
PropertyComp
),
model
.
PropertyComp
},
{
nameof
(
RB_Building_Extend
.
SaleOrSelf
),
model
.
SaleOrSelf
},
{
nameof
(
RB_Building_Extend
.
IsAllOperate
),
model
.
IsAllOperate
},
{
nameof
(
RB_Building_Extend
.
ConstructionTime
),
model
.
ConstructionTime
},
{
nameof
(
RB_Building_Extend
.
PropertyFee
),
model
.
PropertyFee
},
{
nameof
(
RB_Building_Extend
.
RentFee
),
model
.
RentFee
},
{
nameof
(
RB_Building_Extend
.
IndustryDirection
),
model
.
IndustryDirection
},
{
nameof
(
RB_Building_Extend
.
BrandDemand
),
model
.
BrandDemand
},
{
nameof
(
RB_Building_Extend
.
Other
),
model
.
Other
},
{
nameof
(
RB_Building_Extend
.
ContactName
),
model
.
ContactName
},
{
nameof
(
RB_Building_Extend
.
ContactPhone
),
model
.
ContactPhone
},
{
nameof
(
RB_Building_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Building_Extend
.
UpdateDate
),
model
.
UpdateDate
},
};
flag
=
buildingRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Building_Extend
.
BuildId
),
model
.
BuildId
));
}
else
{
var
newId
=
buildingRepository
.
Insert
(
model
);
model
.
BuildId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据编号获取活力楼宇详情
/// </summary>
/// <param name="BuildId"></param>
/// <returns></returns>
public
RB_Building_Extend
GetBuildingInfoModule
(
int
BuildId
)
{
var
extModel
=
buildingRepository
.
GetEntity
<
RB_Building_Extend
>(
BuildId
);
if
(
extModel
!=
null
&&
extModel
.
CategoryId
>
0
)
{
extModel
.
CategoryName
=
brandClassRepository
.
GetEntity
(
extModel
.
CategoryId
)?.
ClassName
??
""
;
}
return
extModel
;
}
/// <summary>
/// 根据编号删除获取楼宇
/// </summary>
/// <param name="BuildId"></param>
/// <returns></returns>
public
bool
RemoveBuildingModule
(
int
BuildId
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Building_Extend
.
Status
),(
int
)
DateStateEnum
.
Delete
},
{
nameof
(
RB_Building_Extend
.
UpdateDate
),
DateTime
.
Now
}
};
bool
flag
=
buildingRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Building_Extend
.
BuildId
),
BuildId
));
return
flag
;
}
#
endregion
#
region
企业服务
/// <summary>
/// 获取企业服务分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_EnterpriseServices_Extend
>
GetEnterpriseServicesPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_EnterpriseServices_Extend
query
)
{
return
enterpriseServicesRepository
.
GetEnterpriseServicesPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 新增修改企业服务
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetEnterpriseServicesModule
(
RB_EnterpriseServices_Extend
model
)
{
bool
flag
=
false
;
if
(
model
.
ServiceId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_EnterpriseServices_Extend
.
Name
),
model
.
Name
},
{
nameof
(
RB_EnterpriseServices_Extend
.
Banner
),
model
.
Banner
},
{
nameof
(
RB_EnterpriseServices_Extend
.
Introduction
),
model
.
Introduction
},
{
nameof
(
RB_EnterpriseServices_Extend
.
DevIntention
),
model
.
DevIntention
},
{
nameof
(
RB_EnterpriseServices_Extend
.
Address
),
model
.
Address
},
{
nameof
(
RB_EnterpriseServices_Extend
.
LatAndLon
),
model
.
LatAndLon
},
{
nameof
(
RB_EnterpriseServices_Extend
.
OperationTime
),
model
.
OperationTime
},
{
nameof
(
RB_EnterpriseServices_Extend
.
CategoryId
),
model
.
CategoryId
},
{
nameof
(
RB_EnterpriseServices_Extend
.
Renovation
),
model
.
Renovation
},
{
nameof
(
RB_EnterpriseServices_Extend
.
Payment
),
model
.
Payment
},
{
nameof
(
RB_EnterpriseServices_Extend
.
HandoverDate
),
model
.
HandoverDate
},
{
nameof
(
RB_EnterpriseServices_Extend
.
IntentionalFloor
),
model
.
IntentionalFloor
},
{
nameof
(
RB_EnterpriseServices_Extend
.
ElevatorNum
),
model
.
ElevatorNum
},
{
nameof
(
RB_EnterpriseServices_Extend
.
PropertyFee
),
model
.
PropertyFee
},
{
nameof
(
RB_EnterpriseServices_Extend
.
RentFee
),
model
.
RentFee
},
{
nameof
(
RB_EnterpriseServices_Extend
.
ContactName
),
model
.
ContactName
},
{
nameof
(
RB_EnterpriseServices_Extend
.
ContactPhone
),
model
.
ContactPhone
},
{
nameof
(
RB_EnterpriseServices_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_EnterpriseServices_Extend
.
UpdateDate
),
model
.
UpdateDate
},
};
flag
=
enterpriseServicesRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_EnterpriseServices_Extend
.
ServiceId
),
model
.
ServiceId
));
}
else
{
var
newId
=
enterpriseServicesRepository
.
Insert
(
model
);
model
.
ServiceId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据编号获取企业服务详情
/// </summary>
/// <param name="ServiceId"></param>
/// <returns></returns>
public
RB_EnterpriseServices_Extend
GetEnterpriseServicesInfoModule
(
int
ServiceId
)
{
var
extModel
=
enterpriseServicesRepository
.
GetEntity
<
RB_EnterpriseServices_Extend
>(
ServiceId
);
if
(
extModel
!=
null
&&
extModel
.
CategoryId
>
0
)
{
extModel
.
CategoryName
=
brandClassRepository
.
GetEntity
(
extModel
.
CategoryId
)?.
ClassName
??
""
;
}
return
extModel
;
}
/// <summary>
/// 根据编号删除企业服务
/// </summary>
/// <param name="ServiceId"></param>
/// <returns></returns>
public
bool
RemoveEnterpriseServicesModule
(
int
ServiceId
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_EnterpriseServices_Extend
.
Status
),
(
int
)
DateStateEnum
.
Delete
},
{
nameof
(
RB_EnterpriseServices_Extend
.
UpdateDate
),
DateTime
.
Now
}
};
bool
flag
=
enterpriseServicesRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_EnterpriseServices_Extend
.
ServiceId
),
ServiceId
));
return
flag
;
}
#
endregion
}
}
Mall.Repository/TradePavilion/RB_BuildingRepository.cs
0 → 100644
View file @
2e109c47
using
Mall.Common.Enum
;
using
Mall.Model.Entity.TradePavilion
;
using
Mall.Model.Extend.TradePavilion
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB.Dapper
;
namespace
Mall.Repository.TradePavilion
{
/// <summary>
/// 活力楼宇仓储层
/// </summary>
public
class
RB_BuildingRepository
:
BaseRepository
<
RB_Building
>
{
/// <summary>
/// 获取活力楼宇分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Building_Extend
>
GetBuildingPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Building_Extend
query
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,IFNULL(B.ClassName,'') AS CategoryName
FROM RB_Building AS A LEFT JOIN rb_brandclass AS B ON A.CategoryId=B.ID
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Building_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Building_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Building_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
CategoryId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Building_Extend
.
CategoryId
),
query
.
CategoryId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Name
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @Name "
,
nameof
(
RB_Building_Extend
.
Name
));
parameters
.
Add
(
"@Name"
,
"%"
+
query
.
Name
.
Trim
()
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Address
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @Address "
,
nameof
(
RB_Building_Extend
.
Address
));
parameters
.
Add
(
"@Address"
,
"%"
+
query
.
Address
.
Trim
()
+
"%"
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Building_Extend
.
BuildId
));
return
GetPage
<
RB_Building_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
Mall.Repository/TradePavilion/RB_EnterpriseServicesRepository.cs
0 → 100644
View file @
2e109c47
using
Mall.Common.Enum
;
using
Mall.Model.Entity.TradePavilion
;
using
Mall.Model.Extend.TradePavilion
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB.Dapper
;
namespace
Mall.Repository.TradePavilion
{
/// <summary>
/// 企业服务仓储层
/// </summary>
public
class
RB_EnterpriseServicesRepository
:
BaseRepository
<
RB_EnterpriseServices
>
{
/// <summary>
/// 获取企业服务分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_EnterpriseServices_Extend
>
GetEnterpriseServicesPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_EnterpriseServices_Extend
query
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,IFNULL(B.ClassName,'') AS CategoryName
FROM rb_enterpriseservices AS A LEFT JOIN rb_brandclass AS B ON A.CategoryId=B.ID
WHERE 1=1
"
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_EnterpriseServices_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_EnterpriseServices_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_EnterpriseServices_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
CategoryId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_EnterpriseServices_Extend
.
CategoryId
),
query
.
CategoryId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Name
))
{
builder
.
AppendFormat
(
@" AND A.{0} LIKE @Name "
,
nameof
(
RB_EnterpriseServices_Extend
.
Name
));
parameters
.
Add
(
"@Name"
,
"%"
+
query
.
Name
+
"%"
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_EnterpriseServices_Extend
.
ServiceId
));
return
GetPage
<
RB_EnterpriseServices_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
Mall.WebApi/Controllers/TradePavilion/YBTradeController.cs
0 → 100644
View file @
2e109c47
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.TradePavilion
;
using
Mall.Module.TradePavilion
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Mall.WebApi.Controllers.TradePavilion
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
YBTradeController
:
BaseController
{
private
readonly
BuildingCarrierModule
buildingCarrierModule
=
new
BuildingCarrierModule
();
/// <summary>
/// 获取活力楼宇分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetBuildingPage
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
ResultPageModel
pageModel
=
new
ResultPageModel
()
{
pageIndex
=
parms
.
GetInt
(
"pageIndex"
),
pageSize
=
parms
.
GetInt
(
"pageSize"
),
};
RB_Building_Extend
query
=
new
RB_Building_Extend
()
{
Name
=
parms
.
GetStringValue
(
"Name"
),
CategoryId
=
parms
.
GetInt
(
"CategoryId"
),
Address
=
parms
.
GetStringValue
(
"Address"
),
MallBaseId
=
RequestParm
.
MallBaseId
,
TenantId
=
RequestParm
.
TenantId
,
};
List
<
object
>
list
=
new
List
<
object
>();
var
dataList
=
buildingCarrierModule
.
GetBuildingPageModule
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
dataList
)
{
string
CoverImg
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
Banner
))
{
try
{
List
<
string
>
imgList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
item
.
Banner
);
CoverImg
=
imgList
?.
FirstOrDefault
()
??
""
;
}
catch
{
}
}
list
.
Add
(
new
{
item
.
BuildId
,
item
.
Name
,
CoverImg
,
item
.
Address
,
item
.
LatAndLon
,
item
.
OperationTime
,
item
.
CategoryId
,
item
.
CategoryName
,
item
.
Areas
,
item
.
BuildingNum
,
item
.
FloorNum
,
item
.
ElevatorNum
,
item
.
FloorHeight
,
item
.
Developers
,
item
.
PropertyComp
,
item
.
SaleOrSelf
,
item
.
IsAllOperate
,
item
.
ConstructionTime
,
item
.
PropertyFee
,
item
.
RentFee
,
item
.
IndustryDirection
,
item
.
BrandDemand
,
item
.
Other
,
item
.
ContactName
,
item
.
ContactPhone
,
CreateDate
=
Common
.
ConvertHelper
.
FormatTime
(
item
.
CreateDate
),
});
}
pageModel
.
count
=
Convert
.
ToInt32
(
rowsCount
);
pageModel
.
pageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 新增修改活力楼宇
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetBuildingInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
RB_Building_Extend
extModel
=
new
RB_Building_Extend
()
{
BuildId
=
parms
.
GetInt
(
"BuildId"
),
Name
=
parms
.
GetStringValue
(
"Name"
),
Address
=
parms
.
GetStringValue
(
"Address"
),
LatAndLon
=
parms
.
GetStringValue
(
"LatAndLon"
),
OperationTime
=
parms
.
GetStringValue
(
"OperationTime"
),
CategoryId
=
parms
.
GetInt
(
"CategoryId"
),
Areas
=
parms
.
GetStringValue
(
"Areas"
),
BuildingNum
=
parms
.
GetStringValue
(
"BuildingNum"
),
FloorNum
=
parms
.
GetInt
(
"FloorNum"
),
ElevatorNum
=
parms
.
GetInt
(
"ElevatorNum"
),
FloorHeight
=
parms
.
GetDecimal
(
"FloorHeight"
),
Developers
=
parms
.
GetStringValue
(
"Developers"
),
PropertyComp
=
parms
.
GetStringValue
(
"PropertyComp"
),
SaleOrSelf
=
parms
.
GetStringValue
(
"SaleOrSelf"
),
IsAllOperate
=
parms
.
GetInt
(
"IsAllOperate"
),
ConstructionTime
=
parms
.
GetStringValue
(
"ConstructionTime"
),
PropertyFee
=
parms
.
GetDecimal
(
"PropertyFee"
),
RentFee
=
parms
.
GetDecimal
(
"RentFee"
),
IndustryDirection
=
parms
.
GetStringValue
(
"IndustryDirection"
),
BrandDemand
=
parms
.
GetStringValue
(
"BrandDemand"
),
Other
=
parms
.
GetStringValue
(
"Other"
),
ContactName
=
parms
.
GetStringValue
(
"ContactName"
),
ContactPhone
=
parms
.
GetStringValue
(
"ContactPhone"
),
};
List
<
string
>
bannerList
=
new
List
<
string
>();
string
BannerStr
=
parms
.
GetStringValue
(
"Banner"
);
if
(!
string
.
IsNullOrEmpty
(
BannerStr
))
{
try
{
bannerList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
BannerStr
);
}
catch
{
}
}
extModel
.
Banner
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
bannerList
);
if
(
extModel
.
BuildId
==
0
)
{
extModel
.
CreateBy
=
RequestParm
.
TenantId
;
extModel
.
CreateDate
=
DateTime
.
Now
;
}
else
{
extModel
.
UpdateBy
=
RequestParm
.
TenantId
;
extModel
.
UpdateDate
=
DateTime
.
Now
;
}
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
bool
flag
=
buildingCarrierModule
.
SetBuildingModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据编号获取活力楼宇信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetBuildingInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
BuildingId
=
parms
.
GetInt
(
"BuildId"
);
if
(
BuildingId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"参数不能为空"
);
}
var
extModel
=
buildingCarrierModule
.
GetBuildingInfoModule
(
BuildingId
);
List
<
string
>
Banner
=
new
List
<
string
>();
string
BannerStr
=
extModel
?.
Banner
??
""
;
if
(!
string
.
IsNullOrEmpty
(
BannerStr
))
{
try
{
Banner
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
BannerStr
);
}
catch
{
}
}
var
dataObj
=
new
{
BuildId
=
extModel
?.
BuildId
??
0
,
Name
=
extModel
?.
Name
??
""
,
Banner
,
Address
=
extModel
?.
Address
??
""
,
LatAndLon
=
extModel
?.
LatAndLon
??
""
,
OperationTime
=
extModel
?.
OperationTime
??
""
,
CategoryId
=
extModel
?.
CategoryId
??
0
,
CategoryName
=
extModel
?.
CategoryName
??
""
,
Areas
=
extModel
?.
Areas
??
""
,
BuildingNum
=
extModel
?.
BuildingNum
??
""
,
FloorNum
=
extModel
?.
FloorNum
??
0
,
ElevatorNum
=
extModel
?.
ElevatorNum
??
0
,
FloorHeight
=
extModel
?.
FloorHeight
??
0
,
Developers
=
extModel
?.
Developers
??
""
,
PropertyComp
=
extModel
?.
PropertyComp
??
""
,
SaleOrSelf
=
extModel
?.
SaleOrSelf
??
""
,
IsAllOperate
=
extModel
?.
IsAllOperate
??
0
,
ConstructionTime
=
extModel
?.
ConstructionTime
??
""
,
PropertyFee
=
extModel
?.
PropertyFee
??
0
,
RentFee
=
extModel
?.
RentFee
??
0
,
IndustryDirection
=
extModel
?.
IndustryDirection
??
""
,
BrandDemand
=
extModel
?.
BrandDemand
??
""
,
Other
=
extModel
?.
Other
??
""
,
ContactName
=
extModel
?.
ContactName
??
""
,
ContactPhone
=
extModel
?.
ContactPhone
??
""
,
};
return
ApiResult
.
Success
(
data
:
dataObj
);
}
/// <summary>
/// 根据编号删除活力楼宇
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
RemoveBuildingInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
BuildId
=
parms
.
GetInt
(
"BuildId"
);
if
(
BuildId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"参数不能为空"
);
}
var
extModel
=
buildingCarrierModule
.
RemoveBuildingModule
(
BuildId
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
///// <summary>
///// 获取【商载通】载体、楼宇下载枚举列表
///// </summary>
///// <returns></returns>
//[HttpPost]
//public ApiResult GetBuildingCarrierExportEnumList()
//{
// var list = EnumHelper.GetEnumList(typeof(Common.Enum.TradePavilion.BuildCarrierExportEnum));
// return ApiResult.Success("", list.Select(x => new
// {
// Name = x.Key,
// Id = Convert.ToInt32(x.Value)
// }));
//}
///// <summary>
///// 检查【商再通】载体、楼宇文件是否存在
///// </summary>
///// <returns></returns>
//[HttpPost]
//public async Task<ApiResult> CheckBuildingCarrierFile()
//{
// JObject parms = JObject.Parse(RequestParm.msg.ToString());
// RB_Building_Carrier_Extend query = new RB_Building_Carrier_Extend()
// {
// CarrierName = parms.GetStringValue("CarrierName"),
// CategoryId = parms.GetInt("CategoryId"),
// QStartDate = parms.GetStringValue("QStartDate"),
// QEndDate = parms.GetStringValue("QEndDate"),
// MetroName = parms.GetStringValue("MetroName"),
// MetroNum = parms.GetInt("MetroNum"),
// BuildingCarrierType = parms.GetInt("BuildingCarrierType"),
// OpeningStatus = parms.GetInt("OpeningStatus", -1),
// QShopType = parms.GetInt("QShopType"),
// MallBaseId = RequestParm.MallBaseId,
// TenantId = RequestParm.TenantId,
// };
// string RandomNum = parms.GetStringValue("RandomNum");
// string ExcelEnumIdsStr = parms.GetStringValue("ExcelEnumIds");
// List<int> ExcelEnumIds = JsonConvert.DeserializeObject<List<int>>(ExcelEnumIdsStr);
// string hashKey = Common.Config.GetHash(Common.Plugin.JsonHelper.Serialize(query) + ExcelEnumIdsStr + RandomNum);
// string fileName = "载体楼宇" + ".xls";
// string filePath = Path.Combine(Directory.GetCurrentDirectory(), "upfile/temporary");
// if (System.IO.Directory.Exists(filePath) == false)//如果不存在就创建file文件夹
// {
// System.IO.Directory.CreateDirectory(filePath);
// }
// string tempPath = filePath + "\\" + hashKey + "\\";
// //如果不存在就创建file文件夹
// if (!System.IO.Directory.Exists(tempPath))
// {
// System.IO.Directory.CreateDirectory(tempPath);
// }
// string fileUrl = tempPath + fileName;
// string key = "Mall_SD_BUILDINGCARRIER_" + hashKey;
// string redisValue = redisHelper.StringGet(key);
// if (string.IsNullOrEmpty(redisValue))
// {
// redisValue = redisHelper.StringGet(key);
// if (string.IsNullOrEmpty(redisValue))
// {
// redisHelper.StringSet(key, fileName, TimeSpan.FromMinutes(10));
// Task.Run(() =>
// {
// GetBuildingCarrierListToExcel(query, ExcelEnumIds, tempPath, fileUrl);
// });
// }
// }
// return await Task.Run<ApiResult>(() =>
// {
// ApiResult apiResult = new ApiResult()
// {
// resultCode = 0,
// };
// if (System.IO.File.Exists(fileUrl))
// {
// var filePath = "/upfile/temporary/" + hashKey + "/";
// var fileUrl = "/upfile/temporary/" + hashKey + "/" + fileName;
// apiResult.resultCode = 1;
// apiResult.data = new { filePath, fileUrl };
// apiResult.message = key;
// }
// return apiResult;
// });
//}
///// <summary>
///// 生成【商载通】载体、楼宇文件
///// </summary>
///// <param name="demodel">查询参数</param>
///// <param name="ExcelEnumIdList">下载列</param>
///// <param name="filePath">Logo文件存放路径</param>
///// <param name="excelFileUrl">Excel文件路径</param>
//private async void GetBuildingCarrierListToExcel(RB_Building_Carrier_Extend demodel, List<int> ExcelEnumIdList, string filePath, string excelFileUrl)
//{
// byte[] bytes = null;
// string ExcelName = "载体列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
// List<ExcelDataSource> slist = new List<ExcelDataSource>();
// var Enumlist = EnumHelper.GetEnumList(typeof(Common.Enum.TradePavilion.BuildCarrierExportEnum));
// ExcelDataSource header = new ExcelDataSource()
// {
// ExcelRows = new List<ExcelColumn>(30)
// {
// new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
// }
// };
// foreach (var item in ExcelEnumIdList)
// {
// var Name = Enumlist.Where(x => x.Value == item.ToString()).FirstOrDefault().Key ?? "";
// header.ExcelRows.Add(new ExcelColumn(value: Name) { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
// }
// slist.Add(header);
// try
// {
// var list = buildingCarrierModule.GetBuildingCarrierListModule(demodel);
// List<Action> actions = new List<Action>();
// if (list != null && list.Count > 0)
// {
// //判断是否下载图片
// if (ExcelEnumIdList.Contains(2))
// {
// foreach (var item in list)
// {
// actions.Add(new Action(() =>
// {
// DownLoadUrl(item.Logo, filePath);
// }));
// }
// }
// }
// if (actions != null && actions.Count > 0)
// {
// ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 4 }; // 设置最大并行度为 4
// Parallel.Invoke(options, actions.ToArray());
// }
// #region 组装数据
// int Num = 0;
// foreach (var item in list)
// {
// Num++;
// ExcelDataSource datarow = new ExcelDataSource()
// {
// ExcelRows = new List<ExcelColumn>(30) {
// new ExcelColumn(value:Num.ToString()){ },
// }
// };
// foreach (var qitem in ExcelEnumIdList)
// {
// switch (qitem)
// {
// case 1:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.CarrierName) { }); break;
// case 2:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Logo, isPic: 1) { }); break;
// case 3:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Developers) { }); break;
// case 4:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.VideoUrl) { }); break;
// case 5:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Address) { }); break;
// case 6:
// datarow.ExcelRows.Add(new ExcelColumn(value: Common.ConvertHelper.FormatDate(item.OpenTime)) { }); break;
// case 7:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.CategoryName) { }); break;
// case 8:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Ascription) { }); break;
// case 9:
// datarow.ExcelRows.Add(new ExcelColumn(value: (item.CarrierSize.ToString()) + "万平方米") { }); break;
// case 10:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.PropertyComposition) { }); break;
// case 11:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Location) { }); break;
// case 12:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Crowd) { }); break;
// case 13:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.VisitorsFlowrate) { }); break;
// case 14:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.LayersNum) { }); break;
// case 15:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.SupportingFacilities) { }); break;
// case 16:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.ManagementCompany) { }); break;
// case 17:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.BrandDemand) { }); break;
// case 18:
// datarow.ExcelRows.Add(new ExcelColumn(value: (item.BuildingCarriermetroList != null && item.BuildingCarriermetroList.Any()) ? (string.Join(",", item.BuildingCarriermetroList.Select(x => x.MetroNum + "号线" + x.MetroName + x.Distance))) : "") { }); break;
// }
// }
// slist.Add(datarow);
// }
// #endregion
// bytes = ExcelTempLateHelper.ToBrandExcelExtend(slist, filePath);
// using (FileStream fs = new FileStream(excelFileUrl, FileMode.CreateNew))
// {
// fs.Write(bytes, 0, bytes.Length);
// }
// }
// catch (Exception ex)
// {
// bytes = ExcelTempLateHelper.ToBrandExcelExtend(slist, filePath);
// using (FileStream fs = new FileStream(excelFileUrl, FileMode.CreateNew))
// {
// fs.Write(bytes, 0, bytes.Length);
// }
// LogHelper.Write(ex, string.Format("GetBuildingCarrierListToExcel_Requst: {0}", JsonHelper.Serialize(demodel)));
// }
//}
/// <summary>
/// 【商载通】企业服务分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetEnterpriseServicesPage
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
ResultPageModel
pageModel
=
new
ResultPageModel
()
{
pageIndex
=
parms
.
GetInt
(
"pageIndex"
),
pageSize
=
parms
.
GetInt
(
"pageSize"
),
};
RB_EnterpriseServices_Extend
query
=
new
RB_EnterpriseServices_Extend
()
{
Name
=
parms
.
GetStringValue
(
"Name"
),
CategoryId
=
parms
.
GetInt
(
"CategoryId"
),
};
query
.
TenantId
=
RequestParm
.
TenantId
;
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
List
<
object
>
list
=
new
List
<
object
>();
var
dataList
=
buildingCarrierModule
.
GetEnterpriseServicesPageModule
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
dataList
)
{
string
CoverImg
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
Banner
))
{
try
{
List
<
string
>
imgList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
item
.
Banner
);
CoverImg
=
imgList
?.
FirstOrDefault
()
??
""
;
}
catch
{
}
}
list
.
Add
(
new
{
item
.
ServiceId
,
item
.
Name
,
CoverImg
,
item
.
Introduction
,
item
.
Address
,
item
.
LatAndLon
,
item
.
OperationTime
,
item
.
CategoryId
,
item
.
CategoryName
,
item
.
Renovation
,
item
.
Payment
,
item
.
HandoverDate
,
item
.
PropertyFee
,
item
.
IntentionalFloor
,
item
.
ElevatorNum
,
item
.
RentFee
,
item
.
ContactName
,
item
.
ContactPhone
,
CreateDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
CreateDate
),
});
}
pageModel
.
count
=
Convert
.
ToInt32
(
rowsCount
);
pageModel
.
pageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 【商载通】新增修改企业服务
/// </summary>
/// <returns></returns>
public
ApiResult
SetEnterpriseServicesInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
RB_EnterpriseServices_Extend
model
=
new
RB_EnterpriseServices_Extend
()
{
ServiceId
=
parms
.
GetInt
(
"ServiceId"
),
Name
=
parms
.
GetStringValue
(
"Name"
),
Introduction
=
parms
.
GetStringValue
(
"FullBIntroductionrandName"
),
DevIntention
=
parms
.
GetStringValue
(
"DevIntention"
),
Address
=
parms
.
GetStringValue
(
"Address"
),
LatAndLon
=
parms
.
GetStringValue
(
"LatAndLon"
),
OperationTime
=
parms
.
GetStringValue
(
"OperationTime"
),
CategoryId
=
parms
.
GetInt
(
"CategoryId"
),
Renovation
=
parms
.
GetStringValue
(
"Renovation"
),
Payment
=
parms
.
GetStringValue
(
"Payment"
),
HandoverDate
=
parms
.
GetStringValue
(
"HandoverDate"
),
IntentionalFloor
=
parms
.
GetInt
(
"IntentionalFloor"
),
ElevatorNum
=
parms
.
GetInt
(
"ElevatorNum"
),
PropertyFee
=
parms
.
GetDecimal
(
"PropertyFee"
),
RentFee
=
parms
.
GetDecimal
(
"RentFee"
),
ContactName
=
parms
.
GetStringValue
(
"ContactName"
),
ContactPhone
=
parms
.
GetStringValue
(
"ContactPhone"
),
};
List
<
string
>
BannerList
=
new
List
<
string
>();
string
bannerListStr
=
parms
.
GetStringValue
(
"BannerList"
);
if
(!
string
.
IsNullOrEmpty
(
bannerListStr
))
{
try
{
BannerList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
bannerListStr
);
}
catch
{
}
}
model
.
Banner
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
BannerList
);
model
.
TenantId
=
RequestParm
.
TenantId
;
model
.
MallBaseId
=
RequestParm
.
MallBaseId
;
if
(
model
.
ServiceId
>
0
)
{
model
.
UpdateBy
=
RequestParm
.
TenantId
;
model
.
UpdateDate
=
DateTime
.
Now
;
}
else
{
model
.
CreateBy
=
RequestParm
.
TenantId
;
model
.
CreateDate
=
DateTime
.
Now
;
}
bool
flag
=
buildingCarrierModule
.
SetEnterpriseServicesModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据编号获取企业服务详情
/// </summary>
/// <returns></returns>
public
ApiResult
GetEnterpriseServicesInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
ServiceId
=
parms
.
GetInt
(
"ServiceId"
);
if
(
ServiceId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"编号不能为空!"
);
}
List
<
string
>
BannerList
=
new
List
<
string
>();
var
extModel
=
buildingCarrierModule
.
GetEnterpriseServicesInfoModule
(
ServiceId
);
string
Banner
=
extModel
?.
Banner
??
""
;
if
(!
string
.
IsNullOrEmpty
(
Banner
))
{
try
{
BannerList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
Banner
);
}
catch
{
}
}
var
dataObj
=
new
{
ServiceId
=
extModel
?.
ServiceId
??
0
,
Name
=
extModel
?.
Name
??
""
,
Introduction
=
extModel
?.
Introduction
??
""
,
DevIntention
=
extModel
?.
DevIntention
??
""
,
Address
=
extModel
?.
Address
??
""
,
LatAndLon
=
extModel
?.
LatAndLon
??
""
,
OperationTime
=
extModel
?.
OperationTime
??
""
,
CategoryId
=
extModel
?.
CategoryId
??
0
,
CategoryName
=
extModel
?.
CategoryName
??
""
,
Renovation
=
extModel
?.
Renovation
??
""
,
Payment
=
extModel
?.
Payment
??
""
,
HandoverDate
=
extModel
?.
HandoverDate
??
""
,
IntentionalFloor
=
extModel
?.
IntentionalFloor
??
0
,
ElevatorNum
=
extModel
?.
ElevatorNum
??
0
,
PropertyFee
=
extModel
?.
PropertyFee
??
0
,
RentFee
=
extModel
?.
RentFee
??
0
,
ContactName
=
extModel
?.
ContactName
??
""
,
ContactPhone
=
extModel
?.
ContactPhone
??
""
,
BannerList
,
};
return
ApiResult
.
Success
(
data
:
dataObj
);
}
/// <summary>
/// 根据编号删除企业服务
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveEnterpriseServicesInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
ServiceId
=
parms
.
GetInt
(
"ServiceId"
);
if
(
ServiceId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"参数不能为空"
);
}
bool
flag
=
buildingCarrierModule
.
RemoveEnterpriseServicesModule
(
ServiceId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
///// <summary>
///// 获取品牌下载枚举列表
///// </summary>
///// <returns></returns>
//[HttpPost]
//public ApiResult GetBrandEnterpriseExportEnumList()
//{
// var list = EnumHelper.GetEnumList(typeof(Common.Enum.TradePavilion.BrandEnterpriseExportEnum));
// return ApiResult.Success("", list.Select(x => new
// {
// Name = x.Key,
// Id = Convert.ToInt32(x.Value)
// }));
//}
///// <summary>
///// 检查品牌文件是否存在
///// </summary>
///// <returns></returns>
//[HttpPost]
//public async Task<ApiResult> CheckBrandEnterpriseFile()
//{
// JObject parms = JObject.Parse(RequestParm.msg.ToString());
// RB_Brand_Enterprise_Extend query = new RB_Brand_Enterprise_Extend()
// {
// BrandEnterpriseType = parms.GetInt("BrandEnterpriseType"),
// BrandName = parms.GetStringValue("BrandName"),
// CategoryId = parms.GetInt("CategoryId"),
// };
// query.MallBaseId = RequestParm.MallBaseId;
// query.TenantId = RequestParm.TenantId;
// string RandomNum = parms.GetStringValue("RandomNum");
// string ExcelEnumIdsStr = parms.GetStringValue("ExcelEnumIds");
// List<int> ExcelEnumIds = JsonConvert.DeserializeObject<List<int>>(ExcelEnumIdsStr);
// string hashKey = Common.Config.GetHash(Common.Plugin.JsonHelper.Serialize(query) + ExcelEnumIdsStr + ExcelEnumIdsStr);
// string fileName = "消费品牌企业服务信息" + ".xls";
// string filePath = Path.Combine(Directory.GetCurrentDirectory(), "upfile/temporary");
// if (System.IO.Directory.Exists(filePath) == false)//如果不存在就创建file文件夹
// {
// System.IO.Directory.CreateDirectory(filePath);
// }
// string tempPath = filePath + "\\" + hashKey + "\\";
// //如果不存在就创建file文件夹
// if (!System.IO.Directory.Exists(tempPath))
// {
// System.IO.Directory.CreateDirectory(tempPath);
// }
// string fileUrl = tempPath + fileName;
// string key = "Mall_SD_BRANDENTERPRISE_" + hashKey;
// string redisValue = redisHelper.StringGet(key);
// if (string.IsNullOrEmpty(redisValue))
// {
// redisValue = redisHelper.StringGet(key);
// if (string.IsNullOrEmpty(redisValue))
// {
// redisHelper.StringSet(key, fileName, TimeSpan.FromMinutes(10));
// Task.Run(() =>
// {
// GetBrandEnterpriseListToExcel(query, ExcelEnumIds, tempPath, fileUrl);
// });
// }
// }
// return await Task.Run<ApiResult>(() =>
// {
// ApiResult apiResult = new ApiResult()
// {
// resultCode = 0,
// };
// if (System.IO.File.Exists(fileUrl))
// {
// var filePath = "/upfile/temporary/" + hashKey + "/";
// var fileUrl = "/upfile/temporary/" + hashKey + "/" + fileName;
// apiResult.resultCode = 1;
// apiResult.data = new { filePath, fileUrl };
// apiResult.message = key;
// }
// return apiResult;
// });
//}
///// <summary>
/////【商载通】 生成品牌文件
///// </summary>
///// <param name="demodel">查询参数</param>
///// <param name="ExcelEnumIdList">需要导出的列</param>
///// <param name="filePath">Logon存放路劲</param>
///// <param name="excelFileUrl">Excel文件路径</param>
//private async void GetBrandEnterpriseListToExcel(RB_Brand_Enterprise_Extend demodel, List<int> ExcelEnumIdList, string filePath, string excelFileUrl)
//{
// byte[] bytes = null;
// List<ExcelDataSource> slist = new List<ExcelDataSource>();
// var Enumlist = EnumHelper.GetEnumList(typeof(Common.Enum.TradePavilion.BrandEnterpriseExportEnum));
// ExcelDataSource header = new ExcelDataSource()
// {
// ExcelRows = new List<ExcelColumn>(30)
// {
// new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
// }
// };
// foreach (var item in ExcelEnumIdList)
// {
// var Name = Enumlist.Where(x => x.Value == item.ToString()).FirstOrDefault().Key ?? "";
// header.ExcelRows.Add(new ExcelColumn(value: Name) { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
// }
// slist.Add(header);
// try
// {
// var list = buildingCarrierModule.GetBrandEnterpriseListModule(demodel);
// List<Action> actions = new List<Action>();
// if (list != null && list.Count > 0)
// {
// //判断是否下载图片
// if (ExcelEnumIdList.Contains(4))
// {
// foreach (var item in list)
// {
// actions.Add(new Action(() =>
// {
// DownLoadUrl(item.Logo, filePath);
// }));
// }
// }
// }
// if (actions != null && actions.Count > 0)
// {
// ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 4 }; // 设置最大并行度为 4
// Parallel.Invoke(options, actions.ToArray());
// }
// #region 组装数据
// int Num = 0;
// foreach (var item in list)
// {
// Num++;
// ExcelDataSource datarow = new ExcelDataSource()
// {
// ExcelRows = new List<ExcelColumn>(30)
// {
// new ExcelColumn(value:Num.ToString()){ },
// }
// };
// foreach (var qitem in ExcelEnumIdList)
// {
// switch (qitem)
// {
// case 1:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.CategoryName) { }); break;
// case 2:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.FullBrandName) { }); break;
// case 3:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.BrandName) { }); break;
// case 4:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Logo, isPic: 1) { }); break;
// case 5:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.VideoUrl) { }); break;
// case 6:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.ShopNum.ToString()) { }); break;
// case 7:
// datarow.ExcelRows.Add(new ExcelColumn(value: (item.BuiltUpArea.ToString()) + "-" + (item.EndBuiltUpArea.ToString())) { }); break;
// case 8:
// datarow.ExcelRows.Add(new ExcelColumn(value: (item.AreaRequirement.ToString()) + "-" + (item.EndAreaRequirement.ToString())) { }); break;
// case 9:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.CustomerType) { }); break;
// case 10:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.BrandType) { }); break;
// case 11:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Introduce) { }); break;
// case 12:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.DevIntention) { }); break;
// case 13:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.PropertyDemand) { }); break;
// case 14:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Cooperation) { }); break;
// case 15:
// datarow.ExcelRows.Add(new ExcelColumn(value: item.Complementary) { }); break;
// }
// }
// slist.Add(datarow);
// }
// #endregion
// bytes = ExcelTempLateHelper.ToBrandExcelExtend(slist, filePath);
// using (FileStream fs = new FileStream(excelFileUrl, FileMode.CreateNew))
// {
// fs.Write(bytes, 0, bytes.Length);
// }
// }
// catch (Exception ex)
// {
// bytes = ExcelTempLateHelper.ToBrandExcelExtend(slist, filePath);
// using (FileStream fs = new FileStream(excelFileUrl, FileMode.CreateNew))
// {
// fs.Write(bytes, 0, bytes.Length);
// }
// LogHelper.Write(ex, string.Format("GetBrandEnterpriseListToExcel_Request: {0}", JsonHelper.Serialize(demodel)));
// }
//}
}
}
\ 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