rename registration event limit type
This commit is contained in:
@@ -38,7 +38,7 @@ public class GaoRegistrationEvent extends UUIDEntity {
|
|||||||
///
|
///
|
||||||
/// @author Codex
|
/// @author Codex
|
||||||
/// @since 2026-08-01
|
/// @since 2026-08-01
|
||||||
public enum RegistrationLimitType {
|
public enum LimitType {
|
||||||
|
|
||||||
/// 不限制
|
/// 不限制
|
||||||
NONE,
|
NONE,
|
||||||
@@ -78,7 +78,7 @@ public class GaoRegistrationEvent extends UUIDEntity {
|
|||||||
private Boolean requirePhoto;
|
private Boolean requirePhoto;
|
||||||
|
|
||||||
/// 登记限制类型
|
/// 登记限制类型
|
||||||
private RegistrationLimitType limitType;
|
private LimitType limitType;
|
||||||
|
|
||||||
/// 登记限制数值,按限制类型表示小时数或次数
|
/// 登记限制数值,按限制类型表示小时数或次数
|
||||||
private Integer limitValue;
|
private Integer limitValue;
|
||||||
|
|||||||
+1
-1
@@ -321,7 +321,7 @@ public class GaoRegistrationEventRecordServiceImplement extends AbstractEntitySe
|
|||||||
private void checkRegistrationEventCreatable(GaoRegistrationEvent registrationEvent, String customerId, long registeredAt) {
|
private void checkRegistrationEventCreatable(GaoRegistrationEvent registrationEvent, String customerId, long registeredAt) {
|
||||||
TimiException.requiredTrue(Boolean.TRUE.equals(registrationEvent.getEnabled()), "登记事件未启用");
|
TimiException.requiredTrue(Boolean.TRUE.equals(registrationEvent.getEnabled()), "登记事件未启用");
|
||||||
TimiException.requiredTrue(registrationEvent.getStatus() == null || registrationEvent.getStatus() == GaoRegistrationEvent.Status.ACTIVE, "登记事件不可登记");
|
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) {
|
switch (limitType) {
|
||||||
case DAILY_HALF_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getHalfDayBegin(registeredAt), getHalfDayEnd(registeredAt), "该客户当前半日已登记该事件");
|
case DAILY_HALF_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getHalfDayBegin(registeredAt), getHalfDayEnd(registeredAt), "该客户当前半日已登记该事件");
|
||||||
case NATURAL_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getDayBegin(registeredAt), getDayEnd(registeredAt), "该客户当日已登记该事件");
|
case NATURAL_DAY -> checkRegistrationLimitRange(customerId, registrationEvent.getId(), getDayBegin(registeredAt), getDayEnd(registeredAt), "该客户当日已登记该事件");
|
||||||
|
|||||||
+3
-3
@@ -109,7 +109,7 @@ public class GaoRegistrationEventServiceImplement extends AbstractEntityService<
|
|||||||
entity.setRequirePhoto(false);
|
entity.setRequirePhoto(false);
|
||||||
}
|
}
|
||||||
if (entity.getLimitType() == null) {
|
if (entity.getLimitType() == null) {
|
||||||
entity.setLimitType(GaoRegistrationEvent.RegistrationLimitType.NONE);
|
entity.setLimitType(GaoRegistrationEvent.LimitType.NONE);
|
||||||
}
|
}
|
||||||
checkRegistrationLimit(entity);
|
checkRegistrationLimit(entity);
|
||||||
if (entity.getColor() != null) {
|
if (entity.getColor() != null) {
|
||||||
@@ -121,8 +121,8 @@ public class GaoRegistrationEventServiceImplement extends AbstractEntityService<
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkRegistrationLimit(GaoRegistrationEvent entity) {
|
private void checkRegistrationLimit(GaoRegistrationEvent entity) {
|
||||||
if (entity.getLimitType() == GaoRegistrationEvent.RegistrationLimitType.INTERVAL_HOUR
|
if (entity.getLimitType() == GaoRegistrationEvent.LimitType.INTERVAL_HOUR
|
||||||
|| entity.getLimitType() == GaoRegistrationEvent.RegistrationLimitType.TOTAL_LIMIT) {
|
|| entity.getLimitType() == GaoRegistrationEvent.LimitType.TOTAL_LIMIT) {
|
||||||
TimiException.required(entity.getLimitValue(), "not found registrationEvent.limitValue");
|
TimiException.required(entity.getLimitValue(), "not found registrationEvent.limitValue");
|
||||||
TimiException.requiredTrue(0 < entity.getLimitValue(), "registrationEvent.limitValue lte 0");
|
TimiException.requiredTrue(0 < entity.getLimitValue(), "registrationEvent.limitValue lte 0");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user