|
@@ -401,10 +401,19 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -401,10 +401,19 @@ public class ProductServiceImpl implements ProductService { |
401
|
if (sp == null) {
|
401
|
if (sp == null) {
|
402
|
throw new ServiceException(400, "商品(skup)不存在:" + skup);
|
402
|
throw new ServiceException(400, "商品(skup)不存在:" + skup);
|
403
|
}
|
403
|
}
|
404
|
-
|
|
|
405
|
- int expectedStatus = (status == 4) ? 1 : 0;
|
|
|
406
|
- if (sp.getStatus() == null || sp.getStatus() != expectedStatus) {
|
|
|
407
|
- throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
404
|
+ if (sp.getPreSaleFlag() == null || sp.getStatus() == null) {
|
|
|
405
|
+ throw new ServiceException(400, "商品(skup)类型异常:" + skup);
|
|
|
406
|
+ }
|
|
|
407
|
+ boolean isSecondHand = (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6);
|
|
|
408
|
+ if (isSecondHand && status == 4) {
|
|
|
409
|
+ if (sp.getStatus() != 1 && sp.getStatus() != 10) {
|
|
|
410
|
+ throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
|
|
411
|
+ }
|
|
|
412
|
+ } else {
|
|
|
413
|
+ int expectedStatus = (status == 4) ? 1 : 0;
|
|
|
414
|
+ if (sp.getStatus() != expectedStatus) {
|
|
|
415
|
+ throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
|
|
|
416
|
+ }
|
408
|
}
|
417
|
}
|
409
|
|
418
|
|
410
|
// 使其可售
|
419
|
// 使其可售
|
|
@@ -423,7 +432,12 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -423,7 +432,12 @@ public class ProductServiceImpl implements ProductService { |
423
|
}
|
432
|
}
|
424
|
}
|
433
|
}
|
425
|
} else {
|
434
|
} else {
|
426
|
- if (storagePriceMapper.updateStatus(skup, status, 1) == 0) {
|
435
|
+ // 4:支付保证金后取消售卖
|
|
|
436
|
+ if (isSecondHand) {
|
|
|
437
|
+ if (storagePriceMapper.cancelSaleSecondHandSkupAfterPay(skup) == 0) {
|
|
|
438
|
+ throw new ServiceException(400, "商品(skup)状态已变更");
|
|
|
439
|
+ }
|
|
|
440
|
+ } else if (storagePriceMapper.updateStatus(skup, status, 1) == 0) {
|
427
|
throw new ServiceException(400, "商品(skup)状态已变更");
|
441
|
throw new ServiceException(400, "商品(skup)状态已变更");
|
428
|
}
|
442
|
}
|
429
|
addStorageNum(skup, sp.getStorageId(), -1);
|
443
|
addStorageNum(skup, sp.getStorageId(), -1);
|