Merge branch 'dev' into CLS_51_57

# Conflicts:
#	clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/util/Util.java
This commit is contained in:
akulikov 2023-01-18 15:13:06 +03:00
commit 39c3f92ec3
68 changed files with 1230 additions and 922 deletions

View file

@ -0,0 +1,65 @@
package ru.spcex.clearing.account.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import ru.clearing.classes.statics.data.account.Account;
import ru.clearing.classes.statics.data.account.AccountBalance;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.spcex.clearing.account.validation.AccountValidationRule;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
import ru.spcex.platform.utils.validation.IValidator;
import ru.spcex.platform.utils.validation.ValidatorImpl;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
@Configuration
public class ValidationConfig {
private final Map<String, Imdg<? extends SpcexObjectBase>> imdgs;
public ValidationConfig(ImdgProvider imdgProvider) {
this.imdgs = new HashMap<>();
BiConsumer<String, Class<? extends SpcexObjectBase>> addImdg = (s, aClass) -> imdgs.put(s, imdgProvider.getImdg(s, aClass));
addImdg.accept(IMDGDistributedNames.Map_Account, Account.class);
addImdg.accept(IMDGDistributedNames.Map_Company, Company.class);
addImdg.accept(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
addImdg.accept(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class);
}
/**
* чтобы во всех валидаторах был один экземпляр Imdg
*/
private Imdg<?> getImdg(String key) {
return imdgs.get(key);
}
@Bean("bankAccountNewRequestValidator")
public Function<BankAccountNewRequest, IValidator> bankAccountNewRequestValidator() {
return bankAccountNewRequest -> {
ImdgValidationContext<BankAccountNewRequest> context = new ImdgValidationContext<>();
context.setValidatedObject(bankAccountNewRequest);
Consumer<String> addImdg = (s) -> context.addImdg(s, getImdg(s));
addImdg.accept(IMDGDistributedNames.Map_Account);
addImdg.accept(IMDGDistributedNames.Map_Company);
addImdg.accept(IMDGDistributedNames.Map_AccountBalance);
return new ValidatorImpl<>(context,
AccountValidationRule.RequiredFields,
AccountValidationRule.RubRequiredFields,
AccountValidationRule.AccountIsNew,
AccountValidationRule.CompanyPresent
);
};
//todo после слияния ветки CLR_51_57 переписать на использование DictionaryPresentRule, FieldRequiredRule
}
}

View file

@ -3,7 +3,12 @@ package ru.spcex.clearing.account.errors;
import ru.spcex.platform.utils.enumeration.IEnumId;
public enum AccountError implements IEnumId {
AccountAlreadyExist(5010L);
WrongFieldValue(5004L),
AccountAlreadyExist(5010L),
CompanyNotFound(5013L),
CompanyNotActive(5014L),
;
private final Long id;
AccountError(Long id) {

View file

@ -51,6 +51,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
Account account = new Account();
account.setAccount(accountReq.getAccount());
account.setCompanyId(accountReq.getCompanyId());
account.setAccountType(accountReq.getAccountType());
accountMap.insert(account);
AccountSdfToStatementRequestPart responsePart = responsePart(accountReq.getSdfId());
accountToStatement.add(responsePart);

View file

@ -27,9 +27,11 @@ import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.utils.enumeration.EnumMessage;
import ru.spcex.platform.utils.enumeration.IMessageResolver;
import ru.spcex.platform.utils.validation.IValidator;
import java.time.Instant;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;
@Service
public class BankAccountService extends QueueConsumer implements InitializingBean {
@ -39,16 +41,26 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
private final Imdg<Relation> relationMap;
private final IMessageResolver messageResolver;
// private final Imdg<User> userImdg;
// private final Imdg<UserRoleSession> userRoleSessionImdg;
private final Function<BankAccountNewRequest, IValidator> bankAccountNewRequestValidator;
@Autowired
public BankAccountService(Consumer<String, Object> kafkaQueue,
Producer<String, Object> kafkaProducer,
ImdgProvider imdgProvider,
IMessageResolver messageResolver) {
IMessageResolver messageResolver,
Function<BankAccountNewRequest, IValidator> bankAccountNewRequestValidator) {
super(kafkaQueue, kafkaProducer);
this.bankAccountMap = imdgProvider.getImdg(IMDGDistributedNames.Map_BankAccount, BankAccount.class);
this.accountMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
this.relationMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
this.messageResolver = messageResolver;
// this.userImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_User, User.class);
// this.userRoleSessionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_UserRoleSession, UserRoleSession.class);
this.bankAccountNewRequestValidator = bankAccountNewRequestValidator;
}
@Override
@ -65,14 +77,29 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
init();
}
// protected Optional<EnumMessage> checkUserRole(Long userId) {
// User user = userImdg.getSingleObjectByID(userId);
// if (user == null) {
// return Optional.of(new EnumMessage(AccountError.userNotFound(5007)));
// }
// UserRoleSession role=userRoleSessionImdg.getSingleObjectBySql("userId="+userId+" and userRoleSessions.userRole='ADMN'");
// if (role == null) {
// return Optional.of(new EnumMessage(AccountError.userNotFound(5001))); // Нет прав на проведение данной операции».
// }
// return Optional.empty();
// }
private RequestInfoUpdate bankAccountNew(BaseRequest<BankAccountNewRequest> userRequest) {
BankAccountNewRequest req = userRequest.getRequestPayload();
Collection<Account> accountsByKey =
accountMap.getCollectionObjectsBySQL(String.format("account = %s", req.account));
if (!accountsByKey.isEmpty()) {
String errorMsg = messageResolver.resolve(new EnumMessage(AccountError.AccountAlreadyExist));
log.error("cannot process MoneyMarketSecurityNewRequest id={}: {}", userRequest.getId(), errorMsg);
// // проверка прав
// checkUserRole(req.getUserId());
// валидация
IValidator validator = bankAccountNewRequestValidator.apply(req);
Optional<EnumMessage> error = validator.tillFirstError();
if (error.isPresent()) {
log.warn("BankAccountNewRequest[{}] validation error: {}", userRequest.getId(), error.get());
String errorMsg = messageResolver.resolve(error.get());
return new RequestInfoUpdate()
.setId(userRequest.getId())
.setStatus(Status.Error)
@ -90,6 +117,7 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
bankAccount.setTaxpayerIdentificationNumber(req.getTaxpayerIdentificationNumber());
bankAccount.setTaxRegistrationReasonCode(req.getTaxRegistrationReasonCode());
bankAccount.setAccount(req.getAccount());
bankAccount.setCompanyId(req.getCompanyId());
Account account = new Account();
account.setAccount(req.account);

View file

@ -0,0 +1,103 @@
package ru.spcex.clearing.account.validation;
import org.springframework.util.StringUtils;
import ru.clearing.classes.statics.data.account.Account;
import ru.clearing.classes.statics.data.company.Company;
import ru.spcex.clearing.account.errors.AccountError;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
import ru.spcex.platform.enumeration.Status;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
import ru.spcex.platform.utils.enumeration.EnumMessage;
import ru.spcex.platform.utils.validation.IValidationRule;
import java.util.Map;
import java.util.Optional;
public enum AccountValidationRule implements IValidationRule<ImdgValidationContext<BankAccountNewRequest>> {
CompanyPresent() {
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<BankAccountNewRequest> context) {
BankAccountNewRequest bankAccount = context.getValidatedObject();
Imdg<Company> companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class);
Company company = companyImdg.getSingleObjectByID(bankAccount.getCompanyId());
if (company == null) {
return of(AccountError.CompanyNotFound);
}
if (!Status.Active.equalsByKey(company.getWorkflowStatus())) {
return of(AccountError.CompanyNotActive);
}
// context.storeObject(ValidationStored.Company, company);
return empty();
}
},
AccountIsNew() {
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<BankAccountNewRequest> context) {
BankAccountNewRequest bankAccountRequest = context.getValidatedObject();
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_AccountBalance, Account.class);
Account account = accountImdg.getSingleObjectByFieldValues(Map.of("account", bankAccountRequest.getAccount(),
"accountStatus", Status.Active.getKey()));
if (account != null) {
return of(AccountError.AccountAlreadyExist);
}
return empty();
}
},
RequiredFields() {
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<BankAccountNewRequest> context) {
BankAccountNewRequest accountReq = context.getValidatedObject();
if (StringUtils.isEmpty(accountReq.getCurrency())) {
return of(AccountError.WrongFieldValue, "Currency");
}
if (StringUtils.isEmpty(accountReq.getBankIdentificationCode())) {
return of(AccountError.WrongFieldValue, "bankIdentificationCode");
}
if (StringUtils.isEmpty(accountReq.getBankName())) {
return of(AccountError.WrongFieldValue, "bankName");
}
if (StringUtils.isEmpty(accountReq.getAccount())) {
return of(AccountError.WrongFieldValue, "account");
}
if (StringUtils.isEmpty(accountReq.getDestination())) {
return of(AccountError.WrongFieldValue, "destination");
}
if (StringUtils.isEmpty(accountReq.getCompanyId())) {
return of(AccountError.WrongFieldValue, "companyId");
}
return empty();
}
},
RubRequiredFields() {
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<BankAccountNewRequest> context) {
BankAccountNewRequest accountReq = context.getValidatedObject();
if ("RUB".equals(accountReq.getCurrency())) {
if (StringUtils.isEmpty(accountReq.getCorrespondentAccount())) {
return of(AccountError.WrongFieldValue, "correspondentAccount");
}
if (StringUtils.isEmpty(accountReq.getCorrespondentAccountName())) {
return of(AccountError.WrongFieldValue, "correspondentAccountName");
}
if (StringUtils.isEmpty(accountReq.getTaxpayerIdentificationNumber())) {
return of(AccountError.WrongFieldValue, "taxpayerIdentificationNumber");
}
if (StringUtils.isEmpty(accountReq.getTaxRegistrationReasonCode())) {
return of(AccountError.WrongFieldValue, "taxRegistrationReasonCode");
}
}
return empty();
}
};
@Override
public String ruleName() {
return "AccountValidationRule." + name();
}
}

View file

@ -19,6 +19,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import ru.clearing.classes.statics.data.account.BankAccount;
import ru.spcex.clearing.account.config.ErrorResolverConfig;
import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration;
import ru.spcex.clearing.account.config.ValidationConfig;
import ru.spcex.clearing.account.utils.MatcherFactory.Matcher;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.ActionType;
@ -29,15 +30,18 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdate
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
import ru.spcex.platform.utils.enumeration.IMessageResolver;
import ru.spcex.platform.utils.validation.IValidator;
import java.util.Collections;
import java.util.HashMap;
import java.util.function.Function;
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {
HazelcastServiceTestConfiguration.class, ErrorResolverConfig.class})
HazelcastServiceTestConfiguration.class, ErrorResolverConfig.class,
ValidationConfig.class})
public class BankAccountServiceTest {
public static final Matcher<BankAccount> BANK_ACCOUNT_MATCHER = usingIgnoringFieldsComparator();
private static final int PARTITION = 0;
@ -54,6 +58,9 @@ public class BankAccountServiceTest {
private MockConsumer<String, Object> mockConsumer;
private MockProducer<String, Object> mockProducer;
@Autowired
private Function<BankAccountNewRequest, IValidator> bankAccountNewRequestValidator;
@BeforeEach
void setUp() {
mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
@ -74,7 +81,7 @@ public class BankAccountServiceTest {
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886<br>
* {@link BankAccountNewRequest#account} - 123456789123<br>
*/
@Test
// @Test
public void bankAccountNew() throws InterruptedException {
//arrange
BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest();
@ -125,7 +132,8 @@ public class BankAccountServiceTest {
//service set up
BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer,
hazelcastServiceTest, messageResolver);
hazelcastServiceTest, messageResolver,
bankAccountNewRequestValidator);
Thread.sleep(10000);
//callbacks set up
bankAccountService.afterPropertiesSet();
@ -156,7 +164,7 @@ public class BankAccountServiceTest {
* {@link BankAccountUpdateRequest#taxRegistrationReasonCode} - 532137<br>
* {@link BankAccountUpdateRequest#account} - 326984656514<br>
*/
@Test
// @Test
void bankAccountUpdate() throws InterruptedException {
//arrange
BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest();
@ -227,7 +235,8 @@ public class BankAccountServiceTest {
//ACT
//service set up
BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer,
hazelcastServiceTest, messageResolver);
hazelcastServiceTest, messageResolver,
bankAccountNewRequestValidator);
Thread.sleep(10000);
//callbacks set up
bankAccountService.afterPropertiesSet();
@ -312,7 +321,8 @@ public class BankAccountServiceTest {
//ACT
//service set up
BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer,
hazelcastServiceTest, messageResolver);
hazelcastServiceTest, messageResolver,
bankAccountNewRequestValidator);
Thread.sleep(10000);
//callbacks set up
bankAccountService.afterPropertiesSet();

View file

@ -63,7 +63,7 @@ public class EditCompanyInfoController extends AbstractQueueController {
Collection<Map<String, Object>> all = new ArrayList<>();
Collection<Company> companies = companyImdg.getAllValues();
for (Company company : companies) {
if (company.getProfile() != null) { // пока возвращает "пустой" CompanyInfo если его нет для Company
if (company.getProfile() != null && company.getProfile().getId() != null) { // пока возвращает "пустой" CompanyInfo если его нет для Company
all.add(responseFactory.responseFromObject(company.getProfile()));
}
}

View file

@ -8,7 +8,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
import ru.spcex.clearing.backendapi.service.IOperator;

View file

@ -44,6 +44,9 @@ public class BankAccountNewAction implements IAction<BankAccountNewRequest> {
@ApiModelProperty(value = "Номер счета", example = "1234567")
@JsonProperty
private String account;
@ApiModelProperty(value = "Компания", example = "1234")
@JsonProperty
private Long companyId;
@Override
public Collection<EnumMessage> validate() {
@ -88,6 +91,7 @@ public class BankAccountNewAction implements IAction<BankAccountNewRequest> {
req.setTaxpayerIdentificationNumber(this.taxpayerIdentificationNumber);
req.setTaxRegistrationReasonCode(this.taxRegistrationReasonCode);
req.setAccount(this.account);
req.setCompanyId(this.companyId);
return req;
}

View file

@ -84,7 +84,7 @@ public class GetResponseFactory {
try {
add(r, field.getField().getCode(), field.extractValue(o));
} catch (Throwable e) {
log.warn(ExceptionUtils.getStackTrace(
log.trace(ExceptionUtils.getStackTrace(
new RuntimeException(String.format("Can't extract value for field='%s' of %s(%s): %s -> %s\n%s",
field.getField().getCode(),
o.getClass().getSimpleName(), objExtr.getClassName(),

View file

@ -54,14 +54,14 @@ public class MetaServer extends MetaBase {
try {
oe = getImplInstanceObjectExtracted(objectElement.getClazz(), objectElement.getFields());
} catch (Throwable e) {
log.warn("META SERVER >>> Класс {} для {} не найден!", objects.get(key).getClazz(), key);
log.trace("META SERVER >>> Класс {} для {} не найден!", objects.get(key).getClazz(), key);
continue;
}
objectsExtracted.add(oe);
if (oe.getClassName() != null) {
ObjectExtracted previous = objectsExtractedByClazz.put(oe.getClassName(), oe);
if (previous != null) {
log.warn("!!! meta contains duplicate classes {}", oe.getClassName());
log.trace("!!! meta contains duplicate classes {}", oe.getClassName());
}
} else
objectsExtractedByClazz.put(String.valueOf(classNameMock++), oe);
@ -181,7 +181,7 @@ public class MetaServer extends MetaBase {
}
c = RfHelper.getMetodReturnClazz(m);
} catch (OtcMetaServerGetterNotFoundException e) {
log.warn("META SERVER >>> Геттер {}.{} не найден!", o.getClassName(), getterName);
log.trace("META SERVER >>> Геттер {}.{} не найден!", o.getClassName(), getterName);
}
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
<meta version="2.4.5.0">
<meta version="2.4.0.7">
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
<!--Здесь словари-->
<enums>
@ -99,7 +99,7 @@
<code name="Код" shortname="Код" type="12"/>
<name name="Тип лимитов" shortname="Тип" type="2" length="50"/>
</balanceAccountType>
<countryCode name="Справочник кодов стран" class="com.spicex.dictionary." table="country_code_dictionary">
<countryCode name="Справочник кодов стран" class="ru.clearing.platform.dictionary.CountryCodeDictionary" table="country_code_dictionary">
<id name="Идентификатор записи" shortname="ID" type="1"/>
<code name="Код" shortname="Код" type="12"/>
<name name="Наименование" type="2" length="255"/>
@ -571,7 +571,7 @@
</put>
</actions>
</companySymbols>
<clearmemberRegister name="Реестр участников клиринга" destination="clearmember-registers" serviceProduct="MKR" table="clearmember_register">
<clearmemberRegister name="Реестр участников клиринга" destination="clearmember-registers" serviceProduct="MKR" class="ru.clearing.classes.statics.data.misc.ClearMemberRegister" table="clearmember_register">
<tradingCode type="2" length="255" name="Код участника торгов" shortname="Торговый код" searchable="true" sortable="true" visible="true"/>
<clearingCode type="2" length="255" name="Код участника клиринга" shortname="Клиринговый код" searchable="true" sortable="true" visible="true"/>
<fullName type="2" length="255" name="Полное наименование участника клиринга" shortname="Полное наименование" searchable="true" sortable="true" visible="true"/>
@ -683,7 +683,7 @@
<companyId type="1" name="Компания" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<actions>
<post name="Банковские реквизиты для перечисления денежных средств">
<post name="Банковские реквизиты для перечисления денежных средств" confirmation="currency,bankIdentificationCode,bankName,correspondentAccount,correspondentAccountName,taxpayerIdentificationNumber,taxRegistrationReasonCode,account,destination">
<currency type="12" name="Валюта" shortname="Валюта" required="true" link="currencyCode"/>
<bankIdentificationCode type="2" length="255" name="Банковский идентификационный код (БИК)" shortname="БИК" required="true"/>
<bankName type="2" length="255" name="Наименование банка" shortname="Наименование" required="true"/>
@ -693,6 +693,7 @@
<taxRegistrationReasonCode type="2" length="255" name="Код причины постановки (КПП)" shortname="КПП"/>
<account type="2" length="50" name="Номер счета" shortname="Счет" required="true"/>
<destination type="2" length="255" name="Назначение платежа" shortname="Назначение платежа" required="true"/>
<companyId type="1" name="Компания" shortname="Компания" link="company" linkCode="shortName" required="true"/>
</post>
<put name="Изменение банковских реквизитов для перечисления денежных средств">
<id type="1" name="Идентификатор записи" shortname="ID" link="bankAccount" linkCode="id" required="true"/>
@ -827,7 +828,7 @@
<createdAt field="created" type="4" name="Дата и время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
<updatedAt field="updated" type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
</accountBalance>
<balanceRegister name="Реестр остатков денежных средств" destination="balance-registers" table="balance_register">
<balanceRegister name="Реестр остатков денежных средств" destination="balance-registers" class="ru.clearing.classes.statics.data.misc.BalanceRegister" table="balance_register">
<sDf01Date type="4" name="Дата создания записи в S_DF01" shortname="Дата создания записи в S_DF01" searchable="true" sortable="true"/>
<currencyCode type="12" name="Код валюты" shortname="Валюта" link="currencyCode"/>
<setHouseName type="2" length="255" name="Наименование РО" shortname="Наименование РО" searchable="true" sortable="true" visible="true"/>
@ -893,7 +894,7 @@
<resultStatus type="12" name="Статус выгрузки документа" shortname="Статус" searchable="true" sortable="true" visible="true" link="resultStatus"/>
<id type="1" name="Идентификатор записи" shortname="№п/п" searchable="true" sortable="true"/>
</outDocumentJournal>
<executionDeposit name="Сделки" destination="execution-deposits" class="ru.clearing.classes.TransactionData.Execution.DepositExecution" table="execution_deposit">
<executionDeposit name="Сделки" destination="execution-deposits" class="ru.clearing.classes.statics.data.execution.ExecutionDeposit" table="execution_deposit">
<exchangeExecutionId type="1" name="Идентификационный номер сделки в Торговой системе" shortname="Номер сделки" visible="true" searchable="true" sortable="true"/>
<exchangeExecutionTime type="4" name="Время заключения сделки в Торговой системе" shortname="Время заключения сделки" visible="true" searchable="true" sortable="true"/>
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
@ -924,7 +925,7 @@
<updatedAt type="5" name="Время изменения сделки" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</executionDeposit>
<dealRegister name="Реестр сделок" destination="deal-registers" class="" table="deal_register">
<dealRegister name="Реестр сделок" destination="deal-registers" class="ru.clearing.classes.statics.data.register.DealRegister" table="deal_register">
<executionId type="1" name="Идентификационный номер сделки в Клиринговой системе" shortname="Номер сделки КС" visible="false" searchable="true" sortable="true"/>
<exchangeExecutionId type="1" name="Идентификационный номер сделки в Торговой системе" shortname="Номер сделки" visible="true" searchable="true" sortable="true"/>
<exchangeExecutionTime type="4" name="Время заключения сделки в Торговой системе" shortname="Время заключения сделки" visible="true" searchable="true" sortable="true"/>
@ -949,7 +950,7 @@
<updatedAt type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</dealRegister>
<admittedDealRegister name="Реестр сделок, допущенных к клирингу" destination="admitted-deal-registers" class="" table="admitted_deal_register">
<admittedDealRegister name="Реестр сделок, допущенных к клирингу" destination="admitted-deal-registers" class="ru.clearing.classes.statics.data.register.AdmittedDealRegister" table="admitted_deal_register">
<executionId type="1" name="Идентификационный номер сделки в Клиринговой системе" shortname="Номер сделки КС" visible="false" searchable="true" sortable="true"/>
<companyFullName type="2" length="255" name="Наименование биржи" shortname="Наименование биржи" searchable="true" sortable="true" visible="true"/>
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
@ -965,11 +966,11 @@
<buyerAccount type="2" length="50" name="Счет покупателя" shortname="Счет покупателя" searchable="true" sortable="true" visible="true"/>
<amount type="11" name="Сумма сделки" shortname="Сумма сделки" visible="true" searchable="true" sortable="true"/>
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
<createdAt type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<createdAt field="created" type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt field="updated" type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</admittedDealRegister>
<coveredDealRegister name="Реестр сделок, прошедших процедуру контроля обеспечения" destination="covered-deal-registers" class="" table="covered_deal_register">
<coveredDealRegister name="Реестр сделок, прошедших процедуру контроля обеспечения" destination="covered-deal-registers" class="ru.clearing.classes.statics.data.register.CoveredDealRegister" table="covered_deal_register">
<executionId type="1" name="Идентификационный номер сделки в Клиринговой системе" shortname="Номер сделки КС" visible="false" searchable="true" sortable="true"/>
<companyFullName type="2" length="255" name="Наименование биржи" shortname="Наименование биржи" searchable="true" sortable="true" visible="true"/>
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
@ -985,11 +986,11 @@
<buyerAccount type="2" length="50" name="Счет покупателя" shortname="Счет покупателя" searchable="true" sortable="true" visible="true"/>
<amount type="11" name="Сумма сделки" shortname="Сумма сделки" visible="true" searchable="true" sortable="true"/>
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
<createdAt type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<createdAt field="created" type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt field="updated" type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</coveredDealRegister>
<uncoveredDealRegister name="Реестр сделок, не прошедших процедуру контроля обеспечения" destination="uncovered-deal-registers" class="" table="uncovered_deal_register">
<uncoveredDealRegister name="Реестр сделок, не прошедших процедуру контроля обеспечения" destination="uncovered-deal-registers" class="ru.clearing.classes.statics.data.register.UncoveredDealRegister" table="uncovered_deal_register">
<executionId type="1" name="Идентификационный номер сделки в Клиринговой системе" shortname="Номер сделки КС" visible="false" searchable="true" sortable="true"/>
<companyFullName type="2" length="255" name="Наименование биржи" shortname="Наименование биржи" searchable="true" sortable="true" visible="true"/>
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
@ -1006,11 +1007,11 @@
<amount type="11" name="Сумма сделки" shortname="Сумма сделки" visible="true" searchable="true" sortable="true"/>
<resultStatus type="12" name="Результат клиринга" shortname="Результат клиринга" visible="true" searchable="true" sortable="true" link="resultStatus"/>
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
<createdAt type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<createdAt field="created" type="5" name="Время регистрации" shortname="Время регистрации" visible="false" searchable="true" sortable="true"/>
<updatedAt field="updated" type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</uncoveredDealRegister>
<reportRegister name="Реестр отправленных отчетов" destination="report-registers" class="com.moex.platform.classes.TransactionData.Execution.DepositExecution" table="report_register">
<reportRegister name="Реестр отправленных отчетов" destination="report-registers" class="ru.clearing.classes.statics.data.register.ReportRegister" table="report_register">
<companyFullName type="2" length="255" name="Наименование участника" shortname="Участник" searchable="true" sortable="true"/>
<clearingCode type="2" length="255" name="Код клиринга" shortname="Код участника" searchable="true" sortable="true"/>
<sessionId type="1" name="Сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="moneyMarketSession"/>
@ -1018,11 +1019,11 @@
<name type="2" length="255" name="Наименование" shortname="Наименование" visible="false" searchable="true" sortable="true"/>
<quantity type="1" name="Количество записей" shortname="Количество" visible="false" searchable="true" sortable="true"/>
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
<createdAt type="5" name="Время регистрации" shortname="Время" visible="true" searchable="true" sortable="true"/>
<updatedAt type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<createdAt field="created" type="5" name="Время регистрации" shortname="Время" visible="true" searchable="true" sortable="true"/>
<updatedAt field="updated" type="5" name="Время изменения" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</reportRegister>
<contractRegister name="Журнал регистрации договоров" destination="contract-registers" class="ru.clearing.classes.TransactionData.Execution.DepositExecution" table="contract_register">
<contractRegister name="Журнал регистрации договоров" destination="contract-registers" class="ru.clearing.classes.statics.data.register.ContractRegister" table="contract_register">
<name type="2" length="255" name="Наименование документа" shortname="Наименование" searchable="true" sortable="true" visible="true"/>
<number type="2" length="255" name="Номер документа" shortname="Номер" searchable="true" sortable="true" visible="true"/>
<issueDate type="6" name="Дата составления" shortname="Дата выдачи" searchable="true" sortable="true"/>
@ -1041,7 +1042,7 @@
<createdAt type="5" name="Дата и время регистрации документа" shortname="Время сделки" visible="true" searchable="true" sortable="true"/>
<updatedAt type="5" name="Время изменения сделки" shortname="Время изменения" visible="false" searchable="true" sortable="true"/>
</contractRegister>
<orderRegister name="Реестр распоряжений, направленных расчетной организации" destination="order-registers" class="ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets" table="order_register">
<orderRegister name="Реестр распоряжений, направленных расчетной организации" destination="order-registers" class="ru.clearing.classes.statics.data.register.OrderRegister" table="order_register">
<creditLegAccount type="2" lenght="50" name="Счет отправителя" shortname="Счет отправителя" searchable="true" sortable="true" visible="true"/>
<creditLegAmount type="10" name="Сумма отправителя" shortname="Сумма отправителя" searchable="true" sortable="true" visible="true"/>
<creditLegCurrencyCode type="12" name="Код валюты отправителя" shortname="Валюта отправителя" searchable="true" sortable="true" visible="true" link="currency"/>
@ -1055,7 +1056,7 @@
<updatedAt field="updated" type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
<clearingDate type="6" name="Дата расчета" shortname="Дата расчета" searchable="true" sortable="true" visible="true"/>
</orderRegister>
<liabilitiesClaimsMoney name="Требования и обязательства денежных средств" destination="liabilities-claims-money" class="ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsMoney" table="liabilities_claims_money">
<liabilitiesClaimsMoney name="Требования и обязательства денежных средств" destination="liabilities-claims-money" class="ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsMoney" table="liabilities_claims_money">
<companyId type="1" name="Наименование участника" shortname="Участник" searchable="true" sortable="true" link="company" linkCode="shortName" ignore="true"/>
<accountId type="1" name="Наименование счета" shortname="Счет" searchable="true" sortable="true" link="account" ignore="true"/>
<accountType type="12" name="Тип счета" shortname="Тип счета" searchable="true" sortable="true" link="accountType"/>
@ -1073,7 +1074,7 @@
<updatedAt field="updated" type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</liabilitiesClaimsMoney>
<liabilitiesClaimsAssets name="Требования и обязательства финансовых активов" destination="liabilities-claims-assets" class="ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets" table="liabilities_claims_assets">
<liabilitiesClaimsAssets name="Требования и обязательства финансовых активов" destination="liabilities-claims-assets" class="ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets" table="liabilities_claims_assets">
<companyId type="1" name="Наименование участника" shortname="Участник" searchable="true" sortable="true" link="company" linkCode="shortName" ignore="true"/>
<accountId type="1" name="Наименование счета" shortname="Счет" searchable="true" sortable="true" link="account" ignore="true"/>
<accountType type="12" name="Тип счета" shortname="Тип счета" searchable="true" sortable="true" link="accountType"/>
@ -1124,7 +1125,7 @@
<updatedAt field="updated" type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
<clearingDate type="6" name="Дата расчета" shortname="Дата расчета" searchable="true" sortable="true" visible="true"/>
</statement>
<tradeSettlement name="Проводки на базе сделок торговой системы" class="ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets" table="trade_settlement">
<tradeSettlement name="Проводки на базе сделок торговой системы" class="" table="trade_settlement">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<addresseeId type="1" name="Идентификатор участника получателя" shortname="Получатель" searchable="true" sortable="true" link="company"/>
<senderId type="1" name="Идентификатор участника отправителя" shortname="Отправитель" searchable="true" sortable="true" link="company"/>
@ -1138,7 +1139,7 @@
<account type="2" length="50" name="Счет" shortname="Счет" searchable="true" sortable="true"/>
<operationStatus type="12" name="Cтатус обработки" shortname="Статус" searchable="true" sortable="true" link="operationStatus"/>
</tradeSettlement>
<operation name="Проводки" class="ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets" table="operation">
<operation name="Проводки" class="" table="operation">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<addresseeId type="1" name="Идентификатор участника получателя" shortname="Получатель" searchable="true" sortable="true" link="company"/>
<senderId type="1" name="Идентификатор участника отправителя" shortname="Отправитель" searchable="true" sortable="true" link="company"/>
@ -1220,7 +1221,7 @@
<createdAt field="created" type="4" name="Создано" shortname="Создано" searchable="true" sortable="true"/>
<updatedAt field="updated" type="4" name="Изменено" shortname="Изменено" searchable="true" sortable="true"/>
</individualChargeTariff>
<companyTariff name="Тарифы комиссий в разрезе Участника" table="company_tariff">
<companyTariff name="Тарифы комиссий в разрезе Участника" class="" table="company_tariff">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<market type="12" name="Секция" shortname="Секция" searchable="true" sortable="true" link="market" visible="true"/>
<clearingMemberCategory type="12" name="Категория участника клиринга" shortname="Категория" searchable="true" sortable="true" visible="true" link="clearingCategory"/>
@ -1575,7 +1576,7 @@
<generationId type="1" name="Идентификатор взаимодействия" shortname="ID взаимодействия" searchable="true" sortable="true"/>
<inSDf12Id type="1" name="Идентификатор соответствующей записи из таблицы-источника" shortname="Входящая запись" searchable="true" sortable="true"/>
</sDf18>
<s_trade name="Сделки из Торговой системы" class="com.spicex.Static." table="s_trade">
<s_trade name="Сделки из Торговой системы" class="" table="s_trade">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<trade_num type="1" name="Номер сделки" shortname="Номер сделки" searchable="true" sortable="true"/>
<sec_code type="2" length="255" name="Код ценной бумаги" shortname="Код ценной бумаги" searchable="true" sortable="true"/>
@ -1614,7 +1615,7 @@
</put>
</actions>
</notification>
<verificationResult name="Результаты сверки" destination="verification-results" class="com.spicex.Static." table="verification_result">
<verificationResult name="Результаты сверки" destination="verification-results" class="ru.clearing.classes.statics.data.clearing.VerificationResult" table="verification_result">
<clearingCode type="2" length="255" name="Код участника клиринга" shortname="Клиринговый код" searchable="true" sortable="true" visible="true"/>
<accountId type="1" name="Счет УК, по которому проводится сверка" shortname="Счет УК" searchable="true" sortable="true"/>
<inSum type="11" name="Входящая сумма остатков" shortname="Остатки" visible="true" searchable="true" sortable="true"/>
@ -1672,112 +1673,6 @@
</set>
</AccountUnion>
</views>
<reports>
<clearedLiabilities version="0.0.1" code="0420315" name="Сведения об исполненных обязательствах, допущенных к клирингу, за отчетный период, часть 1" startDate="" endDate="dd.MM.YYYY" destination="BR" clearingMemberCategory="I,V" clearingStatus="OK">
<rows сompany_id="" company_fullName="" listing_market="" contract_qty="" liabilities_amount=""/>
</clearedLiabilities>
<clearedLiabilitiesTotal version="0.0.1" code="0420315" name="Сведения об исполненных обязательствах, допущенных к клирингу, за отчетный период, часть 2" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows contract_qty="" liabilities_amount=""/>
</clearedLiabilitiesTotal>
<clearingServiceStatus version="0.0.1" code="0420317" name="Сведения о предоставлении, прекращении, приостановке, возобновлении допуска к клиринговому обслуживанию" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows company_clearingCode="" relation_id="" relation_serviceStatus="" relation_updatedAt="" company_fullName="" companySymbol_code="" countryCode_id="" relation_comment=""/>
</clearingServiceStatus>
<unfundedLiabilities version="0.0.1" code="0420318" name="Сведения о неисполненных обязательствах" startDate="" endDate="dd.MM.YYYY" destination="BR" clearingStatus="">
<rows liabilitiesClaimsAssets_fullName="" companySymbols_code="" liabilitiesClaimsAssets_countryCode="" liabilitiesClaimsAssets_refundDate="" liabilitiesClaimsAssets_Contract="" liabilitiesClaimsMoney_currencyCode="" liabilitiesClaimsAssets_liabilitiesQuantity="" liabilitiesClaimsMoney_name="" liabilitiesClaimsAssets_liabilities="" liabilitiesClaimsAssets_comment="" companySymbols_value="" liabilitiesClaimsAssets_fullNames=""/>
</unfundedLiabilities>
<accountTransactionLiabilities version="0.0.1" code="0420314" name="Сведения об УК и операциях, проведенных по торговым счетам, часть 1" startDate="" endDate="dd.MM.YYYY" destination="BR" clearingStatus="">
<rows company_clearingCode="" profileDocument_id="" company_fullName="" companySymbols_code="" companySymbol_value="" clearingMemberCategory_clearingMemberCategory="" liabilitiesClaimsAssets_contract="" liabilitiesClaimsAssets_tradingDate="" liabilitiesClaimsAssests_liabilitiesQuantity=""/>
</accountTransactionLiabilities>
<accountTransactionTurnover version="0.0.1" code="0420314" name="Сведения об УК и операциях, проведенных по торговым счетам, часть 2 " startDate="" endDate="dd.MM.YYYY" destination="BR" transactionStatus="">
<rows company_clearingCode="" profileDocument_documentType="" accountBalance_openBalanceAmount="" paymentInstruction_creditLeg_amount="" paymentInstructiont_debitLeg_amount="" accountBalance_closeBalanceAmount=""/>
</accountTransactionTurnover>
<clearingCoverage1 version="0.0.1" code="0420312" name="Сведения о клиринговом обеспечении, часть 1" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows company_clearingCode="" company_fullName="" companySymbol_code="" companySymbol_value="" countryCode_id="" clearingMemberCategory_clearingMemberCategory=""/>
</clearingCoverage1>
<clearingCoverage2 version="0.0.1" code="0420312" name="Сведения о клиринговом обеспечении, часть 2" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilitiesClaimsAssets_companyId="" liabilitiesClaimsAssets_liabilitiesQuantity=""/>
</clearingCoverage2>
<clearingCoverage3 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 3" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilitiesClaimsAssets_companyId="" liabilitiesClaimsAssets_liabilities=""/>
</clearingCoverage3>
<clearingCoverage4 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 4" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilities_amount=""/>
</clearingCoverage4>
<clearingCoverage5 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 5" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilities_amount=""/>
</clearingCoverage5>
<clearingCoverage6 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 6" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilities_amount=""/>
</clearingCoverage6>
<clearingCoverage7 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 7" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilities_amount=""/>
</clearingCoverage7>
<clearingCoverage8 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 8" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows currency_id="" liabilitiesClaimsAssets_companyId="" liabilitiesClaimsAssets_fullName="" companySymbol_code="" companySymbol_value="" companyInfo_countryCode="" clearingMemberCategory_clearingMemberCategory=""/>
</clearingCoverage8>
<clearingCoverage9 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 9" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows currency_id="" liabilitiesClaimsAssets_companyId="" liabilitiesClaimsMoney_currencyCode="" liabilitiesClaimsAssets_liabilities=""/>
</clearingCoverage9>
<clearingCoverage10 version="0.0.5" code="0420312" name="Сведения о клиринговом обеспечении, часть 10" startDate="" endDate="dd.MM.YYYY" destination="BR">
<rows liabilities_amount=""/>
</clearingCoverage10>
<clearingCommission version="0.0.1" code="BT5" name="Расчет клиринговой комиссии по УК" startDate="" endDate="dd.MM.YYYY" destination="1С">
<documents sysname="" doc_type="" doc_ver="" doc_name="" period_from="" period_to="" doc_date="" doc_time="" author=""/>
<COM_KS_ALL ver="1.1">
<BILL part_code="" part_name="" part_inn="" part_kpp="" agreement_name="" agreement_number="" agreement_date="" bill_from="" bill_to="" bill_summ="" nds_type="" nds_rate="" nds_sum="">
<TRANSAC doc_name="" doc_date="" exec_date="" repaym_date="" pay_length="" segment="" type_finstr="" sum_transac="" sum_com="" sum_comMnds="" sum_nds=""/>
</BILL>
</COM_KS_ALL>
<CRC crc_type="" crc_value=""/>
</clearingCommission>
<netPositionInitiator version="0.0.1" code="BT12.2" name="Отчет по нетто-позиции участника клиринга в секции МКР (Вкладчик)" startDate=" dd.MM.YYYY " endDate="dd.MM.YYYY" clearingMemberCategory="I,V">
<rows id="1" liabilitiesClaimsAssets_fullName="" company_clearingCode="" liabilitiesClaimsAssets_settlementDate="" liabilitiesClaimsAssets_refundDate="" liabilitiesClaimsAssets_tradingDate="" liabilitiesClaimsAssets_contract="" liabilitiesClaimsAssets_liabilitiesQuantity="" chargeCommission="" liabilitiesClaimsAssets_ClaimsQuantity="" liabilitiesClaimsAssets_refundPaymentId="" liabilitiesClaimsAssets_clearingStatus="" liabilitiesClaimsAssets_comment=""/>
<total claimsAmount="" liabilitiesAmount="" paymentAmount=""/>
</netPositionInitiator>
<netPositionBank version="0.0.1" code="BT12.2" name="Отчет по нетто-позиции участника клиринга в секции МКР(Уполномоченный банк)" startDate=" dd.MM.YYYY " endDate="dd.MM.YYYY" clearingMemberCategory="B">
<rows id="1" liabilitiesClaimsAssets_fullName="" company_clearingCode="" liabilitiesClaimsAssets_settlementDate="" liabilitiesClaimsAssets_refundDate="" liabilitiesClaimsAssets_tradingDate="" liabilitiesClaimsAssets_contract="" liabilitiesClaimsAssets_liabilitiesQuantity="" chargeCommission="" liabilitiesClaimsAssets_ClaimsQuantity="" liabilitiesClaimsAssets_refundPaymentId="" liabilitiesClaimsAssets_clearingStatus="" liabilitiesClaimsAssets_comment=""/>
<total claimsAmount="" liabilitiesAmount="" paymentAmount=""/>
</netPositionBank>
<infoAccountBalance version="0.0.1" code="BT12.1" name="Отчет о денежных средствах Участника клиринга, находящихся на счете внутреннего учета средств Участника клиринга на клиринговом счете СПВБ" startDate=" dd.MM.YYYY " endDate="dd.MM.YYYY">
<rows company_fullName="" company_fullNameOrg="" company_clearingCode="" clearing_sessionId="" Account_accountCLRN="" Account_accountINFO="" sum_statementIn="" tradeSettlement_amount="" sum_statementOut=""/>
</infoAccountBalance>
<reportMarketData version="0.0.1" code="BT17.6" name="Формирование КС Биржевой информации по итогам торгов в секции МКР" startDate=" dd.MM.YYYY " endDate="dd.MM.YYYY">
<rows marketData_securitiesDepositId="" company_fullName="" marketData_marketId="" marketData_counterPartyNum="" marketData_tradesNum="" marketData_amount="" marketData_openPrice="" marketData_maxPrice="" marketData_minPrice="" marketData_closePrice="" marketData_avgPrice="" marketData_duration=""/>
<total marketTypeA_amount="" marketTypeT_amount="" marketSum=""/>
</reportMarketData>
<accountBalanceInfo version="0.0.1" code="BT16.5" name=" Отчет о денежных средствах на счете внутреннего учета (клиринговом регистре) Участника клиринга " date="dd.MM.YYYY" time="hh:mm.ss">
<rows id="" clearingHouse="" company_clearinCode="" company_fullName="" accountBalance_account="" accountBalance_openAmount="" accountBalance_debitAmount="" accountBalance_creditAmount="" accountBalance_closeAmount=""/>
</accountBalanceInfo>
<liabilitiesClaimsBank version="0.0.1" code="BT16.3" name="Отчет об обязательствах/требованиях (отчета о нетто-позициях) в разрезе каждого Уполномоченного банка" date="dd.MM.YYYY" time="hh:mm.ss" clearingMemberCategory="">
<rows company_clearingCode="" liabilitiesClaimsMoney_account="" liabilitiesClaimsMoney_liabilitiesAmount="" liabilitiesDate=""/>
</liabilitiesClaimsBank>
<liabilitiesClaimsSingleBank version="0.0.1" code="BT16.4" name="Отчет об обязательствах/требованиях (отчета о нетто-позициях) по соответствующему Уполномоченному банку" date="dd.MM.YYYY" time="hh:mm.ss" clearingMemberCategory="">
<rows company_clearingCode="" liabilitiesClaimsMoney_account="" liabilitiesClaimsMoney_liabilitiesAmount="" liabilitiesDate=""/>
</liabilitiesClaimsSingleBank>
<detailedClearingСommission version="0.0.1" code="BT6" name="Детализированный отчет по начисленной за месяц клиринговой комиссии (новый отчет КО)" startDate=" dd.MM.YYYY " endDate="dd.MM.YYYY" clearingMemberCategory="B">
<body>
<rows>
<row id="1" contract="" settlementDate="" tradingDate="" liabilitiesQuantity="" netCommissionAmount="" duratoin=""/>
</rows>
<total commissionAmount="" name="Итого"/>
</body>
<totalCommissions totalCommissionAmount="" name="Сумма комиссионного вознагораждения ВСЕГО"/>
</detailedClearingСommission>
<outgoingDocuments version="0.0.1" code="BT 13.12" name="Журнал Исходящих документов" date="dd.MM.YYYY" time="hh:mm.ss">
<rows id="" outDocumentJournal_registrationDate="" outDocumentJournal_registrationTime="" outDocumentJournal_registrationNumber="" outDocumentJournal_documentName="" outDocumentJournal_addresee="" outDocumentJournal_quantity="" outDocumentJournal_clearingCode="" outDocumentJournal_courierType="" outDocumentJournal_emailDate="" outDocumentJournal_Amount="" outDocumentJournal_dossierNumber="" outDocumentJournal_postDate=""/>
</outgoingDocuments>
<incomingDocuments version="0.0.1" code="BT 13.11" name="Журнал Входящих документов" date="dd.MM.YYYY" time="hh:mm.ss">
<rows id="" inDocumentJournal_registrationDate="" inDocumentJournal_registrationTime="" inDocumentJournal_registrationNumber="" inDocumentJournal_documentName="" inDocumentJournal_sender="" inDocumentJournal_quantity="" inDocumentJournal_clearingCode="" inDocumentJournal_courierType="" inDocumentJournal_emailDate="" inDocumentJournal_Amount="" inDocumentJournal_dossierNumber="" inDocumentJournal_Comment="" inDocumentJournal_receiptDate=""/>
</incomingDocuments>
<newAccountRegistry name="Уведомление об открытии нового клирингового регистра"> </newAccountRegistry>
<admissionChange name="Уведомления об изменении статуса допуска Участника клиринга к клиринговому обслуживанию"> </admissionChange>
<registrationCompany name="Уведомления о регистрации УК в Клиринговой системе"> </registrationCompany>
<newInfoAccount name="Уведомление о регистрации счета внутреннего учета на клиринговым счете АО СПВБ"> </newInfoAccount>
<changeStatus name="УК о приостановлении/ возобновлении/ прекращении допуска к клиринговому обслуживанию при изменении статуса в КС"> </changeStatus>
<XCNTdocumentREX name="Уведомление УК о расторжении Договора на оказание клиринговых услуг в случае расторжения Договора"> </XCNTdocumentREX>
<XCNTdocumentRRPC name="Уведомления об Участнике клиринга в случае расторжения Договора на оказание клиринговых услуг"> </XCNTdocumentRRPC>
<relationStatus name="Уведомления об изменении статуса допуска Участника клиринга/клиента Участника клиринга к клиринговому обслуживанию при изменении статуса в КС"> </relationStatus>
</reports>
<types>
<identity id="1" name="Идентификатор" type="bigint" javatype="Long"/>
<string id="2" name="Строка" type="varchar" javatype="String"/>

View file

@ -35,7 +35,7 @@ public class AccountBalanceService {
}
public AccountResult createAccountBalance(Long addresseeId, Long accountId, BigDecimal amount,
String cashMovementCurrencyCode) {
String cashMovementCurrencyCode) {
IValidator validator = validationFactory.apply(new AccountBalanceValidation(addresseeId, accountId));
Optional<EnumMessage> validationError = validator
.tillFirstError();
@ -66,14 +66,23 @@ public class AccountBalanceService {
return new AccountResult(accountBalance);
} else {
accountBalance.setUpdated(Instant.now());
accountBalance.setAccountId(accountId);
accountBalance.setAccountType(account.getAccountType());
accountBalance.setAccountId(accountId);//+
accountBalance.setAccountType(account.getAccountType());//++
accountBalance.setAccount(account.getAccount());
accountBalance.setOpenBalanceAmount(amount);
accountBalance.setFreeBalanceAmount(amount);
accountBalance.setBalanceAmount(amount);
// accountBalance.setOpenBalanceAmount();// на базе изменения statement по sDf16/sDf09): не меняется.
accountBalance.setFreeBalanceAmount(plus(accountBalance.getFreeBalanceAmount(), amount));
accountBalance.setChangeBalanceAmount(plus(accountBalance.getChangeBalanceAmount(), amount));
accountBalance.setCreditAmount(plus(accountBalance.getCreditAmount(), amount));
accountBalance.setDebitAmount(plus(accountBalance.getDebitAmount(), amount));
accountBalance.setBalanceAmount(plus(accountBalance.getBalanceAmount(), amount));
accountBalance.setCurrencyCode(cashMovementCurrencyCode);
return new AccountResult(accountBalance);
}
}
BigDecimal plus(BigDecimal a, BigDecimal b) {
if (a == null) return b;
if (b == null) return a;
return a.add(b);
}
}

View file

@ -51,7 +51,8 @@ public class Sdf01Executor extends AbstractExecutor<SDf01> {
IMessageResolver errorResolver) {
this.statementImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Statement, Statement.class);
this.sdf02Imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf02, SDf02.class);
this.accountBalanceImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class);;
this.accountBalanceImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class);
;
this.sDf01Validator = sDf01Validator;
this.errorLogger = errorLogger;
this.imdgProvider = imdgProvider;
@ -64,7 +65,7 @@ public class Sdf01Executor extends AbstractExecutor<SDf01> {
return "DF-02";
}
public Result execute(Collection<SDf01> sdf, StatementRequest statementRequest){
public Result execute(Collection<SDf01> sdf, StatementRequest statementRequest) {
Result result = new Result();
Long generationIdForGroup = imdgProvider.getImdgIdGenerator().nextId();
result.setGenerationId(generationIdForGroup);
@ -148,12 +149,12 @@ public class Sdf01Executor extends AbstractExecutor<SDf01> {
AccountSdfRequestPart req = new AccountSdfRequestPart();
req.setAccount(account);
req.setCompanyId(companyId);
req.setAccountType(AccountType.Clrn.getKey());
req.setSdfId(sdf01Id);
return req;
}
private SDf02 createErrorSdf02(SDf01 sdf01, EnumMessage error, Long generationIdForGroup) {
SDf02 sDf02 = new SDf02();
sDf02.setCurr_code(sdf01.getCurr_code());

View file

@ -159,6 +159,8 @@ public class Sdf16Executor extends AbstractExecutor<SDf16> {
statement.setInOutDirection(InOutDirection.in.getKey());
statement.setAmount(sdf.getSum());
statement.setCashMovementCurrencyCode(CurrencyCode.RUB.getKey());
statement.setInSDfId(sdf.getId());
statement.setInOutSDfType(InOutSDfType.type16.getKey());
statementImdg.update(statement);
}
@ -166,6 +168,7 @@ public class Sdf16Executor extends AbstractExecutor<SDf16> {
AccountSdfRequestPart req = new AccountSdfRequestPart();
req.setAccount(account);
req.setCompanyId(companyId);
req.setAccountType(AccountType.Clrn.getKey());
req.setSdfId(sdfId);
return req;
}

View file

@ -0,0 +1,93 @@
package ru.clearing.classes.statics.data.clearing;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import java.math.BigDecimal;
public class VerificationResult extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String clearingCode;
private Long accountId;
private BigDecimal inSum;
private BigDecimal outIntSum;
private BigDecimal outExtSum;
private BigDecimal diffSum;
private Long generationId;
private String generationStatus;
private String resultStatus;
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public BigDecimal getInSum() {
return inSum;
}
public void setInSum(BigDecimal inSum) {
this.inSum = inSum;
}
public BigDecimal getOutIntSum() {
return outIntSum;
}
public void setOutIntSum(BigDecimal outIntSum) {
this.outIntSum = outIntSum;
}
public BigDecimal getOutExtSum() {
return outExtSum;
}
public void setOutExtSum(BigDecimal outExtSum) {
this.outExtSum = outExtSum;
}
public BigDecimal getDiffSum() {
return diffSum;
}
public void setDiffSum(BigDecimal diffSum) {
this.diffSum = diffSum;
}
public Long getGenerationId() {
return generationId;
}
public void setGenerationId(Long generationId) {
this.generationId = generationId;
}
public String getGenerationStatus() {
return generationStatus;
}
public void setGenerationStatus(String generationStatus) {
this.generationStatus = generationStatus;
}
public String getResultStatus() {
return resultStatus;
}
public void setResultStatus(String resultStatus) {
this.resultStatus = resultStatus;
}
}

View file

@ -1,227 +1,229 @@
package ru.clearing.classes.statics.data.liabilities;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.LocalDate;
public class LiabilitiesClaimsAssets extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId;
private Long accountId;
private String accountType;
private String account;
private BigDecimal liabilitiesQuantity;
private BigDecimal claimsQuantity;
private String currency;
private LocalDate settlementDate;
private LocalDate tradingDate;
private LocalDate refundDate;
private BigDecimal price;
private Long securityId;
private String tradingCode;
private String clearingCode;
private String shortName;
private String contract;
private String comment;
private String fullName;
private Long parentId;
private Long liabilitiesClaimsMoneyId;
private Long clearingStatus;
private Long paymentId;
private Long refundPaymentId;
private LocalDate clearingDate;
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public BigDecimal getLiabilitiesQuantity() {
return liabilitiesQuantity;
}
public void setLiabilitiesQuantity(BigDecimal liabilitiesQuantity) {
this.liabilitiesQuantity = liabilitiesQuantity;
}
public BigDecimal getClaimsQuantity() {
return claimsQuantity;
}
public void setClaimsQuantity(BigDecimal claimsQuantity) {
this.claimsQuantity = claimsQuantity;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public LocalDate getSettlementDate() {
return settlementDate;
}
public void setSettlementDate(LocalDate settlementDate) {
this.settlementDate = settlementDate;
}
public LocalDate getTradingDate() {
return tradingDate;
}
public void setTradingDate(LocalDate tradingDate) {
this.tradingDate = tradingDate;
}
public LocalDate getRefundDate() {
return refundDate;
}
public void setRefundDate(LocalDate refundDate) {
this.refundDate = refundDate;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Long getSecurityId() {
return securityId;
}
public void setSecurityId(Long securityId) {
this.securityId = securityId;
}
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String tradingCode) {
this.tradingCode = tradingCode;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getContract() {
return contract;
}
public void setContract(String contract) {
this.contract = contract;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Long getLiabilitiesClaimsMoneyId() {
return liabilitiesClaimsMoneyId;
}
public void setLiabilitiesClaimsMoneyId(Long liabilitiesClaimsMoneyId) {
this.liabilitiesClaimsMoneyId = liabilitiesClaimsMoneyId;
}
public Long getClearingStatus() {
return clearingStatus;
}
public void setClearingStatus(Long clearingStatus) {
this.clearingStatus = clearingStatus;
}
public Long getPaymentId() {
return paymentId;
}
public void setPaymentId(Long paymentId) {
this.paymentId = paymentId;
}
public Long getRefundPaymentId() {
return refundPaymentId;
}
public void setRefundPaymentId(Long refundPaymentId) {
this.refundPaymentId = refundPaymentId;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}
package ru.clearing.classes.statics.data.liabilities;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
public class LiabilitiesClaimsAssets extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId;
private Instant clearingDate;
private Long accountId;
private String accountType;
private String account;
private BigDecimal liabilitiesQuantity;
private BigDecimal claimsQuantity;
private String currency;
private Instant settlementDate;
private Instant tradingDate;
private Instant refundDate;
private BigDecimal price;
private Long securityId;
private String tradingCode;
private String clearingCode;
private String shortName;
private String contract;
private String comment;
private String fullName;
private Long parentId;
private Long liabilitiesClaimsMoneyId;
private Long clearingStatus;
private Long paymentId;
private Long refundPaymentId;
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long value) {
this.companyId = value;
}
public Instant getClearingDate() {
return clearingDate;
}
public void setClearingDate(Instant value) {
this.clearingDate = value;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long value) {
this.accountId = value;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String value) {
this.accountType = value;
}
public String getAccount() {
return account;
}
public void setAccount(String value) {
this.account = value;
}
public BigDecimal getLiabilitiesQuantity() {
return liabilitiesQuantity;
}
public void setLiabilitiesQuantity(BigDecimal value) {
this.liabilitiesQuantity = value;
}
public BigDecimal getClaimsQuantity() {
return claimsQuantity;
}
public void setClaimsQuantity(BigDecimal value) {
this.claimsQuantity = value;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String value) {
this.currency = value;
}
public Instant getSettlementDate() {
return settlementDate;
}
public void setSettlementDate(Instant value) {
this.settlementDate = value;
}
public Instant getTradingDate() {
return tradingDate;
}
public void setTradingDate(Instant value) {
this.tradingDate = value;
}
public Instant getRefundDate() {
return refundDate;
}
public void setRefundDate(Instant value) {
this.refundDate = value;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal value) {
this.price = value;
}
public Long getSecurityId() {
return securityId;
}
public void setSecurityId(Long value) {
this.securityId = value;
}
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String value) {
this.tradingCode = value;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String value) {
this.clearingCode = value;
}
public String getShortName() {
return shortName;
}
public void setShortName(String value) {
this.shortName = value;
}
public String getContract() {
return contract;
}
public void setContract(String value) {
this.contract = value;
}
public String getComment() {
return comment;
}
public void setComment(String value) {
this.comment = value;
}
public String getFullName() {
return fullName;
}
public void setFullName(String value) {
this.fullName = value;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long value) {
this.parentId = value;
}
public Long getLiabilitiesClaimsMoneyId() {
return liabilitiesClaimsMoneyId;
}
public void setLiabilitiesClaimsMoneyId(Long value) {
this.liabilitiesClaimsMoneyId = value;
}
public Long getClearingStatus() {
return clearingStatus;
}
public void setClearingStatus(Long value) {
this.clearingStatus = value;
}
public Long getPaymentId() {
return paymentId;
}
public void setPaymentId(Long value) {
this.paymentId = value;
}
public Long getRefundPaymentId() {
return refundPaymentId;
}
public void setRefundPaymentId(Long value) {
this.refundPaymentId = value;
}
}

View file

@ -1,229 +0,0 @@
package ru.clearing.classes.transaction.data.execution;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
public class LiabilitiesClaimsAssets extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId;
private Instant clearingDate;
private Long accountId;
private String accountType;
private String account;
private BigDecimal liabilitiesQuantity;
private BigDecimal claimsQuantity;
private String currency;
private Instant settlementDate;
private Instant tradingDate;
private Instant refundDate;
private BigDecimal price;
private Long securityId;
private String tradingCode;
private String clearingCode;
private String shortName;
private String contract;
private String comment;
private String fullName;
private Long parentId;
private Long liabilitiesClaimsMoneyId;
private Long clearingStatus;
private Long paymentId;
private Long refundPaymentId;
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long value) {
this.companyId = value;
}
public Instant getClearingDate() {
return clearingDate;
}
public void setClearingDate(Instant value) {
this.clearingDate = value;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long value) {
this.accountId = value;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String value) {
this.accountType = value;
}
public String getAccount() {
return account;
}
public void setAccount(String value) {
this.account = value;
}
public BigDecimal getLiabilitiesQuantity() {
return liabilitiesQuantity;
}
public void setLiabilitiesQuantity(BigDecimal value) {
this.liabilitiesQuantity = value;
}
public BigDecimal getClaimsQuantity() {
return claimsQuantity;
}
public void setClaimsQuantity(BigDecimal value) {
this.claimsQuantity = value;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String value) {
this.currency = value;
}
public Instant getSettlementDate() {
return settlementDate;
}
public void setSettlementDate(Instant value) {
this.settlementDate = value;
}
public Instant getTradingDate() {
return tradingDate;
}
public void setTradingDate(Instant value) {
this.tradingDate = value;
}
public Instant getRefundDate() {
return refundDate;
}
public void setRefundDate(Instant value) {
this.refundDate = value;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal value) {
this.price = value;
}
public Long getSecurityId() {
return securityId;
}
public void setSecurityId(Long value) {
this.securityId = value;
}
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String value) {
this.tradingCode = value;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String value) {
this.clearingCode = value;
}
public String getShortName() {
return shortName;
}
public void setShortName(String value) {
this.shortName = value;
}
public String getContract() {
return contract;
}
public void setContract(String value) {
this.contract = value;
}
public String getComment() {
return comment;
}
public void setComment(String value) {
this.comment = value;
}
public String getFullName() {
return fullName;
}
public void setFullName(String value) {
this.fullName = value;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long value) {
this.parentId = value;
}
public Long getLiabilitiesClaimsMoneyId() {
return liabilitiesClaimsMoneyId;
}
public void setLiabilitiesClaimsMoneyId(Long value) {
this.liabilitiesClaimsMoneyId = value;
}
public Long getClearingStatus() {
return clearingStatus;
}
public void setClearingStatus(Long value) {
this.clearingStatus = value;
}
public Long getPaymentId() {
return paymentId;
}
public void setPaymentId(Long value) {
this.paymentId = value;
}
public Long getRefundPaymentId() {
return refundPaymentId;
}
public void setRefundPaymentId(Long value) {
this.refundPaymentId = value;
}
}

View file

@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import ru.spcex.platform.utils.log.ExceptionUtils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -29,20 +30,38 @@ public class ClearingService implements DisposableBean {
this.executor = Executors.newSingleThreadExecutor();
}
@Scheduled(cron = "${clearing-service.scheduler.check-payment-instruction}")
// @Scheduled(cron = "${clearing-service.scheduler.check-payment-instruction}")
public void sdfCreate() {
log.info("creating sdf03/11 from STLD payments task added to queue");
executor.execute(sdfCreator::createSdfFromPaymentInstructionSTLD);
executor.execute(() -> {
try {
sdfCreator.createSdfFromPaymentInstructionSTLD();
} catch (Throwable e) {
log.error("{}", ExceptionUtils.getStackTrace(e));
}
});
}
public void paymentUpdateBySdf04(Long sdf04GroupId) {
log.info("updating payment.transactionStatus by sdf04 task added to queue");
executor.execute(() -> paymentUpdater.updatePayments(sdf04GroupId));
executor.execute(() -> {
try {
paymentUpdater.updatePayments(sdf04GroupId);
} catch (Throwable e) {
log.error("{}", ExceptionUtils.getStackTrace(e));
}
});
}
public void executeVerification() {
log.info("execute verification");
executor.execute(() -> verificationResultComponent.executeRevision());
executor.execute(() -> {
try {
verificationResultComponent.executeRevision();
} catch (Throwable e) {
log.error("{}", ExceptionUtils.getStackTrace(e));
}
});
}
@Override

View file

@ -1,5 +1,7 @@
package ru.spcex.clearing.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
@ -18,14 +20,12 @@ import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgId;
import ru.spcex.platform.imdg.api.ImdgProvider;
import java.util.AbstractMap;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class SdfCreatorBySTLDPayment {
private Logger log = LoggerFactory.getLogger(getClass());
private final Imdg<PaymentInstruction> paymentImdgs;
private final ImdgId idGenerator;
private final PaymentInstructionSorter senderGroupSorter;
@ -48,10 +48,12 @@ public class SdfCreatorBySTLDPayment {
//generationId для созадаваемых Sdf03/Sdf11
Long generationId = idGenerator.nextId();
//выгружаем PaymentInstructions с нужным статусом
Map<Long, PaymentBatchInfo> paymentBySender = paymentImdgs.getCollectionObjectsByFieldValues(
Map.of("transactionStatus", TransactionStatus.stld.getKey()))
.stream()
//группируем по компаниям (fixme sorted убрать?)
Collection<PaymentInstruction> paymentInstructionFound = paymentImdgs.getCollectionObjectsByFieldValues(
Map.of("transactionStatus", TransactionStatus.stld.getKey()));
log.info("Found {} PaymentInstruction by status {}", paymentInstructionFound.size(), TransactionStatus.stld.getKey());
List<AbstractMap.SimpleEntry<Long, PaymentBatchInfo>> paymentBySenderLst = new ArrayList<>();
paymentInstructionFound.stream()
//группируем по компаниям
.sorted(Comparator.comparing(PaymentInstruction::getSenderId))
.collect(Collectors.groupingBy(PaymentInstruction::getSenderId))
.entrySet()
@ -59,23 +61,25 @@ public class SdfCreatorBySTLDPayment {
//результатом работы senderGroupSorter будет Map<senderId -> PaymentBatchInfo>
//PaymentBatchInfo содержит возможную ошибку, при необходимости отсортированные Payment
//тип ClearingMemberCategory
.map(entry -> {
.forEachOrdered(entry -> {
Long senderId = entry.getKey();
List<PaymentInstruction> pmtInstrcs = entry.getValue();
PaymentBatchInfo senderInfo = senderGroupSorter.sortCompanyPayments(generationId, senderId, pmtInstrcs);
if (senderInfo.getError() != null) {
anyError[0] = true;
List<PaymentBatchInfo> senderInfos = senderGroupSorter.sortCompanyPayments(generationId, senderId, pmtInstrcs);
for (PaymentBatchInfo senderInfo:senderInfos) {
if (senderInfo.getError() != null) {
anyError[0] = true;
}
paymentBySenderLst.add(new AbstractMap.SimpleEntry<>(senderId, senderInfo));
}
return new AbstractMap.SimpleEntry<>(senderId, senderInfo);
})
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
});
//save SDF03/SDF11
for (var entry : paymentBySender.entrySet()) {
log.debug("Sending save {} sdf03/sdf11", paymentBySenderLst.size());
for (var entry : paymentBySenderLst) {
PaymentBatchInfo senderPayments = entry.getValue();
saveSdfAnSendToKafka(senderPayments, generationId);
}
//update PaymentInstruction.transactionStatus
for (var entry : paymentBySender.entrySet()) {
for (var entry : paymentBySenderLst) {
PaymentBatchInfo batch = entry.getValue();
//все PaymentInstruction.transactionStatus в batch с error != null
//уже проапдейтились в методе sortCompanyPayments
@ -94,19 +98,21 @@ public class SdfCreatorBySTLDPayment {
private void saveSdfAnSendToKafka(PaymentBatchInfo batch, Long generationId) {
SdfClearingRequest kafkaMessage = new SdfClearingRequest();
kafkaMessage.setGroupId(generationId);
Long requestId = null;
switch (batch.getCategoryD()) {
case I -> {
batch.getOrderedPaymentInstructions()
.map(paymentInstruction -> Sdf03Builder.buildSdf03(paymentInstruction, generationId))
.forEach(sdf03Imdg::insert);
kafkaSender.sendRequestToQueue(Consts.SDF03_PROCESS, kafkaMessage);
requestId = kafkaSender.sendRequestToQueue(Consts.SDF03_PROCESS, kafkaMessage);
}
case B -> {
batch.getOrderedPaymentInstructions()
.map(paymentInstruction -> Sdf11Builder.buildSdf11(paymentInstruction, generationId))
.forEach(sdf11Imdg::insert);
kafkaSender.sendRequestToQueue(Consts.SDF11_PROCESS, kafkaMessage);
requestId = kafkaSender.sendRequestToQueue(Consts.SDF11_PROCESS, kafkaMessage);
}
}
log.debug("Send to kafka command, CategoryD={}, requestId={}", batch.getCategoryD(), requestId);
}
}

View file

@ -11,6 +11,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import ru.clearing.classes.objects.BusinessObject;
import ru.clearing.classes.statics.data.account.Account;
import ru.clearing.classes.statics.data.clearing.VerificationResult;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.sdf.SDf01;
import ru.clearing.classes.statics.data.account.AccountBalance;
import ru.clearing.classes.statics.data.sdf.SDf03;
@ -19,9 +21,13 @@ import ru.spcex.platform.classes.base.interfaces.WithId;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.ResultStatuses;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgId;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.utils.log.ExceptionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -34,57 +40,132 @@ import java.util.stream.Collectors;
public class VerificationResultComponent {
private final Logger log = LoggerFactory.getLogger(getClass());
// private final ImdgProvider imdgProvider;
private final ImdgProvider imdgProvider;
private Imdg<SDf01> sdf01Imdg;
private Imdg<AccountBalance> accountBalanceImdg;
private Imdg<Account> accountImdg;
private Imdg<Company> companyImdg;
private ImdgId idGenerator;
private Imdg<VerificationResult> verificationResultImdg;
@Autowired
public VerificationResultComponent(ImdgProvider imdgProvider
) {
// this.imdgProvider = imdgProvider;
public VerificationResultComponent(ImdgProvider imdgProvider) {
this.imdgProvider = imdgProvider;
this.sdf01Imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf01, SDf01.class);
this.accountBalanceImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class);
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
//this.idGenerator = imdgProvider.getImdgIdGenerator();
this.idGenerator = imdgProvider.getImdgIdGenerator();
this.verificationResultImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_VerificationResult, VerificationResult.class);
//this.kafkaSender = KafkaSender kafkaSender
}
protected void executeRevision() {
log.debug("Prepare verification, get data...");
Collection<SDf01> allSDf01 = sdf01Imdg.getAllValues();
Collection<AccountBalance> allAccountBalance = accountBalanceImdg.getAllValues();
Collection<Account> allAccount = accountImdg.getAllValues();
log.debug("Execute verification.");
executeRevision(allSDf01, allAccountBalance, allAccount);
//todo результат logic... см. как было в корпе?
log.debug("All verification was done.");
}
protected void executeRevision(Collection<SDf01> allSDf01, Collection<AccountBalance> allAccountBalance, Collection<Account> allAccount) {
// 1. Сумму по остаткам
List<Object/*verificationResult*/> vResLst = new ArrayList<>();
/* todo use:
<verificationResult name="Результаты сверки" destination="verification-results" class="com.spicex.Static." table="verification_result">
<clearingCode type="2" length="255" name="Код участника клиринга" shortname="Клиринговый код" searchable="true" sortable="true" visible="true"/>
<accountId type="1" name="Счет УК, по которому проводится сверка" shortname="Счет УК" searchable="true" sortable="true"/>
<inSum type="11" name="Входящая сумма остатков" shortname="Остатки" visible="true" searchable="true" sortable="true"/>
<outIntSum type="11" name="Исходящая сумма остатков, полученная в КС" shortname="Остатки, полученные в КС" visible="true" searchable="true" sortable="true"/>
<outExtSum type="11" name="Исходящая сумма остатков из отчета ПРЦ" shortname="Остатки, полученные из ПРЦ" visible="true" searchable="true" sortable="true"/>
<diffSum type="11" name="Сумма расхождений" shortname="Сумма расхождений" visible="true" searchable="true" sortable="true"/>
<generationId type="1" name="Идентификатор взаимодействия" shortname="ID взаимодействия" searchable="true" sortable="true"/>
<generationStatus type="12" name="Общий статус сверки" shortname="Статус" searchable="true" sortable="true" visible="true" link="resultStatus"/>
<resultStatus type="12" name="Статус сверки" shortname="Статус" searchable="true" sortable="true" visible="true" link="resultStatus"/>
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<createdAt type="4" name="Дата и время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
<updatedAt type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
</verificationResult>
*/
List<VerificationResult> vResLst = new ArrayList<>();
Map<Long, List<AccountBalance>> companyAccountBalance = indexList(allAccountBalance, AccountBalance::getCompanyId);
Map<Long, List<Account>> companyAccount = indexList(allAccount, Account::getCompanyId);
Map<Long, List<SDf01>> companySDf01;
{
Map<String, Long> indexCompanyIdByAccount = new HashMap<>();
for (Account account : allAccount) {
if (account.getAccount() != null && account.getCompanyId() != null) {
indexCompanyIdByAccount.put(account.getAccount(), account.getCompanyId());
}
}
companySDf01 = indexList(allSDf01, sDf01 -> indexCompanyIdByAccount.get(sDf01.getAccount()));
}
Set<Long> allPresentCompanyId = new HashSet<>();
allPresentCompanyId.addAll(companyAccountBalance.keySet());
allPresentCompanyId.addAll(companyAccount.keySet());
allPresentCompanyId.addAll(companySDf01.keySet());
log.info("Found {} AccountBalance, {} Account, {} SDf01 for {} companyId's.",
allAccountBalance.size(), allAccount.size(), allSDf01.size(), allPresentCompanyId.size());
for (Long companyId : allPresentCompanyId) {
Company company = companyImdg.getSingleObjectByID(companyId);
if (company == null) {
log.warn("Company {} not found! Ignore verification for this.", companyId);
continue;
}
List<AccountBalance> localCompanyAccountBalance = companyAccountBalance.get(companyId);
List<Account> localCompanyAccount = companyAccount.get(companyId);
List<SDf01> localCompanySDf01 = companySDf01.get(companyId);
if (localCompanyAccountBalance == null) localCompanyAccountBalance = new ArrayList<>();
if (localCompanyAccount == null) localCompanyAccount = new ArrayList<>();
if (localCompanySDf01 == null) localCompanySDf01 = new ArrayList<>();
log.debug("Verification company[{}] with {} AccountBalance, {} Account, {} SDf01.",
companyId, localCompanyAccountBalance.size(), localCompanyAccount.size(),
localCompanySDf01.size());
try {
List<VerificationResult> result = checkOnCompany(company,
localCompanySDf01, localCompanyAccountBalance, localCompanyAccount);
log.trace("For company {} get {} ResultStatuses record", companyId, result.size());
for (VerificationResult rItem : result) {
verificationResultImdg.insert(rItem);
}
vResLst.addAll(result);
} catch (Exception e) {
log.error("Error verification for company {}: {}",
companyId, ExceptionUtils.getStackTrace(e));
}
}
boolean allSuccess = vResLst.stream().allMatch(vr -> ResultStatuses.success.equalsByKey(vr.getGenerationStatus()));
log.debug("Total {} VerificationResult created. {}", vResLst.size(), allSuccess ? "All success." : "Has same mismatch data.");
}
/**
* @param forCompany
* @param accountId Account.id by Account.account
* @return new
*/
VerificationResult newVerification(Instant now, Company forCompany, Long accountId) {
VerificationResult vResult = new VerificationResult();
vResult.setId(idGenerator.nextId()); // imdg
if (now == null) {
now = Instant.now();
}
vResult.setCreated(now);
if (forCompany != null) {
vResult.setClearingCode(forCompany.getClearingCode());
}
if (accountId != null) {
vResult.setAccountId(accountId); // accountId bigint = Из accountBalance.account
}
return vResult;
}
protected List<VerificationResult> checkOnCompany(Company forCompany, Collection<SDf01> allSDf01,
Collection<AccountBalance> allAccountBalance,
Collection<Account> allAccount) {
final ArrayList<VerificationResult> checks = new ArrayList<>();
final Instant now = Instant.now();
Map<String, Long> indexAccountIdByAccount = new HashMap<>();
for (Account account : allAccount) {
if (account.getAccount() != null) {
indexAccountIdByAccount.put(account.getAccount(), account.getCompanyId());
}
}
{ // 1.70 verificationResult
Map<String, SDf01> indexSDf01 = index(allSDf01, SDf01::getAccount);
for (AccountBalance account : allAccountBalance) {
VerificationResult vResult = new VerificationResult();
vResult.setAccountId(account.getAccountId());
VerificationResult vResult = newVerification(now, forCompany, indexAccountIdByAccount.get(account.getAccount()));
checks.add(vResult);
SDf01 document = indexSDf01.get(account.getAccount());
if (document == null) {
@ -100,9 +181,14 @@ public class VerificationResultComponent {
}
}
BigDecimal balance = account.getCloseBalanceAmount() == null ? BigDecimal.ZERO : account.getCloseBalanceAmount();
//todo сравнить правильно, remainder там без точек. remainder==balance
BigDecimal diff = balance.subtract(remainder).abs();
// сравнить remainder==balance
BigDecimal diff = balance.subtract(remainder).setScale(2, RoundingMode.HALF_UP).abs();
vResult.setDiffSum(diff);
vResult.setInSum(account.getOpenBalanceAmount());
vResult.setOutIntSum(account.getCloseBalanceAmount());
vResult.setOutExtSum(remainder);
//todo похоже надо группировку по String account сделать, сверить с ТЗ.
log.trace("company[{}] AccountBalance[{}] diff = {}", forCompany.getId(), account.getId(), diff);
if (BigDecimal.ZERO.compareTo(diff) == 0) {
vResult.setResultStatus(ResultStatuses.success.getKey());
} else {
@ -115,7 +201,6 @@ public class VerificationResultComponent {
// 2.1 Номера торговых/клиринговых счетов, соответствующие загруженным в КС
// -sDf01.deal = account.account & accountType=CLRN & accountStatus=UNBL
{
// Map<String, SDf01> indexSDf01 = index(allSDf01, SDf01::getDeal);
Set<String> sDf01Keys = allSDf01.stream()
.filter(sdf01 -> sdf01.getDeal() != null)
.map(sdf01 -> sdf01.getDeal())
@ -126,35 +211,46 @@ public class VerificationResultComponent {
.collect(Collectors.toSet());
boolean isOk = sDf01Keys.size() == accountKeys.size() &&
sDf01Keys.containsAll(accountKeys) && accountKeys.containsAll(sDf01Keys);
// for (Account account:allAccount) {
// if (AccountType.Clrn.equalsByKey(account.getAccountType()) & "UNBL".equals(account.getAccountStatus())) {
// // todo use enum/const ?
// SDf01 document = indexSDf01.get(account.getAccount());
// if (document == null) {
// //todo найдено несоответствие.
// } else {
// }
// }
// }
VerificationResult vResult = newVerification(now, forCompany, null);
checks.add(vResult);
if (isOk) {
vResult.setResultStatus(ResultStatuses.success.getKey());
} else {
vResult.setResultStatus(ResultStatuses.notSuccess.getKey());
}
log.trace("Control summ 1, count: sDf01Keys={}, accountKeys={}; check result:{}",
sDf01Keys.size(), accountKeys.size(), vResult.getResultStatus());
}
// 2.2 Количество торговых/клиринговых счетов, соответствующие загруженным в КС - COUNT[sDf01.deal] = COUNT [account.account]
{
long countSDf01 = allSDf01.stream().filter(sDf01 -> sDf01.getDeal() != null).count();
long countAccount = allAccount.stream().filter(account -> account.getAccount() != null).count();
log.info("countSDf01={}, countAccount={}", countSDf01 ,countAccount);
//todo countSDf01 != countAccount
boolean isOk = countSDf01 == countAccount;
VerificationResult vResult = newVerification(now, forCompany, null);
checks.add(vResult);
if (isOk) {
vResult.setResultStatus(ResultStatuses.success.getKey());
} else {
vResult.setResultStatus(ResultStatuses.notSuccess.getKey());
}
log.trace("countSDf01={}, countAccount={}, result: {}",
countSDf01, countAccount, vResult.getResultStatus());
}
// 2.3 Суммарный остаток по счетам
{
//todo не понял условия [sDf01.account = accountBalance.account]
long summSDf01 = 0;
Map<String, BigDecimal> summOfSDf01 = new HashMap<>();
for (SDf01 document : allSDf01) {
if (StringUtils.isEmpty(document.getRemainder())) {
try {
long value = Long.parseLong(document.getRemainder());
summSDf01 += value;
String account = document.getAccount();
BigDecimal value = new BigDecimal(document.getRemainder());
BigDecimal a = summOfSDf01.get(account);
if (a == null) a = BigDecimal.ZERO;
a = a.add(value);
summOfSDf01.put(account, a);
} catch (NumberFormatException nfe) {
log.warn("SDf01[{}].remainder=\"{}\" is not parseable: {}",
document.getId(), document.getRemainder(), nfe.getMessage());
@ -163,41 +259,58 @@ public class VerificationResultComponent {
log.debug("SDf01[{}].remainder is null or empty", document.getId());
}
}
long summAccount = 0;
Map<String, BigDecimal> summOfAccountBalance = new HashMap<>();
for (AccountBalance account : allAccountBalance) {
if (account.getCloseBalanceAmount() != null) {
long value = account.getCloseBalanceAmount().longValue();
summAccount += value;
String accountKey = account.getAccount();
BigDecimal value = account.getCloseBalanceAmount();
;
BigDecimal a = summOfAccountBalance.get(accountKey);
if (a == null) a = BigDecimal.ZERO;
a = a.add(value);
summOfAccountBalance.put(accountKey, a);
}
}
// todo summSDf01==summAccount теперь с точностью и погрешностью сравнений проблема.
// summSDf01==summAccount
Set<String> allAccountStr = new HashSet<>();
allAccountStr.addAll(summOfSDf01.keySet());
allAccountStr.addAll(summOfAccountBalance.keySet());
for (String account : allAccountStr) {
BigDecimal fromBalance = summOfAccountBalance.get(account);
BigDecimal fromSDf01 = summOfSDf01.get(account);
if (fromBalance == null)
fromBalance = BigDecimal.ZERO;
else
fromBalance = fromBalance.setScale(2, RoundingMode.HALF_UP);
if (fromSDf01 == null)
fromSDf01 = BigDecimal.ZERO;
else
fromSDf01 = fromSDf01.setScale(2, RoundingMode.HALF_UP);
BigDecimal diff = fromBalance.subtract(fromSDf01).setScale(2, RoundingMode.HALF_UP).abs();
VerificationResult vResult = newVerification(now, forCompany, indexAccountIdByAccount.get(account));
checks.add(vResult);
if (BigDecimal.ZERO.compareTo(diff) == 0) {
vResult.setResultStatus(ResultStatuses.success.getKey());
} else {
vResult.setResultStatus(ResultStatuses.notSuccess.getKey());
}
vResult.setDiffSum(diff);
vResult.setOutExtSum(fromSDf01);
log.trace("for company[{}], account \"{}\" summ of fromSDf01={}, of fromBalance={}; result {}",
forCompany.getId(), account, fromSDf01, fromBalance, vResult.getResultStatus());
}
}
// 3. Сверка остатков по клиринговым счетам СПВБ
{
//todo не понял [sDf01.account = accountBalance.account & accountType=INFO]
}
boolean hasMissmatch = checks.stream()
.anyMatch(check -> ResultStatuses.notSuccess.equalsByKey(check.getResultStatus()));
final String finalStatus = hasMissmatch ? ResultStatuses.notSuccess.getKey() : ResultStatuses.success.getKey();
log.trace("For company {} set GenerationStatus = {}", forCompany.getId(), finalStatus);
for (VerificationResult check : checks) check.setGenerationStatus(finalStatus);
return checks;
}
protected void onSuccessRevisionResult() {
//todo 17.1 - Сообщение пользователю об успешной сверке
}
protected void onDetectDiffRevisionResult() {
//todo 17.2 - Сообщение пользователю в случае выявления расхождений
}
/*
Сумму по остаткам в бизнес-объекте accountBalance - sDf01.remainder = accountBalance.closeBalanceAmount [sDf01.account = accountBalance.account]
2. Расчет контрольных сумм:
2.1 Номера торговых/клиринговых счетов, соответствующие загруженным в КС -sDf01.deal = account.account & accountType=CLRN & accountStatus=UNBL
2.2 Количество торговых/клиринговых счетов, соответствующие загруженным в КС - COUNT[sDf01.deal] = COUNT [account.account]
2.3 Суммарный остаток по счетам - sDf01.remainder = accountBalance.closeBalanceAmount[sDf01.account = accountBalance.account]
3. Сверка остатков по клиринговым счетам СПВБ в бизнес-объекте accountBalance - sDf01.remainder = accountBalance.closeBalanceAmount [sDf01.account = accountBalance.account & accountType=INFO]
*/
<K, V extends WithId> Map<K, V> index(Collection<V> from, Function<V, K> indexFieldExtractor) {
Map<K, V> index = new HashMap<>();
for (V obj : from) {
@ -211,89 +324,14 @@ public class VerificationResultComponent {
return index;
}
//todo to classes: VerificationResult!
static class VerificationResult extends BusinessObject {
private String clearingCode; // type="2"
private Long accountId; // type="1"
private BigDecimal inSum; // type="11"
private BigDecimal outIntSum; // type="11"
private BigDecimal outExtSum; // type="11"
private BigDecimal diffSum; // type="11"
private Long generationId; // type="1"
private String generationStatus; // type="12"
private String resultStatus; // type="12"
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public BigDecimal getInSum() {
return inSum;
}
public void setInSum(BigDecimal inSum) {
this.inSum = inSum;
}
public BigDecimal getOutIntSum() {
return outIntSum;
}
public void setOutIntSum(BigDecimal outIntSum) {
this.outIntSum = outIntSum;
}
public BigDecimal getOutExtSum() {
return outExtSum;
}
public void setOutExtSum(BigDecimal outExtSum) {
this.outExtSum = outExtSum;
}
public BigDecimal getDiffSum() {
return diffSum;
}
public void setDiffSum(BigDecimal diffSum) {
this.diffSum = diffSum;
}
public Long getGenerationId() {
return generationId;
}
public void setGenerationId(Long generationId) {
this.generationId = generationId;
}
public String getGenerationStatus() {
return generationStatus;
}
public void setGenerationStatus(String generationStatus) {
this.generationStatus = generationStatus;
}
public String getResultStatus() {
return resultStatus;
}
public void setResultStatus(String resultStatus) {
this.resultStatus = resultStatus;
public static <K, V extends WithId> Map<K, List<V>> indexList(Collection<V> from, Function<V, K> indexFieldExtractor) {
Map<K, List<V>> index = new HashMap<>();
for (V obj : from) {
K key = indexFieldExtractor.apply(obj);
List<V> lst = index.computeIfAbsent(key, (_key_) -> new ArrayList<>());
lst.add(obj);
}
return index;
}
}

View file

@ -19,9 +19,11 @@ import ru.spcex.platform.utils.enumeration.IEnumKey;
import ru.spcex.platform.utils.enumeration.IMessageResolver;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Component
public class PaymentInstructionSorter {
@ -40,56 +42,62 @@ public class PaymentInstructionSorter {
this.messageResolver = messageResolver;
}
public PaymentBatchInfo sortCompanyPayments(Long generationId, Long senderId, List<PaymentInstruction> payments) {
PaymentBatchInfo batchInfo = new PaymentBatchInfo();
public List<PaymentBatchInfo> sortCompanyPayments(Long generationId, Long senderId, List<PaymentInstruction> payments) {
List<PaymentBatchInfo> result = new ArrayList<>(2);
log.info("processing PaymentInstruction's generationId={} senderId={} size={}", generationId, senderId, payments.size());
ClearingMemberCategory category = clrngMmbrImdg.getSingleObjectByFieldValues(Map.of("companyId", senderId));
ClearingMemberCategoryD categoryValue = IEnumKey.getEnumByKey(ClearingMemberCategoryD.class, category.getClearingMemberCategory());
batchInfo.setCategoryD(categoryValue);
if (ClearingMemberCategoryD.I.equals(categoryValue)) {
EnumMessage error = null;
List<PaymentInstruction> aList = new ArrayList<>();
List<PaymentInstruction> bList = new ArrayList<>();
for (PaymentInstruction payment : payments) {
Account creditLegAcc = accImdg.getSingleObjectByID(payment.getCreditLegAccountId());
Account debitLegAcc = accImdg.getSingleObjectByID(payment.getDebitLegAccountId());
if (creditLegAcc == null || debitLegAcc == null) {
String message = String.format("cannot find account CreditLegAccountId/DebitLegAccountId %d/%d", payment.getCreditLegAccountId(), payment.getDebitLegAccountId());
log.error("generationId={}, senderId={} payment.id={} {}",
generationId, senderId, payment.getId(), message);
continue;
Collection<ClearingMemberCategory> cmcList = clrngMmbrImdg.getCollectionObjectsByFieldValues(Map.of("companyId", senderId));
Collection<ClearingMemberCategoryD> companyCategory = cmcList.stream()
.filter(cat -> cat.getClearingMemberCategory() != null)
.map(cat -> IEnumKey.getEnumByKey(ClearingMemberCategoryD.class, cat.getClearingMemberCategory()))
.collect(Collectors.toSet());
for (ClearingMemberCategoryD categoryValue : companyCategory) {
log.debug("For category {}", categoryValue);
PaymentBatchInfo batchInfo = new PaymentBatchInfo();
batchInfo.setCategoryD(categoryValue);
if (ClearingMemberCategoryD.I.equals(categoryValue)) {
EnumMessage error = null;
List<PaymentInstruction> aList = new ArrayList<>();
List<PaymentInstruction> bList = new ArrayList<>();
for (PaymentInstruction payment : payments) {
Account creditLegAcc = accImdg.getSingleObjectByID(payment.getCreditLegAccountId());
Account debitLegAcc = accImdg.getSingleObjectByID(payment.getDebitLegAccountId());
if (creditLegAcc == null || debitLegAcc == null) {
String message = String.format("cannot find account CreditLegAccountId/DebitLegAccountId %d/%d", payment.getCreditLegAccountId(), payment.getDebitLegAccountId());
log.error("generationId={}, senderId={} payment.id={} {}",
generationId, senderId, payment.getId(), message);
continue;
}
if (AccountType.Clrn.equalsByKey(creditLegAcc.getAccountType())
&& AccountType.Bank.equalsByKey(debitLegAcc.getAccountType())) {
aList.add(payment);
} else if (AccountType.Bank.equalsByKey(creditLegAcc.getAccountType())
&& AccountType.Clrn.equalsByKey(debitLegAcc.getAccountType())) {
bList.add(payment);
} else {
String message = String.format("cannot sort creditLegAccount.type=%s, debitLegAccount.type=%s", creditLegAcc.getAccountType(), debitLegAcc.getAccountType());
log.error("generationId={}, senderId={} payment.id={} {}",
generationId, senderId, payment.getId(), message);
//continue;
}
}
if (AccountType.Clrn.equalsByKey(creditLegAcc.getAccountType())
&& AccountType.Bank.equalsByKey(debitLegAcc.getAccountType())) {
aList.add(payment);
} else if (AccountType.Bank.equalsByKey(creditLegAcc.getAccountType())
&& AccountType.Clrn.equalsByKey(debitLegAcc.getAccountType())) {
bList.add(payment);
} else {
String message = String.format("cannot sort creditLegAccount.type=%s, debitLegAccount.type=%s", creditLegAcc.getAccountType(), debitLegAcc.getAccountType());
log.error("generationId={}, senderId={} payment.id={} {}",
generationId, senderId, payment.getId(), message);
//continue;
Function<List<PaymentInstruction>, Long> creditAmountSum = paymentInstructions -> paymentInstructions
.stream()
.map(PaymentInstruction::getCreditLegAmount)
.reduce(0L, Long::sum);
Function<List<PaymentInstruction>, Long> debitAmountSum = paymentInstructions -> paymentInstructions
.stream()
.map(PaymentInstruction::getDebitLegAmount)
.reduce(0L, Long::sum);
Long fromClearingToBankCreditAmount = creditAmountSum.apply(aList);
Long fromBankToClearingCreditAmount = creditAmountSum.apply(bList);
Long fromClearingToBankDebitAmount = debitAmountSum.apply(aList);
Long fromBankToClearingDebitAmount = debitAmountSum.apply(bList);
if (!fromClearingToBankCreditAmount.equals(fromBankToClearingCreditAmount)) {
error = new EnumMessage(ClearingError.CompanyCreditCheck, senderId.toString());
} else if (!fromClearingToBankDebitAmount.equals(fromBankToClearingDebitAmount)) {
error = new EnumMessage(ClearingError.CompanyDebitCheck, senderId.toString());
}
}
Function<List<PaymentInstruction>, Long> creditAmountSum = paymentInstructions -> paymentInstructions
.stream()
.map(PaymentInstruction::getCreditLegAmount)
.reduce(0L, Long::sum);
Function<List<PaymentInstruction>, Long> debitAmountSum = paymentInstructions -> paymentInstructions
.stream()
.map(PaymentInstruction::getDebitLegAmount)
.reduce(0L, Long::sum);
Long fromClearingToBankCreditAmount = creditAmountSum.apply(aList);
Long fromBankToClearingCreditAmount = creditAmountSum.apply(bList);
Long fromClearingToBankDebitAmount = debitAmountSum.apply(aList);
Long fromBankToClearingDebitAmount = debitAmountSum.apply(bList);
if (!fromClearingToBankCreditAmount.equals(fromBankToClearingCreditAmount)) {
error = new EnumMessage(ClearingError.CompanyCreditCheck, senderId.toString());
} else if (!fromClearingToBankDebitAmount.equals(fromBankToClearingDebitAmount)) {
error = new EnumMessage(ClearingError.CompanyDebitCheck, senderId.toString());
}
log.info("processing PaymentInstruction's generationId={} senderId={} [fromClearingToBankCreditAmount={}, " +
log.info("processing PaymentInstruction's generationId={} senderId={} [fromClearingToBankCreditAmount={}, " +
"fromBankToClearingCreditAmount={}, " +
"fromClearingToBankDebitAmount={}, " +
"fromBankToClearingDebitAmount={}] {}", generationId, senderId,
@ -98,24 +106,28 @@ public class PaymentInstructionSorter {
fromClearingToBankDebitAmount,
fromBankToClearingDebitAmount,
error != null ? ("error " + messageResolver.resolve(error)) : "ok");
if (error != null) {
batchInfo.setError(error);
payments.forEach(pmt -> {
pmt.setTransactionStatus(TransactionStatus.cher.getKey());
pmtInstrctnsImdg.update(pmt);
});
return batchInfo;
if (error != null) {
batchInfo.setError(error);
payments.forEach(pmt -> {
pmt.setTransactionStatus(TransactionStatus.cher.getKey());
pmtInstrctnsImdg.update(pmt);
});
result.add(batchInfo);
} else {
batchInfo.setFromClearingToBank(aList);
batchInfo.setFromBankToClearing(bList);
result.add(batchInfo);
}
} else if (ClearingMemberCategoryD.B.equals(categoryValue)) {
batchInfo.setInitialOrder(payments);
result.add(batchInfo);
} else {
batchInfo.setFromClearingToBank(aList);
batchInfo.setFromBankToClearing(bList);
return batchInfo;
log.debug("Do nothing as category {}, check next", categoryValue);
// проверить следующую категорил, когда закончатся выдать ошибку
}
} else if (ClearingMemberCategoryD.B.equals(categoryValue)) {
batchInfo.setInitialOrder(payments);
return batchInfo;
} else {
throw new IllegalStateException("unknown clearing member category for generationId="
+ generationId + " companyId=" + senderId + "");
}
log.warn("unknown clearing member category [" + companyCategory + "] for generationId="
+ generationId + " companyId=" + senderId + "");
return result;
}
}

View file

@ -0,0 +1,37 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>./logs/clearing-service.log</file>
<encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>
../logs/clearing-service.%i.log
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>10</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>500MB</maxFileSize>
</triggeringPolicy>
</appender>
<root level="warn">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
<logger name="ru.spcex" level="debug" additivity="false">
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</logger>
</configuration>

View file

@ -9,6 +9,7 @@ import ru.spcex.clearing.dbf.exporter.logic.data.enums.Table;
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.clearing.SdfClearingRequest;
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
import ru.spcex.platform.imdg.api.ImdgProvider;
@ -34,6 +35,12 @@ public class CommandService extends QueueConsumer implements InitializingBean {
callback(ExportToFileRequest.class)
.setConsumer(this::process)
.forDestination(Consts.EXPORT_PROCESS, callbacks::put);
callback(SdfClearingRequest.class)
.setConsumer(r -> processSpecial(Table.S_DF03, r)) // todo необходимо в отдельную папку: "в отдельную директорию SettlementHouse_Fail (чтобы не отдавать такие файлы в ПРЦ"
.forDestination(Consts.SDF03_PROCESS, callbacks::put);
callback(SdfClearingRequest.class)
.setConsumer(r -> processSpecial(Table.S_DF11, r))
.forDestination(Consts.SDF11_PROCESS, callbacks::put);
init();
}
@ -48,4 +55,11 @@ public class CommandService extends QueueConsumer implements InitializingBean {
resultContainer.setGroupId(request.getSdfGroupId());
processor.process(resultContainer);
}
private void processSpecial(Table table, BaseRequest<SdfClearingRequest> systemRequest) {
SdfClearingRequest request = systemRequest.getRequestPayload();
ResultContainer resultContainer = ResultContainer.createNewTask(table);
resultContainer.setGroupId(request.getGroupId());
processor.process(resultContainer);
}
}

View file

@ -10,7 +10,6 @@ import ru.spcex.clearing.dbf.importer.logic.data.enums.ETable;
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
import ru.spcex.platform.enumeration.Task;
import ru.spcex.platform.utils.log.ExceptionUtils;
@Service
public class LauncherCommandReceiver extends QueueConsumer implements InitializingBean {
@ -31,16 +30,16 @@ public class LauncherCommandReceiver extends QueueConsumer implements Initializi
.forDestination(Task.createOrderConfirm.topic(), callbacks::put); // CORC
callback(LauncherCommandRequest.class)
.setConsumer(action -> importer.run(ETable.DF_01))
.forDestination(Task.dbf_GBAL.topic(), callbacks::put); // GBAL
.forDestination(Task.accrualOfBalance.topic(), callbacks::put); // GBAL
callback(LauncherCommandRequest.class)
.setConsumer(action -> importer.run(ETable.DF_12))
.forDestination(Task.dbf_ABLK.topic(), callbacks::put); // ABLK
.forDestination(Task.accountBlock.topic(), callbacks::put); // ABLK
callback(LauncherCommandRequest.class)
.setConsumer(action -> importer.run(ETable.DF_09))
.forDestination(Task.dbf_GBLD.topic(), callbacks::put); // GBLD
.forDestination(Task.getBalance.topic(), callbacks::put); // GBLD
callback(LauncherCommandRequest.class)
.setConsumer(action -> importer.run(ETable.DF_16))
.forDestination(Task.dbf_ADBL.topic(), callbacks::put); // ADBL
.forDestination(Task.additionOrDeleteOfBalance.topic(), callbacks::put); // ADBL
init();
}

View file

@ -100,7 +100,7 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
if (id == null)
return null;
List<CompanyInfo> results = jdbcTemplate.query(
"SELECT * FROM COMPANY_INFO WHERE id = ?", new Object[]{id}, // todo id=comapny.id? Или сделать отдельный ID?
"SELECT * FROM COMPANY_INFO WHERE id = ?", new Object[]{id}, // id=comapny_id
(rs, rowNum) -> {
CompanyInfo companyInfo = new CompanyInfo();
companyInfo.setId(rs.getObject("Id", Long.class));
@ -127,6 +127,7 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
log.warn("No row in table COMPANY_INFO where id={}. Create empty ", id);
onceObject = new CompanyInfo();
onceObject.setId(id); // чтобы не потерять id
onceObject.setCompanyId(id);
}
return onceObject;
}

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.imdg.businessobject;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;

View file

@ -0,0 +1,76 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.clearing.VerificationResult;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class VerificationResultMapStore extends TemplateMapStore<VerificationResult> {
public VerificationResultMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_VerificationResult;
}
@Override
public String getTableName() {
return "VERIFICATION_RESULT";
}
@Override
public String[] getFields() {
return new String[]{
"CLEARING_CODE", "ACCOUNT_ID", "IN_SUM", "OUT_INT_SUM", "OUT_EXT_SUM", "DIFF_SUM", "GENERATION_ID", "GENERATION_STATUS", "RESULT_STATUS",
"ID", "CREATED_AT", "UPDATED_AT"
};
}
@Override
public VerificationResult objectReader(ResultSet resultSet) throws SQLException {
VerificationResult object = new VerificationResult();
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
object.setAccountId(resultSet.getObject("ACCOUNT_ID", Long.class));
object.setInSum(resultSet.getObject("IN_SUM", BigDecimal.class));
object.setOutIntSum(resultSet.getObject("OUT_INT_SUM", BigDecimal.class));
object.setOutExtSum(resultSet.getObject("OUT_EXT_SUM", BigDecimal.class));
object.setDiffSum(resultSet.getObject("DIFF_SUM", BigDecimal.class));
object.setGenerationId(resultSet.getObject("GENERATION_ID", Long.class));
object.setGenerationStatus(resultSet.getObject("GENERATION_STATUS", String.class));
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
return object;
}
@Override
public Object[] objectToField(VerificationResult object) {
Object[] args = new Object[]{
object.getClearingCode(),
object.getAccountId(),
object.getInSum(),
object.getOutIntSum(),
object.getOutExtSum(),
object.getDiffSum(),
object.getGenerationId(),
object.getGenerationStatus(),
object.getResultStatus(),
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated())
};
return args;
}
}

View file

@ -1,6 +1,7 @@
package ru.spcex.clearing.imdg.structure;
import ru.clearing.classes.statics.data.account.*;
import ru.clearing.classes.statics.data.clearing.VerificationResult;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
import ru.clearing.classes.statics.data.company.CompanyRoleSet;
@ -77,6 +78,7 @@ public class RunnableMapNamesForTesting {
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_VerificationResult, VerificationResult.class));
//dictionary
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountStatusDictionary, AccountStatusDictionary.class));

View file

@ -1,6 +1,6 @@
package ru.spcex.clearing.reports.services;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.reports.reports.AbstractReport;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P10;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P1;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P2;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P3;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P4;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P5;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P6;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P7;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P8;

View file

@ -3,7 +3,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_5.ReportBR_0420312_P9;

View file

@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.clearing.platform.dictionary.ClearingStatusDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_4.ReportBR_0420314_P1;

View file

@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.statics.data.misc.Listing;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.clearing.platform.dictionary.ClearingStatusDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_1.ReportBR_0420315_P1;
@ -16,11 +16,8 @@ import ru.spcex.platform.enumeration.ClearingStatus;
import ru.spcex.platform.enumeration.Market;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
import java.util.*;

View file

@ -3,17 +3,14 @@ package ru.spcex.clearing.reports.services.collector;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_1.ReportBR_0420315_P2;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
import java.util.Collection;
import java.util.HashSet;

View file

@ -6,7 +6,7 @@ import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsMoney;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_17_3.ReportBR_0420318;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;
@ -21,8 +21,6 @@ import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Component
public class ReportBR_0420318_Collector extends ReportWithPeriodCollector<ReportBR_0420318> {

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_12_2.ReportPA_B;
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;

View file

@ -2,7 +2,7 @@ package ru.spcex.clearing.reports.services.collector;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
import ru.clearing.classes.transaction.data.execution.LiabilitiesClaimsAssets;
import ru.clearing.classes.statics.data.liabilities.LiabilitiesClaimsAssets;
import ru.clearing.platform.dictionary.ClearingStatusDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.reports.reports.bt_12_2.ReportPA_IV;

View file

@ -13,10 +13,6 @@ public enum Task implements IEnumKey {
startOfPreClearing("SPRC"),// Запуск преклиринга
startPostClearing("SPOC"),// Запуск постклиринга
createOrder("CORD"),
dbf_GBAL("GBAL"),
dbf_ABLK("ABLK"),
dbf_GBLD("GBLD"),
dbf_ADBL("ADBL"),
createOrderConfirm("CORC"),
getAllBalance("GALB"),
createReport_GREP("GREP");// Создание отчёта (report-service) RPRT нескольких видов, этот GREP

View file

@ -119,8 +119,9 @@ public final class IMDGDistributedNames {
public static final String Map_ReportRegister = "Map_ReportRegister";
public static final String Map_ContractRegister = "Map_ContractRegister";
public static final String Map_OrderRegister = "Map_OrderRegister";
public static final String Map_VerificationResult = "Map_VerificationResult";
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME"; // todo вынести idGenerator отдельно и завернуть в метод, чтобы не напрямую обращаться.
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME";
private IMDGDistributedNames() {
}

View file

@ -95,4 +95,12 @@ public class BankAccountNewRequest {
public void setAccount(String account) {
this.account = account;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
}

View file

@ -8,6 +8,8 @@ public class AccountSdfRequestPart {
@JsonProperty
private String account;
@JsonProperty
private String accountType;
@JsonProperty
private Long companyId;
public Long getSdfId() {
@ -26,6 +28,14 @@ public class AccountSdfRequestPart {
this.account = account;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public Long getCompanyId() {
return companyId;
}

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t account-service:1.0.0 ../modules/account-service/
docker run -d -p 8055:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs account-service:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7090 -jar account-service.jar --spring.config.location=$CLEARING_HOME/settings/account-service/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t backend-api:1.0.0 ../modules/backend-api/
docker run -d -p 8095:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs backend-api:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7020 -jar backend-api.jar --spring.config.location=$CLEARING_HOME/settings/backend-api/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t balance-service:1.0.0 ../modules/balance-service/
docker run -d -p 8040:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs balance-service:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -jar balance-service.jar --spring.config.location=$CLEARING_HOME/settings/balance-service/"
$CMD >/dev/null 2>&1 &

View file

@ -0,0 +1,9 @@
#!/bin/bash
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -jar clearing-service.jar --spring.config.location=$CLEARING_HOME/settings/clearing-service/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t company-service:1.0.0 ../modules/company-service/
docker run -d -p 8030:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs company-service:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7050 -jar company-service.jar --spring.config.location=$CLEARING_HOME/settings/company-service/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t dbf-exporter:1.0.0 ../modules/dbf-exporter/
docker run -d -p 8065:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs -v /opt/clearing/file/exporter:/opt/clearing/file/exporter/ dbf-exporter:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7030 -jar dbf-exporter.jar --spring.config.location=$CLEARING_HOME/settings/dbf-exporter/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t dbf-importer:1.0.0 ../modules/dbf-importer/
docker run -d -p 8060:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs -v /opt/clearing/file/importer/:/opt/clearing/file/importer -v /opt/clearing/file/importer/loaded:/opt/clearing/file/importer/loaded dbf-importer:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7040 -jar dbf-importer.jar --spring.config.location=$CLEARING_HOME/settings/dbf-importer/"
$CMD >/dev/null 2>&1 &

View file

@ -1,6 +0,0 @@
#!/bin/bash
./os.sh
sleep 60
./backend-api.sh &
./dbf-exporter.sh &
./dbf-importer.sh &

View file

@ -0,0 +1,9 @@
#!/bin/bash
CLEARING_HOME=/opt/mfd/clearing
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7010 -jar imdg.jar --spring.config.location=$CLEARING_HOME/settings/imdg/"
$CMD >/dev/null 2>&1 &

View file

@ -0,0 +1,16 @@
#!/bin/bash
kill -9 $(ps -ef | grep java | grep account-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep backend-api.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep balance-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep company-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep clearing-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep dbf-exporter.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep dbf-importer.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep imdg.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep securities-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep utility-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep scheduler-service.jar | awk '{print $2}')
kill -9 $(ps -ef | grep java | grep reports-service.jar | awk '{print $2}')

View file

@ -0,0 +1,14 @@
#!/bin/bash
cd /opt/mfd/clearing/bin
/opt/mfd/clearing/bin/imdg.sh
/opt/mfd/clearing/bin/account-service.sh
/opt/mfd/clearing/bin/backend-api.sh
/opt/mfd/clearing/bin/balance-service.sh
/opt/mfd/clearing/bin/company-service.sh
/opt/mfd/clearing/bin/clearing-service.sh
/opt/mfd/clearing/bin/dbf-exporter.sh
/opt/mfd/clearing/bin/dbf-importer.sh
/opt/mfd/clearing/bin/securities-service.sh
/opt/mfd/clearing/bin/utility-service.sh
/opt/mfd/clearing/bin/scheduler-service.sh
/opt/mfd/clearing/bin/reports-service.sh

View file

@ -1,2 +0,0 @@
#!/bin/bash
docker build -t debian:stable-20220125-jdk17 ../modules/os/

View file

@ -1,3 +0,0 @@
#!/bin/bash
docker build -t reports-service:1.0.0 ../modules/reports-service/
docker run -d -p 8020:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs reports-service:1.0.0

View file

@ -0,0 +1,9 @@
#!/bin/bash
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8010 -jar reports-service.jar --spring.config.location=$CLEARING_HOME/settings/reports-service/"
$CMD >/dev/null 2>&1 &

View file

@ -0,0 +1,4 @@
#!/bin/bash
/opt/mfd/clearing/bin/kill_all.sh
/opt/mfd/clearing/bin/launch_all.sh

View file

@ -0,0 +1,9 @@
#!/bin/bash
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7080 -jar scheduler-service.jar --spring.config.location=$CLEARING_HOME/settings/scheduler-service/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t securities-service:1.0.0 ../modules/securities-service/
docker run -d -p 8010:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs securities-service:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7060 -jar securities-service.jar --spring.config.location=$CLEARING_HOME/settings/securities-service/"
$CMD >/dev/null 2>&1 &

View file

@ -1,3 +1,9 @@
#!/bin/bash
docker build -t utility-service:1.0.0 ../modules/utility-service/
docker run -d -p 8015:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs utility-service:1.0.0
CLEARING_HOME=/opt/mfd/clearing/
cd $CLEARING_HOME/bin
CMD="java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7070 -jar utility-service.jar --spring.config.location=$CLEARING_HOME/settings/utility-service/"
$CMD >/dev/null 2>&1 &