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