|
@@ -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"));
|