Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
7a3134eb
Commit
7a3134eb
authored
Jun 25, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拍卖订单,利润计算逻辑修改,原来的分销计算利润废弃,改为介绍费和平台服务费扣除,剩余的为卖家利润
parent
1484c1ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
6 deletions
+30
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+30
-6
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
7a3134eb
...
@@ -267,22 +267,46 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
...
@@ -267,22 +267,46 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
map
.
put
(
"prepayId"
,
null
);
map
.
put
(
"prepayId"
,
null
);
//计算分销商的利润
//计算分销商的利润
DistributorProfit
distributorProfit
=
new
DistributorProfit
();
DistributorProfit
distributorProfit
=
new
DistributorProfit
();
//利润,该记录在用户未付款时未无效,仅用于在分销商查看订单详情时,计算预计利润
Double
profit
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.03
;
//平台服务费,默认15%
CollectorWhiteList
collectorWhiteList
=
collectorWhiteListDao
.
findById
(
auctionConfig
.
getCreatorId
());
double
channelCostRebate
=
0.15
;
if
(
collectorWhiteList
!=
null
)
{
BigDecimal
channelCost
=
collectorWhiteList
.
getChannelCostRebate
();
channelCost
=
PriceUtil
.
convertToDivide
(
channelCost
);
channelCostRebate
=
channelCost
.
doubleValue
();
}
logger
.
info
(
"藏家id:{} 生成新拍卖订单,平台服务费比例:{}"
,
auctionConfig
.
getCreatorId
(),
channelCostRebate
);
double
channelServiceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
channelCostRebate
;
distributorProfit
.
setChannelCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
channelServiceCost
)));
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto
followFansRecordRequestDto
=
new
FollowFansRecordRequestDto
();
followFansRecordRequestDto
.
setFollowerId
(
auctionConfig
.
getCreatorId
());
followFansRecordRequestDto
.
setFansId
(
auctionRecord
.
getUserId
());
double
rebate
=
distributorProfitService
.
getIntroduceRebate
(
followFansRecordRequestDto
);
double
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
rebate
;
distributorProfit
.
setIntroduceCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
introduceCost
)));
distributorProfit
.
setDistributionOrderId
(
distributionOrderId
);
distributorProfit
.
setDistributionOrderId
(
distributionOrderId
);
distributorProfit
.
setDistributorId
(
distributionOrder
.
getSellerId
());
distributorProfit
.
setDistributorId
(
distributionOrder
.
getSellerId
());
distributorProfit
.
setItemId
(
distributionOrder
.
getItemId
());
distributorProfit
.
setItemId
(
distributionOrder
.
getItemId
());
distributorProfit
.
setItemNum
(
distributionOrder
.
getItemNum
());
distributorProfit
.
setItemNum
(
distributionOrder
.
getItemNum
());
distributorProfit
.
setAmount
(
distributionOrder
.
getAmount
());
distributorProfit
.
setAmount
(
distributionOrder
.
getAmount
());
distributorProfit
.
setItemCost
(
auctionConfig
.
getStartPrice
());
distributorProfit
.
setItemCost
(
auctionConfig
.
getStartPrice
());
distributorProfit
.
setProfit
((
long
)
Math
.
floor
(
profit
));
distributorProfit
.
setChannelCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
channelServiceCost
)));
distributorProfit
.
setIntroduceCost
(
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
introduceCost
)));
long
profit
=
distributionOrder
.
getAmount
()
-
distributorProfit
.
getChannelCost
()
-
distributorProfit
.
getIntroduceCost
();
distributorProfit
.
setProfit
(
profit
);
distributorProfit
.
setCreateTime
(
new
Date
());
distributorProfit
.
setCreateTime
(
new
Date
());
distributorProfit
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
());
distributorProfit
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
());
distributorProfit
.
setIsValid
(
false
);
distributorProfit
.
setIsValid
(
false
);
distributorProfitDao
.
insert
(
distributorProfit
);
distributorProfitDao
.
insert
(
distributorProfit
);
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
dto
.
getItemId
());
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
dto
.
getItemId
());
//查询参与出价的所有用户所对应的分销商,可以
评
分成交额的3%的利润
//查询参与出价的所有用户所对应的分销商,可以
平
分成交额的3%的利润
List
<
AuctionRecord
>
auctionRecordList
=
auctionRecordDao
.
findByItemId
(
dto
.
getItemId
());
List
<
AuctionRecord
>
auctionRecordList
=
auctionRecordDao
.
findByItemId
(
dto
.
getItemId
());
List
<
AuctionRecord
>
filterRecordList
=
auctionRecordList
.
stream
()
List
<
AuctionRecord
>
filterRecordList
=
auctionRecordList
.
stream
()
.
filter
(
StringUtil
.
distinctByKey
(
AuctionRecord:
:
getDistributorId
))
.
filter
(
StringUtil
.
distinctByKey
(
AuctionRecord:
:
getDistributorId
))
...
@@ -317,13 +341,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
...
@@ -317,13 +341,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
Result
result
=
sendMsgService
.
auctionSuccessForDistributorsMsg
(
auctionOfferNoticeMsg
);
Result
result
=
sendMsgService
.
auctionSuccessForDistributorsMsg
(
auctionOfferNoticeMsg
);
if
(!
result
.
getSuccess
())
{
if
(!
result
.
getSuccess
())
{
String
url
=
wxAppletApi
.
getUrlLink
(
AUCTION_MSG_URL
,
"itemId="
+
supplierItem
.
getId
()
+
"&shareRecordId="
);
String
url
=
wxAppletApi
.
getUrlLink
(
AUCTION_MSG_URL
,
"itemId="
+
supplierItem
.
getId
()
+
"&shareRecordId="
);
String
msg
=
"您分
销
的拍品"
+
supplierItem
.
getName
()
+
"已成拍,成交价是"
+
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
())
+
String
msg
=
"您分
享
的拍品"
+
supplierItem
.
getName
()
+
"已成拍,成交价是"
+
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
())
+
"元,您预计获得利润"
+
PriceUtil
.
convertDoubleToString
(
Math
.
floor
(
averageProfit
))
+
"元。请前往"
+
url
+
"查看"
;
"元,您预计获得利润"
+
PriceUtil
.
convertDoubleToString
(
Math
.
floor
(
averageProfit
))
+
"元。请前往"
+
url
+
"查看"
;
aliSmsSender
.
sendSms
(
record
.
getDistributorId
(),
msg
);
aliSmsSender
.
sendSms
(
record
.
getDistributorId
(),
msg
);
}
}
}
else
{
}
else
{
String
url
=
wxAppletApi
.
getUrlLink
(
AUCTION_MSG_URL
,
"itemId="
+
supplierItem
.
getId
()
+
"&shareRecordId="
);
String
url
=
wxAppletApi
.
getUrlLink
(
AUCTION_MSG_URL
,
"itemId="
+
supplierItem
.
getId
()
+
"&shareRecordId="
);
String
msg
=
"您分
销
的拍品"
+
supplierItem
.
getName
()
+
"已成拍,成交价是"
+
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
())
+
String
msg
=
"您分
享
的拍品"
+
supplierItem
.
getName
()
+
"已成拍,成交价是"
+
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
())
+
"元,您预计获得利润"
+
PriceUtil
.
convertDoubleToString
(
Math
.
floor
(
averageProfit
))
+
"元。请前往"
+
url
+
"查看"
;
"元,您预计获得利润"
+
PriceUtil
.
convertDoubleToString
(
Math
.
floor
(
averageProfit
))
+
"元。请前往"
+
url
+
"查看"
;
aliSmsSender
.
sendSms
(
record
.
getDistributorId
(),
msg
);
aliSmsSender
.
sendSms
(
record
.
getDistributorId
(),
msg
);
}
}
...
...
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