|
|
@@ -396,17 +396,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
throw new BusinessRuntimeException("您有未支付订单.");
|
|
|
}
|
|
|
}
|
|
|
- if (goodsId != null && goodsId == 1) {
|
|
|
- List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- Integer selectCount = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .in(OrderDon::getUserId, userIdList)
|
|
|
- .eq(OrderDon::getGoodsId, 1)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
|
|
|
- if (selectCount > 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("奈飞近30天内限购一单");
|
|
|
- }
|
|
|
- }
|
|
|
+ //校验奈飞限购信息
|
|
|
+ checkNfPayLimit(goodsId, userId);
|
|
|
GroupsRelation relation = null;
|
|
|
String orderPhone = payRequest.getPhone();
|
|
|
if (StrUtil.isNotBlank(orderPhone)) {
|
|
|
@@ -1291,16 +1282,28 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
//单个支付每月限购2单奈飞
|
|
|
if (orderDon.getGoodsId() == 1) {
|
|
|
- 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)));
|
|
|
- //超过2单 自动退款
|
|
|
- if (count > 0) {
|
|
|
- notifyRefundOrder(orderDon, goodsDon, sku);
|
|
|
- return;
|
|
|
+ Boolean isCheck = true;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -4317,4 +4320,30 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ private void checkNfPayLimit(Long goodsId, Long userId) throws Exception {
|
|
|
+ if (goodsId != null && goodsId == 1) {
|
|
|
+ Boolean isCheck = true;
|
|
|
+ SysConfig nfLimitPayWhiteConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
+ .eq(SysConfig::getSysKey, Constant.NF_PURCHASE_LIMIT_WHITE_KEY)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (nfLimitPayWhiteConfig != null && StrUtil.isNotBlank(nfLimitPayWhiteConfig.getSysValue())) {
|
|
|
+ List<Long> whiteUserIds = Jsons.parseList(nfLimitPayWhiteConfig.getSysValue(), Long.class);
|
|
|
+ if (whiteUserIds.contains(userId)) {
|
|
|
+ isCheck = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isCheck) {
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ Integer selectCount = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .in(OrderDon::getUserId, userIdList)
|
|
|
+ .eq(OrderDon::getGoodsId, 1)
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
+ .ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
|
|
|
+ if (selectCount > 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("奈飞近30天内限购一单");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|