|
|
@@ -311,6 +311,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
@Override
|
|
|
public GroupsRelation getRelation(Long payRelationId, Long userId, GoodsDonSku sku) {
|
|
|
GroupsRelation relation = null;
|
|
|
+ Integer maxNum = sku.getNum();
|
|
|
if (payRelationId != null && payRelationId > 0) {
|
|
|
relation = groupsRelationMapper.selectById(payRelationId);
|
|
|
if (relation == null) {
|
|
|
@@ -324,7 +325,6 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
GroupsTrips groups = null;
|
|
|
//ChatGpt Plus、Midjourney非独立规格 上车先获取硬塞座位 硬塞5个座位
|
|
|
//主账号过期时间25天以外
|
|
|
- Integer maxNum = sku.getNum();
|
|
|
if (sku.getNum() > 1 && Constant.AI_goodsIds.contains(sku.getGoodsId())) {
|
|
|
Integer extraNum = 5;
|
|
|
if (sku.getId() == 178l) {
|
|
|
@@ -398,6 +398,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
//车队目前可用停车数
|
|
|
relation.setGroupsAvailParkingNum(groups.getAvailableParkingNum());
|
|
|
+ relation.setMaxNum(maxNum);
|
|
|
}
|
|
|
return relation;
|
|
|
}
|
|
|
@@ -432,7 +433,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void checkGroupsAvailParkingNum(Long skuId, Long groupsId, Integer availableParkingNum) {
|
|
|
+ public void checkGroupsAvailParkingNum(Long skuId, Long groupsId, Integer availableParkingNum, Integer maxNum) {
|
|
|
//GPT10人月付、4人月付
|
|
|
if (skuId == 161l || skuId == 178l) {
|
|
|
//为0时,不参与限制
|
|
|
@@ -443,7 +444,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
//目前上车人数
|
|
|
Integer currentParkingNum = groupsRelationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
.eq(GroupsRelation::getGroupsId, groupsId)
|
|
|
- .ne(GroupsRelation::getUserId, 0));
|
|
|
+ .ne(GroupsRelation::getUserId, 0)
|
|
|
+ .le(GroupsRelation::getNum, maxNum));
|
|
|
if (currentParkingNum > availableParkingNum) {
|
|
|
throw BusinessRuntimeException.getInstance("系统繁忙,请重试...");
|
|
|
}
|
|
|
@@ -467,14 +469,15 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
if (skuId == 178l) {
|
|
|
extraNum = 2;
|
|
|
}
|
|
|
- Integer skuNum = sku.getNum();
|
|
|
- if (availableParkingNum >= skuNum + extraNum) {
|
|
|
+ Integer maxNum = sku.getNum() + extraNum;
|
|
|
+ if (availableParkingNum >= maxNum) {
|
|
|
return;
|
|
|
}
|
|
|
//目前上车人数
|
|
|
Integer currentParkingNum = groupsRelationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
.eq(GroupsRelation::getGroupsId, groupsId)
|
|
|
- .ne(GroupsRelation::getUserId, 0));
|
|
|
+ .ne(GroupsRelation::getUserId, 0)
|
|
|
+ .le(GroupsRelation::getNum, maxNum));
|
|
|
if (currentParkingNum >= availableParkingNum) {
|
|
|
//锁住
|
|
|
DateTime parkingTime = DateUtil.offsetDay(DateTime.now(), 1);
|