Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
f309519c
Commit
f309519c
authored
Oct 30, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
强制到仓和一键到仓业务一致
parent
8cf1d723
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
53 deletions
+49
-53
OrderWarehouseCheckServiceImpl.java
...e/orderWarehouseCheck/OrderWarehouseCheckServiceImpl.java
+49
-53
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseCheck/OrderWarehouseCheckServiceImpl.java
View file @
f309519c
...
...
@@ -83,26 +83,26 @@ public class OrderWarehouseCheckServiceImpl
Date
now
=
DateUtil
.
date
();
Long
userId
=
SecurityFrameworkUtils
.
getLoginUserId
();
List
<
OrderWarehouseCheckDO
>
newWarehouseCheckDOList
=
new
ArrayList
<>();
// 全部到仓,复制入仓信息
Map
<
Long
,
OrderItemCheckWarehouseVO
>
orderItemCheckWarehouseVOMap
=
new
HashMap
<>();
List
<
OrderWarehouseCheckDO
>
warehouseCheckDOList
=
list
(
orderId
);
// 强制到仓信息一致
if
(
CollectionUtil
.
isNotEmpty
(
warehouseCheckDOList
))
{
Map
<
Long
,
OrderWarehouseCheckDO
>
mappings
=
warehouseCheckDOList
.
stream
().
collect
(
Collectors
.
toMap
(
OrderWarehouseCheckDO:
:
getWarehouseInId
,
Function
.
identity
()));
for
(
OrderWarehouseInDO
inDo
:
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderId
))
{
OrderWarehouseCheckDO
checkDo
=
new
OrderWarehouseCheckDO
();
OrderWarehouseCheckDO
checkDo
=
mappings
.
get
(
inDo
.
getId
());
Long
id
=
checkDo
.
getId
();
BeanUtils
.
copyProperties
(
inDo
,
checkDo
);
checkDo
.
setWarehouseInId
(
inDo
.
getId
()
);
checkDo
.
setId
(
id
);
checkDo
.
setSource
(
3
);
checkDo
.
setCheckTime
(
now
);
checkDo
.
setCreateTime
(
now
);
checkDo
.
setCreator
(
String
.
valueOf
(
userId
));
checkDo
.
setUpdateTime
(
now
);
checkDo
.
setUpdater
(
String
.
valueOf
(
userId
));
abstractMapper
.
insert
(
checkDo
);
abstractMapper
.
updateById
(
checkDo
);
newWarehouseCheckDOList
.
add
(
checkDo
);
}
// 货物信息查询
List
<
OrderItemDO
>
orderItemDOList
=
orderItemService
.
list
(
new
LambdaQueryWrapper
<
OrderItemDO
>().
eq
(
OrderItemDO:
:
getOrderId
,
orderId
));
// 货物的到仓信息分组
// 货物的到仓信息分组
Map
<
Long
,
List
<
OrderWarehouseCheckDO
>>
warehouseCheckDOListMap
=
newWarehouseCheckDOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderWarehouseCheckDO:
:
getOrderItemId
));
Map
<
Long
,
OrderItemCheckWarehouseVO
>
orderItemCheckWarehouseVOMap
=
new
HashMap
<>();
for
(
OrderItemDO
orderItemDO
:
orderItemDOList
)
{
OrderItemCheckWarehouseVO
orderItemCheckWarehouseVO
=
new
OrderItemCheckWarehouseVO
();
BeanUtils
.
copyProperties
(
orderItemDO
,
orderItemCheckWarehouseVO
);
...
...
@@ -114,45 +114,27 @@ public class OrderWarehouseCheckServiceImpl
orderItemCheckWarehouseVO
.
setWarehouseCheckInfoVO
(
warehouseCheckInfoVO
);
orderItemCheckWarehouseVOMap
.
put
(
orderItemDO
.
getOrderItemId
(),
orderItemCheckWarehouseVO
);
}
// 合并单个货物信息的到仓总数据
orderBusinessService
.
orderToWarehouse
(
orderId
,
orderItemCheckWarehouseVOMap
);
}
@Override
public
void
revoke
(
long
orderId
)
{
LambdaQueryWrapper
<
OrderWarehouseCheckDO
>
wrapper
=
Wrappers
.
lambdaQuery
();
// 清空到仓信息
abstractMapper
.
delete
(
wrapper
.
eq
(
OrderWarehouseCheckDO:
:
getOrderId
,
orderId
));
orderBusinessService
.
revokeToWarehouse
(
orderId
);
}
@Override
public
void
force
(
long
orderId
)
{
List
<
OrderWarehouseCheckDO
>
warehouseCheckDOList
=
list
(
orderId
);
// 强制到仓信息一致
if
(
CollectionUtil
.
isNotEmpty
(
warehouseCheckDOList
))
{
List
<
OrderWarehouseCheckDO
>
newWarehouseCheckDOList
=
new
ArrayList
<>();
Date
now
=
DateUtil
.
date
();
Long
userId
=
SecurityFrameworkUtils
.
getLoginUserId
();
Map
<
Long
,
OrderWarehouseCheckDO
>
mappings
=
warehouseCheckDOList
.
stream
().
collect
(
Collectors
.
toMap
(
OrderWarehouseCheckDO:
:
getWarehouseInId
,
Function
.
identity
()));
}
else
{
// 全部到仓,复制入仓信息
for
(
OrderWarehouseInDO
inDo
:
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderId
))
{
OrderWarehouseCheckDO
checkDo
=
mappings
.
get
(
inDo
.
getId
());
Long
id
=
checkDo
.
getId
();
OrderWarehouseCheckDO
checkDo
=
new
OrderWarehouseCheckDO
();
BeanUtils
.
copyProperties
(
inDo
,
checkDo
);
checkDo
.
set
Id
(
id
);
checkDo
.
set
WarehouseInId
(
inDo
.
getId
()
);
checkDo
.
setSource
(
3
);
checkDo
.
setCheckTime
(
now
);
checkDo
.
setCreateTime
(
now
);
checkDo
.
setCreator
(
String
.
valueOf
(
userId
));
checkDo
.
setUpdateTime
(
now
);
checkDo
.
setUpdater
(
String
.
valueOf
(
userId
));
abstractMapper
.
updateById
(
checkDo
);
abstractMapper
.
insert
(
checkDo
);
newWarehouseCheckDOList
.
add
(
checkDo
);
}
// 货物信息查询
List
<
OrderItemDO
>
orderItemDOList
=
orderItemService
.
list
(
new
LambdaQueryWrapper
<
OrderItemDO
>().
eq
(
OrderItemDO:
:
getOrderId
,
orderId
));
// 货物的到仓信息分组
// 货物的到仓信息分组
Map
<
Long
,
List
<
OrderWarehouseCheckDO
>>
warehouseCheckDOListMap
=
newWarehouseCheckDOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderWarehouseCheckDO:
:
getOrderItemId
));
Map
<
Long
,
OrderItemCheckWarehouseVO
>
orderItemCheckWarehouseVOMap
=
new
HashMap
<>();
for
(
OrderItemDO
orderItemDO
:
orderItemDOList
)
{
OrderItemCheckWarehouseVO
orderItemCheckWarehouseVO
=
new
OrderItemCheckWarehouseVO
();
BeanUtils
.
copyProperties
(
orderItemDO
,
orderItemCheckWarehouseVO
);
...
...
@@ -164,10 +146,24 @@ public class OrderWarehouseCheckServiceImpl
orderItemCheckWarehouseVO
.
setWarehouseCheckInfoVO
(
warehouseCheckInfoVO
);
orderItemCheckWarehouseVOMap
.
put
(
orderItemDO
.
getOrderItemId
(),
orderItemCheckWarehouseVO
);
}
}
// 合并单个货物信息的到仓总数据
orderBusinessService
.
orderToWarehouse
(
orderId
,
orderItemCheckWarehouseVOMap
);
}
else
{
check
(
orderId
);
}
@Override
public
void
revoke
(
long
orderId
)
{
LambdaQueryWrapper
<
OrderWarehouseCheckDO
>
wrapper
=
Wrappers
.
lambdaQuery
();
// 清空到仓信息
abstractMapper
.
delete
(
wrapper
.
eq
(
OrderWarehouseCheckDO:
:
getOrderId
,
orderId
));
orderBusinessService
.
revokeToWarehouse
(
orderId
);
}
@Override
public
void
force
(
long
orderId
)
{
check
(
orderId
);
}
@Override
...
...
@@ -193,7 +189,7 @@ public class OrderWarehouseCheckServiceImpl
abstractMapper
.
updateBatch
(
newWarehouseCheckDOList
);
// 更新到订单中汇总
// 货物信息查询
OrderItemDO
orderItemDO
=
orderItemService
.
getById
(
checkUpdateReqVO
.
getOrderItemId
());
OrderItemDO
orderItemDO
=
orderItemService
.
getById
(
checkUpdateReqVO
.
getOrderItemId
());
// 货物的到仓信息分组
Map
<
Long
,
OrderItemCheckWarehouseVO
>
orderItemCheckWarehouseVOMap
=
new
HashMap
<>();
OrderItemCheckWarehouseVO
orderItemCheckWarehouseVO
=
new
OrderItemCheckWarehouseVO
();
...
...
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