Commit 1437d94a authored by shiyu's avatar shiyu

转拍卖商品卖出后,原商品也扣减库存

parent 64a273d0
...@@ -59,7 +59,10 @@ public class ItemTagOperateServiceImpl implements ItemTagOperateService { ...@@ -59,7 +59,10 @@ public class ItemTagOperateServiceImpl implements ItemTagOperateService {
//查询类目信息 //查询类目信息
Category category = categoryDao.findById(dto.getCategoryId()); Category category = categoryDao.findById(dto.getCategoryId());
EntityMapper.copyAttribute(dto, supplierItem); EntityMapper.copyAttribute(dto, supplierItem);
supplierItem.setName(category.getName());
//查询分类的上级节点
Category parentCategory = categoryDao.findById(category.getPid());
supplierItem.setName(parentCategory.getName() + "-" + category.getName());
supplierItem.setDescription(category.getIntroduction()); supplierItem.setDescription(category.getIntroduction());
supplierItem.setSupplyPrice(0L); supplierItem.setSupplyPrice(0L);
supplierItem.setRebate(new BigDecimal("0")); supplierItem.setRebate(new BigDecimal("0"));
......
...@@ -445,6 +445,15 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -445,6 +445,15 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}*/ }*/
int updateStock = currentStock - stock; int updateStock = currentStock - stock;
supplierItemDao.updateStock(itemId, updateStock); supplierItemDao.updateStock(itemId, updateStock);
//拍卖商品,检查是否是别的商品转拍卖,是的话原商品的库存也要扣减
if (supplierItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
if (supplierItem.getSupplierId() != null) {
SupplierItem sourceItem = supplierItemDao.findById(supplierItem.getSupplierId());
//当前库存
int sourceItemStock = sourceItem.getStock();
supplierItemDao.updateStock(supplierItem.getSupplierId(), (sourceItemStock - stock));
}
}
return Result.success(); return Result.success();
} else { } else {
return Result.failed("扣减库存失败"); return Result.failed("扣减库存失败");
......
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