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
cf35a832
Commit
cf35a832
authored
Jun 08, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fadc8d90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
Test.java
src/test/java/com/gogirl/Test.java
+33
-0
No files found.
src/test/java/com/gogirl/Test.java
View file @
cf35a832
...
...
@@ -61,6 +61,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
...
...
@@ -670,4 +671,36 @@ public class Test {
marketService
.
calcOrderAmount
(
13659
);
}
@org
.
junit
.
Test
public
void
duplicateCouponFix
()
{
List
<
OrderManage
>
orderManageList
=
orderManageMapper
.
selectBatchIds
(
Lists
.
newArrayList
(
"13711,13744,13766,13921"
.
split
(
","
)));
orderManageList
.
forEach
(
orderManage
->
{
BigDecimal
discountAmount
=
orderManage
.
getDiscountPrice
();
Integer
payUser
=
orderManage
.
getPayUser
();
Integer
orderId
=
orderManage
.
getId
();
marketService
.
calcOrderAmount
(
orderManage
.
getId
());
CustomerBalanceRecord
customerBalanceRecord
=
customerBalanceRecordMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalanceRecord
>()
.
eq
(
CustomerBalanceRecord:
:
getCustomerId
,
payUser
)
.
eq
(
CustomerBalanceRecord:
:
getOrderId
,
orderId
));
if
(
customerBalanceRecord
!=
null
&&
customerBalanceRecord
.
getCurrentBalance
()
>
0
)
{
customerBalanceRecord
.
setOrderAmount
(
customerBalanceRecord
.
getOrderAmount
()
+
(
discountAmount
.
intValue
()
*
100
));
customerBalanceRecord
.
setCurrentBalance
(
customerBalanceRecord
.
getCurrentBalance
()
-
(
discountAmount
.
intValue
()
*
100
));
customerBalanceRecordMapper
.
updateById
(
customerBalanceRecord
);
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>()
.
eq
(
CustomerBalance:
:
getCustomerId
,
payUser
));
customerBalance
.
setTotalExpenditure
(
customerBalance
.
getTotalExpenditure
()
+
(
discountAmount
.
intValue
()
*
100
));
customerBalance
.
setBalance
(
customerBalance
.
getBalance
()
-
(
discountAmount
.
intValue
()
*
100
));
customerBalanceMapper
.
updateById
(
customerBalance
);
}
});
}
}
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