zoujiajian il y a 2 ans
Parent
commit
6cd32cd5a4

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonBackView.java

@@ -1,5 +1,6 @@
 package com.cyksj.model.manage.views;
 
+import com.cyksj.model.entity.GoodsDon;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.entity.OrderDonTransport;
 import com.cyksj.model.entity.OrderDonWaybill;
@@ -63,6 +64,9 @@ public class OrderDonBackView {
 	@DbField("g.title")
 	private String title;
 
+	@DbField("g.special_type")
+	private GoodsDon.SpecialType goodsSpecialType;
+
 	@DbField("o.sku_id")
 	private Long skuId;
 

+ 10 - 11
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GiftCardController.java

@@ -84,6 +84,16 @@ public class GiftCardController {
 		if (byId == null) {
 			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());
 		giftCardGoodsSkuService.updateById(byId);
 		//设置对应礼品卡平台 最低价格
@@ -105,15 +115,4 @@ public class GiftCardController {
 		giftCardGoodsSkuService.setGiftCardGoodsStat(goodsDonMapper.selectById(byId.getGoodsId()));
 		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);
-	}
 }