Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
f3356356
Commit
f3356356
authored
Dec 23, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coco核销优惠券
parent
1a0ec19a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
25 deletions
+50
-25
order-application-service/src/main/java/cn/freemud/service/coupon/impl/CocoCouponRelationServiceImpl.java
+50
-25
No files found.
order-application-service/src/main/java/cn/freemud/service/coupon/impl/CocoCouponRelationServiceImpl.java
View file @
f3356356
...
...
@@ -149,7 +149,7 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
continue
;
}
if
(
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
Objects
.
equals
(
orderSettlementInfo
.
get
(
0
).
getProductId
(),
0
)){
if
(
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
"0"
.
equals
(
orderSettlementInfo
.
get
(
0
).
getProductId
()
)){
// 整单代金券,最后在计算
orderSettlementRemain
.
add
(
orderSettlementInfo
.
get
(
0
));
}
...
...
@@ -230,36 +230,22 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
// 订单号
couponCodeVerificationTransFull
.
setOrderNumber
(
orderBean
.
getOid
());
List
<
CouponCodeVerificationProductDto
>
productsFull
=
new
ArrayList
<>();
Integer
totalAmountFull
=
0
;
Integer
totalAmount
Ori
Full
=
0
;
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
:
productList
){
Long
alreadyNum
=
collect
.
get
(
osr
.
getProductId
())
==
null
?
0L
:
collect
.
get
(
osr
.
getProductId
()).
getSum
();
Integer
num
=
pb
.
getNumber
();
Integer
remainNum
=
num
-
alreadyNum
.
intValue
();
if
(
Objects
.
equals
(
remainNum
,
0
)){
continue
;
totalAmountOriFull
=
buidVerificationProduct
(
collect
,
osr
,
pb
,
productsFull
,
totalAmountOriFull
);
// 小料商品也取出来
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
>
materialProducts
=
pb
.
getMaterialProduct
();
if
(
materialProducts
!=
null
&&
!
materialProducts
.
isEmpty
()){
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
materialProduct
:
materialProducts
){
totalAmountOriFull
=
buidVerificationProduct
(
collect
,
osr
,
materialProduct
,
productsFull
,
totalAmountOriFull
);
}
}
// 统计商品
CouponCodeVerificationProductDto
couponCodeVerificationProductFull
=
new
CouponCodeVerificationProductDto
();
couponCodeVerificationProductFull
.
setConsume_num
(
remainNum
);
couponCodeVerificationProductFull
.
setPID
(
osr
.
getProductId
());
couponCodeVerificationProductFull
.
setSeq
(
osr
.
getProductSeq
());
couponCodeVerificationProductFull
.
setProductName
(
pb
.
getProductName
());
Integer
price
=
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
();
couponCodeVerificationProductFull
.
setInitPrice
(
price
);
couponCodeVerificationProductFull
.
setNowPrice
(
price
);
couponCodeVerificationProductFull
.
setPayMoney
(
price
);
productsFull
.
add
(
couponCodeVerificationProductFull
);
totalAmountFull
=
totalAmountFull
+
price
*
remainNum
;
}
couponCodeVerificationTransFull
.
setProducts
(
productsFull
);
couponCodeVerificationTransFull
.
setAmountPaid
(
totalAmountFull
);
couponCodeVerificationTransFull
.
setAmountRec
(
totalAmountFull
);
couponCodeVerificationTransFull
.
setAmountPaid
(
totalAmount
Ori
Full
);
couponCodeVerificationTransFull
.
setAmountRec
(
totalAmount
Ori
Full
);
transactions
.
add
(
couponCodeVerificationTransFull
);
}
...
...
@@ -293,4 +279,43 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
return
ResponseUtil
.
success
();
}
/**
* 构建整单券的商品
* @param collect
* @param osr
* @param pb
* @param productsFull
* @param totalAmountOriFull
* @return
*/
public
Integer
buidVerificationProduct
(
Map
<
String
,
IntSummaryStatistics
>
collect
,
OrderSettlementResp
osr
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
,
List
<
CouponCodeVerificationProductDto
>
productsFull
,
Integer
totalAmountOriFull
){
Long
alreadyNum
=
collect
.
get
(
pb
.
getProductId
())
==
null
?
0L
:
collect
.
get
(
pb
.
getProductId
()).
getSum
();
Integer
num
=
pb
.
getNumber
();
Integer
remainNum
=
num
-
alreadyNum
.
intValue
();
if
(
Objects
.
equals
(
remainNum
,
0
)){
return
totalAmountOriFull
;
}
// 统计商品
CouponCodeVerificationProductDto
couponCodeVerificationProductFull
=
new
CouponCodeVerificationProductDto
();
couponCodeVerificationProductFull
.
setConsume_num
(
remainNum
);
couponCodeVerificationProductFull
.
setPID
(
pb
.
getProductId
());
couponCodeVerificationProductFull
.
setSeq
(
pb
.
getSequence
());
couponCodeVerificationProductFull
.
setProductName
(
pb
.
getProductName
());
Integer
price
=
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
();
couponCodeVerificationProductFull
.
setInitPrice
(
price
);
couponCodeVerificationProductFull
.
setNowPrice
(
price
);
couponCodeVerificationProductFull
.
setPayMoney
(
price
);
productsFull
.
add
(
couponCodeVerificationProductFull
);
totalAmountOriFull
=
totalAmountOriFull
+
price
*
remainNum
;
return
totalAmountOriFull
;
}
}
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