Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
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
bltdc
dc-java
Commits
535f8937
Commit
535f8937
authored
Apr 11, 2019
by
wutong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单打印错误日志
parent
d5cc54eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
25 deletions
+30
-25
OrderSyncJob.java
...s-order/src/main/java/com/bailuntec/job/OrderSyncJob.java
+30
-25
No files found.
data-base/base-sync-oms-order/src/main/java/com/bailuntec/job/OrderSyncJob.java
View file @
535f8937
...
...
@@ -117,7 +117,7 @@ public class OrderSyncJob extends PointJob {
* @param bailunOrderList
*/
public
void
analyseOmsOrder
(
List
<
OmsResult
>
bailunOrderList
)
{
for
(
OmsResult
omsResult
:
bailunOrderList
)
for
(
OmsResult
omsResult
:
bailunOrderList
)
{
log
.
warn
(
omsResult
.
getOriginOrderId
());
if
(
omsResult
!=
null
&&
omsResult
.
getBailunPaymentStatus
()
!=
null
&&
omsResult
.
getBailunPaymentStatus
().
equals
(
Constant
.
PAYMENT_STATUS
))
{
DcBaseOmsOrder
dcBaseOmsOrder
=
new
DcBaseOmsOrder
();
...
...
@@ -132,7 +132,7 @@ public class OrderSyncJob extends PointJob {
BigDecimal
totalAmountSale
=
BigDecimal
.
ZERO
;
if
(
omsResult
.
getPlatformSku
()
!=
null
&&
omsResult
.
getPlatformSku
().
size
()
>
0
)
{
for
(
PlatformSku
platformSku
:
omsResult
.
getPlatformSku
())
{
if
(
platformSku
.
getPlatformSkuUnitPrice
()
!=
null
&&
platformSku
.
getPlatformSkuUnitPrice
().
getAmount
()
!=
null
&&
platformSku
.
getPlatformSkuQuantityOrdered
()
!=
null
)
{
if
(
platformSku
.
getPlatformSkuUnitPrice
()
!=
null
&&
platformSku
.
getPlatformSkuUnitPrice
().
getAmount
()
!=
null
&&
platformSku
.
getPlatformSkuQuantityOrdered
()
!=
null
)
{
BigDecimal
platformSkuUnitPrice
=
platformSku
.
getPlatformSkuUnitPrice
().
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
platformSku
.
getPlatformSkuUnitPrice
().
getAmount
()
:
BigDecimal
.
ZERO
;
totalAmountSale
=
platformSkuUnitPrice
.
multiply
(
BigDecimal
.
valueOf
(
platformSku
.
getPlatformSkuQuantityOrdered
())).
add
(
totalAmountSale
).
setScale
(
2
,
RoundingMode
.
HALF_EVEN
);
}
...
...
@@ -156,17 +156,17 @@ public class OrderSyncJob extends PointJob {
DcBaseWarehouse
dcBaseWarehouse
=
getDcBaseWarehouse
(
bailunSku
,
omsResult
);
BailunSkuStructure
bailunSkuStructure
=
new
BailunSkuStructure
();
bailunSkuStructure
.
setBailunSku
(
bailunSku
.
getBailunSku
());
bailunSkuStructure
.
setBailunSkuUnitPrice
((
bailunSku
.
getBailunSkuUnitPrice
()
!=
null
&&
bailunSku
.
getBailunSkuUnitPrice
().
getAmount
()
!=
null
)?
bailunSku
.
getBailunSkuUnitPrice
().
getAmount
()
:
BigDecimal
.
ZERO
);
bailunSkuStructure
.
setBailunSkuWeight
(
bailunSku
.
getBailunSkuWeight
()
!=
null
?
bailunSku
.
getBailunSkuWeight
()
:
BigDecimal
.
ZERO
);
bailunSkuStructure
.
setSkuCostRatio
(
dcBaseOmsOrder
.
getCostProduct
().
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
bailunSkuStructure
.
getBailunSkuUnitPrice
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())).
divide
(
dcBaseOmsOrder
.
getCostProduct
(),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ONE
);
bailunSkuStructure
.
setSkuWeightRatio
(
bailunSkuCumulative
.
getTotalWeight
().
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
bailunSkuStructure
.
getBailunSkuWeight
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())).
divide
(
bailunSkuCumulative
.
getTotalWeight
(),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ONE
);
bailunSkuStructure
.
setSkuQuantityOrderd
(
bailunSku
.
getBailunSkuQuantityOrdered
()
!=
null
?
bailunSku
.
getBailunSkuQuantityOrdered
()
:
0
);
bailunSkuStructure
.
setBailunSkuUnitPrice
((
bailunSku
.
getBailunSkuUnitPrice
()
!=
null
&&
bailunSku
.
getBailunSkuUnitPrice
().
getAmount
()
!=
null
)
?
bailunSku
.
getBailunSkuUnitPrice
().
getAmount
()
:
BigDecimal
.
ZERO
);
bailunSkuStructure
.
setBailunSkuWeight
(
bailunSku
.
getBailunSkuWeight
()
!=
null
?
bailunSku
.
getBailunSkuWeight
()
:
BigDecimal
.
ZERO
);
bailunSkuStructure
.
setSkuCostRatio
(
dcBaseOmsOrder
.
getCostProduct
().
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
bailunSkuStructure
.
getBailunSkuUnitPrice
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())).
divide
(
dcBaseOmsOrder
.
getCostProduct
(),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ONE
);
bailunSkuStructure
.
setSkuWeightRatio
(
bailunSkuCumulative
.
getTotalWeight
().
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
bailunSkuStructure
.
getBailunSkuWeight
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())).
divide
(
bailunSkuCumulative
.
getTotalWeight
(),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ONE
);
bailunSkuStructure
.
setSkuQuantityOrderd
(
bailunSku
.
getBailunSkuQuantityOrdered
()
!=
null
?
bailunSku
.
getBailunSkuQuantityOrdered
()
:
0
);
bailunSkuStructure
.
setDcBaseWarehouse
(
dcBaseWarehouse
);
DcBaseOmsSku
dcBaseOmsSku
=
new
DcBaseOmsSku
();
/*
* 赋值, 初始值避免null
*/
assignmentSkuInfo
(
omsResult
,
dcBaseOmsOrder
,
dcBaseOmsSku
,
bailunSku
,
dcBaseWarehouse
,
saleItemHashMap
,
isFbaFeeException
);
assignmentSkuInfo
(
omsResult
,
dcBaseOmsOrder
,
dcBaseOmsSku
,
bailunSku
,
dcBaseWarehouse
,
saleItemHashMap
,
isFbaFeeException
);
if
(
PlatformType
.
FBA
.
value
().
equals
(
omsResult
.
getPlatformType
().
toUpperCase
()))
{
//FBA费用
BigDecimal
skuCostFbaFee
=
bailunSkuStructure
.
getSkuWeightRatio
().
multiply
(
dcBaseOmsOrder
.
getCostFbaFee
()).
setScale
(
3
,
RoundingMode
.
HALF_EVEN
);
...
...
@@ -237,8 +237,8 @@ public class OrderSyncJob extends PointJob {
* 跟重量有关的费用按重量分摊
*/
for
(
BailunSkuStructure
bailunSkuStructure
:
bailunSkuInfoMap
.
values
())
{
DcBaseOmsSku
dcBaseOmsSku
=
bailunSkuStructure
.
getDcBaseOmsSku
();
DcBaseWarehouse
dcBaseWarehouse
=
bailunSkuStructure
.
getDcBaseWarehouse
();
DcBaseOmsSku
dcBaseOmsSku
=
bailunSkuStructure
.
getDcBaseOmsSku
();
DcBaseWarehouse
dcBaseWarehouse
=
bailunSkuStructure
.
getDcBaseWarehouse
();
dcBaseOmsSku
.
setRatioPrice
(
bailunSkuStructure
.
getSkuCostRatio
());
dcBaseOmsSku
.
setRatioWeight
(
bailunSkuStructure
.
getSkuWeightRatio
());
//总收入
...
...
@@ -256,7 +256,7 @@ public class OrderSyncJob extends PointJob {
//将总销售额按比例摊分到SKU-原币种, SKU可能有多个
BigDecimal
skuAmountSales
=
bailunSkuStructure
.
getSkuCostRatio
().
multiply
(
dcBaseOmsOrder
.
getAmountSales
()).
setScale
(
3
,
RoundingMode
.
HALF_EVEN
);
//单个SKU售价-原币种
BigDecimal
skuSalesPrice
=
bailunSkuStructure
.
getSkuQuantityOrderd
()
>
0
?
skuAmountSales
.
divide
(
BigDecimal
.
valueOf
(
bailunSkuStructure
.
getSkuQuantityOrderd
()),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ZERO
;
BigDecimal
skuSalesPrice
=
bailunSkuStructure
.
getSkuQuantityOrderd
()
>
0
?
skuAmountSales
.
divide
(
BigDecimal
.
valueOf
(
bailunSkuStructure
.
getSkuQuantityOrderd
()),
3
,
RoundingMode
.
HALF_EVEN
)
:
BigDecimal
.
ZERO
;
//平台费-原币种
BigDecimal
skuCostPlatformFee
=
bailunSkuStructure
.
getSkuCostRatio
().
multiply
(
dcBaseOmsOrder
.
getCostPlatformFee
()).
setScale
(
3
,
RoundingMode
.
HALF_EVEN
);
BigDecimal
skuCostPlatformFeeRMB
=
bailunSkuStructure
.
getSkuCostRatio
().
multiply
(
costPlatformFeeRMB
).
setScale
(
3
,
RoundingMode
.
HALF_EVEN
);
...
...
@@ -277,7 +277,7 @@ public class OrderSyncJob extends PointJob {
BigDecimal
quantityPrepared
=
BigDecimal
.
valueOf
(
dcBaseOmsSku
.
getBailunSkuQuantityOrdered
()
-
dcBaseOmsSku
.
getBailunSkuQuantityShipped
());
//这是未发货(预收)部分占的平台费
BigDecimal
skuCostPlatformFeePreparedRMB
=
skuCostPlatformFeeRMB
.
multiply
(
quantityPrepared
).
divide
(
BigDecimal
.
valueOf
(
dcBaseOmsSku
.
getBailunSkuQuantityOrdered
()),
3
,
RoundingMode
.
HALF_EVEN
);
BigDecimal
amountPrepaid
=
(
skuSalesPrice
.
multiply
(
quantityPrepared
).
multiply
(
dcBaseOmsOrder
.
getSellerOrderExchangeRate
()).
subtract
(
skuCostPlatformFeePreparedRMB
)).
divide
(
quantityPrepared
,
3
,
RoundingMode
.
HALF_EVEN
);
BigDecimal
amountPrepaid
=
(
skuSalesPrice
.
multiply
(
quantityPrepared
).
multiply
(
dcBaseOmsOrder
.
getSellerOrderExchangeRate
()).
subtract
(
skuCostPlatformFeePreparedRMB
)).
divide
(
quantityPrepared
,
3
,
RoundingMode
.
HALF_EVEN
);
dcBaseOmsSku
.
setAmountPrepaid
(
amountPrepaid
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amountPrepaid
:
BigDecimal
.
ZERO
);
totalAmountPrepaid
=
totalAmountPrepaid
.
add
(
dcBaseOmsSku
.
getAmountPrepaid
());
}
...
...
@@ -297,7 +297,8 @@ public class OrderSyncJob extends PointJob {
* 摊分方法: 除以下单数
*/
BigDecimal
quantityOrderdDecimal
=
BigDecimal
.
valueOf
(
bailunSkuStructure
.
getSkuQuantityOrderd
());
BigDecimal
rmbCost
=
BigDecimal
.
ZERO
;;
BigDecimal
rmbCost
=
BigDecimal
.
ZERO
;
;
if
(
quantityOrderdDecimal
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)
{
dcBaseOmsSku
.
setCostLogistics
(
skuCostLogistics
.
divide
(
quantityOrderdDecimal
,
3
,
RoundingMode
.
HALF_EVEN
));
dcBaseOmsSku
.
setAmountTotal
(
skuAmountTotal
.
divide
(
quantityOrderdDecimal
,
3
,
RoundingMode
.
HALF_EVEN
));
...
...
@@ -393,6 +394,7 @@ public class OrderSyncJob extends PointJob {
}
}
}
}
private
BigDecimal
getTotalCostLogistics
(
List
<
LogisticsItem
>
logisticsItems
)
{
BigDecimal
totalCostLogistics
=
BigDecimal
.
ZERO
;
...
...
@@ -414,7 +416,7 @@ public class OrderSyncJob extends PointJob {
crmRefundMapper
.
updateLinked
(
dcBaseOmsOrder
.
getOriginOrderId
(),
dcBaseOmsOrder
.
getBailunAccountId
());
dcBaseOmsOrder
.
setAmountRefund
(
BigDecimal
.
ZERO
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Mybatis操作DB失败"
,
e
);
throw
new
RuntimeException
(
"Mybatis操作DB失败"
,
e
);
}
finally
{
SessionUtil
.
closeSession
();
}
...
...
@@ -423,6 +425,7 @@ public class OrderSyncJob extends PointJob {
/**
* 计算百伦的处理费用
* 阶梯计费
*
* @param dcBaseOmsOrder
* @param bailunSkuCumulative
* @param dcBaseWarehouse
...
...
@@ -478,11 +481,13 @@ public class OrderSyncJob extends PointJob {
BailunSkuCumulative
bailunSkuCumulative
=
new
BailunSkuCumulative
();
bailunSkuCumulative
.
setMaxSkuLong
(
BigDecimal
.
ZERO
);
bailunSkuCumulative
.
setMaxSkuWidth
(
BigDecimal
.
ZERO
);
bailunSkuCumulative
.
setMaxSkuHight
(
BigDecimal
.
ZERO
);
bailunSkuCumulative
.
setMaxSkuHight
(
BigDecimal
.
ZERO
);
bailunSkuCumulative
.
setTotalWeight
(
BigDecimal
.
ZERO
);
bailunSkuCumulative
.
setTotalQuantity
(
0
);
for
(
BailunSku
bailunSku
:
omsResult
.
getBailunSku
())
{
if
(
bailunSku
.
getBailunSkuWeight
()
==
null
)
{
bailunSku
.
setBailunSkuWeight
(
BigDecimal
.
ZERO
);}
if
(
bailunSku
.
getBailunSkuWeight
()
==
null
)
{
bailunSku
.
setBailunSkuWeight
(
BigDecimal
.
ZERO
);
}
bailunSkuCumulative
.
setTotalWeight
(
bailunSkuCumulative
.
getTotalWeight
()
!=
null
?
bailunSku
.
getBailunSkuWeight
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())).
add
(
bailunSkuCumulative
.
getTotalWeight
())
:
bailunSku
.
getBailunSkuWeight
().
multiply
(
BigDecimal
.
valueOf
(
bailunSku
.
getBailunSkuQuantityOrdered
())));
...
...
@@ -505,9 +510,12 @@ public class OrderSyncJob extends PointJob {
skuHeight
=
new
BigDecimal
(
split
[
2
]);
}
}
if
(
skuLong
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuLong
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuLong
(
skuLong
);
if
(
skuWidth
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuWidth
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuWidth
(
skuWidth
);
if
(
skuHeight
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuHight
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuLong
(
skuHeight
);
if
(
skuLong
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuLong
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuLong
(
skuLong
);
if
(
skuWidth
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuWidth
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuWidth
(
skuWidth
);
if
(
skuHeight
.
compareTo
(
bailunSkuCumulative
.
getMaxSkuHight
())
>=
0
)
bailunSkuCumulative
.
setMaxSkuLong
(
skuHeight
);
}
}
}
...
...
@@ -536,7 +544,7 @@ public class OrderSyncJob extends PointJob {
}
else
{
if
(
StringUtils
.
isNotBlank
(
bailunSku
.
getWarehouseCode
()))
{
dcBaseWarehouse
=
baseWarehouseMapper
.
selectOneByExample
(
DcBaseWarehouseExample
.
newAndCreateCriteria
().
andWarehouseCodeEqualTo
(
bailunSku
.
getWarehouseCode
()).
example
());
}
else
if
(
omsResult
.
getLogisticsItems
()
!=
null
&&
omsResult
.
getLogisticsItems
().
size
()
>
0
&&
omsResult
.
getLogisticsItems
().
get
(
0
).
getWarehouse
()
!=
null
&&
omsResult
.
getLogisticsItems
().
get
(
0
).
getWarehouse
().
getWarehouseCode
()
!=
null
){
}
else
if
(
omsResult
.
getLogisticsItems
()
!=
null
&&
omsResult
.
getLogisticsItems
().
size
()
>
0
&&
omsResult
.
getLogisticsItems
().
get
(
0
).
getWarehouse
()
!=
null
&&
omsResult
.
getLogisticsItems
().
get
(
0
).
getWarehouse
().
getWarehouseCode
()
!=
null
)
{
dcBaseWarehouse
=
baseWarehouseMapper
.
selectOneByExample
(
DcBaseWarehouseExample
.
newAndCreateCriteria
().
andWarehouseCodeEqualTo
(
omsResult
.
getLogisticsItems
().
get
(
0
).
getWarehouse
().
getWarehouseCode
()).
example
());
}
}
...
...
@@ -550,7 +558,6 @@ public class OrderSyncJob extends PointJob {
}
private
HashMap
<
String
,
String
>
putSellerNameInMap
(
List
<
SaleItem
>
saleItemList
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>(
saleItemList
.
size
());
if
(
saleItemList
!=
null
&&
saleItemList
.
size
()
>
0
)
{
...
...
@@ -701,8 +708,6 @@ public class OrderSyncJob extends PointJob {
}
/**
* 把OMS订单中的一部分值赋值到百伦订单对象上
*
...
...
@@ -764,7 +769,7 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsOrder
.
setWebsite
(
omsResult
.
getWebsite
());
dcBaseOmsOrder
.
setPlatformOrderType
(
omsResult
.
getPlatformOrderType
());
dcBaseOmsOrder
.
setCreateTime
(
omsResult
.
getCreateTime
());
dcBaseOmsOrder
.
setPaidTime
(
omsResult
.
getPaidTime
()
!=
null
?
omsResult
.
getPaidTime
()
:
omsResult
.
getCreateTime
());
dcBaseOmsOrder
.
setPaidTime
(
omsResult
.
getPaidTime
()
!=
null
?
omsResult
.
getPaidTime
()
:
omsResult
.
getCreateTime
());
dcBaseOmsOrder
.
setPlatformOrderStatus
(
omsResult
.
getPlatformOrderStatus
());
dcBaseOmsOrder
.
setBailunOrderStatus
(
omsResult
.
getBailunOrderStatus
());
dcBaseOmsOrder
.
setBailunInterceptionStatus
(
omsResult
.
getBailunInterceptionStatus
());
...
...
@@ -857,7 +862,7 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsSku
.
setWebsite
(
omsResult
.
getWebsite
());
dcBaseOmsSku
.
setPlatformOrderType
(
omsResult
.
getPlatformOrderType
());
dcBaseOmsSku
.
setCreateTime
(
omsResult
.
getCreateTime
());
dcBaseOmsSku
.
setPaidTime
(
omsResult
.
getPaidTime
()
!=
null
?
omsResult
.
getPaidTime
()
:
omsResult
.
getCreateTime
());
dcBaseOmsSku
.
setPaidTime
(
omsResult
.
getPaidTime
()
!=
null
?
omsResult
.
getPaidTime
()
:
omsResult
.
getCreateTime
());
dcBaseOmsSku
.
setPlatformOrderStatus
(
omsResult
.
getPlatformOrderStatus
());
dcBaseOmsSku
.
setBailunOrderStatus
(
omsResult
.
getBailunOrderStatus
());
dcBaseOmsSku
.
setShippingStatus
(
omsResult
.
getBailunShippingStatus
());
...
...
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