Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4b8c8fc2bb
159 changed files with 5962 additions and 1785 deletions
|
|
@ -323,6 +323,31 @@
|
|||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate java_classes.java from META file
|
||||
command: mvn xml:transform@java -->
|
||||
<id>java</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/java.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>java_classes.java</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.securities.MoneyMarketSecurityNewAction;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.5.0.21",
|
||||
"version": "3.5.0.22",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -2411,7 +2411,7 @@
|
|||
|
||||
"destination": "securities/money-securities",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.MoneyMarketSecurity",
|
||||
"class": "ru.clearing.classes.statics.data.security.MoneyMarketSecurity",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
||||
|
|
@ -2453,6 +2453,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска","visible": true
|
||||
}
|
||||
,
|
||||
{"code": "securitySymbol",
|
||||
"type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
|
|
@ -2509,6 +2513,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска"
|
||||
}
|
||||
,
|
||||
{"code": "lotSize",
|
||||
"type": 11,"name": "Размер лота","shortname": "Лот","required": true
|
||||
|
|
@ -2586,6 +2594,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска"
|
||||
}
|
||||
,
|
||||
{"code": "lotSize",
|
||||
"type": 11,"name": "Размер лота","shortname": "Лот"
|
||||
|
|
@ -2654,6 +2666,36 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"tradedMoneyMarketSecurity": {
|
||||
|
||||
"name": "Инструменты денежного рынка, учавствующие в сделках",
|
||||
|
||||
"destination": "securities/traded-money-securities",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.TradedMoneyMarketSecurity",
|
||||
|
||||
"table": "traded_money_market_security",
|
||||
|
||||
"fields": [
|
||||
{"code": "securityId",
|
||||
"type": 1,"dbname": "Идентификатор инструмента","name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security","linkCode": "shortName"
|
||||
}
|
||||
,
|
||||
{"code": "shortName",
|
||||
"type": 2,"length": 255,"name": "Краткое наименование инструмента","shortname": "Краткое наименование","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
}
|
||||
,
|
||||
{"code": "securityCode",
|
||||
"type": 2,"length": 255,"name": "Полный код инструмента со сроком","shortname": "Код инструмента","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
,
|
||||
"equitySecurity": {
|
||||
|
|
@ -3783,7 +3825,38 @@
|
|||
"field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true
|
||||
}
|
||||
]
|
||||
|
||||
,"actions":[
|
||||
{"method":"post",
|
||||
|
||||
"name": "Досрочное изъятие части денежных средств по депозиту МКР",
|
||||
|
||||
"destination": "registries/splitDeposit",
|
||||
|
||||
"confirmation": "contract,outboundAmount,refundDate",
|
||||
|
||||
"fields": [
|
||||
{"code": "contract",
|
||||
"type": 2,"length": 255,"name": "Договор","shortname": "Договор","required": true
|
||||
}
|
||||
,
|
||||
{"code": "outboundAmount",
|
||||
"type": 10,"name": "Сумма изъятия","shortname": "Сумма","required": true
|
||||
}
|
||||
,
|
||||
{"code": "refundDate",
|
||||
"type": 6,"name": "Дата возврата","shortname": "Дата","required": true
|
||||
}
|
||||
,
|
||||
{"code": "comment",
|
||||
"type": 2,"length": 255,"name": "Основание для вывода","shortname": "Основание"
|
||||
}
|
||||
,
|
||||
{"code": "direction",
|
||||
"type": 1,"name": "Направление","shortname": "Направление","link": "inOutDirection"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"account": {
|
||||
|
|
@ -4046,6 +4119,10 @@
|
|||
{"code": "companyId",
|
||||
"type": 1,"dbname": "Идентификатор компании","name": "Наименование компании","shortname": "Компания","searchable": true,"sortable": true,"visible": true,"link": "company","linkCode": "shortName"
|
||||
}
|
||||
,
|
||||
{"code": "status",
|
||||
"type": 12,"dbname": "Код статуса","name": "Наименование статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "serviceStatus","extends": "account"
|
||||
}
|
||||
,
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
|
|
@ -4966,7 +5043,11 @@
|
|||
|
||||
"name": "Формирование отчетности",
|
||||
|
||||
"fields": []
|
||||
"fields": [
|
||||
{"code": "sessionId",
|
||||
"type": 1,"name": "Клиринговая сессия","shortname": "Сессия","link": "session"
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
|
@ -4975,18 +5056,18 @@
|
|||
|
||||
"group": "Обмен с Торговой системой",
|
||||
|
||||
"name": "Выгрузка в торговую систему остатков секции МКР",
|
||||
"name": "Выгрузка в торговую систему остатков по деньгам",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
||||
"destination": "LIMF",
|
||||
"destination": "LIMS",
|
||||
|
||||
"group": "Обмен с Торговой системой",
|
||||
|
||||
"name": "Выгрузка в торговую систему остатков Фондовой секции",
|
||||
"name": "Выгрузка в торговую систему остатков по бумагам",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
|
|
@ -6465,7 +6546,40 @@
|
|||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session"
|
||||
}
|
||||
]
|
||||
|
||||
,"actions":[
|
||||
{"method":"post",
|
||||
|
||||
"name": "Вывод денежных средств c регистра инициатора",
|
||||
|
||||
"destination": "payment-instructions/clearing-outbound",
|
||||
|
||||
"fields": [
|
||||
{"code": "senderId",
|
||||
"type": 1,"name": "Участник отправитель","shortname": "Отправитель","link": "company","required": true
|
||||
}
|
||||
,
|
||||
{"code": "addresseeId",
|
||||
"type": 1,"name": "Участник получатель","shortname": "Получатель","link": "company","required": true
|
||||
}
|
||||
,
|
||||
{"code": "paymentPurpose",
|
||||
"type": 2,"length": 255,"name": "Назначение платежа","shortname": "Назначение","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "creditLeg_amount",
|
||||
"type": 10,"name": "Сумма отправителя","shortname": "Сумма отправителя","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "creditLeg_accountId",
|
||||
"type": 1,"name": "Наименование счета отправителя","shortname": "Счет отправителя","searchable": true,"sortable": true,"link": "account","ignore": true
|
||||
}
|
||||
,
|
||||
{"code": "debitLeg_accountId",
|
||||
"type": 1,"name": "Наименование счета получателя","shortname": "Счет получателя","searchable": true,"sortable": true,"link": "account","ignore": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"notification": {
|
||||
|
|
|
|||
|
|
@ -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="3.5.0.21">
|
||||
<meta version="3.5.0.22">
|
||||
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||
<!--Здесь словари-->
|
||||
<enums>
|
||||
|
|
@ -557,7 +557,7 @@
|
|||
<currencyCode type="12" dbname="Код валюты" name="Код валюты" shortname="Валюта" searchable="true" sortable="true" visible="true" link="currencyCode" linkCode="code"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
</currency>
|
||||
<moneyMarketSecurity name="Инструменты Денежного рынка" destination="securities/money-securities" class="ru.clearing.classes.statics.data.misc.MoneyMarketSecurity" logUpdates="true" table="money_market_security">
|
||||
<moneyMarketSecurity name="Инструменты Денежного рынка" destination="securities/money-securities" class="ru.clearing.classes.statics.data.security.MoneyMarketSecurity" logUpdates="true" table="money_market_security">
|
||||
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="true" sortable="true" link="security" linkCode="shortName"/>
|
||||
<description type="2" length="255" name="Описание" shortname="Описание" searchable="true" sortable="false"/>
|
||||
<startDate type="6" name="Дата начала действия" shortname="Дата начала" searchable="true" sortable="true"/>
|
||||
|
|
@ -567,6 +567,7 @@
|
|||
<instrumentType type="12" dbname="Код типа инструмента" name="Наименование типа инструмента" shortname="Тип инструмента" searchable="true" sortable="true" visible="true" link="instrumentType" extends="security"/>
|
||||
<shortName type="2" length="255" name="Краткое наименование инструмента" shortname="Краткое наименование" searchable="true" sortable="true" visible="true" extends="security"/>
|
||||
<fullName type="2" length="255" name="Полное наименование инструмента" shortname="Наименование" searchable="true" sortable="true" visible="true" extends="security"/>
|
||||
<convention type="2" length="255" name="Нотация наименования инструмента" shortname="Маска" visible="true"/>
|
||||
<securitySymbol type="2" length="255" name="Код инструмента" shortname="Код" searchable="true" sortable="true" visible="true" extends="security"/>
|
||||
<termType type="12" dbname="Код вида инструмента" name="Наименование вида инструмента" shortname="Вид инструмента" searchable="true" sortable="true" visible="false" link="termType"/>
|
||||
<lotSize field="securityId" type="11" name="Размер лота" shortname="Лот" searchable="true" sortable="true" visible="true" linkKeyCode="securityId" linkCode="lotSize" link="listing" extends="listing"/>
|
||||
|
|
@ -581,6 +582,7 @@
|
|||
<securitySymbol type="2" length="255" name="Код инструмента" shortname="Код" required="true"/>
|
||||
<shortName type="2" length="255" name="Краткое наименование инструмента" shortname="Краткое наименование" required="true"/>
|
||||
<fullName type="2" length="255" name="Полное наименование инструмента" shortname="Наименование"/>
|
||||
<convention type="2" length="255" name="Нотация наименования инструмента" shortname="Маска"/>
|
||||
<lotSize type="11" name="Размер лота" shortname="Лот" required="true"/>
|
||||
<nominalValue type="10" name="Номинал" shortname="Номинал" required="true"/>
|
||||
<nominalCurrency type="12" name="Наименование валюты номинала" shortname="Валюта номинала" link="currencyCode" linkCode="code" required="true"/>
|
||||
|
|
@ -600,6 +602,7 @@
|
|||
<securitySymbol type="2" length="255" name="Код инструмента" shortname="Код" enabled="false"/>
|
||||
<shortName type="2" length="255" name="Краткое наименование инструмента" shortname="Краткое наименование"/>
|
||||
<fullName type="2" length="255" name="Полное наименование инструмента" shortname="Наименование"/>
|
||||
<convention type="2" length="255" name="Нотация наименования инструмента" shortname="Маска"/>
|
||||
<lotSize type="11" name="Размер лота" shortname="Лот"/>
|
||||
<nominalValue type="10" name="Номинал" shortname="Номинал"/>
|
||||
<nominalCurrency type="12" name="Наименование валюты номинала" shortname="Валюта номинала" link="currencyCode" linkCode="code"/>
|
||||
|
|
@ -619,6 +622,12 @@
|
|||
</delete>
|
||||
</actions>
|
||||
</moneyMarketSecurity>
|
||||
<tradedMoneyMarketSecurity name="Инструменты денежного рынка, учавствующие в сделках" destination="securities/traded-money-securities" class="ru.clearing.classes.statics.data.misc.TradedMoneyMarketSecurity" table="traded_money_market_security">
|
||||
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="true" sortable="true" link="security" linkCode="shortName"/>
|
||||
<shortName type="2" length="255" name="Краткое наименование инструмента" shortname="Краткое наименование" searchable="true" sortable="true" visible="true" extends="security"/>
|
||||
<securityCode type="2" length="255" name="Полный код инструмента со сроком" shortname="Код инструмента" searchable="true" sortable="true" visible="true"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
</tradedMoneyMarketSecurity>
|
||||
<equitySecurity name="Акции" destination="securities/equity-securities" class="ru.clearing.classes.statics.data.instrument.issue.EquitySecurity" logUpdates="true" table="equity_security">
|
||||
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="true" sortable="true" link="security" linkCode="shortName"/>
|
||||
<shortName type="2" length="255" name="Краткое наименование инструмента" shortname="Краткое наименование" searchable="true" sortable="true" visible="true" extends="security"/>
|
||||
|
|
@ -887,6 +896,15 @@
|
|||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<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"/>
|
||||
<actions>
|
||||
<post name="Досрочное изъятие части денежных средств по депозиту МКР" destination="registries/splitDeposit" confirmation="contract,outboundAmount,refundDate">
|
||||
<contract type="2" length="255" name="Договор" shortname="Договор" required="true"/>
|
||||
<outboundAmount type="10" name="Сумма изъятия" shortname="Сумма" required="true"/>
|
||||
<refundDate type="6" name="Дата возврата" shortname="Дата" required="true"/>
|
||||
<comment type="2" length="255" name="Основание для вывода" shortname="Основание"/>
|
||||
<direction type="1" name="Направление" shortname="Направление" link="inOutDirection"/>
|
||||
</post>
|
||||
</actions>
|
||||
</registry>
|
||||
<account name="Счета" destination="accounting/accounts" class="ru.clearing.classes.statics.data.account.Account" logUpdates="true" table="account">
|
||||
<account type="2" length="50" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true"/>
|
||||
|
|
@ -950,6 +968,7 @@
|
|||
<taxRegistrationReasonCode type="2" length="255" name="Код причины постановки (КПП)" shortname="КПП" searchable="true" sortable="true" visible="true"/>
|
||||
<account type="2" length="50" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true"/>
|
||||
<companyId type="1" dbname="Идентификатор компании" name="Наименование компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
|
||||
<status type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" searchable="true" sortable="true" visible="true" link="serviceStatus" extends="account"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<actions>
|
||||
<post name="Добавление счета вывода средств из ПРЦ" confirmation="currency,bankIdentificationCode,bankName,correspondentAccount,correspondentAccountName,taxpayerIdentificationNumber,taxRegistrationReasonCode,account,destination">
|
||||
|
|
@ -1160,10 +1179,11 @@
|
|||
<post destination="GSRR" group="Клиринг" name="Формирование реестра отправленных отчетов">
|
||||
</post>
|
||||
<post destination="GREP" group="Клиринг" name="Формирование отчетности">
|
||||
<sessionId type="1" name="Клиринговая сессия" shortname="Сессия" link="session"/>
|
||||
</post>
|
||||
<post destination="LIMM" group="Обмен с Торговой системой" name="Выгрузка в торговую систему остатков секции МКР">
|
||||
<post destination="LIMM" group="Обмен с Торговой системой" name="Выгрузка в торговую систему остатков по деньгам">
|
||||
</post>
|
||||
<post destination="LIMF" group="Обмен с Торговой системой" name="Выгрузка в торговую систему остатков Фондовой секции">
|
||||
<post destination="LIMS" group="Обмен с Торговой системой" name="Выгрузка в торговую систему остатков по бумагам">
|
||||
</post>
|
||||
<post destination="LIQU" group="Клиринг" name="иквидационная сессия по обязательтсвам участника">
|
||||
</post>
|
||||
|
|
@ -1505,6 +1525,16 @@
|
|||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
<clearingDate type="6" name="Дата расчета" shortname="Дата расчета" searchable="true" sortable="true" ignore="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
<actions>
|
||||
<post name="Вывод денежных средств c регистра инициатора" destination="payment-instructions/clearing-outbound">
|
||||
<senderId type="1" name="Участник отправитель" shortname="Отправитель" link="company" required="true"/>
|
||||
<addresseeId type="1" name="Участник получатель" shortname="Получатель" link="company" required="true"/>
|
||||
<paymentPurpose type="2" length="255" name="Назначение платежа" shortname="Назначение" searchable="true" sortable="true" visible="true"/>
|
||||
<creditLeg_amount type="10" name="Сумма отправителя" shortname="Сумма отправителя" searchable="true" sortable="true" visible="true"/>
|
||||
<creditLeg_accountId type="1" name="Наименование счета отправителя" shortname="Счет отправителя" searchable="true" sortable="true" link="account" ignore="true"/>
|
||||
<debitLeg_accountId type="1" name="Наименование счета получателя" shortname="Счет получателя" searchable="true" sortable="true" link="account" ignore="true"/>
|
||||
</post>
|
||||
</actions>
|
||||
</paymentInstruction>
|
||||
<notification name="Сообщения" destination="notifications" class="ru.clearing.classes.statics.data.misc.Notification" logUpdates="true" table="notification">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
|
|
|
|||
467
clearing-parent/backend-api/src/main/resources/meta/xsl/java.xsl
Normal file
467
clearing-parent/backend-api/src/main/resources/meta/xsl/java.xsl
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="text" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
|
||||
|
||||
<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="meta">// JAVA classes for DB version: <xsl:value-of select="@version"/><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="enums">
|
||||
/* Dictionaries */
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
|
||||
</xsl:template>
|
||||
<xsl:template match="objects">
|
||||
/* Business objects */
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="types">
|
||||
// Data types
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="types">
|
||||
// <xsl:value-of select="@id"/>. <xsl:value-of select="name()"/> : <xsl:value-of select="@type"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
// ----------------- <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="nameObjFmt"><xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
|
||||
package ru.clearing.platform.dictionary;<!-- todo remove extract last class <xsl:value-of select="@class"/> - only package-->
|
||||
<!-- import ru.clearing.dictionarys.ConstDictionarySerializable; -->
|
||||
|
||||
/**
|
||||
* <xsl:value-of select="@name"/>
|
||||
*
|
||||
* Dictionary DB table: <xsl:value-of select="$dbTableName"/>
|
||||
**/
|
||||
public class <xsl:value-of select="$nameObjFmt"/>Dictionary extends AbstractDictionary {
|
||||
private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;
|
||||
|
||||
<xsl:apply-templates select="*" mode="field-enums"/> <!-- ignore default AbstractDictionary field -->
|
||||
|
||||
<xsl:apply-templates select="*" mode="getter-setter-enums"/>
|
||||
}
|
||||
|
||||
|
||||
// -- mapstore --
|
||||
package ru.spcex.clearing.imdg.dictionary;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.platform.dictionary.<xsl:value-of select="$nameObjFmt"/>Dictionary; <!-- or <xsl:value-of select="@class"/> -->
|
||||
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
||||
@Component
|
||||
public class <xsl:value-of select="$nameObjFmt"/>DictionaryMapStore extends DictionaryTMapStore<<xsl:value-of select="$nameObjFmt"/>Dictionary> {
|
||||
|
||||
public <xsl:value-of select="$nameObjFmt"/>DictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_<xsl:value-of select="$nameObjFmt"/>Dictionary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "<xsl:value-of select="$dbTableName"/>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public <xsl:value-of select="$nameObjFmt"/>Dictionary getDictionaryObject() {
|
||||
return new <xsl:value-of select="$nameObjFmt"/>Dictionary();
|
||||
}
|
||||
<xsl:apply-templates select="*" mode="mapstore-field-enums"/> <!-- защита от нестандартного Dictionary -->
|
||||
}
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="mapstore-field-enums" >
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'"></xsl:when>
|
||||
<xsl:when test="name()='code'"></xsl:when>
|
||||
<xsl:when test="name()='name'"></xsl:when>
|
||||
<xsl:otherwise>
|
||||
!! Нестандартное поле !! <xsl:value-of select="name()"/> // FIXME Нестандартный словарь! Требуется писать код вручную.
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
// ------------------ <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="nameObjFmt"><xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
package <xsl:value-of select="@class"/>;<!-- todo remove extract last class - only package-->
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
/**
|
||||
* <xsl:value-of select="@name"/>
|
||||
*
|
||||
* DB table: <xsl:value-of select="$dbTableName"/>
|
||||
**/
|
||||
public class <xsl:value-of select="$nameObjFmt"/> extends SpcexObjectBase {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="field"/>
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="getter-setter-objects"/>
|
||||
}
|
||||
|
||||
|
||||
//mapstore
|
||||
|
||||
// -- mapstore --
|
||||
package ru.spcex.clearing.imdg.object;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import <xsl:value-of select="@class"/>; <!-- or ...<xsl:value-of select="$nameObjFmt"/> -->
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;<!-- ObjectBaseMapStore; -->
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class <xsl:value-of select="$nameObjFmt"/>MapStore extends TemplateMapStore<<xsl:value-of select="$nameObjFmt"/>> {
|
||||
|
||||
public <xsl:value-of select="$nameObjFmt"/>MapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_<xsl:value-of select="$nameObjFmt"/>;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "<xsl:value-of select="$dbTableName"/>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="mapstore-field-getFields"/>
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <xsl:value-of select="$nameObjFmt"/> objectReader(ResultSet resultSet) throws SQLException {
|
||||
<xsl:value-of select="$nameObjFmt"/> object = new <xsl:value-of select="$nameObjFmt"/>(); <xsl:apply-templates select="*[@name or @dbname or @type]" mode="mapstore-field-setters"/>
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(<xsl:value-of select="$nameObjFmt"/> object) {
|
||||
Object[] args = new Object[]{<xsl:apply-templates select="*[@name or @dbname or @type]" mode="mapstore-field-getters"/>
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
<xsl:if test="@logUpdates">
|
||||
// todo добавить класс <xsl:value-of select="$nameObjFmt"/>History
|
||||
package <xsl:value-of select="@class"/>;<!-- todo remove extract last class - only package-->
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessEvent;
|
||||
import java.io.Serial;
|
||||
/**
|
||||
* Изменение состояния объекта <xsl:value-of select="@name"/>
|
||||
*
|
||||
* DB table: <xsl:value-of select="$dbTableName"/>_HISTORY
|
||||
**/
|
||||
public class <xsl:value-of select="$nameObjFmt"/>History extends BusinessEvent<<xsl:value-of select="$nameObjFmt"/>> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private <xsl:value-of select="$nameObjFmt"/> object;
|
||||
|
||||
@Override
|
||||
public <xsl:value-of select="$nameObjFmt"/> getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(<xsl:value-of select="$nameObjFmt"/> object) {
|
||||
this.object = object;
|
||||
}
|
||||
}
|
||||
|
||||
// -- History mapstore для журналирования --
|
||||
package ru.spcex.clearing.imdg.businessevent;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import <xsl:value-of select="@class"/>;
|
||||
import <xsl:value-of select="@class"/>History; <!-- or ...<xsl:value-of select="$nameObjFmt"/> -->
|
||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;<!-- ObjectBaseMapStore; -->
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
@Component
|
||||
public class <xsl:value-of select="$nameObjFmt"/>HistoryMapStore extends TemplateEventMapStore<<xsl:value-of select="$nameObjFmt"/>History> {
|
||||
|
||||
public <xsl:value-of select="$nameObjFmt"/>HistoryMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_<xsl:value-of select="$nameObjFmt"/>History;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "<xsl:value-of select="$dbTableName"/>_HISTORY";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID", "EVENT_TYPE", <!-- todo покрасивее сделать ?_ID, а то код вручную приодится править -->
|
||||
<xsl:value-of select="$dbTableName"/>_<xsl:apply-templates select="*[@name or @dbname or @type]" mode="mapstore-field-getFields"/>
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(<xsl:value-of select="$nameObjFmt"/>History historyLog) {
|
||||
<xsl:value-of select="$nameObjFmt"/> object=historyLog.getObject();
|
||||
Object[] args = new Object[]{
|
||||
historyLog.getId(),
|
||||
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
|
||||
historyLog.getUserId(),
|
||||
historyLog.getEventType(),
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="mapstore-field-getters"/>
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="*" mode="mapstore-field-getFields" ><xsl:if test="position() != '1'">, </xsl:if> "<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>"</xsl:template>
|
||||
<xsl:template match="*" mode="mapstore-field-setters" >
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:variable name="javatp" select="/meta/types/*[@id=$tp]/@javatype"/> <xsl:choose>
|
||||
<xsl:when test="$javatp='Instant'">
|
||||
object.set<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>(getInstantFromTimestamp(resultSet, "<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>"))</xsl:when>
|
||||
<xsl:when test="$javatp='LocalDate'">
|
||||
object.set<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>(getLocalDateFromSqlDate(resultSet, "<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>"))</xsl:when>
|
||||
<xsl:when test="$javatp='LocalTime'">
|
||||
object.set<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>(getLocalTimeFromSqlTime(resultSet, "<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>"))</xsl:when>
|
||||
<xsl:otherwise>
|
||||
object.set<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>(resultSet.getObject("<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>", <xsl:value-of select="$javatp"/>.class))</xsl:otherwise>
|
||||
</xsl:choose>;</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="mapstore-field-getters" ><xsl:if test="position() != '1'">, </xsl:if><!-- todo запятую в конце а не в начале, см. last()-->
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:variable name="javatp" select="/meta/types/*[@id=$tp]/@javatype"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$javatp='Instant'">
|
||||
TimeUtil.toDateFromInstant(object.get<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>())</xsl:when>
|
||||
<xsl:when test="$javatp='LocalDate'">
|
||||
TimeUtil.toDateFromLocalDate(object.get<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>())</xsl:when>
|
||||
<xsl:when test="$javatp='LocalTime'">
|
||||
TimeUtil.toDateFromLocalTime(object.get<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>())</xsl:when>
|
||||
<xsl:otherwise>
|
||||
object.get<xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>()</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="field" >
|
||||
|
||||
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
|
||||
<xsl:if test="name()='id'"> // (in parent) </xsl:if> private <xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> <xsl:text> <!-- space   --></xsl:text><xsl:value-of select="name()"/>;
|
||||
<xsl:choose>
|
||||
<xsl:when test="@dbfield"> // DB field: <xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<!-- new line -->
|
||||
<xsl:otherwise> </xsl:otherwise></xsl:choose>
|
||||
<!-- todo pretty comment: <xsl:if test="@link"> // (linked to <xsl:value-of select="@link"/>)
|
||||
</xsl:if>-->
|
||||
|
||||
<!-- fixme т.к. тут атрибуты перебираются - не работают переносы а ещё знак пробела надо пропатчить, а то NBSP -->
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="field-enums" >
|
||||
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'"></xsl:when><!-- определено в родительском классе AbstractDictionary -->
|
||||
<xsl:when test="name()='code'"></xsl:when><!-- определено в родительском классе AbstractDictionary -->
|
||||
<xsl:when test="name()='name'"></xsl:when><!-- определено в родительском классе AbstractDictionary -->
|
||||
<xsl:otherwise><!-- нестандартное поле -->
|
||||
|
||||
private <xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> <xsl:text> <!-- space   --> </xsl:text><xsl:value-of select="name()"/>;
|
||||
<xsl:choose>
|
||||
<xsl:when test="@dbfield"> // DB field: <xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<!-- new line -->
|
||||
<xsl:otherwise> </xsl:otherwise>
|
||||
</xsl:choose><xsl:if test="@link"> // (linked to <xsl:value-of select="@link"/>)
|
||||
<!--new line--></xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="getter-setter-enums">
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'"></xsl:when><!-- todo other restrictions of parent AbstractDictionary -->
|
||||
<xsl:when test="name()='code'"></xsl:when><!-- todo other restrictions of parent AbstractDictionary -->
|
||||
<xsl:when test="name()='name'"></xsl:when><!-- todo other restrictions of parent AbstractDictionary -->
|
||||
<xsl:otherwise><!-- нестандартное поле -->
|
||||
<xsl:variable name="NameFmt"><xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
public <xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> get<xsl:value-of select="$NameFmt"/>() {
|
||||
return <xsl:value-of select="name()"/>;
|
||||
}
|
||||
public void set<xsl:value-of select="$NameFmt"/>(<xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> value) {
|
||||
this.<xsl:value-of select="name()"/>=value;
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="getter-setter-objects">
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'"></xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="NameFmt"><xsl:call-template name='convertFirstUC_'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
public <xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> get<xsl:value-of select="$NameFmt"/>() {
|
||||
return <xsl:value-of select="name()"/>;
|
||||
}
|
||||
public void set<xsl:value-of select="$NameFmt"/>(<xsl:value-of select="/meta/types/*[@id=$tp]/@javatype"/> value) {
|
||||
this.<xsl:value-of select="name()"/>=value;
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertDbStyle'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:variable name="added_">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$toconvert' />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$added_' />
|
||||
<xsl:with-param name='conversion' select="'upper'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertcase'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:param name='conversion' />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test='$conversion="lower"'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="upper"'>
|
||||
<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="proper"'>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$toconvert' />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertpropercase'>
|
||||
<xsl:param name='toconvert' />
|
||||
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$f' />
|
||||
<xsl:with-param name='conversion'>upper</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,' ')">
|
||||
<xsl:value-of select='substring-before($s," ")'/>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert' select='substring-after($s," ")' />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$s'/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='add_'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$f = translate($f, $lcletters,$ucletters)"><xsl:if test="translate($f, $avoidletters,'')">_</xsl:if><xsl:value-of select='$f'/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select='$f'/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($toconvert) > 1">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$s'/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- todo должен первую букву прописной сделать -->
|
||||
<xsl:template name='convertFirstUC_'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='translate(substring($toconvert, 1, 1),$lcletters,$ucletters)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
<xsl:value-of select='$f'/><xsl:value-of select='$s'/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -26,7 +26,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.filter.CharacterEncodingFilter;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.user.User;
|
||||
import ru.spcex.clearing.backendapi.controller.config.*;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.account.*;
|
||||
|
|
@ -60,7 +59,6 @@ import ru.spcex.clearing.test.TestUtils;
|
|||
import ru.spcex.clearing.test.json.MatcherFactoryWithJson;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
|
||||
|
|
@ -158,6 +156,7 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
WebSecurityTestConfigurer.class,
|
||||
MessagesTestConfig.class,
|
||||
Jackson2HttpConverterTestConfig.class})
|
||||
//todo может быть указать пакедж а не список контроллеров
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebMvcTest
|
||||
//@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.securities;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.securities.MoneyMarketSecurityNewAction;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.5.0.21",
|
||||
"version": "3.5.0.22",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -2411,7 +2411,7 @@
|
|||
|
||||
"destination": "securities/money-securities",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.MoneyMarketSecurity",
|
||||
"class": "ru.clearing.classes.statics.data.security.MoneyMarketSecurity",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
||||
|
|
@ -2453,6 +2453,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска","visible": true
|
||||
}
|
||||
,
|
||||
{"code": "securitySymbol",
|
||||
"type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
|
|
@ -2509,6 +2513,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска"
|
||||
}
|
||||
,
|
||||
{"code": "lotSize",
|
||||
"type": 11,"name": "Размер лота","shortname": "Лот","required": true
|
||||
|
|
@ -2586,6 +2594,10 @@
|
|||
{"code": "fullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование инструмента","shortname": "Наименование"
|
||||
}
|
||||
,
|
||||
{"code": "convention",
|
||||
"type": 2,"length": 255,"name": "Нотация наименования инструмента","shortname": "Маска"
|
||||
}
|
||||
,
|
||||
{"code": "lotSize",
|
||||
"type": 11,"name": "Размер лота","shortname": "Лот"
|
||||
|
|
@ -2654,6 +2666,36 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"tradedMoneyMarketSecurity": {
|
||||
|
||||
"name": "Инструменты денежного рынка, учавствующие в сделках",
|
||||
|
||||
"destination": "securities/traded-money-securities",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.TradedMoneyMarketSecurity",
|
||||
|
||||
"table": "traded_money_market_security",
|
||||
|
||||
"fields": [
|
||||
{"code": "securityId",
|
||||
"type": 1,"dbname": "Идентификатор инструмента","name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security","linkCode": "shortName"
|
||||
}
|
||||
,
|
||||
{"code": "shortName",
|
||||
"type": 2,"length": 255,"name": "Краткое наименование инструмента","shortname": "Краткое наименование","searchable": true,"sortable": true,"visible": true,"extends": "security"
|
||||
}
|
||||
,
|
||||
{"code": "securityCode",
|
||||
"type": 2,"length": 255,"name": "Полный код инструмента со сроком","shortname": "Код инструмента","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
,
|
||||
"equitySecurity": {
|
||||
|
|
@ -3783,7 +3825,38 @@
|
|||
"field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true
|
||||
}
|
||||
]
|
||||
|
||||
,"actions":[
|
||||
{"method":"post",
|
||||
|
||||
"name": "Досрочное изъятие части денежных средств по депозиту МКР",
|
||||
|
||||
"destination": "registries/splitDeposit",
|
||||
|
||||
"confirmation": "contract,outboundAmount,refundDate",
|
||||
|
||||
"fields": [
|
||||
{"code": "contract",
|
||||
"type": 2,"length": 255,"name": "Договор","shortname": "Договор","required": true
|
||||
}
|
||||
,
|
||||
{"code": "outboundAmount",
|
||||
"type": 10,"name": "Сумма изъятия","shortname": "Сумма","required": true
|
||||
}
|
||||
,
|
||||
{"code": "refundDate",
|
||||
"type": 6,"name": "Дата возврата","shortname": "Дата","required": true
|
||||
}
|
||||
,
|
||||
{"code": "comment",
|
||||
"type": 2,"length": 255,"name": "Основание для вывода","shortname": "Основание"
|
||||
}
|
||||
,
|
||||
{"code": "direction",
|
||||
"type": 1,"name": "Направление","shortname": "Направление","link": "inOutDirection"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"account": {
|
||||
|
|
@ -4046,6 +4119,10 @@
|
|||
{"code": "companyId",
|
||||
"type": 1,"dbname": "Идентификатор компании","name": "Наименование компании","shortname": "Компания","searchable": true,"sortable": true,"visible": true,"link": "company","linkCode": "shortName"
|
||||
}
|
||||
,
|
||||
{"code": "status",
|
||||
"type": 12,"dbname": "Код статуса","name": "Наименование статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "serviceStatus","extends": "account"
|
||||
}
|
||||
,
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
|
|
@ -4966,7 +5043,11 @@
|
|||
|
||||
"name": "Формирование отчетности",
|
||||
|
||||
"fields": []
|
||||
"fields": [
|
||||
{"code": "sessionId",
|
||||
"type": 1,"name": "Клиринговая сессия","shortname": "Сессия","link": "session"
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
|
@ -4975,18 +5056,18 @@
|
|||
|
||||
"group": "Обмен с Торговой системой",
|
||||
|
||||
"name": "Выгрузка в торговую систему остатков секции МКР",
|
||||
"name": "Выгрузка в торговую систему остатков по деньгам",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
||||
"destination": "LIMF",
|
||||
"destination": "LIMS",
|
||||
|
||||
"group": "Обмен с Торговой системой",
|
||||
|
||||
"name": "Выгрузка в торговую систему остатков Фондовой секции",
|
||||
"name": "Выгрузка в торговую систему остатков по бумагам",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
|
|
@ -6465,7 +6546,40 @@
|
|||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session"
|
||||
}
|
||||
]
|
||||
|
||||
,"actions":[
|
||||
{"method":"post",
|
||||
|
||||
"name": "Вывод денежных средств c регистра инициатора",
|
||||
|
||||
"destination": "payment-instructions/clearing-outbound",
|
||||
|
||||
"fields": [
|
||||
{"code": "senderId",
|
||||
"type": 1,"name": "Участник отправитель","shortname": "Отправитель","link": "company","required": true
|
||||
}
|
||||
,
|
||||
{"code": "addresseeId",
|
||||
"type": 1,"name": "Участник получатель","shortname": "Получатель","link": "company","required": true
|
||||
}
|
||||
,
|
||||
{"code": "paymentPurpose",
|
||||
"type": 2,"length": 255,"name": "Назначение платежа","shortname": "Назначение","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "creditLeg_amount",
|
||||
"type": 10,"name": "Сумма отправителя","shortname": "Сумма отправителя","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "creditLeg_accountId",
|
||||
"type": 1,"name": "Наименование счета отправителя","shortname": "Счет отправителя","searchable": true,"sortable": true,"link": "account","ignore": true
|
||||
}
|
||||
,
|
||||
{"code": "debitLeg_accountId",
|
||||
"type": 1,"name": "Наименование счета получателя","shortname": "Счет получателя","searchable": true,"sortable": true,"link": "account","ignore": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"notification": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,195 @@
|
|||
package ru.clearing.classes.statics.data.execution;
|
||||
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
import ru.spcex.platform.classes.base.interfaces.ExecutionType;
|
||||
import ru.spcex.platform.classes.base.interfaces.IExecution;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public abstract class ExecutionCommon extends BusinessObject implements IExecution {
|
||||
protected Long exchangeExecutionId;
|
||||
protected Instant exchangeExecutionTime;
|
||||
protected LocalDate tradingDate;
|
||||
protected Long tradingClearingRegistryId;
|
||||
protected String market;
|
||||
protected BigDecimal price;
|
||||
protected BigDecimal lots;
|
||||
protected BigDecimal quantity;
|
||||
protected BigDecimal interestAmount;
|
||||
protected String side;
|
||||
protected String settlementCurrency;
|
||||
protected Long companyId;
|
||||
protected Long duration;
|
||||
protected String securityFullName;
|
||||
protected String securitySymbol;
|
||||
protected Long securityId;
|
||||
protected Long counterPartyId;
|
||||
protected String coverageStatus;
|
||||
protected Long sessionId;
|
||||
protected LocalDate clearingDate;
|
||||
|
||||
public abstract ExecutionType type();
|
||||
|
||||
public LocalDate getClearingDate() {
|
||||
return clearingDate;
|
||||
}
|
||||
|
||||
public void setClearingDate(LocalDate value) {
|
||||
this.clearingDate = value;
|
||||
}
|
||||
|
||||
public Long getExchangeExecutionId() {
|
||||
return exchangeExecutionId;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionId(Long value) {
|
||||
this.exchangeExecutionId = value;
|
||||
}
|
||||
|
||||
public String getSide() {
|
||||
return side;
|
||||
}
|
||||
|
||||
public void setSide(String value) {
|
||||
this.side = value;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String value) {
|
||||
this.market = value;
|
||||
}
|
||||
|
||||
public LocalDate getTradingDate() {
|
||||
return tradingDate;
|
||||
}
|
||||
|
||||
public void setTradingDate(LocalDate value) {
|
||||
this.tradingDate = value;
|
||||
}
|
||||
|
||||
public String getSecuritySymbol() {
|
||||
return securitySymbol;
|
||||
}
|
||||
|
||||
public void setSecuritySymbol(String value) {
|
||||
this.securitySymbol = value;
|
||||
}
|
||||
|
||||
public Long getSecurityId() {
|
||||
return securityId;
|
||||
}
|
||||
|
||||
public void setSecurityId(Long value) {
|
||||
this.securityId = value;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestAmount() {
|
||||
return interestAmount;
|
||||
}
|
||||
|
||||
public void setInterestAmount(BigDecimal value) {
|
||||
this.interestAmount = value;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal value) {
|
||||
this.price = value;
|
||||
}
|
||||
|
||||
public BigDecimal getLots() {
|
||||
return lots;
|
||||
}
|
||||
|
||||
public void setLots(BigDecimal value) {
|
||||
this.lots = value;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal value) {
|
||||
this.quantity = value;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionTime() {
|
||||
return exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionTime(Instant value) {
|
||||
this.exchangeExecutionTime = value;
|
||||
}
|
||||
|
||||
public Long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Long value) {
|
||||
this.duration = value;
|
||||
}
|
||||
|
||||
public Long getTradingClearingRegistryId() {
|
||||
return tradingClearingRegistryId;
|
||||
}
|
||||
|
||||
public void setTradingClearingRegistryId(Long value) {
|
||||
this.tradingClearingRegistryId = value;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long value) {
|
||||
this.companyId = value;
|
||||
}
|
||||
|
||||
public Long getCounterPartyId() {
|
||||
return counterPartyId;
|
||||
}
|
||||
|
||||
public void setCounterPartyId(Long value) {
|
||||
this.counterPartyId = value;
|
||||
}
|
||||
|
||||
public String getSecurityFullName() {
|
||||
return securityFullName;
|
||||
}
|
||||
|
||||
public void setSecurityFullName(String value) {
|
||||
this.securityFullName = value;
|
||||
}
|
||||
|
||||
public String getSettlementCurrency() {
|
||||
return settlementCurrency;
|
||||
}
|
||||
|
||||
public void setSettlementCurrency(String value) {
|
||||
this.settlementCurrency = value;
|
||||
}
|
||||
|
||||
public String getCoverageStatus() {
|
||||
return coverageStatus;
|
||||
}
|
||||
|
||||
public void setCoverageStatus(String value) {
|
||||
this.coverageStatus = value;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long value) {
|
||||
this.sessionId = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,103 +1,25 @@
|
|||
package ru.clearing.classes.statics.data.execution;
|
||||
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
import ru.spcex.platform.classes.base.interfaces.IExecution;
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.spcex.platform.classes.base.interfaces.ExecutionType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ExecutionDeposit extends BusinessObject implements IExecution {
|
||||
private Long exchangeExecutionId;
|
||||
private Instant exchangeExecutionTime;
|
||||
private LocalDate tradingDate;
|
||||
private Long tradingClearingRegistryId;
|
||||
private String market;
|
||||
private BigDecimal price;
|
||||
private BigDecimal lots;
|
||||
private BigDecimal quantity;
|
||||
public class ExecutionDeposit extends ExecutionCommon {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private BigDecimal firstLegAmount;
|
||||
private BigDecimal secondLegAmount;
|
||||
private BigDecimal interestAmount;
|
||||
private String side;
|
||||
private String settlementCurrency;
|
||||
private Long companyId;
|
||||
private Long duration;
|
||||
private LocalDate firstLegSettlementDate;
|
||||
private LocalDate secondLegSettlementDate;
|
||||
private String firstLegSettlementCode;
|
||||
private String secondLegSettlementCode;
|
||||
private String securityFullName;
|
||||
private String securitySymbol;
|
||||
private Long securityId;
|
||||
private String contract;
|
||||
private Long counterPartyId;
|
||||
private String coverageStatus;
|
||||
private Long sessionId;
|
||||
private LocalDate clearingDate;
|
||||
|
||||
public Long getExchangeExecutionId() {
|
||||
return exchangeExecutionId;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionId(Long exchangeExecutionId) {
|
||||
this.exchangeExecutionId = exchangeExecutionId;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionTime() {
|
||||
return exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionTime(Instant exchangeExecutionTime) {
|
||||
this.exchangeExecutionTime = exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public LocalDate getTradingDate() {
|
||||
return tradingDate;
|
||||
}
|
||||
|
||||
public void setTradingDate(LocalDate tradingDate) {
|
||||
this.tradingDate = tradingDate;
|
||||
}
|
||||
|
||||
public Long getTradingClearingRegistryId() {
|
||||
return tradingClearingRegistryId;
|
||||
}
|
||||
|
||||
public void setTradingClearingRegistryId(Long tradingClearingRegistryId) {
|
||||
this.tradingClearingRegistryId = tradingClearingRegistryId;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getLots() {
|
||||
return lots;
|
||||
}
|
||||
|
||||
public void setLots(BigDecimal lots) {
|
||||
this.lots = lots;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal quantity) {
|
||||
this.quantity = quantity;
|
||||
@Override
|
||||
public ExecutionType type() {
|
||||
return ExecutionType.ExecutionDeposit;
|
||||
}
|
||||
|
||||
public BigDecimal getFirstLegAmount() {
|
||||
|
|
@ -116,46 +38,6 @@ public class ExecutionDeposit extends BusinessObject implements IExecution {
|
|||
this.secondLegAmount = secondLegAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestAmount() {
|
||||
return interestAmount;
|
||||
}
|
||||
|
||||
public void setInterestAmount(BigDecimal interestAmount) {
|
||||
this.interestAmount = interestAmount;
|
||||
}
|
||||
|
||||
public String getSide() {
|
||||
return side;
|
||||
}
|
||||
|
||||
public void setSide(String side) {
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public String getSettlementCurrency() {
|
||||
return settlementCurrency;
|
||||
}
|
||||
|
||||
public void setSettlementCurrency(String settlementCurrency) {
|
||||
this.settlementCurrency = settlementCurrency;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public Long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public LocalDate getFirstLegSettlementDate() {
|
||||
return firstLegSettlementDate;
|
||||
}
|
||||
|
|
@ -188,30 +70,6 @@ public class ExecutionDeposit extends BusinessObject implements IExecution {
|
|||
this.secondLegSettlementCode = secondLegSettlementCode;
|
||||
}
|
||||
|
||||
public String getSecurityFullName() {
|
||||
return securityFullName;
|
||||
}
|
||||
|
||||
public void setSecurityFullName(String securityFullName) {
|
||||
this.securityFullName = securityFullName;
|
||||
}
|
||||
|
||||
public String getSecuritySymbol() {
|
||||
return securitySymbol;
|
||||
}
|
||||
|
||||
public void setSecuritySymbol(String securitySymbol) {
|
||||
this.securitySymbol = securitySymbol;
|
||||
}
|
||||
|
||||
public Long getSecurityId() {
|
||||
return securityId;
|
||||
}
|
||||
|
||||
public void setSecurityId(Long securityId) {
|
||||
this.securityId = securityId;
|
||||
}
|
||||
|
||||
public String getContract() {
|
||||
return contract;
|
||||
}
|
||||
|
|
@ -219,36 +77,4 @@ public class ExecutionDeposit extends BusinessObject implements IExecution {
|
|||
public void setContract(String contract) {
|
||||
this.contract = contract;
|
||||
}
|
||||
|
||||
public Long getCounterPartyId() {
|
||||
return counterPartyId;
|
||||
}
|
||||
|
||||
public void setCounterPartyId(Long counterPartyId) {
|
||||
this.counterPartyId = counterPartyId;
|
||||
}
|
||||
|
||||
public String getCoverageStatus() {
|
||||
return coverageStatus;
|
||||
}
|
||||
|
||||
public void setCoverageStatus(String coverageStatus) {
|
||||
this.coverageStatus = coverageStatus;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public LocalDate getClearingDate() {
|
||||
return clearingDate;
|
||||
}
|
||||
|
||||
public void setClearingDate(LocalDate clearingDate) {
|
||||
this.clearingDate = clearingDate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
package ru.clearing.classes.statics.data.execution;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
import ru.spcex.platform.classes.base.interfaces.IExecution;
|
||||
import ru.spcex.platform.classes.base.interfaces.ExecutionType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
|
@ -13,252 +12,75 @@ import java.time.LocalDate;
|
|||
* <p>
|
||||
* DB table: EXECUTION_FOND
|
||||
**/
|
||||
public class ExecutionFond extends BusinessObject implements IExecution {
|
||||
public class ExecutionFond extends ExecutionCommon {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private LocalDate clearingDate;
|
||||
private Long exchangeExecutionId;
|
||||
private String side;
|
||||
private String market;
|
||||
private LocalDate tradingDate;
|
||||
private String securitySymbol;
|
||||
private Long securityId;
|
||||
private BigDecimal interestAmount;
|
||||
private Long exchangeOrderId;
|
||||
private BigDecimal price;
|
||||
private BigDecimal settlementAmount;
|
||||
private BigDecimal lots;
|
||||
private BigDecimal quantity;
|
||||
private Instant exchangeExecutionTime;
|
||||
private Long duration;
|
||||
private Long tradingClearingRegistryId;
|
||||
private String comment;
|
||||
private Long clientCodeId;
|
||||
private String settlementCode;
|
||||
private Long companyId;
|
||||
private Long counterPartyId;
|
||||
private String securityFullName;
|
||||
private LocalDate settlementDate;
|
||||
private String settlementCurrency;
|
||||
private Instant exchangeExecutionMicroseconds;
|
||||
private String coverageStatus;
|
||||
private Long sessionId;
|
||||
|
||||
|
||||
public LocalDate getClearingDate() {
|
||||
return clearingDate;
|
||||
}
|
||||
|
||||
public void setClearingDate(LocalDate value) {
|
||||
this.clearingDate = value;
|
||||
}
|
||||
|
||||
public Long getExchangeExecutionId() {
|
||||
return exchangeExecutionId;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionId(Long value) {
|
||||
this.exchangeExecutionId = value;
|
||||
}
|
||||
|
||||
public String getSide() {
|
||||
return side;
|
||||
}
|
||||
|
||||
public void setSide(String value) {
|
||||
this.side = value;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String value) {
|
||||
this.market = value;
|
||||
}
|
||||
|
||||
public LocalDate getTradingDate() {
|
||||
return tradingDate;
|
||||
}
|
||||
|
||||
public void setTradingDate(LocalDate value) {
|
||||
this.tradingDate = value;
|
||||
}
|
||||
|
||||
public String getSecuritySymbol() {
|
||||
return securitySymbol;
|
||||
}
|
||||
|
||||
public void setSecuritySymbol(String value) {
|
||||
this.securitySymbol = value;
|
||||
}
|
||||
|
||||
public Long getSecurityId() {
|
||||
return securityId;
|
||||
}
|
||||
|
||||
public void setSecurityId(Long value) {
|
||||
this.securityId = value;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestAmount() {
|
||||
return interestAmount;
|
||||
}
|
||||
|
||||
public void setInterestAmount(BigDecimal value) {
|
||||
this.interestAmount = value;
|
||||
@Override
|
||||
public ExecutionType type() {
|
||||
return ExecutionType.ExecutionFond;
|
||||
}
|
||||
|
||||
public Long getExchangeOrderId() {
|
||||
return exchangeOrderId;
|
||||
}
|
||||
|
||||
public void setExchangeOrderId(Long value) {
|
||||
this.exchangeOrderId = value;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal value) {
|
||||
this.price = value;
|
||||
public void setExchangeOrderId(Long exchangeOrderId) {
|
||||
this.exchangeOrderId = exchangeOrderId;
|
||||
}
|
||||
|
||||
public BigDecimal getSettlementAmount() {
|
||||
return settlementAmount;
|
||||
}
|
||||
|
||||
public void setSettlementAmount(BigDecimal value) {
|
||||
this.settlementAmount = value;
|
||||
}
|
||||
|
||||
public BigDecimal getLots() {
|
||||
return lots;
|
||||
}
|
||||
|
||||
public void setLots(BigDecimal value) {
|
||||
this.lots = value;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal value) {
|
||||
this.quantity = value;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionTime() {
|
||||
return exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionTime(Instant value) {
|
||||
this.exchangeExecutionTime = value;
|
||||
}
|
||||
|
||||
public Long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Long value) {
|
||||
this.duration = value;
|
||||
}
|
||||
|
||||
public Long getTradingClearingRegistryId() {
|
||||
return tradingClearingRegistryId;
|
||||
}
|
||||
|
||||
public void setTradingClearingRegistryId(Long value) {
|
||||
this.tradingClearingRegistryId = value;
|
||||
public void setSettlementAmount(BigDecimal settlementAmount) {
|
||||
this.settlementAmount = settlementAmount;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String value) {
|
||||
this.comment = value;
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Long getClientCodeId() {
|
||||
return clientCodeId;
|
||||
}
|
||||
|
||||
public void setClientCodeId(Long value) {
|
||||
this.clientCodeId = value;
|
||||
public void setClientCodeId(Long clientCodeId) {
|
||||
this.clientCodeId = clientCodeId;
|
||||
}
|
||||
|
||||
public String getSettlementCode() {
|
||||
return settlementCode;
|
||||
}
|
||||
|
||||
public void setSettlementCode(String value) {
|
||||
this.settlementCode = value;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long value) {
|
||||
this.companyId = value;
|
||||
}
|
||||
|
||||
public Long getCounterPartyId() {
|
||||
return counterPartyId;
|
||||
}
|
||||
|
||||
public void setCounterPartyId(Long value) {
|
||||
this.counterPartyId = value;
|
||||
}
|
||||
|
||||
public String getSecurityFullName() {
|
||||
return securityFullName;
|
||||
}
|
||||
|
||||
public void setSecurityFullName(String value) {
|
||||
this.securityFullName = value;
|
||||
public void setSettlementCode(String settlementCode) {
|
||||
this.settlementCode = settlementCode;
|
||||
}
|
||||
|
||||
public LocalDate getSettlementDate() {
|
||||
return settlementDate;
|
||||
}
|
||||
|
||||
public void setSettlementDate(LocalDate value) {
|
||||
this.settlementDate = value;
|
||||
}
|
||||
|
||||
public String getSettlementCurrency() {
|
||||
return settlementCurrency;
|
||||
}
|
||||
|
||||
public void setSettlementCurrency(String value) {
|
||||
this.settlementCurrency = value;
|
||||
public void setSettlementDate(LocalDate settlementDate) {
|
||||
this.settlementDate = settlementDate;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionMicroseconds() {
|
||||
return exchangeExecutionMicroseconds;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionMicroseconds(Instant value) {
|
||||
this.exchangeExecutionMicroseconds = value;
|
||||
public void setExchangeExecutionMicroseconds(Instant exchangeExecutionMicroseconds) {
|
||||
this.exchangeExecutionMicroseconds = exchangeExecutionMicroseconds;
|
||||
}
|
||||
|
||||
public String getCoverageStatus() {
|
||||
return coverageStatus;
|
||||
}
|
||||
|
||||
public void setCoverageStatus(String value) {
|
||||
this.coverageStatus = value;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long value) {
|
||||
this.sessionId = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ import java.time.LocalDate;
|
|||
* <p>
|
||||
* DB table: REGISTRY
|
||||
**/
|
||||
public class Registry extends BusinessObject {
|
||||
public class Registry extends BusinessObject implements Cloneable {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private Long companyId;
|
||||
|
|
@ -412,4 +412,13 @@ public class Registry extends BusinessObject {
|
|||
public void setPaymentId(Long paymentId) {
|
||||
this.paymentId = paymentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException("never", e); // it is Cloneable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.clearing.classes.statics.data.misc;
|
||||
package ru.clearing.classes.statics.data.security;
|
||||
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
|
||||
|
|
@ -11,12 +11,13 @@ import java.time.LocalDate;
|
|||
* DB table: MONEY_MARKET_SECURITY
|
||||
**/
|
||||
public class MoneyMarketSecurity extends Security {
|
||||
private Long securityId;// (linked to security)
|
||||
private Long securityId;
|
||||
private String description;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private BigDecimal nominalValue;
|
||||
private String nominalCurrency; // (linked to currencyCode)
|
||||
private String nominalCurrency;
|
||||
private String convention;
|
||||
private String termType;
|
||||
private BigDecimal lotSize;
|
||||
|
||||
|
|
@ -68,6 +69,14 @@ public class MoneyMarketSecurity extends Security {
|
|||
this.nominalCurrency = nominalCurrency;
|
||||
}
|
||||
|
||||
public String getConvention() {
|
||||
return convention;
|
||||
}
|
||||
|
||||
public void setConvention(String convention) {
|
||||
this.convention = convention;
|
||||
}
|
||||
|
||||
public String getTermType() {
|
||||
return termType;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.clearing.classes.statics.data.misc;
|
||||
package ru.clearing.classes.statics.data.security;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessEvent;
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package ru.clearing.classes.statics.data.security;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
/**
|
||||
* Инструменты денежного рынка, учавствующие в сделках
|
||||
* <p>
|
||||
* DB table: TRADED_MONEY_MARKET_SECURITY
|
||||
**/
|
||||
public class TradedMoneyMarketSecurity extends SpcexObjectBase {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private Long securityId;
|
||||
private String shortName;
|
||||
private String securityCode;
|
||||
|
||||
public Long getSecurityId() {
|
||||
return securityId;
|
||||
}
|
||||
|
||||
public void setSecurityId(Long value) {
|
||||
this.securityId = value;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String value) {
|
||||
this.shortName = value;
|
||||
}
|
||||
|
||||
public String getSecurityCode() {
|
||||
return securityCode;
|
||||
}
|
||||
|
||||
public void setSecurityCode(String value) {
|
||||
this.securityCode = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ public enum ClearingError implements IErrorEnumId {
|
|||
SecurityNotFound(5416L),
|
||||
TradingClearingRegistryNotFound(5418L),
|
||||
TradingClearingRegistryNotActive(5419L),
|
||||
InsecurityObligation(5422L),
|
||||
NewDealsNotFound(5423L),
|
||||
;
|
||||
private final Long id;
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package ru.spcex.clearing.models;
|
||||
|
||||
import ru.spcex.platform.enumeration.RegistryCapacity;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
|
||||
public record RegistryInfo(RegistryDesignation registryDesignation,
|
||||
RegistryInstrumentType registryInstrumentType,
|
||||
RegistryCapacity registryCapacity,
|
||||
RegistryUnit registryUnit) {
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package ru.spcex.clearing.models;
|
||||
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.platform.enumeration.RegistryCapacity;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
public record RegistryTradingParams(RegistryDesignation registryDesignation,
|
||||
RegistryInstrumentType registryInstrumentType,
|
||||
RegistryCapacity registryCapacity,
|
||||
RegistryUnit registryUnit) {
|
||||
|
||||
public boolean equalByRegistry(Registry registry) {
|
||||
boolean isEqualDesignation = this.registryDesignation == null || IEnumKey.getEnumByKey(RegistryDesignation.class, registry.getRegistryDesignation()) == this.registryDesignation;
|
||||
boolean isEqualInstrumentType = this.registryInstrumentType == null || IEnumKey.getEnumByKey(RegistryInstrumentType.class, registry.getRegistryInstrumentType()) == this.registryInstrumentType;
|
||||
boolean isEqualCapacity = this.registryCapacity == null || IEnumKey.getEnumByKey(RegistryCapacity.class, registry.getRegistryCapacity()) == this.registryCapacity;
|
||||
boolean isEqualUnit = this.registryUnit == null || IEnumKey.getEnumByKey(RegistryUnit.class, registry.getRegistryUnit()) == this.registryUnit;
|
||||
return isEqualDesignation && isEqualInstrumentType && isEqualCapacity && isEqualUnit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
|
|||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.models.RegistryInfo;
|
||||
import ru.spcex.clearing.models.RegistryTradingParams;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.clearing.CreateRegistryRequest;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
|
@ -42,7 +42,7 @@ public class RegistryService {
|
|||
log.trace("Found tradingClearingRegistry with id: {}", tcrByCompanyId.getId());
|
||||
Registry registry = new Registry();
|
||||
tcrByCompanyId.getTradingClearingRegistryType();
|
||||
RegistryInfo registryInfo = createRegistryInfoByType(tcrByCompanyId.getTradingClearingRegistryType());
|
||||
RegistryTradingParams registryInfo = createRegistryInfoByType(tcrByCompanyId.getTradingClearingRegistryType());
|
||||
registry.setRegistryDesignation(registryInfo.registryDesignation().getKey());
|
||||
registry.setRegistryInstrumentType(registryInfo.registryInstrumentType().getKey());
|
||||
registry.setRegistryCapacity(registryInfo.registryCapacity().getKey());
|
||||
|
|
@ -55,20 +55,20 @@ public class RegistryService {
|
|||
|
||||
}
|
||||
|
||||
private RegistryInfo createRegistryInfoByType(String type){
|
||||
private RegistryTradingParams createRegistryInfoByType(String type){
|
||||
TradingClearingRegistryType registryType = IEnumKey.getEnumByKey(TradingClearingRegistryType.class, type);
|
||||
RegistryInfo registryInfo = null;
|
||||
RegistryTradingParams registryInfo = null;
|
||||
//todo спросить про дубль C и T
|
||||
switch (registryType){
|
||||
case Owner_A -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.M, RegistryCapacity.A, RegistryUnit.T);
|
||||
case Client_B -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.T);
|
||||
case Trustee_C, DepoOfShares_T -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.T);
|
||||
case TrusteeManager_D -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.A);
|
||||
case Issuer_E -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.E, RegistryUnit.R);
|
||||
case ToThePlacementOrRedeem_Z -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.Z, RegistryUnit.R);
|
||||
case DepoBond_H -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.R);
|
||||
case DepoOfTrustedBond_N -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.C, RegistryUnit.R);
|
||||
case DepoOfTrustedShares_S -> registryInfo = new RegistryInfo(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.C, RegistryUnit.T);
|
||||
case Owner_A -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.M, RegistryCapacity.A, RegistryUnit.T);
|
||||
case Client_B -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.T);
|
||||
case Trustee_C, DepoOfShares_T -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.T);
|
||||
case TrusteeManager_D -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.A);
|
||||
case Issuer_E -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.E, RegistryUnit.R);
|
||||
case ToThePlacementOrRedeem_Z -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.Z, RegistryUnit.R);
|
||||
case DepoBond_H -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.R);
|
||||
case DepoOfTrustedBond_N -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.C, RegistryUnit.R);
|
||||
case DepoOfTrustedShares_S -> registryInfo = new RegistryTradingParams(RegistryDesignation.A, RegistryInstrumentType.S, RegistryCapacity.C, RegistryUnit.T);
|
||||
}
|
||||
return registryInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package ru.spcex.clearing.service.builder.sql;
|
||||
|
||||
import ru.spcex.clearing.models.RegistryTradingParams;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RegistryCodeSqlBuilder {
|
||||
|
||||
private List<RegistryTradingParams> registryTradingParams;
|
||||
|
||||
public static RegistryCodeSqlBuilder getInstance(RegistryTradingParams... tradingParams) {
|
||||
return new RegistryCodeSqlBuilder(Arrays.asList(tradingParams));
|
||||
}
|
||||
|
||||
private RegistryCodeSqlBuilder(List<RegistryTradingParams> tradingParams) {
|
||||
this.registryTradingParams = tradingParams;
|
||||
}
|
||||
|
||||
public String build() {
|
||||
List<StringBuilder> conditions = new ArrayList<>();
|
||||
for (RegistryTradingParams tradingParams : this.registryTradingParams) {
|
||||
StringBuilder condition = new StringBuilder();
|
||||
boolean wasAddedCondition = false;
|
||||
if (tradingParams.registryDesignation() != null) {
|
||||
condition.append(String.format("registryDesignation = '%s'", tradingParams.registryDesignation().getKey()));
|
||||
wasAddedCondition = true;
|
||||
}
|
||||
if (wasAddedCondition) {
|
||||
condition.append(" and ");
|
||||
wasAddedCondition = false;
|
||||
}
|
||||
if (tradingParams.registryInstrumentType() != null) {
|
||||
condition.append(String.format("registryInstrumentType = '%s'", tradingParams.registryInstrumentType().getKey()));
|
||||
wasAddedCondition = true;
|
||||
}
|
||||
if (wasAddedCondition) {
|
||||
condition.append(" and ");
|
||||
wasAddedCondition = false;
|
||||
}
|
||||
if (tradingParams.registryCapacity() != null) {
|
||||
condition.append(String.format("registryCapacity = '%s'", tradingParams.registryCapacity().getKey()));
|
||||
wasAddedCondition = true;
|
||||
}
|
||||
if (wasAddedCondition) {
|
||||
condition.append(" and ");
|
||||
wasAddedCondition = false;
|
||||
}
|
||||
if (tradingParams.registryUnit() != null) {
|
||||
condition.append(String.format("registryUnit = '%s'", tradingParams.registryUnit().getKey()));
|
||||
}
|
||||
conditions.add(condition);
|
||||
}
|
||||
return conditions.stream().collect(Collectors.joining(") or (", "(", ")"));
|
||||
}
|
||||
}
|
||||
|
|
@ -11,5 +11,27 @@ public enum TaskType {
|
|||
* step 1
|
||||
*/
|
||||
DealsPrepare,
|
||||
/**
|
||||
* step 2
|
||||
*/
|
||||
RequirementsAndObligationsCreate,
|
||||
/**
|
||||
* step 4
|
||||
*/
|
||||
InclusionToPool,
|
||||
|
||||
/**
|
||||
* Step 6: forming Registry on Obligations and Settlement requirements
|
||||
*/
|
||||
FormingRegistersOnOS,
|
||||
/**
|
||||
* step 7
|
||||
*/
|
||||
FormingPaymentInstruction,
|
||||
|
||||
|
||||
/**
|
||||
* step 8
|
||||
*/
|
||||
UnlockResources,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,14 @@ import ru.spcex.platform.classes.base.interfaces.IExecution;
|
|||
import ru.spcex.platform.classes.base.interfaces.WithExchangeExecutionId;
|
||||
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.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
|
@ -27,6 +31,8 @@ public class DealsPrepare implements ISessionStage {
|
|||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final Imdg<ExecutionDeposit> executionDepositImdg;
|
||||
private final Imdg<ExecutionFond> executionFondImdg;
|
||||
private final List<ImdgPredicate> execDepositPredicates = new ArrayList<>();
|
||||
private final List<ImdgPredicate> execFondPredicates = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
public DealsPrepare(ImdgProvider imdgProvider) {
|
||||
|
|
@ -50,13 +56,24 @@ public class DealsPrepare implements ISessionStage {
|
|||
private StageResult<?> prepareDeals(Long sessionId, Long companyId, Long securityId) {
|
||||
StringBuilder executionDepositSQL = new StringBuilder("sessionId = null");
|
||||
if (companyId != null) {
|
||||
executionDepositSQL.append(" and companyId = ").append(companyId);
|
||||
executionDepositSQL.append(" and companyId = ").append(companyId); //fixme вероятно в ТЗ недостаточно условий для выборки - counterPartyId
|
||||
}
|
||||
if (securityId != null) {
|
||||
executionDepositSQL.append(" and securityId = ").append(securityId);
|
||||
}
|
||||
Collection<ExecutionDeposit> excDpsts = executionDepositImdg.getCollectionObjectsBySQL(executionDepositSQL.toString());
|
||||
Collection<ExecutionFond> excFonds = executionFondImdg.getCollectionObjectsBySQL(executionDepositSQL.toString());
|
||||
ImdgPredicate sqlPredicate = executionFondImdg.predicateBuilder().sql(executionDepositSQL.toString());
|
||||
BiFunction<List<ImdgPredicate>, Imdg<?>, ImdgPredicate> prdComposer = (imdgPredicates, imdg) -> {
|
||||
ImdgPredicateBuilder pb = imdg.predicateBuilder();
|
||||
if (imdgPredicates.isEmpty()) {
|
||||
return sqlPredicate;
|
||||
} else {
|
||||
return pb.and(sqlPredicate, pb.and(execDepositPredicates.toArray(new ImdgPredicate[0])));
|
||||
}
|
||||
};
|
||||
ImdgPredicate excDepPrct = prdComposer.apply(execDepositPredicates, executionDepositImdg);
|
||||
ImdgPredicate excFondPrct = prdComposer.apply(execFondPredicates, executionFondImdg);
|
||||
Collection<ExecutionDeposit> excDpsts = executionDepositImdg.getCollectionObjectsByPredicate(excDepPrct);
|
||||
Collection<ExecutionFond> excFonds = executionFondImdg.getCollectionObjectsByPredicate(excFondPrct);
|
||||
List<IExecution> excs = Stream.concat(excDpsts.stream().map(execToInterface()),
|
||||
excFonds.stream().map(execToInterface()))
|
||||
.sorted(Comparator.comparing(WithExchangeExecutionId::getExchangeExecutionId))
|
||||
|
|
@ -69,11 +86,23 @@ public class DealsPrepare implements ISessionStage {
|
|||
executionFondImdg.update((ExecutionFond) exc);
|
||||
}
|
||||
}
|
||||
StageResult<Collection<IExecution>> res = new StageResult<>(null, true);
|
||||
StageResult<List<IExecution>> res = new StageResult<>(null, true);
|
||||
res.setStageResult(excs);
|
||||
return res;
|
||||
}
|
||||
|
||||
public DealsPrepare addExecutionDepositCondition(ImdgPredicate imdgPredicate) {
|
||||
this.execDepositPredicates.add(imdgPredicate);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DealsPrepare addExecutionFondCondition(ImdgPredicate imdgPredicate) {
|
||||
this.execFondPredicates.add(imdgPredicate);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static <E extends IExecution> Function<E, IExecution> execToInterface() {
|
||||
return (e) -> e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,197 @@
|
|||
package ru.spcex.clearing.session.stage.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.models.RegistryTradingParams;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.service.builder.sql.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
import ru.spcex.clearing.session.stage.StageResult;
|
||||
import ru.spcex.clearing.session.stage.Task;
|
||||
import ru.spcex.clearing.session.stage.task.InspectionPoolPayload;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
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.enumeration.IMessageResolver;
|
||||
import ru.spcex.platform.utils.enumeration.SimpleMessageResolver;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FormingPaymentInstruction implements ISessionStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
//todo remove (set all in single method setImdg(provider -> setImdg1();setIdGenerator();...)
|
||||
private ImdgProvider imdgProvider;
|
||||
private ImdgId idGenerator;
|
||||
private Imdg<Registry> registryImdg;
|
||||
private Imdg<PaymentInstruction> paymentInstructionImdg;
|
||||
private KafkaSender kafkaSender;
|
||||
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
||||
|
||||
@Autowired
|
||||
public FormingPaymentInstruction(ImdgProvider imdgProvider) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.idGenerator = imdgProvider.getImdgIdGenerator();
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResult submit(Task<?> task) {
|
||||
InspectionPoolPayload payload = (InspectionPoolPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case FormingPaymentInstruction -> {
|
||||
return formingPaymentInstruction(payload.getProcessedCompanyId());
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private StageResult formingPaymentInstruction(Long processedCompanyId) {
|
||||
RegistryTradingParams registryTradingParamsL = new RegistryTradingParams(RegistryDesignation.L,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.T);
|
||||
RegistryTradingParams registryTradingParamsC = new RegistryTradingParams(RegistryDesignation.C,
|
||||
RegistryInstrumentType.M, null, null);
|
||||
RegistryCodeSqlBuilder registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParamsL, registryTradingParamsC);
|
||||
String registryCodeCondition = registryCodeSqlBuilder.build();
|
||||
|
||||
Collection<Registry> obligations = registryImdg.getCollectionObjectsBySQL(registryCodeCondition);
|
||||
|
||||
List<Registry> obligationsByMoney = obligations.stream().filter(registry ->
|
||||
new RegistryTradingParams(RegistryDesignation.L, RegistryInstrumentType.M, null, RegistryUnit.T).equalByRegistry(registry))
|
||||
.toList();
|
||||
|
||||
for (Registry obligationByMoney : obligationsByMoney) {
|
||||
String sql = String.format("tradingClearingRegistryId = %s and companyId = %s",
|
||||
obligationByMoney.getTradingClearingRegistryId(), obligationByMoney.getCompanyId());
|
||||
Collection<Registry> relatedRegistries = registryImdg.getCollectionObjectsBySQL(sql);
|
||||
|
||||
RegistryTradingParams registryTradingParamsF = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.M, null, RegistryUnit.F);
|
||||
RegistryTradingParams registryTradingParamsT = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.M, null, RegistryUnit.T);
|
||||
RegistryTradingParams registryTradingParamsB = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.M, null, RegistryUnit.B);
|
||||
|
||||
for (Registry relatedRegistry : relatedRegistries) {
|
||||
if (registryTradingParamsF.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setBalance(relatedRegistry.getBalance().subtract(obligationByMoney.getBalance()));
|
||||
} else if (registryTradingParamsT.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setSettledDebit(relatedRegistry.getSettledDebit().add(obligationByMoney.getBalance()));
|
||||
} else if (registryTradingParamsB.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setBalance(relatedRegistry.getBalance().add(obligationByMoney.getBalance()));
|
||||
}
|
||||
registryImdg.update(relatedRegistry);
|
||||
}
|
||||
}
|
||||
|
||||
List<Registry> requirementsByIssue = obligations.stream().filter(registry ->
|
||||
new RegistryTradingParams(RegistryDesignation.C, RegistryInstrumentType.S, null, RegistryUnit.T).equalByRegistry(registry))
|
||||
.toList();
|
||||
|
||||
for (Registry requirementByIssue : requirementsByIssue) {
|
||||
String sql = String.format("tradingClearingRegistryId = %s and companyId = %s",
|
||||
requirementByIssue.getTradingClearingRegistryId(), requirementByIssue.getCompanyId());
|
||||
Collection<Registry> relatedRegistries = registryImdg.getCollectionObjectsBySQL(sql);
|
||||
|
||||
RegistryTradingParams registryTradingParamsA = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.T);
|
||||
|
||||
for (Registry relatedRegistry : relatedRegistries) {
|
||||
if (registryTradingParamsA.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setSettledDebit(relatedRegistry.getSettledDebit().add(requirementByIssue.getBalance()));
|
||||
}
|
||||
registryImdg.update(relatedRegistry);
|
||||
}
|
||||
}
|
||||
|
||||
List<Registry> requirementsByMoney = obligations.stream().filter(registry ->
|
||||
new RegistryTradingParams(RegistryDesignation.C, RegistryInstrumentType.M, null, RegistryUnit.T).equalByRegistry(registry))
|
||||
.toList();
|
||||
|
||||
for (Registry requirementByMoney : requirementsByMoney) {
|
||||
String sql = String.format("tradingClearingRegistryId = %s and companyId = %s",
|
||||
requirementByMoney.getTradingClearingRegistryId(), requirementByMoney.getCompanyId());
|
||||
Collection<Registry> relatedRegistries = registryImdg.getCollectionObjectsBySQL(sql);
|
||||
|
||||
RegistryTradingParams registryTradingParamsA = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.M, null, RegistryUnit.T);
|
||||
|
||||
for (Registry relatedRegistry : relatedRegistries) {
|
||||
if (registryTradingParamsA.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setSettledDebit(relatedRegistry.getSettledDebit().add(requirementByMoney.getBalance()));
|
||||
}
|
||||
registryImdg.update(relatedRegistry);
|
||||
}
|
||||
}
|
||||
|
||||
List<Registry> obligationsByIssue = obligations.stream().filter(registry ->
|
||||
new RegistryTradingParams(RegistryDesignation.L, RegistryInstrumentType.S, null, RegistryUnit.T).equalByRegistry(registry))
|
||||
.toList();
|
||||
|
||||
for (Registry obligationByIssue : obligationsByIssue) {
|
||||
String sql = String.format("tradingClearingRegistryId = %s and companyId = %s",
|
||||
obligationByIssue.getTradingClearingRegistryId(), obligationByIssue.getCompanyId());
|
||||
Collection<Registry> relatedRegistries = registryImdg.getCollectionObjectsBySQL(sql);
|
||||
|
||||
RegistryTradingParams registryTradingParamsF = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.F);
|
||||
RegistryTradingParams registryTradingParamsT = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.T);
|
||||
RegistryTradingParams registryTradingParamsB = new RegistryTradingParams(RegistryDesignation.A,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.B);
|
||||
|
||||
for (Registry relatedRegistry : relatedRegistries) {
|
||||
if (registryTradingParamsF.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setBalance(relatedRegistry.getBalance().subtract(obligationByIssue.getBalance()));
|
||||
} else if (registryTradingParamsT.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setSettledDebit(relatedRegistry.getSettledDebit().add(obligationByIssue.getBalance()));
|
||||
} else if (registryTradingParamsB.equalByRegistry(relatedRegistry)) {
|
||||
relatedRegistry.setBalance(relatedRegistry.getBalance().add(obligationByIssue.getBalance()));
|
||||
}
|
||||
registryImdg.update(relatedRegistry);
|
||||
}
|
||||
}
|
||||
|
||||
for (Registry obligation : obligations) {
|
||||
RegistryTradingParams registryTradingParamsLT = new RegistryTradingParams(RegistryDesignation.L,
|
||||
null, null, RegistryUnit.T);
|
||||
registryCodeCondition = RegistryCodeSqlBuilder.getInstance(registryTradingParamsLT).build();
|
||||
String sqlCondition = String.format("(%s) and securityId = %s and tradingClearingRegistryId = %s and companyId = %s and counterPartyId = %s",
|
||||
registryCodeCondition, obligation.getSecurityId(), obligation.getTradingClearingRegistryId(), obligation.getCompanyId(), obligation.getCounterPartyId());
|
||||
Collection<Registry> registries = registryImdg.getCollectionObjectsBySQL(sqlCondition);
|
||||
|
||||
BigDecimal sumBalance = registries.stream().map(Registry::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
PaymentInstruction paymentInstruction = createPaymentInstruction(obligation, sumBalance);
|
||||
paymentInstructionImdg.insert(paymentInstruction);
|
||||
obligation.setPaymentId(paymentInstruction.getId());
|
||||
registryImdg.update(obligation);
|
||||
}
|
||||
|
||||
|
||||
//todo send message to queue for forming sDf03 and sDf12?
|
||||
|
||||
return new StageResult(null, true);
|
||||
}
|
||||
|
||||
private PaymentInstruction createPaymentInstruction(Registry registry, BigDecimal balance){
|
||||
PaymentInstruction paymentInstruction = new PaymentInstruction();
|
||||
paymentInstruction.setSenderId(registry.getCompanyId());
|
||||
paymentInstruction.setAddresseeId(registry.getCounterPartyId());
|
||||
//todo add builder for paymentInstruction
|
||||
return paymentInstruction;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package ru.spcex.clearing.session.stage.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
import ru.spcex.clearing.session.stage.StageResult;
|
||||
import ru.spcex.clearing.session.stage.Task;
|
||||
import ru.spcex.clearing.session.stage.task.RegistryOnObligationsAndSettlementRequirementsPayload;
|
||||
import ru.spcex.clearing.session.stage.util.RegistryUtil;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryStatus;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@Service
|
||||
public class FormingRegistersOnOS implements ISessionStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final ImdgId idSequence;
|
||||
private final Imdg<Registry> registryImdg;
|
||||
|
||||
@Autowired
|
||||
public FormingRegistersOnOS(ImdgProvider imdgProvider) {
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.idSequence = imdgProvider.getImdgIdGenerator();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResult<?> submit(Task<?> task) {
|
||||
RegistryOnObligationsAndSettlementRequirementsPayload payload = (RegistryOnObligationsAndSettlementRequirementsPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case FormingRegistersOnOS -> {
|
||||
return createRegistryOnObligationsAndSettlementRequirements(payload.getSessionId());
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select Registry by: registryCode = [O/T][S/M][*][T] & registryStatus=OK
|
||||
*
|
||||
* @param sessionId
|
||||
* @return
|
||||
*/
|
||||
protected Collection<Registry> selectRegistry(Long sessionId) {
|
||||
String registrySQL = "sessionId = " + sessionId;
|
||||
registrySQL += " and (registryDesignation=" + RegistryDesignation.O.getKey() + " or registryDesignation=" + RegistryDesignation.T.getKey() + ")";
|
||||
registrySQL += " and (registryInstrumentType=" + RegistryInstrumentType.S.getKey() + " or registryInstrumentType=" + RegistryInstrumentType.M.getKey() + ")";
|
||||
registrySQL += " and (registryUnit=" + RegistryUnit.T.getKey() + ")";
|
||||
registrySQL += " and registryStatus=" + RegistryStatus.OK.getKey() + ")";
|
||||
Collection<Registry> result = registryImdg.getCollectionObjectsBySQL(registrySQL);
|
||||
log.trace("Selected {} registry's by sql: {}", result.size(), registrySQL);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StageResult<?> createRegistryOnObligationsAndSettlementRequirements(Long sessionId) {
|
||||
Collection<Registry> forRegistries = selectRegistry(sessionId);
|
||||
ArrayList<Registry> newRegistries = new ArrayList<>();
|
||||
|
||||
//todo oreder by обрабатываться группами по полю registry.groupId
|
||||
//todo при перезапуске после незапланированного завершения стадии: надо ли проверять уже созданные регистры и не создавать дубликаты?
|
||||
|
||||
for (Registry registry : forRegistries) {
|
||||
Registry newRegistry = createRegistryFor(registry);
|
||||
newRegistries.add(newRegistry);
|
||||
registryImdg.insert(newRegistry);
|
||||
log.trace("For registry {} (registryCode={}) make new registry {} (registryCode={})",
|
||||
registry.getId(), registry.getRegistryCode(), newRegistry.getId(), newRegistry.getRegistryCode());
|
||||
}
|
||||
|
||||
StageResult<Collection<Registry>> res = new StageResult<>(null, true);
|
||||
res.setStageResult(newRegistries);
|
||||
return res;
|
||||
}
|
||||
|
||||
Registry createRegistryFor(Registry forRegistry) {
|
||||
Registry newRegistry = (Registry) forRegistry.clone();// cloneable
|
||||
newRegistry.setId(idSequence.nextId());
|
||||
newRegistry.setCreated(Instant.now());
|
||||
newRegistry.setUpdated(newRegistry.getCreated());
|
||||
|
||||
String newRegDestination;
|
||||
if (RegistryDesignation.O.equalsByKey(forRegistry.getRegistryDesignation())) {
|
||||
newRegDestination = RegistryDesignation.L.getKey();
|
||||
} else if (RegistryDesignation.T.equalsByKey(forRegistry.getRegistryDesignation())) {
|
||||
newRegDestination = RegistryDesignation.C.getKey();
|
||||
} else {
|
||||
throw new IllegalArgumentException("RegistryDesignation=" + forRegistry.getRegistryDesignation());
|
||||
}
|
||||
newRegistry.setRegistryDesignation(newRegDestination);
|
||||
|
||||
String newRegistryInstrumentType; // по ТЗ не меняется
|
||||
if (RegistryInstrumentType.S.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
||||
newRegistryInstrumentType = RegistryInstrumentType.S.getKey();
|
||||
} else if (RegistryInstrumentType.M.equalsByKey(forRegistry.getRegistryInstrumentType())) {
|
||||
newRegistryInstrumentType = RegistryInstrumentType.M.getKey();
|
||||
} else {
|
||||
throw new IllegalArgumentException("RegistryInstrumentType=" + forRegistry.getRegistryInstrumentType());
|
||||
}
|
||||
newRegistry.setRegistryInstrumentType(newRegistryInstrumentType);
|
||||
|
||||
newRegistry.setRegistryCode(RegistryUtil.clearingCode(newRegistry));
|
||||
return newRegistry;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package ru.spcex.clearing.session.stage.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
import ru.spcex.clearing.session.stage.StageResult;
|
||||
import ru.spcex.clearing.session.stage.Task;
|
||||
import ru.spcex.clearing.session.stage.task.InclusionToPoolPayload;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class InclusionObligations implements ISessionStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
//todo remove (set all in single method setImdg(provider -> setImdg1();setIdGenerator();...)
|
||||
private ImdgProvider imdgProvider;
|
||||
private ImdgId idGenerator;
|
||||
private Imdg<Registry> registryImdg;
|
||||
private KafkaSender kafkaSender;
|
||||
|
||||
@Autowired
|
||||
public InclusionObligations(ImdgProvider imdgProvider) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.idGenerator = imdgProvider.getImdgIdGenerator();
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResult submit(Task<?> task) {
|
||||
InclusionToPoolPayload payload = (InclusionToPoolPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case InclusionToPool -> {
|
||||
return inclusionToPool(payload.getSessionType(), payload.getCounterPartyId());
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private StageResult inclusionToPool(String sessionType, Long counterPartyId) {
|
||||
String sqlCondition = String.format("registryDesignation in ('%s', '%s') and " +
|
||||
"registryInstrumentType in ('%s', '%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"registryStatus = '%s' and " +
|
||||
"settlementDate = '%s' and " +
|
||||
"sessionType = '%s'",
|
||||
"O", "T",
|
||||
"S", "M",
|
||||
"T",
|
||||
"PROC",
|
||||
LocalDate.now(),
|
||||
sessionType);
|
||||
Collection<Registry> obligations = registryImdg.getCollectionObjectsBySQL(sqlCondition);
|
||||
Map<Long, List<Registry>> registryByGroupId = obligations.stream().
|
||||
collect(Collectors.groupingBy(Registry::getGroupId));
|
||||
|
||||
for (Map.Entry<Long, List<Registry>> entrySet : registryByGroupId.entrySet()) {
|
||||
log.debug("Processing set of registry with groupId: {}", entrySet.getKey());
|
||||
for (Registry registry : entrySet.getValue()) {
|
||||
registry.setRegistryStatus("POOL");
|
||||
registryImdg.update(registry);
|
||||
}
|
||||
}
|
||||
|
||||
return new StageResult(null, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package ru.spcex.clearing.session.stage.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
import ru.spcex.clearing.session.stage.StageResult;
|
||||
import ru.spcex.clearing.session.stage.Task;
|
||||
import ru.spcex.clearing.session.stage.task.InspectionPoolPayload;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
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.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
import ru.spcex.platform.utils.enumeration.SimpleMessageResolver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class InspectionObligations implements ISessionStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
//todo remove (set all in single method setImdg(provider -> setImdg1();setIdGenerator();...)
|
||||
private ImdgProvider imdgProvider;
|
||||
private ImdgId idGenerator;
|
||||
private Imdg<Registry> registryImdg;
|
||||
private KafkaSender kafkaSender;
|
||||
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
||||
|
||||
@Autowired
|
||||
public InspectionObligations(ImdgProvider imdgProvider) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.idGenerator = imdgProvider.getImdgIdGenerator();
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResult submit(Task<?> task) {
|
||||
InspectionPoolPayload payload = (InspectionPoolPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case InclusionToPool -> {
|
||||
return inspectionPool(payload.getProcessedCompanyId());
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private StageResult inspectionPool(Long processedCompanyId) {
|
||||
String sqlCondition = String.format("registryDesignation in ('%s', '%s') and " +
|
||||
"registryInstrumentType in ('%s', '%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"registryStatus = '%s' and " +
|
||||
"settlementDate = '%s'",
|
||||
RegistryDesignation.O.getKey(), RegistryDesignation.T.getKey(),
|
||||
RegistryInstrumentType.S.getKey(), RegistryInstrumentType.M.getKey(),
|
||||
RegistryUnit.T.getKey(),
|
||||
"POOL");
|
||||
|
||||
Collection<Registry> obligations = registryImdg.getCollectionObjectsBySQL(sqlCondition);
|
||||
Map<Long, Map<Long, List<Registry>>> registryByGroupIdAndCompanyId = obligations.stream().
|
||||
collect(Collectors.groupingBy(Registry::getGroupId, Collectors.groupingBy(Registry::getCompanyId)));
|
||||
|
||||
List<Long> insecurityGroups = new ArrayList<>();
|
||||
for (Registry currentRegistry : obligations) {
|
||||
if (insecurityGroups.contains(currentRegistry.getGroupId())) {
|
||||
log.debug("Skip insecurity groupId: {}", currentRegistry.getGroupId());
|
||||
continue;
|
||||
}
|
||||
if (IEnumKey.getEnumByKey(RegistryDesignation.class, currentRegistry.getRegistryDesignation()) == RegistryDesignation.A) {
|
||||
String sqlCounterRegistryCondition = String.format("registryDesignation = '%s' and " +
|
||||
"registryInstrumentType in ('%s', '%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"tradingClearingRegistryId = '%s' and " +
|
||||
"companyId = '%s' and ",
|
||||
RegistryDesignation.A,
|
||||
RegistryInstrumentType.S.getKey(), RegistryInstrumentType.M.getKey(),
|
||||
RegistryUnit.F.getKey(),
|
||||
currentRegistry.getTradingClearingRegistryId(),
|
||||
currentRegistry.getCompanyId());
|
||||
Registry counterRegistry = registryImdg.getSingleObjectBySQL(sqlCounterRegistryCondition);
|
||||
if (currentRegistry.getBalance().compareTo(counterRegistry.getBalance()) > 0) {
|
||||
log.warn("{}", msgResolver.resolve(new EnumMessage(ClearingError.InsecurityObligation, currentRegistry.getCompanyId())));
|
||||
insecurityGroups.add(currentRegistry.getGroupId());
|
||||
break;
|
||||
}
|
||||
currentRegistry.setRegistryStatus("OK");
|
||||
registryImdg.update(counterRegistry);
|
||||
}
|
||||
}
|
||||
|
||||
for (Long insecuritiesGroupId : insecurityGroups) {
|
||||
for (Map.Entry<Long, List<Registry>> entrySet : registryByGroupIdAndCompanyId.get(insecuritiesGroupId).entrySet()) {
|
||||
if (entrySet.getKey().equals(processedCompanyId)) {
|
||||
for (Registry registry : entrySet.getValue()) {
|
||||
registry.setRegistryStatus("UNCV");
|
||||
registryImdg.update(registry);
|
||||
}
|
||||
} else {
|
||||
for (Registry registry : entrySet.getValue()) {
|
||||
registry.setRegistryStatus("FAIL");
|
||||
registryImdg.update(registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new StageResult(null, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package ru.spcex.clearing.session.stage.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
import ru.spcex.clearing.session.stage.StageResult;
|
||||
import ru.spcex.clearing.session.stage.Task;
|
||||
import ru.spcex.clearing.session.stage.task.UnlockResourcesPayload;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
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.util.Collection;
|
||||
|
||||
@Service
|
||||
public class UnlockResources implements ISessionStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final Imdg<Registry> registryImdg;
|
||||
|
||||
@Autowired
|
||||
public UnlockResources(ImdgProvider imdgProvider) {
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResult<?> submit(Task<?> task) {
|
||||
switch (task.getTaskType()) {
|
||||
case UnlockResources -> {
|
||||
UnlockResourcesPayload payload = (UnlockResourcesPayload) task.getData();
|
||||
return unlockResources(payload.getSdfMode(), payload.getSessionId(),
|
||||
payload.getAccount(),
|
||||
payload.getSecurityId(),
|
||||
payload.getFullNames(),
|
||||
payload.getValue()
|
||||
);
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select Registry by: account; fullName* / securityId
|
||||
*/
|
||||
protected Collection<Registry> selectRegistry(Long sessionId, String account, Long securityId, Collection<String> fullNames) {
|
||||
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
||||
ImdgPredicate queryPart;
|
||||
if (securityId != null) {
|
||||
queryPart = pb.in("securityId", securityId);
|
||||
} else if (fullNames != null && !fullNames.isEmpty()) {
|
||||
queryPart = pb.in("fullName", fullNames.toArray(new String[fullNames.size()]));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Required securityId or fullNames");
|
||||
}
|
||||
ImdgPredicate query = pb.and(
|
||||
pb.and(
|
||||
pb.equals("sessionId", sessionId),
|
||||
pb.equals("registryDesignation", RegistryDesignation.A.getKey()) // не все нужны, только с этим кодом отфильтруем.
|
||||
),
|
||||
pb.equals("account", account),
|
||||
queryPart
|
||||
);
|
||||
|
||||
Collection<Registry> result = registryImdg.getCollectionObjectsByPredicate(query);
|
||||
log.trace("Selected {} registry's by sql: {}", result.size(), query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sdfMode UnlockResourcesPayload.sdfMode
|
||||
* @param sessionId
|
||||
* @param account
|
||||
* @param securityId
|
||||
* @param fullNames
|
||||
* @return
|
||||
*/
|
||||
protected StageResult<?> unlockResources(String sdfMode, Long sessionId, String account, Long securityId, Collection<String> fullNames, BigDecimal value) {
|
||||
Collection<Registry> forRegistries = selectRegistry(sessionId, account, securityId, fullNames);
|
||||
|
||||
//todo при перезапуске после незапланированного завершения стадии: надо ли проверять уже созданные регистры и не создавать дубликаты?
|
||||
if (UnlockResourcesPayload.MODE_SDF04.equals(sdfMode)) {
|
||||
forRegistries = forRegistries.stream().filter(
|
||||
(Registry r) ->
|
||||
RegistryDesignation.A.equalsByKey(r.getRegistryDesignation())
|
||||
&&
|
||||
RegistryInstrumentType.M.equalsByKey(r.getRegistryInstrumentType())
|
||||
&&
|
||||
(RegistryUnit.F.equalsByKey(r.getRegistryUnit()) || RegistryUnit.B.equalsByKey(r.getRegistryUnit()))
|
||||
).toList();
|
||||
} else if (UnlockResourcesPayload.MODE_SDF12.equals(sdfMode)) {
|
||||
forRegistries = forRegistries.stream().filter(
|
||||
(Registry r) ->
|
||||
RegistryDesignation.A.equalsByKey(r.getRegistryDesignation())
|
||||
&&
|
||||
RegistryInstrumentType.S.equalsByKey(r.getRegistryInstrumentType())
|
||||
&&
|
||||
(RegistryUnit.F.equalsByKey(r.getRegistryUnit()) || RegistryUnit.B.equalsByKey(r.getRegistryUnit()))
|
||||
).toList();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Mode not support: " + sdfMode);
|
||||
}
|
||||
|
||||
for (Registry registry : forRegistries) {
|
||||
boolean modified = unlockRegistry(registry, value);
|
||||
if (modified) {
|
||||
registry.setUpdated(Instant.now());
|
||||
registryImdg.update(registry);
|
||||
log.trace("Registry {} changed; value +- registry",
|
||||
registry.getId(), registry.getRegistryCode(), value);
|
||||
}
|
||||
}
|
||||
//todo рекомендуется делать транзакцией.
|
||||
|
||||
StageResult<Collection<Registry>> res = new StageResult<>(null, true);
|
||||
res.setStageResult(forRegistries);
|
||||
return res;
|
||||
}
|
||||
|
||||
boolean unlockRegistry(Registry registry, BigDecimal value) {
|
||||
if (RegistryUnit.F.equalsByKey(registry.getRegistryUnit())) {
|
||||
if (registry.getBalance() == null) registry.setBalance(BigDecimal.ZERO);
|
||||
registry.setBalance(registry.getBalance().add(value));
|
||||
return true;
|
||||
} else if (RegistryUnit.B.equalsByKey(registry.getRegistryUnit())) {
|
||||
if (registry.getBalance() == null) registry.setBalance(BigDecimal.ZERO);
|
||||
registry.setBalance(registry.getBalance().subtract(value));
|
||||
return true;
|
||||
} else {
|
||||
log.warn("For registry {} registryUnit={} unlock operation not implemented.",
|
||||
registry.getId(), registry.getRegistryUnit());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package ru.spcex.clearing.session.stage.task;
|
||||
|
||||
public class InclusionToPoolPayload {
|
||||
private String sessionType;
|
||||
private Long counterPartyId;
|
||||
|
||||
public String getSessionType() {
|
||||
return sessionType;
|
||||
}
|
||||
|
||||
public void setSessionType(String sessionType) {
|
||||
this.sessionType = sessionType;
|
||||
}
|
||||
|
||||
public Long getCounterPartyId() {
|
||||
return counterPartyId;
|
||||
}
|
||||
|
||||
public void setCounterPartyId(Long counterPartyId) {
|
||||
this.counterPartyId = counterPartyId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.spcex.clearing.session.stage.task;
|
||||
|
||||
public class InspectionPoolPayload {
|
||||
private Long processedCompanyId;
|
||||
|
||||
public Long getProcessedCompanyId() {
|
||||
return processedCompanyId;
|
||||
}
|
||||
|
||||
public void setProcessedCompanyId(Long processedCompanyId) {
|
||||
this.processedCompanyId = processedCompanyId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.session.stage.task;
|
||||
|
||||
public class RegistryOnObligationsAndSettlementRequirementsPayload {
|
||||
private Long sessionId;
|
||||
// private Long companyId;
|
||||
// private Long securityId;
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
// public Long getCompanyId() {
|
||||
// return companyId;
|
||||
// }
|
||||
//
|
||||
// public void setCompanyId(Long companyId) {
|
||||
// this.companyId = companyId;
|
||||
// }
|
||||
//
|
||||
// public Long getSecurityId() {
|
||||
// return securityId;
|
||||
// }
|
||||
//
|
||||
// public void setSecurityId(Long securityId) {
|
||||
// this.securityId = securityId;
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package ru.spcex.clearing.session.stage.task;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public class UnlockResourcesPayload {
|
||||
public static final String MODE_SDF04 = "sDf04";
|
||||
public static final String MODE_SDF12 = "sDf12";
|
||||
|
||||
/**
|
||||
* MODE_SDF04/MODE_SDF12
|
||||
*/
|
||||
private String sdfMode;
|
||||
|
||||
private Long sessionId;
|
||||
|
||||
/**
|
||||
* sDf04.c_acc_cred
|
||||
* sDf12.depoCodeSender
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* sDf04.(sbanknam1, sbanknam2 и т.д.)
|
||||
*/
|
||||
private List<String> fullNames;
|
||||
|
||||
/**
|
||||
* sDf12.securityCode
|
||||
*/
|
||||
private Long securityId;
|
||||
|
||||
/**
|
||||
* sDf04.pay_val
|
||||
* sDf12.quantity
|
||||
*/
|
||||
private BigDecimal value;
|
||||
|
||||
|
||||
|
||||
public String getSdfMode() {
|
||||
return sdfMode;
|
||||
}
|
||||
|
||||
public void setSdfMode(String sdfMode) {
|
||||
this.sdfMode = sdfMode;
|
||||
}
|
||||
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public List<String> getFullNames() {
|
||||
return fullNames;
|
||||
}
|
||||
|
||||
public void setFullNames(List<String> fullNames) {
|
||||
this.fullNames = fullNames;
|
||||
}
|
||||
|
||||
public Long getSecurityId() {
|
||||
return securityId;
|
||||
}
|
||||
|
||||
public void setSecurityId(Long securityId) {
|
||||
this.securityId = securityId;
|
||||
}
|
||||
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package ru.spcex.clearing.session.stage.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.platform.enumeration.RegistryCapacity;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class RegistryUtil {
|
||||
|
||||
|
||||
public static String clearingCode(Registry ofRegistry) {
|
||||
return clearingCode(ofRegistry.getRegistryDesignation(), ofRegistry.getRegistryInstrumentType(), ofRegistry.getRegistryCapacity(), ofRegistry.getRegistryUnit());
|
||||
}
|
||||
|
||||
public static String clearingCode(String registryDesignation, String registryInstrumentType, String registryCapacity, String registryUnit) {
|
||||
if (StringUtils.isEmpty(registryDesignation)) registryDesignation = "-";
|
||||
if (StringUtils.isEmpty(registryInstrumentType)) registryInstrumentType = "-";
|
||||
if (StringUtils.isEmpty(registryCapacity)) registryCapacity = "-";
|
||||
if (StringUtils.isEmpty(registryUnit)) registryUnit = "-";
|
||||
return registryDesignation + registryInstrumentType + registryCapacity + registryUnit;
|
||||
}
|
||||
|
||||
public static String clearingCode(RegistryDesignation registryDesignation, RegistryInstrumentType registryInstrumentType, RegistryCapacity registryCapacity, RegistryUnit registryUnit) {
|
||||
return registryDesignation.getKey() + registryInstrumentType.getKey() + registryCapacity.getKey() + registryUnit.getKey();
|
||||
}
|
||||
|
||||
public static Map<Long, List<Registry>> groupByGroupId(Collection<Registry> registries) {
|
||||
HashMap<Long, List<Registry>> groups = new HashMap<>();
|
||||
for (Registry reg : registries) {
|
||||
List<Registry> lst = groups.get(reg.getGroupId());
|
||||
if (lst == null) {
|
||||
lst = new ArrayList<>();
|
||||
groups.put(reg.getGroupId(), lst);
|
||||
}
|
||||
lst.add(reg);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package ru.spcex.clearing.service.builder.sql;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import ru.spcex.clearing.models.RegistryTradingParams;
|
||||
import ru.spcex.platform.enumeration.RegistryCapacity;
|
||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
|
||||
public class RegistryCodeSqlBuilderTest {
|
||||
|
||||
@Test
|
||||
public void testBuildByOneObject() {
|
||||
RegistryTradingParams registryTradingParams = new RegistryTradingParams(RegistryDesignation.C, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.R);
|
||||
RegistryCodeSqlBuilder registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams);
|
||||
String sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryDesignation = 'C' and registryInstrumentType = 'M' and registryCapacity = 'B' and registryUnit = 'R')", sql);
|
||||
|
||||
registryTradingParams = new RegistryTradingParams(null, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.R);
|
||||
registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams);
|
||||
sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryInstrumentType = 'M' and registryCapacity = 'B' and registryUnit = 'R')", sql);
|
||||
|
||||
registryTradingParams = new RegistryTradingParams(RegistryDesignation.C, null, null, RegistryUnit.R);
|
||||
registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams);
|
||||
sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryDesignation = 'C' and registryUnit = 'R')", sql);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildByFewObjects() {
|
||||
RegistryTradingParams registryTradingParams_first = new RegistryTradingParams(RegistryDesignation.C, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.R);
|
||||
RegistryTradingParams registryTradingParams_second = new RegistryTradingParams(RegistryDesignation.O, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.F);
|
||||
RegistryCodeSqlBuilder registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams_first, registryTradingParams_second);
|
||||
String sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryDesignation = 'C' and registryInstrumentType = 'M' and registryCapacity = 'B' and registryUnit = 'R')" +
|
||||
" or (registryDesignation = 'O' and registryInstrumentType = 'S' and registryCapacity = 'A' and registryUnit = 'F')", sql);
|
||||
|
||||
registryTradingParams_first = new RegistryTradingParams(null, RegistryInstrumentType.M, RegistryCapacity.B, RegistryUnit.R);
|
||||
registryTradingParams_second = new RegistryTradingParams(null, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.F);
|
||||
registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams_first, registryTradingParams_second);
|
||||
sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryInstrumentType = 'M' and registryCapacity = 'B' and registryUnit = 'R') or " +
|
||||
"(registryInstrumentType = 'S' and registryCapacity = 'A' and registryUnit = 'F')", sql);
|
||||
|
||||
registryTradingParams_first = new RegistryTradingParams(RegistryDesignation.C, null, null, RegistryUnit.R);
|
||||
registryTradingParams_second = new RegistryTradingParams(null, RegistryInstrumentType.S, RegistryCapacity.A, RegistryUnit.F);
|
||||
registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(registryTradingParams_first, registryTradingParams_second);
|
||||
sql = registryCodeSqlBuilder.build();
|
||||
Assertions.assertEquals("(registryDesignation = 'C' and registryUnit = 'R') or " +
|
||||
"(registryInstrumentType = 'S' and registryCapacity = 'A' and registryUnit = 'F')", sql);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package ru.spcex.clearing.session.stage.util;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class RegistryUtilTest {
|
||||
|
||||
@Test
|
||||
void clearingCode1() {
|
||||
assertEquals("OMAT", RegistryUtil.clearingCode("O", "M", "A", "T"));
|
||||
assertEquals("O-A-", RegistryUtil.clearingCode("O", "", "A", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void clearingCode2() {
|
||||
Registry reg = new Registry();
|
||||
reg.setRegistryDesignation("O");
|
||||
reg.setRegistryInstrumentType("M");
|
||||
reg.setRegistryCapacity("A");
|
||||
reg.setRegistryUnit("T");
|
||||
assertEquals("OMAT", RegistryUtil.clearingCode(reg));
|
||||
}
|
||||
}
|
||||
|
|
@ -65,6 +65,7 @@ public record FieldRequiredRule<R, V>(
|
|||
}
|
||||
|
||||
@Override
|
||||
// todo replace for error fieldName to fieldValue
|
||||
public Optional<EnumMessage> validate(ImdgValidationContext<R> context) {
|
||||
R validatedObject = context.getValidatedObject();
|
||||
V value = getter.apply(validatedObject);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-- DB version: 3.5.0.21
|
||||
-- DB version: 3.5.0.22
|
||||
/* Dictionaries */
|
||||
|
||||
-- allowed - Справочник признаков допустимости использования объектов
|
||||
|
|
@ -1164,7 +1164,7 @@ COMMENT ON COLUMN CURRENCY_HISTORY.ID IS 'Идентификатор запис
|
|||
|
||||
-- moneyMarketSecurity - Инструменты Денежного рынка
|
||||
DROP TABLE IF EXISTS MONEY_MARKET_SECURITY;
|
||||
CREATE TABLE MONEY_MARKET_SECURITY(SECURITY_ID bigint, DESCRIPTION varchar(255), START_DATE date, END_DATE date, NOMINAL_VALUE numeric(72,18), NOMINAL_CURRENCY varchar(4), TERM_TYPE varchar(4), ID bigint PRIMARY KEY);
|
||||
CREATE TABLE MONEY_MARKET_SECURITY(SECURITY_ID bigint, DESCRIPTION varchar(255), START_DATE date, END_DATE date, NOMINAL_VALUE numeric(72,18), NOMINAL_CURRENCY varchar(4), CONVENTION varchar(255), TERM_TYPE varchar(4), ID bigint PRIMARY KEY);
|
||||
COMMENT ON TABLE MONEY_MARKET_SECURITY IS 'Инструменты Денежного рынка';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY.SECURITY_ID IS 'Идентификатор инструмента (linked to security)';
|
||||
|
|
@ -1179,6 +1179,8 @@ COMMENT ON COLUMN MONEY_MARKET_SECURITY.NOMINAL_VALUE IS 'Номинал';
|
|||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY.NOMINAL_CURRENCY IS 'Код валюты номинала (linked to currencyCode)';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY.CONVENTION IS 'Нотация наименования инструмента';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY.TERM_TYPE IS 'Код вида инструмента (linked to termType)';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY.ID IS 'Идентификатор записи';
|
||||
|
|
@ -1186,7 +1188,7 @@ COMMENT ON COLUMN MONEY_MARKET_SECURITY.ID IS 'Идентификатор зап
|
|||
|
||||
-- History log of moneyMarketSecurity - Инструменты Денежного рынка
|
||||
DROP TABLE IF EXISTS MONEY_MARKET_SECURITY_HISTORY;
|
||||
CREATE TABLE MONEY_MARKET_SECURITY_HISTORY(MONEY_MARKET_SECURITY_ID BIGINT NOT NULL, EVENT_TIME timestamp, EVENT_USER_ID BIGINT, EVENT_TYPE VARCHAR(4), SECURITY_ID bigint, DESCRIPTION varchar(255), START_DATE date, END_DATE date, NOMINAL_VALUE numeric(72,18), NOMINAL_CURRENCY varchar(4), TERM_TYPE varchar(4), ID bigint PRIMARY KEY);
|
||||
CREATE TABLE MONEY_MARKET_SECURITY_HISTORY(MONEY_MARKET_SECURITY_ID BIGINT NOT NULL, EVENT_TIME timestamp, EVENT_USER_ID BIGINT, EVENT_TYPE VARCHAR(4), SECURITY_ID bigint, DESCRIPTION varchar(255), START_DATE date, END_DATE date, NOMINAL_VALUE numeric(72,18), NOMINAL_CURRENCY varchar(4), CONVENTION varchar(255), TERM_TYPE varchar(4), ID bigint PRIMARY KEY);
|
||||
COMMENT ON TABLE MONEY_MARKET_SECURITY_HISTORY IS 'История изменений таблицы moneyMarketSecurity';
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.MONEY_MARKET_SECURITY_ID IS 'Идентификатор записи в таблице MONEY_MARKET_SECURITY';
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.EVENT_TIME IS 'Дата и время изменения';
|
||||
|
|
@ -1205,10 +1207,23 @@ COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.NOMINAL_VALUE IS 'Номинал
|
|||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.NOMINAL_CURRENCY IS 'Код валюты номинала (linked to currencyCode)';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.CONVENTION IS 'Нотация наименования инструмента';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.TERM_TYPE IS 'Код вида инструмента (linked to termType)';
|
||||
|
||||
COMMENT ON COLUMN MONEY_MARKET_SECURITY_HISTORY.ID IS 'Идентификатор записи';
|
||||
|
||||
-- tradedMoneyMarketSecurity - Инструменты денежного рынка, учавствующие в сделках
|
||||
DROP TABLE IF EXISTS TRADED_MONEY_MARKET_SECURITY;
|
||||
CREATE TABLE TRADED_MONEY_MARKET_SECURITY(SECURITY_ID bigint, SECURITY_CODE varchar(255), ID bigint PRIMARY KEY);
|
||||
COMMENT ON TABLE TRADED_MONEY_MARKET_SECURITY IS 'Инструменты денежного рынка, учавствующие в сделках';
|
||||
|
||||
COMMENT ON COLUMN TRADED_MONEY_MARKET_SECURITY.SECURITY_ID IS 'Идентификатор инструмента (linked to security)';
|
||||
|
||||
COMMENT ON COLUMN TRADED_MONEY_MARKET_SECURITY.SECURITY_CODE IS 'Полный код инструмента со сроком';
|
||||
|
||||
COMMENT ON COLUMN TRADED_MONEY_MARKET_SECURITY.ID IS 'Идентификатор записи';
|
||||
|
||||
-- equitySecurity - Акции
|
||||
DROP TABLE IF EXISTS EQUITY_SECURITY;
|
||||
CREATE TABLE EQUITY_SECURITY(SECURITY_ID bigint, SHARE_TYPE varchar(4), ID bigint PRIMARY KEY);
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
package ru.spcex.clearing.imdg.businessevent;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.AccountBalance;
|
||||
import ru.clearing.classes.statics.data.account.AccountBalanceHistory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
@Deprecated
|
||||
//@Component
|
||||
public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<AccountBalanceHistory> {
|
||||
|
||||
public AccountBalanceHistoryMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_AccountBalanceHistory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "ACCOUNT_BALANCE_HISTORY";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
|
||||
"ACCOUNT_BALANCE_ID", "COMPANY_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT_ID", "ACCOUNT_TYPE",
|
||||
"ACCOUNT", "OPEN_BALANCE_AMOUNT", "START_BALANCE_AMOUNT", "CLOSE_BALANCE_AMOUNT",
|
||||
"TRADE_BALANCE_AMOUNT", "FREE_BALANCE_AMOUNT", "CHANGE_BALANCE_AMOUNT",
|
||||
"CREDIT_AMOUNT", "DEBIT_AMOUNT", "BALANCE_AMOUNT", "BALANCE_ACCOUNT_TYPE",
|
||||
"CLEARING_DATE", "CURRENCY_CODE", "TRADING_CODE", "SHORT_NAME", "FULL_NAME"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(AccountBalanceHistory updateLog) {
|
||||
AccountBalance object = updateLog.getObject();
|
||||
Object[] args = new Object[]{
|
||||
updateLog.getId(),
|
||||
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||
updateLog.getEventType(),
|
||||
updateLog.getUserId(),
|
||||
|
||||
object.getId(),
|
||||
object.getCompanyId(),
|
||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||
object.getAccountId(),
|
||||
object.getAccountType(),
|
||||
object.getAccount(),
|
||||
object.getOpenBalanceAmount(),
|
||||
object.getStartBalanceAmount(),
|
||||
object.getCloseBalanceAmount(),
|
||||
object.getTradeBalanceAmount(),
|
||||
object.getFreeBalanceAmount(),
|
||||
object.getChangeBalanceAmount(),
|
||||
object.getCreditAmount(),
|
||||
object.getDebitAmount(),
|
||||
object.getBalanceAmount(),
|
||||
object.getBalanceAccountType(),
|
||||
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||
object.getCurrencyCode(),
|
||||
object.getTradingCode(),
|
||||
object.getShortName(),
|
||||
object.getFullName()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,15 +3,10 @@ package ru.spcex.clearing.imdg.businessevent;
|
|||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurityHistory;
|
||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurityHistory;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class MoneyMarketSecurityHistoryMapStore extends ASecurityHistoryMapStore<MoneyMarketSecurityHistory> {
|
||||
|
||||
|
|
@ -34,7 +29,7 @@ public class MoneyMarketSecurityHistoryMapStore extends ASecurityHistoryMapStore
|
|||
public String[] getFields() {
|
||||
return new String[]{
|
||||
"ID", "EVENT_TIME", "EVENT_USER_ID", "EVENT_TYPE",
|
||||
"MONEY_MARKET_SECURITY_ID", "SECURITY_ID", "DESCRIPTION", "START_DATE", "END_DATE", "NOMINAL_VALUE", "NOMINAL_CURRENCY", "TERM_TYPE"};
|
||||
"MONEY_MARKET_SECURITY_ID", "SECURITY_ID", "DESCRIPTION", "START_DATE", "END_DATE", "NOMINAL_VALUE", "NOMINAL_CURRENCY", "TERM_TYPE", "CONVENTION"};
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -54,7 +49,8 @@ public class MoneyMarketSecurityHistoryMapStore extends ASecurityHistoryMapStore
|
|||
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getEndDate()),
|
||||
moneyMarketSecurity.getNominalValue(),
|
||||
moneyMarketSecurity.getNominalCurrency(),
|
||||
moneyMarketSecurity.getTermType()
|
||||
moneyMarketSecurity.getTermType(),
|
||||
moneyMarketSecurity.getConvention()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,13 @@ package ru.spcex.clearing.imdg.businessobject;
|
|||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class MoneyMarketSecurityMapStore extends ASecurityMapStore<MoneyMarketSecurity> {
|
||||
|
|
@ -41,7 +37,7 @@ public class MoneyMarketSecurityMapStore extends ASecurityMapStore<MoneyMarketSe
|
|||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{"ID", "SECURITY_ID", "DESCRIPTION", "START_DATE", "END_DATE", "NOMINAL_VALUE", "NOMINAL_CURRENCY", "TERM_TYPE"};
|
||||
return new String[]{"ID", "SECURITY_ID", "DESCRIPTION", "START_DATE", "END_DATE", "NOMINAL_VALUE", "NOMINAL_CURRENCY", "TERM_TYPE", "CONVENTION"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,6 +64,7 @@ public class MoneyMarketSecurityMapStore extends ASecurityMapStore<MoneyMarketSe
|
|||
object.setNominalValue(resultSet.getObject("NOMINAL_VALUE", BigDecimal.class));
|
||||
object.setNominalCurrency(resultSet.getObject("NOMINAL_CURRENCY", String.class));
|
||||
object.setTermType(resultSet.getObject("TERM_TYPE", String.class));
|
||||
object.setConvention(resultSet.getObject("CONVENTION", String.class));
|
||||
fillBySecurity(object, object.getSecurityId());
|
||||
return object;
|
||||
}
|
||||
|
|
@ -83,7 +80,8 @@ public class MoneyMarketSecurityMapStore extends ASecurityMapStore<MoneyMarketSe
|
|||
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getEndDate()),
|
||||
moneyMarketSecurity.getNominalValue(),
|
||||
moneyMarketSecurity.getNominalCurrency(),
|
||||
moneyMarketSecurity.getTermType()
|
||||
moneyMarketSecurity.getTermType(),
|
||||
moneyMarketSecurity.getConvention()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package ru.spcex.clearing.imdg.object;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.security.TradedMoneyMarketSecurity;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
public class TradedMoneyMarketSecurityMapStore extends TemplateMapStore<TradedMoneyMarketSecurity> {
|
||||
|
||||
public TradedMoneyMarketSecurityMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_TradedMoneyMarketSecurity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "TRADED_MONEY_MARKET_SECURITY";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{
|
||||
"SECURITY_ID", "SHORT_NAME", "SECURITY_CODE", "ID"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradedMoneyMarketSecurity objectReader(ResultSet resultSet) throws SQLException {
|
||||
TradedMoneyMarketSecurity object = new TradedMoneyMarketSecurity();
|
||||
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
||||
object.setShortName(resultSet.getObject("SHORT_NAME", String.class));
|
||||
object.setSecurityCode(resultSet.getObject("SECURITY_CODE", String.class));
|
||||
object.setId(resultSet.getObject("ID", Long.class));
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(TradedMoneyMarketSecurity object) {
|
||||
Object[] args = new Object[]{
|
||||
object.getSecurityId(),
|
||||
object.getShortName(),
|
||||
object.getSecurityCode(),
|
||||
object.getId()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@ import ru.clearing.classes.statics.data.instrument.issue.*;
|
|||
import ru.clearing.classes.statics.data.misc.*;
|
||||
import ru.clearing.classes.statics.data.profile.ProfileDocument;
|
||||
import ru.clearing.classes.statics.data.profile.ProfileDocumentHistory;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurityHistory;
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
import ru.clearing.classes.statics.data.security.SecurityHistory;
|
||||
import ru.clearing.classes.statics.data.user.User;
|
||||
|
|
@ -61,12 +63,7 @@ public class UpdateMapService extends AbstractUpdateMapService {
|
|||
protected void entryModified(EntryEvent<Long, Object> event, String eventType) {
|
||||
log.debug("{} {}", event, eventType);
|
||||
Object value = (EVENT_DELETE.equals(eventType) ? event.getOldValue() : event.getValue());
|
||||
if (value instanceof AccountBalance) {
|
||||
AccountBalanceHistory accountBalanceHistory = new AccountBalanceHistory();
|
||||
createBusinessEvent(accountBalanceHistory, eventType);
|
||||
accountBalanceHistory.setObject((AccountBalance) value);
|
||||
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountBalanceHistory).put(accountBalanceHistory.getId(), accountBalanceHistory);
|
||||
} else if (value instanceof Account) {
|
||||
if (value instanceof Account) {
|
||||
AccountHistory accountHistory = new AccountHistory();
|
||||
createBusinessEvent(accountHistory, eventType);
|
||||
accountHistory.setObject((Account) value);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import ru.clearing.classes.statics.data.profile.ProfileDocumentHistory;
|
|||
import ru.clearing.classes.statics.data.register.*;
|
||||
import ru.clearing.classes.statics.data.scheduler.*;
|
||||
import ru.clearing.classes.statics.data.sdf.*;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurityHistory;
|
||||
import ru.clearing.classes.statics.data.statement.Statement;
|
||||
import ru.clearing.classes.statics.data.user.*;
|
||||
import ru.clearing.platform.dictionary.*;
|
||||
|
|
|
|||
|
|
@ -40,17 +40,27 @@
|
|||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XML -->
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.19</version>
|
||||
</dependency>
|
||||
|
||||
<!-- DOC -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- CSV -->
|
||||
<dependency>
|
||||
<groupId>com.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
<version>5.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- IMDG clearing system -->
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
|
|
@ -83,6 +93,24 @@
|
|||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>security-util</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package ru.spcex.clearing.reports;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.naming.NoNameCoder;
|
||||
import com.thoughtworks.xstream.io.xml.XppDriver;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -10,11 +7,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import ru.spcex.clearing.reports.config.ReportCmdParser;
|
||||
import ru.spcex.clearing.reports.reports.bt_16_5.ReportINACCNT;
|
||||
import ru.spcex.clearing.reports.services.QCommandExecutor;
|
||||
import ru.spcex.clearing.reports.services.ReportsServiceCommand;
|
||||
import ru.spcex.clearing.reports.services.collector.ReportINACCNT_Collector;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ReportsServiceApplication {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package ru.spcex.clearing.reports.config;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import ru.spcex.clearing.reports.errors.ReportError;
|
||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||
import ru.spcex.clearing.util.services.IMDGMessageResolver;
|
||||
import ru.spcex.clearing.util.services.RequestHelper;
|
||||
import ru.spcex.platform.enumeration.UserRole;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
|
||||
@Configuration
|
||||
public class BeanConfiguration {
|
||||
@Bean
|
||||
public IMessageResolver messageResolver(ImdgProvider imdgProvider) {
|
||||
return new IMDGMessageResolver(imdgProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public UserRoleVerification userRoleVerification(ImdgProvider imdgProvider, IMessageResolver messageResolver) {
|
||||
return new UserRoleVerification(imdgProvider, messageResolver, UserRole.Admin, ReportError.UserVerifyDenial);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public RequestHelper requestHelper(IMessageResolver messageResolver) {
|
||||
return new RequestHelper(messageResolver, ReportError.InternalError);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,9 +20,9 @@ public class KafkaConfig {
|
|||
return KafkaConsumerFactory.consumer(settings.getKafkaConsumer());
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
// @Bean
|
||||
// public Producer<String, Object> createProducer(ReportsServiceSettings settings) {
|
||||
// return KafkaProducerFactory.producer(settings.getKafkaProducer());
|
||||
// }
|
||||
@Autowired
|
||||
@Bean
|
||||
public Producer<String, Object> createProducer(ReportsServiceSettings settings) {
|
||||
return KafkaProducerFactory.producer(settings.getKafkaProducer());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package ru.spcex.clearing.reports.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.spcex.clearing.reports.reports.*;
|
||||
import ru.spcex.clearing.reports.reports.bp.*;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class ReportBuildersConfig {
|
||||
@Bean("reportBuildersWithoutParams")
|
||||
public Map<ReportType, List<CSVReportBuilder<EmptyParams>>> reportBuildersWithoutParams(ImdgProvider imdgProvider) {
|
||||
Map<ReportType, List<CSVReportBuilder<EmptyParams>>> resultMap = new HashMap<>();
|
||||
resultMap.put(ReportType.SUMMARY_LIABILITIES_CLAIMS, List.of(new SummaryLiabilitiesClaimsReportBuilder(imdgProvider)));
|
||||
resultMap.put(ReportType.SUMMARY_MONEY_CHANGE, List.of(new SummaryMoneyChangeReportBuilder(imdgProvider)));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Bean("reportBuildersWithSessionIdParam")
|
||||
public Map<ReportType, List<CSVReportBuilder<SessionIdParam>>> reportBuildersWithSessionIdParam(ImdgProvider imdgProvider) {
|
||||
Map<ReportType, List<CSVReportBuilder<SessionIdParam>>> resultMap = new HashMap<>();
|
||||
resultMap.put(ReportType.OPERATIONAL_LIABILITIES_CLAIMS, List.of(new OperationalLiabilitiesClaimsReportBuilder(imdgProvider)));
|
||||
resultMap.put(ReportType.OPERATIONAL_MONEY_CHANGE, List.of(new OperationalMoneyChangeReportBuilder(imdgProvider)));
|
||||
resultMap.put(ReportType.EXECUTED_DEAL_REPORT,
|
||||
List.of(
|
||||
new ExecutedDealReportBuilder_INFTYPE_1(imdgProvider),
|
||||
new ExecutedDealReportBuilder_INFTYPE_2(imdgProvider),
|
||||
new ExecutedDealReportBuilder_INFTYPE_3(imdgProvider),
|
||||
new ExecutedDealReportBuilder_INFTYPE_4(imdgProvider)
|
||||
)
|
||||
);
|
||||
resultMap.put(ReportType.UNFULFILLED_DEAL_REPORT, List.of(new UnfulfilledDealReportBuilder(imdgProvider)));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Bean("reportBuildersWithSessionIdListParam")
|
||||
public Map<ReportType, List<CSVReportBuilder<SessionIdListParams>>> reportBuildersWithSessionIdListParams(ImdgProvider imdgProvider) {
|
||||
Map<ReportType, List<CSVReportBuilder<SessionIdListParams>>> resultMap = new HashMap<>();
|
||||
resultMap.put(ReportType.PERIOD_LIABILITIES_CLAIMS, List.of(new PeriodLiabilitiesClaimsReportBuilder(imdgProvider)));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Bean("reportBuildersWithPeriodParams")
|
||||
public Map<ReportType, List<CSVReportBuilder<PeriodParams>>> reportBuildersWithPeriodParams(ImdgProvider imdgProvider) {
|
||||
Map<ReportType, List<CSVReportBuilder<PeriodParams>>> resultMap = new HashMap<>();
|
||||
resultMap.put(ReportType.PERIOD_MONEY_CHANGE, List.of(new PeriodMoneyChangeReportBuilder(imdgProvider)));
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
|||
public class ReportsServiceSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
// private KafkaProducerSettings kafkaProducer;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private String reportModuleOut;
|
||||
|
||||
public HazelcastClientParams getHazelcast() {
|
||||
|
|
@ -37,13 +37,13 @@ public class ReportsServiceSettings {
|
|||
this.kafkaConsumer = kafkaConsumer;
|
||||
}
|
||||
|
||||
// public KafkaProducerSettings getKafkaProducer() {
|
||||
// return kafkaProducer;
|
||||
// }
|
||||
//
|
||||
// public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
// this.kafkaProducer = kafkaProducer;
|
||||
// }
|
||||
public KafkaProducerSettings getKafkaProducer() {
|
||||
return kafkaProducer;
|
||||
}
|
||||
|
||||
public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
}
|
||||
|
||||
public String getReportModuleOut() {
|
||||
return reportModuleOut;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
package ru.spcex.clearing.reports.config.validation;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithPeriod;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithSessionId;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithSessionIdList;
|
||||
import ru.spcex.clearing.reports.errors.ReportError;
|
||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||
import ru.spcex.clearing.validation.common.rules.EndDtAfterStartDtRule;
|
||||
import ru.spcex.clearing.validation.common.rules.EnumPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
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.enumeration.IEnumKey;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
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.Function;
|
||||
|
||||
@Configuration
|
||||
public class ValidationConfig {
|
||||
|
||||
@Bean("imdgForValidation")
|
||||
public Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation(ImdgProvider imdgProvider) {
|
||||
final Map<String, Imdg<? extends SpcexObjectBase>> imdg = new HashMap<>();
|
||||
BiConsumer<String, Class<? extends SpcexObjectBase>> addImdg = (s, aClass) -> imdg.put(s, imdgProvider.getImdg(s, aClass));
|
||||
|
||||
addImdg.accept(IMDGDistributedNames.Map_Company, Company.class);
|
||||
|
||||
return imdg;
|
||||
}
|
||||
|
||||
@Bean("validationHelper")
|
||||
public ValidationHelper validationHelper(IMessageResolver messageResolver) {
|
||||
return new ValidationHelper(messageResolver);
|
||||
}
|
||||
|
||||
@Bean("reportRequestValidator")
|
||||
public Function<ReportRequest, IValidator> reportRequestValidator(
|
||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||
) {
|
||||
return reportRequest -> {
|
||||
ImdgValidationContext<ReportRequest> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequest);
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequest::getReportId,
|
||||
new IEnumKey[]{
|
||||
ReportType.SUMMARY_LIABILITIES_CLAIMS,
|
||||
ReportType.SUMMARY_MONEY_CHANGE
|
||||
},
|
||||
ReportError.WrongFieldValue,
|
||||
ReportError.RequiredFieldEmpty)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@Bean("reportRequestWithSessionIdValidator")
|
||||
public Function<ReportRequestWithSessionId, IValidator> reportRequestWithSessionIdValidator(
|
||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||
) {
|
||||
return reportRequestWithSessionId -> {
|
||||
ImdgValidationContext<ReportRequestWithSessionId> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithSessionId);
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithSessionId::getReportId,
|
||||
new IEnumKey[]{
|
||||
ReportType.OPERATIONAL_LIABILITIES_CLAIMS,
|
||||
ReportType.OPERATIONAL_MONEY_CHANGE,
|
||||
ReportType.EXECUTED_DEAL_REPORT,
|
||||
ReportType.UNFULFILLED_DEAL_REPORT
|
||||
},
|
||||
ReportError.WrongFieldValue,
|
||||
ReportError.RequiredFieldEmpty),
|
||||
FieldRequiredRule.instance("sessionId",
|
||||
ReportRequestWithSessionId::getSessionId,
|
||||
ReportError.RequiredFieldEmpty,
|
||||
sessionId -> sessionId > 0 ? null : ReportError.WrongFieldValue)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@Bean("reportRequestWithSessionIdListValidator")
|
||||
public Function<ReportRequestWithSessionIdList, IValidator> reportRequestWithSessionIdListValidator(
|
||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||
) {
|
||||
return reportRequestWithSessionIdList -> {
|
||||
ImdgValidationContext<ReportRequestWithSessionIdList> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithSessionIdList);
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithSessionIdList::getReportId,
|
||||
new IEnumKey[]{
|
||||
ReportType.PERIOD_LIABILITIES_CLAIMS
|
||||
},
|
||||
ReportError.WrongFieldValue,
|
||||
ReportError.RequiredFieldEmpty),
|
||||
FieldRequiredRule.instance("sessionIdList",
|
||||
ReportRequestWithSessionIdList::getSessionIdList,
|
||||
ReportError.RequiredFieldEmpty,
|
||||
sessionIdList -> {
|
||||
if (sessionIdList == null || sessionIdList.isEmpty())
|
||||
return ReportError.WrongFieldValue;
|
||||
return null;
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@Bean("reportRequestWithPeriodValidator")
|
||||
public Function<ReportRequestWithPeriod, IValidator> reportRequestWithPeriodValidator(
|
||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||
) {
|
||||
return reportRequestWithPeriod -> {
|
||||
ImdgValidationContext<ReportRequestWithPeriod> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithPeriod);
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithPeriod::getReportId,
|
||||
new IEnumKey[]{
|
||||
ReportType.PERIOD_MONEY_CHANGE,
|
||||
},
|
||||
ReportError.WrongFieldValue,
|
||||
ReportError.RequiredFieldEmpty),
|
||||
EndDtAfterStartDtRule.instance("endDate", "startDate",
|
||||
ReportRequestWithPeriod::getEndDate,
|
||||
ReportRequestWithPeriod::getStartDate,
|
||||
ReportError.RequiredFieldEmpty,
|
||||
ReportError.WrongFieldValue)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package ru.spcex.clearing.reports.errors;
|
||||
|
||||
import ru.spcex.platform.utils.enumeration.IErrorEnumId;
|
||||
|
||||
public enum ReportError implements IErrorEnumId {
|
||||
InternalError(4000L),
|
||||
UserVerifyDenial(4001L),
|
||||
RequiredFieldEmpty(4002L),
|
||||
WrongFieldValue(4004L),
|
||||
;
|
||||
|
||||
private final Long id;
|
||||
|
||||
ReportError(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import java.time.format.DateTimeFormatter;
|
|||
/**
|
||||
* Общая шапка (атрибуты) для всех отчетов
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractReport {
|
||||
protected static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||
protected static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("dd.MM.yyyy'T'HH:mm:ss");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
package ru.spcex.clearing.reports.reports;
|
||||
|
||||
import com.opencsv.CSVWriterBuilder;
|
||||
import com.opencsv.ICSVWriter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Класс для построения отчетов в формате CSV
|
||||
*
|
||||
* @param <P> тип параметров, используемых при построении отчета
|
||||
*/
|
||||
public abstract class CSVReportBuilder<P> {
|
||||
protected static final Logger log = LoggerFactory.getLogger(CSVReportBuilder.class);
|
||||
|
||||
protected DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||
protected DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy'T'HH:mm:ss");
|
||||
protected DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
|
||||
/**
|
||||
* Метод получения заголовков для CSV отчета
|
||||
*/
|
||||
protected abstract String[] getHeaders();
|
||||
|
||||
/**
|
||||
* Возвращает списком значения CSV отчета. Каждый элемент списка - строка, элемент массива внутри списка - столбец.
|
||||
*/
|
||||
protected abstract List<String[]> getLines();
|
||||
|
||||
/**
|
||||
* Название отчета, используется для формирования имени отчета (без указания формата)
|
||||
*
|
||||
* @param params Параметры формирования отчета
|
||||
*/
|
||||
protected abstract String getReportFilename(P params);
|
||||
|
||||
/**
|
||||
* Тип отчета по {@link ReportType}
|
||||
*/
|
||||
public abstract ReportType getReportType();
|
||||
|
||||
/**
|
||||
* Формирование отчета на основе параметров
|
||||
*
|
||||
* @param params Параметры формирования отчета
|
||||
*/
|
||||
protected abstract void collect(P params);
|
||||
|
||||
/**
|
||||
* Создает CSVWriter. Если требуется изменить параметры выходного CSV файла, этот метод следует переопределить.
|
||||
*
|
||||
* @param file Файл отчета
|
||||
* @return Созданный CSVWriter
|
||||
*
|
||||
* todo check it
|
||||
*/
|
||||
protected ICSVWriter createCsvWriter(File file) throws IOException {
|
||||
Writer writer = new FileWriter(file);
|
||||
CSVWriterBuilder csvWriterBuilder = new CSVWriterBuilder(writer)
|
||||
.withLineEnd("\n")
|
||||
.withSeparator(',')
|
||||
.withQuoteChar('\"');
|
||||
return csvWriterBuilder.build();
|
||||
}
|
||||
|
||||
public File createReport(P params, File outFolder) {
|
||||
assert outFolder != null && outFolder.isDirectory();
|
||||
|
||||
File reportFile = new File(outFolder, normalizeFilenameForOS(getReportFilename(params) + ".csv"));
|
||||
|
||||
collect(params);
|
||||
String[] headers = getHeaders();
|
||||
List<String[]> lines = getLines();
|
||||
|
||||
assert headers != null;
|
||||
assert lines != null;
|
||||
|
||||
try (ICSVWriter csvWriter = createCsvWriter(reportFile)) {
|
||||
csvWriter.writeNext(headers, false);
|
||||
csvWriter.writeAll(lines, true);
|
||||
} catch (IOException e) {
|
||||
log.error("Can't create report", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return reportFile;
|
||||
}
|
||||
|
||||
protected String normalizeFilenameForOS(String filename) {
|
||||
if (System.getProperty("os.name").toLowerCase().contains("windows"))
|
||||
return filename.replace(":", "_");
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setDateFormatter(DateTimeFormatter dateFormatter) {
|
||||
this.dateFormatter = dateFormatter;
|
||||
}
|
||||
|
||||
public void setDateTimeFormatter(DateTimeFormatter dateTimeFormatter) {
|
||||
this.dateTimeFormatter = dateTimeFormatter;
|
||||
}
|
||||
|
||||
public void setTimeFormatter(DateTimeFormatter timeFormatter) {
|
||||
this.timeFormatter = timeFormatter;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.spcex.clearing.reports.reports;
|
||||
|
||||
/**
|
||||
* Класс для формирования отчета без параметров
|
||||
*/
|
||||
public class EmptyParams {
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package ru.spcex.clearing.reports.reports;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Параметры для формирования отчета на период
|
||||
*/
|
||||
public class PeriodParams {
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import ru.spcex.platform.utils.enumeration.IEnumKey;
|
|||
/**
|
||||
* Идентификаторы отчётов
|
||||
*/
|
||||
@Deprecated
|
||||
public enum ReportId implements IEnumKey {
|
||||
PA_B("REPPA.B"), PA_IV("REPPA.IV"),
|
||||
|
||||
|
|
@ -22,8 +23,18 @@ public enum ReportId implements IEnumKey {
|
|||
|
||||
BR_0420312_P1("REPBR.0420312_р1-1"), BR_0420312_P2("REPBR.0420312_р1-2"), BR_0420312_P3("REPBR.0420312_р1-3"), BR_0420312_P4("REPBR.0420312_р1-4"),
|
||||
BR_0420312_P5("REPBR.0420312_р1-5"), BR_0420312_P6("REPBR.0420312_р1-6"), BR_0420312_P7("REPBR.0420312_р1-7"), BR_0420312_P8("REPBR.0420312_р3-1"),
|
||||
BR_0420312_P9("REPBR.0420312_р3-2"), BR_0420312_P10("REPBR.0420312_р3-3");
|
||||
BR_0420312_P9("REPBR.0420312_р3-2"), BR_0420312_P10("REPBR.0420312_р3-3"),
|
||||
|
||||
OPERATIONAL_LIABILITIES_CLAIMS("operational_liabilities_claims"),
|
||||
OPERATIONAL_MONEY_CHANGE("operational_money_change"),
|
||||
SUMMARY_LIABILITIES_CLAIMS("summary_liabilities_claims"),
|
||||
SUMMARY_L_MONEY_CHANGE("summary_lmoney_change"),
|
||||
PERIOD_LIABILITIES_CLAIMS("period_liabilities_claims"),
|
||||
PERIOD_MONEY_CHANGE("period_money_change"),
|
||||
EXECUTED_DEAL_REPORT("executed_deal_report"),
|
||||
UNFULFILLED_DEAL_REPORT("unfulfilled_deal_report"),
|
||||
|
||||
;
|
||||
|
||||
private final String key;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
|||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Deprecated
|
||||
public abstract class ReportWithClearingStatus extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("clearingStatus")
|
||||
|
|
|
|||
|
|
@ -2,24 +2,23 @@ package ru.spcex.clearing.reports.reports;
|
|||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalDateConverter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Шапка для отчётов, содержащих startDate и endDate
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class ReportWithPeriod extends AbstractReport {
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("startDate")
|
||||
@XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
// @XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
protected LocalDate startDate;
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("endDate")
|
||||
@XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
// @XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
protected LocalDate endDate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.reports.reports;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Параметры для формирования отчета по списку SessionId
|
||||
*/
|
||||
public class SessionIdListParams {
|
||||
private List<Long> sessionIdList;
|
||||
|
||||
public List<Long> getSessionIdList() {
|
||||
return sessionIdList;
|
||||
}
|
||||
|
||||
public void setSessionIdList(List<Long> sessionIdList) {
|
||||
this.sessionIdList = sessionIdList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package ru.spcex.clearing.reports.reports;
|
||||
|
||||
/**
|
||||
* Параметры для формирования отчета по SessionId
|
||||
*/
|
||||
public class SessionIdParam {
|
||||
private Long sessionId;
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.clearing.classes.statics.data.misc.STrades;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.reports.reports.CSVReportBuilder;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ExecutedDealReportBuilderCommon<T> extends CSVReportBuilder<T> {
|
||||
protected final DateTimeFormatter fileNameDateTimeFormatter = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
|
||||
protected final Imdg<ExecutionFond> executionFondImdg;
|
||||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<STrades> sTradesImdg;
|
||||
|
||||
private final String[] headers = {
|
||||
"id", "securityId", "tradeNo", "tradeDate", "tradeTime",
|
||||
"settleDate", "settleCode", "price", "quanity", "value"
|
||||
};
|
||||
private List<String[]> lines = null;
|
||||
|
||||
public ExecutedDealReportBuilderCommon(ImdgProvider imdgProvider) {
|
||||
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
||||
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.sTradesImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_STrades, STrades.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String[]> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.EXECUTED_DEAL_REPORT;
|
||||
}
|
||||
|
||||
protected abstract Collection<ExecutionFond> getExecutionFondsForReport(T params);
|
||||
|
||||
@Override
|
||||
protected void collect(T params) {
|
||||
Collection<ExecutionFond> executionFonds = getExecutionFondsForReport(params);
|
||||
|
||||
lines = new ArrayList<>(executionFonds.size());
|
||||
for (ExecutionFond executionFond : executionFonds) {
|
||||
Company company = companyImdg.getSingleObjectByID(executionFond.getCompanyId());
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
STrades sTrade = sTradesImdg.getSingleObjectByFieldValues(
|
||||
Map.of(
|
||||
"tradeNum", executionFond.getExchangeExecutionId(),
|
||||
"operation", executionFond.getSide()
|
||||
)
|
||||
);
|
||||
|
||||
String id = String.valueOf(executionFond.getId());
|
||||
String securityId = String.valueOf(executionFond.getSecurityId());
|
||||
String tradeNo = String.valueOf(executionFond.getExchangeExecutionId());
|
||||
String tradeDate = dateFormatter.format(executionFond.getTradingDate());
|
||||
String tradeTime = dateFormatter.format(LocalDate.ofInstant(executionFond.getCreated(), ZoneId.systemDefault()));
|
||||
String settleDate = dateFormatter.format(executionFond.getSettlementDate());
|
||||
String settleCode = sTrade != null ? sTrade.getSettleCode() : "";
|
||||
String quantity = String.valueOf(executionFond.getQuantity());
|
||||
String value = String.valueOf(executionFond.getSettlementAmount());
|
||||
String price = String.valueOf(executionFond.getSettlementAmount().divide(executionFond.getQuantity(), RoundingMode.HALF_UP));
|
||||
|
||||
int valueIdx = 0;
|
||||
String[] line = new String[getHeaders().length];
|
||||
line[valueIdx++] = id;
|
||||
line[valueIdx++] = securityId;
|
||||
line[valueIdx++] = tradeNo;
|
||||
line[valueIdx++] = tradeDate;
|
||||
line[valueIdx++] = tradeTime;
|
||||
line[valueIdx++] = settleDate;
|
||||
line[valueIdx++] = settleCode;
|
||||
line[valueIdx++] = price;
|
||||
line[valueIdx++] = quantity;
|
||||
line[valueIdx++] = value;
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExecutedDealReportBuilder_INFTYPE_1 extends ExecutedDealReportBuilderCommon<SessionIdParam> {
|
||||
|
||||
public ExecutedDealReportBuilder_INFTYPE_1(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "KS_BR_PFX64_INFTYPE_1_%s".formatted(fileNameDateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdParam params) {
|
||||
ImdgPredicateBuilder pb = executionFondImdg.predicateBuilder();
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("sessionId", params.getSessionId()),
|
||||
pb.less("tradingDate", LocalDate.now()),
|
||||
pb.equals("settlementDate", LocalDate.now())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExecutedDealReportBuilder_INFTYPE_2 extends ExecutedDealReportBuilderCommon<SessionIdParam> {
|
||||
|
||||
public ExecutedDealReportBuilder_INFTYPE_2(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "KS_BR_PFX64_INFTYPE_2_%s".formatted(fileNameDateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdParam params) {
|
||||
ImdgPredicateBuilder pb = executionFondImdg.predicateBuilder();
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("sessionId", params.getSessionId()),
|
||||
pb.equals("tradingDate", LocalDate.now()),
|
||||
pb.equals("settlementDate", LocalDate.now())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExecutedDealReportBuilder_INFTYPE_3 extends ExecutedDealReportBuilderCommon<SessionIdParam> {
|
||||
|
||||
public ExecutedDealReportBuilder_INFTYPE_3(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "KS_BR_PFX64_INFTYPE_3_%s".formatted(fileNameDateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdParam params) {
|
||||
ImdgPredicateBuilder pb = executionFondImdg.predicateBuilder();
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(pb.greater("settlementDate", LocalDate.now()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.enumeration.Allowed;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExecutedDealReportBuilder_INFTYPE_4 extends ExecutedDealReportBuilderCommon<SessionIdParam> {
|
||||
|
||||
public ExecutedDealReportBuilder_INFTYPE_4(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "KS_BR_PFX64_INFTYPE_4_%s".formatted(fileNameDateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdParam params) {
|
||||
ImdgPredicateBuilder pb = executionFondImdg.predicateBuilder();
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("coverageStatus", Allowed.DENIED.getKey()),
|
||||
pb.equals("settlementDate", LocalDate.now())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionCommon;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
|
||||
import ru.clearing.classes.statics.data.misc.Listing;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.reports.reports.CSVReportBuilder;
|
||||
import ru.spcex.platform.enumeration.Allowed;
|
||||
import ru.spcex.platform.enumeration.Market;
|
||||
import ru.spcex.platform.enumeration.Side;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// todo check typo
|
||||
public abstract class LiabilitiesClaimsReportBuilder<P> extends CSVReportBuilder<P> {
|
||||
protected final Imdg<ExecutionFond> executionFondImdg;
|
||||
protected final Imdg<ExecutionDeposit> executionDepositImdg;
|
||||
protected final Imdg<Company> companyImdg;
|
||||
protected final Imdg<Registry> registryImdg;
|
||||
protected final Imdg<Listing> listingImdg;
|
||||
protected final Imdg<FixedIncomeSecurity> fixedIncomeSecurityImdg;
|
||||
protected final Imdg<TradingClearingRegistry> tradingClearingRegistryImdg;
|
||||
|
||||
protected final String[] headers = {
|
||||
"id", "doc_date", "doc_time", "doc_name", "doc_type", "clearingHouse", "firmId", "firName", "session_id",
|
||||
"clearing_date", "clearing_time", "trdAccId", "account", "depo_account", "currency", "tr_id", "securityId",
|
||||
"tr_buySell", "tr_date", "tr_execDate", "exec_status", "repaym_date", "tr_price", "nominal", "lot_value",
|
||||
"tr_lot", "tr_quantity", "tr_value", "tr_accruedint", "accruedint", "tr_clrComm", "tr_exhComm", "cash_liability",
|
||||
"depo_liability", "cash_netto", "depo_netto"
|
||||
};
|
||||
protected List<String[]> lines = null;
|
||||
|
||||
public LiabilitiesClaimsReportBuilder(ImdgProvider imdgProvider) {
|
||||
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
||||
this.executionDepositImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionDeposit, ExecutionDeposit.class);
|
||||
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.listingImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Listing, Listing.class);
|
||||
this.fixedIncomeSecurityImdg = imdgProvider.getImdg(
|
||||
IMDGDistributedNames.Map_FixedIncomeSecurity, FixedIncomeSecurity.class
|
||||
);
|
||||
this.tradingClearingRegistryImdg = imdgProvider.getImdg(
|
||||
IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String[]> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
protected abstract Collection<ExecutionFond> getExecutionFondsForReport(P params);
|
||||
|
||||
protected abstract Collection<ExecutionDeposit> getExecutionDepositsForReport(P params);
|
||||
|
||||
@Override
|
||||
protected void collect(P params) {
|
||||
Collection<ExecutionFond> executionFonds = getExecutionFondsForReport(params);
|
||||
Collection<ExecutionDeposit> executionDeposits = getExecutionDepositsForReport(params);
|
||||
|
||||
List<ExecutionCommon> executions = new ArrayList<>(executionFonds.size() + executionDeposits.size());
|
||||
executions.addAll(executionFonds);
|
||||
executions.addAll(executionDeposits);
|
||||
|
||||
Company clearingHouseCompany = companyImdg.getSingleObjectByID(1L);
|
||||
String clearingHouse = clearingHouseCompany.getFullName();
|
||||
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
LocalTime nowTime = LocalTime.now();
|
||||
|
||||
lines = new ArrayList<>(executions.size());
|
||||
for (ExecutionCommon execution : executions) {
|
||||
Company company = companyImdg.getSingleObjectByID(execution.getCompanyId());
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
Registry registry = registryImdg.getSingleObjectByFieldValues(Map.of("companyId", execution.getCompanyId()));
|
||||
Collection<Registry> registriesForSessionId = registryImdg.getCollectionObjectsByFieldValues(
|
||||
Map.of("sessionId", execution.getSessionId())
|
||||
);
|
||||
Listing listing = listingImdg.getSingleObjectByFieldValues(Map.of("securityId", execution.getSecurityId()));
|
||||
FixedIncomeSecurity fixedIncomeSecurity = fixedIncomeSecurityImdg.getSingleObjectByFieldValues(
|
||||
Map.of("securityId", execution.getSecurityId())
|
||||
);
|
||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(
|
||||
execution.getTradingClearingRegistryId()
|
||||
);
|
||||
|
||||
String id = String.valueOf(execution.getId());
|
||||
String docDate = dateFormatter.format(nowDate);
|
||||
String docTime = timeFormatter.format(nowTime);
|
||||
String docName = "Отчет об обязательствах/требованиях Участника клиринга";
|
||||
String docType = "KS_FIRMID_LIABILITIES";
|
||||
String firmId = String.valueOf(execution.getCompanyId());
|
||||
String firName = company.getFullName();
|
||||
String sessionId = String.valueOf(execution.getSessionId());
|
||||
String clearingDate = dateFormatter.format(execution.getClearingDate());
|
||||
String clearingTime = dateFormatter.format(execution.getClearingDate());
|
||||
String trdAccId = registry.getTradingClearingRegistry();
|
||||
String account = String.valueOf(tradingClearingRegistry.getMoneyAccountId());
|
||||
String depoAccount = String.valueOf(tradingClearingRegistry.getDepoAccountId());
|
||||
String currency = execution.getSettlementCurrency();
|
||||
String trId = String.valueOf(execution.getExchangeExecutionId());
|
||||
String securityId = String.valueOf(execution.getSecurityId());
|
||||
|
||||
String trBuySell = "";
|
||||
if (Side.BUY.equalsByKey(execution.getSide()))
|
||||
trBuySell = "B";
|
||||
else if (Side.SELL.equalsByKey(execution.getSide()))
|
||||
trBuySell = "S";
|
||||
String trDate = dateFormatter.format(execution.getTradingDate());
|
||||
|
||||
String trExecDate = "";
|
||||
String execStatus = "";
|
||||
String repaymDate = "";
|
||||
String trPrice = "";
|
||||
String nominal = "";
|
||||
String trQuantity = "";
|
||||
String trValue = "";
|
||||
String trAccruedInt = "";
|
||||
String accruedInt = "";
|
||||
String cashLiability = "";
|
||||
String depoLiability = "";
|
||||
if (execution instanceof ExecutionDeposit executionDeposit) {
|
||||
trExecDate = dateFormatter.format(executionDeposit.getSecondLegSettlementDate());
|
||||
if (Market.mkrs.equalsByKey(execution.getMarket())) {
|
||||
|
||||
String coverageStatus = executionDeposit.getCoverageStatus();
|
||||
if (Allowed.ALLOWED.equalsByKey(coverageStatus)) execStatus = "Y";
|
||||
else if (Allowed.DENIED.equalsByKey(coverageStatus)) execStatus = "N";
|
||||
else execStatus = "W";
|
||||
|
||||
repaymDate = dateFormatter.format(executionDeposit.getSecondLegSettlementDate());
|
||||
trPrice = String.valueOf(executionDeposit.getPrice());
|
||||
trValue = String.valueOf(executionDeposit.getFirstLegAmount());
|
||||
cashLiability = String.valueOf(executionDeposit.getFirstLegAmount());
|
||||
}
|
||||
} else if (execution instanceof ExecutionFond executionFond) {
|
||||
trExecDate = dateFormatter.format(executionFond.getSettlementDate());
|
||||
if (Market.fond.equalsByKey(execution.getMarket())) {
|
||||
trPrice = String.valueOf(
|
||||
executionFond.getSettlementAmount().divide(executionFond.getQuantity(), RoundingMode.HALF_UP)
|
||||
);
|
||||
trQuantity = String.valueOf(executionFond.getQuantity());
|
||||
nominal = String.valueOf(fixedIncomeSecurity.getNominalValue());
|
||||
trValue = String.valueOf(executionFond.getSettlementAmount());
|
||||
trAccruedInt = String.valueOf(fixedIncomeSecurity.getCoupon());
|
||||
accruedInt = String.valueOf(
|
||||
fixedIncomeSecurity.getCoupon().divide(executionFond.getQuantity(), RoundingMode.HALF_UP)
|
||||
);
|
||||
cashLiability = String.valueOf(executionFond.getSettlementAmount());
|
||||
depoLiability = String.valueOf(executionFond.getQuantity());
|
||||
}
|
||||
}
|
||||
|
||||
String lotValue = String.valueOf(listing.getLotSize());
|
||||
String trLot = String.valueOf(execution.getLots());
|
||||
String trClrComm = "";
|
||||
String trExhComm = "";
|
||||
|
||||
Registry tm_tRegistry = null;
|
||||
Registry om_tRegistry = null;
|
||||
Registry ts_tRegistry = null;
|
||||
Registry os_tRegistry = null;
|
||||
for (Registry currRegistry : registriesForSessionId) {
|
||||
String registryCode = currRegistry.getRegistryCode();
|
||||
if (registryCode.endsWith("T")) {
|
||||
if (registryCode.startsWith("TM")) {
|
||||
if (tm_tRegistry != null && tm_tRegistry.getUpdated().isAfter(currRegistry.getUpdated())) continue;
|
||||
tm_tRegistry = currRegistry;
|
||||
}
|
||||
if (registryCode.startsWith("OM")) {
|
||||
if (om_tRegistry != null && om_tRegistry.getUpdated().isAfter(currRegistry.getUpdated())) continue;
|
||||
om_tRegistry = currRegistry;
|
||||
}
|
||||
if (registryCode.startsWith("TS")) {
|
||||
if (ts_tRegistry != null && ts_tRegistry.getUpdated().isAfter(currRegistry.getUpdated())) continue;
|
||||
ts_tRegistry = currRegistry;
|
||||
}
|
||||
if (registryCode.startsWith("OS")) {
|
||||
if (os_tRegistry != null && os_tRegistry.getUpdated().isAfter(currRegistry.getUpdated())) continue;
|
||||
os_tRegistry = currRegistry;
|
||||
}
|
||||
}
|
||||
}
|
||||
String cashNetto = "";
|
||||
if (tm_tRegistry != null && om_tRegistry != null) {
|
||||
cashNetto = String.valueOf(tm_tRegistry.getBalance().subtract(om_tRegistry.getBalance()));
|
||||
}
|
||||
|
||||
String depoNetto = "";
|
||||
if (ts_tRegistry != null && os_tRegistry != null) {
|
||||
depoNetto = String.valueOf(ts_tRegistry.getBalance().subtract(os_tRegistry.getBalance()));
|
||||
}
|
||||
|
||||
|
||||
int valueIdx = 0;
|
||||
String[] line = new String[getHeaders().length];
|
||||
line[valueIdx++] = id;
|
||||
line[valueIdx++] = docDate;
|
||||
line[valueIdx++] = docTime;
|
||||
line[valueIdx++] = docName;
|
||||
line[valueIdx++] = docType;
|
||||
line[valueIdx++] = clearingHouse;
|
||||
line[valueIdx++] = firmId;
|
||||
line[valueIdx++] = firName;
|
||||
line[valueIdx++] = sessionId;
|
||||
line[valueIdx++] = clearingDate;
|
||||
line[valueIdx++] = clearingTime;
|
||||
line[valueIdx++] = trdAccId;
|
||||
line[valueIdx++] = account;
|
||||
line[valueIdx++] = depoAccount;
|
||||
line[valueIdx++] = currency;
|
||||
line[valueIdx++] = trId;
|
||||
line[valueIdx++] = securityId;
|
||||
line[valueIdx++] = trBuySell;
|
||||
line[valueIdx++] = trDate;
|
||||
line[valueIdx++] = trExecDate;
|
||||
line[valueIdx++] = execStatus;
|
||||
line[valueIdx++] = repaymDate;
|
||||
line[valueIdx++] = trPrice;
|
||||
line[valueIdx++] = nominal;
|
||||
line[valueIdx++] = lotValue;
|
||||
line[valueIdx++] = trLot;
|
||||
line[valueIdx++] = trQuantity;
|
||||
line[valueIdx++] = trValue;
|
||||
line[valueIdx++] = trAccruedInt;
|
||||
line[valueIdx++] = accruedInt;
|
||||
line[valueIdx++] = trClrComm;
|
||||
line[valueIdx++] = trExhComm;
|
||||
line[valueIdx++] = cashLiability;
|
||||
line[valueIdx++] = depoLiability;
|
||||
line[valueIdx++] = cashNetto;
|
||||
line[valueIdx] = depoNetto;
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.misc.Listing;
|
||||
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.clearing.classes.statics.data.statement.Statement;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.reports.reports.CSVReportBuilder;
|
||||
import ru.spcex.platform.enumeration.InOutDirection;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class MoneyChangeReportBuilder<P> extends CSVReportBuilder<P> {
|
||||
protected final Imdg<Registry> registryImdg;
|
||||
protected final Imdg<Company> companyImdg;
|
||||
protected final Imdg<Listing> listingImdg;
|
||||
protected final Imdg<Statement> statementImdg;
|
||||
protected final Imdg<PaymentInstruction> paymentInstructionImdg;
|
||||
protected final String[] headers = {
|
||||
"id", "doc_date", "doc_time", "doc_name", "doc_type", "clearingHouse", "firmId", "firName", "trdAccId",
|
||||
"account", "currency", "registry_code", "registry_name", "open_balance", "change_balance", "add_withdraw",
|
||||
"close_balance", "remarks", "add_sum", "add_time", "withdraw_sum", "withdraw_time"
|
||||
};
|
||||
|
||||
protected List<String[]> lines = null;
|
||||
|
||||
public MoneyChangeReportBuilder(ImdgProvider imdgProvider) {
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.listingImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Listing, Listing.class);
|
||||
this.statementImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Statement, Statement.class);
|
||||
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String[]> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
protected abstract Collection<Registry> getRegistryForReport(P param);
|
||||
|
||||
@Override
|
||||
protected void collect(P params) {
|
||||
Collection<Registry> registries = getRegistryForReport(params);
|
||||
|
||||
Company clearingHouseCompany = companyImdg.getSingleObjectByID(1L);
|
||||
String clearingHouse = clearingHouseCompany.getFullName();
|
||||
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
LocalTime nowTime = LocalTime.now();
|
||||
lines = new ArrayList<>(registries.size());
|
||||
for (Registry registry : registries) {
|
||||
Company company = companyImdg.getSingleObjectByID(registry.getCompanyId());
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
Listing listing = listingImdg.getSingleObjectByFieldValues(Map.of("securityId", registry.getSecurityId()));
|
||||
Statement statement = statementImdg.getSingleObjectByFieldValues(Map.of("addresseeId", registry.getCompanyId()));
|
||||
PaymentInstruction paymentInstruction = paymentInstructionImdg.getSingleObjectByFieldValues(
|
||||
Map.of(
|
||||
"id", registry.getPaymentId(),
|
||||
"creditLeg_direction", InOutDirection.out.getKey()
|
||||
)
|
||||
);
|
||||
|
||||
String id = String.valueOf(registry.getId());
|
||||
String docDate = dateFormatter.format(nowDate);
|
||||
String docTime = timeFormatter.format(nowTime);
|
||||
String docName = "Отчет об изменении суммы денежных средств и (или) количества иного имущества Участника клиринга";
|
||||
String docType = "KS_FIRMID_ASSETS";
|
||||
String firmId = String.valueOf(registry.getCompanyId());
|
||||
String firName = company.getFullName();
|
||||
String trdAccId = registry.getTradingClearingRegistry();
|
||||
String account = String.valueOf(registry.getAccountId());
|
||||
String currency = listing.getTradingCurrency();
|
||||
String registryCode = String.valueOf(registry.getId());
|
||||
String registryName = registry.getRegistryCode();
|
||||
String openBalance = String.valueOf(registry.getOpenBalance());
|
||||
String changeBalance = String.valueOf(registry.getCloseBalance().subtract(registry.getOpenBalance()));
|
||||
String addWithdraw = String.valueOf(registry.getCredit().subtract(registry.getDebit()));
|
||||
String closeBalance = String.valueOf(registry.getCloseBalance());
|
||||
String remarks = "";
|
||||
String addSum = String.valueOf(registry.getCredit());
|
||||
String addTime = dateTimeFormatter.format(LocalDateTime.ofInstant(statement.getCreated(), ZoneId.systemDefault()));
|
||||
String withdrawSum = String.valueOf(registry.getDebit());
|
||||
String withdrawTime = dateTimeFormatter.format(LocalDateTime.ofInstant(paymentInstruction.getPaymentDate(), ZoneId.systemDefault()));
|
||||
|
||||
int valueIdx = 0;
|
||||
String[] line = new String[getHeaders().length];
|
||||
line[valueIdx++] = id;
|
||||
line[valueIdx++] = docDate;
|
||||
line[valueIdx++] = docTime;
|
||||
line[valueIdx++] = docName;
|
||||
line[valueIdx++] = docType;
|
||||
line[valueIdx++] = clearingHouse;
|
||||
line[valueIdx++] = firmId;
|
||||
line[valueIdx++] = firName;
|
||||
line[valueIdx++] = trdAccId;
|
||||
line[valueIdx++] = account;
|
||||
line[valueIdx++] = currency;
|
||||
line[valueIdx++] = registryCode;
|
||||
line[valueIdx++] = registryName;
|
||||
line[valueIdx++] = openBalance;
|
||||
line[valueIdx++] = changeBalance;
|
||||
line[valueIdx++] = addWithdraw;
|
||||
line[valueIdx++] = closeBalance;
|
||||
line[valueIdx++] = remarks;
|
||||
line[valueIdx++] = addSum;
|
||||
line[valueIdx++] = addTime;
|
||||
line[valueIdx++] = withdrawSum;
|
||||
line[valueIdx++] = withdrawTime;
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public class OperationalLiabilitiesClaimsReportBuilder extends LiabilitiesClaimsReportBuilder<SessionIdParam> {
|
||||
public OperationalLiabilitiesClaimsReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdParam params) {
|
||||
return executionFondImdg.getCollectionObjectsByFieldValues(
|
||||
Map.of("sessionId", params.getSessionId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionDeposit> getExecutionDepositsForReport(SessionIdParam params) {
|
||||
return executionDepositImdg.getCollectionObjectsByFieldValues(
|
||||
Map.of("sessionId", params.getSessionId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "operational_liabilities_claims.%s".formatted(
|
||||
dateTimeFormatter.format(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.OPERATIONAL_LIABILITIES_CLAIMS;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public class OperationalMoneyChangeReportBuilder extends MoneyChangeReportBuilder<SessionIdParam> {
|
||||
public OperationalMoneyChangeReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Registry> getRegistryForReport(SessionIdParam param) {
|
||||
return registryImdg.getCollectionObjectsByFieldValues(
|
||||
Map.of("sessionId", param.getSessionId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "operational_money_change.%s".formatted(dateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.OPERATIONAL_MONEY_CHANGE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdListParams;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class PeriodLiabilitiesClaimsReportBuilder extends LiabilitiesClaimsReportBuilder<SessionIdListParams> {
|
||||
|
||||
public PeriodLiabilitiesClaimsReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdListParams params) {
|
||||
return "period_liabilities_claims.%s".formatted(dateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.PERIOD_LIABILITIES_CLAIMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdListParams params) {
|
||||
if (params.getSessionIdList() == null || params.getSessionIdList().isEmpty()) return Collections.emptyList();
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(
|
||||
executionFondImdg.predicateBuilder().in("sessionId", params.getSessionIdList().toArray(new Long[0]))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionDeposit> getExecutionDepositsForReport(SessionIdListParams params) {
|
||||
if (params.getSessionIdList() == null || params.getSessionIdList().isEmpty()) return Collections.emptyList();
|
||||
return executionDepositImdg.getCollectionObjectsByPredicate(
|
||||
executionDepositImdg.predicateBuilder().in("sessionId", params.getSessionIdList().toArray(new Long[0]))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.reports.reports.PeriodParams;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PeriodMoneyChangeReportBuilder extends MoneyChangeReportBuilder<PeriodParams> {
|
||||
|
||||
public PeriodMoneyChangeReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Registry> getRegistryForReport(PeriodParams params) {
|
||||
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
||||
return registryImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.greatEqual("clearingDate", params.getStartDate()),
|
||||
pb.lessEqual("clearingDate", params.getEndDate())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportFilename(PeriodParams params) {
|
||||
return "period_money_change.%s-%s.%s".formatted(
|
||||
dateFormatter.format(params.getStartDate()),
|
||||
dateFormatter.format(params.getEndDate()),
|
||||
dateTimeFormatter.format(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.PERIOD_MONEY_CHANGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.spcex.clearing.reports.reports.EmptyParams;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class SummaryLiabilitiesClaimsReportBuilder extends LiabilitiesClaimsReportBuilder<EmptyParams> {
|
||||
public SummaryLiabilitiesClaimsReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(EmptyParams params) {
|
||||
return executionFondImdg.getAllValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionDeposit> getExecutionDepositsForReport(EmptyParams params) {
|
||||
return executionDepositImdg.getAllValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(EmptyParams params) {
|
||||
return "summary_money_change.%s".formatted(dateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.SUMMARY_LIABILITIES_CLAIMS;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.reports.reports.EmptyParams;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
public class SummaryMoneyChangeReportBuilder extends MoneyChangeReportBuilder<EmptyParams> {
|
||||
public SummaryMoneyChangeReportBuilder(ImdgProvider imdgProvider) {
|
||||
super(imdgProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Registry> getRegistryForReport(EmptyParams param) {
|
||||
return registryImdg.getAllValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(EmptyParams params) {
|
||||
return "summary_money_change.%s".formatted(dateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.SUMMARY_MONEY_CHANGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package ru.spcex.clearing.reports.reports.bp;
|
||||
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.clearing.classes.statics.data.misc.STrades;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.reports.reports.CSVReportBuilder;
|
||||
import ru.spcex.clearing.reports.reports.SessionIdParam;
|
||||
import ru.spcex.platform.enumeration.Allowed;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class UnfulfilledDealReportBuilder extends CSVReportBuilder<SessionIdParam> {
|
||||
private final Imdg<ExecutionFond> executionFondImdg;
|
||||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<STrades> sTradesImdg;
|
||||
private final String[] headers = {
|
||||
"id", "securityId", "tradeNo", "tradeDate", "settleCode"
|
||||
};
|
||||
private List<String[]> lines = null;
|
||||
|
||||
public UnfulfilledDealReportBuilder(ImdgProvider imdgProvider) {
|
||||
executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
||||
companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
sTradesImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_STrades, STrades.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String[]> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReportFilename(SessionIdParam params) {
|
||||
return "unfulfilled_deal_report.%s".formatted(dateTimeFormatter.format(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportType getReportType() {
|
||||
return ReportType.UNFULFILLED_DEAL_REPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void collect(SessionIdParam params) {
|
||||
ImdgPredicateBuilder pb = executionFondImdg.predicateBuilder();
|
||||
ImdgPredicate predicate = pb.and(
|
||||
pb.equals("sessionId", params.getSessionId()),
|
||||
pb.equals("coverageStatus", Allowed.DENIED.getKey())
|
||||
);
|
||||
Collection<ExecutionFond> executionFonds = executionFondImdg.getCollectionObjectsByPredicate(predicate);
|
||||
|
||||
lines = new ArrayList<>(executionFonds.size());
|
||||
for (ExecutionFond executionFond : executionFonds) {
|
||||
Company company = companyImdg.getSingleObjectByID(executionFond.getCompanyId());
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
STrades sTrade = sTradesImdg.getSingleObjectByFieldValues(
|
||||
Map.of(
|
||||
"settleCode", executionFond.getSettlementCode(),
|
||||
"operation", executionFond.getSide()
|
||||
)
|
||||
);
|
||||
|
||||
String id = String.valueOf(executionFond.getId());
|
||||
String securityId = String.valueOf(executionFond.getSecurityId());
|
||||
String tradeNo = String.valueOf(executionFond.getExchangeExecutionId());
|
||||
String tradeDate = dateFormatter.format(executionFond.getTradingDate());
|
||||
String settleCode = sTrade != null ? sTrade.getClassCode() : null;
|
||||
|
||||
int valueIdx = 0;
|
||||
String[] line = new String[getHeaders().length];
|
||||
line[valueIdx++] = id;
|
||||
line[valueIdx++] = securityId;
|
||||
line[valueIdx++] = tradeNo;
|
||||
line[valueIdx++] = tradeDate;
|
||||
line[valueIdx++] = settleCode;
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_12_2;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_12_2;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("netPositionBank")
|
||||
@Deprecated
|
||||
public class ReportPA_B extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("clearingMemberCategory")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_12_2;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_12_2;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("netPositionInitiator")
|
||||
@Deprecated
|
||||
public class ReportPA_IV extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("clearingMemberCategory")
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_13;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_13;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import ru.spcex.clearing.reports.reports.AbstractReport;
|
||||
import ru.spcex.clearing.reports.reports.ReportId;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalDateConverter;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalTimeConverter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -15,13 +12,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("incomingDocuments")
|
||||
@Deprecated
|
||||
public class ReportDOCIN extends AbstractReport {
|
||||
/**
|
||||
* Дата в формате: dd.MM.yyyy
|
||||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("date")
|
||||
@XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
// @XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
private final LocalDate date;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +27,7 @@ public class ReportDOCIN extends AbstractReport {
|
|||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("time")
|
||||
@XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
// @XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
private final LocalTime time;
|
||||
|
||||
@XStreamAlias("rows")
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_13;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_13;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import ru.spcex.clearing.reports.reports.AbstractReport;
|
||||
import ru.spcex.clearing.reports.reports.ReportId;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalDateConverter;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalTimeConverter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -15,13 +12,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("incomingDocuments")
|
||||
@Deprecated
|
||||
public class ReportDOCOUT extends AbstractReport {
|
||||
/**
|
||||
* Дата в формате: dd.MM.yyyy
|
||||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("date")
|
||||
@XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
// @XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
private final LocalDate date;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +27,7 @@ public class ReportDOCOUT extends AbstractReport {
|
|||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("time")
|
||||
@XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
// @XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
private final LocalTime time;
|
||||
|
||||
@XStreamAlias("rows")
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_16_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_16_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import ru.spcex.clearing.reports.reports.AbstractReport;
|
||||
import ru.spcex.clearing.reports.reports.ReportId;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalDateConverter;
|
||||
import ru.spcex.clearing.reports.xml_test.FormattedLocalTimeConverter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -15,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("accountBalanceInfo")
|
||||
@Deprecated
|
||||
public class ReportINACCNT extends AbstractReport {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("clearingMemberCategory")
|
||||
|
|
@ -25,7 +23,7 @@ public class ReportINACCNT extends AbstractReport {
|
|||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("date")
|
||||
@XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
// @XStreamConverter(value = FormattedLocalDateConverter.class, strings = {"dd.MM.yyyy"})
|
||||
private final LocalDate date;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +31,7 @@ public class ReportINACCNT extends AbstractReport {
|
|||
*/
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("time")
|
||||
@XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
// @XStreamConverter(value = FormattedLocalTimeConverter.class, strings = {"HH:mm:ss"})
|
||||
private final LocalTime time;
|
||||
|
||||
@XStreamAlias("rows")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_1;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_1;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearedLiabilities")
|
||||
@Deprecated
|
||||
public class ReportBR_0420315_P1 extends ReportWithClearingStatus {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_1;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_1;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -10,6 +10,7 @@ import java.time.LocalDate;
|
|||
import java.time.LocalDateTime;
|
||||
|
||||
@XStreamAlias("clearedLiabilitiesTotal")
|
||||
@Deprecated
|
||||
public class ReportBR_0420315_P2 extends ReportWithPeriod {
|
||||
@XStreamAlias("rows")
|
||||
private Info_0420315_P2 rows;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_2;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_2;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingServiceStatus")
|
||||
@Deprecated
|
||||
public class ReportBR_0420317 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_3;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_3;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -13,6 +13,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("unfundedLiabilities")
|
||||
@Deprecated
|
||||
public class ReportBR_0420318 extends ReportWithClearingStatus {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_4;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_4;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("accountTransactionLiabilities")
|
||||
@Deprecated
|
||||
public class ReportBR_0420314_P1 extends ReportWithClearingStatus {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_4;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_4;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("accountTransactionTurnover")
|
||||
@Deprecated
|
||||
public class ReportBR_0420314_P2 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage1")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P1 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage10")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P10 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage2")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P2 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage3")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P3 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage4")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P4 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage5")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P5 extends ReportWithPeriod {
|
||||
|
||||
@XStreamAsAttribute
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage6")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P6 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage7")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P7 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage8")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P8 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.spcex.clearing.reports.reports.bt_17_5;
|
||||
package ru.spcex.clearing.reports.reports.bt.bt_17_5;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@XStreamAlias("clearingCoverage9")
|
||||
@Deprecated
|
||||
public class ReportBR_0420312_P9 extends ReportWithPeriod {
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias("destination")
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
package ru.spcex.clearing.reports.services;
|
||||
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithPeriod;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithSessionId;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportRequestWithSessionIdList;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||
import ru.spcex.clearing.reports.config.element.ReportsServiceSettings;
|
||||
import ru.spcex.clearing.reports.reports.*;
|
||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||
import ru.spcex.platform.enumeration.ReportType;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
public class ReportService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final UserRoleVerification userRoleVerification;
|
||||
private final ValidationHelper validationHelper;
|
||||
private final Function<ReportRequest, IValidator> reportRequestValidator;
|
||||
private final Function<ReportRequestWithSessionId, IValidator> reportRequestWithSessionIdValidator;
|
||||
private final Function<ReportRequestWithSessionIdList, IValidator> reportRequestWithSessionIdListValidator;
|
||||
private final Function<ReportRequestWithPeriod, IValidator> reportRequestWithPeriodValidator;
|
||||
private final Map<ReportType, List<CSVReportBuilder<EmptyParams>>> reportBuildersWithoutParams;
|
||||
private final Map<ReportType, List<CSVReportBuilder<SessionIdParam>>> reportBuildersWithSessionIdParam;
|
||||
private final Map<ReportType, List<CSVReportBuilder<SessionIdListParams>>> reportBuildersWithSessionIdListParam;
|
||||
private final Map<ReportType, List<CSVReportBuilder<PeriodParams>>> reportBuildersWithPeriodParams;
|
||||
|
||||
private final File outFolder;
|
||||
|
||||
public ReportService(Consumer<String, Object> kafkaQueue,
|
||||
Producer<String, Object> kafkaResponseQueue,
|
||||
UserRoleVerification userRoleVerification,
|
||||
ValidationHelper validationHelper,
|
||||
ReportsServiceSettings reportsServiceSettings,
|
||||
@Qualifier("reportBuildersWithoutParams")
|
||||
Map<ReportType, List<CSVReportBuilder<EmptyParams>>> reportBuildersWithoutParams,
|
||||
@Qualifier("reportBuildersWithSessionIdParam")
|
||||
Map<ReportType, List<CSVReportBuilder<SessionIdParam>>> reportBuildersWithSessionIdParam,
|
||||
@Qualifier("reportBuildersWithSessionIdListParam")
|
||||
Map<ReportType, List<CSVReportBuilder<SessionIdListParams>>> reportBuildersWithSessionIdListParam,
|
||||
@Qualifier("reportBuildersWithPeriodParams")
|
||||
Map<ReportType, List<CSVReportBuilder<PeriodParams>>> reportBuildersWithPeriodParams,
|
||||
@Qualifier("reportRequestValidator")
|
||||
Function<ReportRequest, IValidator> reportRequestValidator,
|
||||
@Qualifier("reportRequestWithSessionIdValidator")
|
||||
Function<ReportRequestWithSessionId, IValidator> reportRequestWithSessionIdValidator,
|
||||
@Qualifier("reportRequestWithSessionIdListValidator")
|
||||
Function<ReportRequestWithSessionIdList, IValidator> reportRequestWithSessionIdListValidator,
|
||||
@Qualifier("reportRequestWithPeriodValidator")
|
||||
Function<ReportRequestWithPeriod, IValidator> reportRequestWithPeriodValidator) {
|
||||
super(kafkaQueue, kafkaResponseQueue);
|
||||
this.userRoleVerification = userRoleVerification;
|
||||
this.validationHelper = validationHelper;
|
||||
this.reportRequestValidator = reportRequestValidator;
|
||||
this.reportRequestWithSessionIdValidator = reportRequestWithSessionIdValidator;
|
||||
this.reportRequestWithSessionIdListValidator = reportRequestWithSessionIdListValidator;
|
||||
this.reportRequestWithPeriodValidator = reportRequestWithPeriodValidator;
|
||||
this.reportBuildersWithoutParams = reportBuildersWithoutParams;
|
||||
this.reportBuildersWithSessionIdParam = reportBuildersWithSessionIdParam;
|
||||
this.reportBuildersWithSessionIdListParam = reportBuildersWithSessionIdListParam;
|
||||
this.reportBuildersWithPeriodParams = reportBuildersWithPeriodParams;
|
||||
this.outFolder = new File(reportsServiceSettings.getReportModuleOut());
|
||||
assert outFolder.isDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
callback(ReportRequest.class)
|
||||
.setFunction(this::createReport)
|
||||
.forDestination(Consts.CREATE_REPORT, callbacks::put);
|
||||
callback(ReportRequestWithSessionId.class)
|
||||
.setFunction(this::createReportForSessionId)
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_SESSION_ID, callbacks::put);
|
||||
callback(ReportRequestWithSessionIdList.class)
|
||||
.setFunction(this::createReportForSessionIdList)
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_SESSION_ID_LIST, callbacks::put);
|
||||
callback(ReportRequestWithPeriod.class)
|
||||
.setFunction(this::createReportForPeriod)
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_PERIOD, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
public RequestInfoUpdate createReport(BaseRequest<ReportRequest> userRequest) {
|
||||
log.debug("ReportRequest received");
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestValidator);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
ReportRequest req = userRequest.getRequestPayload();
|
||||
log.debug("Create report type {}...", req.getReportId());
|
||||
|
||||
List<CSVReportBuilder<EmptyParams>> builders = reportBuildersWithoutParams.get(
|
||||
IEnumKey.getEnumByKey(ReportType.class, req.getReportId())
|
||||
);
|
||||
List<String> outFilenames = new ArrayList<>();
|
||||
for (CSVReportBuilder<EmptyParams> builder : builders) {
|
||||
File outFile = builder.createReport(new EmptyParams(), outFolder);
|
||||
if (outFile == null) continue;
|
||||
outFilenames.add(outFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
int outFilesCnt = outFilenames.size();
|
||||
if (outFilesCnt == 0) {
|
||||
log.error("Create report {} failed, see log", req.getReportId());
|
||||
} else if (outFilesCnt < builders.size()) {
|
||||
log.error("Create some error for {} failed, see log", req.getReportId());
|
||||
} else {
|
||||
log.debug("Reports {} successfully created. Output files: {}", req.getReportId(), String.join(", ", outFilenames));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RequestInfoUpdate createReportForSessionId(BaseRequest<ReportRequestWithSessionId> userRequest) {
|
||||
log.debug("ReportRequestWithSessionId received");
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestWithSessionIdValidator);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
ReportRequestWithSessionId req = userRequest.getRequestPayload();
|
||||
log.debug("Create report type {}...", req.getReportId());
|
||||
|
||||
List<CSVReportBuilder<SessionIdParam>> builders = reportBuildersWithSessionIdParam.get(
|
||||
IEnumKey.getEnumByKey(ReportType.class, req.getReportId())
|
||||
);
|
||||
List<String> outFilenames = new ArrayList<>();
|
||||
for (CSVReportBuilder<SessionIdParam> builder : builders) {
|
||||
SessionIdParam sessionIdParam = new SessionIdParam();
|
||||
sessionIdParam.setSessionId(req.getSessionId());
|
||||
File outFile = builder.createReport(sessionIdParam, outFolder);
|
||||
if (outFile == null) continue;
|
||||
outFilenames.add(outFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
int outFilesCnt = outFilenames.size();
|
||||
if (outFilesCnt == 0) {
|
||||
log.error("Create report {} failed, see log", req.getReportId());
|
||||
} else if (outFilesCnt < builders.size()) {
|
||||
log.error("Create some error for {} failed, see log", req.getReportId());
|
||||
} else {
|
||||
log.debug("Reports {} successfully created. Output files: {}", req.getReportId(), String.join(", ", outFilenames));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RequestInfoUpdate createReportForSessionIdList(BaseRequest<ReportRequestWithSessionIdList> userRequest) {
|
||||
log.debug("ReportRequestWithSessionIdList received");
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestWithSessionIdListValidator);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
ReportRequestWithSessionIdList req = userRequest.getRequestPayload();
|
||||
log.debug("Create report type {}...", req.getReportId());
|
||||
|
||||
List<CSVReportBuilder<SessionIdListParams>> builders = reportBuildersWithSessionIdListParam.get(
|
||||
IEnumKey.getEnumByKey(ReportType.class, req.getReportId())
|
||||
);
|
||||
List<String> outFilenames = new ArrayList<>();
|
||||
for (CSVReportBuilder<SessionIdListParams> builder : builders) {
|
||||
SessionIdListParams sessionIdListParams = new SessionIdListParams();
|
||||
sessionIdListParams.setSessionIdList(req.getSessionIdList());
|
||||
File outFile = builder.createReport(sessionIdListParams, outFolder);
|
||||
if (outFile == null) continue;
|
||||
outFilenames.add(outFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
int outFilesCnt = outFilenames.size();
|
||||
if (outFilesCnt == 0) {
|
||||
log.error("Create report {} failed, see log", req.getReportId());
|
||||
} else if (outFilesCnt < builders.size()) {
|
||||
log.error("Create some error for {} failed, see log", req.getReportId());
|
||||
} else {
|
||||
log.debug("Reports {} successfully created. Output files: {}", req.getReportId(), String.join(", ", outFilenames));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RequestInfoUpdate createReportForPeriod(BaseRequest<ReportRequestWithPeriod> userRequest) {
|
||||
log.debug("ReportRequestWithPeriod received");
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestWithPeriodValidator);
|
||||
if (requestInfoUpdate != null) return null;
|
||||
|
||||
ReportRequestWithPeriod req = userRequest.getRequestPayload();
|
||||
log.debug("Create report type {}...", req.getReportId());
|
||||
|
||||
List<CSVReportBuilder<PeriodParams>> builders = reportBuildersWithPeriodParams.get(
|
||||
IEnumKey.getEnumByKey(ReportType.class, req.getReportId())
|
||||
);
|
||||
List<String> outFilenames = new ArrayList<>();
|
||||
for (CSVReportBuilder<PeriodParams> builder : builders) {
|
||||
PeriodParams periodParams = new PeriodParams();
|
||||
periodParams.setStartDate(req.getStartDate());
|
||||
periodParams.setEndDate(req.getEndDate());
|
||||
File outFile = builder.createReport(periodParams, outFolder);
|
||||
if (outFile == null) continue;
|
||||
outFilenames.add(outFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
int outFilesCnt = outFilenames.size();
|
||||
if (outFilesCnt == 0) {
|
||||
log.error("Create report {} failed, see log", req.getReportId());
|
||||
} else if (outFilesCnt < builders.size()) {
|
||||
log.error("Create some error for {} failed, see log", req.getReportId());
|
||||
} else {
|
||||
log.debug("Reports {} successfully created. Output files: {}", req.getReportId(), String.join(", ", outFilenames));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import ru.spcex.clearing.reports.reports.AbstractReport;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Deprecated
|
||||
public abstract class FileReportBuilder {
|
||||
protected final Class<? extends AbstractReport> reportClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Deprecated
|
||||
public class XMLReportBuilder extends FileReportBuilder {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
protected final XStream xStream;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package ru.spcex.clearing.reports.services.collector;
|
||||
package ru.spcex.clearing.reports.services.collector.bt.bt_12_2;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||
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.reports.bt.bt_12_2.ReportPA_B;
|
||||
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;
|
||||
import ru.spcex.platform.enumeration.ClearingCategory;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
|
@ -20,6 +20,7 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Deprecated
|
||||
public class ReportPA_B_Collector extends ReportWithPeriodCollector<ReportPA_B> {
|
||||
private final Imdg<LiabilitiesClaimsAssets> liabilitiesClaimsAssetsImdg;
|
||||
private final Imdg<ClearingMemberCategory> clearingMemberCategoryImdg;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package ru.spcex.clearing.reports.services.collector;
|
||||
package ru.spcex.clearing.reports.services.collector.bt.bt_12_2;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||
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;
|
||||
import ru.spcex.clearing.reports.reports.bt.bt_12_2.ReportPA_IV;
|
||||
import ru.spcex.clearing.reports.services.ReportWithPeriodCollector;
|
||||
import ru.spcex.platform.enumeration.ClearingCategory;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
|
@ -20,6 +20,7 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Deprecated
|
||||
public class ReportPA_IV_Collector extends ReportWithPeriodCollector<ReportPA_IV> {
|
||||
private final Imdg<LiabilitiesClaimsAssets> liabilitiesClaimsAssetsImdg;
|
||||
private final Imdg<ClearingStatusDictionary> clearingStatusDictionaryImdg;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package ru.spcex.clearing.reports.services.collector;
|
||||
package ru.spcex.clearing.reports.services.collector.bt.bt_13;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.journal.InDocumentJournal;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.reports.reports.bt_13.ReportDOCIN;
|
||||
import ru.spcex.clearing.reports.reports.bt.bt_13.ReportDOCIN;
|
||||
import ru.spcex.clearing.reports.services.SimpleReportCollector;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
|
@ -17,6 +17,7 @@ import java.time.LocalTime;
|
|||
import java.util.Collection;
|
||||
|
||||
@Component
|
||||
@Deprecated
|
||||
public class ReportDOCIN_Collector extends SimpleReportCollector<ReportDOCIN> {
|
||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue