...
|
...
|
@@ -401,10 +401,19 @@ public class ProductServiceImpl implements ProductService { |
|
|
if (sp == null) {
|
|
|
throw new ServiceException(400, "商品(skup)不存在:" + skup);
|
|
|
}
|
|
|
|
|
|
int expectedStatus = (status == 4) ? 1 : 0;
|
|
|
if (sp.getStatus() == null || sp.getStatus() != expectedStatus) {
|
|
|
throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
|
|
if (sp.getPreSaleFlag() == null || sp.getStatus() == null) {
|
|
|
throw new ServiceException(400, "商品(skup)类型异常:" + skup);
|
|
|
}
|
|
|
boolean isSecondHand = (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6);
|
|
|
if (isSecondHand && status == 4) {
|
|
|
if (sp.getStatus() != 1 && sp.getStatus() != 10) {
|
|
|
throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
|
|
}
|
|
|
} else {
|
|
|
int expectedStatus = (status == 4) ? 1 : 0;
|
|
|
if (sp.getStatus() != expectedStatus) {
|
|
|
throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 使其可售
|
...
|
...
|
@@ -423,7 +432,12 @@ public class ProductServiceImpl implements ProductService { |
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (storagePriceMapper.updateStatus(skup, status, 1) == 0) {
|
|
|
// 4:支付保证金后取消售卖
|
|
|
if (isSecondHand) {
|
|
|
if (storagePriceMapper.cancelSaleSecondHandSkupAfterPay(skup) == 0) {
|
|
|
throw new ServiceException(400, "商品(skup)状态已变更");
|
|
|
}
|
|
|
} else if (storagePriceMapper.updateStatus(skup, status, 1) == 0) {
|
|
|
throw new ServiceException(400, "商品(skup)状态已变更");
|
|
|
}
|
|
|
addStorageNum(skup, sp.getStorageId(), -1);
|
...
|
...
|
|