Commit f309519c authored by zhengyi's avatar zhengyi

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

parent 8cf1d723
...@@ -83,60 +83,11 @@ public class OrderWarehouseCheckServiceImpl ...@@ -83,60 +83,11 @@ public class OrderWarehouseCheckServiceImpl
Date now = DateUtil.date(); Date now = DateUtil.date();
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
List<OrderWarehouseCheckDO> newWarehouseCheckDOList = new ArrayList<>(); List<OrderWarehouseCheckDO> newWarehouseCheckDOList = new ArrayList<>();
// 全部到仓,复制入仓信息
for (OrderWarehouseInDO inDo : orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderId)) {
OrderWarehouseCheckDO checkDo = new OrderWarehouseCheckDO();
BeanUtils.copyProperties(inDo, checkDo);
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.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<>(); Map<Long, OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOMap = new HashMap<>();
for (OrderItemDO orderItemDO : orderItemDOList) {
OrderItemCheckWarehouseVO orderItemCheckWarehouseVO = new OrderItemCheckWarehouseVO();
BeanUtils.copyProperties(orderItemDO, orderItemCheckWarehouseVO);
orderItemCheckWarehouseVO.setCheckBrand(orderItemDO.getBrand());
orderItemCheckWarehouseVO.setCheckBrandType(orderItemDO.getFeeType());
orderItemCheckWarehouseVO.setCheckMaterial(orderItemDO.getMaterial());
orderItemCheckWarehouseVO.setCheckProdAttrIds(orderItemDO.getWarehouseInProdAttrIds());
WarehouseCheckInfoVO warehouseCheckInfoVO = orderItemSetWarehouseCheckInfoVO(orderItemDO.getBoxGauge(), warehouseCheckDOListMap.get(orderItemDO.getOrderItemId()));
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); List<OrderWarehouseCheckDO> warehouseCheckDOList = list(orderId);
// 强制到仓信息一致 // 强制到仓信息一致
if (CollectionUtil.isNotEmpty(warehouseCheckDOList)) { 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())); Map<Long, OrderWarehouseCheckDO> mappings = warehouseCheckDOList.stream().collect(Collectors.toMap(OrderWarehouseCheckDO::getWarehouseInId, Function.identity()));
for (OrderWarehouseInDO inDo : orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderId)) { for (OrderWarehouseInDO inDo : orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderId)) {
OrderWarehouseCheckDO checkDo = mappings.get(inDo.getId()); OrderWarehouseCheckDO checkDo = mappings.get(inDo.getId());
Long id = checkDo.getId(); Long id = checkDo.getId();
...@@ -152,7 +103,6 @@ public class OrderWarehouseCheckServiceImpl ...@@ -152,7 +103,6 @@ public class OrderWarehouseCheckServiceImpl
List<OrderItemDO> orderItemDOList = orderItemService.list(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderId)); 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, List<OrderWarehouseCheckDO>> warehouseCheckDOListMap = newWarehouseCheckDOList.stream().collect(Collectors.groupingBy(OrderWarehouseCheckDO::getOrderItemId));
Map<Long, OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOMap = new HashMap<>();
for (OrderItemDO orderItemDO : orderItemDOList) { for (OrderItemDO orderItemDO : orderItemDOList) {
OrderItemCheckWarehouseVO orderItemCheckWarehouseVO = new OrderItemCheckWarehouseVO(); OrderItemCheckWarehouseVO orderItemCheckWarehouseVO = new OrderItemCheckWarehouseVO();
BeanUtils.copyProperties(orderItemDO, orderItemCheckWarehouseVO); BeanUtils.copyProperties(orderItemDO, orderItemCheckWarehouseVO);
...@@ -164,10 +114,56 @@ public class OrderWarehouseCheckServiceImpl ...@@ -164,10 +114,56 @@ public class OrderWarehouseCheckServiceImpl
orderItemCheckWarehouseVO.setWarehouseCheckInfoVO(warehouseCheckInfoVO); orderItemCheckWarehouseVO.setWarehouseCheckInfoVO(warehouseCheckInfoVO);
orderItemCheckWarehouseVOMap.put(orderItemDO.getOrderItemId(), orderItemCheckWarehouseVO); orderItemCheckWarehouseVOMap.put(orderItemDO.getOrderItemId(), orderItemCheckWarehouseVO);
} }
orderBusinessService.orderToWarehouse(orderId, orderItemCheckWarehouseVOMap);
} else { } else {
check(orderId); // 全部到仓,复制入仓信息
for (OrderWarehouseInDO inDo : orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderId)) {
OrderWarehouseCheckDO checkDo = new OrderWarehouseCheckDO();
BeanUtils.copyProperties(inDo, checkDo);
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.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));
for (OrderItemDO orderItemDO : orderItemDOList) {
OrderItemCheckWarehouseVO orderItemCheckWarehouseVO = new OrderItemCheckWarehouseVO();
BeanUtils.copyProperties(orderItemDO, orderItemCheckWarehouseVO);
orderItemCheckWarehouseVO.setCheckBrand(orderItemDO.getBrand());
orderItemCheckWarehouseVO.setCheckBrandType(orderItemDO.getFeeType());
orderItemCheckWarehouseVO.setCheckMaterial(orderItemDO.getMaterial());
orderItemCheckWarehouseVO.setCheckProdAttrIds(orderItemDO.getWarehouseInProdAttrIds());
WarehouseCheckInfoVO warehouseCheckInfoVO = orderItemSetWarehouseCheckInfoVO(orderItemDO.getBoxGauge(), warehouseCheckDOListMap.get(orderItemDO.getOrderItemId()));
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) {
check(orderId);
} }
@Override @Override
...@@ -193,7 +189,7 @@ public class OrderWarehouseCheckServiceImpl ...@@ -193,7 +189,7 @@ public class OrderWarehouseCheckServiceImpl
abstractMapper.updateBatch(newWarehouseCheckDOList); abstractMapper.updateBatch(newWarehouseCheckDOList);
// 更新到订单中汇总 // 更新到订单中汇总
// 货物信息查询 // 货物信息查询
OrderItemDO orderItemDO = orderItemService.getById( checkUpdateReqVO.getOrderItemId()); OrderItemDO orderItemDO = orderItemService.getById(checkUpdateReqVO.getOrderItemId());
// 货物的到仓信息分组 // 货物的到仓信息分组
Map<Long, OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOMap = new HashMap<>(); Map<Long, OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOMap = new HashMap<>();
OrderItemCheckWarehouseVO orderItemCheckWarehouseVO = new OrderItemCheckWarehouseVO(); 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