Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
hooloo
ms
soss
Commits
d0b07205
Commit
d0b07205
authored
Oct 14, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单明细拆分问题修复
parent
a314c3c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+17
-12
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
+1
-1
No files found.
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
d0b07205
...
...
@@ -180,28 +180,33 @@ public class OrderServiceImpl implements IOrderService {
orderDetail
.
setCreatedAt
(
new
Date
());
orderDetail
.
setUpdatedAt
(
new
Date
());
orderDetail
.
setMachineId
(
machineId
);
BigDecimal
amountShould
=
orderDetail
.
getAmountShould
();
BigDecimal
couponAmount
=
orderDetail
.
getCouponAmount
();
if
(
couponAmount
==
null
)
{
couponAmount
=
BigDecimal
.
ZERO
;
}
BigDecimal
realAmount
=
orderDetail
.
getRealAmount
();
BigDecimal
amountShouldUnit
=
amountShould
.
divide
(
new
BigDecimal
(
orderDetail
.
getNum
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
orderDetail
.
setAmountShould
(
amountShouldUnit
);
BigDecimal
couponAmountUnit
=
couponAmount
.
divide
(
new
BigDecimal
(
orderDetail
.
getNum
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
orderDetail
.
setCouponAmount
(
couponAmountUnit
);
BigDecimal
realAmountUnit
=
realAmount
.
divide
(
new
BigDecimal
(
orderDetail
.
getNum
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
orderDetail
.
setRealAmount
(
realAmountUnit
);
int
skuNum
=
orderDetail
.
getNum
();
BigDecimal
amountShouldUnit
=
amountShould
.
divide
(
new
BigDecimal
(
skuNum
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
couponAmountUnit
=
couponAmount
.
divide
(
new
BigDecimal
(
skuNum
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
realAmountUnit
=
realAmount
.
divide
(
new
BigDecimal
(
skuNum
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
for
(
int
i
=
1
;
i
<=
skuNum
;
i
++)
{
if
(
i
==
orderDetail
.
getNum
())
{
OrderDetail
orderDetailLst
=
new
OrderDetail
();
BeanUtils
.
copyProperties
(
orderDetail
,
orderDetailLst
);
OrderDetail
orderDetailLst
=
new
OrderDetail
();
BeanUtils
.
copyProperties
(
orderDetail
,
orderDetailLst
);
orderDetailLst
.
setNum
(
1
);
if
(
i
==
skuNum
)
{
orderDetailLst
.
setAmountShould
(
amountShould
.
subtract
(
amountShouldUnit
.
multiply
(
new
BigDecimal
(
i
-
1
))));
orderDetailLst
.
setCouponAmount
(
couponAmount
.
subtract
(
couponAmountUnit
.
multiply
(
new
BigDecimal
(
i
-
1
))));
orderDetailLst
.
setRealAmount
(
realAmount
.
subtract
(
realAmountUnit
.
multiply
(
new
BigDecimal
(
i
-
1
))));
detailsSave
.
add
(
orderDetailLst
);
}
else
{
orderDetail
.
setNum
(
1
);
detailsSave
.
add
(
orderDetail
);
orderDetailLst
.
setAmountShould
(
amountShouldUnit
);
orderDetailLst
.
setCouponAmount
(
couponAmountUnit
);
orderDetailLst
.
setRealAmount
(
realAmountUnit
);
}
detailsSave
.
add
(
orderDetailLst
);
}
}
order
.
setOrderDetails
(
detailsSave
);
...
...
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
View file @
d0b07205
...
...
@@ -115,7 +115,7 @@
</trim>
</insert>
<insert
id=
"insertBatch"
>
<insert
id=
"insertBatch"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO order_detail ( order_id, goods_id, goods_name, machine_id, num, unit_price, ori_amount,
amount_should, coupon_amount, real_amount, spec_rule_detail, spec_rule_ids, sku_id, goods_category, created_at,
refund_id, refund_time, updated_at ) VALUES
...
...
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