Commit f309519c authored by zhengyi's avatar zhengyi

强制到仓和一键到仓业务一致

parent 8cf1d723
......@@ -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.setId(id);
checkDo.setWarehouseInId(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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment