|
@@ -145,6 +145,9 @@ public class OrderLogic {
|
|
@Autowired
|
|
@Autowired
|
|
GoodsApplyItemService goodsApplyItemService;
|
|
GoodsApplyItemService goodsApplyItemService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ GoodsSpecService goodsSpecService;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1172,9 +1175,11 @@ public class OrderLogic {
|
|
if (goodsSpec.getStockNum() < num) {
|
|
if (goodsSpec.getStockNum() < num) {
|
|
throw new RemoteServiceException(1100, goodsName + "库存不足");
|
|
throw new RemoteServiceException(1100, goodsName + "库存不足");
|
|
}
|
|
}
|
|
- goodsSpec.setStockNum(goodsSpec.getStockNum() - num);
|
|
|
|
- goodsSpec.setSoldNum(goodsSpec.getSoldNum() + num);
|
|
|
|
- goodsSpec.updateById();
|
|
|
|
|
|
+
|
|
|
|
+ goodsSpecService.lambdaUpdate()
|
|
|
|
+ .eq(GoodsSpec::getGoodsSpecId,goodsSpec.getGoodsSpecId())
|
|
|
|
+ .set(GoodsSpec::getStockNum,goodsSpec.getStockNum() - num)
|
|
|
|
+ .set(GoodsSpec::getSoldNum,goodsSpec.getSoldNum() + num).update();
|
|
|
|
|
|
return goodsSpec;
|
|
return goodsSpec;
|
|
} finally {
|
|
} finally {
|
|
@@ -1193,8 +1198,11 @@ public class OrderLogic {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
GoodsSpec goodsSpec = goodsLogic.getGoodsSpecById(goodsSpecId);
|
|
GoodsSpec goodsSpec = goodsLogic.getGoodsSpecById(goodsSpecId);
|
|
- goodsSpec.setStockNum(goodsSpec.getStockNum() + num);
|
|
|
|
- goodsSpec.updateById();
|
|
|
|
|
|
+
|
|
|
|
+ goodsSpecService.lambdaUpdate()
|
|
|
|
+ .eq(GoodsSpec::getGoodsSpecId,goodsSpec.getGoodsSpecId())
|
|
|
|
+ .set(GoodsSpec::getStockNum,goodsSpec.getStockNum() + num)
|
|
|
|
+ .update();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.info("还原库存失败goodsSpecId:" + goodsSpecId, e);
|
|
log.info("还原库存失败goodsSpecId:" + goodsSpecId, e);
|
|
} finally {
|
|
} finally {
|