|
|
@@ -70,10 +70,18 @@ public class CmsGroupsRelationServiceImpl implements CmsGroupsRelationService {
|
|
|
recoverStatusReset(recoverRecordId);
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- GroupsRelation oldRelation = groupsRelationMapper.selectById(recoverRecord.getRelationId());
|
|
|
+ //清除车票
|
|
|
+ List<Long> userIdList;
|
|
|
+ try {
|
|
|
+ userIdList = userBindRelationService.getRelationUserIdList(recoverRecord.getUserId(), null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ userIdList = List.of(recoverRecord.getUserId());
|
|
|
+ }
|
|
|
+ GroupsRelation oldRelation = groupsRelationMapper.selectOne(Wrappers.lambdaUpdate(GroupsRelation.class).eq(GroupsRelation::getId, recoverRecord.getRelationId()).in(GroupsRelation::getUserId, userIdList).last("limit 1"));
|
|
|
if (oldRelation != null) {
|
|
|
- if (!resetUserTicket(oldRelation, newRelation)) {
|
|
|
+ newRelation.setStartTime(oldRelation.getStartTime());
|
|
|
+ newRelation.setExpiryTime(newExpiryTime);
|
|
|
+ if (!resetUserTicket(oldRelation, newRelation, userIdList)) {
|
|
|
//恢复 待恢复状态
|
|
|
recoverStatusReset(recoverRecordId);
|
|
|
}
|
|
|
@@ -134,21 +142,14 @@ public class CmsGroupsRelationServiceImpl implements CmsGroupsRelationService {
|
|
|
.orderByAsc(GroupsRelation::getNum)
|
|
|
.last("limit 1"));
|
|
|
if (relation != null) {
|
|
|
- log.info("用户userId:{},获取相似车队的车位relationId:{}", relation.getId());
|
|
|
+ log.info("获取相似车队的车位relationId:{}", relation.getId());
|
|
|
}
|
|
|
return relation;
|
|
|
}
|
|
|
|
|
|
- private Boolean resetUserTicket(GroupsRelation oldRelation, GroupsRelation newRelation) {
|
|
|
+ private Boolean resetUserTicket(GroupsRelation oldRelation, GroupsRelation newRelation, List<Long> userIdList) {
|
|
|
Long userId = oldRelation.getUserId();
|
|
|
Long oldRelationId = oldRelation.getId();
|
|
|
- //清除车票
|
|
|
- List<Long> userIdList;
|
|
|
- try {
|
|
|
- userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- } catch (Exception e) {
|
|
|
- userIdList = List.of(userId);
|
|
|
- }
|
|
|
newRelation.setUserId(userId);
|
|
|
|
|
|
//校验座位
|
|
|
@@ -159,6 +160,7 @@ public class CmsGroupsRelationServiceImpl implements CmsGroupsRelationService {
|
|
|
if (update == 0) {
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
+ groupsMapper.decrAvailableNum(newRelation.getGroupsId());
|
|
|
oldRelation.setNewRelationId(newRelation.getId());
|
|
|
clearService.clearTicket(oldRelation, UserTicketClearedRecord.Source.recover_replace);
|
|
|
|