This commit is contained in:
parent
c288a5669f
commit
a950dfcf33
3 changed files with 29 additions and 21 deletions
|
|
@ -5,6 +5,7 @@ import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||||
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
|
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
|
||||||
import ru.clearing.classes.statics.data.registry.Registry;
|
import ru.clearing.classes.statics.data.registry.Registry;
|
||||||
|
import ru.clearing.classes.statics.data.security.Security;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.platform.enumeration.CompanySymbol;
|
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||||
import ru.spcex.platform.enumeration.InOutDirection;
|
import ru.spcex.platform.enumeration.InOutDirection;
|
||||||
|
|
@ -36,11 +37,15 @@ public class PaymentInstructionBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaymentInstruction build() {
|
public PaymentInstruction build() {
|
||||||
|
Imdg<Account> accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
Imdg<Company> companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||||
|
Imdg<CompanySymbols> companySymbolsImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
|
||||||
|
Imdg<Security> securityImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Security, Security.class);
|
||||||
|
|
||||||
PaymentInstruction paymentInstruction = new PaymentInstruction();
|
PaymentInstruction paymentInstruction = new PaymentInstruction();
|
||||||
paymentInstruction.setSenderId(registry.getCompanyId());
|
paymentInstruction.setSenderId(registry.getCompanyId());
|
||||||
paymentInstruction.setAddresseeId(registry.getCounterPartyId());
|
paymentInstruction.setAddresseeId(registry.getCounterPartyId());
|
||||||
|
|
||||||
Imdg<CompanySymbols> companySymbolsImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
|
|
||||||
CompanySymbols companySymbols = companySymbolsImdg.getSingleObjectByFieldValues(Map.of(
|
CompanySymbols companySymbols = companySymbolsImdg.getSingleObjectByFieldValues(Map.of(
|
||||||
"companyId", registry.getCompanyId(),
|
"companyId", registry.getCompanyId(),
|
||||||
"companySymbol", CompanySymbol.BIC.getKey())
|
"companySymbol", CompanySymbol.BIC.getKey())
|
||||||
|
|
@ -60,7 +65,6 @@ public class PaymentInstructionBuilder {
|
||||||
paymentInstruction.setAdresseeBic(counterCompanySymbols.getCompanySymbolValue());
|
paymentInstruction.setAdresseeBic(counterCompanySymbols.getCompanySymbolValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
Imdg<Company> companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
|
||||||
Company company = companyImdg.getSingleObjectByID(registry.getCompanyId());
|
Company company = companyImdg.getSingleObjectByID(registry.getCompanyId());
|
||||||
if (company != null) {
|
if (company != null) {
|
||||||
paymentInstruction.setPayeeBankName(company.getShortName());
|
paymentInstruction.setPayeeBankName(company.getShortName());
|
||||||
|
|
@ -69,17 +73,14 @@ public class PaymentInstructionBuilder {
|
||||||
paymentInstruction.setSettlementDate(registry.getSettlementDate());
|
paymentInstruction.setSettlementDate(registry.getSettlementDate());
|
||||||
paymentInstruction.setCreditLeg_amount(registry.getBalance());
|
paymentInstruction.setCreditLeg_amount(registry.getBalance());
|
||||||
paymentInstruction.setDebitLeg_amount(registry.getBalance());
|
paymentInstruction.setDebitLeg_amount(registry.getBalance());
|
||||||
paymentInstruction.setCreditLeg_accountId(registry.getAccountId());
|
|
||||||
|
|
||||||
Imdg<Account> accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
paymentInstruction.setCreditLeg_accountId(registry.getAccountId());//fixme контрагента?
|
||||||
Account account = accountImdg.getSingleObjectByID(registry.getAccountId());
|
Account account = accountImdg.getSingleObjectByID(paymentInstruction.getCreditLeg_accountId());
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
paymentInstruction.setCreditLeg_account(account.getAccount());
|
paymentInstruction.setCreditLeg_account(account.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
paymentInstruction.setDebitLeg_accountId(registry.getAccountId());
|
paymentInstruction.setDebitLeg_accountId(registry.getAccountId()); //fixme компании?
|
||||||
|
|
||||||
// Imdg<DepoAccount> depoAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
|
|
||||||
account = accountImdg.getSingleObjectByID(paymentInstruction.getDebitLeg_accountId());
|
account = accountImdg.getSingleObjectByID(paymentInstruction.getDebitLeg_accountId());
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
paymentInstruction.setDebitLeg_account(account.getAccount());
|
paymentInstruction.setDebitLeg_account(account.getAccount());
|
||||||
|
|
@ -88,6 +89,15 @@ public class PaymentInstructionBuilder {
|
||||||
paymentInstruction.setCreditLeg_direction(InOutDirection.out.getKey());
|
paymentInstruction.setCreditLeg_direction(InOutDirection.out.getKey());
|
||||||
paymentInstruction.setDebitLeg_direction(InOutDirection.in.getKey());
|
paymentInstruction.setDebitLeg_direction(InOutDirection.in.getKey());
|
||||||
|
|
||||||
|
Security security = securityImdg.getSingleObjectByID(registry.getSecurityId());
|
||||||
|
if (security != null) {
|
||||||
|
//fixme тут точно что-то не то
|
||||||
|
// paymentInstruction.setCreditLeg_currencyCode(security.getSecuritySymbol());
|
||||||
|
paymentInstruction.setCreditLeg_securityId(security.getId());
|
||||||
|
// paymentInstruction.setDebitLeg_currencyCode(security.getSecuritySymbol());
|
||||||
|
paymentInstruction.setDebitLeg_securityId(security.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
paymentInstruction.setTransactionStatus("STLD");
|
paymentInstruction.setTransactionStatus("STLD");
|
||||||
paymentInstruction.setCreated(Instant.now());
|
paymentInstruction.setCreated(Instant.now());
|
||||||
|
|
|
||||||
|
|
@ -349,6 +349,4 @@ public class FormingPaymentInstruction implements ISessionStage {
|
||||||
sDf12.setGenerationId(sdf12GroupId);
|
sDf12.setGenerationId(sdf12GroupId);
|
||||||
sDf12Imdg.insert(sDf12);
|
sDf12Imdg.insert(sDf12);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private String defineCompanyName(Function function, )
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,10 @@ public class FormingRegistersOnOS implements ISessionStage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Registry createRegistryFor(Registry forRegistry) {
|
Registry createRegistryFor(Registry forRegistry) {
|
||||||
Registry newRegistry = (Registry) forRegistry.clone();// cloneable
|
Registry newRegistry = forRegistry.clone();
|
||||||
newRegistry.setId(idSequence.nextId());
|
newRegistry.setId(idSequence.nextId());
|
||||||
newRegistry.setCreated(Instant.now());
|
newRegistry.setCreated(Instant.now());
|
||||||
newRegistry.setUpdated(newRegistry.getCreated());
|
newRegistry.setUpdated(null);
|
||||||
|
|
||||||
String newRegDestination;
|
String newRegDestination;
|
||||||
if (RegistryDesignation.O.equalsByKey(forRegistry.getRegistryDesignation())) {
|
if (RegistryDesignation.O.equalsByKey(forRegistry.getRegistryDesignation())) {
|
||||||
|
|
@ -104,15 +104,15 @@ public class FormingRegistersOnOS implements ISessionStage {
|
||||||
}
|
}
|
||||||
newRegistry.setRegistryDesignation(newRegDestination);
|
newRegistry.setRegistryDesignation(newRegDestination);
|
||||||
|
|
||||||
String newRegistryInstrumentType; // по ТЗ не меняется
|
// String newRegistryInstrumentType; // по ТЗ не меняется
|
||||||
if (RegistryInstrumentType.S.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
// if (RegistryInstrumentType.S.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
||||||
newRegistryInstrumentType = RegistryInstrumentType.S.getKey();
|
// newRegistryInstrumentType = RegistryInstrumentType.S.getKey();
|
||||||
} else if (RegistryInstrumentType.M.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
// } else if (RegistryInstrumentType.M.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
||||||
newRegistryInstrumentType = RegistryInstrumentType.M.getKey();
|
// newRegistryInstrumentType = RegistryInstrumentType.M.getKey();
|
||||||
} else {
|
// } else {
|
||||||
throw new IllegalArgumentException("RegistryInstrumentType=" + forRegistry.getRegistryInstrumentType());
|
// throw new IllegalArgumentException("RegistryInstrumentType=" + forRegistry.getRegistryInstrumentType());
|
||||||
}
|
// }
|
||||||
newRegistry.setRegistryInstrumentType(newRegistryInstrumentType);
|
// newRegistry.setRegistryInstrumentType(newRegistryInstrumentType);
|
||||||
|
|
||||||
newRegistry.setRegistryCode(RegistryUtil.clearingCode(newRegistry));
|
newRegistry.setRegistryCode(RegistryUtil.clearingCode(newRegistry));
|
||||||
return newRegistry;
|
return newRegistry;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue