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
public Optional<EnumMessage> validate(ImdgValidationContext<T> ctx) {
T validatedObject = ctx.getValidatedObject();
if (validatedObject.getQuantityLot() == null || validatedObject.getQuantityLot() < 0) {
return of(DefaultManagementErrors.RequiredFieldIsEmpty, "quantityLot");
if (validatedObject.getQuantityLot() == null || validatedObject.getQuantityLot() <= 0) {
return of(DefaultManagementErrors.OperationNotAllowed, "quantityLot");
}
return Optional.empty();
}

View file

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

View file

@ -1,10 +1,11 @@
package ru.spcex.clearing.platform.messaging.domain.cud.order;
import java.math.BigDecimal;
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.WithQuantityLot;
public class OrderCurrencyUpdateRequest implements WithId {
public class OrderCurrencyUpdateRequest implements WithId, WithQuantityLot {
@JsonProperty
private Long id;
@JsonProperty
@ -56,6 +57,7 @@ public class OrderCurrencyUpdateRequest implements WithId {
this.price = price;
}
@Override
public Long getQuantityLot() {
return quantityLot;
}