Commit c0e2b1d0 authored by jiaorz's avatar jiaorz

Merge branch 'master-order'

parents 89ae3285 1dbfeb93
......@@ -63,7 +63,7 @@ public class ActivityProductBiz extends BaseBiz<ActivityProductMapper, ActivityP
ActivityProduct oldValue = selectById(activityProduct.getId());
if (oldValue != null) { //增加销量,减少库存
oldValue.setSales(oldValue.getSales() + activityProduct.getSales());
if (oldValue.getStock() > 0) {
if (oldValue.getStock() > 0 || activityProduct.getSales() < 0) {
oldValue.setStock(oldValue.getStock() - activityProduct.getSales());
updateSelectiveByIdRe(oldValue);
return ObjectRestResponse.succ(oldValue);
......
......@@ -57,7 +57,7 @@ public class ActivityProductSpecsBiz extends BaseBiz<ActivityProductSpecsMapper,
}
ActivityProductSpecs oldValue = selectById(activityProductSpecs.getId());
if (oldValue != null) { //增加销量,减少库存
if (oldValue.getStock() > 0) {
if (oldValue.getStock() > 0 || activityProductSpecs.getSales() < 0) {
oldValue.setSales(oldValue.getSales() + activityProductSpecs.getSales());
oldValue.setStock(oldValue.getStock() - activityProductSpecs.getSales());
updateSelectiveByIdRe(oldValue);
......
......@@ -390,12 +390,12 @@ public class OrderCancelBiz {
ActivityProductSpecs activityProductSpecs = activityFeign.get(orderActiveDetail.getSpecsId()).getData();
if (activityProductSpecs != null) {
//修改规格库存
activityProductSpecs.setSales(orderActiveDetail.getNumber());
activityProductSpecs.setSales(-orderActiveDetail.getNumber());
activityFeign.update(activityProductSpecs);
//修改商品库存
ActivityProduct activityProduct = new ActivityProduct();
activityProduct.setId(activityProductSpecs.getGoodsId());
activityProduct.setSales(orderActiveDetail.getNumber());
activityProduct.setSales(-orderActiveDetail.getNumber());
activityFeign.updateProduct(activityProduct);
}
......
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