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
cc002df1
Commit
cc002df1
authored
Nov 08, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
超时未支付扣除保证金
parent
18f2f52a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
14 deletions
+62
-14
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+9
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
...main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
+16
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+3
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributorProfitServiceImpl.java
...ch/wx/impl/distribution/DistributorProfitServiceImpl.java
+3
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
...m/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
+14
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
...-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
+17
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
cc002df1
...
...
@@ -201,18 +201,23 @@ public interface CommConsts {
/**
* 微信手续费,按照最高的
1%
计算
* 微信手续费,按照最高的
0.006
计算
*/
public
final
static
double
WX_COMMISSION_REBATE
=
0.0
1
;
public
final
static
double
WX_COMMISSION_REBATE
=
0.0
06
;
/**
* 默认介绍佣金比例
*/
public
final
static
double
REBATE
=
0.03
;
public
final
static
double
REBATE
=
0.02
;
/**
* 平台服务费
*/
public
final
static
double
CHANNEL_COST_REBATE
=
0.01
;
/**
* 自测账号,不发送短信
*/
public
static
final
List
<
Long
>
NOT_SEND_MSG_USERID
=
Arrays
.
asList
(
9357942L
,
42273900L
,
290775L
,
61091901L
,
299497L
,
61097938L
,
61113888L
,
60652774L
,
60684039L
,
42192256L
,
60652774L
,
291997L
,
61098908L
,
61074146L
);
61113888L
,
60652774L
,
60684039L
,
42192256L
,
60652774L
,
291997L
,
61098908L
,
61074146L
,
2222222222222L
,
6666666666L
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
View file @
cc002df1
...
...
@@ -27,7 +27,9 @@ import com.wwdz.ch.core.entity.DistributionOrderNoticeMsg;
import
com.wwdz.ch.core.entity.PayNoticeMsg
;
import
com.wwdz.ch.core.service.SendMsgService
;
import
com.wwdz.ch.db.dto.request.distribution.GroupPurchaseRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.wx.service.distribution.*
;
import
com.wwdz.ch.wx.service.openShop.AuctionEarnestService
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.StringUtils
;
...
...
@@ -146,6 +148,9 @@ public class WxPayCallbackController {
@Autowired
RedissonClient
redissonClient
;
@Autowired
AuctionEarnestService
auctionEarnestService
;
@RequestMapping
(
value
=
"/getPayNotify"
)
public
String
payNotify
(
HttpServletRequest
request
)
throws
IOException
{
logger
.
info
(
"------------------ 收到微信支付回调通知 ------------------"
);
...
...
@@ -362,6 +367,17 @@ public class WxPayCallbackController {
//更新拍品配置中的状态为"成交"
auctionConfigDao
.
updateState
(
distributionOrder
.
getItemId
(),
AuctionEnum
.
StateEnum
.
DEALED
.
getCode
());
//释放用户拍卖保证金
EarnestRecordRequestDto
releaseEarnestDto
=
new
EarnestRecordRequestDto
();
releaseEarnestDto
.
setUserId
(
distributionOrder
.
getBuyerId
());
releaseEarnestDto
.
setAuctionPrice
(
distributionOrder
.
getAmount
());
releaseEarnestDto
.
setItemId
(
distributionOrder
.
getItemId
());
Result
releaseEarnestResult
=
auctionEarnestService
.
releaseEarnest
(
releaseEarnestDto
);
if
(!
releaseEarnestResult
.
getSuccess
())
{
logger
.
error
(
"======= 订单号:{}, 拍卖支付回调处理失败,释放保证金失败 ======"
,
distributionOrderId
);
throw
new
Exception
(
"拍卖付款成功后释放保证金失败"
);
}
//新增用户账户的明细,调整月度账单
DistributorProfit
distributorProfit
=
distributorProfitDao
.
findById
(
distributionOrderId
);
userAccountDetailService
.
create
(
distributionOrder
,
distributorProfit
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
cc002df1
...
...
@@ -481,9 +481,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
map
.
put
(
"prepayId"
,
prepayId
);
//计算分销商的利润
DistributorProfit
distributorProfit
=
new
DistributorProfit
();
//平台服务费,默认1
5
%
//平台服务费,默认1%
CollectorWhiteList
collectorWhiteList
=
collectorWhiteListDao
.
findById
(
supplierItem
.
getCreatorId
());
double
channelCostRebate
=
0.15
;
double
channelCostRebate
=
CommConsts
.
CHANNEL_COST_REBATE
;
if
(
collectorWhiteList
!=
null
&&
collectorWhiteList
.
getChannelCostRebate
()
!=
null
)
{
BigDecimal
channelCost
=
collectorWhiteList
.
getChannelCostRebate
();
channelCost
=
PriceUtil
.
convertToDivide
(
channelCost
);
...
...
@@ -494,7 +494,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
//实际订单到账金额
double
realAmount
=
distributionOrder
.
getAmount
().
doubleValue
()
*
(
1
-
CommConsts
.
WX_COMMISSION_REBATE
);
//平台佣金还要减去微信的服务手续费
1%,实际上平台佣金就是订单金额* (平台佣金比例(默认0.15)- 微信手续费(0.01
))
//平台佣金还要减去微信的服务手续费
0.6%,实际上平台佣金就是订单金额* (平台佣金比例(默认0.01)- 微信手续费(0.006
))
//暂时先不考虑
double
channelServiceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
channelCostRebate
;
double
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
rebate
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributorProfitServiceImpl.java
View file @
cc002df1
...
...
@@ -45,8 +45,8 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
public
Double
getIntroduceRebate
(
long
userId
,
long
introducerId
)
{
double
rebate
=
CommConsts
.
REBATE
;
try
{
if
(
introducerId
==
CommConsts
.
SYSTEM_ACCOUNT
)
{
return
rebate
;
/*
if (introducerId == CommConsts.SYSTEM_ACCOUNT) {
return rebate;
}
IntroduceRecord introduceRecord = introduceRecordDao.findByDoubleId(userId, introducerId);
if (introduceRecord == null) {
...
...
@@ -71,7 +71,7 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
rebate = 0.02;
} else if (year == 3) {
rebate = 0.01;
}
}
*/
return
rebate
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取介绍人当前的佣金比例 error : {}"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
View file @
cc002df1
...
...
@@ -27,10 +27,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
...
...
@@ -112,6 +109,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
map
.
put
(
"totalOfferAmount"
,
totalOfferAmount
);
map
.
put
(
"addOfferAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
addOfferAmount
*
CommConsts
.
EARNEST_TRANSFORM_AUCTION_REBATE
));
map
.
put
(
"residueOfferAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
earnestUsableAmount
*
CommConsts
.
EARNEST_TRANSFORM_AUCTION_REBATE
));
map
.
put
(
"option"
,
Arrays
.
asList
(
"100"
,
"200"
,
"300"
,
"400"
,
"500"
,
"600"
));
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"计算用户可出价的额度失败 error : {}"
,
e
);
...
...
@@ -121,6 +119,9 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
@Override
public
Result
checkEnoughEarnest
(
EarnestRecordRequestDto
dto
)
{
/*if (CommConsts.NOT_SEND_MSG_USERID.contains(dto.getUserId())) {
return Result.success();
}*/
try
{
long
auctionPrice
=
dto
.
getAuctionPrice
();
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
...
...
@@ -141,6 +142,9 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
@Transactional
@Override
public
Result
occupyEarnest
(
EarnestRecordRequestDto
dto
)
{
/*if (CommConsts.NOT_SEND_MSG_USERID.contains(dto.getUserId())) {
return Result.success();
}*/
String
lockKey
=
CommConsts
.
EARNEST_ACCOUNT_LOCK
+
dto
.
getUserId
();
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
...
...
@@ -187,6 +191,9 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
@Transactional
@Override
public
Result
releaseEarnest
(
EarnestRecordRequestDto
dto
)
{
/* if (CommConsts.NOT_SEND_MSG_USERID.contains(dto.getUserId())) {
return Result.success();
}*/
String
itemIdKey
=
CommConsts
.
EARNEST_ACCOUNT_LOCK
+
dto
.
getUserId
();
RLock
lock
=
redissonClient
.
getLock
(
itemIdKey
);
try
{
...
...
@@ -240,6 +247,9 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
@Override
public
Result
deductEarnest
(
EarnestRecordRequestDto
dto
)
{
/* if (CommConsts.NOT_SEND_MSG_USERID.contains(dto.getUserId())) {
return Result.success();
}*/
String
itemIdKey
=
CommConsts
.
EARNEST_ACCOUNT_LOCK
+
dto
.
getUserId
();
RLock
lock
=
redissonClient
.
getLock
(
itemIdKey
);
try
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
View file @
cc002df1
...
...
@@ -16,8 +16,10 @@ import com.wwdz.ch.core.entity.AuctionOfferNoticeMsg;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.wx.service.distribution.DistributionOrderService
;
import
com.wwdz.ch.core.service.SendMsgService
;
import
com.wwdz.ch.wx.service.openShop.AuctionEarnestService
;
import
com.xxdxxs.utils.DateUtils
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
...
...
@@ -88,6 +90,9 @@ public class AutoSendMsgJob {
@Autowired
SpecialPerformanceDao
specialPerformanceDao
;
@Autowired
AuctionEarnestService
auctionEarnestService
;
@Value
(
"${dts.wx.auction-msg-url}"
)
private
String
AUCTION_MSG_URL
;
...
...
@@ -250,6 +255,18 @@ public class AutoSendMsgJob {
distributionOrderDao
.
updateState
(
distributionOrder
.
getDistributionOrderId
(),
DistributionEnum
.
DistributionOrderStateEnum
.
CANCEL
.
getCode
());
auctionConfigDao
.
updateState
(
distributionOrder
.
getItemId
(),
AuctionEnum
.
StateEnum
.
GET_NOT_PAY_TO_PASS
.
getCode
());
logger
.
info
(
"================== 拍品:{}, 超过付款时效, 自动取消订单 =================="
,
distributionOrder
.
getItemId
());
//扣除用户保证金
EarnestRecordRequestDto
deductEarnestDto
=
new
EarnestRecordRequestDto
();
deductEarnestDto
.
setUserId
(
distributionOrder
.
getBuyerId
());
deductEarnestDto
.
setAuctionPrice
(
distributionOrder
.
getAmount
());
deductEarnestDto
.
setItemId
(
distributionOrder
.
getItemId
());
Result
releaseEarnestResult
=
auctionEarnestService
.
deductEarnest
(
deductEarnestDto
);
if
(!
releaseEarnestResult
.
getSuccess
())
{
logger
.
error
(
"================== 拍卖订单号:{},超时未支付扣除保证金失败 =================="
,
distributionOrder
.
getDistributionOrderId
());
}
else
{
logger
.
info
(
"================== 拍卖订单号:{}, 超时未支付扣除保证金成功 SUCCESS =================="
,
distributionOrder
.
getDistributionOrderId
());
}
}
});
}
...
...
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