Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
b4a10e8f
Commit
b4a10e8f
authored
Sep 09, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单计算月卡,次卡
parent
06d6a649
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
MonthlyCardLog.java
...tem/src/main/java/share/system/domain/MonthlyCardLog.java
+4
-2
CreateOrderRequest.java
...rc/main/java/share/system/request/CreateOrderRequest.java
+8
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+41
-0
No files found.
share-system/src/main/java/share/system/domain/MonthlyCardLog.java
View file @
b4a10e8f
...
...
@@ -9,6 +9,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
/**
* 月卡使用记录对象 s_monthly_card_log
*
...
...
@@ -47,13 +49,13 @@ public class MonthlyCardLog extends BaseEntity {
* 使用时长
*/
@Excel
(
name
=
"使用时长"
)
private
Long
useDuration
;
private
BigDecimal
useDuration
;
/**
* 剩余时长
*/
@Excel
(
name
=
"剩余时长"
)
private
Long
residueDuration
;
private
BigDecimal
residueDuration
;
/**
* 删除标记:1-删除,0-正常
...
...
share-system/src/main/java/share/system/request/CreateOrderRequest.java
View file @
b4a10e8f
...
...
@@ -89,4 +89,12 @@ public class CreateOrderRequest {
@ApiModelProperty
(
value
=
"使用时长"
)
private
BigDecimal
duration
;
//次卡ID
@ApiModelProperty
(
value
=
"次卡ID"
)
private
Long
secondaryCardId
;
//月卡ID
@ApiModelProperty
(
value
=
"月卡ID"
)
private
Long
monthlyCardId
;
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
b4a10e8f
...
...
@@ -173,7 +173,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private
ConsumerMonthlyCardService
consumerMonthlyCardService
;
@Autowired
private
MonthlyCardLogService
monthlyCardLogService
;
@Autowired
private
ConsumerSecondaryCardService
consumerSecondaryCardService
;
@Autowired
private
SecondaryCardLogService
secondaryCardLogService
;
private
final
static
Long
FIVE
=
5L
;
...
...
@@ -876,6 +880,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
user
.
getId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
consumerMonthlyCardService
.
getById
(
request
.
getMonthlyCardId
());
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardService
.
getById
(
request
.
getSecondaryCardId
());
List
<
SStore
>
stores
=
storeService
.
list
();
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
SStore
sStore
=
storeService
.
getById
(
request
.
getStoreId
());
...
...
@@ -933,6 +939,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder
.
setPayStatus
(
YesNoEnum
.
yes
.
getIndex
());
sOrder
.
setPayTime
(
DateUtils
.
getNowDate
());
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
createCard
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
// response = orderPayService.payment(sOrder);
// 扫呗聚合支付
...
...
@@ -1066,6 +1073,32 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
private
void
createCard
(
ConsumerMonthlyCard
consumerMonthlyCard
,
SOrder
sOrder
,
ConsumerSecondaryCard
consumerSecondaryCard
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
MonthlyCardLog
monthlyCardLog
=
new
MonthlyCardLog
();
monthlyCardLog
.
setConsumerMonthlyCardId
(
consumerMonthlyCard
.
getId
());
monthlyCardLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
monthlyCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
monthlyCardLog
.
setUseDuration
(
sOrder
.
getDuration
());
monthlyCardLog
.
setResidueDuration
(
consumerMonthlyCard
.
getFreeDuration
().
subtract
(
sOrder
.
getDuration
()));
consumerMonthlyCard
.
setFreeDuration
(
consumerMonthlyCard
.
getFreeDuration
().
subtract
(
sOrder
.
getDuration
()));
consumerMonthlyCardService
.
updateById
(
consumerMonthlyCard
);
monthlyCardLogService
.
save
(
monthlyCardLog
);
}
else
if
(
ObjectUtil
.
isNotEmpty
(
consumerSecondaryCard
))
{
SecondaryCardLog
secondaryCardLog
=
new
SecondaryCardLog
();
secondaryCardLog
.
setConsumerSecondaryCardId
(
consumerSecondaryCard
.
getId
());
secondaryCardLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
secondaryCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
secondaryCardLog
.
setPackId
(
sOrder
.
getPackId
());
secondaryCardLog
.
setUsageCount
(
1L
);
secondaryCardLog
.
setResidueCount
(
consumerSecondaryCard
.
getNumber
()
-
1L
);
consumerSecondaryCard
.
setNumber
(
consumerSecondaryCard
.
getNumber
()
-
1
);
secondaryCardLogService
.
save
(
secondaryCardLog
);
consumerSecondaryCardService
.
updateById
(
consumerSecondaryCard
);
}
}
private
void
creatExtracted
(
ConsumerWallet
consumerWallet
,
SOrder
sOrder
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getDuration
())
&&
sOrder
.
getDuration
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
...
...
@@ -1585,10 +1618,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
order
.
setBalance
(
priceResponse
.
getBalance
());
order
.
setDuration
(
priceResponse
.
getDuration
());
order
.
setDiscountRatio
(
priceResponse
.
getDiscountRatio
());
if
(
ObjectUtil
.
isNotEmpty
(
request
.
getMonthlyCardId
()))
{
order
.
setMonthlyCardId
(
request
.
getMonthlyCardId
());
}
if
(
ObjectUtil
.
isNotEmpty
(
request
.
getSecondaryCardId
()))
{
order
.
setSecondaryCardId
(
request
.
getSecondaryCardId
());
}
if
(
priceResponse
.
getPayFee
().
compareTo
(
order
.
getPayPrice
())
!=
0
&&
priceResponse
.
getDuration
().
compareTo
(
request
.
getDuration
())
!=
0
&&
priceResponse
.
getBalance
().
compareTo
(
request
.
getBalance
())
!=
0
&&
priceResponse
.
getDiscountRatio
().
compareTo
(
request
.
getDiscountRatio
())
!=
0
&&
(
ObjectUtil
.
isNotEmpty
(
request
.
getSecondaryCardId
())
&&
priceResponse
.
getSecondaryCardId
().
compareTo
(
request
.
getSecondaryCardId
())
!=
0
)
&&
(
ObjectUtil
.
isNotEmpty
(
request
.
getMonthlyCardId
())
&&
priceResponse
.
getMonthlyCardId
().
compareTo
(
request
.
getMonthlyCardId
())
!=
0
)
)
{
throw
new
BaseException
(
"订单金额异常!"
);
}
...
...
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