|
@@ -338,14 +338,15 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
.last("limit 1");
|
|
.last("limit 1");
|
|
|
GroupsTrips groups = groupsMapper.selectOne(queryWrapper);
|
|
GroupsTrips groups = groupsMapper.selectOne(queryWrapper);
|
|
|
if (groups == null) throw BusinessRuntimeException.getInstance("车队不存在或已下架");
|
|
if (groups == null) throw BusinessRuntimeException.getInstance("车队不存在或已下架");
|
|
|
- if (orderDon.getGoodsId() != 18 && groups.getAvailableNum() <= 0) {
|
|
|
|
|
|
|
+ if (!Constant.AI_goodsIds.contains(orderDon.getGoodsId()) && groups.getAvailableNum() <= 0) {
|
|
|
throw BusinessRuntimeException.getInstance("该新车位人员已满");
|
|
throw BusinessRuntimeException.getInstance("该新车位人员已满");
|
|
|
}
|
|
}
|
|
|
|
|
+ Integer relationNum = groups.getNum();
|
|
|
//获取新车队车位
|
|
//获取新车队车位
|
|
|
GroupsRelation newRelation;
|
|
GroupsRelation newRelation;
|
|
|
- if (orderDon.getGoodsId() == 18 && groups.getAvailableNum() == 0) {
|
|
|
|
|
- //GPT车队 额外增加车位 并不让上车
|
|
|
|
|
- newRelation = getChatGPTOutsideRelation(orderDon.getUserId(), groupId, 1);
|
|
|
|
|
|
|
+ if (Constant.AI_goodsIds.contains(orderDon.getGoodsId()) && groups.getAvailableNum() == 0) {
|
|
|
|
|
+ //Ai车队 额外增加车位 并不让上车
|
|
|
|
|
+ newRelation = getChatGPTOutsideRelation(orderDon.getUserId(), groupId, relationNum, 1);
|
|
|
} else {
|
|
} else {
|
|
|
newRelation = getRelationThisTrips(orderDon.getUserId(), groupId, 1);
|
|
newRelation = getRelationThisTrips(orderDon.getUserId(), groupId, 1);
|
|
|
}
|
|
}
|
|
@@ -665,9 +666,9 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
return relation;
|
|
return relation;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private GroupsRelation getChatGPTOutsideRelation(Long userId, Long groupsId, Integer retryNum) {
|
|
|
|
|
|
|
+ private GroupsRelation getChatGPTOutsideRelation(Long userId, Long groupsId, Integer relationNum, Integer retryNum) {
|
|
|
//寻找快满编车队额外座位
|
|
//寻找快满编车队额外座位
|
|
|
- GroupsRelation relation = relationMapper.selectOutsideRelationByGroupsId(groupsId);
|
|
|
|
|
|
|
+ GroupsRelation relation = relationMapper.selectOutsideRelationByGroupsId(groupsId, relationNum);
|
|
|
if (relation == null) {
|
|
if (relation == null) {
|
|
|
relation = new GroupsRelation();
|
|
relation = new GroupsRelation();
|
|
|
relation.setStatus(GroupsRelation.Status.outside);
|
|
relation.setStatus(GroupsRelation.Status.outside);
|
|
@@ -682,7 +683,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
if (!redisService.setNx(RedisKey.GROUPS_RELATION_NUM_KEY + relationId, userId, 60 * 5L)) {
|
|
if (!redisService.setNx(RedisKey.GROUPS_RELATION_NUM_KEY + relationId, userId, 60 * 5L)) {
|
|
|
if (retryNum == 7) throw BusinessRuntimeException.getInstance("该车队人员已满,请选择另一车队");
|
|
if (retryNum == 7) throw BusinessRuntimeException.getInstance("该车队人员已满,请选择另一车队");
|
|
|
retryNum++;
|
|
retryNum++;
|
|
|
- getChatGPTOutsideRelation(userId, groupsId, retryNum);
|
|
|
|
|
|
|
+ getChatGPTOutsideRelation(userId, groupsId, relationNum, retryNum);
|
|
|
}
|
|
}
|
|
|
return relation;
|
|
return relation;
|
|
|
}
|
|
}
|