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
ffa25b8e
Commit
ffa25b8e
authored
Feb 20, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品低利润
parent
0f424d07
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
519 additions
and
2 deletions
+519
-2
RB_Goods.cs
Mall.Model/Entity/Product/RB_Goods.cs
+5
-0
RB_Goods_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Extend.cs
+5
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+1
-0
RB_GoodsRepository.cs
Mall.Repository/Product/RB_GoodsRepository.cs
+7
-0
LiveHouseController.cs
Mall.WebApi/Controllers/AppletWeChat/LiveHouseController.cs
+474
-1
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+24
-1
appsettings.json
Mall.WebApi/appsettings.json
+3
-0
No files found.
Mall.Model/Entity/Product/RB_Goods.cs
View file @
ffa25b8e
...
...
@@ -579,5 +579,10 @@ namespace Mall.Model.Entity.Product
/// 是否为不可开发票商品,1-是
/// </summary>
public
int
IsNoTax
{
get
;
set
;
}
/// <summary>
/// 最低利润率
/// </summary>
public
decimal
MinProfitRate
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Extend.cs
View file @
ffa25b8e
...
...
@@ -16,6 +16,11 @@ namespace Mall.Model.Extend.Product
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_Extend
:
RB_Goods
{
/// <summary>
/// 是否查询低利润商品 1是 其他否
/// </summary>
public
int
IsSelectLowProfit
{
get
;
set
;
}
/// <summary>
/// 课程是否已付款
/// </summary>
...
...
Mall.Module.Product/ProductModule.cs
View file @
ffa25b8e
...
...
@@ -7013,6 +7013,7 @@ namespace Mall.Module.Product
{
nameof
(
RB_Goods
.
Remark
),
demodel
.
Remark
},
{
nameof
(
RB_Goods
.
GoodsPageType
),
demodel
.
GoodsPageType
},
{
nameof
(
RB_Goods
.
IsNoTax
),
demodel
.
IsNoTax
},
{
nameof
(
RB_Goods
.
MinProfitRate
),
demodel
.
MinProfitRate
},
};
if
(
goodsModel
.
IsProcurement
==
1
)
{
...
...
Mall.Repository/Product/RB_GoodsRepository.cs
View file @
ffa25b8e
...
...
@@ -99,6 +99,9 @@ namespace Mall.Repository.Product
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
SupplierId
)}
=
{
dmodel
.
SupplierId
}
"
;
}
if
(
dmodel
.
MinProfitRate
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
MinProfitRate
)}
<
{
dmodel
.
MinProfitRate
}
"
;
}
if
(
dmodel
.
GoodsPageType
.
HasValue
)
{
if
(
dmodel
.
GoodsPageType
==
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
)
...
...
@@ -608,6 +611,10 @@ where {where} group by g.Id order by {orderBy}";
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
SupplierId
)}
=
{
dmodel
.
SupplierId
}
"
;
}
if
(
dmodel
.
MinProfitRate
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
MinProfitRate
)}
<
{
dmodel
.
MinProfitRate
}
"
;
}
if
(
dmodel
.
GoodsPageType
.
HasValue
)
{
if
(
dmodel
.
GoodsPageType
==
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
)
...
...
Mall.WebApi/Controllers/AppletWeChat/LiveHouseController.cs
View file @
ffa25b8e
...
...
@@ -17,7 +17,10 @@ using Mall.WebApi.Filter;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration.Json
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
namespace
Mall.WebApi.Controllers.AppletWeChat
{
...
...
@@ -907,6 +910,476 @@ namespace Mall.WebApi.Controllers.AppletWeChat
#
endregion
#
region
erp
低利润商品查询
/// <summary>
/// 商品后台分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductGoodsPageList
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
JObject
parameters
=
JObject
.
Parse
(
parms
.
msg
.
ToString
());
RB_Goods_Extend
demodel
=
new
RB_Goods_Extend
()
{
Name
=
parameters
.
GetStringValue
(
"Name"
),
GoodsStatus
=
parameters
.
GetInt
(
"GoodsStatus"
),
IsSelectSellOut
=
parameters
.
GetInt
(
"IsSelectSellOut"
),
CategoryIds
=
parameters
.
GetStringValue
(
"CategoryIds"
),
Id
=
parameters
.
GetInt
(
"Id"
),
StartTime
=
parameters
.
GetStringValue
(
"StartTime"
),
EndTime
=
parameters
.
GetStringValue
(
"EndTime"
),
OrderBy
=
parameters
.
GetInt
(
"OrderBy"
)
};
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
decimal
MinProfitRate
=
0
;
if
(
demodel
.
TenantId
==
1
)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if
(
demodel
.
IsSelectLowProfit
==
1
)
{
demodel
.
MinProfitRate
=
MinProfitRate
;
}
var
list
=
productModule
.
GetProductGoodsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Sort
,
x
.
CoverImage
,
CategoryList
=
x
.
CategoryList
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
CategoryName
}),
x
.
SellingPrice
,
x
.
InventoryNum
,
x
.
SalesNum
,
x
.
GoodsBuyNum
,
x
.
IsQuickBuy
,
x
.
IsProxy
,
x
.
IsProcurement
,
x
.
ProcurementStatus
,
x
.
GoodsStatus
,
x
.
TenantId
,
x
.
MallBaseId
,
x
.
SendArea
,
x
.
Remark
,
GoodsPageTypeStr
=
x
.
GoodsPageType
.
GetEnumName
(),
CarouselImageList
=
x
.
CarouselImageList
.
Select
(
qitem
=>
qitem
.
Path
).
ToList
(),
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
x
.
IsNoTax
,
IsLowProfit
=
MinProfitRate
>
0
?
x
.
MinProfitRate
<
MinProfitRate
?
1
:
2
:
2
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 商品信息下载
/// </summary>
[
HttpPost
]
public
FileContentResult
GetProductGoodsListToExcel
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
parms
.
msg
.
ToString
());
string
ExcelName
=
"商品列表"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"序号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品名称"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"原价"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"成本价"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品详情"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品缩略图"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品轮播图"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品视频"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"单位"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"售价"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"是否使用规格"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"规格组"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"商品库存"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"虚拟销量"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"购物数量限制"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"单品满件包邮"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"单品满额包邮"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"赠送积分"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"赠送积分类型"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"可抵扣积分"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"可抵扣积分类型"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"允许多件累计折扣"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"自定义分享图片"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"自定义分享标题"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"排序"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"限购订单"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"是否单独区域购买"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"区域限购详情"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"规格详情"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"是否快速购买"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"是否热销"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"是否面议"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
slist
.
Add
(
header
);
try
{
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
decimal
MinProfitRate
=
0
;
if
(
demodel
.
TenantId
==
1
)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if
(
demodel
.
IsSelectLowProfit
==
1
)
{
demodel
.
MinProfitRate
=
MinProfitRate
;
}
var
list
=
productModule
.
GetProductGoodsListForExcel
(
demodel
);
#
region
组装数据
int
Num
=
0
;
foreach
(
var
item
in
list
)
{
Num
++;
string
GGZ
=
""
;
string
GGMX
=
""
;
if
(
item
.
IsCustomSpecification
==
1
)
{
var
obj
=
item
.
SpecificationList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
Name
,
x
.
Sort
,
x
.
EnabledImage
,
SpecificationValueList
=
x
.
SpecificationValueList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
GoodsId
,
z
.
SpecificationId
,
z
.
Name
,
z
.
Image
,
z
.
Sort
})
});
GGZ
=
JsonConvert
.
SerializeObject
(
obj
);
//序列化
GGMX
=
JsonConvert
.
SerializeObject
(
item
.
SpecificationPriceList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
SpecificationSort
,
x
.
SellingPrice
,
x
.
InventoryNum
,
x
.
GoodsWeight
,
x
.
GoodsNumbers
}));
}
else
{
List
<
object
>
objList
=
new
List
<
object
>();
List
<
object
>
SpecificationValueList
=
new
List
<
object
>();
SpecificationValueList
.
Add
(
new
{
Id
=
0
,
GoodsId
=
item
.
Id
,
SpecificationId
=
0
,
Name
=
item
.
DefaultSpecificationName
,
Image
=
""
,
Sort
=
0
});
objList
.
Add
(
new
{
Id
=
0
,
GoodsId
=
item
.
Id
,
Name
=
"规格"
,
Sort
=
0
,
EnabledImage
=
2
,
SpecificationValueList
});
GGZ
=
JsonConvert
.
SerializeObject
(
objList
);
//序列化
List
<
object
>
SpecificationPriceList
=
new
List
<
object
>();
SpecificationPriceList
.
Add
(
new
{
Id
=
0
,
GoodsId
=
item
.
Id
,
SpecificationSort
=
""
,
item
.
SellingPrice
,
item
.
InventoryNum
,
item
.
GoodsWeight
,
item
.
GoodsNumbers
});
GGMX
=
JsonConvert
.
SerializeObject
(
SpecificationPriceList
);
//序列化
}
string
AreaList
=
""
;
if
(
item
.
IsAreaBuy
==
1
)
{
AreaList
=
JsonConvert
.
SerializeObject
(
item
.
AreaList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
AreaId
,
x
.
AreaName
,
x
.
AreaType
}));
}
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
Num
.
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
Name
){
},
new
ExcelColumn
(
value
:(
item
.
OriginalPrice
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
CostPrice
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
GoodsDetails
){
},
new
ExcelColumn
(
value
:
item
.
CoverImage
){
},
new
ExcelColumn
(
value
:
item
.
CarouselImage
){
},
new
ExcelColumn
(
value
:
item
.
VideoAddress
){
},
new
ExcelColumn
(
value
:
item
.
Unit
){
},
new
ExcelColumn
(
value
:(
item
.
SellingPrice
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsCustomSpecification
??
2
).
ToString
()){
},
new
ExcelColumn
(
value
:
GGZ
.
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
InventoryNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
SalesNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
LimitBuyGoodsNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
FullNumPinkage
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
FullMoneyPinkage
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IntegralPresent
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IntegralPresentType
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
PointsDeduction
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
PointsDeductionType
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsMultipleDeduction
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
CustomShareImage
??
""
){
},
new
ExcelColumn
(
value
:
item
.
CustomShareTitles
??
""
){
},
new
ExcelColumn
(
value
:(
item
.
Sort
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
LimitBuyOrderNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsAreaBuy
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:
AreaList
.
ToString
()){
},
new
ExcelColumn
(
value
:
GGMX
.
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsQuickBuy
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsSellWell
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
item
.
IsGoodsNegotiable
??
0
).
ToString
()){
},
}
,
ColumnHight
=
30
};
slist
.
Add
(
datarow
);
}
#
endregion
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetFileFromWebApi_requestData: {0}"
,
JsonHelper
.
Serialize
(
parms
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
/// <summary>
/// 获取分类树形结构
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductCategoryTreeList
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
RB_Product_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Category_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductCategoryTreeList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取商品详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductGoodsInfo
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
JObject
prams
=
JObject
.
Parse
(
parms
.
msg
.
ToString
());
int
GoodsId
=
prams
.
GetInt
(
"GoodsId"
,
0
);
if
(
GoodsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
model
=
productModule
.
GetProductGoodsInfo
(
GoodsId
,
parms
.
TenantId
,
parms
.
MallBaseId
);
object
obj
=
new
object
();
if
(
model
!=
null
)
{
obj
=
new
{
model
?.
Id
,
model
?.
Name
,
model
?.
CarouselImage
,
model
?.
VideoAddress
,
model
?.
CustomShareTitles
,
model
?.
CustomShareImage
,
model
?.
CustomShareImagePath
,
model
?.
GoodsStatus
,
model
?.
InventoryNum
,
model
?.
DefaultSpecificationName
,
model
?.
IsCustomSpecification
,
model
?.
Sort
,
model
?.
SellingPrice
,
model
?.
OriginalPrice
,
model
?.
Unit
,
model
?.
CostPrice
,
model
?.
IsGoodsNegotiable
,
model
?.
SalesNum
,
model
?.
GoodsNumbers
,
model
?.
GoodsWeight
,
model
?.
IsDefaultService
,
model
?.
GoodsService
,
model
?.
FreightId
,
model
?.
FreightName
,
model
?.
FormsId
,
model
?.
FormsName
,
model
?.
LimitBuyGoodsNum
,
model
?.
LimitBuyOrderNum
,
model
?.
FullNumPinkage
,
model
?.
FullMoneyPinkage
,
model
?.
IsAreaBuy
,
model
?.
IntegralPresent
,
model
?.
IntegralPresentType
,
model
?.
PointsDeduction
,
model
?.
PointsDeductionType
,
model
?.
IsMultipleDeduction
,
model
?.
GoodsDetails
,
model
?.
SeparateDistribution
,
model
?.
SeparateDistributionType
,
model
?.
SeparateDistributionMoneyType
,
model
?.
EnjoyMember
,
model
?.
SeparateSetMember
,
model
?.
IsQuickBuy
,
model
?.
SupplierId
,
model
?.
IsProxy
,
model
?.
ProxyType
,
model
?.
ProxyRises
,
model
?.
ProxyMoney
,
model
?.
IsProcurement
,
model
?.
Commission
,
model
?.
IsLiveGoods
,
model
?.
SendArea
,
model
?.
Remark
,
model
?.
GoodsPageType
,
model
?.
IsNoTax
,
CategoryList
=
model
?.
CategoryList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
CategoryId
,
x
.
CategoryName
}),
SpecificationList
=
model
?.
SpecificationList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
EnabledImage
,
x
.
Name
,
x
.
Sort
,
SpecificationValueList
=
x
.
SpecificationValueList
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
Image
,
y
.
ImagePath
,
y
.
Name
,
y
.
Sort
})
}),
SpecificationPriceList
=
model
?.
SpecificationPriceList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsNumbers
,
x
.
GoodsWeight
,
x
.
InventoryNum
,
x
.
SellingPrice
,
x
.
SpecificationSort
,
x
.
AttrList
,
x
.
Commission
,
x
.
CostMoney
}),
AreaList
=
model
?.
AreaList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
AreaId
,
x
.
AreaName
,
x
.
AreaType
}),
DistributionCommissionList
=
model
?.
DistributionCommissionList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
DistributorGrade
,
x
.
OneCommission
,
x
.
SpecificationSort
,
x
.
ThreeCommission
,
x
.
TwoCommission
}),
DistributionCommissionTreeList
=
model
?.
DistributionCommissionTreeList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
SpecificationSort
,
x
.
AttrList
,
GradeCommissionList
=
x
.
GradeCommissionList
.
Select
(
y
=>
new
{
y
.
DistributorGrade
,
y
.
OneCommission
,
y
.
ThreeCommission
,
y
.
TwoCommission
})
}),
MemberPriceList
=
model
?.
MemberPriceList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
MemberGrade
,
x
.
MemberPrice
,
x
.
SpecificationSort
}),
MemberPriceTreeList
=
model
?.
MemberPriceTreeList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
SpecificationSort
,
x
.
AttrList
,
GradePriceList
=
x
.
GradePriceList
.
Select
(
y
=>
new
{
y
.
MemberGrade
,
y
.
MemberPrice
})
}),
model
?.
CarouselImageList
,
model
?.
ServiceList
,
model
?.
PresentFXGrade
,
model
?.
PresentFXMonth
,
model
?.
Advertising
,
model
?.
SubName
,
model
?.
MarketingLogo
,
model
?.
ShelvesDate
,
model
?.
DownDate
,
model
?.
VideoType
,
model
?.
IntegralComment
,
model
?.
IntegralCommentType
,
};
}
return
ApiResult
.
Success
(
""
,
obj
);
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
ffa25b8e
...
...
@@ -16,6 +16,8 @@ using Newtonsoft.Json.Linq;
using
Mall.Common
;
using
Mall.Module.Product
;
using
Mall.AOP
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration.Json
;
namespace
Mall.WebApi.Controllers.MallBase
{
...
...
@@ -1222,6 +1224,15 @@ namespace Mall.WebApi.Controllers.MallBase
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
decimal
MinProfitRate
=
0
;
if
(
demodel
.
TenantId
==
1
)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if
(
demodel
.
IsSelectLowProfit
==
1
)
{
demodel
.
MinProfitRate
=
MinProfitRate
;
}
var
list
=
productModule
.
GetProductGoodsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
...
...
@@ -1247,7 +1258,8 @@ namespace Mall.WebApi.Controllers.MallBase
GoodsPageTypeStr
=
x
.
GoodsPageType
.
GetEnumName
(),
CarouselImageList
=
x
.
CarouselImageList
.
Select
(
qitem
=>
qitem
.
Path
).
ToList
(),
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
x
.
IsNoTax
x
.
IsNoTax
,
IsLowProfit
=
MinProfitRate
>
0
?
x
.
MinProfitRate
<
MinProfitRate
?
1
:
2
:
2
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
...
...
@@ -1306,6 +1318,15 @@ namespace Mall.WebApi.Controllers.MallBase
{
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
decimal
MinProfitRate
=
0
;
if
(
demodel
.
TenantId
==
1
)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if
(
demodel
.
IsSelectLowProfit
==
1
)
{
demodel
.
MinProfitRate
=
MinProfitRate
;
}
var
list
=
productModule
.
GetProductGoodsListForExcel
(
demodel
);
#
region
组装数据
int
Num
=
0
;
...
...
@@ -1800,6 +1821,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel
.
InventoryNum
??=
0
;
List
<
Model
.
Extend
.
User
.
RB_Distributor_Grade_Extend
>
DGradeList
=
null
;
List
<
Model
.
Extend
.
User
.
RB_Member_Grade_Extend
>
MGradeList
=
null
;
demodel
.
MinProfitRate
=
0
;
if
(
demodel
.
IsCustomSpecification
==
1
)
{
demodel
.
InventoryNum
=
0
;
...
...
@@ -1899,6 +1921,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
demodel
.
SellingPrice
=
SellingPrice
;
}
demodel
.
MinProfitRate
=
demodel
.
SpecificationPriceList
.
Where
(
x
=>
x
.
SellingPrice
>
0
&&
x
.
CostMoney
>
0
&&
x
.
Commission
>
0
)?.
Min
(
x
=>
Math
.
Round
(((
x
.
SellingPrice
??
0
)
-
x
.
CostMoney
-
x
.
Commission
)
/
(
x
.
SellingPrice
??
0
),
2
,
MidpointRounding
.
AwayFromZero
))
??
0
;
}
//分销佣金
...
...
Mall.WebApi/appsettings.json
View file @
ffa25b8e
...
...
@@ -84,6 +84,9 @@
"ProcurementDepartment"
:
331
,
"ProcurementCurrencyId"
:
1
},
"MinProfitRate"
:
{
"TenantId1"
:
0.1
},
"InitializeImages"
:
{
"GradeEntranceImage"
:
"1234566778"
},
...
...
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