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
526121a2
Commit
526121a2
authored
Nov 06, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保证金
parent
96940a93
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
529 additions
and
19 deletions
+529
-19
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/openShop/UserAccount.java
...main/java/com/wwdz/ch/db/domain/openShop/UserAccount.java
+11
-4
ch-dao/src/main/java/com/wwdz/ch/db/domain/openShop/UserAccountExample.java
...va/com/wwdz/ch/db/domain/openShop/UserAccountExample.java
+132
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/openShop/EarnestRecordRequestDto.java
...z/ch/db/dto/request/openShop/EarnestRecordRequestDto.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
...ava/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
+0
-2
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.xml
...rces/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.xml
+331
-12
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/AuctionRecordServiceImpl.java
...wdz/ch/wx/impl/distribution/AuctionRecordServiceImpl.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
...m/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
+35
-1
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
526121a2
...
...
@@ -150,6 +150,11 @@ public interface CommConsts {
*/
public
final
static
String
AUCTION_EARNEST_ORDER_PREFIX
=
"AE"
;
/**
* 保证金换成出价额度比例为1:20,换成百分比为5%
*/
public
final
static
String
EARNEST_REBATE
=
"0.05"
;
/**
* 平台收货地址
...
...
ch-core/src/main/java/com/wwdz/ch/core/util/PriceUtil.java
View file @
526121a2
...
...
@@ -48,6 +48,11 @@ public class PriceUtil {
}
public
static
Long
convertToLong
(
BigDecimal
number
){
return
number
.
multiply
(
new
BigDecimal
(
100
)).
longValue
();
}
public
static
Long
convertPriceUnit
(
Long
price
){
BigDecimal
bigDecimal
=
new
BigDecimal
(
price
);
bigDecimal
=
bigDecimal
.
multiply
(
new
BigDecimal
(
100
));
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/openShop/UserAccount.java
View file @
526121a2
...
...
@@ -4,8 +4,6 @@ import java.io.Serializable;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
/**
...
...
@@ -13,7 +11,7 @@ import lombok.Data;
* @date 2024/11/06
*/
@Data
public
class
UserAccount
implements
Entity
{
public
class
UserAccount
implements
Serializable
{
private
Long
id
;
/**
...
...
@@ -52,10 +50,15 @@ public class UserAccount implements Entity {
private
Long
earnestAmount
;
/**
* 保证金可用
额度
* 保证金可用
金额
*/
private
Long
earnestUsableAmount
;
/**
* 赠送的保证金金额
*/
private
Long
giftEarnestAmount
;
/**
* 创建时间
*/
...
...
@@ -83,6 +86,7 @@ public class UserAccount implements Entity {
sb
.
append
(
", introduceWaitEntryAmount="
).
append
(
introduceWaitEntryAmount
);
sb
.
append
(
", earnestAmount="
).
append
(
earnestAmount
);
sb
.
append
(
", earnestUsableAmount="
).
append
(
earnestUsableAmount
);
sb
.
append
(
", giftEarnestAmount="
).
append
(
giftEarnestAmount
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
...
...
@@ -111,6 +115,7 @@ public class UserAccount implements Entity {
&&
(
this
.
getIntroduceWaitEntryAmount
()
==
null
?
other
.
getIntroduceWaitEntryAmount
()
==
null
:
this
.
getIntroduceWaitEntryAmount
().
equals
(
other
.
getIntroduceWaitEntryAmount
()))
&&
(
this
.
getEarnestAmount
()
==
null
?
other
.
getEarnestAmount
()
==
null
:
this
.
getEarnestAmount
().
equals
(
other
.
getEarnestAmount
()))
&&
(
this
.
getEarnestUsableAmount
()
==
null
?
other
.
getEarnestUsableAmount
()
==
null
:
this
.
getEarnestUsableAmount
().
equals
(
other
.
getEarnestUsableAmount
()))
&&
(
this
.
getGiftEarnestAmount
()
==
null
?
other
.
getGiftEarnestAmount
()
==
null
:
this
.
getGiftEarnestAmount
().
equals
(
other
.
getGiftEarnestAmount
()))
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()));
}
...
...
@@ -128,6 +133,7 @@ public class UserAccount implements Entity {
result
=
prime
*
result
+
((
getIntroduceWaitEntryAmount
()
==
null
)
?
0
:
getIntroduceWaitEntryAmount
().
hashCode
());
result
=
prime
*
result
+
((
getEarnestAmount
()
==
null
)
?
0
:
getEarnestAmount
().
hashCode
());
result
=
prime
*
result
+
((
getEarnestUsableAmount
()
==
null
)
?
0
:
getEarnestUsableAmount
().
hashCode
());
result
=
prime
*
result
+
((
getGiftEarnestAmount
()
==
null
)
?
0
:
getGiftEarnestAmount
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTime
()
==
null
)
?
0
:
getCreateTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
return
result
;
...
...
@@ -150,6 +156,7 @@ public class UserAccount implements Entity {
introduceWaitEntryAmount
(
"introduce_wait_entry_amount"
,
"introduceWaitEntryAmount"
,
"BIGINT"
,
false
),
earnestAmount
(
"earnest_amount"
,
"earnestAmount"
,
"BIGINT"
,
false
),
earnestUsableAmount
(
"earnest_usable_amount"
,
"earnestUsableAmount"
,
"BIGINT"
,
false
),
giftEarnestAmount
(
"gift_earnest_amount"
,
"giftEarnestAmount"
,
"BIGINT"
,
false
),
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/openShop/UserAccountExample.java
View file @
526121a2
...
...
@@ -1336,6 +1336,138 @@ public class UserAccountExample {
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountIsNull
()
{
addCriterion
(
"gift_earnest_amount is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountIsNotNull
()
{
addCriterion
(
"gift_earnest_amount is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountEqualTo
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount ="
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountEqualToColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountNotEqualTo
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount <>"
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountNotEqualToColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountGreaterThan
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount >"
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountGreaterThanColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount >="
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountGreaterThanOrEqualToColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountLessThan
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount <"
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountLessThanColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"gift_earnest_amount <="
,
value
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andGiftEarnestAmountLessThanOrEqualToColumn
(
UserAccount
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"gift_earnest_amount <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountIn
(
List
<
Long
>
values
)
{
addCriterion
(
"gift_earnest_amount in"
,
values
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"gift_earnest_amount not in"
,
values
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"gift_earnest_amount between"
,
value1
,
value2
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
public
Criteria
andGiftEarnestAmountNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"gift_earnest_amount not between"
,
value1
,
value2
,
"giftEarnestAmount"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCreateTimeIsNull
()
{
addCriterion
(
"create_time is null"
);
return
(
Criteria
)
this
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/openShop/EarnestRecordRequestDto.java
View file @
526121a2
...
...
@@ -30,6 +30,11 @@ public class EarnestRecordRequestDto extends BaseRequestDto implements Entity {
*/
private
String
amount
;
/**
* 拍卖出价金额
*/
private
Long
auctionPrice
;
/**
* -1扣除1新增
*/
...
...
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
View file @
526121a2
...
...
@@ -3,10 +3,8 @@ package com.wwdz.ch.db.mapper.openShop;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.domain.openShop.UserAccountExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
UserAccountMapper
{
long
countByExample
(
UserAccountExample
example
);
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.xml
View file @
526121a2
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/AuctionRecordServiceImpl.java
View file @
526121a2
...
...
@@ -160,6 +160,9 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
}
//把上次的最高价记录改为落后
auctionRecordDao
.
updateNotLeadById
(
auctionRecord
.
getId
());
//把上次出价的用户保证金释放
//发送模板消息,提示用户出价被超越
String
openId
=
sendMsgService
.
getOpenIdByUserId
(
auctionRecord
.
getUserId
());
if
(
com
.
xxdxxs
.
utils
.
StringUtils
.
hasLength
(
openId
))
{
...
...
@@ -201,6 +204,8 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
//更新专场配置中商品的当前价
specialPerformanceConfigDao
.
updatePrice
(
itemId
,
price
);
//把当前领先的用户的保证金额度占用
//如果当前时间是拍卖截止时间的最后五分钟内,则再延长五分钟
Instant
instant
=
endTime
.
toInstant
().
minus
(
Duration
.
ofMinutes
(
5
));
Date
time
=
Date
.
from
(
instant
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
View file @
526121a2
...
...
@@ -10,6 +10,8 @@ import com.wwdz.ch.db.dao.openShop.EarnestOrderDao;
import
com.wwdz.ch.db.dao.openShop.EarnestRecordDao
;
import
com.wwdz.ch.db.dao.openShop.UserAccountDao
;
import
com.wwdz.ch.db.domain.openShop.EarnestOrder
;
import
com.wwdz.ch.db.domain.openShop.EarnestRecord
;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
...
...
@@ -18,6 +20,10 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Service
...
...
@@ -81,18 +87,46 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
}
@Transactional
@Override
public
Result
occupyEarnest
(
EarnestRecordRequestDto
dto
)
{
try
{
EarnestRecord
earnestRecord
=
new
EarnestRecord
();
long
auctionPrice
=
dto
.
getAuctionPrice
();
BigDecimal
earnestAmount
=
new
BigDecimal
(
String
.
valueOf
(
auctionPrice
)).
multiply
(
new
BigDecimal
(
CommConsts
.
EARNEST_REBATE
));
//换算成对应占用的保证金
long
occupyAmount
=
earnestAmount
.
longValue
();
earnestRecord
.
setAmount
(
earnestAmount
.
longValue
());
earnestRecord
.
setItemId
(
dto
.
getItemId
());
earnestRecord
.
setSpecialPerformanceId
(
dto
.
getSpecialPerformanceId
());
earnestRecord
.
setEntryType
(
EarnestEnum
.
EntryEnum
.
DEDUCT
.
getCode
());
earnestRecord
.
setCreateTime
(
new
Date
());
earnestRecord
.
setUpdateTime
(
new
Date
());
earnestRecord
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
earnestRecord
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
earnestRecordDao
.
insert
(
earnestRecord
);
//用户账户,更新保证金额度
UserAccount
userAccount
=
new
UserAccount
();
userAccount
.
setUserId
(
dto
.
getUserId
());
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"占用保证金失败 error : {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
();
}
@Transactional
@Override
public
Result
releaseEarnest
(
EarnestRecordRequestDto
dto
)
{
return
null
;
try
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"释放保证金失败 error : {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
();
}
}
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