diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java index 9ad7192d4..72c8b2676 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java @@ -177,6 +177,8 @@ public enum ReturnCodeEnum { CODE_UPDATE_RESERVED_STATUS_REFUSED("00400016", "时间与现有预订重叠"), + CODE_RESERVATION_ALREADY_EXISTS_ERROR("00400017", "已经存在生效中的预约,请关闭后再试"), + /* 个人桩 end */ CODE_THIS_CARNO_HAS_BEEN_BINDING("00500001", "当前车牌号已经绑定,请检查!"), diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java index 42ee308bd..ec08ba362 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java @@ -15,6 +15,7 @@ import com.jsowell.pile.service.PileBasicInfoService; import com.jsowell.pile.service.PileRemoteService; import com.jsowell.pile.vo.uniapp.MemberPlateNumberVO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -111,6 +112,12 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic */ @Override public void activateReserved(PileReservationDTO dto) { + // 查询其他生效中的预约 + List infoList = pileReservationInfoMapper.findByMemberIdAndPileSnAndStatus(dto.getMemberId(), dto.getPileSn(), "1"); + if (CollectionUtils.isNotEmpty(infoList)) { + throw new BusinessException(ReturnCodeEnum.CODE_RESERVATION_ALREADY_EXISTS_ERROR); + } + PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId())); if (pileReservationInfo == null) { return;