Преглед изворни кода

fix 奈飞限购开关设置

zoujiajian пре 1 година
родитељ
комит
c24ea4afd7

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -436,6 +436,11 @@ public interface Constant {
 	 */
 	 */
 	String NF_PURCHASE_LIMIT_WHITE_KEY = "nf_purchase_Limit_white_key";
 	String NF_PURCHASE_LIMIT_WHITE_KEY = "nf_purchase_Limit_white_key";
 
 
+	/**
+	 * 奈飞限购开关
+	 */
+	String NF_PURCHASE_LIMIT_KEY = "nf_purchase_Limit_key";
+
 	/**
 	/**
 	 * 用户镜像店铺佣金比例配置key
 	 * 用户镜像店铺佣金比例配置key
 	 */
 	 */

+ 32 - 18
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1355,26 +1355,31 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		//单个支付每月限购2单奈飞
 		//单个支付每月限购2单奈飞
 		if (orderDon.getGoodsId() == 1) {
 		if (orderDon.getGoodsId() == 1) {
 			Boolean isCheck = true;
 			Boolean isCheck = true;
-			SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-					.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_WHITE_KEY)
+			SysConfig purchaseLimitConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+					.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_KEY)
 					.last("limit 1"));
 					.last("limit 1"));
-			if (one != null && StrUtil.isNotBlank(one.getSysValue())) {
-				List<Long> whiteUserIds = Jsons.parseList(one.getSysValue(), Long.class);
-				if (whiteUserIds.contains(orderDon.getUserId())) {
-					isCheck = false;
+			if (purchaseLimitConfig != null && StrUtil.isNotEmpty(purchaseLimitConfig.getSysValue())) {
+				SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+						.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_WHITE_KEY)
+						.last("limit 1"));
+				if (one != null && StrUtil.isNotBlank(one.getSysValue())) {
+					List<Long> whiteUserIds = Jsons.parseList(one.getSysValue(), Long.class);
+					if (whiteUserIds.contains(orderDon.getUserId())) {
+						isCheck = false;
+					}
 				}
 				}
-			}
-			if (isCheck) {
-				Integer count = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-						.eq(OrderDon::getBuyerId, orderDon.getBuyerId())
-						.eq(OrderDon::getGoodsId, 1)
-						.ne(OrderDon::getId, orderDon.getId())
-						.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-						.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
-				//超过1单 自动退款
-				if (count > 0) {
-					notifyRefundOrder(orderDon, goodsDon, sku);
-					return;
+				if (isCheck) {
+					Integer count = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+							.eq(OrderDon::getBuyerId, orderDon.getBuyerId())
+							.eq(OrderDon::getGoodsId, 1)
+							.ne(OrderDon::getId, orderDon.getId())
+							.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
+							.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
+					//超过1单 自动退款
+					if (count > 0) {
+						notifyRefundOrder(orderDon, goodsDon, sku);
+						return;
+					}
 				}
 				}
 			}
 			}
 		}
 		}
@@ -4596,6 +4601,15 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	private void checkNfPayLimit(Long goodsId, Long userId) throws Exception {
 	private void checkNfPayLimit(Long goodsId, Long userId) throws Exception {
 		if (goodsId != null && goodsId == 1) {
 		if (goodsId != null && goodsId == 1) {
 			Boolean isCheck = true;
 			Boolean isCheck = true;
+			SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+					.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_KEY)
+					.last("limit 1"));
+			if (config == null) {
+				return;
+			}
+			if (StrUtil.isEmpty(config.getSysValue())) {
+				return;
+			}
 			SysConfig nfLimitPayWhiteConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
 			SysConfig nfLimitPayWhiteConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
 					.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_WHITE_KEY)
 					.eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_WHITE_KEY)
 					.last("limit 1"));
 					.last("limit 1"));