Explorar o código

MJ同一买家或者同一用户一个月内多次购买退款

zoujiajian %!s(int64=2) %!d(string=hai) anos
pai
achega
6db1f4dd3d

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

@@ -1154,12 +1154,14 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (orderDon.getOrderType() == 1 && StrUtil.isNotEmpty(buyerId)) {
 			//近一个月同一买家id 只能购买一次 多人
 			if (orderDon.getGoodsId() == 26l && sku.getNum() != 1) {
+				List<Long> userIdList = userBindRelationService.getRelationUserIdList(orderDon.getUserId(), null);
 				Integer count = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
 						.ne(OrderDon::getId, orderDon.getId())
 						.eq(OrderDon::getGoodsId, orderDon.getGoodsId())
-						.eq(OrderDon::getBuyerId, buyerId)
 						.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-						.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1)));
+						.ge(OrderDon::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -1))
+						//同一买家或者同一用户
+						.and(o -> o.eq(OrderDon::getBuyerId, buyerId).or().in(OrderDon::getUserId, userIdList)));
 				if (count > 1) {
 					//退款
 					log.info("一个月内同一买家id购买过Midjourney账号,对订单号:{}进行退款", orderDon.getOrderNo());