Browse Source

fix 奈飞近30天内限购一单

zoujiajian 1 year ago
parent
commit
acc3e4ac6c

+ 12 - 2
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -396,6 +396,16 @@ 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)
+					.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
+					.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
+			if (selectCount > 0) {
+				throw BusinessRuntimeException.getInstance("奈飞近30天内限购一单");
+			}
+		}
 		GroupsRelation relation = null;
 		String orderPhone = payRequest.getPhone();
 		if (StrUtil.isNotBlank(orderPhone)) {
@@ -1285,9 +1295,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 					.eq(OrderDon::getGoodsId, 1)
 					.ne(OrderDon::getId, orderDon.getId())
 					.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-					.ge(OrderDon::getCreatedTime, DateUtil.beginOfMonth(DateTime.now())));
+					.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
 			//超过2单 自动退款
-			if (count > 1) {
+			if (count > 0) {
 				notifyRefundOrder(orderDon, goodsDon, sku);
 				return;
 			}

+ 5 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java

@@ -87,6 +87,8 @@ public class CmsUserController{
 
     private final UserDoubleVerifyCodeChangeRecordMapper userDoubleVerifyCodeChangeRecordMapper;
 
+    private final List<Long> no_blacks_userIds = List.of(375274l, 545599l, 523937l, 507498l, 604146l, 613437l, 651728l, 614100l, 604148l);
+
     @GetMapping("/get")
     public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order, Boolean isCert, Boolean isAbroad) {
         MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
@@ -159,6 +161,9 @@ public class CmsUserController{
     @PutMapping("/put/black/status/{id}")
     @SaCheckPermission("user:black")
     public Result<String> putBlackStatus(@PathVariable Long id) {
+        if (no_blacks_userIds.contains(id)) {
+            throw BusinessRuntimeException.getInstance("张凯已处理");
+        }
         User user = userMapper.selectById(id);
         Optional.ofNullable(user).ifPresent(u -> {
             u.setIsBlack(!u.getIsBlack());