etreschenkov 2026-06-02 11:04:20 +03:00
parent 9b902fb956
commit 6430a3ef4d
3 changed files with 7 additions and 4 deletions

View file

@ -13,8 +13,8 @@ public class QuantityLotGreaterThanZero<T extends WithQuantityLot> implements IV
@Override @Override
public Optional<EnumMessage> validate(ImdgValidationContext<T> ctx) { public Optional<EnumMessage> validate(ImdgValidationContext<T> ctx) {
T validatedObject = ctx.getValidatedObject(); T validatedObject = ctx.getValidatedObject();
if (validatedObject.getQuantityLot() == null || validatedObject.getQuantityLot() < 0) { if (validatedObject.getQuantityLot() == null || validatedObject.getQuantityLot() <= 0) {
return of(DefaultManagementErrors.RequiredFieldIsEmpty, "quantityLot"); return of(DefaultManagementErrors.OperationNotAllowed, "quantityLot");
} }
return Optional.empty(); return Optional.empty();
} }

View file

@ -242,6 +242,7 @@ public class ValidationConfig {
return new ValidatorImpl<>(ctx, return new ValidatorImpl<>(ctx,
orderCurrencyPresentById, orderCurrencyPresentById,
securityPresent, securityPresent,
QuantityLotGreaterThanZero.INSTANCE,
DictionaryPresentRule.instance( DictionaryPresentRule.instance(
"side", "side",
OrderCurrencyUpdateRequest::getSide, OrderCurrencyUpdateRequest::getSide,

View file

@ -1,10 +1,11 @@
package ru.spcex.clearing.platform.messaging.domain.cud.order; package ru.spcex.clearing.platform.messaging.domain.cud.order;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import ru.spcex.platform.classes.base.interfaces.WithId; import ru.spcex.platform.classes.base.interfaces.WithId;
import ru.spcex.platform.classes.base.interfaces.WithQuantityLot;
public class OrderCurrencyUpdateRequest implements WithId { public class OrderCurrencyUpdateRequest implements WithId, WithQuantityLot {
@JsonProperty @JsonProperty
private Long id; private Long id;
@JsonProperty @JsonProperty
@ -56,6 +57,7 @@ public class OrderCurrencyUpdateRequest implements WithId {
this.price = price; this.price = price;
} }
@Override
public Long getQuantityLot() { public Long getQuantityLot() {
return quantityLot; return quantityLot;
} }