|
|
@@ -119,9 +119,14 @@ public class UserReservationServiceImpl extends ServiceImpl<UserReservationMappe
|
|
|
if (dto.getGuestCount() == null || dto.getGuestCount() < 1) {
|
|
|
throw new RuntimeException("预约人数至少为1");
|
|
|
}
|
|
|
+ int sourceType = dto.getType() == null ? 0 : dto.getType();
|
|
|
+ if (sourceType < 0 || sourceType > 2) {
|
|
|
+ throw new RuntimeException("type参数不合法,仅支持0-线上预订、1-app扫码、2-线下开台");
|
|
|
+ }
|
|
|
|
|
|
UserReservation entity = new UserReservation();
|
|
|
- BeanUtils.copyProperties(dto, entity, "id", "tableIds");
|
|
|
+ BeanUtils.copyProperties(dto, entity, "id", "tableIds", "type");
|
|
|
+ entity.setType(sourceType);
|
|
|
entity.setId(null);
|
|
|
entity.setReservationNo(generateReservationNo());
|
|
|
if (entity.getStatus() == null) {
|
|
|
@@ -212,9 +217,17 @@ public class UserReservationServiceImpl extends ServiceImpl<UserReservationMappe
|
|
|
String oldTableNumber = tableIdsToTableNumberString(listTableIdsByReservationId(existing.getId()));
|
|
|
|
|
|
UserReservation entity = new UserReservation();
|
|
|
- BeanUtils.copyProperties(dto, entity, "tableIds", "reservationNo");
|
|
|
+ BeanUtils.copyProperties(dto, entity, "tableIds", "reservationNo", "type");
|
|
|
entity.setId(existing.getId());
|
|
|
entity.setReservationNo(existing.getReservationNo());
|
|
|
+ if (dto.getType() != null) {
|
|
|
+ if (dto.getType() < 0 || dto.getType() > 2) {
|
|
|
+ throw new RuntimeException("type参数不合法,仅支持0-线上预订、1-app扫码、2-线下开台");
|
|
|
+ }
|
|
|
+ entity.setType(dto.getType());
|
|
|
+ } else {
|
|
|
+ entity.setType(existing.getType());
|
|
|
+ }
|
|
|
this.updateById(entity);
|
|
|
|
|
|
saveReservationTables(existing.getId(), dto.getTableIds());
|