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
9a5e4142
Commit
9a5e4142
authored
Nov 11, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拍卖保证金
parent
9f276395
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
22 deletions
+38
-22
ch-core/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
...re/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserAccountServiceImpl.java
...main/java/com/wwdz/ch/wx/impl/UserAccountServiceImpl.java
+17
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
...m/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
+20
-18
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
View file @
9a5e4142
...
@@ -45,7 +45,7 @@ public class EarnestEnum {
...
@@ -45,7 +45,7 @@ public class EarnestEnum {
GIFT
(
1
,
"赠送保证金"
),
GIFT
(
1
,
"赠送保证金"
),
PAY
(
2
,
"缴纳保证金"
),
PAY
(
2
,
"缴纳保证金"
),
WITHDRAW
(
3
,
"提取保证金"
),
WITHDRAW
(
3
,
"提取保证金"
),
OCCUPY
(
4
,
"占用
保证金
"
),
OCCUPY
(
4
,
"占用
额度
"
),
RELEASE
(
5
,
"释放保证金"
),
RELEASE
(
5
,
"释放保证金"
),
DEDUCT
(-
1
,
"扣除保证金"
),
DEDUCT
(-
1
,
"扣除保证金"
),
;
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserAccountServiceImpl.java
View file @
9a5e4142
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.db.dao.distribution.UserAccountDetailDao;
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.db.dao.distribution.UserAccountDetailDao;
import
com.wwdz.ch.db.dao.openShop.EarnestRecordDao
;
import
com.wwdz.ch.db.dao.openShop.EarnestRecordDao
;
import
com.wwdz.ch.db.dao.openShop.UserAccountDao
;
import
com.wwdz.ch.db.dao.openShop.UserAccountDao
;
import
com.wwdz.ch.db.domain.distribution.UserAccountDetail
;
import
com.wwdz.ch.db.domain.distribution.UserAccountDetail
;
import
com.wwdz.ch.db.domain.openShop.EarnestRecord
;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.wx.service.UserAccountService
;
import
com.wwdz.ch.wx.service.UserAccountService
;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -40,6 +42,7 @@ public class UserAccountServiceImpl implements UserAccountService {
...
@@ -40,6 +42,7 @@ public class UserAccountServiceImpl implements UserAccountService {
try
{
try
{
UserAccount
userAccount
=
userAccountDao
.
findByUserId
(
userId
);
UserAccount
userAccount
=
userAccountDao
.
findByUserId
(
userId
);
if
(
userAccount
==
null
)
{
if
(
userAccount
==
null
)
{
Date
now
=
new
Date
();
UserAccount
newAccount
=
new
UserAccount
();
UserAccount
newAccount
=
new
UserAccount
();
newAccount
.
setUserId
(
userId
);
newAccount
.
setUserId
(
userId
);
newAccount
.
setGuaranteeAmount
(
0L
);
newAccount
.
setGuaranteeAmount
(
0L
);
...
@@ -49,10 +52,21 @@ public class UserAccountServiceImpl implements UserAccountService {
...
@@ -49,10 +52,21 @@ public class UserAccountServiceImpl implements UserAccountService {
newAccount
.
setIntroduceWaitEntryAmount
(
0L
);
newAccount
.
setIntroduceWaitEntryAmount
(
0L
);
newAccount
.
setEarnestAmount
(
0L
);
newAccount
.
setEarnestAmount
(
0L
);
newAccount
.
setGiftEarnestAmount
(
CommConsts
.
GIFT_EARNEST_AMOUNT
);
newAccount
.
setGiftEarnestAmount
(
CommConsts
.
GIFT_EARNEST_AMOUNT
);
newAccount
.
setEarnestUsableAmount
(
CommConsts
.
GIFT_EARNEST_AMOUNT
*
CommConsts
.
EARNEST_TRANSFORM_AUCTION_REBATE
);
newAccount
.
setEarnestUsableAmount
(
CommConsts
.
GIFT_EARNEST_AMOUNT
);
newAccount
.
setCreateTime
(
n
ew
Date
()
);
newAccount
.
setCreateTime
(
n
ow
);
newAccount
.
setUpdateTime
(
n
ew
Date
()
);
newAccount
.
setUpdateTime
(
n
ow
);
userAccountDao
.
insert
(
newAccount
);
userAccountDao
.
insert
(
newAccount
);
//新用户新增默认赠送的保证金额度
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
earnestRecord
.
setUserId
(
userId
);
earnestRecord
.
setAmount
(
CommConsts
.
GIFT_EARNEST_AMOUNT
);
earnestRecord
.
setEntryType
(
EarnestEnum
.
EntryEnum
.
INCREASE
.
getCode
());
earnestRecord
.
setCreateTime
(
now
);
earnestRecord
.
setUpdateTime
(
now
);
earnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
GIFT
.
getCode
());
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecordDao
.
insert
(
earnestRecord
);
}
}
return
Result
.
success
();
return
Result
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
View file @
9a5e4142
...
@@ -109,7 +109,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -109,7 +109,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
map
.
put
(
"totalOfferAmount"
,
totalOfferAmount
);
map
.
put
(
"totalOfferAmount"
,
totalOfferAmount
);
map
.
put
(
"addOfferAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
addOfferAmount
*
CommConsts
.
EARNEST_TRANSFORM_AUCTION_REBATE
));
map
.
put
(
"addOfferAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
addOfferAmount
*
CommConsts
.
EARNEST_TRANSFORM_AUCTION_REBATE
));
map
.
put
(
"residueOfferAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
earnestUsableAmount
*
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"
));
map
.
put
(
"option"
,
Arrays
.
asList
(
"
0.1
"
,
"200"
,
"300"
,
"400"
,
"500"
,
"600"
));
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"计算用户可出价的额度失败 error : {}"
,
e
);
logger
.
error
(
"计算用户可出价的额度失败 error : {}"
,
e
);
...
@@ -204,6 +204,15 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -204,6 +204,15 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
//换算成对应占用的保证金
//换算成对应占用的保证金
long
occupyAmount
=
earnestAmount
.
longValue
();
long
occupyAmount
=
earnestAmount
.
longValue
();
//把上一次的占用记录状态更改为已释放
EarnestRecord
newEarnestRecord
=
new
EarnestRecord
();
newEarnestRecord
.
setUserId
(
dto
.
getUserId
());
newEarnestRecord
.
setItemId
(
dto
.
getItemId
());
newEarnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
newEarnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
RELEASE
.
getCode
());
earnestRecordDao
.
update
(
newEarnestRecord
);
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
earnestRecord
.
setUserId
(
dto
.
getUserId
());
earnestRecord
.
setUserId
(
dto
.
getUserId
());
earnestRecord
.
setAmount
(
earnestAmount
.
longValue
());
earnestRecord
.
setAmount
(
earnestAmount
.
longValue
());
...
@@ -216,14 +225,6 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -216,14 +225,6 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecordDao
.
insert
(
earnestRecord
);
earnestRecordDao
.
insert
(
earnestRecord
);
//把上一次的占用记录状态更改为已释放
EarnestRecord
newEarnestRecord
=
new
EarnestRecord
();
newEarnestRecord
.
setUserId
(
dto
.
getUserId
());
newEarnestRecord
.
setItemId
(
dto
.
getItemId
());
newEarnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
newEarnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
RELEASE
.
getCode
());
earnestRecordDao
.
update
(
newEarnestRecord
);
//更新用户账户,更新保证金额度
//更新用户账户,更新保证金额度
UserAccount
userAccount
=
userAccountDao
.
findByUserId
(
dto
.
getUserId
());
UserAccount
userAccount
=
userAccountDao
.
findByUserId
(
dto
.
getUserId
());
long
earnestUsableAmount
=
userAccount
.
getEarnestUsableAmount
();
long
earnestUsableAmount
=
userAccount
.
getEarnestUsableAmount
();
...
@@ -260,6 +261,15 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -260,6 +261,15 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
//换算成对应占用的保证金
//换算成对应占用的保证金
long
occupyAmount
=
earnestAmount
.
longValue
();
long
occupyAmount
=
earnestAmount
.
longValue
();
//把上一次的占用记录状态更改为已扣除
EarnestRecord
newEarnestRecord
=
new
EarnestRecord
();
newEarnestRecord
.
setUserId
(
dto
.
getUserId
());
newEarnestRecord
.
setItemId
(
dto
.
getItemId
());
newEarnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
newEarnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
DEDUCT
.
getCode
());
earnestRecordDao
.
update
(
newEarnestRecord
);
//保证金扣除记录
//保证金扣除记录
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
earnestRecord
.
setUserId
(
dto
.
getUserId
());
earnestRecord
.
setUserId
(
dto
.
getUserId
());
...
@@ -273,13 +283,6 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -273,13 +283,6 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecordDao
.
insert
(
earnestRecord
);
earnestRecordDao
.
insert
(
earnestRecord
);
//把上一次的占用记录状态更改为已扣除
EarnestRecord
newEarnestRecord
=
new
EarnestRecord
();
newEarnestRecord
.
setUserId
(
dto
.
getUserId
());
newEarnestRecord
.
setItemId
(
dto
.
getItemId
());
newEarnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
newEarnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
DEDUCT
.
getCode
());
earnestRecordDao
.
update
(
newEarnestRecord
);
//更新用户账户,更新保证金额度,先扣除赠送的保证金,额度不够再扣用户自己缴纳的
//更新用户账户,更新保证金额度,先扣除赠送的保证金,额度不够再扣用户自己缴纳的
UserAccount
newUserAccount
=
new
UserAccount
();
UserAccount
newUserAccount
=
new
UserAccount
();
...
@@ -288,8 +291,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
...
@@ -288,8 +291,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
long
oldEarnestAmount
=
userAccount
.
getEarnestAmount
();
long
oldEarnestAmount
=
userAccount
.
getEarnestAmount
();
long
earnestUsableAmount
=
userAccount
.
getEarnestUsableAmount
();
long
earnestUsableAmount
=
userAccount
.
getEarnestUsableAmount
();
long
giftEarnestAmount
=
userAccount
.
getGiftEarnestAmount
();
long
giftEarnestAmount
=
userAccount
.
getGiftEarnestAmount
();
//可用的保证金金额
newUserAccount
.
setEarnestUsableAmount
(
earnestUsableAmount
-
occupyAmount
);
if
(
occupyAmount
<=
giftEarnestAmount
)
{
if
(
occupyAmount
<=
giftEarnestAmount
)
{
//赠送的保证金足够扣除,就只扣除赠送的部分额度
//赠送的保证金足够扣除,就只扣除赠送的部分额度
newUserAccount
.
setGiftEarnestAmount
(
giftEarnestAmount
-
occupyAmount
);
newUserAccount
.
setGiftEarnestAmount
(
giftEarnestAmount
-
occupyAmount
);
...
...
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