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
d0202fd9
Commit
d0202fd9
authored
May 19, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'KA-顺丰计算商品重量的情况-20220517' into qa
parents
2462ebdb
367adc5c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
order-application-service/src/main/java/cn/freemud/utils/DemoMain.java
+0
-0
order-management/src/main/java/cn/freemud/management/adapter/DeliverySdkAdapter.java
+21
-16
order-management/src/main/java/cn/freemud/management/service/handle/DeliveryHandle.java
+1
-1
No files found.
order-application-service/src/main/java/cn/freemud/utils/DemoMain.java
View file @
d0202fd9
This diff is collapsed.
Click to expand it.
order-management/src/main/java/cn/freemud/management/adapter/DeliverySdkAdapter.java
View file @
d0202fd9
...
@@ -27,7 +27,6 @@ public class DeliverySdkAdapter {
...
@@ -27,7 +27,6 @@ public class DeliverySdkAdapter {
*/
*/
public
CreateDeliveryOrderRequestDto
buildDeliveryOrderRequestDto
(
OrderBeanV1
order
public
CreateDeliveryOrderRequestDto
buildDeliveryOrderRequestDto
(
OrderBeanV1
order
,
ConsoleResponseDTO
<
BizDTO
>
bizDTO
,
String
deliveryCallBackUrl
)
{
,
ConsoleResponseDTO
<
BizDTO
>
bizDTO
,
String
deliveryCallBackUrl
)
{
StoreInfoDTO
storeInfo
=
bizDTO
.
getBizVO
().
getStoreInfo
();
CreateDeliveryOrderRequestDto
deliveryOrderRequestDto
=
new
CreateDeliveryOrderRequestDto
();
CreateDeliveryOrderRequestDto
deliveryOrderRequestDto
=
new
CreateDeliveryOrderRequestDto
();
deliveryOrderRequestDto
.
setDepatchWeight
(
this
.
getDepatchWeightByOrder
(
order
.
getProductList
()));
deliveryOrderRequestDto
.
setDepatchWeight
(
this
.
getDepatchWeightByOrder
(
order
.
getProductList
()));
deliveryOrderRequestDto
.
setSerialNumber
(
order
.
getOtherCode
());
deliveryOrderRequestDto
.
setSerialNumber
(
order
.
getOtherCode
());
...
@@ -37,6 +36,7 @@ public class DeliverySdkAdapter {
...
@@ -37,6 +36,7 @@ public class DeliverySdkAdapter {
deliveryOrderRequestDto
.
setOrderActualAmount
(
order
.
getAmount
().
intValue
());
deliveryOrderRequestDto
.
setOrderActualAmount
(
order
.
getAmount
().
intValue
());
deliveryOrderRequestDto
.
setPartnerId
(
order
.
getCompanyId
());
deliveryOrderRequestDto
.
setPartnerId
(
order
.
getCompanyId
());
deliveryOrderRequestDto
.
setOrderChannel
(
order
.
getSource
());
deliveryOrderRequestDto
.
setOrderChannel
(
order
.
getSource
());
StoreInfoDTO
storeInfo
=
bizDTO
.
getBizVO
().
getStoreInfo
();
deliveryOrderRequestDto
.
setStoreId
(
storeInfo
.
getStoreId
());
deliveryOrderRequestDto
.
setStoreId
(
storeInfo
.
getStoreId
());
deliveryOrderRequestDto
.
setStoreCode
(
storeInfo
.
getStoreCode
());
deliveryOrderRequestDto
.
setStoreCode
(
storeInfo
.
getStoreCode
());
StringBuffer
address
=
new
StringBuffer
(
storeInfo
.
getCity
())
StringBuffer
address
=
new
StringBuffer
(
storeInfo
.
getCity
())
...
@@ -83,27 +83,32 @@ public class DeliverySdkAdapter {
...
@@ -83,27 +83,32 @@ public class DeliverySdkAdapter {
return
new
BigDecimal
(
"0.5"
);
return
new
BigDecimal
(
"0.5"
);
}
}
BigDecimal
result
=
BigDecimal
.
ZERO
;
BigDecimal
result
=
BigDecimal
.
ZERO
;
productList
.
forEach
(
p
->
{
for
(
ProductBeanV1
p
:
productList
)
{
BigDecimal
sum
=
p
.
getWeight
().
multiply
(
new
BigDecimal
(
p
.
getNumber
()));
BigDecimal
sum
=
p
.
getWeight
().
multiply
(
new
BigDecimal
(
p
.
getNumber
()));
if
(
CollectionUtils
.
isNotEmpty
(
p
.
getComboProduct
()))
{
BigDecimal
comboSum
=
this
.
sumWeightByProduct
(
p
.
getComboProduct
());
long
comboProductSum
=
p
.
getComboProduct
().
stream
().
mapToLong
(
value
->
value
.
getWeight
().
multiply
(
new
BigDecimal
(
value
.
getNumber
())).
longValue
()).
sum
();
BigDecimal
materSum
=
this
.
sumWeightByProduct
(
p
.
getMaterialProduct
());
if
(
CollectionUtils
.
isNotEmpty
(
p
.
getMaterialProduct
()))
{
BigDecimal
sendSum
=
this
.
sumWeightByProduct
(
p
.
getSendProduct
());
long
materialProductSum
=
p
.
getMaterialProduct
().
stream
().
mapToLong
(
value
->
value
.
getWeight
().
multiply
(
new
BigDecimal
(
value
.
getNumber
())).
longValue
()).
sum
();
result
=
result
.
add
(
sum
).
add
(
comboSum
).
add
(
materSum
).
add
(
sendSum
);
comboProductSum
+=
materialProductSum
;
}
if
(
CollectionUtils
.
isNotEmpty
(
p
.
getSendProduct
()))
{
long
sendProductSum
=
p
.
getSendProduct
().
stream
().
mapToLong
(
value
->
value
.
getWeight
().
multiply
(
new
BigDecimal
(
value
.
getNumber
())).
longValue
()).
sum
();
comboProductSum
+=
sendProductSum
;
}
}
BigDecimal
otherProductSum
=
new
BigDecimal
(
comboProductSum
);
sum
.
add
(
otherProductSum
);
}
result
.
add
(
sum
);
});
if
(
result
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
if
(
result
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
return
new
BigDecimal
(
"0.5"
);
return
new
BigDecimal
(
"0.5"
);
}
}
// 这里 计算的结果是 g 需要变成 kg 给接口 保留3位小数 后面多余直接舍弃
// 这里 计算的结果是 g 需要变成 kg 给接口 保留3位小数 后面多余直接舍弃
return
result
.
divide
(
new
BigDecimal
(
"1000"
),
3
,
BigDecimal
.
ROUND_DOWN
);
return
result
.
divide
(
new
BigDecimal
(
"1000"
),
3
,
BigDecimal
.
ROUND_DOWN
);
}
}
private
BigDecimal
sumWeightByProduct
(
List
<
ProductBeanV1
>
productBeanV
)
{
BigDecimal
result
=
BigDecimal
.
ZERO
;
if
(
CollectionUtils
.
isEmpty
(
productBeanV
))
{
return
result
;
}
for
(
ProductBeanV1
p
:
productBeanV
)
{
BigDecimal
weight
=
p
.
getWeight
();
int
number
=
p
.
getNumber
();
BigDecimal
multiply
=
weight
.
multiply
(
new
BigDecimal
(
number
));
result
=
result
.
add
(
multiply
);
}
return
result
;
}
}
}
order-management/src/main/java/cn/freemud/management/service/handle/DeliveryHandle.java
View file @
d0202fd9
...
@@ -102,7 +102,7 @@ public class DeliveryHandle {
...
@@ -102,7 +102,7 @@ public class DeliveryHandle {
}
}
// 调用配送系统创建配送单
// 调用配送系统创建配送单
CreateDeliveryOrderRequestDto
requestDto
=
deliverySdkAdapter
.
buildDeliveryOrderRequestDto
(
orderBean
,
storeInfo
,
deliveryCallBackUrl
);
CreateDeliveryOrderRequestDto
requestDto
=
deliverySdkAdapter
.
buildDeliveryOrderRequestDto
(
orderBean
,
storeInfo
,
deliveryCallBackUrl
);
logUtil
.
info
(
"fisherman -> 配送计算金额 "
,
orderBean
.
getOid
(),
JSON
.
toJSONString
(
requestDto
));
logUtil
.
info
(
"fisherman -> 配送计算金额 "
,
orderBean
.
getOid
(),
JSON
.
toJSONString
(
requestDto
)
,
JSON
.
toJSONString
(
orderBean
.
getProductList
())
);
CreateDeliveryOrderResponseDto
deliveryResponse
=
deliveryService
.
deliveryOrderAdd
(
requestDto
,
LogThreadLocal
.
getTrackingNo
());
CreateDeliveryOrderResponseDto
deliveryResponse
=
deliveryService
.
deliveryOrderAdd
(
requestDto
,
LogThreadLocal
.
getTrackingNo
());
String
operator
=
request
==
null
||
StringUtils
.
isBlank
(
request
.
getOperator
())
?
"系统"
:
request
.
getOperator
();
String
operator
=
request
==
null
||
StringUtils
.
isBlank
(
request
.
getOperator
())
?
"系统"
:
request
.
getOperator
();
...
...
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