|
@@ -84,6 +84,16 @@ public class GiftCardController {
|
|
|
if (byId == null) {
|
|
if (byId == null) {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (byId.getStatus()) {
|
|
|
|
|
+ //校验礼品卡已上架多少个 最多上架三个
|
|
|
|
|
+ int count = giftCardGoodsSkuService.count(Wrappers.lambdaQuery(GiftCardGoodsSku.class)
|
|
|
|
|
+ .eq(GiftCardGoodsSku::getStatus, true)
|
|
|
|
|
+ .eq(GiftCardGoodsSku::getDeleted, true)
|
|
|
|
|
+ .eq(GiftCardGoodsSku::getGcType, byId.getGcType()));
|
|
|
|
|
+ if (count > 2) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(String.format("%s最多上架三个", byId.getGcType() == 1 ? "现金卡" : "虚拟卡"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
byId.setStatus(!byId.getStatus());
|
|
byId.setStatus(!byId.getStatus());
|
|
|
giftCardGoodsSkuService.updateById(byId);
|
|
giftCardGoodsSkuService.updateById(byId);
|
|
|
//设置对应礼品卡平台 最低价格
|
|
//设置对应礼品卡平台 最低价格
|
|
@@ -105,15 +115,4 @@ public class GiftCardController {
|
|
|
giftCardGoodsSkuService.setGiftCardGoodsStat(goodsDonMapper.selectById(byId.getGoodsId()));
|
|
giftCardGoodsSkuService.setGiftCardGoodsStat(goodsDonMapper.selectById(byId.getGoodsId()));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 礼品卡类型设置数量
|
|
|
|
|
- */
|
|
|
|
|
- @GetMapping("/get/num")
|
|
|
|
|
- public Result<Integer> getGiftCardNum(@RequestParam(defaultValue = "1") Integer gcType) {
|
|
|
|
|
- int count = giftCardGoodsSkuService.count(Wrappers.lambdaQuery(GiftCardGoodsSku.class)
|
|
|
|
|
- .eq(GiftCardGoodsSku::getGcType, gcType)
|
|
|
|
|
- .eq(GiftCardGoodsSku::getDeleted, true));
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(count);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|