Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
huluobin
gogirl-miniapp-backend
Commits
30b1ef50
Commit
30b1ef50
authored
Mar 23, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
b3dadc5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
25 deletions
+33
-25
ChargeOrderServiceImpl.java
...application/order/member/impl/ChargeOrderServiceImpl.java
+33
-25
No files found.
src/main/java/com/gogirl/application/order/member/impl/ChargeOrderServiceImpl.java
View file @
30b1ef50
...
@@ -69,7 +69,8 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
...
@@ -69,7 +69,8 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
Customer
customer
=
customerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
Customer
>().
eq
(
Customer:
:
getOpenid1
,
result
.
getOpenid
()));
Customer
customer
=
customerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
Customer
>().
eq
(
Customer:
:
getOpenid1
,
result
.
getOpenid
()));
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
customer
.
getId
()));
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
customer
.
getId
()));
DiscountConfig
discountConfig
=
discountConfigMapper
.
selectList
(
new
LambdaQueryWrapper
<>())
DiscountConfig
discountConfig
=
discountConfigMapper
.
selectList
(
new
LambdaQueryWrapper
<>())
.
stream
().
filter
(
config
->
config
.
getChargeAmount
()
<=
result
.
getTotalFee
())
.
stream
().
filter
(
config
->
config
.
getChargeAmount
()
<=
result
.
getTotalFee
())
...
@@ -80,31 +81,42 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
...
@@ -80,31 +81,42 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
//首次充值
//首次充值
if
(
customerBalance
==
null
||
customerBalance
.
getBalance
()
==
0
)
{
if
(
customerBalance
==
null
||
customerBalance
.
getBalance
()
==
0
)
{
customerBalance
=
CustomerBalance
.
builder
()
if
(
customerBalance
==
null
)
{
//充值金额+赠送金额
customerBalance
=
CustomerBalance
.
builder
()
// .balance(result.getTotalFee() + discountConfig.getBestowAmount())
//充值金额+赠送金额
.
balance
(
result
.
getTotalFee
())
.
balance
(
result
.
getTotalFee
())
.
customerId
(
customer
.
getId
())
.
currentDiscount
(
1.00
)
.
discountRate
(
0.00
)
.
firstChargeTime
(
new
Date
())
.
level
(
discountConfig
.
getLevel
())
//赠送金额
.
totalBestow
(
0
)
//总充值金额
.
totalCharge
(
result
.
getTotalFee
())
.
totalExpenditure
(
0
)
.
updateTime
(
new
Date
())
.
version
(
5
)
.
build
();
}
else
{
customerBalance
.
setBalance
(
result
.
getTotalFee
());
customerBalance
.
setCurrentDiscount
(
1.00
);
customerBalance
.
setDiscountRate
(
0.00
);
customerBalance
.
setFirstChargeTime
(
new
Date
());
customerBalance
.
setLevel
(
discountConfig
.
getLevel
());
customerBalance
.
setTotalBestow
(
0
);
customerBalance
.
setTotalCharge
(
result
.
getTotalFee
());
customerBalance
.
setTotalExpenditure
(
0
);
customerBalance
.
setUpdateTime
(
new
Date
());
customerBalance
.
setVersion
(
5
);
}
.
customerId
(
customer
.
getId
())
.
currentDiscount
(
1.00
)
.
discountRate
(
0.00
)
.
firstChargeTime
(
new
Date
())
.
level
(
discountConfig
.
getLevel
())
//赠送金额
// .totalBestow(discountConfig.getBestowAmount())
.
totalBestow
(
0
)
//总充值金额
.
totalCharge
(
result
.
getTotalFee
())
.
totalExpenditure
(
0
)
.
updateTime
(
new
Date
())
.
version
(
5
)
.
build
();
//会员卡不存在
//会员卡不存在
if
(
customerBalance
.
getId
()
==
null
)
{
if
(
customerBalance
.
getId
()
==
null
)
{
customerBalanceMapper
.
insert
(
customerBalance
);
customerBalanceMapper
.
insert
(
customerBalance
);
}
}
//会员卡存在
//会员卡存在
else
{
else
{
customerBalanceMapper
.
updateById
(
customerBalance
);
customerBalanceMapper
.
updateById
(
customerBalance
);
...
@@ -117,8 +129,6 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
...
@@ -117,8 +129,6 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
.
discount
(
1.00
)
.
discount
(
1.00
)
.
currentBalance
(
customerBalance
.
getBalance
())
.
currentBalance
(
customerBalance
.
getBalance
())
.
bestowAmount
(
0
)
.
bestowAmount
(
0
)
//赠送金额
// .bestowAmount(discountConfig.getBestowAmount())
//首次充值
//首次充值
.
type
(
1
)
.
type
(
1
)
.
customerId
(
customer
.
getId
())
.
customerId
(
customer
.
getId
())
...
@@ -131,12 +141,11 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
...
@@ -131,12 +141,11 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
//充值
//充值
else
{
else
{
//更新用户余额
//更新用户余额
// customerBalance.setBalance(customerBalance.getBalance() + result.getTotalFee() + discountConfig.getBestowAmount());
customerBalance
.
setBalance
(
customerBalance
.
getBalance
()
+
result
.
getTotalFee
());
customerBalance
.
setBalance
(
customerBalance
.
getBalance
()
+
result
.
getTotalFee
());
customerBalance
.
setLevel
(
discountConfig
.
getLevel
());
customerBalance
.
setLevel
(
discountConfig
.
getLevel
());
customerBalance
.
setUpdateTime
(
new
Date
());
customerBalance
.
setUpdateTime
(
new
Date
());
//总送
//总送
// customerBalance.setTotalBestow(customerBalance.getTotalBestow());
customerBalance
.
setTotalCharge
(
customerBalance
.
getTotalCharge
()
+
result
.
getTotalFee
());
customerBalance
.
setTotalCharge
(
customerBalance
.
getTotalCharge
()
+
result
.
getTotalFee
());
customerBalanceMapper
.
updateById
(
customerBalance
);
customerBalanceMapper
.
updateById
(
customerBalance
);
...
@@ -147,7 +156,6 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
...
@@ -147,7 +156,6 @@ public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, Charg
.
orderAmount
(
result
.
getTotalFee
())
.
orderAmount
(
result
.
getTotalFee
())
.
discount
(
1.00
)
.
discount
(
1.00
)
.
currentBalance
(
customerBalance
.
getBalance
())
.
currentBalance
(
customerBalance
.
getBalance
())
// .bestowAmount(discountConfig.getBestowAmount())
.
bestowAmount
(
0
)
.
bestowAmount
(
0
)
//首次充值
//首次充值
.
type
(
1
)
.
type
(
1
)
...
...
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