rename registration event limit type

This commit is contained in:
Timi
2026-08-03 10:48:43 +08:00
parent 2f366fe219
commit 7370b2fc98
3 changed files with 6 additions and 6 deletions
@@ -38,7 +38,7 @@ public class GaoRegistrationEvent extends UUIDEntity {
///
/// @author Codex
/// @since 2026-08-01
public enum RegistrationLimitType {
public enum LimitType {
/// 不限制
NONE,
@@ -78,7 +78,7 @@ public class GaoRegistrationEvent extends UUIDEntity {
private Boolean requirePhoto;
/// 登记限制类型
private RegistrationLimitType limitType;
private LimitType limitType;
/// 登记限制数值,按限制类型表示小时数或次数
private Integer limitValue;
@@ -321,7 +321,7 @@ public class GaoRegistrationEventRecordServiceImplement extends AbstractEntitySe
private void checkRegistrationEventCreatable(GaoRegistrationEvent registrationEvent, String customerId, long registeredAt) {
TimiException.requiredTrue(Boolean.TRUE.equals(registrationEvent.getEnabled()), "登记事件未启用");
TimiException.requiredTrue(registrationEvent.getStatus() == null || registrationEvent.getStatus() == GaoRegistrationEvent.Status.ACTIVE, "登记事件不可登记");
GaoRegistrationEvent.RegistrationLimitType limitType = TimiJava.defaultIfNull(registrationEvent.getLimitType(), GaoRegistrationEvent.RegistrationLimitType.NONE);
GaoRegistrationEvent.LimitType limitType = TimiJava.defaultIfNull(registrationEvent.getLimitType(), GaoRegistrationEvent.LimitType.NONE);
switch (limitType) {
case DAILY_HALF_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getHalfDayBegin(registeredAt), getHalfDayEnd(registeredAt), "该客户当前半日已登记该事件");
case NATURAL_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getDayBegin(registeredAt), getDayEnd(registeredAt), "该客户当日已登记该事件");
@@ -109,7 +109,7 @@ public class GaoRegistrationEventServiceImplement extends AbstractEntityService<
entity.setRequirePhoto(false);
}
if (entity.getLimitType() == null) {
entity.setLimitType(GaoRegistrationEvent.RegistrationLimitType.NONE);
entity.setLimitType(GaoRegistrationEvent.LimitType.NONE);
}
checkRegistrationLimit(entity);
if (entity.getColor() != null) {
@@ -121,8 +121,8 @@ public class GaoRegistrationEventServiceImplement extends AbstractEntityService<
}
private void checkRegistrationLimit(GaoRegistrationEvent entity) {
if (entity.getLimitType() == GaoRegistrationEvent.RegistrationLimitType.INTERVAL_HOUR
|| entity.getLimitType() == GaoRegistrationEvent.RegistrationLimitType.TOTAL_LIMIT) {
if (entity.getLimitType() == GaoRegistrationEvent.LimitType.INTERVAL_HOUR
|| entity.getLimitType() == GaoRegistrationEvent.LimitType.TOTAL_LIMIT) {
TimiException.required(entity.getLimitValue(), "not found registrationEvent.limitValue");
TimiException.requiredTrue(0 < entity.getLimitValue(), "registrationEvent.limitValue lte 0");
return;