Merge branch 'dev' into report_25_26_29

This commit is contained in:
AKurakin 2022-12-29 17:44:37 +03:00
commit 867f30de6a
68 changed files with 32704 additions and 2708 deletions

View file

@ -129,34 +129,187 @@
<finalName>${project.artifactId}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<!--all doc generation: mvn clean xml:transform@ddl xml:transform@data xml:transform@db xml:transform@json xml:transform@core xml:transform@report xml:transform@web -->
<execution>
<!-- Generate DDL.sql from META file
command: mvn xml:transform@ddl -->
<id>ddl</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/ddl.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>ddl.sql</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate Data.sql from META and DATA file
command: mvn xml:transform@data -->
<id>data</id>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>src/main/resources/meta</dir>
<includes>
<include>data.xml</include>
</includes>
<stylesheet>src/main/resources/meta/xsl/data.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>data.sql</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate db.html - description from META and dATA file
command: mvn xml:transform@db -->
<id>db</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/db.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>db.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate meta.json - description from META file
command: mvn xml:transform@json -->
<id>json</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/json.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>meta.json</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate core.html - description from META* files
command: mvn xml:transform@core -->
<id>core</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/core.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>core.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate report.html - report description from META* files
command: mvn xml:transform@report -->
<id>report</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/report.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>report.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
<execution>
<!-- Generate web.html - description from META* files
command: mvn xml:transform@web -->
<id>web</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/web.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>web.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>src/main/resources/meta</dir>
<excludes>
<exclude>meta.server.xslt</exclude>
</excludes>
<stylesheet>src/main/resources/meta/meta.server.xslt</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.json</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>

View file

@ -3,6 +3,8 @@ package ru.spcex.clearing.backendapi.controller.queue.user;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
@ -33,6 +35,7 @@ import java.util.concurrent.ExecutionException;
@Controller
@RequestMapping("/users")
public class UserController extends AbstractQueueController {
private Logger log = LoggerFactory.getLogger(getClass());
private final IStateLoader stateLoader;
private final Imdg<User> userImdg;
@ -62,14 +65,18 @@ public class UserController extends AbstractQueueController {
@RequestMapping(method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public CudResponse update(
@RequestBody UserAuthAction userAuthAction) throws ExecutionException, InterruptedException {
@RequestBody UserAuthAction userUpdateAction) throws ExecutionException, InterruptedException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String username = KeycloakUtils.getUserNameFromAuthentication(authentication);
if (!username.equals(userUpdateAction.getUsername())) {
log.warn("user {} sended update request for user {}", username, userUpdateAction.getUsername());
throw new IllegalStateException("cannot perform delete action for " + username);
}
User user = userImdg.getSingleObjectByFieldValues(Map.of("identifier", username));
if (user == null) {
return processRequest(Consts.USER_AUTH_SUCCESS, userAuthAction);
log.info("user {} authenticated, but User object was not created", username);
}
throw new IllegalStateException("cannot create user cause it is exists: " + username);
return processRequest(Consts.USER_UPDATE, userUpdateAction);
}

View file

@ -2,35 +2,24 @@ package ru.spcex.clearing.backendapi.controller.request.cud.utilities;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import ru.spcex.clearing.backendapi.domain.actions.IAction;
import ru.spcex.clearing.backendapi.errors.BackEndError;
import ru.spcex.clearing.platform.messaging.domain.ActionType;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserAuthRequest;
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserUpdateRequest;
import ru.spcex.platform.enumeration.UserRole;
import ru.spcex.platform.utils.enumeration.EnumMessage;
import ru.spcex.platform.utils.enumeration.IEnumKey;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class UserAuthAction implements IAction<UserAuthRequest> {
public class UserAuthAction implements IAction<UserUpdateRequest> {
@JsonProperty
private String username;
@JsonProperty
private List<String> roles = new ArrayList<>();
@JsonSerialize(using = InstantSerializer.class)
@JsonDeserialize(using = InstantDeserializer.class)
@JsonProperty
private Instant time;
@JsonProperty
private String serverIp;
@JsonProperty
private String clientIp;
@Override
public Collection<EnumMessage> validate() {
@ -38,23 +27,27 @@ public class UserAuthAction implements IAction<UserAuthRequest> {
if (count != roles.size()) {
return List.of(new EnumMessage(BackEndError.KeycloakRepeatedRoles));
}
boolean unknownRolePresent = roles
.stream()
.anyMatch(role -> IEnumKey.getEnumByKey(UserRole.class, role) == null);
if (unknownRolePresent) {
return List.of(new EnumMessage(BackEndError.ValidationError, roles));
}
return Collections.emptyList();
}
@Override
public UserAuthRequest toRequest() {
UserAuthRequest userAuthRequest = new UserAuthRequest();
userAuthRequest.setServerIp(serverIp);
userAuthRequest.setUsername(username);
userAuthRequest.setRoles(roles);
userAuthRequest.setTime(time);
return userAuthRequest;
public UserUpdateRequest toRequest() {
UserUpdateRequest userUpdateRequest = new UserUpdateRequest();
userUpdateRequest.setUsername(username);
userUpdateRequest.setRoles(roles);
return userUpdateRequest;
}
@Override
public ActionType getActionType() {
return ActionType.SYSTEM;
return ActionType.UPDATE;
}
public String getUsername() {
@ -72,28 +65,4 @@ public class UserAuthAction implements IAction<UserAuthRequest> {
public void setRoles(List<String> roles) {
this.roles = roles;
}
public Instant getTime() {
return time;
}
public void setTime(Instant time) {
this.time = time;
}
public String getServerIp() {
return serverIp;
}
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
}

View file

@ -0,0 +1,42 @@
package ru.spcex.clearing.backendapi.controller.request.cud.utilities;
import ru.spcex.clearing.backendapi.domain.actions.IAction;
import ru.spcex.clearing.backendapi.errors.BackEndError;
import ru.spcex.clearing.platform.messaging.domain.ActionType;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserAuthRequest;
import ru.spcex.platform.utils.enumeration.EnumMessage;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class UserAuthSystemAction implements IAction<UserAuthRequest> {
private final UserAuthRequest authRequest;
public UserAuthSystemAction() {
this.authRequest = new UserAuthRequest();
}
public UserAuthRequest getAuthRequest() {
return authRequest;
}
@Override
public Collection<EnumMessage> validate() {
long count = authRequest.getRoles().stream().distinct().count();
if (count != authRequest.getRoles().size()) {
return List.of(new EnumMessage(BackEndError.KeycloakRepeatedRoles));
}
return Collections.emptyList();
}
@Override
public UserAuthRequest toRequest() {
return authRequest;
}
@Override
public ActionType getActionType() {
return ActionType.SYSTEM;
}}

View file

@ -5,9 +5,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import ru.spcex.clearing.backendapi.controller.request.cud.utilities.UserAuthAction;
import ru.spcex.clearing.backendapi.controller.request.cud.utilities.UserAuthSystemAction;
import ru.spcex.clearing.backendapi.controller.request.cud.utilities.UserLogoutAction;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserAuthRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserLogoutRequest;
import ru.spcex.platform.utils.log.ExceptionUtils;
@ -33,14 +34,15 @@ public class UserAuthProcessor {
}
public void sendAuthSuccessEvent(String identifier, Collection<String> roles, String userIp, String serverIp) {
UserAuthAction requestData = new UserAuthAction();
UserAuthSystemAction authEvent = new UserAuthSystemAction();
UserAuthRequest requestData = authEvent.toRequest();
requestData.setUsername(identifier);
requestData.setTime(Instant.now());
requestData.setRoles(new ArrayList<>(roles));
requestData.setServerIp(serverIp + ":" + serverPort); //getServerAddress() + ":" + serverPort
requestData.setClientIp(userIp);
try {
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, requestData);
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, authEvent);
} catch (Throwable e) { //ExecutionException | InterruptedException
log.error(ExceptionUtils.getStackTrace(e));
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
<meta version="2.4.2.0">
<meta version="2.4.4.0">
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
<!--Здесь словари-->
<enums>
@ -247,6 +247,11 @@
<createdAt field="created" type="4" name="Создано" shortname="Создано" searchable="true" sortable="true"/>
<updatedAt field="updated" type="4" name="Изменено" shortname="Изменено" searchable="true" sortable="true"/>
<identifier type="2" length="250" name="Внешний идентификатор" shortname="Идентификатор" searchable="true" sortable="true" visible="true"/>
<name type="2" length="250" name="Имя и фамилия пользователя" shortname="Имя и фамилия" searchable="true" sortable="true" visible="true"/>
<firstName type="2" length="250" name="Имя пользователя" shortname="Имя" searchable="true" sortable="true" visible="true"/>
<lastName type="2" length="250" name="Фамилия пользователя" shortname="Фамилия" searchable="true" sortable="true" visible="true"/>
<middleName type="2" length="250" name="Отчество пользователя" shortname="Отчество" searchable="true" sortable="true" visible="true"/>
<email type="2" length="250" name="Email пользователя" shortname="Email" searchable="true" sortable="true" visible="true"/>
<actions>
<put name="Авторизация пользователя">
<userName type="2" length="255" name="Логин пользователя" required="true"/>
@ -256,9 +261,9 @@
</userCls>
<userRoleSession name="Набор ролей" destination="user-role-sessions" class="ru.clearing.classes.statics.data.user.UserRoleSession" table="user_role_session">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<userId type="1" name="Идентификатор пользователя" shortname="Пользователь" searchable="true" sortable="true" visible="true" link="userCls"/>
<userId type="1" name="Идентификатор пользователя" shortname="Пользователь" searchable="true" sortable="true" visible="true" link="userCls" linkCode="name"/>
<userRole type="12" name="Идентификатор роли" shortname="Роль" searchable="true" sortable="true" visible="true" link="userRole"/>
<companyId type="1" name="Идентификатор компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company"/>
<companyId type="1" name="Идентификатор компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
<status type="12" name="Статус" shortname="Статус" searchable="true" sortable="true" link="workflowStatus"/>
</userRoleSession>
<userSettings name="Настройки пользователя" destination="utilities/user-settings" class="ru.clearing.classes.statics.data.user.UserSettings" table="user_settings">
@ -596,7 +601,7 @@
<createdAt field="created" type="4" name="Дата и время создания записи" shortname="Создано" searchable="true" sortable="true"/>
<updatedAt field="updated" type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true"/>
</clearmemberRegister>
<clearmemberRegisterChange name="Журнал изменений информации участников клиринга" destination="clearmember-register-changes" table="clearmember_register_change">
<clearmemberRegisterChange name="Журнал изменений информации участников клиринга" table="clearmember_register_change">
<date type="4" name="Дата и время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
<clearingCode type="2" length="255" name="Код участника клиринга" shortname="Клиринговый код" searchable="true" sortable="true" visible="true"/>
<comment type="2" length="255" name="Комментарий" shortname="Комментарий" searchable="true" sortable="true" visible="true"/>
@ -674,7 +679,7 @@
<swiftCode type="2" length="255" name="Код SWIFT" shortname="SWIFT" searchable="true" sortable="true" visible="true"/>
<taxpayerIdentificationNumber type="2" length="255" name="Идентификационный номер налогоплательщика (ИНН)" shortname="ИНН" searchable="true" sortable="true" visible="true"/>
<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" extends="account"/>
<account type="2" length="50" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true"/>
<companyId type="1" name="Компания" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<actions>
@ -1778,8 +1783,8 @@
<string id="2" name="Строка" type="varchar" javatype="String"/>
<long id="3" name="Целый" type="bigint" javatype="Long"/>
<dateTime id="4" name="Дата и время" type="timestamp" javatype="Instant"/>
<time id="5" name="Время" type="time" javatype="Instant"/>
<date id="6" name="Дата" type="date" javatype="Instant"/>
<time id="5" name="Время" type="time" javatype="LocalTime"/>
<date id="6" name="Дата" type="date" javatype="LocalDate"/>
<array id="7" name="Массив" type="json" javatype="String"/>
<object id="8" name="Объект" type="jsonb" javatype="String"/>
<boolean id="9" name="Булевый" type="boolean" javatype="Boolean"/>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
<xsl:variable name="data" select="document('..\data.xml')/meta"/>
<xsl:variable name="metaxsd" select="document('..\meta.xsd')/xs:schema"/>
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
<xsl:template match="/">
<html><xsl:apply-templates select="*"/></html>
</xsl:template>
<xsl:template match="meta">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Web</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">
table.sample {
border-width: 1px 1px 1px 1px;
border-spacing: 2px;
border-style: outset outset outset outset;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
-moz-border-radius: 0px 0px 0px 0px;
}
table.sample td {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
}
</style>
</head>
Version: <xsl:value-of select="@version"/>
<xsl:apply-templates select="objects"/>
<xsl:apply-templates select="enums"/>
</xsl:template>
<xsl:template match="objects">
<a name="objects"/>
<h2>Общее описание бизнес-объектов</h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:annotation/xs:documentation/."/></div>
<xsl:apply-templates select="*" mode="objects"/>
</xsl:template>
<xsl:template match="enums"><xsl:apply-templates select="*" mode="enums"/></xsl:template>
<xsl:template match="views"></xsl:template>
<xsl:template match="types"></xsl:template>
<xsl:template match="*" mode="objects">
<xsl:variable name="objectNum"><xsl:value-of select="position()"/></xsl:variable>
<xsl:variable name="objectName"><xsl:value-of select="name()"/></xsl:variable>
<a name="objects.{$objectName}"/>
<h2>1.<xsl:value-of select="$objectNum"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:annotation/xs:documentation/."/></div>
<br/>
<a name="objects.{$objectName}.actions"/>
<xsl:if test="actions">
<h3>1.<xsl:value-of select="$objectNum"/>.1. Обработка методов</h3>
</xsl:if>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:annotation/xs:documentation/."/></div>
<xsl:for-each select="actions/*">
<xsl:variable name="methodName"><xsl:value-of select="name()"/></xsl:variable>
<a name="objects.{$objectName}.actions.{$methodName}"/>
<h4>1.<xsl:value-of select="$objectNum"/>.1.<xsl:value-of select="position()"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h4>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:annotation/xs:documentation/."/></div>
<br/>
<table class="sample" id="{$objectName}{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="10%">Тип</td><td width="10%">Обяз.</td><td width="45%">Наименование</td></tr>
<xsl:for-each select="*">
<xsl:variable name="methodField"><xsl:value-of select="name()"/></xsl:variable>
<tr> <td style="vertical-align: top;"><xsl:value-of select="position()"/></td>
<td style="vertical-align: top;"><a name="objects.{$objectName}.actions.{$methodName}.{name()}"/><xsl:value-of select="name()"/></td>
<td style="vertical-align: top;">
<xsl:if test="@type">
<xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
</xsl:if>
</td>
<td style="vertical-align: top;">
<xsl:choose>
<xsl:when test="@required">O</xsl:when>
<xsl:when test="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:complexType/xs:sequence/xs:element[@name=$methodField]/xs:annotation/xs:documentation/.">
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:complexType/xs:sequence/xs:element[@name=$methodField]/xs:annotation/xs:documentation/."/></div>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</td>
<td style="vertical-align: top;">
<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if><br/>
<xsl:if test="@link"><br/>Ссылается на объект: <xsl:value-of select="@link"/></xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
<a name="objects.{$objectName}.fields"/>
<h3>1.<xsl:value-of select="$objectNum"/>.2. Поля объекта</h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td>Тип</td><td>Наименование</td><td width="45%">Обработка</td></tr>
<xsl:for-each select="*[name()!='actions' and not(@extends)]">
<xsl:variable name="attributeName"><xsl:value-of select="name()"/></xsl:variable>
<tr> <td style="vertical-align: top;"><xsl:value-of select="position()"/></td>
<td style="vertical-align: top;">
<xsl:choose>
<xsl:when test="@linkKeyCode"><a name="objects.{$objectName}.fields.{@linkCode}"/><xsl:value-of select="@linkCode"/></xsl:when>
<xsl:otherwise><a name="objects.{$objectName}.fields.{name()}"/><xsl:value-of select="name()"/></xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
</td>
<td style="vertical-align: top;">
<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if>
<br/>
<xsl:if test="@link"><br/>Ссылается на объект: <xsl:value-of select="@link"/>
<xsl:if test="@linkKeyCode">&#160;Содержит значение <xsl:value-of select="@linkCode"/> объекта <xsl:value-of select="@link"/> связанного по полям <xsl:value-of select="name()"/>=<xsl:value-of select="@link"/>.<xsl:value-of select="@linkKeyCode"/><br/></xsl:if>
<!--xsl:variable name="linkData"><xsl:value-of select="@link"/></xsl:variable>
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$linkData]">
<br/><xsl:value-of select="@code"/>(<xsl:value-of select="@id"/>) - <i><xsl:value-of select="@name"/></i>
</xsl:for-each-->
</xsl:if>
</td>
<td style="vertical-align: top;">
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name=$attributeName]/xs:annotation/xs:documentation/."/></div>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="*" mode="enums">
<xsl:variable name="enumName"><xsl:value-of select="name()"/></xsl:variable>
<a name="enums.{name()}"/>
<h3>2.<xsl:value-of select="position()"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="20%">Наименование</td><td width="10%">Тип</td></tr>
<xsl:apply-templates select="*" mode="field-enums"/>
</table>
<div>Значения:</div>
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$enumName]">
<xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> - <i><xsl:value-of select="@name"/></i><br/>
</xsl:for-each>
</xsl:template>
<xsl:template match="*" mode="field-enums">
<tr><td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name()"/></td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='type'">
<td>
<xsl:value-of select="name(/meta/types/*[@id=current()])"/>
<xsl:if test="../@length">(<xsl:value-of select="../@length"/>)</xsl:if>
</td>
</xsl:when>
<!--xsl:when test="name()='name'"><td><xsl:value-of select="."/></td></xsl:when-->
<xsl:when test="name()='shortname'"><td><xsl:value-of select="."/></td></xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output version="1.0" method="text" indent="yes" 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:variable name="meta" select="document('..\meta.xml')/meta"/>
<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
<xsl:template match="meta">-- DB version: <xsl:value-of select="$meta/@version"/>
-- DATA 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="type" mode="types">
-- <xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> : <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:variable name="nodeName" select="name()"/>
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(xalan:nodeset($meta)/enums/*[name()=$nodeName]),"Dictionary")'/></xsl:call-template></xsl:variable>
INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@*" mode="tablename">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>) ON CONFLICT (ID) DO UPDATE SET <xsl:apply-templates select="@*" mode="tablename-conflict-set">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>;
</xsl:template>
<xsl:template match="*" mode="objects">
<xsl:variable name="nodeName" select="name()"/>
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(xalan:nodeset($meta)/objects/*[name()=$nodeName])'/></xsl:call-template></xsl:variable>
INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@*" mode="tablename">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>) ON CONFLICT (ID) DO UPDATE SET <xsl:apply-templates select="@*" mode="tablename-conflict-set">
<xsl:with-param name="nodeName" select="$nodeName"/>
</xsl:apply-templates>;
</xsl:template>
<xsl:template match="@*" mode="tablename">
<xsl:param name="nodeName"/>
<xsl:variable name="fieldName" select="name()"/>
<xsl:choose>
<xsl:when test="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]">
<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>
<!--xsl:value-of select="name()"/-->
</xsl:when>
</xsl:choose>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:template>
<xsl:template match="@*" mode="values">
<xsl:param name="nodeName"/>
<xsl:variable name="fieldName" select="name()"/>
<xsl:variable name="field" select="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]"/>
<xsl:choose>
<xsl:when test="xalan:nodeset($field)/@type='2'">'<xsl:value-of select="."/>'</xsl:when>
<xsl:when test="xalan:nodeset($field)/@type='12'">'<xsl:value-of select="."/>'</xsl:when>
<xsl:when test="xalan:nodeset($field)/@type='4'">'<xsl:value-of select="."/>'</xsl:when>
<xsl:when test="xalan:nodeset($field)/@type='5'">'<xsl:value-of select="."/>'</xsl:when>
<xsl:when test="xalan:nodeset($field)/@type='6'">'<xsl:value-of select="."/>'</xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:template>
<xsl:template match="@*" mode="tablename-conflict-set">
<xsl:param name="nodeName"/>
<xsl:variable name="fieldName" select="name()"/>
<xsl:variable name="dbFieldName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
<xsl:choose>
<xsl:when test="$dbFieldName='ID'">
</xsl:when>
<xsl:when test="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]">
<xsl:value-of select="$dbFieldName"/> = EXCLUDED.<xsl:value-of select="$dbFieldName"/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:when>
</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>
</xsl:stylesheet>

View file

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
<xsl:variable name="data" select="document('..\data.xml')/meta"/>
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
<xsl:template match="/">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Web</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">
table.sample {
border-width: 1px 1px 1px 1px;
border-spacing: 2px;
border-style: outset outset outset outset;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
-moz-border-radius: 0px 0px 0px 0px;
}
table.sample td {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
}
</style>
</head>
Version: <xsl:value-of select="@version"/>
<xsl:apply-templates select="reports"/>
<xsl:apply-templates select="*"/></xsl:template>
<xsl:template match="meta">-- 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="views">
/* views */
</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: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="enumName"><xsl:value-of select="name()"/></xsl:variable>
<h3><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/> - <xsl:value-of select="$dbTableName"/>( <xsl:value-of select="name()"/>)</h3>
<table class="sample" width="100%" border="0">
<tr><td width="10%"></td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
<xsl:apply-templates select="*" mode="comment-enums"/>
</table>
<a name="enums.{name()}"/>
<div>Значения:</div>
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$enumName]">
<xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> - <i><xsl:value-of select="@name"/></i><br/>
</xsl:for-each>
</xsl:template>
<xsl:template match="*" mode="objects">
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
<h3><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/> - <xsl:value-of select="$dbTableName"/>( <xsl:value-of select="name()"/>)</h3>
<table class="sample" width="100%" border="0">
<tr><td width="10%"></td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
<xsl:apply-templates select="*" mode="comment-objects"/>
</table>
</xsl:template>
<xsl:template match="*" mode="field" >
<xsl:if test="position() != '1'">, </xsl:if>
<xsl:variable name="tp" select="@type"/>
<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>&#160;<xsl:value-of select="/meta/types/*[@id=$tp]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if><xsl:if test="name()='id'"> PRIMARY KEY</xsl:if>
</xsl:template>
<xsl:template match="*" mode="comment-enums">
<tr>
<td width="5%"><xsl:value-of select="position()"/></td>
<td width="10%"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></td>
<td width="20%"><xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
</td>
<td width="45%"><xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if></td></tr>
</xsl:template>
<xsl:template match="*" mode="comment-objects">
<xsl:if test="name() != 'actions'">
<tr>
<td width="5%"><xsl:value-of select="position()"/></td>
<td width="10%"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></td>
<td width="20%"><xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
</td>
<td width="45%"><xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if></td></tr>
</xsl:if>
</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>
</xsl:stylesheet>

View file

@ -0,0 +1,194 @@
<?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">-- 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="views">
/* views */
</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>
DROP TABLE IF EXISTS <xsl:value-of select="$dbTableName"/>;
CREATE TABLE <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*" mode="field"/>);
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="@name"/>';
<xsl:apply-templates select="*" mode="comment-enums"/>
</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>
DROP TABLE IF EXISTS <xsl:value-of select="$dbTableName"/>;
CREATE TABLE <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*[@name or @type]" mode="field"/>);
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="@name"/>';
<xsl:apply-templates select="*[@name or @type]" mode="comment-objects"/>
<xsl:if test="@logUpdates">
-- History log of <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>
DROP TABLE IF EXISTS <xsl:value-of select="$dbTableName"/>_HISTORY;
CREATE TABLE <xsl:value-of select="$dbTableName"/>_HISTORY(<xsl:value-of select="$dbTableName"/>_ID BIGINT NOT NULL, EVENT_TIME timestamp, EVENT_USER_ID BIGINT, EVENT_TYPE VARCHAR(4), <xsl:apply-templates select="*[@name or @type]" mode="field"/>);
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/>_HISTORY IS 'История изменений таблицы <xsl:value-of select="name()"/>';
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.<xsl:value-of select="$dbTableName"/>_ID IS 'Идентификатор записи в таблице <xsl:value-of select="$dbTableName"/>';
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_TIME IS 'Дата и время изменения';
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_USER_ID IS 'Инициатор изменения';
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_TYPE IS 'Тип изменения';
<xsl:apply-templates select="*[@name or @type]" mode="comment-history-objects"/>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="field" >
<xsl:variable name="tp" select="@type"/>
<xsl:choose>
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
<xsl:when test="@linkKeyCode"></xsl:when>
<xsl:when test="@extends"></xsl:when>
<xsl:otherwise><xsl:if test="position() != '1'">, </xsl:if><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@linkKeyCode"></xsl:when>
<xsl:when test="@extends"></xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text><xsl:value-of select="/meta/types/*[@id=$tp]/@type"/>
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if><xsl:if test="name()='id'"> PRIMARY KEY</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="comment-enums">
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(parent::*),"Dictionary")'/></xsl:call-template></xsl:variable>
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
</xsl:template>
<xsl:template match="*" mode="comment-objects">
<xsl:choose>
<xsl:when test="@linkKeyCode"></xsl:when>
<xsl:when test="@extends"></xsl:when>
<xsl:otherwise>
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(parent::*)'/></xsl:call-template></xsl:variable>
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
</xsl:otherwise></xsl:choose></xsl:template>
<xsl:template match="*" mode="comment-history-objects"><!-- todo похож на comment-objects только именем таблицы различается попробовать объединить -->
<xsl:choose>
<xsl:when test="@linkKeyCode"></xsl:when>
<xsl:when test="@extends"></xsl:when>
<xsl:otherwise>
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(parent::*)'/></xsl:call-template></xsl:variable>
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
</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>
</xsl:stylesheet>

View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
<xsl:variable name="data" select="document('..\data.xml')/meta"/>
<xsl:variable name="metaxsd" select="document('..\meta.xsd')/xs:schema"/>
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
<xsl:template match="/">
<html><xsl:apply-templates select="*"/></html>
</xsl:template>
<xsl:template match="meta">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Web</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">
table.sample {
border-width: 1px 1px 1px 1px;
border-spacing: 2px;
border-style: outset outset outset outset;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
-moz-border-radius: 0px 0px 0px 0px;
}
table.sample td {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
}
</style>
</head>
Version: <xsl:value-of select="@version"/>
<xsl:apply-templates select="reports"/>
<!--xsl:apply-templates select="enums"/-->
</xsl:template>
<xsl:template match="objects">
</xsl:template>
<xsl:template match="reports">
<a name="reports"/>
<h2>Общее описание отчетов</h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:annotation/xs:documentation/."/></div>
<xsl:apply-templates select="*" mode="reports"/>
</xsl:template>
<xsl:template match="enums"><xsl:apply-templates select="*" mode="enums"/></xsl:template>
<xsl:template match="views"></xsl:template>
<xsl:template match="types"></xsl:template>
<xsl:template match="*" mode="reports">
<xsl:variable name="reportNum"><xsl:value-of select="position()"/></xsl:variable>
<xsl:variable name="reportName"><xsl:value-of select="name()"/></xsl:variable>
<a name="reports.{$reportName}"/>
<h2>1.<xsl:value-of select="$reportNum"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:annotation/xs:documentation/."/></div>
<br/>
<xsl:for-each select="@*">
<xsl:variable name="reportField"><xsl:value-of select="name()"/></xsl:variable>
<div style="white-space: pre-wrap;"><xsl:value-of select="position()"/>. <xsl:value-of select="name()"/>=<xsl:value-of select="."/>
<xsl:if test="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:attribute[@name=$reportField]/xs:annotation/xs:documentation/."> - <xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:attribute[@name=$reportField]/xs:annotation/xs:documentation/."/>
</xsl:if>
</div>
</xsl:for-each>
<a name="reports.{$reportName}.fields"/>
<h3>1.<xsl:value-of select="$reportNum"/>.2. Поля объекта</h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="45%">Обработка</td></tr>
<xsl:for-each select="rows/@*">
<xsl:variable name="attributeName"><xsl:value-of select="name()"/></xsl:variable>
<tr> <td style="vertical-align: top;"><xsl:value-of select="position()"/></td>
<td style="vertical-align: top;">
<a name="reports.{$reportName}.fields.{name()}"/><xsl:value-of select="name()"/>
</td>
<td style="vertical-align: top;">
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:sequence/xs:element[@name='rows']/xs:complexType/xs:attribute[@name=$attributeName]/xs:annotation/xs:documentation/."/></div>
</td>
</tr>
</xsl:for-each>
</table>
<div>Пример:</div>
<div><textarea autocomplete="on" cols="100" rows="8"><xsl:copy-of select="."/></textarea></div>
</xsl:template>
<xsl:template match="*" mode="enums">
<a name="enums.{name()}"/>
<h3>2.<xsl:value-of select="position()"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="45%">Описание</td><td width="20%">Наименование</td><td width="20%">Тип</td></tr>
<xsl:apply-templates select="*" mode="field-enums"/>
</table>
</xsl:template>
<xsl:template match="*" mode="field-enums">
<tr><td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name()"/></td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='type'">
<td>
<xsl:value-of select="name(/meta/types/*[@id=current()])"/>
<xsl:if test="../@length">(<xsl:value-of select="../@length"/>)</xsl:if>
</td>
</xsl:when>
<xsl:when test="name()='searchable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='sortable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='visible'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='required'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='hidden'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='ignored'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='cacheable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='name'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='shortname'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='link'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='field'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='dbfield'"><td><xsl:value-of select="."/></td></xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,172 @@
<?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="html" indent="no" encoding="UTF-8"/>
<xsl:template match="/">
<html><xsl:apply-templates select="*"/></html>
</xsl:template>
<xsl:template match="meta">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Web</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">
table.sample {
border-width: 1px 1px 1px 1px;
border-spacing: 2px;
border-style: outset outset outset outset;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
-moz-border-radius: 0px 0px 0px 0px;
}
table.sample td {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
}
</style>
</head>
Version: <xsl:value-of select="@version"/>
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="enums">
<xsl:apply-templates select="*" mode="enums"/>
</xsl:template>
<xsl:template match="objects">
<xsl:apply-templates select="*" mode="objects"/>
</xsl:template>
<xsl:template match="views">
<!--xsl:apply-templates select="*" mode="views"/-->
</xsl:template>
<xsl:template match="types">
<h2>Data types</h2>
<table class="sample" id="types" width="100%" border="0">
<xsl:apply-templates select="*" mode="types"/>
</table>
</xsl:template>
<xsl:template match="*" mode="types">
<tr><td><xsl:value-of select="@id"/></td><td><xsl:value-of select="name()"/></td><td><xsl:value-of select="@type"/></td><td><xsl:value-of select="@name"/></td></tr>
</xsl:template>
<xsl:template match="*" mode="enums">
<h2><!--1.<xsl:value-of select="position()"/>. --><xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="45%">Описание</td><td width="20%">Наименование</td><td width="20%">Тип</td></tr>
<xsl:apply-templates select="*" mode="field-enums"/>
</table>
</xsl:template>
<xsl:template match="*" mode="objects">
<h2><!--2.<xsl:value-of select="position()"/>. --><xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td><!--td width="20%">Видимость</td--></tr>
<xsl:apply-templates select="*" mode="field-objects"/>
</table>
<!--xsl:apply-templates select="query|subscription|subscriptionHistory" mode="objects"/>
<xsl:if test="actions">,"actions":[<xsl:apply-templates select="actions" mode="objects"/>]</xsl:if>
<xsl:if test="views">,"views":{<xsl:apply-templates select="views" mode="objects"/>}</xsl:if-->
</xsl:template>
<xsl:template match="*" mode="field-enums">
<tr><td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name()"/></td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='type'">
<td>
<xsl:value-of select="name(/meta/types/*[@id=current()])"/>
<xsl:if test="../@length">(<xsl:value-of select="../@length"/>)</xsl:if>
</td>
</xsl:when>
<xsl:when test="name()='searchable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='sortable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='visible'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='required'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='hidden'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='ignored'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='cacheable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='name'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='shortname'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='link'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='field'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='dbfield'"><td><xsl:value-of select="."/></td></xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
<xsl:template match="*" mode="field-objects">
<tr><td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name()"/>
<!--br/>поле: <xsl:value-of select="@field"/>
<br/>столбец:<xsl:value-of select="@dbfield"/-->
</td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='type'">
<td>
<xsl:value-of select="name(/meta/types/*[@id=current()])"/>
<xsl:if test="../@length">(<xsl:value-of select="../@length"/>)</xsl:if>
</td>
</xsl:when>
<xsl:when test="name()='shortname'">
<td>
<i><xsl:value-of select="."/></i>. <!--br/-->
<xsl:if test="../@name"><xsl:value-of select="../@name"/></xsl:if>
<xsl:if test="../@link"><br/>Ссылается на объект :<xsl:value-of select="../@link"/></xsl:if>
</td>
<!--td>
<xsl:if test="../@searchable">Поиск: <xsl:value-of select="../@searchable"/></xsl:if>
<xsl:if test="../@sortable"><br/>Сортировка:<xsl:value-of select="../@sortable"/></xsl:if>
<xsl:if test="../@visible"><br/>Видимость: <xsl:value-of select="../@visible"/></xsl:if>
<xsl:if test="../@hidden"><br/>Скрыт:<xsl:value-of select="../@hidden"/></xsl:if>
<xsl:if test="../@ignored"><br/>Игнорируемый: <xsl:value-of select="../@ignored"/></xsl:if>
<xsl:if test="../@sendable"><br/>Отправляемый:<xsl:value-of select="../@sendable"/></xsl:if>
</td-->
</xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
<xsl:template match="@*" mode="withSource">
<xsl:choose>
<xsl:when test="name()='type'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='length'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='searchable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='sortable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='visible'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='required'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:when test="name()='cacheable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
<xsl:otherwise>"<xsl:value-of select="parent::*/@source"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -24,6 +24,7 @@ import ru.spcex.platform.utils.enumeration.EnumMessage;
import ru.spcex.platform.utils.enumeration.IMessageResolver;
import ru.spcex.platform.utils.validation.IValidator;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@ -34,9 +35,8 @@ import java.util.function.Function;
@Service
public class Sdf16Executor extends AbstractExecutor<SDf16> {
private final Logger log = LoggerFactory.getLogger(getClass());
private final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
private final Logger log = LoggerFactory.getLogger(getClass());
private final Imdg<Statement> statementImdg;
private final Function<SDf16, IValidator> sDf16Validator;
private final LoggingService errorLogger;
@ -200,15 +200,15 @@ public class Sdf16Executor extends AbstractExecutor<SDf16> {
successSdf.setGenerationId(generationIdForGroup);
successSdf.setGenerationTime(Instant.now());
successSdf.setInSDf16Id(sdf.getId());
successSdf.setResult(0);
successSdf.setResult(new BigDecimal(0));
return successSdf;
}
private Integer obtainResultNum(EnumMessage error){
private BigDecimal obtainResultNum(EnumMessage error) {
if (BalanceError.AccountNotPresent.equalsById(error.getSubject().getId()))
return 1;
return new BigDecimal(1);
if (BalanceError.BalanceNotEnough.equalsById(error.getSubject().getId()))
return 1;
return 9;
return new BigDecimal(1);
return new BigDecimal(9);
}
}

View file

@ -20,6 +20,9 @@ public enum AccountBalanceValidationRule implements IValidationRule<ImdgValidati
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<AccountBalanceValidation> context) {
AccountBalanceValidation validatedObject = context.getValidatedObject();
if (validatedObject.addresseeId() == null) {
return of(BalanceError.CompanyNotFound);
}
Imdg<Company> companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class);
Company company = companyImdg.getSingleObjectByID(validatedObject.addresseeId());
if (company == null) {
@ -33,6 +36,9 @@ public enum AccountBalanceValidationRule implements IValidationRule<ImdgValidati
@Override
public Optional<EnumMessage> validate(ImdgValidationContext<AccountBalanceValidation> context) {
AccountBalanceValidation validatedObject = context.getValidatedObject();
if (validatedObject.accountId() == null) {
return of(BalanceError.AccountNotPresent);
}
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
Account account = accountImdg.getSingleObjectByFieldValues(Map.of("id", validatedObject.accountId(),
"accountType", AccountType.Clrn.getKey()));

View file

@ -10,6 +10,8 @@ import ru.clearing.classes.statics.data.account.Account;
import ru.clearing.classes.statics.data.company.Company;
import ru.spcex.clearing.balance.config.*;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.Status;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
@ -27,6 +29,10 @@ import java.util.concurrent.atomic.AtomicLong;
KafkaSenderConfig.class,
KafkaTestConfig.class})
public abstract class AbstractServiceTest {
protected final Long accountIdNew = 1L;
protected final Long addresseeIdNew = 2L;
protected final String deal = "111111111";
protected final String acc = "123456789";
protected AtomicLong currentId = new AtomicLong(0L);
protected IMap<Long, Company> companyMap;
protected IMap<Long, Account> accountMap;
@ -43,4 +49,21 @@ public abstract class AbstractServiceTest {
accountMap = accountImdg.getMap();
}
protected Company getTestCompany() {
Company company = new Company();
company.setId(addresseeIdNew);
company.setTradingCode(deal);
company.setShortName("ShortName");
company.setFullName("FullName");
return company;
}
protected Account getTestAccount(Long id) {
Account account = new Account();
account.setId(id);
account.setAccount(acc);
account.setAccountType(AccountType.Clrn.getKey());
account.setAccountStatus(Status.Active.getKey());
return account;
}
}

View file

@ -19,10 +19,7 @@ import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFields
class AccountBalanceServiceTest extends AbstractServiceTest {
public static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
private final Long id = 0L;
private final Long accountIdNew = 0L;
private final Long addresseeIdNew = 0L;
private static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
private final BigDecimal amountNew = new BigDecimal(1000);
private final String cashMovementCurrencyCodeNew = "cash";
private final Long accountIdUpdate = accountIdNew;
@ -43,21 +40,13 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
*/
@Test
void createAccountBalance() {
Company company = new Company();
company.setId(addresseeIdNew);
company.setTradingCode("code");
company.setShortName("ShortName");
company.setFullName("FullName");
companyMap.put(id, company);
Account account = new Account();
account.setId(accountIdNew);
account.setAccount("123456789");
account.setAccountType(AccountType.Clrn.getKey());
account.setAccountStatus(Status.Active.getKey());
accountMap.put(id, account);
Company company = getTestCompany();
companyMap.put(addresseeIdNew, company);
Account account = getTestAccount(accountIdNew);
accountMap.put(accountIdNew, account);
AccountBalance accountBalanceNew = new AccountBalance();
accountBalanceNew.setId(id);
accountBalanceNew.setId(accountIdNew);
accountBalanceNew.setCompanyId(addresseeIdNew);
accountBalanceNew.setAccountId(accountIdNew);
accountBalanceNew.setAccountType(account.getAccountType());
@ -72,10 +61,10 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
accountBalanceNew.setFullName(company.getFullName());
AccountResult predictableNewResult = new AccountResult(accountBalanceNew);
AccountResult resultNew = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
resultNew.getAccount().setId(id);
resultNew.getAccount().setId(accountIdNew);
AccountBalance accountBalanceUpdate = new AccountBalance();
accountBalanceUpdate.setId(id);
accountBalanceUpdate.setId(accountIdNew);
accountBalanceUpdate.setCompanyId(addresseeIdUpdate);
accountBalanceUpdate.setAccountId(accountIdUpdate);
accountBalanceUpdate.setAccountType(account.getAccountType());
@ -89,7 +78,7 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
accountBalanceUpdate.setShortName(company.getShortName());
accountBalanceUpdate.setFullName(company.getFullName());
AccountResult resultUpdate = accountBalanceService.createAccountBalance(addresseeIdUpdate, accountIdUpdate, amountUpdate, cashMovementCurrencyCodeUpdate);
resultUpdate.getAccount().setId(id);
resultUpdate.getAccount().setId(accountIdNew);
AccountResult predictableUpdateResult = new AccountResult(accountBalanceUpdate);
ACCOUNT_BALANCE_MATCHER.assertMatch(resultNew, predictableNewResult);
@ -110,18 +99,20 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
//CompanyNotFound
AccountResult predictableResult;
predictableResult = new AccountResult(new EnumMessage(BalanceError.CompanyNotFound));
companyMap.delete(addresseeIdNew);
AccountResult result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
result = accountBalanceService.createAccountBalance(null, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
//AccountNotPresent accountType=null
Company company = new Company();
company.setId(addresseeIdNew);
companyMap.put(id, company);
companyMap.put(addresseeIdNew, getTestCompany());
Account account = new Account();
account.setId(accountIdNew);
account.setAccountStatus(Status.Active.getKey());
accountMap.put(id, account);
accountMap.put(accountIdNew, account);
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
@ -131,7 +122,7 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
account.setId(null);
account.setAccountType(AccountType.Clrn.getKey());
account.setAccountStatus(Status.Active.getKey());
accountMap.put(id, account);
accountMap.put(accountIdNew, account);
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
@ -141,15 +132,16 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
account.setId(accountIdNew);
account.setAccountType(AccountType.Clrn.getKey());
account.setAccountStatus(null);
accountMap.put(id, account);
accountMap.put(accountIdNew, account);
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotActive, account.getId()));
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
account.setAccountStatus(Status.Active.getKey());
accountMap.put(id, account);
accountMap.put(accountIdNew, account);
result = accountBalanceService.createAccountBalance(addresseeIdNew, null, amountNew, cashMovementCurrencyCodeNew);
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
}
}

View file

@ -5,25 +5,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import ru.clearing.classes.statics.data.account.Account;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.sdf.SDf01;
import ru.clearing.classes.statics.data.statement.Statement;
import ru.spcex.clearing.balance.utils.MatcherFactory;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.Status;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator;
class Sdf01ExecutorTest extends AbstractServiceTest {
private static final MatcherFactory.Matcher<Result> SDF01_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
private final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
private final Long id = currentId.getAndIncrement();
@Autowired
Sdf01Executor sdf01Executor;
private final String deal = "111111111";
private final String acc = "123456789";
private final Long id = currentId.getAndIncrement();
@Test
void execute() {
//check create statement
SDf01 sDf01 = new SDf01();
sDf01.setMarket("U");//!"U".equals
sDf01.setDeal(deal);//tradingCode
@ -32,21 +35,18 @@ class Sdf01ExecutorTest extends AbstractServiceTest {
sDf01.setDat(LocalDate.now().format(datFormatter));
sDf01.setAcc_type("A");
Company company = new Company();
company.setTradingCode(deal);
Company company = getTestCompany();
companyMap.put(id, company);
Account account = new Account();
account.setId(id);
account.setAccount(acc);
account.setAccountType(AccountType.Clrn.getKey());
account.setAccountStatus(Status.Active.getKey());
Account account = getTestAccount(id);
accountMap.put(id, account);
StatementRequest statementRequest = new StatementRequest();
Result predictableResult = new Result();
predictableResult.setGenerationId(id);
Statement predictableStatement = new Statement();
Result result = sdf01Executor.execute(Collections.singletonList(sDf01), statementRequest);
SDF01_MATCHER.assertMatch(result, predictableResult);
}
}

View file

@ -11,6 +11,7 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
private Instant eventTime;
private Long userId;
private String eventType; // varchar(4)
public Instant getEventTime() {
return eventTime;
@ -20,6 +21,14 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
this.eventTime = eventTime;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public Long getUserId() {
return userId;
}
@ -36,6 +45,7 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
public String toString() {
return getClass().getSimpleName() + "{" +
"eventTime=" + eventTime +
"eventType=" + eventType +
", userId=" + userId +
", object=" + getObject() +
'}';

View file

@ -0,0 +1,244 @@
package ru.clearing.classes.statics.data.execution;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
public class ExecutionDeposit extends BusinessObject {
private Long exchangeExecutionId;
private Instant exchangeExecutionTime;
private LocalDate tradingDate;
private Long accountId;
private String market;
private BigDecimal price;
private BigDecimal lots;
private BigDecimal quantity;
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 LocalDate firstLegSettlementCode;
private LocalDate secondLegSettlementCode;
private String securityFullName;
private String securitySymbol;
private Long securityId;
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 getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
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;
}
public BigDecimal getFirstLegAmount() {
return firstLegAmount;
}
public void setFirstLegAmount(BigDecimal firstLegAmount) {
this.firstLegAmount = firstLegAmount;
}
public BigDecimal getSecondLegAmount() {
return secondLegAmount;
}
public void setSecondLegAmount(BigDecimal secondLegAmount) {
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;
}
public void setFirstLegSettlementDate(LocalDate firstLegSettlementDate) {
this.firstLegSettlementDate = firstLegSettlementDate;
}
public LocalDate getSecondLegSettlementDate() {
return secondLegSettlementDate;
}
public void setSecondLegSettlementDate(LocalDate secondLegSettlementDate) {
this.secondLegSettlementDate = secondLegSettlementDate;
}
public LocalDate getFirstLegSettlementCode() {
return firstLegSettlementCode;
}
public void setFirstLegSettlementCode(LocalDate firstLegSettlementCode) {
this.firstLegSettlementCode = firstLegSettlementCode;
}
public LocalDate getSecondLegSettlementCode() {
return secondLegSettlementCode;
}
public void setSecondLegSettlementCode(LocalDate secondLegSettlementCode) {
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 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;
}
}

View file

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

View file

@ -0,0 +1,128 @@
package ru.clearing.classes.statics.data.liabilities;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.LocalDate;
public class LiabilitiesClaimsMoney extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId;
private Long accountId;
private String accountType;
private String account;
private BigDecimal liabilitiesAmount;
private BigDecimal claimsAmount;
private LocalDate settlementDate;
private LocalDate tradingDate;
private String currency;
private String tradingCode;
private String shortName;
private String fullName;
private LocalDate clearingDate;
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public BigDecimal getLiabilitiesAmount() {
return liabilitiesAmount;
}
public void setLiabilitiesAmount(BigDecimal liabilitiesAmount) {
this.liabilitiesAmount = liabilitiesAmount;
}
public BigDecimal getClaimsAmount() {
return claimsAmount;
}
public void setClaimsAmount(BigDecimal claimsAmount) {
this.claimsAmount = claimsAmount;
}
public LocalDate getSettlementDate() {
return settlementDate;
}
public void setSettlementDate(LocalDate settlementDate) {
this.settlementDate = settlementDate;
}
public LocalDate getTradingDate() {
return tradingDate;
}
public void setTradingDate(LocalDate tradingDate) {
this.tradingDate = tradingDate;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String tradingCode) {
this.tradingCode = tradingCode;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -1,30 +0,0 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalTime;
/**
* Реестр сделок допущенных к клирингу
* <p>
* DB table: ADMITTED_DEAL_REGISTER
**/
public class AdmittedDealRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String companyFullName;
private Instant executionDepositRegisterTradingDate;
private String exchangeExecutionId;
private LocalTime exchangeExecutionTime;
private Long securityShortName;
private String sellerFullName;
private String sellerClearingCode;
private String sellerAccount;
private String buyerFullName;
private String buyerClearingCode;
private String buyerAccount;
private BigDecimal executionDepositRegisterAmount;
}

View file

@ -0,0 +1,138 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
public class BalanceRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Instant sDf01Date;
private String currencyCode;
private String setHouseName;
private String account;
private String infoAccount;
private BigDecimal remainderSum;
private BigDecimal blockedSum;
private BigDecimal unblockedSum;
private String inn;
private Long market;
private String fullName;
private String typeRemains;
private String docNumber;
private Long companyId;
public Instant getsDf01Date() {
return sDf01Date;
}
public void setsDf01Date(Instant sDf01Date) {
this.sDf01Date = sDf01Date;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getSetHouseName() {
return setHouseName;
}
public void setSetHouseName(String setHouseName) {
this.setHouseName = setHouseName;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getInfoAccount() {
return infoAccount;
}
public void setInfoAccount(String infoAccount) {
this.infoAccount = infoAccount;
}
public BigDecimal getRemainderSum() {
return remainderSum;
}
public void setRemainderSum(BigDecimal remainderSum) {
this.remainderSum = remainderSum;
}
public BigDecimal getBlockedSum() {
return blockedSum;
}
public void setBlockedSum(BigDecimal blockedSum) {
this.blockedSum = blockedSum;
}
public BigDecimal getUnblockedSum() {
return unblockedSum;
}
public void setUnblockedSum(BigDecimal unblockedSum) {
this.unblockedSum = unblockedSum;
}
public String getInn() {
return inn;
}
public void setInn(String inn) {
this.inn = inn;
}
public Long getMarket() {
return market;
}
public void setMarket(Long market) {
this.market = market;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getTypeRemains() {
return typeRemains;
}
public void setTypeRemains(String typeRemains) {
this.typeRemains = typeRemains;
}
public String getDocNumber() {
return docNumber;
}
public void setDocNumber(String docNumber) {
this.docNumber = docNumber;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
}

View file

@ -0,0 +1,236 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.Instant;
import java.time.LocalDate;
public class ClearMemberRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String tradingCode;
private String clearingCode;
private String fullName;
private String shortName;
private String categoryList;
private String corporationSole;
private String account;
private Long bank;
private String bankName;
private String inn;
private String bic;
private String ogrn;
private String cpp;
private String ocpo;
private String contractNumber;
private LocalDate contractDate;
private LocalDate registrationDate;
private LocalDate systemDate;
private Instant accessDate;
private Instant suspentionDate;
private Instant reopeningDate;
private Instant closeDate;
private Instant exclusionDate;
private String address;
private String email;
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String tradingCode) {
this.tradingCode = tradingCode;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getCategoryList() {
return categoryList;
}
public void setCategoryList(String categoryList) {
this.categoryList = categoryList;
}
public String getCorporationSole() {
return corporationSole;
}
public void setCorporationSole(String corporationSole) {
this.corporationSole = corporationSole;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Long getBank() {
return bank;
}
public void setBank(Long bank) {
this.bank = bank;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getInn() {
return inn;
}
public void setInn(String inn) {
this.inn = inn;
}
public String getBic() {
return bic;
}
public void setBic(String bic) {
this.bic = bic;
}
public String getOgrn() {
return ogrn;
}
public void setOgrn(String ogrn) {
this.ogrn = ogrn;
}
public String getCpp() {
return cpp;
}
public void setCpp(String cpp) {
this.cpp = cpp;
}
public String getOcpo() {
return ocpo;
}
public void setOcpo(String ocpo) {
this.ocpo = ocpo;
}
public String getContractNumber() {
return contractNumber;
}
public void setContractNumber(String contractNumber) {
this.contractNumber = contractNumber;
}
public LocalDate getContractDate() {
return contractDate;
}
public void setContractDate(LocalDate contractDate) {
this.contractDate = contractDate;
}
public LocalDate getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(LocalDate registrationDate) {
this.registrationDate = registrationDate;
}
public LocalDate getSystemDate() {
return systemDate;
}
public void setSystemDate(LocalDate systemDate) {
this.systemDate = systemDate;
}
public Instant getAccessDate() {
return accessDate;
}
public void setAccessDate(Instant accessDate) {
this.accessDate = accessDate;
}
public Instant getSuspentionDate() {
return suspentionDate;
}
public void setSuspentionDate(Instant suspentionDate) {
this.suspentionDate = suspentionDate;
}
public Instant getReopeningDate() {
return reopeningDate;
}
public void setReopeningDate(Instant reopeningDate) {
this.reopeningDate = reopeningDate;
}
public Instant getCloseDate() {
return closeDate;
}
public void setCloseDate(Instant closeDate) {
this.closeDate = closeDate;
}
public Instant getExclusionDate() {
return exclusionDate;
}
public void setExclusionDate(Instant exclusionDate) {
this.exclusionDate = exclusionDate;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

View file

@ -0,0 +1,153 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
/**
* Реестр сделок допущенных к клирингу
* <p>
* DB table: ADMITTED_DEAL_REGISTER
**/
public class AdmittedDealRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long executionId;
private String companyFullName;
private LocalDate tradingDate;
private Long exchangeExecutionId;
private Instant exchangeExecutionTime;
private String securitySymbol;
private String securityFullName;
private String sellerFullName;
private String sellerClearingCode;
private String sellerAccount;
private String buyerFullName;
private String buyerClearingCode;
private String buyerAccount;
private BigDecimal amount;
private LocalDate clearingDate;
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(Long executionId) {
this.executionId = executionId;
}
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public LocalDate getTradingDate() {
return tradingDate;
}
public void setTradingDate(LocalDate tradingDate) {
this.tradingDate = tradingDate;
}
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 String getSecuritySymbol() {
return securitySymbol;
}
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public String getSecurityFullName() {
return securityFullName;
}
public void setSecurityFullName(String securityFullName) {
this.securityFullName = securityFullName;
}
public String getSellerFullName() {
return sellerFullName;
}
public void setSellerFullName(String sellerFullName) {
this.sellerFullName = sellerFullName;
}
public String getSellerClearingCode() {
return sellerClearingCode;
}
public void setSellerClearingCode(String sellerClearingCode) {
this.sellerClearingCode = sellerClearingCode;
}
public String getSellerAccount() {
return sellerAccount;
}
public void setSellerAccount(String sellerAccount) {
this.sellerAccount = sellerAccount;
}
public String getBuyerFullName() {
return buyerFullName;
}
public void setBuyerFullName(String buyerFullName) {
this.buyerFullName = buyerFullName;
}
public String getBuyerClearingCode() {
return buyerClearingCode;
}
public void setBuyerClearingCode(String buyerClearingCode) {
this.buyerClearingCode = buyerClearingCode;
}
public String getBuyerAccount() {
return buyerAccount;
}
public void setBuyerAccount(String buyerAccount) {
this.buyerAccount = buyerAccount;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -0,0 +1,137 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.LocalDate;
public class ContractRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String name;
private String number;
private LocalDate issueDate;
private Long companyFullName;
private Long companyId;
private String documentType;
private String issuePlace;
private String issuer;
private String issuerCode;
private String place;
private LocalDate validFromDate;
private LocalDate validToDate;
private LocalDate closeDate;
private String comment;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public LocalDate getIssueDate() {
return issueDate;
}
public void setIssueDate(LocalDate issueDate) {
this.issueDate = issueDate;
}
public Long getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(Long companyFullName) {
this.companyFullName = companyFullName;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public String getDocumentType() {
return documentType;
}
public void setDocumentType(String documentType) {
this.documentType = documentType;
}
public String getIssuePlace() {
return issuePlace;
}
public void setIssuePlace(String issuePlace) {
this.issuePlace = issuePlace;
}
public String getIssuer() {
return issuer;
}
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public String getIssuerCode() {
return issuerCode;
}
public void setIssuerCode(String issuerCode) {
this.issuerCode = issuerCode;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public LocalDate getValidFromDate() {
return validFromDate;
}
public void setValidFromDate(LocalDate validFromDate) {
this.validFromDate = validFromDate;
}
public LocalDate getValidToDate() {
return validToDate;
}
public void setValidToDate(LocalDate validToDate) {
this.validToDate = validToDate;
}
public LocalDate getCloseDate() {
return closeDate;
}
public void setCloseDate(LocalDate closeDate) {
this.closeDate = closeDate;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}

View file

@ -0,0 +1,148 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
public class CoveredDealRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long executionId;
private String companyFullName;
private LocalDate tradingDate;
private Long exchangeExecutionId;
private Instant exchangeExecutionTime;
private String securitySymbol;
private String securityFullName;
private String sellerFullName;
private String sellerClearingCode;
private String sellerAccount;
private String buyerFullName;
private String buyerClearingCode;
private String buyerAccount;
private BigDecimal amount;
private LocalDate clearingDate;
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(Long executionId) {
this.executionId = executionId;
}
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public LocalDate getTradingDate() {
return tradingDate;
}
public void setTradingDate(LocalDate tradingDate) {
this.tradingDate = tradingDate;
}
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 String getSecuritySymbol() {
return securitySymbol;
}
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public String getSecurityFullName() {
return securityFullName;
}
public void setSecurityFullName(String securityFullName) {
this.securityFullName = securityFullName;
}
public String getSellerFullName() {
return sellerFullName;
}
public void setSellerFullName(String sellerFullName) {
this.sellerFullName = sellerFullName;
}
public String getSellerClearingCode() {
return sellerClearingCode;
}
public void setSellerClearingCode(String sellerClearingCode) {
this.sellerClearingCode = sellerClearingCode;
}
public String getSellerAccount() {
return sellerAccount;
}
public void setSellerAccount(String sellerAccount) {
this.sellerAccount = sellerAccount;
}
public String getBuyerFullName() {
return buyerFullName;
}
public void setBuyerFullName(String buyerFullName) {
this.buyerFullName = buyerFullName;
}
public String getBuyerClearingCode() {
return buyerClearingCode;
}
public void setBuyerClearingCode(String buyerClearingCode) {
this.buyerClearingCode = buyerClearingCode;
}
public String getBuyerAccount() {
return buyerAccount;
}
public void setBuyerAccount(String buyerAccount) {
this.buyerAccount = buyerAccount;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -0,0 +1,190 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
public class DealRegister extends BusinessObject {
private Long executionId;
private Long exchangeExecutionId;
private Instant exchangeExecutionTime;
private LocalDate tradingDate;
private String account;
private String market;
private BigDecimal price;
private BigDecimal amount;
private String side;
private String settlementCurrency;
private Long companyId;
private LocalDate firstLegSettlementDate;
private LocalDate secondLegSettlementDate;
private String securityFullName;
private String securitySymbol;
private Long securityId;
private Long counterPartyId;
private String coverageStatus;
private Long sessionId;
private LocalDate clearingDate;
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(Long executionId) {
this.executionId = executionId;
}
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 String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
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 getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
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 LocalDate getFirstLegSettlementDate() {
return firstLegSettlementDate;
}
public void setFirstLegSettlementDate(LocalDate firstLegSettlementDate) {
this.firstLegSettlementDate = firstLegSettlementDate;
}
public LocalDate getSecondLegSettlementDate() {
return secondLegSettlementDate;
}
public void setSecondLegSettlementDate(LocalDate secondLegSettlementDate) {
this.secondLegSettlementDate = secondLegSettlementDate;
}
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 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;
}
}

View file

@ -0,0 +1,93 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.LocalDate;
public class OrderRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String creditLegAccount;
private BigDecimal creditLegAmount;
private String creditLegCurrencyCode;
private Long creditLegDirection;
private String debitLegAccount;
private String sender;
private String addressee;
private String documentNumber;
private LocalDate clearingDate;
public String getCreditLegAccount() {
return creditLegAccount;
}
public void setCreditLegAccount(String creditLegAccount) {
this.creditLegAccount = creditLegAccount;
}
public BigDecimal getCreditLegAmount() {
return creditLegAmount;
}
public void setCreditLegAmount(BigDecimal creditLegAmount) {
this.creditLegAmount = creditLegAmount;
}
public String getCreditLegCurrencyCode() {
return creditLegCurrencyCode;
}
public void setCreditLegCurrencyCode(String creditLegCurrencyCode) {
this.creditLegCurrencyCode = creditLegCurrencyCode;
}
public Long getCreditLegDirection() {
return creditLegDirection;
}
public void setCreditLegDirection(Long creditLegDirection) {
this.creditLegDirection = creditLegDirection;
}
public String getDebitLegAccount() {
return debitLegAccount;
}
public void setDebitLegAccount(String debitLegAccount) {
this.debitLegAccount = debitLegAccount;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getAddressee() {
return addressee;
}
public void setAddressee(String addressee) {
this.addressee = addressee;
}
public String getDocumentNumber() {
return documentNumber;
}
public void setDocumentNumber(String documentNumber) {
this.documentNumber = documentNumber;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -0,0 +1,74 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.LocalDate;
public class ReportRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String companyFullName;
private String clearingCode;
private Long sessionId;
private String comment;
private String name;
private Long quantity;
private LocalDate clearingDate;
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getQuantity() {
return quantity;
}
public void setQuantity(Long quantity) {
this.quantity = quantity;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -0,0 +1,157 @@
package ru.clearing.classes.statics.data.register;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
public class UncoveredDealRegister extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long executionId;
private String companyFullName;
private LocalDate tradingDate;
private Long exchangeExecutionId;
private Instant exchangeExecutionTime;
private String securitySymbol;
private String securityFullName;
private String sellerFullName;
private String sellerClearingCode;
private String sellerAccount;
private String buyerFullName;
private String buyerClearingCode;
private String buyerAccount;
private BigDecimal amount;
private String resultStatus;
private LocalDate clearingDate;
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(Long executionId) {
this.executionId = executionId;
}
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public LocalDate getTradingDate() {
return tradingDate;
}
public void setTradingDate(LocalDate tradingDate) {
this.tradingDate = tradingDate;
}
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 String getSecuritySymbol() {
return securitySymbol;
}
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public String getSecurityFullName() {
return securityFullName;
}
public void setSecurityFullName(String securityFullName) {
this.securityFullName = securityFullName;
}
public String getSellerFullName() {
return sellerFullName;
}
public void setSellerFullName(String sellerFullName) {
this.sellerFullName = sellerFullName;
}
public String getSellerClearingCode() {
return sellerClearingCode;
}
public void setSellerClearingCode(String sellerClearingCode) {
this.sellerClearingCode = sellerClearingCode;
}
public String getSellerAccount() {
return sellerAccount;
}
public void setSellerAccount(String sellerAccount) {
this.sellerAccount = sellerAccount;
}
public String getBuyerFullName() {
return buyerFullName;
}
public void setBuyerFullName(String buyerFullName) {
this.buyerFullName = buyerFullName;
}
public String getBuyerClearingCode() {
return buyerClearingCode;
}
public void setBuyerClearingCode(String buyerClearingCode) {
this.buyerClearingCode = buyerClearingCode;
}
public String getBuyerAccount() {
return buyerAccount;
}
public void setBuyerAccount(String buyerAccount) {
this.buyerAccount = buyerAccount;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getResultStatus() {
return resultStatus;
}
public void setResultStatus(String resultStatus) {
this.resultStatus = resultStatus;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
}

View file

@ -23,7 +23,7 @@ public class SDf17 extends SpcexObjectBase implements WithAccount {
private BigDecimal bic;
private String spec;
private BigDecimal number;
private Integer result;
private BigDecimal result;
private Instant generationTime;
private Long generationId;
private Long inSDf16Id;
@ -93,11 +93,11 @@ public class SDf17 extends SpcexObjectBase implements WithAccount {
this.number = value;
}
public Integer getResult() {
public BigDecimal getResult() {
return result;
}
public void setResult(Integer value) {
public void setResult(BigDecimal value) {
this.result = value;
}

View file

@ -13,6 +13,11 @@ public class User extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String identifier;
private String name;
private String firstName;
private String lastName;
private String middleName;
private String email;
public String getIdentifier() {
return identifier;
@ -21,4 +26,44 @@ public class User extends BusinessObject {
public void setIdentifier(String value) {
this.identifier = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@ public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<Account
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
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",
@ -42,6 +42,7 @@ public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<Account
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,8 +27,8 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
"ACCOUNT_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "ACCOUNT_STATUS", "PROCESSING_SIGN"
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"ACCOUNT_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "ACCOUNT_STATUS", "PROCESSING_SIGN", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),
@ -47,7 +48,8 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
object.getAccountType(),
object.getRelationId(),
object.getAccountStatus(),
object.getProcessingSign()
object.getProcessingSign(),
object.getCompanyId()
};
return args;
}

View file

@ -27,7 +27,7 @@ public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<Account
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"ACCOUNT_ROUTING_ID", "DESTINATION_ID", "RELATION_ID", "SOURCE_ID"
};
}
@ -38,6 +38,7 @@ public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<Account
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,8 +27,8 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
"BANK_ACCOUNT_ID", "ACCOUNT_ID", "BANK_IDENTIFICATION_CODE", "BANK_NAME", "CORRESPONDENT_ACCOUNT", "CORRESPONDENT_ACCOUNT_NAME", "CURRENCY", "DESTINATION", "IBAN", "INTERNATIONAL_TRANSFER_SIGN", "SWIFT_CODE", "TAXPAYER_IDENTIFICATION_NUMBER", "TAX_REGISTRATION_REASON_CODE"
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"BANK_ACCOUNT_ID", "ACCOUNT_ID", "BANK_IDENTIFICATION_CODE", "BANK_NAME", "CORRESPONDENT_ACCOUNT", "CORRESPONDENT_ACCOUNT_NAME", "CURRENCY", "DESTINATION", "IBAN", "INTERNATIONAL_TRANSFER_SIGN", "SWIFT_CODE", "TAXPAYER_IDENTIFICATION_NUMBER", "TAX_REGISTRATION_REASON_CODE", "ACCOUNT", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),
@ -53,6 +54,8 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
object.getSwiftCode(),
object.getTaxpayerIdentificationNumber(),
object.getTaxRegistrationReasonCode(),
object.getAccount(),
object.getCompanyId()
};
return args;
}

View file

@ -32,17 +32,17 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
@Override
public String[] getFields() {
return new String[]{
"id", "event_time", "event_user_id",
"id", "event_time", "event_type", "event_user_id",
"company_id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
};
}
public String[] getFieldsForCompanyInfo() {
return new String[]{
"id", "event_time", "event_user_id",
"id", "event_time", "event_type", "event_user_id",
"company_info_id", "company_id", "corporation_sole_type", "country_code", "description",
"professional_sign", "legal_kind", "organization_type", "residence", "short_name", "full_name",
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
"professional_sign", "legal_kind", "organization_type", "residence", "short_name_eng", "full_name_eng"
// ,"short_name", "full_name", "trading_code", "clearing_code", "registration_code"
};
}
@ -58,6 +58,7 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
Object[] args = new Object[]{
companyHistory.getId(),
TimeUtil.toDateFromInstant(companyHistory.getEventTime()),
companyHistory.getEventType(),
companyHistory.getUserId(),
company.getId(), // company_id
@ -94,6 +95,7 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
return new ArrayList<>(Arrays.asList(
rootUpdate.getId(),
TimeUtil.toDateFromInstant(rootUpdate.getEventTime()),
rootUpdate.getEventType(),
rootUpdate.getUserId(),
companyInfo.getId(), // company_info_id
@ -105,13 +107,13 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
companyInfo.getLegalKind(),
companyInfo.getOrganizationType(),
companyInfo.getResidence(),
companyInfo.getShortName(),
companyInfo.getFullName(),
companyInfo.getShortNameEng(),
companyInfo.getFullNameEng(),
companyInfo.getTradingCode(),
companyInfo.getClearingCode(),
companyInfo.getRegistrationCode()
companyInfo.getFullNameEng()
// companyInfo.getShortName(),
// companyInfo.getFullName(),
// companyInfo.getTradingCode(),
// companyInfo.getClearingCode(),
// companyInfo.getRegistrationCode()
));
}
}

View file

@ -27,7 +27,7 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore<Inf
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"INFORMATION_ACCOUNT_ID", "ACCOUNT_ID", "CLEARING_ACCOUNT_ID", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore<Inf
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -28,7 +28,7 @@ public class RelationHistoryMapStore extends TemplateEventMapStore<RelationHisto
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"RELATION_ID", "CREATED_AT", "UPDATED_AT", "CONSUMER_ID", "SUPPLIER_ID", "SERVICE_STATUS", "SERVICE", "SERVICE_PRODUCT", "COMMENT"
};
}
@ -39,6 +39,7 @@ public class RelationHistoryMapStore extends TemplateEventMapStore<RelationHisto
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class SecurityHistoryMapStore extends TemplateEventMapStore<SecurityHisto
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"SECURITY_ID", "CREATED_AT", "UPDATED_AT", "INSTRUMENT_TYPE", "ISSUER_ID", "SHORT_NAME", "FULL_NAME", "SHORT_NAME_ENG", "FULL_NAME_ENG", "SECURITY_SYMBOL", "WORKFLOW_STATUS"
};
}
@ -38,6 +38,7 @@ public class SecurityHistoryMapStore extends TemplateEventMapStore<SecurityHisto
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"USER_CONNECT_ID", "CREATED_AT", "UPDATED_AT", "USER_ID", "CONNECTION_TIME", "DISCONNECTION_TIME", "SERVER_IP", "CLIENT_IP", "CONNECTION_STATE", "CLEARING_DATE", "ERROR_CODE", "ERROR_TEXT"
};
}
@ -38,6 +38,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -27,8 +27,8 @@ public class UserHistoryMapStore extends TemplateEventMapStore<UserHistory> {
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
"USER_CLS_ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER"
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"USER_CLS_ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER", "NAME", "FIRST_NAME", "LAST_NAME", "MIDDLE_NAME", "EMAIL"
};
}
@ -38,12 +38,18 @@ public class UserHistoryMapStore extends TemplateEventMapStore<UserHistory> {
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getIdentifier()
object.getIdentifier(),
object.getName(),
object.getFirstName(),
object.getLastName(),
object.getMiddleName(),
object.getEmail()
};
return args;
}

View file

@ -37,8 +37,8 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
return new String[]{
"id", "company_id", "corporation_sole_type", "country_code", "description",
"professional_sign", "legal_kind", "organization_type", "residence",
"short_name_eng", "full_name_eng", "short_name", "full_name", "trading_code",
"clearing_code", "registration_code"
"short_name_eng", "full_name_eng"
// , "short_name", "full_name", "trading_code","clearing_code", "registration_code"
};
}
@ -114,11 +114,11 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
companyInfo.setResidence(rs.getString("RESIDENCE"));
companyInfo.setShortNameEng(rs.getString("SHORT_NAME_ENG"));
companyInfo.setFullNameEng(rs.getString("FULL_NAME_ENG"));
companyInfo.setShortName(rs.getString("SHORT_NAME"));
companyInfo.setFullName(rs.getString("FULL_NAME"));
companyInfo.setTradingCode(rs.getString("TRADING_CODE"));
companyInfo.setClearingCode(rs.getString("CLEARING_CODE"));
companyInfo.setRegistrationCode(rs.getString("REGISTRATION_CODE"));
// companyInfo.setShortName(rs.getString("SHORT_NAME"));
// companyInfo.setFullName(rs.getString("FULL_NAME"));
// companyInfo.setTradingCode(rs.getString("TRADING_CODE"));
// companyInfo.setClearingCode(rs.getString("CLEARING_CODE"));
// companyInfo.setRegistrationCode(rs.getString("REGISTRATION_CODE"));
return companyInfo;
}
);
@ -150,12 +150,12 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
companyInfo.getOrganizationType(),
companyInfo.getResidence(),
companyInfo.getShortNameEng(),
companyInfo.getFullNameEng(),
companyInfo.getShortName(),
companyInfo.getFullName(),
companyInfo.getTradingCode(),
companyInfo.getClearingCode(),
companyInfo.getRegistrationCode()
companyInfo.getFullNameEng()
// companyInfo.getShortName(),
// companyInfo.getFullName(),
// companyInfo.getTradingCode(),
// companyInfo.getClearingCode(),
// companyInfo.getRegistrationCode()
));
return companyInfoArgs;
}

View file

@ -30,7 +30,7 @@ public class UserMapStore extends TemplateMapStore<User> {
@Override
public String[] getFields() {
return new String[]{
"ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER"
"ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER", "NAME", "FIRST_NAME", "LAST_NAME", "MIDDLE_NAME", "EMAIL",
};
}
@ -41,6 +41,11 @@ public class UserMapStore extends TemplateMapStore<User> {
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setIdentifier(resultSet.getObject("IDENTIFIER", String.class));
object.setName(resultSet.getObject("NAME", String.class));
object.setFirstName(resultSet.getObject("FIRST_NAME", String.class));
object.setLastName(resultSet.getObject("LAST_NAME", String.class));
object.setMiddleName(resultSet.getObject("MIDDLE_NAME", String.class));
object.setEmail(resultSet.getObject("EMAIL", String.class));
return object;
}
@ -50,7 +55,12 @@ public class UserMapStore extends TemplateMapStore<User> {
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getIdentifier()
object.getIdentifier(),
object.getName(),
object.getFirstName(),
object.getLastName(),
object.getMiddleName(),
object.getEmail()
};
return args;
}

View file

@ -0,0 +1,101 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.AdmittedDealRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class AdmittedDealRegisterMapStore extends TemplateMapStore<AdmittedDealRegister> {
public AdmittedDealRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "ADMITTED_DEAL_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_AdmittedDealRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"EXECUTION_ID",
"COMPANY_FULL_NAME",
"TRADING_DATE",
"EXCHANGE_EXECUTION_ID",
"EXCHANGE_EXECUTION_TIME",
"SECURITY_SYMBOL",
"SECURITY_FULL_NAME",
"SELLER_FULL_NAME",
"SELLER_CLEARING_CODE",
"SELLER_ACCOUNT",
"BUYER_FULL_NAME",
"BUYER_CLEARING_CODE",
"BUYER_ACCOUNT",
"AMOUNT",
"CLEARING_DATE",
};
}
@Override
protected AdmittedDealRegister objectReader(ResultSet resultSet) throws SQLException {
AdmittedDealRegister object = new AdmittedDealRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setExecutionId(resultSet.getObject("EXECUTION_ID", Long.class));
object.setCompanyFullName(resultSet.getObject("COMPANY_FULL_NAME", String.class));
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
object.setSecurityFullName(resultSet.getObject("SECURITY_FULL_NAME", String.class));
object.setSellerFullName(resultSet.getObject("SELLER_FULL_NAME", String.class));
object.setSellerClearingCode(resultSet.getObject("SELLER_CLEARING_CODE", String.class));
object.setSellerAccount(resultSet.getObject("SELLER_ACCOUNT", String.class));
object.setBuyerFullName(resultSet.getObject("BUYER_FULL_NAME", String.class));
object.setBuyerClearingCode(resultSet.getObject("BUYER_CLEARING_CODE", String.class));
object.setBuyerAccount(resultSet.getObject("BUYER_ACCOUNT", String.class));
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(AdmittedDealRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getExecutionId(),
object.getCompanyFullName(),
TimeUtil.toDateFromLocalDate(object.getTradingDate()),
object.getExchangeExecutionId(),
TimeUtil.toDateFromInstant(object.getExchangeExecutionTime()),
object.getSecuritySymbol(),
object.getSecurityFullName(),
object.getSellerFullName(),
object.getSellerClearingCode(),
object.getSellerAccount(),
object.getBuyerFullName(),
object.getBuyerClearingCode(),
object.getBuyerAccount(),
object.getAmount(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -0,0 +1,98 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.misc.BalanceRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class BalanceRegisterMapStore extends TemplateMapStore<BalanceRegister> {
public BalanceRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "BALANCE_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_BalanceRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"S_DF01_DATE",
"CURRENCY_CODE",
"SET_HOUSE_NAME",
"ACCOUNT",
"INFO_ACCOUNT",
"REMAINDER_SUM",
"BLOCKED_SUM",
"UNBLOCKED_SUM",
"INN",
"MARKET",
"FULL_NAME",
"TYPE_REMAINS",
"DOC_NUMBER",
"COMPANY_ID"
};
}
@Override
protected BalanceRegister objectReader(ResultSet resultSet) throws SQLException {
BalanceRegister object = new BalanceRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setsDf01Date(getInstantFromTimestamp(resultSet, "S_DF01_DATE"));
object.setCurrencyCode(resultSet.getObject("CURRENCY_CODE", String.class));
object.setSetHouseName(resultSet.getObject("SET_HOUSE_NAME", String.class));
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
object.setInfoAccount(resultSet.getObject("INFO_ACCOUNT", String.class));
object.setRemainderSum(resultSet.getObject("REMAINDER_SUM", BigDecimal.class));
object.setBlockedSum(resultSet.getObject("BLOCKED_SUM", BigDecimal.class));
object.setUnblockedSum(resultSet.getObject("UNBLOCKED_SUM", BigDecimal.class));
object.setInn(resultSet.getObject("INN", String.class));
object.setMarket(resultSet.getObject("MARKET", Long.class));
object.setFullName(resultSet.getObject("FULL_NAME", String.class));
object.setTypeRemains(resultSet.getObject("TYPE_REMAINS", String.class));
object.setDocNumber(resultSet.getObject("DOC_NUMBER", String.class));
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
return object;
}
@Override
protected Object[] objectToField(BalanceRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
TimeUtil.toDateFromInstant(object.getsDf01Date()),
object.getCurrencyCode(),
object.getSetHouseName(),
object.getAccount(),
object.getInfoAccount(),
object.getRemainderSum(),
object.getBlockedSum(),
object.getUnblockedSum(),
object.getInn(),
object.getMarket(),
object.getFullName(),
object.getTypeRemains(),
object.getDocNumber(),
object.getCompanyId()
};
return args;
}
}

View file

@ -0,0 +1,130 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.misc.ClearMemberRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class ClearMemberRegisterMapStore extends TemplateMapStore<ClearMemberRegister> {
public ClearMemberRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CLEARMEMBER_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_ClearMemberRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"TRADING_CODE",
"CLEARING_CODE",
"FULL_NAME",
"SHORT_NAME",
"CATEGORY_LIST",
"CORPORATION_SOLE",
"ACCOUNT",
"BANK",
"BANK_NAME",
"INN",
"BIC",
"OGRN",
"CPP",
"OCPO",
"CONTRACT_NUMBER",
"CONTRACT_DATE",
"REGISTRATION_DATE",
"SYSTEM_DATE",
"ACCESS_DATE",
"SUSPENTION_DATE",
"REOPENING_DATE",
"CLOSE_DATE",
"EXCLUSION_DATE",
"ADDRESS",
"EMAIL",
};
}
@Override
protected ClearMemberRegister objectReader(ResultSet resultSet) throws SQLException {
ClearMemberRegister object = new ClearMemberRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setTradingCode(resultSet.getObject("TRADING_CODE", String.class));
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
object.setFullName(resultSet.getObject("FULL_NAME", String.class));
object.setShortName(resultSet.getObject("SHORT_NAME", String.class));
object.setCategoryList(resultSet.getObject("CATEGORY_LIST", String.class));
object.setCorporationSole(resultSet.getObject("CORPORATION_SOLE", String.class));
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
object.setBank(resultSet.getObject("BANK", Long.class));
object.setBankName(resultSet.getObject("BANK_NAME", String.class));
object.setInn(resultSet.getObject("INN", String.class));
object.setBic(resultSet.getObject("BIC", String.class));
object.setOgrn(resultSet.getObject("OGRN", String.class));
object.setCpp(resultSet.getObject("CPP", String.class));
object.setOcpo(resultSet.getObject("OCPO", String.class));
object.setContractNumber(resultSet.getObject("CONTRACT_NUMBER", String.class));
object.setContractDate(getLocalDateFromSqlDate(resultSet, "CONTRACT_DATE"));
object.setRegistrationDate(getLocalDateFromSqlDate(resultSet, "REGISTRATION_DATE"));
object.setSystemDate(getLocalDateFromSqlDate(resultSet, "SYSTEM_DATE"));
object.setAccessDate(getInstantFromTimestamp(resultSet, "ACCESS_DATE"));
object.setSuspentionDate(getInstantFromTimestamp(resultSet, "SUSPENTION_DATE"));
object.setReopeningDate(getInstantFromTimestamp(resultSet, "REOPENING_DATE"));
object.setCloseDate(getInstantFromTimestamp(resultSet, "CLOSE_DATE"));
object.setExclusionDate(getInstantFromTimestamp(resultSet, "EXCLUSION_DATE"));
object.setAddress(resultSet.getObject("ADDRESS", String.class));
object.setEmail(resultSet.getObject("EMAIL", String.class));
return object;
}
@Override
protected Object[] objectToField(ClearMemberRegister clearMemberRegister) {
Object[] args = new Object[]{
clearMemberRegister.getId(),
TimeUtil.toDateFromInstant(clearMemberRegister.getCreated()),
TimeUtil.toDateFromInstant(clearMemberRegister.getUpdated()),
clearMemberRegister.getTradingCode(),
clearMemberRegister.getClearingCode(),
clearMemberRegister.getFullName(),
clearMemberRegister.getShortName(),
clearMemberRegister.getCategoryList(),
clearMemberRegister.getCorporationSole(),
clearMemberRegister.getAccount(),
clearMemberRegister.getBank(),
clearMemberRegister.getBankName(),
clearMemberRegister.getInn(),
clearMemberRegister.getBic(),
clearMemberRegister.getOgrn(),
clearMemberRegister.getCpp(),
clearMemberRegister.getOcpo(),
clearMemberRegister.getContractNumber(),
TimeUtil.toDateFromLocalDate(clearMemberRegister.getContractDate()),
TimeUtil.toDateFromLocalDate(clearMemberRegister.getRegistrationDate()),
TimeUtil.toDateFromLocalDate(clearMemberRegister.getSystemDate()),
TimeUtil.toDateFromInstant(clearMemberRegister.getAccessDate()),
TimeUtil.toDateFromInstant(clearMemberRegister.getSuspentionDate()),
TimeUtil.toDateFromInstant(clearMemberRegister.getReopeningDate()),
TimeUtil.toDateFromInstant(clearMemberRegister.getCloseDate()),
TimeUtil.toDateFromInstant(clearMemberRegister.getExclusionDate()),
clearMemberRegister.getAddress(),
clearMemberRegister.getEmail()
};
return args;
}
}

View file

@ -0,0 +1,97 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.ContractRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class ContractRegisterMapStore extends TemplateMapStore<ContractRegister> {
public ContractRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CONTRACT_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_ContractRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"NAME",
"NUMBER",
"ISSUE_DATE",
"COMPANY_FULL_NAME",
"COMPANY_ID",
"DOCUMENT_TYPE",
"ISSUE_PLACE",
"ISSUER",
"ISSUER_CODE",
"PLACE",
"VALID_FROM_DATE",
"VALID_TO_DATE",
"CLOSE_DATE",
"COMMENT",
};
}
@Override
protected ContractRegister objectReader(ResultSet resultSet) throws SQLException {
ContractRegister object = new ContractRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setName(resultSet.getObject("NAME", String.class));
object.setNumber(resultSet.getObject("NUMBER", String.class));
object.setIssueDate(getLocalDateFromSqlDate(resultSet, "ISSUE_DATE"));
object.setCompanyFullName(resultSet.getObject("COMPANY_FULL_NAME", Long.class));
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
object.setDocumentType(resultSet.getObject("DOCUMENT_TYPE", String.class));
object.setIssuePlace(resultSet.getObject("ISSUE_PLACE", String.class));
object.setIssuer(resultSet.getObject("ISSUER", String.class));
object.setIssuerCode(resultSet.getObject("ISSUER_CODE", String.class));
object.setPlace(resultSet.getObject("PLACE", String.class));
object.setValidFromDate(getLocalDateFromSqlDate(resultSet, "VALID_FROM_DATE"));
object.setValidToDate(getLocalDateFromSqlDate(resultSet, "VALID_TO_DATE"));
object.setCloseDate(getLocalDateFromSqlDate(resultSet, "CLOSE_DATE"));
object.setComment(resultSet.getObject("COMMENT", String.class));
return object;
}
@Override
protected Object[] objectToField(ContractRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getName(),
object.getNumber(),
TimeUtil.toDateFromLocalDate(object.getIssueDate()),
object.getCompanyFullName(),
object.getCompanyId(),
object.getDocumentType(),
object.getIssuePlace(),
object.getIssuer(),
object.getIssuerCode(),
object.getPlace(),
TimeUtil.toDateFromLocalDate(object.getValidFromDate()),
TimeUtil.toDateFromLocalDate(object.getValidToDate()),
TimeUtil.toDateFromLocalDate(object.getCloseDate()),
object.getComment(),
};
return args;
}
}

View file

@ -0,0 +1,101 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.CoveredDealRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class CoveredDealRegisterMapStore extends TemplateMapStore<CoveredDealRegister> {
public CoveredDealRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "COVERED_DEAL_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_CoveredDealRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"EXECUTION_ID",
"COMPANY_FULL_NAME",
"TRADING_DATE",
"EXCHANGE_EXECUTION_ID",
"EXCHANGE_EXECUTION_TIME",
"SECURITY_SYMBOL",
"SECURITY_FULL_NAME",
"SELLER_FULL_NAME",
"SELLER_CLEARING_CODE",
"SELLER_ACCOUNT",
"BUYER_FULL_NAME",
"BUYER_CLEARING_CODE",
"BUYER_ACCOUNT",
"AMOUNT",
"CLEARING_DATE",
};
}
@Override
protected CoveredDealRegister objectReader(ResultSet resultSet) throws SQLException {
CoveredDealRegister object = new CoveredDealRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setExecutionId(resultSet.getObject("EXECUTION_ID", Long.class));
object.setCompanyFullName(resultSet.getObject("COMPANY_FULL_NAME", String.class));
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
object.setSecurityFullName(resultSet.getObject("SECURITY_FULL_NAME", String.class));
object.setSellerFullName(resultSet.getObject("SELLER_FULL_NAME", String.class));
object.setSellerClearingCode(resultSet.getObject("SELLER_CLEARING_CODE", String.class));
object.setSellerAccount(resultSet.getObject("SELLER_ACCOUNT", String.class));
object.setBuyerFullName(resultSet.getObject("BUYER_FULL_NAME", String.class));
object.setBuyerClearingCode(resultSet.getObject("BUYER_CLEARING_CODE", String.class));
object.setBuyerAccount(resultSet.getObject("BUYER_ACCOUNT", String.class));
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(CoveredDealRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getExecutionId(),
object.getCompanyFullName(),
TimeUtil.toDateFromLocalDate(object.getTradingDate()),
object.getExchangeExecutionId(),
TimeUtil.toDateFromInstant(object.getExchangeExecutionTime()),
object.getSecuritySymbol(),
object.getSecurityFullName(),
object.getSellerFullName(),
object.getSellerClearingCode(),
object.getSellerAccount(),
object.getBuyerFullName(),
object.getBuyerClearingCode(),
object.getBuyerAccount(),
object.getAmount(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -0,0 +1,116 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.DealRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class DealRegisterMapStore extends TemplateMapStore<DealRegister> {
public DealRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "DEAL_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_DealRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"EXECUTION_ID",
"EXCHANGE_EXECUTION_ID",
"EXCHANGE_EXECUTION_TIME",
"TRADING_DATE",
"ACCOUNT",
"MARKET",
"PRICE",
"AMOUNT",
"SIDE",
"SETTLEMENT_CURRENCY",
"COMPANY_ID",
"FIRST_LEG_SETTLEMENT_DATE",
"SECOND_LEG_SETTLEMENT_DATE",
"SECURITY_FULL_NAME",
"SECURITY_SYMBOL",
"SECURITY_ID",
"COUNTER_PARTY_ID",
"COVERAGE_STATUS",
"SESSION_ID",
"CLEARING_DATE",
};
}
@Override
protected DealRegister objectReader(ResultSet resultSet) throws SQLException {
DealRegister object = new DealRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setExecutionId(resultSet.getObject("EXECUTION_ID", Long.class));
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
object.setMarket(resultSet.getObject("MARKET", String.class));
object.setPrice(resultSet.getObject("PRICE", BigDecimal.class));
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
object.setSide(resultSet.getObject("SIDE", String.class));
object.setSettlementCurrency(resultSet.getObject("SETTLEMENT_CURRENCY", String.class));
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
object.setFirstLegSettlementDate(getLocalDateFromSqlDate(resultSet, "FIRST_LEG_SETTLEMENT_DATE"));
object.setSecondLegSettlementDate(getLocalDateFromSqlDate(resultSet, "SECOND_LEG_SETTLEMENT_DATE"));
object.setSecurityFullName(resultSet.getObject("SECURITY_FULL_NAME", String.class));
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
object.setCounterPartyId(resultSet.getObject("COUNTER_PARTY_ID", Long.class));
object.setCoverageStatus(resultSet.getObject("COVERAGE_STATUS", String.class));
object.setSessionId(resultSet.getObject("SESSION_ID", Long.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(DealRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getExecutionId(),
object.getExchangeExecutionId(),
TimeUtil.toDateFromInstant(object.getExchangeExecutionTime()),
TimeUtil.toDateFromLocalDate(object.getTradingDate()),
object.getAccount(),
object.getMarket(),
object.getPrice(),
object.getAmount(),
object.getSide(),
object.getSettlementCurrency(),
object.getCompanyId(),
TimeUtil.toDateFromLocalDate(object.getFirstLegSettlementDate()),
TimeUtil.toDateFromLocalDate(object.getSecondLegSettlementDate()),
object.getSecurityFullName(),
object.getSecuritySymbol(),
object.getSecurityId(),
object.getCounterPartyId(),
object.getCoverageStatus(),
object.getSessionId(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -0,0 +1,133 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class ExecutionDepositMapStore extends TemplateMapStore<ExecutionDeposit> {
public ExecutionDepositMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "EXECUTION_DEPOSIT";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_ExecutionDeposit;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"EXCHANGE_EXECUTION_ID",
"EXCHANGE_EXECUTION_TIME",
"TRADING_DATE",
"ACCOUNT_ID",
"MARKET",
"PRICE",
"LOTS",
"QUANTITY",
"FIRST_LEG_AMOUNT",
"SECOND_LEG_AMOUNT",
"INTEREST_AMOUNT",
"SIDE",
"SETTLEMENT_CURRENCY",
"COMPANY_ID",
"DURATION",
"FIRST_LEG_SETTLEMENT_DATE",
"SECOND_LEG_SETTLEMENT_DATE",
"FIRST_LEG_SETTLEMENT_CODE",
"SECOND_LEG_SETTLEMENT_CODE",
"SECURITY_FULL_NAME",
"SECURITY_SYMBOL",
"SECURITY_ID",
"COUNTER_PARTY_ID",
"COVERAGE_STATUS",
"SESSION_ID",
"CLEARING_DATE",
};
}
@Override
protected ExecutionDeposit objectReader(ResultSet resultSet) throws SQLException {
ExecutionDeposit object = new ExecutionDeposit();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
object.setAccountId(resultSet.getObject("ACCOUNT_ID", Long.class));
object.setMarket(resultSet.getObject("MARKET", String.class));
object.setPrice(resultSet.getObject("PRICE", BigDecimal.class));
object.setLots(resultSet.getObject("LOTS", BigDecimal.class));
object.setQuantity(resultSet.getObject("QUANTITY", BigDecimal.class));
object.setFirstLegAmount(resultSet.getObject("FIRST_LEG_AMOUNT", BigDecimal.class));
object.setSecondLegAmount(resultSet.getObject("SECOND_LEG_AMOUNT", BigDecimal.class));
object.setInterestAmount(resultSet.getObject("INTEREST_AMOUNT", BigDecimal.class));
object.setSide(resultSet.getObject("SIDE", String.class));
object.setSettlementCurrency(resultSet.getObject("SETTLEMENT_CURRENCY", String.class));
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
object.setDuration(resultSet.getObject("DURATION", Long.class));
object.setFirstLegSettlementDate(getLocalDateFromSqlDate(resultSet, "FIRST_LEG_SETTLEMENT_DATE"));
object.setSecondLegSettlementDate(getLocalDateFromSqlDate(resultSet, "SECOND_LEG_SETTLEMENT_DATE"));
object.setFirstLegSettlementCode(getLocalDateFromSqlDate(resultSet, "FIRST_LEG_SETTLEMENT_CODE"));
object.setSecondLegSettlementCode(getLocalDateFromSqlDate(resultSet, "SECOND_LEG_SETTLEMENT_CODE"));
object.setSecurityFullName(resultSet.getObject("SECURITY_FULL_NAME", String.class));
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
object.setCounterPartyId(resultSet.getObject("COUNTER_PARTY_ID", Long.class));
object.setCoverageStatus(resultSet.getObject("COVERAGE_STATUS", String.class));
object.setSessionId(resultSet.getObject("SESSION_ID", Long.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(ExecutionDeposit object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getExchangeExecutionId(),
TimeUtil.toDateFromInstant(object.getExchangeExecutionTime()),
TimeUtil.toDateFromLocalDate(object.getTradingDate()),
object.getAccountId(),
object.getMarket(),
object.getPrice(),
object.getLots(),
object.getQuantity(),
object.getFirstLegAmount(),
object.getSecondLegAmount(),
object.getInterestAmount(),
object.getSide(),
object.getSettlementCurrency(),
object.getCompanyId(),
object.getDuration(),
TimeUtil.toDateFromLocalDate(object.getFirstLegSettlementDate()),
TimeUtil.toDateFromLocalDate(object.getSecondLegSettlementDate()),
TimeUtil.toDateFromLocalDate(object.getFirstLegSettlementCode()),
TimeUtil.toDateFromLocalDate(object.getSecondLegSettlementCode()),
object.getSecurityFullName(),
object.getSecuritySymbol(),
object.getSecurityId(),
object.getCounterPartyId(),
object.getCoverageStatus(),
object.getSessionId(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -0,0 +1,83 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.OrderRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class OrderRegisterMapStore extends TemplateMapStore<OrderRegister> {
public OrderRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "ORDER_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_OrderRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"CREDIT_LEG_ACCOUNT",
"CREDIT_LEG_AMOUNT",
"CREDIT_LEG_CURRENCY_CODE",
"CREDIT_LEG_DIRECTION",
"DEBIT_LEG_ACCOUNT",
"SENDER",
"ADDRESSEE",
"DOCUMENT_NUMBER",
"CLEARING_DATE",
};
}
@Override
protected OrderRegister objectReader(ResultSet resultSet) throws SQLException {
OrderRegister object = new OrderRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setCreditLegAccount(resultSet.getObject("CREDIT_LEG_ACCOUNT", String.class));
object.setCreditLegAmount(resultSet.getObject("CREDIT_LEG_AMOUNT", BigDecimal.class));
object.setCreditLegCurrencyCode(resultSet.getObject("CREDIT_LEG_CURRENCY_CODE", String.class));
object.setCreditLegDirection(resultSet.getObject("CREDIT_LEG_DIRECTION", Long.class));
object.setDebitLegAccount(resultSet.getObject("DEBIT_LEG_ACCOUNT", String.class));
object.setSender(resultSet.getObject("SENDER", String.class));
object.setAddressee(resultSet.getObject("ADDRESSEE", String.class));
object.setDocumentNumber(resultSet.getObject("DOCUMENT_NUMBER", String.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(OrderRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getCreditLegAccount(),
object.getCreditLegAmount(),
object.getCreditLegCurrencyCode(),
object.getCreditLegDirection(),
object.getDebitLegAccount(),
object.getSender(),
object.getAddressee(),
object.getDocumentNumber(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -0,0 +1,76 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.ReportRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class ReportRegisterMapStore extends TemplateMapStore<ReportRegister> {
public ReportRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "REPORT_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_ReportRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"COMPANY_FULL_NAME",
"CLEARING_CODE",
"SESSION_ID",
"COMMENT",
"NAME",
"QUANTITY",
"CLEARING_DATE",
};
}
@Override
protected ReportRegister objectReader(ResultSet resultSet) throws SQLException {
ReportRegister object = new ReportRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setCompanyFullName(resultSet.getObject("COMPANY_FULL_NAME", String.class));
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
object.setSessionId(resultSet.getObject("SESSION_ID", Long.class));
object.setComment(resultSet.getObject("COMMENT", String.class));
object.setName(resultSet.getObject("NAME", String.class));
object.setQuantity(resultSet.getObject("QUANTITY", Long.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(ReportRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getCompanyFullName(),
object.getClearingCode(),
object.getSessionId(),
object.getComment(),
object.getName(),
object.getQuantity(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -47,7 +47,7 @@ public class SDf17MapStore extends TemplateMapStore<SDf17> {
object.setBic(resultSet.getObject("BIC", BigDecimal.class));
object.setSpec(resultSet.getObject("SPEC", String.class));
object.setNumber(resultSet.getObject("NUMBER", BigDecimal.class));
object.setResult(resultSet.getObject("RESULT", Integer.class));
object.setResult(resultSet.getObject("RESULT", BigDecimal.class));
object.setGenerationTime(getInstantFromTimestamp(resultSet, "GENERATION_TIME"));
object.setGenerationId(resultSet.getObject("GENERATION_ID", Long.class));
object.setInSDf16Id(resultSet.getObject("IN_S_DF16_ID", Long.class));

View file

@ -0,0 +1,104 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.register.UncoveredDealRegister;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class UncoveredDealRegisterMapStore extends TemplateMapStore<UncoveredDealRegister> {
public UncoveredDealRegisterMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "UNCOVERED_DEAL_REGISTER";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_UncoveredDealRegister;
}
@Override
public String[] getFields() {
return new String[]{"ID", "CREATED_AT", "UPDATED_AT",
"EXECUTION_ID",
"COMPANY_FULL_NAME",
"TRADING_DATE",
"EXCHANGE_EXECUTION_ID",
"EXCHANGE_EXECUTION_TIME",
"SECURITY_SYMBOL",
"SECURITY_FULL_NAME",
"SELLER_FULL_NAME",
"SELLER_CLEARING_CODE",
"SELLER_ACCOUNT",
"BUYER_FULL_NAME",
"BUYER_CLEARING_CODE",
"BUYER_ACCOUNT",
"AMOUNT",
"RESULT_STATUS",
"CLEARING_DATE",
};
}
@Override
protected UncoveredDealRegister objectReader(ResultSet resultSet) throws SQLException {
UncoveredDealRegister object = new UncoveredDealRegister();
object.setId(resultSet.getObject("ID", Long.class));
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
object.setExecutionId(resultSet.getObject("EXECUTION_ID", Long.class));
object.setCompanyFullName(resultSet.getObject("COMPANY_FULL_NAME", String.class));
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
object.setSecurityFullName(resultSet.getObject("SECURITY_FULL_NAME", String.class));
object.setSellerFullName(resultSet.getObject("SELLER_FULL_NAME", String.class));
object.setSellerClearingCode(resultSet.getObject("SELLER_CLEARING_CODE", String.class));
object.setSellerAccount(resultSet.getObject("SELLER_ACCOUNT", String.class));
object.setBuyerFullName(resultSet.getObject("BUYER_FULL_NAME", String.class));
object.setBuyerClearingCode(resultSet.getObject("BUYER_CLEARING_CODE", String.class));
object.setBuyerAccount(resultSet.getObject("BUYER_ACCOUNT", String.class));
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
return object;
}
@Override
protected Object[] objectToField(UncoveredDealRegister object) {
Object[] args = new Object[]{
object.getId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getExecutionId(),
object.getCompanyFullName(),
TimeUtil.toDateFromLocalDate(object.getTradingDate()),
object.getExchangeExecutionId(),
TimeUtil.toDateFromInstant(object.getExchangeExecutionTime()),
object.getSecuritySymbol(),
object.getSecurityFullName(),
object.getSellerFullName(),
object.getSellerClearingCode(),
object.getSellerAccount(),
object.getBuyerFullName(),
object.getBuyerClearingCode(),
object.getBuyerAccount(),
object.getAmount(),
object.getResultStatus(),
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
};
return args;
}
}

View file

@ -15,9 +15,12 @@ import java.time.Instant;
public abstract class AbstractUpdateMapService implements InitializingBean,
EntryAddedListener<Long, Object>, EntryUpdatedListener<Long, Object>, EntryRemovedListener<Long, Object> {
protected final String EVENT_CREATE = "CREATE";
protected final String EVENT_UPDATE = "UPDATE";
protected final String EVENT_DELETE = "DELETE";
/**
* EVENT_TYPE_DICTIONARY
*/
protected final String EVENT_CREATE = "CRET";
protected final String EVENT_UPDATE = "UPDT";
protected final String EVENT_DELETE = "DELT";
protected final HazelcastInstance hazelcastServerInstance;
private final Logger log = LoggerFactory.getLogger(this.getClass());
@ -53,7 +56,11 @@ public abstract class AbstractUpdateMapService implements InitializingBean,
protected void createBusinessEvent(BusinessEvent businessEvent, String eventType) {
businessEvent.setId(hazelcastServerInstance.getIdGenerator(IMDGDistributedNames.MAP_SEQUENCE_NAME).newId());
businessEvent.setEventTime(Instant.now());
businessEvent.setUserId(0L); // todo откуда брать пользователя, причину изменений?
if (eventType != null && eventType.length() > 4) { // never
eventType = eventType.substring(0, 4);
}
businessEvent.setEventType(eventType);
businessEvent.setUserId(0L);
log.debug("business event created {} {}", businessEvent.getClass().getName(), businessEvent);
}
}

View file

@ -6,6 +6,7 @@ import com.hazelcast.core.IMap;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
@ -18,7 +19,6 @@ import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.lang.NonNull;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
@ -39,6 +39,8 @@ import ru.spcex.platform.utils.text.TextUtil;
import javax.annotation.PostConstruct;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
@ -51,7 +53,7 @@ import static ru.spcex.clearing.imdg.utils.DbDataUtils.generatingRandomString;
TestConfiguration.class,
DbTestConnectionConfig.class})
@ExtendWith(SpringExtension.class)
@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/imdg/src/main/resources")
//@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/imdg/src/main/resources") @TestPropertySource(locations = "/AllMapStoreTest.properties")
public class AllMapStoreTest {
private static final Long ID = 1000000L;
private final Logger log = LoggerFactory.getLogger(this.getClass());
@ -61,6 +63,13 @@ public class AllMapStoreTest {
@Autowired
JdbcTemplate jdbcTemplate;
@BeforeAll
static void setProperty() {
Path path = Paths.get("src", "main", "resources");
String currentPath = path.toAbsolutePath().toString();
System.setProperty("spring.config.location", currentPath);
}
@PostConstruct
public void initTestObjects() {
try {

View file

@ -11,7 +11,7 @@ import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsCom
public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
public final Matcher<T> MATCHER;
private final String mapName;
private final Class<T> clazz;
private SettingOperation settingOperation;
@ -21,12 +21,20 @@ public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz) {
this.mapName = mapName;
this.clazz = clazz;
this.MATCHER = usingIgnoringFieldsComparator();
}
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) {
this.mapName = mapName;
this.clazz = clazz;
this.settingOperation = settingOperation;
this.MATCHER = usingIgnoringFieldsComparator();
}
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, Matcher<T> MATCHER) {
this.mapName = mapName;
this.clazz = clazz;
this.MATCHER = MATCHER;
}
public String getMapName() {

View file

@ -30,6 +30,8 @@ import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
public class RunnableMapNamesForTesting {
public static List<BusinessObjectAndBusinessEventForCheckMapStore> businessObjectAndBusinessEventForCheckMapStores;
public static List<DictionaryObjectForCheckMapStore> dictionaryObjectForCheckMapStores;
@ -47,7 +49,8 @@ public class RunnableMapNamesForTesting {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class,
usingIgnoringFieldsComparator("object.profile.clearingCode", "object.profile.fullName", "object.profile.registrationCode", "object.profile.shortName", "object.profile.tradingCode")));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
@ -58,7 +61,8 @@ public class RunnableMapNamesForTesting {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Account, Account.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ClearingCalendar, ClearingCalendar.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class,
usingIgnoringFieldsComparator("profile.clearingCode", "profile.fullName", "profile.registrationCode", "profile.shortName", "profile.tradingCode")));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ErrorText, ErrorText.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Launcher, Launcher.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Listing, Listing.class,

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@ import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserAuthRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserLogoutRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.UserUpdateRequest;
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
import ru.spcex.platform.enumeration.ConnectionState;
import ru.spcex.platform.enumeration.Status;
@ -97,12 +98,25 @@ public class UserService extends QueueConsumer implements InitializingBean {
callback(UserAuthRequest.class)
.setConsumer(this::userAuthSuccess)
.forDestination(Consts.USER_AUTH_SUCCESS, callbacks::put);
callback(UserUpdateRequest.class)
.setConsumer(this::userUpdate)
.forDestination(Consts.USER_UPDATE, callbacks::put);
callback(UserLogoutRequest.class)
.setConsumer(this::usersLogoutSuccess)
.forDestination(Consts.USER_LOGOUT_SUCCESS, callbacks::put);
init();
}
private void userUpdate(BaseRequest<UserUpdateRequest> updateEvent) {
UserUpdateRequest updateInfo = updateEvent.getRequestPayload();
log.debug("user name={} update request", updateInfo.getUsername());
UserInfo userInfo = createUserIfNeeded(updateInfo.getUsername());
if (userInfo.isNew) {
log.warn("update for non-existent user");
}
changeRoles(userInfo.userId, userInfo.isNew, updateInfo.getRoles());
}
private void userAuthSuccess(BaseRequest<UserAuthRequest> authEvent) {
UserAuthRequest authInfo = authEvent.getRequestPayload();
log.debug("user name={} authenticated", authInfo.getUsername());

View file

@ -108,6 +108,16 @@ public final class IMDGDistributedNames {
public static final String Map_Session = "Map_Session";
public static final String Map_Notification = "Map_Notification";
public static final String Map_LiabilitiesClaimsAssets = "Map_LiabilitiesClaimsAssets";
public static final String Map_ClearMemberRegister = "Map_ClearMemberRegister";
public static final String Map_BalanceRegister = "Map_BalanceRegister";
public static final String Map_ExecutionDeposit = "Map_ExecutionDeposit";
public static final String Map_DealRegister = "Map_DealRegister";
public static final String Map_AdmittedDealRegister = "Map_AdmittedDealRegister";
public static final String Map_CoveredDealRegister = "Map_CoveredDealRegister";
public static final String Map_UncoveredDealRegister = "Map_UncoveredDealRegister";
public static final String Map_ReportRegister = "Map_ReportRegister";
public static final String Map_ContractRegister = "Map_ContractRegister";
public static final String Map_OrderRegister = "Map_OrderRegister";
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME"; // todo вынести idGenerator отдельно и завернуть в метод, чтобы не напрямую обращаться.

View file

@ -39,6 +39,7 @@ public interface Consts {
String DESTINATION_SDF02_NEW = "s-df-02-new";
String USER_AUTH_SUCCESS = "user-auth-success";
String USER_UPDATE = "user-update";
String USER_LOGOUT_SUCCESS = "user-logout-success";
String USER_SETTINGS_UPDATE = "user-settings-update";

View file

@ -0,0 +1,29 @@
package ru.spcex.clearing.platform.messaging.domain.cud.utilities;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
public class UserUpdateRequest {
@JsonProperty
private String username;
@JsonProperty
private List<String> roles = new ArrayList<>();
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
}