This commit is contained in:
parent
3619329137
commit
f9044dcc1c
5 changed files with 15 additions and 10 deletions
|
|
@ -137,6 +137,7 @@ public class ValidationConfig {
|
|||
Sdf57ValidationRule.CompanyDebPresent,
|
||||
Sdf57ValidationRule.CompanyCredPresent,
|
||||
Sdf57ValidationRule.AccountDebPresent,
|
||||
Sdf57ValidationRule.AccountCredPresent,
|
||||
Sdf57ValidationRule.CurrencyCode
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ import ru.spcex.platform.utils.enumeration.IErrorEnumId;
|
|||
|
||||
public enum ClearingError implements IErrorEnumId {
|
||||
GeneralError(5400L),
|
||||
IncorrectValue(5404L),
|
||||
RecordNotFound(5406L),
|
||||
CompanyNotFound(5410L),
|
||||
CompanyNotActive(5411L),
|
||||
CompanyCreditCheck(5412L),
|
||||
CompanyDebitCheck(5413L),
|
||||
CurrentDateOnly(5214L),
|
||||
AccountNotFound(5414L),
|
||||
AccountNotActive(5415L),
|
||||
SecurityNotFound(5416L),
|
||||
AccountNotPresent(5417L),
|
||||
|
|
|
|||
|
|
@ -66,16 +66,16 @@ public enum Sdf01ValidationRule implements IValidationRule<ImdgValidationContext
|
|||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf01> context) {
|
||||
SDf01 sdf01 = context.getValidatedObject();
|
||||
if (sdf01.getDat() == null) {
|
||||
return of(ClearingError.CurrentDateOnly);
|
||||
return of(ClearingError.IncorrectValue);
|
||||
}
|
||||
LocalDate date;
|
||||
try {
|
||||
date = LocalDate.parse(sdf01.getDat(), datFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
return of(ClearingError.CurrentDateOnly);
|
||||
return of(ClearingError.IncorrectValue);
|
||||
}
|
||||
if (!LocalDate.now().equals(date)) {
|
||||
return of(ClearingError.CurrentDateOnly);
|
||||
return of(ClearingError.IncorrectValue);
|
||||
}
|
||||
return empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ public enum Sdf57ValidationRule implements IValidationRule<ImdgValidationContext
|
|||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf57> context) {
|
||||
SDf57 sdf57 = context.getValidatedObject();
|
||||
if (TextUtil.isEmpty(sdf57.getDeal_cred())) {
|
||||
return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb());
|
||||
return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred());
|
||||
}
|
||||
Imdg<Company> companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class);
|
||||
Company found = companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_cred() + "'");
|
||||
if (found == null) {
|
||||
return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb());
|
||||
return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred());
|
||||
}
|
||||
context.storeObject(ValidationStored.Sdf57CompanyCred, found);
|
||||
return empty();
|
||||
|
|
@ -49,12 +49,12 @@ public enum Sdf57ValidationRule implements IValidationRule<ImdgValidationContext
|
|||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf57> context) {
|
||||
SDf57 sdf57 = context.getValidatedObject();
|
||||
if (TextUtil.isEmpty(sdf57.getC_acc_deb())) {
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb());
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb());
|
||||
}
|
||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||
Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_deb() + "'");
|
||||
if (found == null) {
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb());
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb());
|
||||
}
|
||||
context.storeObject(ValidationStored.Sdf57AccountDeb, found);
|
||||
return empty();
|
||||
|
|
@ -65,12 +65,12 @@ public enum Sdf57ValidationRule implements IValidationRule<ImdgValidationContext
|
|||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf57> context) {
|
||||
SDf57 sdf57 = context.getValidatedObject();
|
||||
if (TextUtil.isEmpty(sdf57.getC_acc_cred())) {
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb());
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred());
|
||||
}
|
||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||
Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_cred() + "'");
|
||||
if (found == null) {
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb());
|
||||
return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred());
|
||||
}
|
||||
context.storeObject(ValidationStored.Sdf57AccountCred, found);
|
||||
return empty();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
|||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -153,6 +154,8 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
|||
newSession.setSection(Section.FOND.getKey());
|
||||
newSession.setSessionType(SessionType.IPOB.getKey());
|
||||
newSession.setSessionStatus(SessionStatus.CLRN.getKey());
|
||||
newSession.setClearingDate(LocalDate.now());
|
||||
|
||||
//todo companyId/securityId/userId передается из сообщения очереди
|
||||
sessionImdg.insert(newSession);
|
||||
currSession = newSession;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue