Merge remote-tracking branch 'refs/remotes/origin/dev_xml-importer-exporter' into dev
This commit is contained in:
commit
51c5182e47
93 changed files with 9412 additions and 0 deletions
|
|
@ -43,6 +43,8 @@
|
|||
<module>swt-importer</module>
|
||||
<module>gateway-api</module>
|
||||
<module>imdg-hist</module>
|
||||
<module>xml-importer</module>
|
||||
<module>xml-exporter</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
2
clearing-parent/xml-exporter/.gitignore
vendored
Normal file
2
clearing-parent/xml-exporter/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
log/
|
||||
17
clearing-parent/xml-exporter/.idea/dataSources.xml
generated
Normal file
17
clearing-parent/xml-exporter/.idea/dataSources.xml
generated
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="clearing@localhost" uuid="8f6a6996-0d81-423c-b506-8dd4667b4c00">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:5433/clearing</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
119
clearing-parent/xml-exporter/pom.xml
Normal file
119
clearing-parent/xml-exporter/pom.xml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xml-exporter</artifactId>
|
||||
<name>xml-exporter</name>
|
||||
<description>XML exporter for XML files</description>
|
||||
<version>SPCEX-3.11.0.0</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.11.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-sftp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XML files -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Own dependencies -->
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api-hazelcast-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- special logging -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>7.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.xml.exporter;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
@SpringBootApplication
|
||||
public class XMLExporterApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(XMLExporterApplication.class);
|
||||
builder.run(args);
|
||||
} catch (Throwable e) {
|
||||
LoggerFactory.getLogger(XMLExporterApplication.class).error("XML-Loader start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Configuration
|
||||
public class ImdgConfig {
|
||||
@Bean("taskExecutorHazelcastClientInitializer")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
@Bean("taskExecutorIdGeneratorAwaiter")
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Bean("imdgProvider")
|
||||
public ImdgProvider imdgProvider(@Qualifier("taskExecutorHazelcastClientInitializer") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
ExportXMLServiceSettings settings) {
|
||||
HazelcastClientParams params = new HazelcastClientParams();
|
||||
params.setClusterMembers(settings.getHazelcast().getClusterMembers());
|
||||
params.setLogin(settings.getHazelcast().getLogin());
|
||||
params.setPassword(settings.getHazelcast().getPassword());
|
||||
return new HazelcastService(taskExecutorHazelcastClientInitializer, taskExecutorIdGeneratorAwaiter, params);
|
||||
}
|
||||
|
||||
@Bean("executor")
|
||||
public ThreadPoolTaskExecutor executor(ExportXMLServiceSettings settings) {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setMaxPoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setCorePoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setThreadNamePrefix("xml-exporter-");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(300);
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) {
|
||||
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
|
||||
if (maxPoolSz > 2) {
|
||||
pool.setKeepAliveSeconds(60);
|
||||
pool.setAllowCoreThreadTimeOut(true);
|
||||
}
|
||||
pool.setCorePoolSize(maxPoolSz);
|
||||
pool.setWaitForTasksToCompleteOnShutdown(waitForCompletion);
|
||||
return pool;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
|
||||
@Configuration
|
||||
public class KafkaConfig {
|
||||
@Autowired
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Bean
|
||||
public Consumer<String, Object> createConsumer(ExportXMLServiceSettings settings) {
|
||||
return KafkaConsumerFactory.consumer(settings.getKafkaConsumer());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public Producer<String, Object> createProducer(ExportXMLServiceSettings settings) {
|
||||
if (settings.getKafkaProducer() != null) {
|
||||
return KafkaProducerFactory.producer(settings.getKafkaProducer());
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Configuration
|
||||
public class KafkaSenderConfig {
|
||||
Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final ImdgProvider imdgProvider;
|
||||
|
||||
@Autowired
|
||||
public KafkaSenderConfig(ImdgProvider imdgProvider) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProducerFactory<String, Object> pf(ExportXMLServiceSettings settings) {
|
||||
if (settings.getKafkaProducer() == null) {
|
||||
return null;
|
||||
}
|
||||
KafkaProducerSettings kafkaSettings = settings.getKafkaProducer();
|
||||
return KafkaProducerFactory.producerFactory(kafkaSettings);
|
||||
}
|
||||
|
||||
@Bean("kafkaTemplate")
|
||||
public KafkaTemplate<String, Object> kafkaTemplate(ProducerFactory<String, Object> pf) {
|
||||
if (pf == null) {
|
||||
return null;
|
||||
}
|
||||
return new KafkaTemplate<>(pf);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Supplier<KafkaSender> kafkaSenderSupplier(KafkaTemplate<String, Object> kafkaTemplate,
|
||||
ImdgProvider imdgProvider) {
|
||||
ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator();
|
||||
return () -> KafkaSender
|
||||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import static org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Command.LS;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway;
|
||||
import org.springframework.integration.file.remote.session.CachingSessionFactory;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
|
||||
import org.springframework.integration.sftp.gateway.SftpOutboundGateway;
|
||||
import org.springframework.integration.sftp.outbound.SftpMessageHandler;
|
||||
import org.springframework.integration.sftp.session.DefaultSftpSessionFactory;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
import org.springframework.messaging.handler.annotation.Payload;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
|
||||
@Profile("!test")
|
||||
@Configuration
|
||||
public class SFTPConfig {
|
||||
protected Logger log = LoggerFactory.getLogger(getClass());
|
||||
protected static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser();
|
||||
|
||||
@Bean
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ExportXMLServiceSettings settings) {
|
||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||
factory.setHost(settings.getStore().getServerIp());
|
||||
factory.setPort(settings.getStore().getServerPort());
|
||||
factory.setUser(settings.getStore().getUser());
|
||||
factory.setPassword(settings.getStore().getPassword());
|
||||
factory.setAllowUnknownKeys(true);
|
||||
return new CachingSessionFactory<>(factory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "toSftpChannel")
|
||||
public MessageHandler handler(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
SftpMessageHandler handler = new SftpMessageHandler(sessionFactory);
|
||||
handler.setRemoteDirectoryExpression(EXPRESSION_PARSER.parseExpression("headers['path']"));
|
||||
handler.setAutoCreateDirectory(true);
|
||||
handler.setFileNameGenerator(message -> {
|
||||
if (message.getPayload() instanceof File) {
|
||||
return ((File) message.getPayload()).getName();
|
||||
} else {
|
||||
throw new IllegalArgumentException("File must expected as payload.");
|
||||
}
|
||||
});
|
||||
return handler;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/53655208/profile-doesnt-work-with-messaging-gateway
|
||||
@Bean("xmlGateway")
|
||||
public AnnotationGatewayProxyFactoryBean xmlGateway() {
|
||||
return new AnnotationGatewayProxyFactoryBean(XmlGateway.class);
|
||||
}
|
||||
|
||||
public interface XmlGateway {
|
||||
@Gateway(requestChannel = "toSftpChannel")
|
||||
void sendToSftp(@Payload File file, @Header("path") String path);
|
||||
|
||||
@Gateway(requestChannel = "listSftpChannel")
|
||||
List<SftpFileInfo> listFiles(@Payload String dir);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel listSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handlerList(sessionFactory));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel toSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handler(sessionFactory));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "listSftpChannel")
|
||||
public MessageHandler handlerList(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
SftpOutboundGateway sftpOutboundGateway = new SftpOutboundGateway(sessionFactory, LS.getCommand(), "payload");
|
||||
sftpOutboundGateway.setOption(AbstractRemoteFileOutboundGateway.Option.RECURSIVE);
|
||||
return sftpOutboundGateway;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
|
||||
@Profile("test")
|
||||
@Configuration
|
||||
public class SFTPMockConfig {
|
||||
@Bean("xmlGateway")
|
||||
public SFTPConfig.XmlGateway dbfGateway(){
|
||||
return new XGateway();
|
||||
}
|
||||
|
||||
public static class XGateway implements SFTPConfig.XmlGateway{
|
||||
|
||||
@Override
|
||||
public void sendToSftp(File file, String path) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SftpFileInfo> listFiles(String dir) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
import com.ctc.wstx.stax.WstxOutputFactory;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class XMLExporterConfig {
|
||||
@Bean("mapOfTable")
|
||||
public Map<Table, ObjectTag<? extends SpcexObjectBase>> getMapOfTables() {
|
||||
Map<Table, ObjectTag<? extends SpcexObjectBase>> map = new HashMap<>();
|
||||
map.put(Table.S_DF02, new DF02ObjectTag());
|
||||
map.put(Table.S_DF03, new DF03ObjectTag());
|
||||
map.put(Table.S_DF05, new DF05ObjectTag());
|
||||
map.put(Table.S_DF07, new DF07ObjectTag());
|
||||
map.put(Table.S_DF51, new DF51ObjectTag());
|
||||
map.put(Table.S_DF53, new DF53ObjectTag());
|
||||
map.put(Table.S_DF54, new DF54ObjectTag());
|
||||
map.put(Table.S_DF56, new DF56ObjectTag());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Bean("xmlMapper")
|
||||
public XmlMapper xmlMapper() {
|
||||
XMLInputFactory inputFactory = new WstxInputFactory();
|
||||
XMLOutputFactory outputFactory = new WstxOutputFactory();
|
||||
|
||||
XmlFactory xmlFactory = XmlFactory.builder()
|
||||
.xmlInputFactory(inputFactory)
|
||||
.xmlOutputFactory(outputFactory)
|
||||
.build();
|
||||
|
||||
XmlMapper xmlMapper = new XmlMapper(xmlFactory);
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
return xmlMapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
public class Common {
|
||||
private String encoding;
|
||||
private int insertBatchSize;
|
||||
private int threadsCount;
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public int getInsertBatchSize() {
|
||||
return insertBatchSize;
|
||||
}
|
||||
|
||||
public void setInsertBatchSize(int insertBatchSize) {
|
||||
this.insertBatchSize = insertBatchSize;
|
||||
}
|
||||
|
||||
public int getThreadsCount() {
|
||||
return threadsCount;
|
||||
}
|
||||
|
||||
public void setThreadsCount(int threadsCount) {
|
||||
this.threadsCount = threadsCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
public class Cron {
|
||||
private String checkSrcDirCron;
|
||||
|
||||
public String getCheckSrcDirCron() {
|
||||
return checkSrcDirCron;
|
||||
}
|
||||
|
||||
public void setCheckSrcDirCron(String checkSrcDirCron) {
|
||||
this.checkSrcDirCron = checkSrcDirCron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaConsumerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
|
||||
@Component
|
||||
@PropertySource("file:${spring.config.location}/application.properties")
|
||||
@ConfigurationProperties("export-xml-service")
|
||||
public class ExportXMLServiceSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private Common common;
|
||||
private Store store;
|
||||
private Cron cron;
|
||||
|
||||
public HazelcastClientParams getHazelcast() {
|
||||
return hazelcast;
|
||||
}
|
||||
|
||||
public void setHazelcast(HazelcastClientParams hazelcast) {
|
||||
this.hazelcast = hazelcast;
|
||||
}
|
||||
|
||||
public KafkaConsumerSettings getKafkaConsumer() {
|
||||
return kafkaConsumer;
|
||||
}
|
||||
|
||||
public void setKafkaConsumer(KafkaConsumerSettings kafkaConsumer) {
|
||||
this.kafkaConsumer = kafkaConsumer;
|
||||
}
|
||||
|
||||
public Common getCommon() {
|
||||
return common;
|
||||
}
|
||||
|
||||
public void setCommon(Common common) {
|
||||
this.common = common;
|
||||
}
|
||||
|
||||
public Store getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Store store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public Cron getCron() {
|
||||
return cron;
|
||||
}
|
||||
|
||||
public void setCron(Cron cron) {
|
||||
this.cron = cron;
|
||||
}
|
||||
|
||||
public KafkaProducerSettings getKafkaProducer() {
|
||||
return kafkaProducer;
|
||||
}
|
||||
|
||||
public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Store {
|
||||
private String outDir;
|
||||
private String localTempDir;
|
||||
private String user;
|
||||
private String password;
|
||||
private String serverIp;
|
||||
private int serverPort;
|
||||
private Map<String, String> outPayValDir;
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
|
||||
public void setServerIp(String serverIp) {
|
||||
this.serverIp = serverIp;
|
||||
}
|
||||
|
||||
public int getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public String getOutDir() {
|
||||
return outDir;
|
||||
}
|
||||
|
||||
public void setOutDir(String outDir) {
|
||||
this.outDir = outDir;
|
||||
}
|
||||
|
||||
public String getLocalTempDir() {
|
||||
return localTempDir;
|
||||
}
|
||||
|
||||
public void setLocalTempDir(String localTempDir) {
|
||||
this.localTempDir = localTempDir;
|
||||
}
|
||||
|
||||
public Map<String, String> getOutPayValDir() {
|
||||
return outPayValDir;
|
||||
}
|
||||
|
||||
public void setOutPayValDir(Map<String, String> outPayValDir) {
|
||||
this.outPayValDir = outPayValDir;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
|
||||
public class ResultContainer {
|
||||
private String sourceName; // имя инициатора (файла)
|
||||
private UUID uuid;
|
||||
private Table tableForExport;
|
||||
private File fileForExport;
|
||||
private Long groupId;
|
||||
private StageResult lastStageResult;
|
||||
private LocalDateTime registrationDateTime;
|
||||
private String memberCode;
|
||||
private DocumentTag documentTag;
|
||||
|
||||
public ResultContainer(Table tableForExport) {
|
||||
this.tableForExport = tableForExport;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Table getTableForExport() {
|
||||
return tableForExport;
|
||||
}
|
||||
|
||||
public void setTableForExport(Table tableForExport) {
|
||||
this.tableForExport = tableForExport;
|
||||
}
|
||||
|
||||
public File getFileForExport() {
|
||||
return fileForExport;
|
||||
}
|
||||
|
||||
public void setFileForExport(File fileForExport) {
|
||||
this.fileForExport = fileForExport;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public StageResult getLastStageResult() {
|
||||
return lastStageResult;
|
||||
}
|
||||
|
||||
public void setLastStageResult(StageResult lastStageResult) {
|
||||
this.lastStageResult = lastStageResult;
|
||||
}
|
||||
|
||||
public LocalDateTime getRegistrationDateTime() {
|
||||
return registrationDateTime;
|
||||
}
|
||||
|
||||
public void setRegistrationDateTime(LocalDateTime registrationDateTime) {
|
||||
this.registrationDateTime = registrationDateTime;
|
||||
}
|
||||
|
||||
public String getMemberCode() {
|
||||
return memberCode;
|
||||
}
|
||||
|
||||
public void setMemberCode(String memberCode) {
|
||||
this.memberCode = memberCode;
|
||||
}
|
||||
|
||||
public DocumentTag getDocumentTag() {
|
||||
return documentTag;
|
||||
}
|
||||
|
||||
public void setDocumentTag(DocumentTag documentTag) {
|
||||
this.documentTag = documentTag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
import static ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile.SECTION;
|
||||
import static ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile.outDir;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
|
||||
public enum FilenameTemplate {
|
||||
df_section_dateTime {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
},
|
||||
df_section_dateTime_counter {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(counter(resultContainer, files))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
},
|
||||
df_section_sameName {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
if (resultContainer.getSourceName() == null) {
|
||||
LoggerFactory.getLogger(getClass()).warn("{} groupId={}, SourceName no set. Do default name as df_section_dateTime_counter.", resultContainer.getTableForExport(), resultContainer.getGroupId());
|
||||
return df_section_dateTime_counter.getFileName(resultContainer, files);
|
||||
}
|
||||
String name = resultContainer.getSourceName();
|
||||
int i = name.indexOf("_");
|
||||
if (i < 0) throw new IllegalArgumentException("Unexpected source name (symbol _ not found): " + name);
|
||||
return outDir + File.separator +
|
||||
resultContainer.getTableForExport().getFilePrefix().toUpperCase(Locale.ROOT) +
|
||||
name.substring(i);
|
||||
}
|
||||
},
|
||||
df_section_dateTime_counter_mamberCode {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(counter(resultContainer, files))
|
||||
.append(memberCode(resultContainer))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
};
|
||||
|
||||
protected StringBuilder appendSection(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(outDir);
|
||||
result.append(File.separator);
|
||||
result.append(resultContainer.getTableForExport().getFilePrefix().toUpperCase(Locale.ROOT));
|
||||
result.append('_');
|
||||
result.append(SECTION);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder dateTime(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append("PRC");
|
||||
result.append(tsFormatter.format(resultContainer.getRegistrationDateTime()));
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder counter(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append(countSameFilesInDir(resultContainer.getTableForExport().getFilePrefix(), files) + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder memberCode(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append(resultContainer.getMemberCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Integer countSameFilesInDir(String prefixOfTable, List<SftpFileInfo> files) {
|
||||
final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
int res = 0;
|
||||
String timestampNow = utilFormatter.format(LocalDateTime.now());
|
||||
for (SftpFileInfo file : files) {
|
||||
if (file.isDirectory()) continue;
|
||||
String name = file.getFilename();
|
||||
String[] splitName = name.split("_");
|
||||
if (splitName.length < 3) {
|
||||
log.info("Filename did not contains 3 or 4+ separator \"_\": " + name);
|
||||
continue;
|
||||
}
|
||||
String prefix = splitName[0];
|
||||
String timestamp = splitName[2];
|
||||
|
||||
if (prefix.equalsIgnoreCase(prefixOfTable) && timestamp.contains(timestampNow)) {
|
||||
if (splitName.length < 4) {
|
||||
log.warn("Filename did not contains 4+ separator \"_\": " + name);
|
||||
continue;
|
||||
}
|
||||
String counter = splitName[3];
|
||||
int positionOfDot = counter.indexOf('.');
|
||||
if (positionOfDot != -1) {
|
||||
counter = counter.substring(0, positionOfDot);
|
||||
}
|
||||
res = Integer.max(res, Integer.parseInt(counter));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static final DateTimeFormatter tsFormatter = DateTimeFormatter.ofPattern("yyMMddHHmm");
|
||||
private static final DateTimeFormatter utilFormatter = DateTimeFormatter.ofPattern("yyMMdd");
|
||||
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
public enum StageResult {
|
||||
OK,
|
||||
ERROR,
|
||||
COMPLETE
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
public enum Table {
|
||||
S_DF02("DF-02", IMDGDistributedNames.Map_SDf02, SDf02.class),
|
||||
S_DF03("DF-03", IMDGDistributedNames.Map_SDf03, SDf03.class),
|
||||
S_DF05("DF-05", IMDGDistributedNames.Map_SDf05, SDf05.class),
|
||||
S_DF07("DF-07", IMDGDistributedNames.Map_SDf07, SDf07.class),
|
||||
S_DF51("DF-51", IMDGDistributedNames.Map_SDf51, SDf51.class),
|
||||
S_DF53("DF-53", IMDGDistributedNames.Map_SDf53, SDf53.class),
|
||||
S_DF54("DF-54", IMDGDistributedNames.Map_SDf54, SDf54.class),
|
||||
S_DF56("DF-56", IMDGDistributedNames.Map_SDf56, SDf56.class);
|
||||
|
||||
/**
|
||||
* Префикс имени файла для экспорта
|
||||
*/
|
||||
private final String filePrefix;
|
||||
|
||||
/**
|
||||
* Имя мапы hazelcast
|
||||
*/
|
||||
private final String hazelcastMapName;
|
||||
|
||||
/**
|
||||
* Класс объекта
|
||||
*/
|
||||
private final Class<? extends SpcexObjectBase> entityClass;
|
||||
|
||||
|
||||
Table(String filePrefix, String hazelcastMapName, Class<? extends SpcexObjectBase> entityClass) {
|
||||
this.filePrefix = filePrefix;
|
||||
this.hazelcastMapName = hazelcastMapName;
|
||||
this.entityClass = entityClass;
|
||||
}
|
||||
|
||||
public String getHazelcastMapName() {
|
||||
return hazelcastMapName;
|
||||
}
|
||||
|
||||
public String getFilePrefix() {
|
||||
return filePrefix;
|
||||
}
|
||||
|
||||
public Class<? extends SpcexObjectBase> getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@JacksonXmlRootElement(localName = "DOCUMENT")
|
||||
public class DocumentTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEID")
|
||||
private String messageId;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETYPE")
|
||||
private String messageType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGENAME")
|
||||
private String messageName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEDATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate messageDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETIME")
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
private LocalTime messageTime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SENDER")
|
||||
private String sender;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RECEIVER")
|
||||
private String receiver;
|
||||
|
||||
@JacksonXmlProperty(localName = "PARENTDOC")
|
||||
private ParentDocTag parentDoc;
|
||||
|
||||
@JacksonXmlElementWrapper(localName = "OBJECTS")
|
||||
@JacksonXmlProperty(localName = "OBJECT")
|
||||
private List<ObjectTag<? extends SpcexObjectBase>> objects;
|
||||
|
||||
public DocumentTag() {
|
||||
}
|
||||
|
||||
public String getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(String messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public String getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public String getMessageName() {
|
||||
return messageName;
|
||||
}
|
||||
|
||||
public void setMessageName(String messageName) {
|
||||
this.messageName = messageName;
|
||||
}
|
||||
|
||||
public LocalDate getMessageDate() {
|
||||
return messageDate;
|
||||
}
|
||||
|
||||
public void setMessageDate(LocalDate messageDate) {
|
||||
this.messageDate = messageDate;
|
||||
}
|
||||
|
||||
public LocalTime getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(LocalTime messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getReceiver() {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
public ParentDocTag getParentDoc() {
|
||||
return parentDoc;
|
||||
}
|
||||
|
||||
public void setParentDoc(ParentDocTag parentDoc) {
|
||||
this.parentDoc = parentDoc;
|
||||
}
|
||||
|
||||
public List<ObjectTag<? extends SpcexObjectBase>> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void setObjects(List<ObjectTag<? extends SpcexObjectBase>> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DocumentTag that = (DocumentTag) o;
|
||||
return Objects.equals(messageId, that.messageId) && Objects.equals(messageType, that.messageType) && Objects.equals(messageName, that.messageName) && Objects.equals(messageDate, that.messageDate) && Objects.equals(messageTime, that.messageTime) && Objects.equals(sender, that.sender) && Objects.equals(receiver, that.receiver) && Objects.equals(parentDoc, that.parentDoc) && Objects.equals(objects, that.objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(messageId, messageType, messageName, messageDate, messageTime, sender, receiver, parentDoc, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocumentTag{" +
|
||||
"messageId='" + messageId + '\'' +
|
||||
", messageType='" + messageType + '\'' +
|
||||
", messageName='" + messageName + '\'' +
|
||||
", messageDate='" + messageDate + '\'' +
|
||||
", messageTime='" + messageTime + '\'' +
|
||||
", sender='" + sender + '\'' +
|
||||
", receiver='" + receiver + '\'' +
|
||||
", parentDoc=" + parentDoc +
|
||||
", objects=" + objects +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ParentDocTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PARENTID")
|
||||
private String parentId;
|
||||
|
||||
public ParentDocTag() {
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ParentDocTag that = (ParentDocTag) o;
|
||||
return Objects.equals(parentId, that.parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParentDocTag{" +
|
||||
"parentId='" + parentId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
|
||||
public class DF02ObjectTag extends ObjectTag<SDf02> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CURR_CODE")
|
||||
private String currCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "REMAINDER")
|
||||
private String remainder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_CODE")
|
||||
private String accCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DAT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dat;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMENGAGE")
|
||||
private String sumengage;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMUNBLOK")
|
||||
private String sumunblock;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "FILE_TYPE")
|
||||
private String fileType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private String result;
|
||||
|
||||
public DF02ObjectTag() {
|
||||
super(SDf02.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf02 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.currCode = entity.getCurr_code();
|
||||
this.account = entity.getAccount();
|
||||
this.remainder = entity.getRemainder();
|
||||
this.deal = entity.getDeal();
|
||||
this.accCode = entity.getAcc_code();
|
||||
this.dat = LocalDate.parse(entity.getDat(), dtf);
|
||||
this.market = entity.getMarket();
|
||||
this.accName = entity.getAcc_name();
|
||||
this.accType = entity.getAcc_type();
|
||||
this.sumengage = entity.getSumengage();
|
||||
this.sumunblock = entity.getSumunblock();
|
||||
this.fileType = entity.getFile_type();
|
||||
this.result = entity.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.currCode;
|
||||
}
|
||||
|
||||
public String getCurrCode() {
|
||||
return currCode;
|
||||
}
|
||||
|
||||
public void setCurrCode(String currCode) {
|
||||
this.currCode = currCode;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getRemainder() {
|
||||
return remainder;
|
||||
}
|
||||
|
||||
public void setRemainder(String remainder) {
|
||||
this.remainder = remainder;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getAccCode() {
|
||||
return accCode;
|
||||
}
|
||||
|
||||
public void setAccCode(String accCode) {
|
||||
this.accCode = accCode;
|
||||
}
|
||||
|
||||
public LocalDate getDat() {
|
||||
return dat;
|
||||
}
|
||||
|
||||
public void setDat(LocalDate dat) {
|
||||
this.dat = dat;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
public String getSumengage() {
|
||||
return sumengage;
|
||||
}
|
||||
|
||||
public void setSumengage(String sumengage) {
|
||||
this.sumengage = sumengage;
|
||||
}
|
||||
|
||||
public String getSumunblock() {
|
||||
return sumunblock;
|
||||
}
|
||||
|
||||
public void setSumunblock(String sumunblock) {
|
||||
this.sumunblock = sumunblock;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF02ObjectTag that = (DF02ObjectTag) o;
|
||||
return Objects.equals(currCode, that.currCode) && Objects.equals(account, that.account) && Objects.equals(remainder, that.remainder) && Objects.equals(deal, that.deal) && Objects.equals(accCode, that.accCode) && Objects.equals(dat, that.dat) && Objects.equals(market, that.market) && Objects.equals(accName, that.accName) && Objects.equals(accType, that.accType) && Objects.equals(sumengage, that.sumengage) && Objects.equals(sumunblock, that.sumunblock) && Objects.equals(fileType, that.fileType) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(currCode, account, remainder, deal, accCode, dat, market, accName, accType, sumengage, sumunblock, fileType, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF02ObjectTag{" +
|
||||
"currCode='" + currCode + '\'' +
|
||||
", account='" + account + '\'' +
|
||||
", remainder='" + remainder + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", accCode='" + accCode + '\'' +
|
||||
", dat=" + dat +
|
||||
", market='" + market + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", accType='" + accType + '\'' +
|
||||
", sumengage='" + sumengage + '\'' +
|
||||
", sumunblock='" + sumunblock + '\'' +
|
||||
", fileType='" + fileType + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
|
||||
public class DF03ObjectTag extends ObjectTag<SDf03> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
@JsonIgnore
|
||||
private String sbanknam2;
|
||||
@JsonIgnore
|
||||
private String sbanknam3;
|
||||
@JsonIgnore
|
||||
private String sbanknam4;
|
||||
@JsonIgnore
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
@JsonIgnore
|
||||
private String rbanknam2;
|
||||
@JsonIgnore
|
||||
private String rbanknam3;
|
||||
@JsonIgnore
|
||||
private String rbanknam4;
|
||||
@JsonIgnore
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "IMP_RESULT")
|
||||
private String impResult;
|
||||
|
||||
|
||||
public DF03ObjectTag() {
|
||||
super(SDf03.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf03 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.segType = entity.getSeg_type();
|
||||
this.docType = entity.getDoc_type();
|
||||
this.docnmRef = entity.getDocnm_ref();
|
||||
this.docnmprev = entity.getDocnmprev();
|
||||
this.cAccDeb = entity.getC_acc_deb();
|
||||
this.sbanknam1 = entity.getSbanknam1();
|
||||
this.sbanknam2 = entity.getSbanknam2();
|
||||
this.sbanknam3 = entity.getSbanknam3();
|
||||
this.sbanknam4 = entity.getSbanknam4();
|
||||
this.sbanknam5 = entity.getSbanknam5();
|
||||
this.cAccCred = entity.getC_acc_cred();
|
||||
this.rbanknam1 = entity.getRbanknam1();
|
||||
this.rbanknam2 = entity.getRbanknam2();
|
||||
this.rbanknam3 = entity.getRbanknam3();
|
||||
this.rbanknam4 = entity.getRbanknam4();
|
||||
this.rbanknam5 = entity.getRbanknam5();
|
||||
this.payDate = LocalDate.parse(entity.getPay_date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
this.sumDeb = entity.getSum_deb();
|
||||
this.specif1 = entity.getSpecif_1();
|
||||
this.impResult = entity.getImp_result();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getImpResult() {
|
||||
return impResult;
|
||||
}
|
||||
|
||||
public void setImpResult(String impResult) {
|
||||
this.impResult = impResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF03ObjectTag that = (DF03ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(specif1, that.specif1) && Objects.equals(impResult, that.impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, payDate, payVal, sumDeb, specif1, impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF03ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", impResult='" + impResult + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
|
||||
public class DF05ObjectTag extends ObjectTag<SDf05> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TP")
|
||||
private BigDecimal tp;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dt;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TM")
|
||||
@JsonFormat(pattern = "hh:mm:ss")
|
||||
private LocalTime tm;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PR")
|
||||
private String pr;
|
||||
|
||||
public DF05ObjectTag() {
|
||||
super(SDf05.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf05 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
this.tp = entity.getTp();
|
||||
this.dt = entity.getDt();
|
||||
this.tm = LocalTime.parse(entity.getTm(), dtf);
|
||||
this.pr = entity.getPr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public BigDecimal getTp() {
|
||||
return tp;
|
||||
}
|
||||
|
||||
public void setTp(BigDecimal tp) {
|
||||
this.tp = tp;
|
||||
}
|
||||
|
||||
public LocalDate getDt() {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(LocalDate dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public LocalTime getTm() {
|
||||
return tm;
|
||||
}
|
||||
|
||||
public void setTm(LocalTime tm) {
|
||||
this.tm = tm;
|
||||
}
|
||||
|
||||
public String getPr() {
|
||||
return pr;
|
||||
}
|
||||
|
||||
public void setPr(String pr) {
|
||||
this.pr = pr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF05ObjectTag that = (DF05ObjectTag) o;
|
||||
return Objects.equals(tp, that.tp) && Objects.equals(dt, that.dt) && Objects.equals(tm, that.tm) && Objects.equals(pr, that.pr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(tp, dt, tm, pr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF05ObjectTag{" +
|
||||
"tp=" + tp +
|
||||
", dt=" + dt +
|
||||
", tm=" + tm +
|
||||
", pr='" + pr + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
|
||||
public class DF07ObjectTag extends ObjectTag<SDf07> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM")
|
||||
private BigDecimal sum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TYPE")
|
||||
private String type;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CLIENTN")
|
||||
private String clientN;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN")
|
||||
private String inn;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "BIC")
|
||||
private String bic;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPEC")
|
||||
private String spec;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private BigDecimal number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private BigDecimal result;
|
||||
|
||||
|
||||
public DF07ObjectTag() {
|
||||
super(SDf07.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf07 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.account = entity.getAccount();
|
||||
this.sum = entity.getSum();
|
||||
this.market = entity.getMarket();
|
||||
this.type = entity.getType();
|
||||
this.deal = entity.getDeal();
|
||||
this.clientN = entity.getClientN();
|
||||
this.inn = entity.getInn();
|
||||
this.bic = entity.getBic();
|
||||
this.spec = entity.getSpec();
|
||||
this.number = entity.getNumber();
|
||||
this.result = entity.getResult();
|
||||
this.docNum = entity.getDoc_Num();
|
||||
this.docDate = LocalDate.parse(entity.getDoc_Date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public BigDecimal getSum() {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public void setSum(BigDecimal sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getClientN() {
|
||||
return clientN;
|
||||
}
|
||||
|
||||
public void setClientN(String clientN) {
|
||||
this.clientN = clientN;
|
||||
}
|
||||
|
||||
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 getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setSpec(String spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(BigDecimal number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public BigDecimal getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(BigDecimal result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF07ObjectTag that = (DF07ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(sum, that.sum) && Objects.equals(market, that.market) && Objects.equals(type, that.type) && Objects.equals(deal, that.deal) && Objects.equals(clientN, that.clientN) && Objects.equals(inn, that.inn) && Objects.equals(bic, that.bic) && Objects.equals(spec, that.spec) && Objects.equals(number, that.number) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(payVal, that.payVal) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, sum, market, type, deal, clientN, inn, bic, spec, number, docNum, docDate, payVal, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF07ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", sum=" + sum +
|
||||
", market='" + market + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", clientN='" + clientN + '\'' +
|
||||
", inn='" + inn + '\'' +
|
||||
", bic='" + bic + '\'' +
|
||||
", spec='" + spec + '\'' +
|
||||
", number=" + number +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Objects;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
|
||||
public class DF51ObjectTag extends ObjectTag<SDf51> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private String number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "UNIXTIME")
|
||||
private Long unixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime datetime;
|
||||
|
||||
public DF51ObjectTag() {
|
||||
super(SDf51.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf51 entity) {
|
||||
this.number = entity.getNumber();
|
||||
this.unixtime = Long.valueOf(entity.getDatetime());
|
||||
this.datetime = Instant.ofEpochMilli(this.unixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Long getUnixtime() {
|
||||
return unixtime;
|
||||
}
|
||||
|
||||
public void setUnixtime(Long unixtime) {
|
||||
this.unixtime = unixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getDatetime() {
|
||||
return datetime;
|
||||
}
|
||||
|
||||
public void setDatetime(LocalDateTime datetime) {
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF51ObjectTag that = (DF51ObjectTag) o;
|
||||
return Objects.equals(number, that.number) && Objects.equals(unixtime, that.unixtime) && Objects.equals(datetime, that.datetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(number, unixtime, datetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF51ObjectTag{" +
|
||||
"number='" + number + '\'' +
|
||||
", unixtime=" + unixtime +
|
||||
", datetime=" + datetime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
|
||||
public class DF53ObjectTag extends ObjectTag<SDf53> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate date;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "STATUS")
|
||||
private Long status;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private String result;
|
||||
|
||||
|
||||
public DF53ObjectTag() {
|
||||
super(SDf53.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf53 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.account = entity.getAccount();
|
||||
this.accName = entity.getAccName();
|
||||
this.deal = entity.getDeal();
|
||||
this.date = LocalDate.parse(entity.getDate(), dtf);
|
||||
this.status = entity.getStatus();
|
||||
this.accType = entity.getAccType();
|
||||
this.result = entity.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Long getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Long status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF53ObjectTag that = (DF53ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(accName, that.accName) && Objects.equals(deal, that.deal) && Objects.equals(date, that.date) && Objects.equals(status, that.status) && Objects.equals(accType, that.accType) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, accName, deal, date, status, accType, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF53ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", date=" + date +
|
||||
", status=" + status +
|
||||
", accType='" + accType + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,619 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
|
||||
public class DF54ObjectTag extends ObjectTag<SDf54> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKCODE")
|
||||
private String sbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
@JsonIgnore
|
||||
private String sbanknam2;
|
||||
@JsonIgnore
|
||||
private String sbanknam3;
|
||||
@JsonIgnore
|
||||
private String sbanknam4;
|
||||
@JsonIgnore
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKCODE")
|
||||
private String rbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
@JsonIgnore
|
||||
private String rbanknam2;
|
||||
@JsonIgnore
|
||||
private String rbanknam3;
|
||||
@JsonIgnore
|
||||
private String rbanknam4;
|
||||
@JsonIgnore
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_TYPE")
|
||||
private String opType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_ORDER")
|
||||
private String opOrder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SCLIENTN")
|
||||
private String sclientn1;
|
||||
@JsonIgnore
|
||||
private String sclientn2;
|
||||
@JsonIgnore
|
||||
private String sclientn3;
|
||||
@JsonIgnore
|
||||
private String sclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_DEB")
|
||||
private String innDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_DEB")
|
||||
private String kppDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_DEB")
|
||||
private String accDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RCLIENTN")
|
||||
private String rclientn1;
|
||||
@JsonIgnore
|
||||
private String rclientn2;
|
||||
@JsonIgnore
|
||||
private String rclientn3;
|
||||
@JsonIgnore
|
||||
private String rclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_CRED")
|
||||
private String innCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_CRED")
|
||||
private String kppCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_KR_1")
|
||||
private String accKr1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEND_TYPE")
|
||||
private String sendType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_RESULT")
|
||||
private String docResult;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "VALUE_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate valueDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_BEN")
|
||||
private String swiftBen;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_INT")
|
||||
private String swiftInt;
|
||||
|
||||
|
||||
public DF54ObjectTag() {
|
||||
super(SDf54.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf54 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.segType = entity.getSeg_type();
|
||||
this.docType = entity.getDoc_type();
|
||||
this.docnmRef = entity.getDocnm_ref();
|
||||
this.docnmprev = entity.getDocnmprev();
|
||||
this.sbankcode = entity.getSbankcode();
|
||||
this.cAccDeb = entity.getC_acc_deb();
|
||||
this.sbanknam1 = entity.getSbanknam1();
|
||||
this.sbanknam2 = entity.getSbanknam2();
|
||||
this.sbanknam3 = entity.getSbanknam3();
|
||||
this.sbanknam4 = entity.getSbanknam4();
|
||||
this.sbanknam5 = entity.getSbanknam5();
|
||||
this.rbankcode = entity.getRbankcode();
|
||||
this.cAccCred = entity.getC_acc_cred();
|
||||
this.rbanknam1 = entity.getRbanknam1();
|
||||
this.rbanknam2 = entity.getRbanknam2();
|
||||
this.rbanknam3 = entity.getRbanknam3();
|
||||
this.rbanknam4 = entity.getRbanknam4();
|
||||
this.rbanknam5 = entity.getRbanknam5();
|
||||
this.opType = entity.getOp_type();
|
||||
this.opOrder = entity.getOp_order();
|
||||
this.payDate = LocalDate.parse(entity.getPay_date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
this.sumDeb = entity.getSum_deb();
|
||||
this.sclientn1 = entity.getSclientn1();
|
||||
this.sclientn2 = entity.getSclientn2();
|
||||
this.sclientn3 = entity.getSclientn3();
|
||||
this.sclientn4 = entity.getSclientn4();
|
||||
this.innDeb = entity.getInn_deb();
|
||||
this.kppDeb = entity.getKpp_deb();
|
||||
this.accDeb = entity.getAcc_deb();
|
||||
this.rclientn1 = entity.getRclientn1();
|
||||
this.rclientn2 = entity.getRclientn2();
|
||||
this.rclientn3 = entity.getRclientn3();
|
||||
this.rclientn4 = entity.getRclientn4();
|
||||
this.innCred = entity.getInn_cred();
|
||||
this.kppCred = entity.getKpp_cred();
|
||||
this.accKr1 = entity.getAcc_kr_1();
|
||||
this.specif1 = entity.getSpecif_1();
|
||||
this.sendType = entity.getSend_type();
|
||||
this.docResult = entity.getDoc_result();
|
||||
this.docNum = entity.getDoc_Num();
|
||||
this.docDate = LocalDate.parse(entity.getDoc_Date(), dtf);
|
||||
this.valueDate = LocalDate.parse(entity.getValue_date(), dtf);
|
||||
this.swiftBen = entity.getSwift_ben();
|
||||
this.swiftInt = entity.getSwift_int();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getSbankcode() {
|
||||
return sbankcode;
|
||||
}
|
||||
|
||||
public void setSbankcode(String sbankcode) {
|
||||
this.sbankcode = sbankcode;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getRbankcode() {
|
||||
return rbankcode;
|
||||
}
|
||||
|
||||
public void setRbankcode(String rbankcode) {
|
||||
this.rbankcode = rbankcode;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public String getOpType() {
|
||||
return opType;
|
||||
}
|
||||
|
||||
public void setOpType(String opType) {
|
||||
this.opType = opType;
|
||||
}
|
||||
|
||||
public String getOpOrder() {
|
||||
return opOrder;
|
||||
}
|
||||
|
||||
public void setOpOrder(String opOrder) {
|
||||
this.opOrder = opOrder;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSclientn1() {
|
||||
return sclientn1;
|
||||
}
|
||||
|
||||
public void setSclientn1(String sclientn1) {
|
||||
this.sclientn1 = sclientn1;
|
||||
}
|
||||
|
||||
public String getSclientn2() {
|
||||
return sclientn2;
|
||||
}
|
||||
|
||||
public void setSclientn2(String sclientn2) {
|
||||
this.sclientn2 = sclientn2;
|
||||
}
|
||||
|
||||
public String getSclientn3() {
|
||||
return sclientn3;
|
||||
}
|
||||
|
||||
public void setSclientn3(String sclientn3) {
|
||||
this.sclientn3 = sclientn3;
|
||||
}
|
||||
|
||||
public String getSclientn4() {
|
||||
return sclientn4;
|
||||
}
|
||||
|
||||
public void setSclientn4(String sclientn4) {
|
||||
this.sclientn4 = sclientn4;
|
||||
}
|
||||
|
||||
public String getInnDeb() {
|
||||
return innDeb;
|
||||
}
|
||||
|
||||
public void setInnDeb(String innDeb) {
|
||||
this.innDeb = innDeb;
|
||||
}
|
||||
|
||||
public String getKppDeb() {
|
||||
return kppDeb;
|
||||
}
|
||||
|
||||
public void setKppDeb(String kppDeb) {
|
||||
this.kppDeb = kppDeb;
|
||||
}
|
||||
|
||||
public String getAccDeb() {
|
||||
return accDeb;
|
||||
}
|
||||
|
||||
public void setAccDeb(String accDeb) {
|
||||
this.accDeb = accDeb;
|
||||
}
|
||||
|
||||
public String getRclientn1() {
|
||||
return rclientn1;
|
||||
}
|
||||
|
||||
public void setRclientn1(String rclientn1) {
|
||||
this.rclientn1 = rclientn1;
|
||||
}
|
||||
|
||||
public String getRclientn2() {
|
||||
return rclientn2;
|
||||
}
|
||||
|
||||
public void setRclientn2(String rclientn2) {
|
||||
this.rclientn2 = rclientn2;
|
||||
}
|
||||
|
||||
public String getRclientn3() {
|
||||
return rclientn3;
|
||||
}
|
||||
|
||||
public void setRclientn3(String rclientn3) {
|
||||
this.rclientn3 = rclientn3;
|
||||
}
|
||||
|
||||
public String getRclientn4() {
|
||||
return rclientn4;
|
||||
}
|
||||
|
||||
public void setRclientn4(String rclientn4) {
|
||||
this.rclientn4 = rclientn4;
|
||||
}
|
||||
|
||||
public String getInnCred() {
|
||||
return innCred;
|
||||
}
|
||||
|
||||
public void setInnCred(String innCred) {
|
||||
this.innCred = innCred;
|
||||
}
|
||||
|
||||
public String getKppCred() {
|
||||
return kppCred;
|
||||
}
|
||||
|
||||
public void setKppCred(String kppCred) {
|
||||
this.kppCred = kppCred;
|
||||
}
|
||||
|
||||
public String getAccKr1() {
|
||||
return accKr1;
|
||||
}
|
||||
|
||||
public void setAccKr1(String accKr1) {
|
||||
this.accKr1 = accKr1;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getSendType() {
|
||||
return sendType;
|
||||
}
|
||||
|
||||
public void setSendType(String sendType) {
|
||||
this.sendType = sendType;
|
||||
}
|
||||
|
||||
public String getDocResult() {
|
||||
return docResult;
|
||||
}
|
||||
|
||||
public void setDocResult(String docResult) {
|
||||
this.docResult = docResult;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public LocalDate getValueDate() {
|
||||
return valueDate;
|
||||
}
|
||||
|
||||
public void setValueDate(LocalDate valueDate) {
|
||||
this.valueDate = valueDate;
|
||||
}
|
||||
|
||||
public String getSwiftBen() {
|
||||
return swiftBen;
|
||||
}
|
||||
|
||||
public void setSwiftBen(String swiftBen) {
|
||||
this.swiftBen = swiftBen;
|
||||
}
|
||||
|
||||
public String getSwiftInt() {
|
||||
return swiftInt;
|
||||
}
|
||||
|
||||
public void setSwiftInt(String swiftInt) {
|
||||
this.swiftInt = swiftInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF54ObjectTag that = (DF54ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(sbankcode, that.sbankcode) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(rbankcode, that.rbankcode) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(opType, that.opType) && Objects.equals(opOrder, that.opOrder) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(sclientn1, that.sclientn1) && Objects.equals(sclientn2, that.sclientn2) && Objects.equals(sclientn3, that.sclientn3) && Objects.equals(sclientn4, that.sclientn4) && Objects.equals(innDeb, that.innDeb) && Objects.equals(kppDeb, that.kppDeb) && Objects.equals(accDeb, that.accDeb) && Objects.equals(rclientn1, that.rclientn1) && Objects.equals(rclientn2, that.rclientn2) && Objects.equals(rclientn3, that.rclientn3) && Objects.equals(rclientn4, that.rclientn4) && Objects.equals(innCred, that.innCred) && Objects.equals(kppCred, that.kppCred) && Objects.equals(accKr1, that.accKr1) && Objects.equals(specif1, that.specif1) && Objects.equals(sendType, that.sendType) && Objects.equals(docResult, that.docResult) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(valueDate, that.valueDate) && Objects.equals(swiftBen, that.swiftBen) && Objects.equals(swiftInt, that.swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, sbankcode, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, rbankcode, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, opType, opOrder, payDate, payVal, sumDeb, sclientn1, sclientn2, sclientn3, sclientn4, innDeb, kppDeb, accDeb, rclientn1, rclientn2, rclientn3, rclientn4, innCred, kppCred, accKr1, specif1, sendType, docResult, docNum, docDate, valueDate, swiftBen, swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF54ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", sbankcode='" + sbankcode + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", rbankcode='" + rbankcode + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", opType='" + opType + '\'' +
|
||||
", opOrder='" + opOrder + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", sclientn1='" + sclientn1 + '\'' +
|
||||
", sclientn2='" + sclientn2 + '\'' +
|
||||
", sclientn3='" + sclientn3 + '\'' +
|
||||
", sclientn4='" + sclientn4 + '\'' +
|
||||
", innDeb='" + innDeb + '\'' +
|
||||
", kppDeb='" + kppDeb + '\'' +
|
||||
", accDeb='" + accDeb + '\'' +
|
||||
", rclientn1='" + rclientn1 + '\'' +
|
||||
", rclientn2='" + rclientn2 + '\'' +
|
||||
", rclientn3='" + rclientn3 + '\'' +
|
||||
", rclientn4='" + rclientn4 + '\'' +
|
||||
", innCred='" + innCred + '\'' +
|
||||
", kppCred='" + kppCred + '\'' +
|
||||
", accKr1='" + accKr1 + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", sendType='" + sendType + '\'' +
|
||||
", docResult='" + docResult + '\'' +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", valueDate=" + valueDate +
|
||||
", swiftBen='" + swiftBen + '\'' +
|
||||
", swiftInt='" + swiftInt + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
|
||||
public class DF56ObjectTag extends ObjectTag<SDf56> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private String number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUNIXTIME")
|
||||
private Long startUnixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SDATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime startDatetime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "EUNIXTIME")
|
||||
private Long endUnixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "EDATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime endDatetime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
|
||||
public DF56ObjectTag() {
|
||||
super(SDf56.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf56 entity) {
|
||||
this.number = entity.getNumber();
|
||||
this.startUnixtime = Long.valueOf(entity.getStart_datetime());
|
||||
this.startDatetime = Instant.ofEpochMilli(this.startUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
this.endUnixtime = Long.valueOf(entity.getEnd_datetime());
|
||||
this.endDatetime = Instant.ofEpochMilli(this.endUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
this.account = entity.getAccount();
|
||||
this.deal = entity.getDeal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Long getStartUnixtime() {
|
||||
return startUnixtime;
|
||||
}
|
||||
|
||||
public void setStartUnixtime(Long startUnixtime) {
|
||||
this.startUnixtime = startUnixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartDatetime() {
|
||||
return startDatetime;
|
||||
}
|
||||
|
||||
public void setStartDatetime(LocalDateTime startDatetime) {
|
||||
this.startDatetime = startDatetime;
|
||||
}
|
||||
|
||||
public Long getEndUnixtime() {
|
||||
return endUnixtime;
|
||||
}
|
||||
|
||||
public void setEndUnixtime(Long endUnixtime) {
|
||||
this.endUnixtime = endUnixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndDatetime() {
|
||||
return endDatetime;
|
||||
}
|
||||
|
||||
public void setEndDatetime(LocalDateTime endDatetime) {
|
||||
this.endDatetime = endDatetime;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF56ObjectTag that = (DF56ObjectTag) o;
|
||||
return Objects.equals(number, that.number) && Objects.equals(startUnixtime, that.startUnixtime) && Objects.equals(startDatetime, that.startDatetime) && Objects.equals(endUnixtime, that.endUnixtime) && Objects.equals(endDatetime, that.endDatetime) && Objects.equals(account, that.account) && Objects.equals(deal, that.deal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(number, startUnixtime, startDatetime, endUnixtime, endDatetime, account, deal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF56ObjectTag{" +
|
||||
"number='" + number + '\'' +
|
||||
", startUnixtime=" + startUnixtime +
|
||||
", startDatetime=" + startDatetime +
|
||||
", endUnixtime=" + endUnixtime +
|
||||
", endDatetime=" + endDatetime +
|
||||
", account='" + account + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(DF02ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF03ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF05ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF07ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF51ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF53ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF54ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF56ObjectTag.class),
|
||||
})
|
||||
@JsonIgnoreProperties(value = { "clazz", "currency" })
|
||||
public abstract class ObjectTag<T1 extends SpcexObjectBase> {
|
||||
public final static String ruCurrency = CurrencyCode.RUB.getKey();
|
||||
public Class<T1> clazz;
|
||||
|
||||
public ObjectTag (Class<T1> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public abstract void setData(T1 entity);
|
||||
|
||||
public abstract String getCurrency();
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.PAIR_SDF;
|
||||
import static ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag.ruCurrency;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.PairSdfRequest;
|
||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.ParentDocTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Component
|
||||
public class ExportFromHazelcast {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ImdgProvider imdgProvider;
|
||||
private final SFTPConfig.XmlGateway gateway;
|
||||
private final Map<Table, ObjectTag<? extends SpcexObjectBase>> objectTagMap;
|
||||
private final Supplier<KafkaSender> kafkaSender;
|
||||
private final ExportXMLServiceSettings settings;
|
||||
|
||||
public ExportFromHazelcast(ImdgProvider imdgProvider,
|
||||
SFTPConfig.XmlGateway gateway,
|
||||
@Qualifier("mapOfTable") Map<Table, ObjectTag<? extends SpcexObjectBase>> objectTagMap,
|
||||
Supplier<KafkaSender> kafkaSender,
|
||||
ExportXMLServiceSettings settings) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.gateway = gateway;
|
||||
this.objectTagMap = objectTagMap;
|
||||
this.kafkaSender = kafkaSender;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Table table = Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
File xmlFile = Objects.requireNonNull(resultContainer.getFileForExport());
|
||||
|
||||
DocumentTag documentTag = new DocumentTag();
|
||||
ParentDocTag parentDocTag = new ParentDocTag();
|
||||
parentDocTag.setParentId("");
|
||||
// todo: Добавить данные DocumentTag'а
|
||||
documentTag.setMessageId("");
|
||||
documentTag.setMessageType(table.getFilePrefix().replace("-", ""));
|
||||
documentTag.setMessageName("");
|
||||
documentTag.setMessageDate(LocalDate.now());
|
||||
documentTag.setMessageTime(LocalTime.now());
|
||||
documentTag.setSender("");
|
||||
documentTag.setReceiver("");
|
||||
documentTag.setParentDoc(parentDocTag);
|
||||
|
||||
Imdg<? extends SpcexObjectBase> map = imdgProvider.getImdg(table.getHazelcastMapName(), table.getEntityClass());
|
||||
|
||||
Collection<? extends SpcexObjectBase> tableRows;
|
||||
if (resultContainer.getGroupId() != null) {
|
||||
Map<String, Long> queryParams = Map.of("generationId", resultContainer.getGroupId());
|
||||
tableRows = map.getCollectionObjectsByFieldValues(queryParams);
|
||||
} else {
|
||||
tableRows = map.getAllValues();
|
||||
}
|
||||
if (tableRows.isEmpty()) {
|
||||
log.info("uuid {}. Map {} is empty, generationId {}", resultContainer.getUuid(), resultContainer.getTableForExport().getHazelcastMapName(), resultContainer.getGroupId());
|
||||
return StageResult.COMPLETE;
|
||||
} else {
|
||||
log.debug("uuid {}. Selected {} records from map {}, generationId {}", resultContainer.getUuid(),
|
||||
tableRows.size(), resultContainer.getTableForExport().getHazelcastMapName(), resultContainer.getGroupId());
|
||||
}
|
||||
if (Table.S_DF02 == resultContainer.getTableForExport()) {
|
||||
log.trace("Sort S_DF02 items"); // Сортировка по возрастанию id, чтобы сохранить последовательность строк SDF02, как в SDF01
|
||||
tableRows = new ArrayList<SpcexObjectBase>(tableRows);
|
||||
((ArrayList<SpcexObjectBase>) tableRows).sort(Comparator.comparing(SpcexObjectBase::getId));
|
||||
}
|
||||
|
||||
documentTag.setObjects(addObjectTags(tableRows, table));
|
||||
resultContainer.setDocumentTag(documentTag);
|
||||
|
||||
boolean emptyMap = tableRows.isEmpty();
|
||||
String path;
|
||||
String currency = ruCurrency; //todo: rewrite currency logic
|
||||
if (CurrencyCode.isRub(currency)) {
|
||||
path = settings.getStore().getOutPayValDir().get(ruCurrency);
|
||||
} else {
|
||||
path = settings.getStore().getOutPayValDir().get(currency);
|
||||
}
|
||||
|
||||
if (emptyMap) {
|
||||
log.debug("Delete empty XML temp file \"{}\"", resultContainer.getFileForExport());
|
||||
boolean deleteOk = resultContainer.getFileForExport().delete();
|
||||
if (!deleteOk) {
|
||||
log.warn("Can't delete file {}", resultContainer.getFileForExport().getName());
|
||||
}
|
||||
} else {
|
||||
log.debug("uuid {}, send to SFTP path \"{}\"", resultContainer.getUuid(), path);
|
||||
gateway.sendToSftp(xmlFile, path);
|
||||
if (Table.S_DF02.equals(resultContainer.getTableForExport())) {
|
||||
sendPairSdfRequest(resultContainer);
|
||||
}
|
||||
}
|
||||
|
||||
return StageResult.OK;
|
||||
}
|
||||
|
||||
private <T extends SpcexObjectBase> List<ObjectTag<? extends SpcexObjectBase>> addObjectTags(Collection<T> tableRows, Table table) {
|
||||
List<ObjectTag<? extends SpcexObjectBase>> result = new ArrayList<>();
|
||||
|
||||
for (T row : tableRows) {
|
||||
ObjectTag<T> value = (ObjectTag<T>) objectTagMap.get(table);
|
||||
value.setData(row);
|
||||
result.add(value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void sendPairSdfRequest(ResultContainer resultContainer) {
|
||||
PairSdfRequest request = new PairSdfRequest();
|
||||
request.setGenerationId(resultContainer.getGroupId());
|
||||
request.setFileNameSDf(resultContainer.getFileForExport().getName());
|
||||
request.setTableSDf(resultContainer.getTableForExport().getFilePrefix());
|
||||
Long msgId = kafkaSender.get().sendRequestToQueue(PAIR_SDF, request);
|
||||
log.info("Send PairSdfRequest={} message id={} to kafka \"{}\"", LogFormatter.toString(request), msgId, PAIR_SDF);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.EXPORT_COMPLETED;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.system.JournalSdf;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
|
||||
@Component
|
||||
public class Journal implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final Supplier<KafkaSender> kafkaSender;
|
||||
|
||||
@Autowired
|
||||
public Journal(Supplier<KafkaSender> kafkaSender) {
|
||||
this.kafkaSender = kafkaSender;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
if (kafkaSender == null) {
|
||||
log.info("kafka producer settings missing; kafka messages to journal-service are not enabled.");
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
JournalSdf journalSdf = new JournalSdf();
|
||||
//todo read file attibutes
|
||||
journalSdf.setRegistrationDate(resultContainer.getRegistrationDateTime().toLocalDate());
|
||||
journalSdf.setRegistrationTime(resultContainer.getRegistrationDateTime().toLocalTime());
|
||||
journalSdf.setRegistrationNumber(resultContainer.getGroupId());
|
||||
journalSdf.setDocumentName(documentNames.get(resultContainer.getTableForExport()));
|
||||
journalSdf.setDossierNumber(dossierNumber.get(resultContainer.getTableForExport()));
|
||||
journalSdf.setResultStatus(StageResult.ERROR.equals(resultContainer.getLastStageResult()) ? "NACK" : "ACK");
|
||||
kafkaSender.get().sendRequestToQueue(EXPORT_COMPLETED, journalSdf);
|
||||
|
||||
//удалим временный файл
|
||||
File xmlFile = resultContainer.getFileForExport();
|
||||
// try {
|
||||
// log.debug("Uuid {}, delete temp file \"{}\"", resultContainer.getUuid(), xmlFile);
|
||||
// Files.deleteIfExists(xmlFile.toPath());
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// Надо сохранять для разбора истории и отладки по логам
|
||||
log.debug("Uuid {}, save temp file \"{}\"", resultContainer.getUuid(), xmlFile);
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
}
|
||||
|
||||
private static final Map<Table, String> documentNames = new EnumMap<>(Table.class);
|
||||
static {
|
||||
documentNames.put(Table.S_DF02, "Уведомлений об исполнении операции загрузки денежных средств или уведомление об ошибке");
|
||||
documentNames.put(Table.S_DF03, "Сводное платёжное поручение по итогу проведения расчетов, направляемое в РО");
|
||||
documentNames.put(Table.S_DF05, "Уведомление о завершении расчетов в секции");
|
||||
documentNames.put(Table.S_DF07, "Подтверждение о загрузке Уведомления о возврате ден.ср. по договору депозита");
|
||||
documentNames.put(Table.S_DF51, "Запрос остатков по всем счетам, направляемый в РО");
|
||||
documentNames.put(Table.S_DF53, "");
|
||||
documentNames.put(Table.S_DF54, "Распоряжение на списание денежных средств УК категории В (с клирингового счета)");
|
||||
documentNames.put(Table.S_DF56, "");
|
||||
}
|
||||
|
||||
private static final Map<Table, String> dossierNumber = new EnumMap<>(Table.class);
|
||||
static {
|
||||
dossierNumber.put(Table.S_DF02, "07-50");
|
||||
dossierNumber.put(Table.S_DF03, "07-51");
|
||||
dossierNumber.put(Table.S_DF05, "07-53");
|
||||
dossierNumber.put(Table.S_DF07, "07-58");
|
||||
dossierNumber.put(Table.S_DF51, "07-55");
|
||||
dossierNumber.put(Table.S_DF53, "");
|
||||
dossierNumber.put(Table.S_DF54, "07-48");
|
||||
dossierNumber.put(Table.S_DF56, "");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.FilenameTemplate;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
|
||||
@Component
|
||||
public class PrepareXMLFile implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
public static final String SECTION = "S";
|
||||
private final ExportXMLServiceSettings settings;
|
||||
public static String outDir;
|
||||
private final SFTPConfig.XmlGateway gateway;
|
||||
|
||||
public PrepareXMLFile(ExportXMLServiceSettings settings,
|
||||
SFTPConfig.XmlGateway gateway) {
|
||||
this.settings = settings;
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
if (settings.getStore().getOutPayValDir() == null || settings.getStore().getOutPayValDir().isEmpty()) {
|
||||
log.error("No SFTP scanning directories, need will be adding settings like 'export-xml-service.store.out-pay-val-dir.RUB=/RUB' and restart app");
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
List<SftpFileInfo> files = new ArrayList<>();
|
||||
log.trace("Get files from SFTP paths: {}", settings.getStore().getOutPayValDir().values());
|
||||
// for (String path : settings.getStore().getOutPayValDir().values()) {
|
||||
// files.addAll(gateway.listFiles(path));
|
||||
// }
|
||||
// log.info("There are {} files on the sFTP server in the search directories.", files.size());
|
||||
Table table = resultContainer.getTableForExport();
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
resultContainer.setRegistrationDateTime(currentDateTime);
|
||||
File xmlFile = new File(nameTemplates.get(table).getFileName(resultContainer, files));
|
||||
log.info("XML FILE = {}", xmlFile.toPath());
|
||||
try {
|
||||
Path xmlFilePath = xmlFile.toPath();
|
||||
Files.deleteIfExists(xmlFilePath);
|
||||
Files.createFile(xmlFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("uuid %s. Can't create file %s", resultContainer.getUuid(), xmlFile.getName()), e);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
resultContainer.setFileForExport(xmlFile);
|
||||
log.info("uuid {}. Rows from {} with generationId {} will be export to temp file \"{}\"", resultContainer.getUuid(),
|
||||
resultContainer.getTableForExport().getFilePrefix(), resultContainer.getGroupId(), xmlFile);
|
||||
return StageResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
String outDirPath = settings.getStore().getLocalTempDir();
|
||||
File outDirFile = new File(outDirPath);
|
||||
if (outDirFile.exists() && !outDirFile.isDirectory())
|
||||
throw new IOException("Output directory " + outDirPath + " is file.");
|
||||
if (!outDirFile.exists()) Files.createDirectories(outDirFile.toPath());
|
||||
this.outDir = outDirPath;
|
||||
log.info("Output directory: {}", outDirFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static final Map<Table, FilenameTemplate> nameTemplates = new EnumMap<>(Table.class);
|
||||
|
||||
static {
|
||||
nameTemplates.put(Table.S_DF02, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF03, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF05, FilenameTemplate.df_section_dateTime);
|
||||
nameTemplates.put(Table.S_DF07, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF51, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF53, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF54, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF56, FilenameTemplate.df_section_dateTime_counter);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
|
||||
@Component
|
||||
public class WriteXMLFile {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XmlMapper xmlMapper;
|
||||
|
||||
public WriteXMLFile(@Qualifier("xmlMapper") XmlMapper xmlMapper) {
|
||||
this.xmlMapper = xmlMapper;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Table table = Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
File xmlFile = Objects.requireNonNull(resultContainer.getFileForExport());
|
||||
|
||||
DocumentTag documentTag = Objects.requireNonNull(resultContainer.getDocumentTag());
|
||||
|
||||
log.info("DOCUMENT TAG = {}", documentTag);
|
||||
try {
|
||||
xmlMapper.writeValue(xmlFile, documentTag);
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("uuid %s. Can't export table %s (map %s) to file %s. Table was skipped.",
|
||||
resultContainer.getUuid(), table, table.getHazelcastMapName(), xmlFile), e);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
|
||||
return StageResult.OK;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package ru.spcex.clearing.xml.exporter.services;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.clearing.SdfClearingRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.ExportFromHazelcast;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.Journal;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.WriteXMLFile;
|
||||
import ru.spcex.platform.enumeration.Task;
|
||||
|
||||
@Service
|
||||
public class CommandService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final PrepareXMLFile prepareXMLFile;
|
||||
private final ExportFromHazelcast exportFromHazelcast;
|
||||
private final WriteXMLFile writeXMLFile;
|
||||
private final Journal journal;
|
||||
|
||||
public CommandService(Consumer<String, Object> kafkaQueue,
|
||||
PrepareXMLFile prepareXMLFile,
|
||||
ExportFromHazelcast exportFromHazelcast,
|
||||
WriteXMLFile writeXMLFile,
|
||||
Journal journal) {
|
||||
super(kafkaQueue);
|
||||
this.prepareXMLFile = prepareXMLFile;
|
||||
this.exportFromHazelcast = exportFromHazelcast;
|
||||
this.writeXMLFile = writeXMLFile;
|
||||
this.journal = journal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
callback(ExportToFileRequest.class)
|
||||
.setConsumer(this::process)
|
||||
.forDestination(Consts.EXPORT_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF02, r))
|
||||
.forDestination(Consts.SDF02_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF03, r)) // todo необходимо в отдельную папку: "в отдельную директорию SettlementHouse_Fail (чтобы не отдавать такие файлы в ПРЦ"
|
||||
.forDestination(Consts.SDF03_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF05, r))
|
||||
.forDestination(Consts.SDF05_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF07, r))
|
||||
.forDestination(Consts.SDF07_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF51, r))
|
||||
.forDestination(Consts.SDF51_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF53, r))
|
||||
.forDestination(Consts.SDF53_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF54, r))
|
||||
.forDestination(Consts.SDF54_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF56, r))
|
||||
.forDestination(Consts.SDF56_PROCESS, callbacks::put);
|
||||
|
||||
callback(LauncherCommandRequest.class)
|
||||
.setConsumer(r -> processByLauncher(Table.S_DF54, r))
|
||||
.forDestination(Task.dbfExport_OUTV.topic(), callbacks::put); // todo: добавить код для экспорта XML
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void process(BaseRequest<ExportToFileRequest> systemRequest) {
|
||||
ExportToFileRequest request = systemRequest.getRequestPayload();
|
||||
Optional<Table> tableForExport = Arrays.stream(Table.values()).
|
||||
filter(table -> table.getFilePrefix().equalsIgnoreCase(request.getNameOfTable())).findFirst();
|
||||
if (tableForExport.isEmpty()) {
|
||||
throw new IllegalStateException(String.format("Unsupported table prefix: %s", request.getNameOfTable()));
|
||||
}
|
||||
ResultContainer resultContainer = new ResultContainer(tableForExport.get());
|
||||
resultContainer.setGroupId(request.getSdfGroupId());
|
||||
resultContainer.setSourceName(request.getFileName());
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void processSpecial(Table table, BaseRequest<SdfClearingRequest> systemRequest) {
|
||||
SdfClearingRequest request = systemRequest.getRequestPayload();
|
||||
ResultContainer resultContainer = new ResultContainer(table);
|
||||
resultContainer.setGroupId(request.getGroupId());
|
||||
resultContainer.setSourceName(null);
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void processByLauncher(Table table, BaseRequest<LauncherCommandRequest> systemRequest) {
|
||||
LauncherCommandRequest request = systemRequest.getRequestPayload();
|
||||
log.info("RequestId={}, LauncherCommandRequest task={}. Table {}", systemRequest.getId(), request.getTaskName(), table);
|
||||
ResultContainer resultContainer = new ResultContainer(table);
|
||||
resultContainer.setGroupId(null);
|
||||
resultContainer.setSourceName(null);
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void runProcess(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Task started", resultContainer.getUuid());
|
||||
StageResult result;
|
||||
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
result = prepareXMLFile.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
if (result == StageResult.OK) {
|
||||
result = exportFromHazelcast.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
if (result == StageResult.OK) {
|
||||
result = writeXMLFile.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
if (result == StageResult.OK) {
|
||||
result = journal.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
stopWatch.stop();
|
||||
|
||||
log.info("uuid {}. Task completed, result: {}, time working: {} ms",
|
||||
resultContainer.getUuid(),
|
||||
result,
|
||||
stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
spring.main.web-application-type=none
|
||||
|
||||
export-xml-service.hazelcast.cluster-members=10.200.200.181:5701
|
||||
export-xml-service.hazelcast.login=dev
|
||||
export-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
export-xml-service.common.encoding=cp866
|
||||
export-xml-service.common.threads-count=10
|
||||
|
||||
export-xml-service.store.local-temp-dir=D:\\docs and T3\\clearing\\xml\\
|
||||
# код валюты должен быть в верхнем регистре, например для рублей - "RUB" (*.RUB=export/rub/).RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.EUR=export/eur/
|
||||
export-xml-service.store.user:tester
|
||||
export-xml-service.store.password=password
|
||||
export-xml-service.store.server-ip=10.230.238.53
|
||||
export-xml-service.store.server-port=2222
|
||||
|
||||
export-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-consumer.group-id=dev-group-balance-service
|
||||
export-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
export-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
export-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
export-xml-service.kafka-consumer.linger-ms=1
|
||||
export-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
|
||||
export-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-producer.acks=all
|
||||
export-xml-service.kafka-producer.retries=0
|
||||
export-xml-service.kafka-producer.batch-size=16384
|
||||
export-xml-service.kafka-producer.linger-ms=1
|
||||
export-xml-service.kafka-producer.buffer-memory=33554432
|
||||
56
clearing-parent/xml-exporter/src/main/resources/logback.xml
Normal file
56
clearing-parent/xml-exporter/src/main/resources/logback.xml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_PATH" value="./log" />
|
||||
<property name="FILE_NAME" value="xml-exporter" />
|
||||
<property name="CONSOLE_LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %class{0}:%line - %message%n" />
|
||||
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %class{0}:%msg%n" />
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- first FILE TEXT appender -->
|
||||
<appender name="TEXT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-text.log</file>
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${FILE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-text.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- second FILE JSON appender -->
|
||||
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-json.log</file>
|
||||
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-json.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
</root>
|
||||
|
||||
<logger name="ru.spcex" level="debug" additivity="false">
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,406 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPMockConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.XMLExporterConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
ExportFromHazelcast.class,
|
||||
ExportXMLServiceSettings.class,
|
||||
XMLExporterConfig.class,
|
||||
SFTPMockConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
KafkaTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
@ActiveProfiles("test")
|
||||
class ExportFromHazelcastTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private HazelcastService hazelcastService;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
private ExportFromHazelcast exportFromHazelcast;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
hazelcastService.waitAvailable();
|
||||
|
||||
new TestObjectCreator(hazelcastService).createUserAdmin(1000L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf02ToObjectTag() {
|
||||
SDf02 expectedSDf02 = new SDf02();
|
||||
expectedSDf02.setCurr_code("test1");
|
||||
expectedSDf02.setAccount("test2");
|
||||
expectedSDf02.setRemainder("test3");
|
||||
expectedSDf02.setDeal("test4");
|
||||
expectedSDf02.setAcc_code("test5");
|
||||
expectedSDf02.setDat("14.03.24");
|
||||
expectedSDf02.setMarket("test6");
|
||||
expectedSDf02.setAcc_name("test7");
|
||||
expectedSDf02.setAcc_type("test8");
|
||||
expectedSDf02.setSumengage("test9");
|
||||
expectedSDf02.setSumunblock("test10");
|
||||
expectedSDf02.setFile_type("test11");
|
||||
expectedSDf02.setResult("test12");
|
||||
|
||||
Imdg<SDf02> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf02, SDf02.class);
|
||||
imdg.insert(expectedSDf02);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF02);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF02ObjectTag actualObjectTag = (DF02ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF02");
|
||||
Assertions.assertThat(actualObjectTag.getCurrCode()).isEqualTo(expectedSDf02.getCurr_code());
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf02.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getRemainder()).isEqualTo(expectedSDf02.getRemainder());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf02.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getAccCode()).isEqualTo(expectedSDf02.getAcc_code());
|
||||
Assertions.assertThat(actualObjectTag.getDat().format(formatter)).isEqualTo(expectedSDf02.getDat());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedSDf02.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedSDf02.getAcc_name());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedSDf02.getAcc_type());
|
||||
Assertions.assertThat(actualObjectTag.getSumengage()).isEqualTo(expectedSDf02.getSumengage());
|
||||
Assertions.assertThat(actualObjectTag.getSumunblock()).isEqualTo(expectedSDf02.getSumunblock());
|
||||
Assertions.assertThat(actualObjectTag.getFileType()).isEqualTo(expectedSDf02.getFile_type());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf03ToObjectTag() {
|
||||
SDf03 expectedSDf03 = new SDf03();
|
||||
expectedSDf03.setSeg_type("test1");
|
||||
expectedSDf03.setDoc_type("test2");
|
||||
expectedSDf03.setDocnm_ref("test3");
|
||||
expectedSDf03.setDocnmprev("test4");
|
||||
expectedSDf03.setC_acc_deb("test5");
|
||||
expectedSDf03.setSbanknam1("test6");
|
||||
expectedSDf03.setC_acc_cred("test7");
|
||||
expectedSDf03.setRbanknam1("test8");
|
||||
expectedSDf03.setPay_date("14.03.24");
|
||||
expectedSDf03.setPay_val("test9");
|
||||
expectedSDf03.setSum_deb("test10");
|
||||
expectedSDf03.setSpecif_1("test11");
|
||||
expectedSDf03.setImp_result("test12");
|
||||
|
||||
Imdg<SDf03> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf03, SDf03.class);
|
||||
imdg.insert(expectedSDf03);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF03);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF03ObjectTag actualObjectTag = (DF03ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF03");
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedSDf03.getSeg_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedSDf03.getDoc_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedSDf03.getDocnm_ref());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedSDf03.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedSDf03.getC_acc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedSDf03.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedSDf03.getC_acc_cred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedSDf03.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate().format(formatter)).isEqualTo(expectedSDf03.getPay_date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf03.getPay_val());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedSDf03.getSum_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedSDf03.getSpecif_1());
|
||||
Assertions.assertThat(actualObjectTag.getImpResult()).isEqualTo(expectedSDf03.getImp_result());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf05ToObjectTag() {
|
||||
SDf05 expectedSDf05 = new SDf05();
|
||||
expectedSDf05.setTp(BigDecimal.TEN);
|
||||
expectedSDf05.setDt(LocalDate.parse("2024-03-14"));
|
||||
expectedSDf05.setTm("09:22:12");
|
||||
expectedSDf05.setPr("test2");
|
||||
|
||||
Imdg<SDf05> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf05, SDf05.class);
|
||||
imdg.insert(expectedSDf05);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF05);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF05ObjectTag actualObjectTag = (DF05ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF05");
|
||||
Assertions.assertThat(actualObjectTag.getTp()).isEqualTo(expectedSDf05.getTp());
|
||||
Assertions.assertThat(actualObjectTag.getDt()).isEqualTo(expectedSDf05.getDt());
|
||||
Assertions.assertThat(actualObjectTag.getTm()).isEqualTo(expectedSDf05.getTm());
|
||||
Assertions.assertThat(actualObjectTag.getPr()).isEqualTo(expectedSDf05.getPr());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf07ToObjectTag() {
|
||||
SDf07 expectedSDf07 = new SDf07();
|
||||
expectedSDf07.setAccount("test1");
|
||||
expectedSDf07.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedSDf07.setMarket("test3");
|
||||
expectedSDf07.setType("test4");
|
||||
expectedSDf07.setDeal("test5");
|
||||
expectedSDf07.setClientN("test6");
|
||||
expectedSDf07.setInn("test7");
|
||||
expectedSDf07.setBic("test8");
|
||||
expectedSDf07.setSpec("test9");
|
||||
expectedSDf07.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedSDf07.setDoc_Num("test11");
|
||||
expectedSDf07.setDoc_Date("14.03.24");
|
||||
expectedSDf07.setPay_val("test12");
|
||||
|
||||
Imdg<SDf07> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf07, SDf07.class);
|
||||
imdg.insert(expectedSDf07);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF07);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF07ObjectTag actualObjectTag = (DF07ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF07");
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf07.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getSum()).isEqualTo(expectedSDf07.getSum());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedSDf07.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getType()).isEqualTo(expectedSDf07.getType());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf07.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getClientN()).isEqualTo(expectedSDf07.getClientN());
|
||||
Assertions.assertThat(actualObjectTag.getInn()).isEqualTo(expectedSDf07.getInn());
|
||||
Assertions.assertThat(actualObjectTag.getBic()).isEqualTo(expectedSDf07.getBic());
|
||||
Assertions.assertThat(actualObjectTag.getSpec()).isEqualTo(expectedSDf07.getSpec());
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf07.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedSDf07.getDoc_Num());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate().format(formatter)).isEqualTo(expectedSDf07.getDoc_Date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf07.getPay_val());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf51ToObjectTag() {
|
||||
SDf51 expectedSDf51 = new SDf51();
|
||||
expectedSDf51.setNumber("1234");
|
||||
expectedSDf51.setDatetime("1718785193000");
|
||||
|
||||
Imdg<SDf51> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf51, SDf51.class);
|
||||
imdg.insert(expectedSDf51);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF51);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF51ObjectTag actualObjectTag = (DF51ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF51");
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf51.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getUnixtime()).isEqualTo(Long.parseLong(expectedSDf51.getDatetime()));
|
||||
Assertions.assertThat(actualObjectTag.getDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf51.getDatetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf53ToObjectTag() {
|
||||
SDf53 expectedSDf53 = new SDf53();
|
||||
expectedSDf53.setAccount("test1");
|
||||
expectedSDf53.setAccName("test2");
|
||||
expectedSDf53.setDeal("test3");
|
||||
expectedSDf53.setDate("14.03.24");
|
||||
expectedSDf53.setStatus(1L);
|
||||
expectedSDf53.setAccType("test4");
|
||||
expectedSDf53.setResult("test5");
|
||||
|
||||
Imdg<SDf53> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
||||
imdg.insert(expectedSDf53);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF53);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF53ObjectTag actualObjectTag = (DF53ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF53");
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf53.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedSDf53.getAccName());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf53.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getDate().format(formatter)).isEqualTo(expectedSDf53.getDate());
|
||||
Assertions.assertThat(actualObjectTag.getStatus()).isEqualTo(expectedSDf53.getStatus());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedSDf53.getAccType());
|
||||
Assertions.assertThat(actualObjectTag.getResult()).isEqualTo(expectedSDf53.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf54ToObjectTag() {
|
||||
SDf54 expectedSDf54 = new SDf54();
|
||||
expectedSDf54.setSeg_type("test1");
|
||||
expectedSDf54.setDoc_type("test2");
|
||||
expectedSDf54.setDocnm_ref("test3");
|
||||
expectedSDf54.setDocnmprev("test4");
|
||||
expectedSDf54.setSbankcode("test5");
|
||||
expectedSDf54.setC_acc_deb("test6");
|
||||
expectedSDf54.setSbanknam1("test7");
|
||||
expectedSDf54.setRbankcode("test8");
|
||||
expectedSDf54.setC_acc_cred("test9");
|
||||
expectedSDf54.setRbanknam1("test10");
|
||||
expectedSDf54.setOp_type("test11");
|
||||
expectedSDf54.setOp_order("test12");
|
||||
expectedSDf54.setPay_date("14.03.24");
|
||||
expectedSDf54.setPay_val("test13");
|
||||
expectedSDf54.setSum_deb("test14");
|
||||
expectedSDf54.setSclientn1("test15");
|
||||
expectedSDf54.setInn_deb("test16");
|
||||
expectedSDf54.setKpp_deb("test17");
|
||||
expectedSDf54.setAcc_deb("test18");
|
||||
expectedSDf54.setRclientn1("test19");
|
||||
expectedSDf54.setInn_cred("test20");
|
||||
expectedSDf54.setKpp_cred("test21");
|
||||
expectedSDf54.setAcc_kr_1("test22");
|
||||
expectedSDf54.setSpecif_1("test23");
|
||||
expectedSDf54.setSend_type("test24");
|
||||
expectedSDf54.setDoc_result("test25");
|
||||
expectedSDf54.setDoc_Num("test26");
|
||||
expectedSDf54.setDoc_Date("14.03.24");
|
||||
expectedSDf54.setValue_date("14.03.24");
|
||||
expectedSDf54.setSwift_ben("test27");
|
||||
expectedSDf54.setSwift_int("test28");
|
||||
|
||||
Imdg<SDf54> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf54, SDf54.class);
|
||||
imdg.insert(expectedSDf54);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF54);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF54ObjectTag actualObjectTag = (DF54ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF54");
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedSDf54.getSeg_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedSDf54.getDoc_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedSDf54.getDocnm_ref());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedSDf54.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getSbankcode()).isEqualTo(expectedSDf54.getSbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedSDf54.getC_acc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedSDf54.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getRbankcode()).isEqualTo(expectedSDf54.getRbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedSDf54.getC_acc_cred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedSDf54.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getOpType()).isEqualTo(expectedSDf54.getOp_type());
|
||||
Assertions.assertThat(actualObjectTag.getOpOrder()).isEqualTo(expectedSDf54.getOp_order());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate().format(formatter)).isEqualTo(expectedSDf54.getPay_date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf54.getPay_val());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedSDf54.getSum_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSclientn1()).isEqualTo(expectedSDf54.getSclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnDeb()).isEqualTo(expectedSDf54.getInn_deb());
|
||||
Assertions.assertThat(actualObjectTag.getKppDeb()).isEqualTo(expectedSDf54.getKpp_deb());
|
||||
Assertions.assertThat(actualObjectTag.getAccDeb()).isEqualTo(expectedSDf54.getAcc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getRclientn1()).isEqualTo(expectedSDf54.getRclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnCred()).isEqualTo(expectedSDf54.getInn_cred());
|
||||
Assertions.assertThat(actualObjectTag.getKppCred()).isEqualTo(expectedSDf54.getKpp_cred());
|
||||
Assertions.assertThat(actualObjectTag.getAccKr1()).isEqualTo(expectedSDf54.getAcc_kr_1());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedSDf54.getSpecif_1());
|
||||
Assertions.assertThat(actualObjectTag.getSendType()).isEqualTo(expectedSDf54.getSend_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocResult()).isEqualTo(expectedSDf54.getDoc_result());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedSDf54.getDoc_Num());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate().format(formatter)).isEqualTo(expectedSDf54.getDoc_Date());
|
||||
Assertions.assertThat(actualObjectTag.getValueDate().format(formatter)).isEqualTo(expectedSDf54.getValue_date());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftBen()).isEqualTo(expectedSDf54.getSwift_ben());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftInt()).isEqualTo(expectedSDf54.getSwift_int());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf56ToObjectTag() {
|
||||
SDf56 expectedSDf56 = new SDf56();
|
||||
expectedSDf56.setNumber("test1");
|
||||
expectedSDf56.setStart_datetime("1718785193000");
|
||||
expectedSDf56.setEnd_datetime("1718875193000");
|
||||
expectedSDf56.setAccount("test4");
|
||||
expectedSDf56.setDeal("test5");
|
||||
|
||||
Imdg<SDf56> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf56, SDf56.class);
|
||||
imdg.insert(expectedSDf56);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF56);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF56ObjectTag actualObjectTag = (DF56ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF56");
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf56.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getStartUnixtime()).isEqualTo(Long.valueOf(expectedSDf56.getStart_datetime()));
|
||||
Assertions.assertThat(actualObjectTag.getEndUnixtime()).isEqualTo(Long.valueOf(expectedSDf56.getEnd_datetime()));
|
||||
Assertions.assertThat(actualObjectTag.getStartDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf56.getStart_datetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
Assertions.assertThat(actualObjectTag.getEndDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf56.getEnd_datetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf56.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf56.getDeal());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,433 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.XMLExporterConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.ParentDocTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
WriteXMLFile.class,
|
||||
ExportXMLServiceSettings.class,
|
||||
XMLExporterConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
class WriteXMLFileTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private WriteXMLFile writeXMLFile;
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
try {
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf02ToXMLFile() {
|
||||
DF02ObjectTag expectedObjectTag = new DF02ObjectTag();
|
||||
expectedObjectTag.setCurrCode("test1");
|
||||
expectedObjectTag.setAccount("test2");
|
||||
expectedObjectTag.setRemainder("test3");
|
||||
expectedObjectTag.setDeal("test4");
|
||||
expectedObjectTag.setAccCode("test5");
|
||||
expectedObjectTag.setDat(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setMarket("test6");
|
||||
expectedObjectTag.setAccName("test7");
|
||||
expectedObjectTag.setAccType("test8");
|
||||
expectedObjectTag.setSumengage("test9");
|
||||
expectedObjectTag.setSumunblock("test10");
|
||||
expectedObjectTag.setFileType("test11");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF02");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF02);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-02_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf03ToXMLFile() {
|
||||
DF03ObjectTag expectedObjectTag = new DF03ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setcAccCred("test7");
|
||||
expectedObjectTag.setRbanknam1("test8");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test9");
|
||||
expectedObjectTag.setSumDeb("test10");
|
||||
expectedObjectTag.setSpecif1("test11");
|
||||
expectedObjectTag.setImpResult("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF03");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF03);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-03_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf05ToXMLFile() {
|
||||
DF05ObjectTag expectedObjectTag = new DF05ObjectTag();
|
||||
expectedObjectTag.setTp(BigDecimal.TEN);
|
||||
expectedObjectTag.setDt(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setTm(LocalTime.parse("09:22:12"));
|
||||
expectedObjectTag.setPr("test2");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF05");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF05);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-05_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf07ToXMLFile() {
|
||||
DF07ObjectTag expectedObjectTag = new DF07ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedObjectTag.setMarket("test3");
|
||||
expectedObjectTag.setType("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setClientN("test6");
|
||||
expectedObjectTag.setInn("test7");
|
||||
expectedObjectTag.setBic("test8");
|
||||
expectedObjectTag.setSpec("test9");
|
||||
expectedObjectTag.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedObjectTag.setDocNum("test11");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF07");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF07);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-07_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf51ToXMLFile() {
|
||||
DF51ObjectTag expectedObjectTag = new DF51ObjectTag();
|
||||
expectedObjectTag.setNumber("1234");
|
||||
expectedObjectTag.setDatetime(LocalDateTime.parse("2024-03-14T09:03:11"));
|
||||
expectedObjectTag.setUnixtime(expectedObjectTag.getDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF51");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF51);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-51_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf53ToXMLFile() {
|
||||
DF53ObjectTag expectedObjectTag = new DF53ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setAccName("test2");
|
||||
expectedObjectTag.setDeal("test3");
|
||||
expectedObjectTag.setDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setStatus(1L);
|
||||
expectedObjectTag.setAccType("test4");
|
||||
expectedObjectTag.setResult("test5");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF53");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF53);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-53_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf54ToXMLFile() {
|
||||
DF54ObjectTag expectedObjectTag = new DF54ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setSbankcode("test5");
|
||||
expectedObjectTag.setcAccDeb("test6");
|
||||
expectedObjectTag.setSbanknam1("test7");
|
||||
expectedObjectTag.setRbankcode("test8");
|
||||
expectedObjectTag.setcAccCred("test9");
|
||||
expectedObjectTag.setRbanknam1("test10");
|
||||
expectedObjectTag.setOpType("test11");
|
||||
expectedObjectTag.setOpOrder("test12");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test13");
|
||||
expectedObjectTag.setSumDeb("test14");
|
||||
expectedObjectTag.setSclientn1("test15");
|
||||
expectedObjectTag.setInnDeb("test16");
|
||||
expectedObjectTag.setKppDeb("test17");
|
||||
expectedObjectTag.setAccDeb("test18");
|
||||
expectedObjectTag.setRclientn1("test19");
|
||||
expectedObjectTag.setInnCred("test20");
|
||||
expectedObjectTag.setKppCred("test21");
|
||||
expectedObjectTag.setAccKr1("test22");
|
||||
expectedObjectTag.setSpecif1("test23");
|
||||
expectedObjectTag.setSendType("test24");
|
||||
expectedObjectTag.setDocResult("test25");
|
||||
expectedObjectTag.setDocNum("test26");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setValueDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setSwiftBen("test27");
|
||||
expectedObjectTag.setSwiftInt("test28");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF54");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF54);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-54_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf56ToXMLFile() {
|
||||
DF56ObjectTag expectedObjectTag = new DF56ObjectTag();
|
||||
expectedObjectTag.setNumber("test1");
|
||||
expectedObjectTag.setStartDatetime(LocalDateTime.parse("2024-03-14T09:03:11"));
|
||||
expectedObjectTag.setEndDatetime(LocalDateTime.parse("2024-04-15T11:03:11"));
|
||||
expectedObjectTag.setAccount("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setStartUnixtime(expectedObjectTag.getStartDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
expectedObjectTag.setEndUnixtime(expectedObjectTag.getEndDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF56");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF56);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-56_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
spring.main.web-application-type=none
|
||||
|
||||
export-xml-service.hazelcast.cluster-members=127.0.0.1:5701
|
||||
export-xml-service.hazelcast.login=dev
|
||||
export-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
export-xml-service.common.encoding=cp866
|
||||
export-xml-service.common.threads-count=10
|
||||
|
||||
export-xml-service.store.local-temp-dir=D:\\docs and T3\\clearing\\xml\\
|
||||
# код валюты должен быть в верхнем регистре, например для рублей - "RUB" (*.RUB=export/rub/).RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.EUR=export/eur/
|
||||
export-xml-service.store.user:tester
|
||||
export-xml-service.store.password=password
|
||||
export-xml-service.store.server-ip=localhost
|
||||
export-xml-service.store.server-port=2222
|
||||
|
||||
export-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-consumer.group-id=dev-group-balance-service
|
||||
export-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
export-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
export-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
export-xml-service.kafka-consumer.linger-ms=1
|
||||
export-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
|
||||
export-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-producer.acks=all
|
||||
export-xml-service.kafka-producer.retries=0
|
||||
export-xml-service.kafka-producer.batch-size=16384
|
||||
export-xml-service.kafka-producer.linger-ms=1
|
||||
export-xml-service.kafka-producer.buffer-memory=33554432
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF02" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT CURR_CODE="test1" ACCOUNT="test2" REMAINDER="test3" DEAL="test4" ACC_CODE="test5" DAT="2024-03-14" MARKET="test6" ACC_NAME="test7" ACC_TYPE="test8" SUMENGAGE="test9" SUMUNBLOK="test10" FILE_TYPE="test11"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF03" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT SEG_TYPE="test1" DOC_TYPE="test2" DOCNM_REF="test3" DOCNMPREV="test4" C_ACC_DEB="test5" SBANKNAM="test6" C_ACC_CRED="test7" RBANKNAM="test8" PAY_DATE="2024-03-14" PAY_VAL="test9" SUM_DEB="test10" SPECIF_1="test11" IMP_RESULT="test12"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF05" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT TP="10" DT="2024-03-14" TM="09:22:12" PR="test2"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF07" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" SUM="10" MARKET="test3" TYPE="test4" DEAL="test5" CLIENTN="test6" INN="test7" BIC="test8" SPEC="test9" NUMBER="2" DOC_NUM="test11" DOC_DATE="2024-03-14" PAY_VAL="test12"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF51" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT NUMBER="1234" UNIXTIME="1710396191" DATETIME="2024-03-14T09:03:11"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF53" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" ACC_NAME="test2" DEAL="test3" DATE="2024-03-14" STATUS="1" ACC_TYPE="test4" RESULT="test5"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF54" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT SEG_TYPE="test1" DOC_TYPE="test2" DOCNM_REF="test3" DOCNMPREV="test4" SBANKCODE="test5" C_ACC_DEB="test6" SBANKNAM="test7" RBANKCODE="test8" C_ACC_CRED="test9" RBANKNAM="test10" OP_TYPE="test11" OP_ORDER="test12" PAY_DATE="2024-03-14" PAY_VAL="test13" SUM_DEB="test14" SCLIENTN="test15" INN_DEB="test16" KPP_DEB="test17" ACC_DEB="test18" RCLIENTN="test19" INN_CRED="test20" KPP_CRED="test21" ACC_KR_1="test22" SPECIF_1="test23" SEND_TYPE="test24" DOC_RESULT="test25" DOC_NUM="test26" DOC_DATE="2024-03-15" VALUE_DATE="2024-03-16" SWIFT_BEN="test27" SWIFT_INT="test28"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF56" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT NUMBER="test1" SUNIXTIME="1710396191" SDATETIME="2024-03-14T09:03:11" EUNIXTIME="1713168191" EDATETIME="2024-04-15T11:03:11" ACCOUNT="test4" DEAL="test5"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
2
clearing-parent/xml-importer/.gitignore
vendored
Normal file
2
clearing-parent/xml-importer/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
log/
|
||||
124
clearing-parent/xml-importer/.idea/uiDesigner.xml
generated
Normal file
124
clearing-parent/xml-importer/.idea/uiDesigner.xml
generated
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
156
clearing-parent/xml-importer/pom.xml
Normal file
156
clearing-parent/xml-importer/pom.xml
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xml-importer</artifactId>
|
||||
<name>xml-importer</name>
|
||||
<description>XML loader for XML files</description>
|
||||
<version>SPCEX-3.11.0.0</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.11.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-sftp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JDBC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XML files -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api-hazelcast-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-enum</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- special logging -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>7.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.xml.importer;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
@SpringBootApplication
|
||||
public class XMLImporterApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(XMLImporterApplication.class);
|
||||
builder.run(args);
|
||||
} catch (Exception e) {
|
||||
LoggerFactory.getLogger(XMLImporterApplication.class).error("XML-Loader start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Configuration
|
||||
public class ImporterImdgConfig {
|
||||
private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) {
|
||||
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
|
||||
if (maxPoolSz > 2) {
|
||||
pool.setKeepAliveSeconds(60);
|
||||
pool.setAllowCoreThreadTimeOut(true);
|
||||
}
|
||||
pool.setCorePoolSize(maxPoolSz);
|
||||
pool.setWaitForTasksToCompleteOnShutdown(waitForCompletion);
|
||||
return pool;
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorHazelcastClientInitializer")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorIdGeneratorAwaiter")
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public ImdgProvider imdgProvider(
|
||||
@Qualifier("taskExecutorHazelcastClientInitializer") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
ImportXMLServiceSettings settings
|
||||
) {
|
||||
return new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
taskExecutorIdGeneratorAwaiter,
|
||||
settings.getHazelcast());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Configuration
|
||||
public class KafkaConfig {
|
||||
@Bean
|
||||
public ProducerFactory<String, Object> pf(ImportXMLServiceSettings settings) {
|
||||
KafkaProducerSettings kafkaSettings = settings.getKafkaProducer();
|
||||
return KafkaProducerFactory.producerFactory(kafkaSettings);
|
||||
}
|
||||
|
||||
@Bean("kafkaTemplate")
|
||||
public KafkaTemplate<String, Object> kafkaTemplate(ProducerFactory<String, Object> pf) {
|
||||
return new KafkaTemplate<>(pf);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public Supplier<KafkaSender> kafkaSender(KafkaTemplate<String, Object> kafkaTemplate,
|
||||
ImdgProvider imdgProvider) {
|
||||
ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator();
|
||||
return () -> KafkaSender
|
||||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Bean
|
||||
public Consumer<String, Object> createConsumer(ImportXMLServiceSettings settings) {
|
||||
return KafkaConsumerFactory.consumer(settings.getKafkaConsumer());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import static org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Command.MGET;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway;
|
||||
import org.springframework.integration.file.remote.session.CachingSessionFactory;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
|
||||
import org.springframework.integration.sftp.gateway.SftpOutboundGateway;
|
||||
import org.springframework.integration.sftp.session.DefaultSftpSessionFactory;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
|
||||
@Profile("!test")
|
||||
@Configuration
|
||||
public class SFTPConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Bean
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ImportXMLServiceSettings settings) {
|
||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||
factory.setHost(settings.getStore().getSftpIn().getServerIp());
|
||||
factory.setPort(settings.getStore().getSftpIn().getServerPort());
|
||||
factory.setUser(settings.getStore().getSftpIn().getUser());
|
||||
factory.setPassword(settings.getStore().getSftpIn().getPassword());
|
||||
factory.setAllowUnknownKeys(true);
|
||||
return new CachingSessionFactory<>(factory);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/53655208/profile-doesnt-work-with-messaging-gateway
|
||||
@Bean("xmlGateway")
|
||||
public AnnotationGatewayProxyFactoryBean xmlGateway() {
|
||||
return new AnnotationGatewayProxyFactoryBean(XmlGateway.class);
|
||||
}
|
||||
|
||||
public interface XmlGateway {
|
||||
@Gateway(requestChannel = "listSftpChannel")
|
||||
List<File> listFiles(String dir);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel listSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory, ImportXMLServiceSettings settings) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handlerList(sessionFactory, settings));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "listSftpChannel")
|
||||
public MessageHandler handlerList(SessionFactory<ChannelSftp.LsEntry> sessionFactory, ImportXMLServiceSettings settings) {
|
||||
SftpOutboundGateway sftpOutboundGateway = new SftpOutboundGateway(sessionFactory, MGET.getCommand(), null);
|
||||
sftpOutboundGateway.setLocalDirectory(new File(settings.getStore().getSrcDir()));
|
||||
sftpOutboundGateway.setAutoCreateLocalDirectory(true);
|
||||
sftpOutboundGateway.setOption(AbstractRemoteFileOutboundGateway.Option.DELETE);
|
||||
return sftpOutboundGateway;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
@Profile("test")
|
||||
@Configuration
|
||||
public class SFTPMockConfig {
|
||||
@Bean("xmlGateway")
|
||||
public SFTPConfig.XmlGateway xmlGateway(){
|
||||
return new XGateway();
|
||||
}
|
||||
|
||||
public static class XGateway implements SFTPConfig.XmlGateway{
|
||||
|
||||
@Override
|
||||
public List<File> listFiles(String dir) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
import com.ctc.wstx.stax.WstxOutputFactory;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf04;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf06;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf55;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf57;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class XMLImporterConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ImportXMLServiceSettings settings;
|
||||
private final ApplicationContext context;
|
||||
private final ImdgProvider hazelcastService;
|
||||
|
||||
public XMLImporterConfig(ImportXMLServiceSettings settings,
|
||||
ApplicationContext context,
|
||||
ImdgProvider hazelcastService) {
|
||||
this.settings = settings;
|
||||
this.context = context;
|
||||
this.hazelcastService = hazelcastService;
|
||||
}
|
||||
|
||||
@Bean("executor")
|
||||
public ThreadPoolTaskExecutor executor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
|
||||
executor.setMaxPoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setCorePoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setThreadNamePrefix("xml-importer-thread-");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(300);
|
||||
executor.initialize();
|
||||
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("mapOfTable")
|
||||
public Map<ETable, ImdgHazelcast<? extends SpcexObjectBase>> getMapOfTables() {
|
||||
Map<ETable, ImdgHazelcast<? extends SpcexObjectBase>> map = new HashMap<>();
|
||||
map.put(ETable.DF_01, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf01, SDf01.class));
|
||||
map.put(ETable.DF_04, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf04, SDf04.class));
|
||||
map.put(ETable.DF_06, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf06, SDf06.class));
|
||||
map.put(ETable.DF_52, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf52, SDf52.class));
|
||||
map.put(ETable.DF_55, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf55, SDf55.class));
|
||||
map.put(ETable.DF_57, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf57, SDf57.class));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Bean("xmlMapper")
|
||||
public XmlMapper xmlMapper() {
|
||||
XMLInputFactory inputFactory = new WstxInputFactory();
|
||||
XMLOutputFactory outputFactory = new WstxOutputFactory();
|
||||
|
||||
XmlFactory xmlFactory = XmlFactory.builder()
|
||||
.xmlInputFactory(inputFactory)
|
||||
.xmlOutputFactory(outputFactory)
|
||||
.build();
|
||||
|
||||
XmlMapper xmlMapper = new XmlMapper(xmlFactory);
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
return xmlMapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
public class Common {
|
||||
private String encodingSource;
|
||||
private int insertBatchSize;
|
||||
private int threadsCount;
|
||||
|
||||
public String getEncodingSource() {
|
||||
return encodingSource;
|
||||
}
|
||||
|
||||
public void setEncodingSource(String encodingSource) {
|
||||
this.encodingSource = encodingSource;
|
||||
}
|
||||
|
||||
public int getInsertBatchSize() {
|
||||
return insertBatchSize;
|
||||
}
|
||||
|
||||
public void setInsertBatchSize(int insertBatchSize) {
|
||||
this.insertBatchSize = insertBatchSize;
|
||||
}
|
||||
|
||||
public int getThreadsCount() {
|
||||
return threadsCount;
|
||||
}
|
||||
|
||||
public void setThreadsCount(int threadsCount) {
|
||||
this.threadsCount = threadsCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
public class Cron {
|
||||
private String checkSrcDirCron;
|
||||
|
||||
public String getCheckSrcDirCron() {
|
||||
return checkSrcDirCron;
|
||||
}
|
||||
|
||||
public void setCheckSrcDirCron(String checkSrcDirCron) {
|
||||
this.checkSrcDirCron = checkSrcDirCron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaConsumerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
|
||||
@Component
|
||||
@PropertySource("file:${spring.config.location}/application.properties")
|
||||
@ConfigurationProperties("import-xml-service")
|
||||
public class ImportXMLServiceSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
private Common common;
|
||||
private Store store;
|
||||
private Cron cron;
|
||||
|
||||
public HazelcastClientParams getHazelcast() {
|
||||
return hazelcast;
|
||||
}
|
||||
|
||||
public void setHazelcast(HazelcastClientParams hazelcast) {
|
||||
this.hazelcast = hazelcast;
|
||||
}
|
||||
|
||||
public KafkaProducerSettings getKafkaProducer() {
|
||||
return kafkaProducer;
|
||||
}
|
||||
|
||||
public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
}
|
||||
|
||||
public KafkaConsumerSettings getKafkaConsumer() {
|
||||
return kafkaConsumer;
|
||||
}
|
||||
|
||||
public void setKafkaConsumer(KafkaConsumerSettings kafkaConsumer) {
|
||||
this.kafkaConsumer = kafkaConsumer;
|
||||
}
|
||||
|
||||
public Common getCommon() {
|
||||
return common;
|
||||
}
|
||||
|
||||
public void setCommon(Common common) {
|
||||
this.common = common;
|
||||
}
|
||||
|
||||
public Store getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Store store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public Cron getCron() {
|
||||
return cron;
|
||||
}
|
||||
|
||||
public void setCron(Cron cron) {
|
||||
this.cron = cron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
import ru.spcex.platform.utils.config.SftpInboundFolderSetting;
|
||||
|
||||
public class Store {
|
||||
private String srcDir;
|
||||
private String outDir;
|
||||
private String outDirError;
|
||||
private boolean deleteSrcFiles = true;
|
||||
//sftp settings
|
||||
private SftpInboundFolderSetting sftpIn;
|
||||
public String getSrcDir() {
|
||||
return srcDir;
|
||||
}
|
||||
|
||||
public void setSrcDir(String srcDir) {
|
||||
this.srcDir = srcDir;
|
||||
}
|
||||
|
||||
public String getOutDir() {
|
||||
return outDir;
|
||||
}
|
||||
|
||||
public void setOutDir(String outDir) {
|
||||
this.outDir = outDir;
|
||||
}
|
||||
|
||||
public boolean isDeleteSrcFiles() {
|
||||
return deleteSrcFiles;
|
||||
}
|
||||
|
||||
public void setDeleteSrcFiles(boolean deleteSrcFiles) {
|
||||
this.deleteSrcFiles = deleteSrcFiles;
|
||||
}
|
||||
|
||||
public String getOutDirError() {
|
||||
return outDirError;
|
||||
}
|
||||
|
||||
public void setOutDirError(String outDirError) {
|
||||
this.outDirError = outDirError;
|
||||
}
|
||||
|
||||
public SftpInboundFolderSetting getSftpIn() {
|
||||
return sftpIn;
|
||||
}
|
||||
|
||||
public void setSftpIn(SftpInboundFolderSetting sftpIn) {
|
||||
this.sftpIn = sftpIn;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ru.spcex.clearing.xml.importer.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.spcex.clearing.xml.importer.services.XMLImporterService;
|
||||
|
||||
@RestController("/")
|
||||
public class ImporterController implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XMLImporterService importerService;
|
||||
|
||||
public ImporterController(@Qualifier("xmlImporterService") XMLImporterService importerService) {
|
||||
this.importerService = importerService;
|
||||
}
|
||||
|
||||
@GetMapping(path = "/xml-import", produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
public String checkFolder() {
|
||||
log.info("Call check method for importer controller");
|
||||
importerService.run();
|
||||
return "xml import completed, see log";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
log.info("controller started");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package ru.spcex.clearing.xml.importer.exceptions;
|
||||
|
||||
public class ConfigException extends RuntimeException {
|
||||
public ConfigException(String msg) { super(msg); }
|
||||
public ConfigException(String msg, Throwable cause) { super(msg, cause); }
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
|
||||
public class ResultContainer {
|
||||
private UUID uuid;
|
||||
private ETable xmlTable;
|
||||
private File xmlFile;
|
||||
private StageResult lastStageStatus;
|
||||
private DocumentTag documentTag;
|
||||
|
||||
public ResultContainer(ETable xmlTable, File xmlFile) {
|
||||
this.xmlTable = xmlTable;
|
||||
this.xmlFile = xmlFile;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public ETable getXmlTable() {
|
||||
return xmlTable;
|
||||
}
|
||||
|
||||
public void setXmlTable(ETable xmlTable) {
|
||||
this.xmlTable = xmlTable;
|
||||
}
|
||||
|
||||
public File getXmlFile() {
|
||||
return xmlFile;
|
||||
}
|
||||
|
||||
public void setXmlFile(File xmlFile) {
|
||||
this.xmlFile = xmlFile;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public StageResult getLastStageStatus() {
|
||||
return lastStageStatus;
|
||||
}
|
||||
|
||||
public void setLastStageStatus(StageResult lastStageRes) {
|
||||
this.lastStageStatus = lastStageRes;
|
||||
}
|
||||
|
||||
public DocumentTag getDocumentTag() {
|
||||
return documentTag;
|
||||
}
|
||||
|
||||
public void setDocumentTag(DocumentTag documentTag) {
|
||||
this.documentTag = documentTag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.enums;
|
||||
|
||||
public enum ETable {
|
||||
DF_01("DF-01"),
|
||||
DF_04("DF-04"),
|
||||
DF_06("DF-06"),
|
||||
DF_52("DF-52"),
|
||||
DF_55("DF-55"),
|
||||
DF_57("DF-57");
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ETable(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public static ETable getTableForFilename(String filename) {
|
||||
for (ETable table : ETable.values()) {
|
||||
if (table.fileForThisTable(filename)) return table;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ETable tableForName(String name) {
|
||||
for (ETable table : values()) {
|
||||
if (name.equalsIgnoreCase(table.name()))
|
||||
return table;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean fileForThisTable(String filename) {
|
||||
return filename != null && filename.startsWith(prefix);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.enums;
|
||||
|
||||
public enum StageResult {
|
||||
OK,
|
||||
ERROR,
|
||||
COMPLETE
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@JacksonXmlRootElement(localName = "DOCUMENT")
|
||||
public class DocumentTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEID")
|
||||
private String messageId;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETYPE")
|
||||
private String messageType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGENAME")
|
||||
private String messageName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEDATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate messageDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETIME")
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
private LocalTime messageTime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SENDER")
|
||||
private String sender;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RECEIVER")
|
||||
private String receiver;
|
||||
|
||||
@JacksonXmlProperty(localName = "PARENTDOC")
|
||||
private ParentDocTag parentDoc;
|
||||
|
||||
@JacksonXmlElementWrapper(localName = "OBJECTS")
|
||||
@JacksonXmlProperty(localName = "OBJECT")
|
||||
private List<ObjectTag<? extends SpcexObjectBase>> objects;
|
||||
|
||||
public DocumentTag() {
|
||||
}
|
||||
|
||||
public String getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(String messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public String getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public String getMessageName() {
|
||||
return messageName;
|
||||
}
|
||||
|
||||
public void setMessageName(String messageName) {
|
||||
this.messageName = messageName;
|
||||
}
|
||||
|
||||
public LocalDate getMessageDate() {
|
||||
return messageDate;
|
||||
}
|
||||
|
||||
public void setMessageDate(LocalDate messageDate) {
|
||||
this.messageDate = messageDate;
|
||||
}
|
||||
|
||||
public LocalTime getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(LocalTime messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getReceiver() {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
public ParentDocTag getParentDoc() {
|
||||
return parentDoc;
|
||||
}
|
||||
|
||||
public void setParentDoc(ParentDocTag parentDoc) {
|
||||
this.parentDoc = parentDoc;
|
||||
}
|
||||
|
||||
public List<ObjectTag<? extends SpcexObjectBase>> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void setObjects(List<ObjectTag<? extends SpcexObjectBase>> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DocumentTag that = (DocumentTag) o;
|
||||
return Objects.equals(messageId, that.messageId) && Objects.equals(messageType, that.messageType) && Objects.equals(messageName, that.messageName) && Objects.equals(messageDate, that.messageDate) && Objects.equals(messageTime, that.messageTime) && Objects.equals(sender, that.sender) && Objects.equals(receiver, that.receiver) && Objects.equals(parentDoc, that.parentDoc) && Objects.equals(objects, that.objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(messageId, messageType, messageName, messageDate, messageTime, sender, receiver, parentDoc, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocumentTag{" +
|
||||
"messageId='" + messageId + '\'' +
|
||||
", messageType='" + messageType + '\'' +
|
||||
", messageName='" + messageName + '\'' +
|
||||
", messageDate='" + messageDate + '\'' +
|
||||
", messageTime='" + messageTime + '\'' +
|
||||
", sender='" + sender + '\'' +
|
||||
", receiver='" + receiver + '\'' +
|
||||
", parentDoc=" + parentDoc +
|
||||
", objects=" + objects +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ParentDocTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PARENTID")
|
||||
private String parentId;
|
||||
|
||||
public ParentDocTag() {
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ParentDocTag that = (ParentDocTag) o;
|
||||
return Objects.equals(parentId, that.parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParentDocTag{" +
|
||||
"parentId='" + parentId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF01ObjectTag extends ObjectTag<SDf01> {
|
||||
private static final ETable PREFIX = ETable.DF_01;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CURR_CODE")
|
||||
private String currCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "REMAINDER")
|
||||
private String remainder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_CODE")
|
||||
private String accCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DAT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dat;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMENGAGE")
|
||||
private String sumengage;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMUNBLOK")
|
||||
private String sumunblock;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "FILE_TYPE")
|
||||
private String fileType;
|
||||
|
||||
public DF01ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf01 getSDfEntity() {
|
||||
SDf01 result = new SDf01();
|
||||
|
||||
result.setCurr_code(this.getCurrCode());
|
||||
result.setAccount(this.getAccount());
|
||||
result.setRemainder(this.getRemainder());
|
||||
result.setDeal(this.getDeal());
|
||||
result.setAcc_code(this.getAccCode());
|
||||
result.setDat(this.getDat() == null ? null : this.getDat().format(formatter));
|
||||
result.setMarket(this.getMarket());
|
||||
result.setAcc_name(this.getAccName());
|
||||
result.setAcc_type(this.getAccType());
|
||||
result.setSumengage(this.getSumengage());
|
||||
result.setSumunblock(this.getSumunblock());
|
||||
result.setFile_type(this.getFileType());
|
||||
result.setFileName(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getCurrCode() {
|
||||
return currCode;
|
||||
}
|
||||
|
||||
public void setCurrCode(String currCode) {
|
||||
this.currCode = currCode;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getRemainder() {
|
||||
return remainder;
|
||||
}
|
||||
|
||||
public void setRemainder(String remainder) {
|
||||
this.remainder = remainder;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getAccCode() {
|
||||
return accCode;
|
||||
}
|
||||
|
||||
public void setAccCode(String accCode) {
|
||||
this.accCode = accCode;
|
||||
}
|
||||
|
||||
public LocalDate getDat() {
|
||||
return dat;
|
||||
}
|
||||
|
||||
public void setDat(LocalDate dat) {
|
||||
this.dat = dat;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
public String getSumengage() {
|
||||
return sumengage;
|
||||
}
|
||||
|
||||
public void setSumengage(String sumengage) {
|
||||
this.sumengage = sumengage;
|
||||
}
|
||||
|
||||
public String getSumunblock() {
|
||||
return sumunblock;
|
||||
}
|
||||
|
||||
public void setSumunblock(String sumunblock) {
|
||||
this.sumunblock = sumunblock;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF01ObjectTag that = (DF01ObjectTag) o;
|
||||
return Objects.equals(currCode, that.currCode) && Objects.equals(account, that.account) && Objects.equals(remainder, that.remainder) && Objects.equals(deal, that.deal) && Objects.equals(accCode, that.accCode) && Objects.equals(dat, that.dat) && Objects.equals(market, that.market) && Objects.equals(accName, that.accName) && Objects.equals(accType, that.accType) && Objects.equals(sumengage, that.sumengage) && Objects.equals(sumunblock, that.sumunblock) && Objects.equals(fileType, that.fileType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(currCode, account, remainder, deal, accCode, dat, market, accName, accType, sumengage, sumunblock, fileType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF01ObjectTag{" +
|
||||
"currCode='" + currCode + '\'' +
|
||||
", account='" + account + '\'' +
|
||||
", remainder='" + remainder + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", accCode='" + accCode + '\'' +
|
||||
", dat=" + dat +
|
||||
", market='" + market + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", accType='" + accType + '\'' +
|
||||
", sumengage='" + sumengage + '\'' +
|
||||
", sumunblock='" + sumunblock + '\'' +
|
||||
", fileType='" + fileType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf04;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF04ObjectTag extends ObjectTag<SDf04> {
|
||||
private static final ETable PREFIX = ETable.DF_04;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
private String sbanknam2;
|
||||
private String sbanknam3;
|
||||
private String sbanknam4;
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
private String rbanknam2;
|
||||
private String rbanknam3;
|
||||
private String rbanknam4;
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "IMP_RESULT")
|
||||
private String impResult;
|
||||
|
||||
public DF04ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf04 getSDfEntity() {
|
||||
SDf04 result = new SDf04();
|
||||
|
||||
result.setSeg_type(this.getSegType());
|
||||
result.setDoc_type(this.getDocType());
|
||||
result.setDocnm_ref(this.getDocnmRef());
|
||||
result.setDocnmprev(this.getDocnmprev());
|
||||
result.setC_acc_deb(this.getcAccDeb());
|
||||
result.setSbanknam1(this.getSbanknam1());
|
||||
result.setSbanknam2(this.getSbanknam1());
|
||||
result.setSbanknam3(this.getSbanknam1());
|
||||
result.setSbanknam4(this.getSbanknam1());
|
||||
result.setSbanknam5(this.getSbanknam1());
|
||||
result.setC_acc_cred(this.getcAccCred());
|
||||
result.setRbanknam1(this.getRbanknam1());
|
||||
result.setRbanknam2(this.getRbanknam1());
|
||||
result.setRbanknam3(this.getRbanknam1());
|
||||
result.setRbanknam4(this.getRbanknam1());
|
||||
result.setRbanknam5(this.getRbanknam1());
|
||||
result.setPay_date(this.getPayDate() == null ? null : this.getPayDate().format(formatter));
|
||||
result.setPay_val(this.getPayVal());
|
||||
result.setSum_deb(this.getSumDeb());
|
||||
result.setSpecif_1(this.getSpecif1());
|
||||
result.setImp_result(this.getImpResult());
|
||||
result.setFile_name(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getImpResult() {
|
||||
return impResult;
|
||||
}
|
||||
|
||||
public void setImpResult(String impResult) {
|
||||
this.impResult = impResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF04ObjectTag that = (DF04ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(specif1, that.specif1) && Objects.equals(impResult, that.impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, payDate, payVal, sumDeb, specif1, impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF04ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", impResult='" + impResult + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf06;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF06ObjectTag extends ObjectTag<SDf06> {
|
||||
private static final ETable PREFIX = ETable.DF_06;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM")
|
||||
private BigDecimal sum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TYPE")
|
||||
private String type;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CLIENTN")
|
||||
private String clientN;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN")
|
||||
private String inn;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "BIC")
|
||||
private String bic;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPEC")
|
||||
private String spec;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private BigDecimal number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
public DF06ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf06 getSDfEntity() {
|
||||
SDf06 result = new SDf06();
|
||||
|
||||
result.setAccount(this.getAccount());
|
||||
result.setSum(this.getSum());
|
||||
result.setMarket(this.getMarket());
|
||||
result.setType(this.getType());
|
||||
result.setDeal(this.getDeal());
|
||||
result.setClientN(this.getClientN());
|
||||
result.setInn(this.getInn());
|
||||
result.setBic(this.getBic());
|
||||
result.setSpec(this.getSpec());
|
||||
result.setNumber(this.getNumber());
|
||||
result.setDoc_Num(this.getDocNum());
|
||||
result.setDoc_Date(this.getDocDate() == null ? null : this.getDocDate().format(formatter));
|
||||
result.setPay_val(this.getPayVal());
|
||||
result.setFileName(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public BigDecimal getSum() {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public void setSum(BigDecimal sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getClientN() {
|
||||
return clientN;
|
||||
}
|
||||
|
||||
public void setClientN(String clientN) {
|
||||
this.clientN = clientN;
|
||||
}
|
||||
|
||||
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 getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setSpec(String spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(BigDecimal number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF06ObjectTag that = (DF06ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(sum, that.sum) && Objects.equals(market, that.market) && Objects.equals(type, that.type) && Objects.equals(deal, that.deal) && Objects.equals(clientN, that.clientN) && Objects.equals(inn, that.inn) && Objects.equals(bic, that.bic) && Objects.equals(spec, that.spec) && Objects.equals(number, that.number) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(payVal, that.payVal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, sum, market, type, deal, clientN, inn, bic, spec, number, docNum, docDate, payVal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF06ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", sum=" + sum +
|
||||
", market='" + market + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", clientN='" + clientN + '\'' +
|
||||
", inn='" + inn + '\'' +
|
||||
", bic='" + bic + '\'' +
|
||||
", spec='" + spec + '\'' +
|
||||
", number=" + number +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF52ObjectTag extends ObjectTag<SDf52> {
|
||||
private static final ETable PREFIX = ETable.DF_52;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate date;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "STATUS")
|
||||
private Long status;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
public DF52ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf52 getSDfEntity() {
|
||||
SDf52 result = new SDf52();
|
||||
|
||||
result.setAccount(this.getAccount());
|
||||
result.setAcc_name(this.getAccName());
|
||||
result.setDeal(this.getDeal());
|
||||
result.setDate(this.getDate() == null ? null : this.getDate().format(formatter));
|
||||
result.setAcc_type(this.getAccType());
|
||||
result.setStatus(this.getStatus());
|
||||
result.setFileName(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Long getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Long status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF52ObjectTag that = (DF52ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(accName, that.accName) && Objects.equals(deal, that.deal) && Objects.equals(date, that.date) && Objects.equals(status, that.status) && Objects.equals(accType, that.accType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, accName, deal, date, status, accType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF52ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", date=" + date +
|
||||
", status=" + status +
|
||||
", accType='" + accType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,609 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf55;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF55ObjectTag extends ObjectTag<SDf55> {
|
||||
private static final ETable PREFIX = ETable.DF_55;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKCODE")
|
||||
private String sbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
private String sbanknam2;
|
||||
private String sbanknam3;
|
||||
private String sbanknam4;
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKCODE")
|
||||
private String rbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
private String rbanknam2;
|
||||
private String rbanknam3;
|
||||
private String rbanknam4;
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_TYPE")
|
||||
private String opType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_ORDER")
|
||||
private String opOrder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SCLIENTN")
|
||||
private String sclientn1;
|
||||
private String sclientn2;
|
||||
private String sclientn3;
|
||||
private String sclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_DEB")
|
||||
private String innDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_DEB")
|
||||
private String kppDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_DEB")
|
||||
private String accDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RCLIENTN")
|
||||
private String rclientn1;
|
||||
private String rclientn2;
|
||||
private String rclientn3;
|
||||
private String rclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_CRED")
|
||||
private String innCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_CRED")
|
||||
private String kppCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_KR_1")
|
||||
private String accKr1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEND_TYPE")
|
||||
private String sendType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_RESULT")
|
||||
private String docResult;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "VALUE_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate valueDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_BEN")
|
||||
private String swiftBen;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_INT")
|
||||
private String swiftInt;
|
||||
|
||||
public DF55ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf55 getSDfEntity() {
|
||||
SDf55 result = new SDf55();
|
||||
|
||||
result.setSeg_type(this.getSegType());
|
||||
result.setDoc_type(this.getDocType());
|
||||
result.setDocnm_ref(this.getDocnmRef());
|
||||
result.setDocnmprev(this.getDocnmprev());
|
||||
result.setSbankcode(this.getSbankcode());
|
||||
result.setC_acc_deb(this.getcAccDeb());
|
||||
result.setSbanknam1(this.getSbanknam1());
|
||||
result.setSbanknam2(this.getSbanknam1());
|
||||
result.setSbanknam3(this.getSbanknam1());
|
||||
result.setSbanknam4(this.getSbanknam1());
|
||||
result.setSbanknam5(this.getSbanknam1());
|
||||
result.setRbankcode(this.getRbankcode());
|
||||
result.setC_acc_cred(this.getcAccCred());
|
||||
result.setRbanknam1(this.getRbanknam1());
|
||||
result.setRbanknam2(this.getRbanknam1());
|
||||
result.setRbanknam3(this.getRbanknam1());
|
||||
result.setRbanknam4(this.getRbanknam1());
|
||||
result.setRbanknam5(this.getRbanknam1());
|
||||
result.setOp_type(this.getOpType());
|
||||
result.setOp_order(this.getOpOrder());
|
||||
result.setPay_date(this.getPayDate() == null ? null : this.getPayDate().format(formatter));
|
||||
result.setPay_val(this.getPayVal());
|
||||
result.setSum_deb(this.getSumDeb());
|
||||
result.setSclientn1(this.getSclientn1());
|
||||
result.setSclientn2(this.getSclientn1());
|
||||
result.setSclientn3(this.getSclientn1());
|
||||
result.setSclientn4(this.getSclientn1());
|
||||
result.setInn_deb(this.getInnDeb());
|
||||
result.setKpp_deb(this.getKppDeb());
|
||||
result.setAcc_deb(this.getAccDeb());
|
||||
result.setRclientn1(this.getRclientn1());
|
||||
result.setRclientn2(this.getRclientn1());
|
||||
result.setRclientn3(this.getRclientn1());
|
||||
result.setRclientn4(this.getRclientn1());
|
||||
result.setInn_cred(this.getInnCred());
|
||||
result.setKpp_cred(this.getKppCred());
|
||||
result.setAcc_kr_1(this.getAccKr1());
|
||||
result.setSpecif_1(this.getSpecif1());
|
||||
result.setSend_type(this.getSendType());
|
||||
result.setDoc_result(this.getDocResult());
|
||||
result.setDoc_Num(this.getDocNum());
|
||||
result.setDoc_Date(this.getDocDate() == null ? null : this.getDocDate().format(formatter));
|
||||
result.setValue_date(this.getValueDate() == null ? null : this.getValueDate().format(formatter));
|
||||
result.setSwift_ben(this.getSwiftBen());
|
||||
result.setSwift_int(this.getSwiftInt());
|
||||
result.setFileName(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getSbankcode() {
|
||||
return sbankcode;
|
||||
}
|
||||
|
||||
public void setSbankcode(String sbankcode) {
|
||||
this.sbankcode = sbankcode;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getRbankcode() {
|
||||
return rbankcode;
|
||||
}
|
||||
|
||||
public void setRbankcode(String rbankcode) {
|
||||
this.rbankcode = rbankcode;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public String getOpType() {
|
||||
return opType;
|
||||
}
|
||||
|
||||
public void setOpType(String opType) {
|
||||
this.opType = opType;
|
||||
}
|
||||
|
||||
public String getOpOrder() {
|
||||
return opOrder;
|
||||
}
|
||||
|
||||
public void setOpOrder(String opOrder) {
|
||||
this.opOrder = opOrder;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSclientn1() {
|
||||
return sclientn1;
|
||||
}
|
||||
|
||||
public void setSclientn1(String sclientn1) {
|
||||
this.sclientn1 = sclientn1;
|
||||
}
|
||||
|
||||
public String getSclientn2() {
|
||||
return sclientn2;
|
||||
}
|
||||
|
||||
public void setSclientn2(String sclientn2) {
|
||||
this.sclientn2 = sclientn2;
|
||||
}
|
||||
|
||||
public String getSclientn3() {
|
||||
return sclientn3;
|
||||
}
|
||||
|
||||
public void setSclientn3(String sclientn3) {
|
||||
this.sclientn3 = sclientn3;
|
||||
}
|
||||
|
||||
public String getSclientn4() {
|
||||
return sclientn4;
|
||||
}
|
||||
|
||||
public void setSclientn4(String sclientn4) {
|
||||
this.sclientn4 = sclientn4;
|
||||
}
|
||||
|
||||
public String getInnDeb() {
|
||||
return innDeb;
|
||||
}
|
||||
|
||||
public void setInnDeb(String innDeb) {
|
||||
this.innDeb = innDeb;
|
||||
}
|
||||
|
||||
public String getKppDeb() {
|
||||
return kppDeb;
|
||||
}
|
||||
|
||||
public void setKppDeb(String kppDeb) {
|
||||
this.kppDeb = kppDeb;
|
||||
}
|
||||
|
||||
public String getAccDeb() {
|
||||
return accDeb;
|
||||
}
|
||||
|
||||
public void setAccDeb(String accDeb) {
|
||||
this.accDeb = accDeb;
|
||||
}
|
||||
|
||||
public String getRclientn1() {
|
||||
return rclientn1;
|
||||
}
|
||||
|
||||
public void setRclientn1(String rclientn1) {
|
||||
this.rclientn1 = rclientn1;
|
||||
}
|
||||
|
||||
public String getRclientn2() {
|
||||
return rclientn2;
|
||||
}
|
||||
|
||||
public void setRclientn2(String rclientn2) {
|
||||
this.rclientn2 = rclientn2;
|
||||
}
|
||||
|
||||
public String getRclientn3() {
|
||||
return rclientn3;
|
||||
}
|
||||
|
||||
public void setRclientn3(String rclientn3) {
|
||||
this.rclientn3 = rclientn3;
|
||||
}
|
||||
|
||||
public String getRclientn4() {
|
||||
return rclientn4;
|
||||
}
|
||||
|
||||
public void setRclientn4(String rclientn4) {
|
||||
this.rclientn4 = rclientn4;
|
||||
}
|
||||
|
||||
public String getInnCred() {
|
||||
return innCred;
|
||||
}
|
||||
|
||||
public void setInnCred(String innCred) {
|
||||
this.innCred = innCred;
|
||||
}
|
||||
|
||||
public String getKppCred() {
|
||||
return kppCred;
|
||||
}
|
||||
|
||||
public void setKppCred(String kppCred) {
|
||||
this.kppCred = kppCred;
|
||||
}
|
||||
|
||||
public String getAccKr1() {
|
||||
return accKr1;
|
||||
}
|
||||
|
||||
public void setAccKr1(String accKr1) {
|
||||
this.accKr1 = accKr1;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getSendType() {
|
||||
return sendType;
|
||||
}
|
||||
|
||||
public void setSendType(String sendType) {
|
||||
this.sendType = sendType;
|
||||
}
|
||||
|
||||
public String getDocResult() {
|
||||
return docResult;
|
||||
}
|
||||
|
||||
public void setDocResult(String docResult) {
|
||||
this.docResult = docResult;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public LocalDate getValueDate() {
|
||||
return valueDate;
|
||||
}
|
||||
|
||||
public void setValueDate(LocalDate valueDate) {
|
||||
this.valueDate = valueDate;
|
||||
}
|
||||
|
||||
public String getSwiftBen() {
|
||||
return swiftBen;
|
||||
}
|
||||
|
||||
public void setSwiftBen(String swiftBen) {
|
||||
this.swiftBen = swiftBen;
|
||||
}
|
||||
|
||||
public String getSwiftInt() {
|
||||
return swiftInt;
|
||||
}
|
||||
|
||||
public void setSwiftInt(String swiftInt) {
|
||||
this.swiftInt = swiftInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF55ObjectTag that = (DF55ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(sbankcode, that.sbankcode) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(rbankcode, that.rbankcode) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(opType, that.opType) && Objects.equals(opOrder, that.opOrder) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(sclientn1, that.sclientn1) && Objects.equals(sclientn2, that.sclientn2) && Objects.equals(sclientn3, that.sclientn3) && Objects.equals(sclientn4, that.sclientn4) && Objects.equals(innDeb, that.innDeb) && Objects.equals(kppDeb, that.kppDeb) && Objects.equals(accDeb, that.accDeb) && Objects.equals(rclientn1, that.rclientn1) && Objects.equals(rclientn2, that.rclientn2) && Objects.equals(rclientn3, that.rclientn3) && Objects.equals(rclientn4, that.rclientn4) && Objects.equals(innCred, that.innCred) && Objects.equals(kppCred, that.kppCred) && Objects.equals(accKr1, that.accKr1) && Objects.equals(specif1, that.specif1) && Objects.equals(sendType, that.sendType) && Objects.equals(docResult, that.docResult) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(valueDate, that.valueDate) && Objects.equals(swiftBen, that.swiftBen) && Objects.equals(swiftInt, that.swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, sbankcode, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, rbankcode, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, opType, opOrder, payDate, payVal, sumDeb, sclientn1, sclientn2, sclientn3, sclientn4, innDeb, kppDeb, accDeb, rclientn1, rclientn2, rclientn3, rclientn4, innCred, kppCred, accKr1, specif1, sendType, docResult, docNum, docDate, valueDate, swiftBen, swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF55ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", sbankcode='" + sbankcode + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", rbankcode='" + rbankcode + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", opType='" + opType + '\'' +
|
||||
", opOrder='" + opOrder + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", sclientn1='" + sclientn1 + '\'' +
|
||||
", sclientn2='" + sclientn2 + '\'' +
|
||||
", sclientn3='" + sclientn3 + '\'' +
|
||||
", sclientn4='" + sclientn4 + '\'' +
|
||||
", innDeb='" + innDeb + '\'' +
|
||||
", kppDeb='" + kppDeb + '\'' +
|
||||
", accDeb='" + accDeb + '\'' +
|
||||
", rclientn1='" + rclientn1 + '\'' +
|
||||
", rclientn2='" + rclientn2 + '\'' +
|
||||
", rclientn3='" + rclientn3 + '\'' +
|
||||
", rclientn4='" + rclientn4 + '\'' +
|
||||
", innCred='" + innCred + '\'' +
|
||||
", kppCred='" + kppCred + '\'' +
|
||||
", accKr1='" + accKr1 + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", sendType='" + sendType + '\'' +
|
||||
", docResult='" + docResult + '\'' +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", valueDate=" + valueDate +
|
||||
", swiftBen='" + swiftBen + '\'' +
|
||||
", swiftInt='" + swiftInt + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,582 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf57;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
|
||||
public class DF57ObjectTag extends ObjectTag<SDf57> {
|
||||
private static final ETable PREFIX = ETable.DF_57;
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ID")
|
||||
private Long id;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL_DEB")
|
||||
private String dealDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL_CRED")
|
||||
private String dealCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKCODE")
|
||||
private String sbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
private String sbanknam2;
|
||||
private String sbanknam3;
|
||||
private String sbanknam4;
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKCODE")
|
||||
private String rbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
private String rbanknam2;
|
||||
private String rbanknam3;
|
||||
private String rbanknam4;
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_TYPE")
|
||||
private String opType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "EXT_DATE")
|
||||
private Long extDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SCLIENTN")
|
||||
private String sclientn1;
|
||||
private String sclientn2;
|
||||
private String sclientn3;
|
||||
private String sclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_DEB")
|
||||
private String innDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_DEB")
|
||||
private String kppDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_DEB")
|
||||
private String accDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RCLIENTN")
|
||||
private String rclientn1;
|
||||
private String rclientn2;
|
||||
private String rclientn3;
|
||||
private String rclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_CRED")
|
||||
private String innCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_CRED")
|
||||
private String kppCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_KR")
|
||||
private String accKr;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF")
|
||||
private String specif;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DT_IN")
|
||||
private String dtIn;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KT_IN")
|
||||
private String ktIn;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DT_OUT")
|
||||
private String dtOut;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KT_OUT")
|
||||
private String ktOut;
|
||||
|
||||
public DF57ObjectTag() {
|
||||
super(PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDf57 getSDfEntity() {
|
||||
SDf57 result = new SDf57();
|
||||
|
||||
result.setDbfId(this.getId());
|
||||
result.setDeal_deb(this.getDealDeb());
|
||||
result.setDeal_cred(this.getDealCred());
|
||||
result.setSbankcode(this.getSbankcode());
|
||||
result.setC_acc_deb(this.getcAccDeb());
|
||||
result.setSbanknam1(this.getSbanknam1());
|
||||
result.setSbanknam2(this.getSbanknam1());
|
||||
result.setSbanknam3(this.getSbanknam1());
|
||||
result.setSbanknam4(this.getSbanknam1());
|
||||
result.setSbanknam5(this.getSbanknam1());
|
||||
result.setRbankcode(this.getRbankcode());
|
||||
result.setC_acc_cred(this.getcAccCred());
|
||||
result.setRbanknam1(this.getRbanknam1());
|
||||
result.setRbanknam2(this.getRbanknam1());
|
||||
result.setRbanknam3(this.getRbanknam1());
|
||||
result.setRbanknam4(this.getRbanknam1());
|
||||
result.setRbanknam5(this.getRbanknam1());
|
||||
result.setOp_type(this.getOpType());
|
||||
result.setPay_date(this.getPayDate() == null ? null : this.getPayDate().format(formatter));
|
||||
result.setExt_date(this.getExtDate() == null ? null : this.getExtDate().toString());
|
||||
result.setPay_val(this.getPayVal());
|
||||
result.setSum_deb(this.getSumDeb());
|
||||
result.setSclientn1(this.getSclientn1());
|
||||
result.setSclientn2(this.getSclientn1());
|
||||
result.setSclientn3(this.getSclientn1());
|
||||
result.setSclientn4(this.getSclientn1());
|
||||
result.setInn_deb(this.getInnDeb());
|
||||
result.setKpp_deb(this.getKppDeb());
|
||||
result.setAcc_deb(this.getAccDeb());
|
||||
result.setRclientn1(this.getRclientn1());
|
||||
result.setRclientn2(this.getRclientn1());
|
||||
result.setRclientn3(this.getRclientn1());
|
||||
result.setRclientn4(this.getRclientn1());
|
||||
result.setInn_cred(this.getInnCred());
|
||||
result.setKpp_cred(this.getKppCred());
|
||||
result.setAcc_kr(this.getAccKr());
|
||||
result.setSpecif(this.getSpecif());
|
||||
result.setDoc_Num(this.getDocNum());
|
||||
result.setDoc_Date(this.getDocDate() == null ? null : this.getDocDate().format(formatter));
|
||||
result.setDt_in(this.getDtIn());
|
||||
result.setKt_in(this.getKtIn());
|
||||
result.setDt_out(this.getDtOut());
|
||||
result.setKt_out(this.getKtOut());
|
||||
result.setFileName(this.getFileName());
|
||||
result.setGenerationTime(Instant.now());
|
||||
result.setGenerationId(this.getGenerationId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDealDeb() {
|
||||
return dealDeb;
|
||||
}
|
||||
|
||||
public void setDealDeb(String dealDeb) {
|
||||
this.dealDeb = dealDeb;
|
||||
}
|
||||
|
||||
public String getDealCred() {
|
||||
return dealCred;
|
||||
}
|
||||
|
||||
public void setDealCred(String dealCred) {
|
||||
this.dealCred = dealCred;
|
||||
}
|
||||
|
||||
public String getSbankcode() {
|
||||
return sbankcode;
|
||||
}
|
||||
|
||||
public void setSbankcode(String sbankcode) {
|
||||
this.sbankcode = sbankcode;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getRbankcode() {
|
||||
return rbankcode;
|
||||
}
|
||||
|
||||
public void setRbankcode(String rbankcode) {
|
||||
this.rbankcode = rbankcode;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public String getOpType() {
|
||||
return opType;
|
||||
}
|
||||
|
||||
public void setOpType(String opType) {
|
||||
this.opType = opType;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public Long getExtDate() {
|
||||
return extDate;
|
||||
}
|
||||
|
||||
public void setExtDate(Long extDate) {
|
||||
this.extDate = extDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSclientn1() {
|
||||
return sclientn1;
|
||||
}
|
||||
|
||||
public void setSclientn1(String sclientn1) {
|
||||
this.sclientn1 = sclientn1;
|
||||
}
|
||||
|
||||
public String getSclientn2() {
|
||||
return sclientn2;
|
||||
}
|
||||
|
||||
public void setSclientn2(String sclientn2) {
|
||||
this.sclientn2 = sclientn2;
|
||||
}
|
||||
|
||||
public String getSclientn3() {
|
||||
return sclientn3;
|
||||
}
|
||||
|
||||
public void setSclientn3(String sclientn3) {
|
||||
this.sclientn3 = sclientn3;
|
||||
}
|
||||
|
||||
public String getSclientn4() {
|
||||
return sclientn4;
|
||||
}
|
||||
|
||||
public void setSclientn4(String sclientn4) {
|
||||
this.sclientn4 = sclientn4;
|
||||
}
|
||||
|
||||
public String getInnDeb() {
|
||||
return innDeb;
|
||||
}
|
||||
|
||||
public void setInnDeb(String innDeb) {
|
||||
this.innDeb = innDeb;
|
||||
}
|
||||
|
||||
public String getKppDeb() {
|
||||
return kppDeb;
|
||||
}
|
||||
|
||||
public void setKppDeb(String kppDeb) {
|
||||
this.kppDeb = kppDeb;
|
||||
}
|
||||
|
||||
public String getAccDeb() {
|
||||
return accDeb;
|
||||
}
|
||||
|
||||
public void setAccDeb(String accDeb) {
|
||||
this.accDeb = accDeb;
|
||||
}
|
||||
|
||||
public String getRclientn1() {
|
||||
return rclientn1;
|
||||
}
|
||||
|
||||
public void setRclientn1(String rclientn1) {
|
||||
this.rclientn1 = rclientn1;
|
||||
}
|
||||
|
||||
public String getRclientn2() {
|
||||
return rclientn2;
|
||||
}
|
||||
|
||||
public void setRclientn2(String rclientn2) {
|
||||
this.rclientn2 = rclientn2;
|
||||
}
|
||||
|
||||
public String getRclientn3() {
|
||||
return rclientn3;
|
||||
}
|
||||
|
||||
public void setRclientn3(String rclientn3) {
|
||||
this.rclientn3 = rclientn3;
|
||||
}
|
||||
|
||||
public String getRclientn4() {
|
||||
return rclientn4;
|
||||
}
|
||||
|
||||
public void setRclientn4(String rclientn4) {
|
||||
this.rclientn4 = rclientn4;
|
||||
}
|
||||
|
||||
public String getInnCred() {
|
||||
return innCred;
|
||||
}
|
||||
|
||||
public void setInnCred(String innCred) {
|
||||
this.innCred = innCred;
|
||||
}
|
||||
|
||||
public String getKppCred() {
|
||||
return kppCred;
|
||||
}
|
||||
|
||||
public void setKppCred(String kppCred) {
|
||||
this.kppCred = kppCred;
|
||||
}
|
||||
|
||||
public String getAccKr() {
|
||||
return accKr;
|
||||
}
|
||||
|
||||
public void setAccKr(String accKr) {
|
||||
this.accKr = accKr;
|
||||
}
|
||||
|
||||
public String getSpecif() {
|
||||
return specif;
|
||||
}
|
||||
|
||||
public void setSpecif(String specif) {
|
||||
this.specif = specif;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public String getDtIn() {
|
||||
return dtIn;
|
||||
}
|
||||
|
||||
public void setDtIn(String dtIn) {
|
||||
this.dtIn = dtIn;
|
||||
}
|
||||
|
||||
public String getKtIn() {
|
||||
return ktIn;
|
||||
}
|
||||
|
||||
public void setKtIn(String ktIn) {
|
||||
this.ktIn = ktIn;
|
||||
}
|
||||
|
||||
public String getDtOut() {
|
||||
return dtOut;
|
||||
}
|
||||
|
||||
public void setDtOut(String dtOut) {
|
||||
this.dtOut = dtOut;
|
||||
}
|
||||
|
||||
public String getKtOut() {
|
||||
return ktOut;
|
||||
}
|
||||
|
||||
public void setKtOut(String ktOut) {
|
||||
this.ktOut = ktOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF57ObjectTag that = (DF57ObjectTag) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(dealDeb, that.dealDeb) && Objects.equals(dealCred, that.dealCred) && Objects.equals(sbankcode, that.sbankcode) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(rbankcode, that.rbankcode) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(opType, that.opType) && Objects.equals(payDate, that.payDate) && Objects.equals(extDate, that.extDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(sclientn1, that.sclientn1) && Objects.equals(sclientn2, that.sclientn2) && Objects.equals(sclientn3, that.sclientn3) && Objects.equals(sclientn4, that.sclientn4) && Objects.equals(innDeb, that.innDeb) && Objects.equals(kppDeb, that.kppDeb) && Objects.equals(accDeb, that.accDeb) && Objects.equals(rclientn1, that.rclientn1) && Objects.equals(rclientn2, that.rclientn2) && Objects.equals(rclientn3, that.rclientn3) && Objects.equals(rclientn4, that.rclientn4) && Objects.equals(innCred, that.innCred) && Objects.equals(kppCred, that.kppCred) && Objects.equals(accKr, that.accKr) && Objects.equals(specif, that.specif) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(dtIn, that.dtIn) && Objects.equals(ktIn, that.ktIn) && Objects.equals(dtOut, that.dtOut) && Objects.equals(ktOut, that.ktOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, dealDeb, dealCred, sbankcode, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, rbankcode, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, opType, payDate, extDate, payVal, sumDeb, sclientn1, sclientn2, sclientn3, sclientn4, innDeb, kppDeb, accDeb, rclientn1, rclientn2, rclientn3, rclientn4, innCred, kppCred, accKr, specif, docNum, docDate, dtIn, ktIn, dtOut, ktOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF57ObjectTag{" +
|
||||
"id=" + id +
|
||||
", dealDeb='" + dealDeb + '\'' +
|
||||
", dealCred='" + dealCred + '\'' +
|
||||
", sbankcode='" + sbankcode + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", rbankcode='" + rbankcode + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", opType='" + opType + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", extDate=" + extDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", sclientn1='" + sclientn1 + '\'' +
|
||||
", sclientn2='" + sclientn2 + '\'' +
|
||||
", sclientn3='" + sclientn3 + '\'' +
|
||||
", sclientn4='" + sclientn4 + '\'' +
|
||||
", innDeb='" + innDeb + '\'' +
|
||||
", kppDeb='" + kppDeb + '\'' +
|
||||
", accDeb='" + accDeb + '\'' +
|
||||
", rclientn1='" + rclientn1 + '\'' +
|
||||
", rclientn2='" + rclientn2 + '\'' +
|
||||
", rclientn3='" + rclientn3 + '\'' +
|
||||
", rclientn4='" + rclientn4 + '\'' +
|
||||
", innCred='" + innCred + '\'' +
|
||||
", kppCred='" + kppCred + '\'' +
|
||||
", accKr='" + accKr + '\'' +
|
||||
", specif='" + specif + '\'' +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", dtIn='" + dtIn + '\'' +
|
||||
", ktIn='" + ktIn + '\'' +
|
||||
", dtOut='" + dtOut + '\'' +
|
||||
", ktOut='" + ktOut + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(DF01ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF04ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF06ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF52ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF55ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF57ObjectTag.class)
|
||||
})
|
||||
public abstract class ObjectTag<T1 extends SpcexObjectBase> {
|
||||
private final ETable prefix;
|
||||
|
||||
@JsonIgnore
|
||||
protected String fileName;
|
||||
@JsonIgnore
|
||||
protected Long generationId;
|
||||
|
||||
public ObjectTag(ETable prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public abstract T1 getSDfEntity();
|
||||
|
||||
public ETable getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public Long getGenerationId() {
|
||||
return generationId;
|
||||
}
|
||||
|
||||
public void setGenerationId(Long generationId) {
|
||||
this.generationId = generationId;
|
||||
}
|
||||
|
||||
public void insertEntity(ImdgHazelcast<T1> map) {
|
||||
T1 obj = getSDfEntity();
|
||||
if (checkOnExisting(obj)) {
|
||||
map.insert(obj);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean checkOnExisting(T1 obj) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
@Component
|
||||
public class ChangeDirOfFileStage {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy.MM.dd HH.mm.ss");
|
||||
private final ImportXMLServiceSettings settings;
|
||||
|
||||
public ChangeDirOfFileStage(ImportXMLServiceSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: Change directory of file", resultContainer.getUuid());
|
||||
File srcDir = new File(settings.getStore().getSrcDir());
|
||||
File outDir;
|
||||
if (resultContainer.getLastStageStatus().equals(StageResult.ERROR)) {
|
||||
outDir = new File(settings.getStore().getOutDirError());
|
||||
|
||||
} else {
|
||||
outDir = new File(settings.getStore().getOutDir());
|
||||
}
|
||||
File xmlFile = resultContainer.getXmlFile();
|
||||
|
||||
if (!srcDir.exists()) {
|
||||
log.error("SettlementHouse_DocIn does not exists!");
|
||||
notifyWithCode(resultContainer, StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
if (!outDir.exists()) {
|
||||
log.warn("ouput directory {} does not exists! Trying to made new!", outDir.getAbsolutePath());
|
||||
if (outDir.mkdir()) {
|
||||
log.error("Made dir {} successfully!", outDir.getName());
|
||||
} else {
|
||||
log.error("SettlementHouse_DocIn does not exists!");
|
||||
notifyWithCode(resultContainer, StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
}
|
||||
if (!xmlFile.exists()) {
|
||||
log.error("XML file to save does not exists!");
|
||||
notifyWithCode(resultContainer, StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
String newNameOfFile = TimeUtil.formatInstant(Instant.now(), FORMATTER) + '_' + xmlFile.getName();
|
||||
|
||||
try {
|
||||
Files.move(xmlFile.toPath(), outDir.toPath().resolve(newNameOfFile), REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
log.error("Could not move file {}", e.getMessage());
|
||||
notifyWithCode(resultContainer, StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
|
||||
if (resultContainer.getLastStageStatus().equals(StageResult.ERROR)) {
|
||||
notifyWithCode(resultContainer, StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
} else {
|
||||
notifyWithCode(resultContainer, StageResult.COMPLETE);
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyWithCode(ResultContainer resultContainer, StageResult result) {
|
||||
log.info("uuid {}. Stage change directory of file finished with status {}", resultContainer.getUuid(), result);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Component
|
||||
public class ImportToDB {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XmlMapper xmlMapper;
|
||||
private final HazelcastService hazelcastService;
|
||||
private final XmlImportKafkaMessenger kafkaMessenger;
|
||||
private final Map<ETable, ImdgHazelcast<?>> mapOfTable;
|
||||
|
||||
public ImportToDB(@Qualifier("xmlMapper") XmlMapper xmlMapper,
|
||||
HazelcastService hazelcastService,
|
||||
XmlImportKafkaMessenger kafkaMessenger,
|
||||
@Qualifier("mapOfTable") Map<ETable, ImdgHazelcast<?>> mapOfTable) {
|
||||
this.xmlMapper = xmlMapper;
|
||||
this.hazelcastService = hazelcastService;
|
||||
this.kafkaMessenger = kafkaMessenger;
|
||||
this.mapOfTable = mapOfTable;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: Import to DB", resultContainer.getUuid());
|
||||
ETable currTable = resultContainer.getXmlTable();
|
||||
DocumentTag documentTag = resultContainer.getDocumentTag();
|
||||
|
||||
String fileName = resultContainer.getXmlFile().getName();
|
||||
Long fileId = hazelcastService.getImdgIdGenerator().nextId();
|
||||
for (ObjectTag o : documentTag.getObjects()) {
|
||||
ImdgHazelcast<? extends SpcexObjectBase> imdgMap = mapOfTable.get(o.getPrefix());
|
||||
o.setFileName(fileName);
|
||||
o.setGenerationId(fileId);
|
||||
o.insertEntity(imdgMap);
|
||||
}
|
||||
|
||||
if (ETable.DF_01.equals(currTable)) {
|
||||
kafkaMessenger.sendPairSdfRequest(fileName, fileId, currTable.getPrefix());
|
||||
}
|
||||
kafkaMessenger.notifySystemIfNeeded(currTable, fileId);
|
||||
kafkaMessenger.notifyUserAboutSuccessLoad(resultContainer);
|
||||
|
||||
log.info("uuid {}. Stage import to DB finished with status {}", resultContainer.getUuid(), StageResult.OK);
|
||||
return StageResult.OK;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.IOException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||
|
||||
@Component
|
||||
public class ReadXMLFile {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XmlMapper xmlMapper;
|
||||
private final XmlImportKafkaMessenger kafkaMessenger;
|
||||
|
||||
public ReadXMLFile(@Qualifier("xmlMapper") XmlMapper xmlMapper,
|
||||
XmlImportKafkaMessenger kafkaMessenger) {
|
||||
this.xmlMapper = xmlMapper;
|
||||
this.kafkaMessenger = kafkaMessenger;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: Reading XML file", resultContainer.getUuid());
|
||||
try {
|
||||
resultContainer.setDocumentTag(xmlMapper.readValue(resultContainer.getXmlFile(), DocumentTag.class));
|
||||
return StageResult.OK;
|
||||
} catch (IOException e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
kafkaMessenger.notifyUserAboutErrorParsing(e, resultContainer);
|
||||
log.info("uuid {}. Stage reading from XML file finished with status {}", resultContainer.getUuid(), StageResult.ERROR);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.PAIR_SDF;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.clearing.Sdf04Request;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.NotificationNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.PairSdfRequest;
|
||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.platform.enumeration.ObjectType;
|
||||
import ru.spcex.platform.enumeration.Priority;
|
||||
import ru.spcex.platform.enumeration.SdfTable;
|
||||
|
||||
@Component
|
||||
public class XmlImportKafkaMessenger implements InitializingBean {
|
||||
final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final Supplier<KafkaSender> kafka;
|
||||
private final Map<ETable, Consumer<Long>> messengers;
|
||||
|
||||
public XmlImportKafkaMessenger(Supplier<KafkaSender> kafka) {
|
||||
this.kafka = kafka;
|
||||
this.messengers = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
messengers.put(ETable.DF_01, groupId -> messageStatement(groupId, SdfTable.SDF_01));
|
||||
messengers.put(ETable.DF_04, groupId -> messageStatement(groupId, SdfTable.SDF_04));
|
||||
messengers.put(ETable.DF_06, groupId -> messageStatement(groupId, SdfTable.SDF_06, Consts.STATEMENT_PROCESS_SDF06));
|
||||
messengers.put(ETable.DF_52, groupId -> messageStatement(groupId, SdfTable.SDF_52, Consts.ACCOUNT_PROCESS_SDF52));
|
||||
messengers.put(ETable.DF_55, groupId -> messageStatement(groupId, SdfTable.SDF_55));
|
||||
messengers.put(ETable.DF_57, groupId -> messageStatement(groupId, SdfTable.SDF_57));
|
||||
}
|
||||
|
||||
/**
|
||||
* отправляет в кафку сообщение, при необходимости
|
||||
* (обрабатывается, например, в balance-service, clearing-service)
|
||||
*/
|
||||
public void notifySystemIfNeeded(ETable table, Long groupId) {
|
||||
Consumer<Long> messenger = messengers.get(table);
|
||||
if (messenger != null) {
|
||||
messenger.accept(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyUserAboutErrorParsing(Throwable error, ResultContainer resultContainer) {
|
||||
if (resultContainer == null || resultContainer.getXmlFile() == null)
|
||||
return;
|
||||
String fileName = resultContainer.getXmlFile().getName();
|
||||
log.debug("Notify user about error {} \"{}\"",
|
||||
resultContainer.getXmlTable(), fileName);
|
||||
sendUserNotification(ObjectType.rgst, String.format("Файл \"%s\" не сохранен", fileName), Priority.HIGH);
|
||||
}
|
||||
|
||||
public void notifyUserAboutSuccessLoad(ResultContainer resultContainer) {
|
||||
if (ETable.DF_04 == resultContainer.getXmlTable()) {
|
||||
if (!(StageResult.OK == resultContainer.getLastStageStatus() || StageResult.COMPLETE == resultContainer.getLastStageStatus())) {
|
||||
return;
|
||||
}
|
||||
String fileName = resultContainer.getXmlFile().getName();
|
||||
log.debug("Notify user about success {} \"{}\"",
|
||||
resultContainer.getXmlTable(), fileName);
|
||||
sendUserNotification(ObjectType.rgst, String.format("Загружен \"%s\" - успешно", fileName), Priority.LOW);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendUserNotification(ObjectType objectType, String comment, Priority priority) {
|
||||
final String destination = Consts.NOTIFICATION_NEW;
|
||||
NotificationNewRequest request = new NotificationNewRequest();
|
||||
request.setObjectType(objectType.getKey());
|
||||
request.setPriority(priority.getKey());
|
||||
request.setComment(comment);
|
||||
log.debug("Send message to kafka \"{}\": {}", destination, LogFormatter.toStringWrapper(request));
|
||||
Long rKey = kafka.get().sendRequestToQueue(destination, request);
|
||||
log.trace("For user send message, request id={}", rKey);
|
||||
}
|
||||
|
||||
private void messageStatement(Long groupId, SdfTable table) {
|
||||
messageStatement(groupId, table, Consts.STATEMENT_PROCESS);
|
||||
}
|
||||
|
||||
private void messageStatement(Long groupId, SdfTable table, String destination) {
|
||||
StatementRequest statementRequest = new StatementRequest();
|
||||
statementRequest.setGroupId(groupId);
|
||||
statementRequest.setTable(table);
|
||||
Long msgId = kafka.get().sendRequestToQueue(destination, statementRequest);
|
||||
log.debug("Send StatementRequest({}, {}) message id={} to kafka \"{}\"",
|
||||
groupId, table, msgId, destination);
|
||||
}
|
||||
|
||||
public void sendPairSdfRequest(String fileName, Long fileId, String tableSdf) {
|
||||
PairSdfRequest request = new PairSdfRequest();
|
||||
request.setFileNameSDf(fileName);
|
||||
request.setGenerationId(fileId);
|
||||
request.setTableSDf(tableSdf);
|
||||
Long msgId = kafka.get().sendRequestToQueue(PAIR_SDF, request);
|
||||
log.info("Send PairSdfRequest={} message id={} to kafka \"{}\"", LogFormatter.toString(request), msgId, PAIR_SDF);
|
||||
}
|
||||
|
||||
private void messageDf04(Long groupId) {
|
||||
Sdf04Request sdf04ImportNotification = new Sdf04Request();
|
||||
sdf04ImportNotification.setGroupId(groupId);
|
||||
kafka.get().sendRequestToQueue(Consts.SDF04_PROCESS, sdf04ImportNotification);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package ru.spcex.clearing.xml.importer.services;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.spcex.clearing.xml.importer.config.SFTPConfig;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||
|
||||
@Service("fileChecker")
|
||||
public class FileChecker {
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
private final ImportXMLServiceSettings settings;
|
||||
private final SFTPConfig.XmlGateway gateway;
|
||||
|
||||
public FileChecker(ImportXMLServiceSettings settings, SFTPConfig.XmlGateway gateway) {
|
||||
this.settings = settings;
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public Map<ETable, List<File>> checkNewFiles(ETable specificTable) {
|
||||
Map<ETable, List<File>> newFiles = new EnumMap<>(ETable.class);
|
||||
|
||||
String srcDir = settings.getStore().getSrcDir();
|
||||
List<File> xmlFiles = lsXML(srcDir);
|
||||
if (xmlFiles.isEmpty()) return newFiles;
|
||||
|
||||
for (File xmlFile : xmlFiles) {
|
||||
if (xmlFile.isDirectory()) continue;
|
||||
|
||||
ETable currTable = ETable.getTableForFilename(xmlFile.getName());
|
||||
if (currTable == null) continue;
|
||||
if (specificTable != null && !specificTable.equals(currTable)) continue;
|
||||
List<File> currList = newFiles.computeIfAbsent(currTable, list -> new LinkedList<>());
|
||||
currList.add(xmlFile);
|
||||
}
|
||||
return newFiles;
|
||||
}
|
||||
|
||||
private List<File> lsXML(String xmlDirPath) {
|
||||
List<File> resultFiles = new LinkedList<>();
|
||||
try (Stream<Path> stream = Files.walk(Paths.get(xmlDirPath))) {
|
||||
resultFiles = stream
|
||||
.filter(file -> !Files.isDirectory(file))
|
||||
.map(Path::toFile)
|
||||
.filter(file -> file.getName().toLowerCase(Locale.ROOT).endsWith(".xml"))
|
||||
.sorted(Comparator.comparingLong(File::lastModified))
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
log.error("Error reading 'service.store.src-dir' : {}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
|
||||
return resultFiles;
|
||||
}
|
||||
|
||||
public void checkAndLoadSFTP() {
|
||||
if (settings.getStore().getSftpIn().getSftpSrcPayValDir() == null || settings.getStore().getSftpIn().getSftpSrcPayValDir().isEmpty()) {
|
||||
log.error("No SFTP scanning directories, need will be adding setting like 'import-xml-service.store.sftp-in.sftp-src-pay-val-dir.VAL=/VAL' and restart app");
|
||||
return;
|
||||
}
|
||||
List<File> files = new ArrayList<>();
|
||||
log.trace("Load from SFTP paths: {}", settings.getStore().getSftpIn().getSftpSrcPayValDir().values());
|
||||
for (String path : settings.getStore().getSftpIn().getSftpSrcPayValDir().values()) {
|
||||
files.addAll(gateway.listFiles(path));
|
||||
}
|
||||
if (!files.isEmpty()) log.info("Loaded from SFTP files count={}", files.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package ru.spcex.clearing.xml.importer.services;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.steps.ChangeDirOfFileStage;
|
||||
import ru.spcex.clearing.xml.importer.logic.steps.ImportToDB;
|
||||
import ru.spcex.clearing.xml.importer.logic.steps.ReadXMLFile;
|
||||
import ru.spcex.platform.utils.collection.Pair;
|
||||
|
||||
@Service("xmlImporterService")
|
||||
@EnableScheduling
|
||||
public class XMLImporterService {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final FileChecker fileChecker;
|
||||
private final ThreadPoolTaskExecutor executorService;
|
||||
private final Set<Path> filesCurrentlyInProcess;
|
||||
|
||||
private final ReadXMLFile readXMLFile;
|
||||
private final ImportToDB importToDB;
|
||||
private final ChangeDirOfFileStage changeDirOfFileStage;
|
||||
|
||||
public XMLImporterService(@Qualifier("fileChecker") FileChecker fileChecker,
|
||||
@Qualifier("executor") ThreadPoolTaskExecutor executorService,
|
||||
ReadXMLFile readXMLFile,
|
||||
ImportToDB importToDB,
|
||||
ChangeDirOfFileStage changeDirOfFileStage) {
|
||||
this.fileChecker = fileChecker;
|
||||
this.executorService = executorService;
|
||||
this.readXMLFile = readXMLFile;
|
||||
this.importToDB = importToDB;
|
||||
this.changeDirOfFileStage = changeDirOfFileStage;
|
||||
this.filesCurrentlyInProcess = new HashSet<>();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${import-xml-service.scheduler.check-src-dir-cron}")
|
||||
public void run() {
|
||||
processTable(null);
|
||||
}
|
||||
|
||||
public void processTable(ETable specificTable) {
|
||||
log.info("adding import task {}", specificTable == null ? "without specific table" : specificTable);
|
||||
|
||||
fileChecker.checkAndLoadSFTP();
|
||||
executorService.execute(() -> {
|
||||
Map<ETable, List<File>> newFiles = null;
|
||||
try {
|
||||
log.trace("checking new files... {}", specificTable != null ? specificTable.name() : "");
|
||||
newFiles = getFiles(specificTable);
|
||||
if (!newFiles.isEmpty() && log.isDebugEnabled()) {
|
||||
log.debug("following files will be processed {}", forLogging(newFiles));
|
||||
} else if (!newFiles.isEmpty()) {
|
||||
log.info("following files will be processed {}", forLoggingSizeOnly(newFiles));
|
||||
} else {
|
||||
log.trace("no files were found");
|
||||
}
|
||||
|
||||
// Сортировка по возрастанию времени изменения - обрабатывать только в таком порядке
|
||||
List<Pair<File, ETable>> orderByTimeFiles = new ArrayList<>();
|
||||
for (Map.Entry<ETable, List<File>> newFilesEntry : newFiles.entrySet()) {
|
||||
ETable currTable = newFilesEntry.getKey();
|
||||
List<File> fileList = newFilesEntry.getValue();
|
||||
for (File xmlFile : fileList) {
|
||||
orderByTimeFiles.add(new Pair<>(xmlFile, currTable));
|
||||
}
|
||||
}
|
||||
orderByTimeFiles.sort(Comparator.comparingLong(iF -> iF.getFirst().lastModified()));
|
||||
for (Pair<File, ETable> newFilesEntry : orderByTimeFiles) {
|
||||
ETable currTable = newFilesEntry.getSecond();
|
||||
File xmlFile = newFilesEntry.getFirst();
|
||||
ResultContainer task = new ResultContainer(currTable, xmlFile);
|
||||
|
||||
log.info("uuid {}. Task started", task.getUuid());
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
task.setLastStageStatus(readXMLFile.process(task));
|
||||
task.setLastStageStatus(importToDB.process(task));
|
||||
task.setLastStageStatus(changeDirOfFileStage.process(task));
|
||||
stopWatch.stop();
|
||||
log.info("uuid {}. Task completed, result: {}, time working: {} ms",
|
||||
task.getUuid(),
|
||||
task,
|
||||
stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
} finally {
|
||||
if (newFiles != null && !newFiles.isEmpty()) {
|
||||
cleanFiles(newFiles);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private synchronized Map<ETable, List<File>> getFiles(ETable specificTable) {
|
||||
Map<ETable, List<File>> newFiles = fileChecker.checkNewFiles(specificTable);
|
||||
Map<ETable, List<File>> newFilesFiltered = newFiles.entrySet()
|
||||
.stream()
|
||||
.map(entry ->
|
||||
new AbstractMap.SimpleEntry<>(entry.getKey(), entry.getValue()
|
||||
.stream()
|
||||
.filter(file -> !filesCurrentlyInProcess.contains(file.toPath()))
|
||||
.collect(Collectors.toList())))
|
||||
.collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
|
||||
newFilesFiltered.forEach((table, files)
|
||||
-> files.forEach(file -> filesCurrentlyInProcess.add(file.toPath())));
|
||||
return newFilesFiltered;
|
||||
}
|
||||
|
||||
private synchronized void cleanFiles(Map<ETable, List<File>> filesFromTask) {
|
||||
filesFromTask.forEach((table, files)
|
||||
-> files.forEach(file -> filesCurrentlyInProcess.remove(file.toPath())));
|
||||
}
|
||||
|
||||
private static String forLogging(Map<ETable, List<File>> files) {
|
||||
return files
|
||||
.entrySet()
|
||||
.stream()
|
||||
.flatMap((Function<Map.Entry<ETable, List<File>>, Stream<String>>) entry -> {
|
||||
List<String> r = new LinkedList<>();
|
||||
for (File file : entry.getValue()) {
|
||||
r.add(entry.getKey().name() + " " + file.toPath());
|
||||
}
|
||||
return r.stream();
|
||||
})
|
||||
.collect(Collectors.joining(";", "[", "]"));
|
||||
}
|
||||
|
||||
private static String forLoggingSizeOnly(Map<ETable, List<File>> files) {
|
||||
return files
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(entry -> entry.getKey().name() + " " + entry.getValue().size())
|
||||
.collect(Collectors.joining(";", "[", "]"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
server.port=8081
|
||||
server.servlet.context-path=/xml-importer
|
||||
spring.main.web-application-type=servlet
|
||||
|
||||
import-xml-service.scheduler.check-src-dir-cron=* * * * 1 ?
|
||||
|
||||
import-xml-service.store.delete-src-files=false
|
||||
import-xml-service.store.src-dir=/opt/clearing/file/xml-importer/
|
||||
import-xml-service.store.out-dir=/opt/clearing/file/xml-importer/loaded/
|
||||
import-xml-service.store.out-dir-error=/opt/clearing/file/xml-importer/error/
|
||||
|
||||
import-xml-service.common.encoding-source=cp866
|
||||
import-xml-service.common.insert-batch-size=100
|
||||
import-xml-service.common.threads-count=10
|
||||
|
||||
#sftpSrcDir
|
||||
import-xml-service.store.sftp-in.sftp-src-pay-val-dir.rub=clearing_xml-importer_sftp/rub/
|
||||
import-xml-service.store.sftp-in.sftp-src-pay-val-dir.eur=clearing_xml-importer_sftp/eur/
|
||||
import-xml-service.store.sftp-in.sftp-src-dir=clearing_xml-importer_sftp
|
||||
import-xml-service.store.sftp-in.user=user
|
||||
import-xml-service.store.sftp-in.password=*********
|
||||
import-xml-service.store.sftp-in.server-ip=127.0.0.1
|
||||
import-xml-service.store.sftp-in.server-port=22
|
||||
|
||||
import-xml-service.hazelcast.cluster-members=10.200.200.181:5701
|
||||
import-xml-service.hazelcast.login=dev
|
||||
import-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
|
||||
import-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
import-xml-service.kafka-producer.acks=all
|
||||
import-xml-service.kafka-producer.retries=0
|
||||
import-xml-service.kafka-producer.batch-size=16384
|
||||
import-xml-service.kafka-producer.linger-ms=1
|
||||
import-xml-service.kafka-producer.buffer-memory=33554432
|
||||
|
||||
import-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
import-xml-service.kafka-consumer.group-id=dev-group-clearing-service
|
||||
import-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
import-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
import-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
import-xml-service.kafka-consumer.linger-ms=1
|
||||
import-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
56
clearing-parent/xml-importer/src/main/resources/logback.xml
Normal file
56
clearing-parent/xml-importer/src/main/resources/logback.xml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_PATH" value="./log" />
|
||||
<property name="FILE_NAME" value="xml-importer" />
|
||||
<property name="CONSOLE_LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %class{0}:%line - %message%n" />
|
||||
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %class{0}:%msg%n" />
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- first FILE TEXT appender -->
|
||||
<appender name="TEXT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-text.log</file>
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${FILE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-text.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- second FILE JSON appender -->
|
||||
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-json.log</file>
|
||||
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-json.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
</root>
|
||||
|
||||
<logger name="ru.spcex" level="debug" additivity="false">
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,500 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf04;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf06;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf55;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf57;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.clearing.xml.importer.config.XMLImporterConfig;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.ParentDocTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF01ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF04ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF06ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF52ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF55ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF57ObjectTag;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
ImportToDB.class,
|
||||
ImportXMLServiceSettings.class,
|
||||
XmlImportKafkaMessenger.class,
|
||||
XMLImporterConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
KafkaTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
class ImportToDBTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private HazelcastService hazelcastService;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
private ImportToDB importToDB;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
hazelcastService.waitAvailable();
|
||||
|
||||
new TestObjectCreator(hazelcastService).createUserAdmin(1000L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf01ToHazelcast() {
|
||||
DF01ObjectTag expectedObjectTag = new DF01ObjectTag();
|
||||
expectedObjectTag.setCurrCode("test1");
|
||||
expectedObjectTag.setAccount("test2");
|
||||
expectedObjectTag.setRemainder("test3");
|
||||
expectedObjectTag.setDeal("test4");
|
||||
expectedObjectTag.setAccCode("test5");
|
||||
expectedObjectTag.setDat(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setMarket("test6");
|
||||
expectedObjectTag.setAccName("test7");
|
||||
expectedObjectTag.setAccType("test8");
|
||||
expectedObjectTag.setSumengage("test9");
|
||||
expectedObjectTag.setSumunblock("test10");
|
||||
expectedObjectTag.setFileType("test11");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF01");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_01,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-01_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf01> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf01, SDf01.class);
|
||||
SDf01 actualSDf01 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf01.getCurr_code()).isEqualTo(expectedObjectTag.getCurrCode());
|
||||
Assertions.assertThat(actualSDf01.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualSDf01.getRemainder()).isEqualTo(expectedObjectTag.getRemainder());
|
||||
Assertions.assertThat(actualSDf01.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualSDf01.getAcc_code()).isEqualTo(expectedObjectTag.getAccCode());
|
||||
Assertions.assertThat(actualSDf01.getDat()).isEqualTo(expectedObjectTag.getDat().format(formatter));
|
||||
Assertions.assertThat(actualSDf01.getMarket()).isEqualTo(expectedObjectTag.getMarket());
|
||||
Assertions.assertThat(actualSDf01.getAcc_name()).isEqualTo(expectedObjectTag.getAccName());
|
||||
Assertions.assertThat(actualSDf01.getAcc_type()).isEqualTo(expectedObjectTag.getAccType());
|
||||
Assertions.assertThat(actualSDf01.getSumengage()).isEqualTo(expectedObjectTag.getSumengage());
|
||||
Assertions.assertThat(actualSDf01.getSumunblock()).isEqualTo(expectedObjectTag.getSumunblock());
|
||||
Assertions.assertThat(actualSDf01.getFile_type()).isEqualTo(expectedObjectTag.getFileType());
|
||||
Assertions.assertThat(actualSDf01.getFileName()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf01.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf04ToHazelcast() {
|
||||
DF04ObjectTag expectedObjectTag = new DF04ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setcAccCred("test7");
|
||||
expectedObjectTag.setRbanknam1("test8");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test9");
|
||||
expectedObjectTag.setSumDeb("test10");
|
||||
expectedObjectTag.setSpecif1("test11");
|
||||
expectedObjectTag.setImpResult("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF04");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_04,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-04_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf04> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf04, SDf04.class);
|
||||
SDf04 actualSDf04 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf04.getSeg_type()).isEqualTo(expectedObjectTag.getSegType());
|
||||
Assertions.assertThat(actualSDf04.getDoc_type()).isEqualTo(expectedObjectTag.getDocType());
|
||||
Assertions.assertThat(actualSDf04.getDocnm_ref()).isEqualTo(expectedObjectTag.getDocnmRef());
|
||||
Assertions.assertThat(actualSDf04.getDocnmprev()).isEqualTo(expectedObjectTag.getDocnmprev());
|
||||
Assertions.assertThat(actualSDf04.getC_acc_deb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualSDf04.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualSDf04.getC_acc_cred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualSDf04.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualSDf04.getPay_date()).isEqualTo(expectedObjectTag.getPayDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf04.getPay_val()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualSDf04.getSum_deb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualSDf04.getSpecif_1()).isEqualTo(expectedObjectTag.getSpecif1());
|
||||
Assertions.assertThat(actualSDf04.getImp_result()).isEqualTo(expectedObjectTag.getImpResult());
|
||||
Assertions.assertThat(actualSDf04.getFile_name()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf04.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf06ToHazelcast() {
|
||||
DF06ObjectTag expectedObjectTag = new DF06ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedObjectTag.setMarket("test3");
|
||||
expectedObjectTag.setType("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setClientN("test6");
|
||||
expectedObjectTag.setInn("test7");
|
||||
expectedObjectTag.setBic("test8");
|
||||
expectedObjectTag.setSpec("test9");
|
||||
expectedObjectTag.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedObjectTag.setDocNum("test11");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF06");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_06,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-06_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf06> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf06, SDf06.class);
|
||||
SDf06 actualSDf06 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf06.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualSDf06.getSum()).isEqualTo(expectedObjectTag.getSum());
|
||||
Assertions.assertThat(actualSDf06.getMarket()).isEqualTo(expectedObjectTag.getMarket());
|
||||
Assertions.assertThat(actualSDf06.getType()).isEqualTo(expectedObjectTag.getType());
|
||||
Assertions.assertThat(actualSDf06.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualSDf06.getClientN()).isEqualTo(expectedObjectTag.getClientN());
|
||||
Assertions.assertThat(actualSDf06.getInn()).isEqualTo(expectedObjectTag.getInn());
|
||||
Assertions.assertThat(actualSDf06.getBic()).isEqualTo(expectedObjectTag.getBic());
|
||||
Assertions.assertThat(actualSDf06.getSpec()).isEqualTo(expectedObjectTag.getSpec());
|
||||
Assertions.assertThat(actualSDf06.getNumber()).isEqualTo(expectedObjectTag.getNumber());
|
||||
Assertions.assertThat(actualSDf06.getDoc_Num()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualSDf06.getDoc_Date()).isEqualTo(expectedObjectTag.getDocDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf06.getPay_val()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualSDf06.getFileName()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf06.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf52ToHazelcast() {
|
||||
DF52ObjectTag expectedObjectTag = new DF52ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setAccName("test2");
|
||||
expectedObjectTag.setDeal("test3");
|
||||
expectedObjectTag.setDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setAccType("test5");
|
||||
expectedObjectTag.setStatus(1L);
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF52");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_52,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-52_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf52> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf52, SDf52.class);
|
||||
SDf52 actualSDf52 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf52.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualSDf52.getAcc_name()).isEqualTo(expectedObjectTag.getAccName());
|
||||
Assertions.assertThat(actualSDf52.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualSDf52.getDate()).isEqualTo(expectedObjectTag.getDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf52.getAcc_type()).isEqualTo(expectedObjectTag.getAccType());
|
||||
Assertions.assertThat(actualSDf52.getStatus()).isEqualTo(expectedObjectTag.getStatus());
|
||||
Assertions.assertThat(actualSDf52.getFileName()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf52.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf55ToHazelcast() {
|
||||
DF55ObjectTag expectedObjectTag = new DF55ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setSbankcode("test5");
|
||||
expectedObjectTag.setcAccDeb("test6");
|
||||
expectedObjectTag.setSbanknam1("test7");
|
||||
expectedObjectTag.setRbankcode("test8");
|
||||
expectedObjectTag.setcAccCred("test9");
|
||||
expectedObjectTag.setRbanknam1("test10");
|
||||
expectedObjectTag.setOpType("test11");
|
||||
expectedObjectTag.setOpOrder("test12");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test13");
|
||||
expectedObjectTag.setSumDeb("test14");
|
||||
expectedObjectTag.setSclientn1("test15");
|
||||
expectedObjectTag.setInnDeb("test16");
|
||||
expectedObjectTag.setKppDeb("test17");
|
||||
expectedObjectTag.setAccDeb("test18");
|
||||
expectedObjectTag.setRclientn1("test19");
|
||||
expectedObjectTag.setInnCred("test20");
|
||||
expectedObjectTag.setKppCred("test21");
|
||||
expectedObjectTag.setAccKr1("test22");
|
||||
expectedObjectTag.setSpecif1("test23");
|
||||
expectedObjectTag.setSendType("test24");
|
||||
expectedObjectTag.setDocResult("test25");
|
||||
expectedObjectTag.setDocNum("test26");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setValueDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setSwiftBen("test27");
|
||||
expectedObjectTag.setSwiftInt("test28");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF55");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_55,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-55_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf55> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf55, SDf55.class);
|
||||
SDf55 actualSDf55 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf55.getSeg_type()).isEqualTo(expectedObjectTag.getSegType());
|
||||
Assertions.assertThat(actualSDf55.getDoc_type()).isEqualTo(expectedObjectTag.getDocType());
|
||||
Assertions.assertThat(actualSDf55.getDocnm_ref()).isEqualTo(expectedObjectTag.getDocnmRef());
|
||||
Assertions.assertThat(actualSDf55.getDocnmprev()).isEqualTo(expectedObjectTag.getDocnmprev());
|
||||
Assertions.assertThat(actualSDf55.getSbankcode()).isEqualTo(expectedObjectTag.getSbankcode());
|
||||
Assertions.assertThat(actualSDf55.getC_acc_deb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualSDf55.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualSDf55.getRbankcode()).isEqualTo(expectedObjectTag.getRbankcode());
|
||||
Assertions.assertThat(actualSDf55.getC_acc_cred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualSDf55.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualSDf55.getOp_type()).isEqualTo(expectedObjectTag.getOpType());
|
||||
Assertions.assertThat(actualSDf55.getOp_order()).isEqualTo(expectedObjectTag.getOpOrder());
|
||||
Assertions.assertThat(actualSDf55.getPay_date()).isEqualTo(expectedObjectTag.getPayDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf55.getPay_val()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualSDf55.getSum_deb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualSDf55.getSclientn1()).isEqualTo(expectedObjectTag.getSclientn1());
|
||||
Assertions.assertThat(actualSDf55.getInn_deb()).isEqualTo(expectedObjectTag.getInnDeb());
|
||||
Assertions.assertThat(actualSDf55.getKpp_deb()).isEqualTo(expectedObjectTag.getKppDeb());
|
||||
Assertions.assertThat(actualSDf55.getAcc_deb()).isEqualTo(expectedObjectTag.getAccDeb());
|
||||
Assertions.assertThat(actualSDf55.getRclientn1()).isEqualTo(expectedObjectTag.getRclientn1());
|
||||
Assertions.assertThat(actualSDf55.getInn_cred()).isEqualTo(expectedObjectTag.getInnCred());
|
||||
Assertions.assertThat(actualSDf55.getKpp_cred()).isEqualTo(expectedObjectTag.getKppCred());
|
||||
Assertions.assertThat(actualSDf55.getAcc_kr_1()).isEqualTo(expectedObjectTag.getAccKr1());
|
||||
Assertions.assertThat(actualSDf55.getSpecif_1()).isEqualTo(expectedObjectTag.getSpecif1());
|
||||
Assertions.assertThat(actualSDf55.getSend_type()).isEqualTo(expectedObjectTag.getSendType());
|
||||
Assertions.assertThat(actualSDf55.getDoc_result()).isEqualTo(expectedObjectTag.getDocResult());
|
||||
Assertions.assertThat(actualSDf55.getDoc_Num()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualSDf55.getDoc_Date()).isEqualTo(expectedObjectTag.getDocDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf55.getValue_date()).isEqualTo(expectedObjectTag.getValueDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf55.getSwift_ben()).isEqualTo(expectedObjectTag.getSwiftBen());
|
||||
Assertions.assertThat(actualSDf55.getSwift_int()).isEqualTo(expectedObjectTag.getSwiftInt());
|
||||
Assertions.assertThat(actualSDf55.getFileName()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf55.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldImportSDf57ToHazelcast() {
|
||||
DF57ObjectTag expectedObjectTag = new DF57ObjectTag();
|
||||
expectedObjectTag.setId(1L);
|
||||
expectedObjectTag.setDealDeb("test2");
|
||||
expectedObjectTag.setDealCred("test3");
|
||||
expectedObjectTag.setSbankcode("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setRbankcode("test7");
|
||||
expectedObjectTag.setcAccCred("test8");
|
||||
expectedObjectTag.setRbanknam1("test9");
|
||||
expectedObjectTag.setOpType("test10");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setExtDate(111L);
|
||||
expectedObjectTag.setPayVal("test11");
|
||||
expectedObjectTag.setSumDeb("test12");
|
||||
expectedObjectTag.setSclientn1("test13");
|
||||
expectedObjectTag.setInnDeb("test14");
|
||||
expectedObjectTag.setKppDeb("test15");
|
||||
expectedObjectTag.setAccDeb("test16");
|
||||
expectedObjectTag.setRclientn1("test17");
|
||||
expectedObjectTag.setInnCred("test18");
|
||||
expectedObjectTag.setKppCred("test19");
|
||||
expectedObjectTag.setAccKr("test20");
|
||||
expectedObjectTag.setSpecif("test21");
|
||||
expectedObjectTag.setDocNum("test22");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setDtIn("test23");
|
||||
expectedObjectTag.setKtIn("test24");
|
||||
expectedObjectTag.setDtOut("test25");
|
||||
expectedObjectTag.setKtOut("test26");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF57");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_57,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-57_S_PRC1604240915_1.xml")).getFile()));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = importToDB.process(actualResultContainer);
|
||||
|
||||
Imdg<SDf57> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf57, SDf57.class);
|
||||
SDf57 actualSDf57 = imdg.getAllValues().iterator().next();
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualSDf57.getDbfId()).isEqualTo(expectedObjectTag.getId());
|
||||
Assertions.assertThat(actualSDf57.getDeal_deb()).isEqualTo(expectedObjectTag.getDealDeb());
|
||||
Assertions.assertThat(actualSDf57.getDeal_cred()).isEqualTo(expectedObjectTag.getDealCred());
|
||||
Assertions.assertThat(actualSDf57.getSbankcode()).isEqualTo(expectedObjectTag.getSbankcode());
|
||||
Assertions.assertThat(actualSDf57.getC_acc_deb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualSDf57.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualSDf57.getRbankcode()).isEqualTo(expectedObjectTag.getRbankcode());
|
||||
Assertions.assertThat(actualSDf57.getC_acc_cred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualSDf57.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualSDf57.getOp_type()).isEqualTo(expectedObjectTag.getOpType());
|
||||
Assertions.assertThat(actualSDf57.getPay_date()).isEqualTo(expectedObjectTag.getPayDate().format(formatter));
|
||||
Assertions.assertThat(Long.parseLong(actualSDf57.getExt_date())).isEqualTo(expectedObjectTag.getExtDate());
|
||||
Assertions.assertThat(actualSDf57.getPay_val()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualSDf57.getSum_deb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualSDf57.getSclientn1()).isEqualTo(expectedObjectTag.getSclientn1());
|
||||
Assertions.assertThat(actualSDf57.getInn_deb()).isEqualTo(expectedObjectTag.getInnDeb());
|
||||
Assertions.assertThat(actualSDf57.getKpp_deb()).isEqualTo(expectedObjectTag.getKppDeb());
|
||||
Assertions.assertThat(actualSDf57.getAcc_deb()).isEqualTo(expectedObjectTag.getAccDeb());
|
||||
Assertions.assertThat(actualSDf57.getRclientn1()).isEqualTo(expectedObjectTag.getRclientn1());
|
||||
Assertions.assertThat(actualSDf57.getInn_cred()).isEqualTo(expectedObjectTag.getInnCred());
|
||||
Assertions.assertThat(actualSDf57.getKpp_cred()).isEqualTo(expectedObjectTag.getKppCred());
|
||||
Assertions.assertThat(actualSDf57.getAcc_kr()).isEqualTo(expectedObjectTag.getAccKr());
|
||||
Assertions.assertThat(actualSDf57.getSpecif()).isEqualTo(expectedObjectTag.getSpecif());
|
||||
Assertions.assertThat(actualSDf57.getDoc_Num()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualSDf57.getDoc_Date()).isEqualTo(expectedObjectTag.getDocDate().format(formatter));
|
||||
Assertions.assertThat(actualSDf57.getDt_in()).isEqualTo(expectedObjectTag.getDtIn());
|
||||
Assertions.assertThat(actualSDf57.getKt_in()).isEqualTo(expectedObjectTag.getKtIn());
|
||||
Assertions.assertThat(actualSDf57.getDt_out()).isEqualTo(expectedObjectTag.getDtOut());
|
||||
Assertions.assertThat(actualSDf57.getKt_out()).isEqualTo(expectedObjectTag.getKtOut());
|
||||
Assertions.assertThat(actualSDf57.getFileName()).isEqualTo(expectedObjectTag.getFileName());
|
||||
Assertions.assertThat(actualSDf57.getGenerationId()).isEqualTo(expectedObjectTag.getGenerationId());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,377 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.steps;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Objects;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.clearing.xml.importer.config.XMLImporterConfig;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF01ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF04ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF06ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF52ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF55ObjectTag;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.DF57ObjectTag;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
ReadXMLFile.class,
|
||||
ImportXMLServiceSettings.class,
|
||||
XmlImportKafkaMessenger.class,
|
||||
XMLImporterConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
KafkaTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
class ReadXMLFileTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private ReadXMLFile readXMLFile;
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf01XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_01,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-01_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF01ObjectTag expectedObjectTag = new DF01ObjectTag();
|
||||
expectedObjectTag.setCurrCode("test1");
|
||||
expectedObjectTag.setAccount("test2");
|
||||
expectedObjectTag.setRemainder("test3");
|
||||
expectedObjectTag.setDeal("test4");
|
||||
expectedObjectTag.setAccCode("test5");
|
||||
expectedObjectTag.setDat(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setMarket("q");
|
||||
expectedObjectTag.setAccName("test7");
|
||||
expectedObjectTag.setAccType("t8");
|
||||
expectedObjectTag.setSumengage("test9");
|
||||
expectedObjectTag.setSumunblock("test10");
|
||||
expectedObjectTag.setFileType("1");
|
||||
|
||||
DF01ObjectTag actualObjectTag = (DF01ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getCurrCode()).isEqualTo(expectedObjectTag.getCurrCode());
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getRemainder()).isEqualTo(expectedObjectTag.getRemainder());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getAccCode()).isEqualTo(expectedObjectTag.getAccCode());
|
||||
Assertions.assertThat(actualObjectTag.getDat()).isEqualTo(expectedObjectTag.getDat());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedObjectTag.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedObjectTag.getAccName());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedObjectTag.getAccType());
|
||||
Assertions.assertThat(actualObjectTag.getSumengage()).isEqualTo(expectedObjectTag.getSumengage());
|
||||
Assertions.assertThat(actualObjectTag.getSumunblock()).isEqualTo(expectedObjectTag.getSumunblock());
|
||||
Assertions.assertThat(actualObjectTag.getFileType()).isEqualTo(expectedObjectTag.getFileType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf04XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_04,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-04_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF04ObjectTag expectedObjectTag = new DF04ObjectTag();
|
||||
expectedObjectTag.setSegType("1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setcAccCred("test7");
|
||||
expectedObjectTag.setRbanknam1("test8");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test9");
|
||||
expectedObjectTag.setSumDeb("test10");
|
||||
expectedObjectTag.setSpecif1("test11");
|
||||
expectedObjectTag.setImpResult("t12");
|
||||
|
||||
DF04ObjectTag actualObjectTag = (DF04ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedObjectTag.getSegType());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedObjectTag.getDocType());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedObjectTag.getDocnmRef());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedObjectTag.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate()).isEqualTo(expectedObjectTag.getPayDate());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedObjectTag.getSpecif1());
|
||||
Assertions.assertThat(actualObjectTag.getImpResult()).isEqualTo(expectedObjectTag.getImpResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf06XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_06,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-06_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF06ObjectTag expectedObjectTag = new DF06ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedObjectTag.setMarket("q");
|
||||
expectedObjectTag.setType("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setClientN("test6");
|
||||
expectedObjectTag.setInn("test7");
|
||||
expectedObjectTag.setBic("test8");
|
||||
expectedObjectTag.setSpec("test9");
|
||||
expectedObjectTag.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedObjectTag.setDocNum("t11");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test12");
|
||||
|
||||
DF06ObjectTag actualObjectTag = (DF06ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getSum()).isEqualTo(expectedObjectTag.getSum());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedObjectTag.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getType()).isEqualTo(expectedObjectTag.getType());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getClientN()).isEqualTo(expectedObjectTag.getClientN());
|
||||
Assertions.assertThat(actualObjectTag.getInn()).isEqualTo(expectedObjectTag.getInn());
|
||||
Assertions.assertThat(actualObjectTag.getBic()).isEqualTo(expectedObjectTag.getBic());
|
||||
Assertions.assertThat(actualObjectTag.getSpec()).isEqualTo(expectedObjectTag.getSpec());
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedObjectTag.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate()).isEqualTo(expectedObjectTag.getDocDate());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf52XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_52,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-52_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF52ObjectTag expectedObjectTag = new DF52ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setAccName("test2");
|
||||
expectedObjectTag.setDeal("tes3");
|
||||
expectedObjectTag.setDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setAccType("t5");
|
||||
expectedObjectTag.setStatus(1L);
|
||||
|
||||
DF52ObjectTag actualObjectTag = (DF52ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedObjectTag.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedObjectTag.getAccName());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedObjectTag.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getDate()).isEqualTo(expectedObjectTag.getDate());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedObjectTag.getAccType());
|
||||
Assertions.assertThat(actualObjectTag.getStatus()).isEqualTo(expectedObjectTag.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf55XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_55,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-55_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF55ObjectTag expectedObjectTag = new DF55ObjectTag();
|
||||
expectedObjectTag.setSegType("1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setSbankcode("test5");
|
||||
expectedObjectTag.setcAccDeb("test6");
|
||||
expectedObjectTag.setSbanknam1("test7");
|
||||
expectedObjectTag.setRbankcode("test8");
|
||||
expectedObjectTag.setcAccCred("test9");
|
||||
expectedObjectTag.setRbanknam1("test10");
|
||||
expectedObjectTag.setOpType("11");
|
||||
expectedObjectTag.setOpOrder("2");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test13");
|
||||
expectedObjectTag.setSumDeb("test14");
|
||||
expectedObjectTag.setSclientn1("test15");
|
||||
expectedObjectTag.setInnDeb("test16");
|
||||
expectedObjectTag.setKppDeb("test17");
|
||||
expectedObjectTag.setAccDeb("test18");
|
||||
expectedObjectTag.setRclientn1("test19");
|
||||
expectedObjectTag.setInnCred("test20");
|
||||
expectedObjectTag.setKppCred("test21");
|
||||
expectedObjectTag.setAccKr1("test22");
|
||||
expectedObjectTag.setSpecif1("test23");
|
||||
expectedObjectTag.setSendType("test24");
|
||||
expectedObjectTag.setDocResult("25");
|
||||
expectedObjectTag.setDocNum("t26");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setValueDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setSwiftBen("test27");
|
||||
expectedObjectTag.setSwiftInt("test28");
|
||||
|
||||
DF55ObjectTag actualObjectTag = (DF55ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedObjectTag.getSegType());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedObjectTag.getDocType());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedObjectTag.getDocnmRef());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedObjectTag.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getSbankcode()).isEqualTo(expectedObjectTag.getSbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getRbankcode()).isEqualTo(expectedObjectTag.getRbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getOpType()).isEqualTo(expectedObjectTag.getOpType());
|
||||
Assertions.assertThat(actualObjectTag.getOpOrder()).isEqualTo(expectedObjectTag.getOpOrder());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate()).isEqualTo(expectedObjectTag.getPayDate());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSclientn1()).isEqualTo(expectedObjectTag.getSclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnDeb()).isEqualTo(expectedObjectTag.getInnDeb());
|
||||
Assertions.assertThat(actualObjectTag.getKppDeb()).isEqualTo(expectedObjectTag.getKppDeb());
|
||||
Assertions.assertThat(actualObjectTag.getAccDeb()).isEqualTo(expectedObjectTag.getAccDeb());
|
||||
Assertions.assertThat(actualObjectTag.getRclientn1()).isEqualTo(expectedObjectTag.getRclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnCred()).isEqualTo(expectedObjectTag.getInnCred());
|
||||
Assertions.assertThat(actualObjectTag.getKppCred()).isEqualTo(expectedObjectTag.getKppCred());
|
||||
Assertions.assertThat(actualObjectTag.getAccKr1()).isEqualTo(expectedObjectTag.getAccKr1());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedObjectTag.getSpecif1());
|
||||
Assertions.assertThat(actualObjectTag.getSendType()).isEqualTo(expectedObjectTag.getSendType());
|
||||
Assertions.assertThat(actualObjectTag.getDocResult()).isEqualTo(expectedObjectTag.getDocResult());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate()).isEqualTo(expectedObjectTag.getDocDate());
|
||||
Assertions.assertThat(actualObjectTag.getValueDate()).isEqualTo(expectedObjectTag.getValueDate());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftBen()).isEqualTo(expectedObjectTag.getSwiftBen());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftInt()).isEqualTo(expectedObjectTag.getSwiftInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf57XMLFile() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_57,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-57_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DF57ObjectTag expectedObjectTag = new DF57ObjectTag();
|
||||
expectedObjectTag.setId(1L);
|
||||
expectedObjectTag.setDealDeb("test2");
|
||||
expectedObjectTag.setDealCred("test3");
|
||||
expectedObjectTag.setSbankcode("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setRbankcode("test7");
|
||||
expectedObjectTag.setcAccCred("test8");
|
||||
expectedObjectTag.setRbanknam1("test9");
|
||||
expectedObjectTag.setOpType("test10");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setExtDate(111L);
|
||||
expectedObjectTag.setPayVal("test11");
|
||||
expectedObjectTag.setSumDeb("test12");
|
||||
expectedObjectTag.setSclientn1("test13");
|
||||
expectedObjectTag.setInnDeb("test14");
|
||||
expectedObjectTag.setKppDeb("test15");
|
||||
expectedObjectTag.setAccDeb("test16");
|
||||
expectedObjectTag.setRclientn1("test17");
|
||||
expectedObjectTag.setInnCred("test18");
|
||||
expectedObjectTag.setKppCred("test19");
|
||||
expectedObjectTag.setAccKr("test20");
|
||||
expectedObjectTag.setSpecif("test21");
|
||||
expectedObjectTag.setDocNum("test22");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setDtIn("test23");
|
||||
expectedObjectTag.setKtIn("test24");
|
||||
expectedObjectTag.setDtOut("test25");
|
||||
expectedObjectTag.setKtOut("test26");
|
||||
|
||||
DF57ObjectTag actualObjectTag = (DF57ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualObjectTag.getId()).isEqualTo(expectedObjectTag.getId());
|
||||
Assertions.assertThat(actualObjectTag.getDealDeb()).isEqualTo(expectedObjectTag.getDealDeb());
|
||||
Assertions.assertThat(actualObjectTag.getDealCred()).isEqualTo(expectedObjectTag.getDealCred());
|
||||
Assertions.assertThat(actualObjectTag.getSbankcode()).isEqualTo(expectedObjectTag.getSbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedObjectTag.getcAccDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedObjectTag.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getRbankcode()).isEqualTo(expectedObjectTag.getRbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedObjectTag.getcAccCred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedObjectTag.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getOpType()).isEqualTo(expectedObjectTag.getOpType());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate()).isEqualTo(expectedObjectTag.getPayDate());
|
||||
Assertions.assertThat(actualObjectTag.getExtDate()).isEqualTo(expectedObjectTag.getExtDate());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedObjectTag.getPayVal());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedObjectTag.getSumDeb());
|
||||
Assertions.assertThat(actualObjectTag.getSclientn1()).isEqualTo(expectedObjectTag.getSclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnDeb()).isEqualTo(expectedObjectTag.getInnDeb());
|
||||
Assertions.assertThat(actualObjectTag.getKppDeb()).isEqualTo(expectedObjectTag.getKppDeb());
|
||||
Assertions.assertThat(actualObjectTag.getAccDeb()).isEqualTo(expectedObjectTag.getAccDeb());
|
||||
Assertions.assertThat(actualObjectTag.getRclientn1()).isEqualTo(expectedObjectTag.getRclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnCred()).isEqualTo(expectedObjectTag.getInnCred());
|
||||
Assertions.assertThat(actualObjectTag.getKppCred()).isEqualTo(expectedObjectTag.getKppCred());
|
||||
Assertions.assertThat(actualObjectTag.getAccKr()).isEqualTo(expectedObjectTag.getAccKr());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif()).isEqualTo(expectedObjectTag.getSpecif());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedObjectTag.getDocNum());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate()).isEqualTo(expectedObjectTag.getDocDate());
|
||||
Assertions.assertThat(actualObjectTag.getDtIn()).isEqualTo(expectedObjectTag.getDtIn());
|
||||
Assertions.assertThat(actualObjectTag.getKtIn()).isEqualTo(expectedObjectTag.getKtIn());
|
||||
Assertions.assertThat(actualObjectTag.getDtOut()).isEqualTo(expectedObjectTag.getDtOut());
|
||||
Assertions.assertThat(actualObjectTag.getKtOut()).isEqualTo(expectedObjectTag.getKtOut());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldReadSDf01XMLFileAndTestHeaders() {
|
||||
ResultContainer actualResultContainer = new ResultContainer(ETable.DF_01,
|
||||
new File(Objects.requireNonNull(getClass()
|
||||
.getClassLoader()
|
||||
.getResource("xml/DF-01_S_PRC1604240915_1.xml")).getFile()));
|
||||
|
||||
StageResult processResult = readXMLFile.process(actualResultContainer);
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("qq");
|
||||
expectedDocumentTag.setMessageType("DF01");
|
||||
expectedDocumentTag.setMessageName("ww");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("БИСКВИТ");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
|
||||
Assertions.assertThat(processResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageId()).isEqualTo(expectedDocumentTag.getMessageId());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo(expectedDocumentTag.getMessageType());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageName()).isEqualTo(expectedDocumentTag.getMessageName());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageDate()).isEqualTo(expectedDocumentTag.getMessageDate());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageTime()).isEqualTo(expectedDocumentTag.getMessageTime());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getSender()).isEqualTo(expectedDocumentTag.getSender());
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getReceiver()).isEqualTo(expectedDocumentTag.getReceiver());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
server.port=8081
|
||||
server.servlet.context-path=/xml-importer
|
||||
spring.main.web-application-type=servlet
|
||||
|
||||
import-xml-service.scheduler.check-src-dir-cron=* * * * 1 ?
|
||||
|
||||
import-xml-service.store.delete-src-files=false
|
||||
import-xml-service.store.src-dir=/opt/clearing/file/xml-importer/
|
||||
import-xml-service.store.out-dir=/opt/clearing/file/xml-importer/loaded/
|
||||
import-xml-service.store.out-dir-error=/opt/clearing/file/xml-importer/error/
|
||||
|
||||
import-xml-service.common.encoding-source=cp866
|
||||
import-xml-service.common.insert-batch-size=100
|
||||
import-xml-service.common.threads-count=10
|
||||
|
||||
#sftpSrcDir
|
||||
import-xml-service.store.sftp-in.sftp-src-pay-val-dir.rub=clearing_xml-importer_sftp/rub/
|
||||
import-xml-service.store.sftp-in.sftp-src-pay-val-dir.eur=clearing_xml-importer_sftp/eur/
|
||||
import-xml-service.store.sftp-in.sftp-src-dir=clearing_xml-importer_sftp
|
||||
import-xml-service.store.sftp-in.user=user
|
||||
import-xml-service.store.sftp-in.password=*********
|
||||
import-xml-service.store.sftp-in.server-ip=127.0.0.1
|
||||
import-xml-service.store.sftp-in.server-port=22
|
||||
|
||||
import-xml-service.hazelcast.cluster-members=127.0.0.1:5701
|
||||
import-xml-service.hazelcast.login=dev
|
||||
import-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
|
||||
import-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
import-xml-service.kafka-producer.acks=all
|
||||
import-xml-service.kafka-producer.retries=0
|
||||
import-xml-service.kafka-producer.batch-size=16384
|
||||
import-xml-service.kafka-producer.linger-ms=1
|
||||
import-xml-service.kafka-producer.buffer-memory=33554432
|
||||
|
||||
import-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
import-xml-service.kafka-consumer.group-id=dev-group-clearing-service
|
||||
import-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
import-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
import-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
import-xml-service.kafka-consumer.linger-ms=1
|
||||
import-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF01" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT CURR_CODE="test1" ACCOUNT="test2" REMAINDER="test3" DEAL="test4" ACC_CODE="test5" DAT="2024-03-14" MARKET="q" ACC_NAME="test7" ACC_TYPE="t8" SUMENGAGE="test9" SUMUNBLOK="test10" FILE_TYPE="1" />
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF04" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT SEG_TYPE="1" DOC_TYPE="test2" DOCNM_REF="test3" DOCNMPREV="test4" C_ACC_DEB="test5" SBANKNAM="test6" C_ACC_CRED="test7" RBANKNAM="test8" PAY_DATE="2024-03-14" PAY_VAL="test9" SUM_DEB="test10" SPECIF_1="test11" IMP_RESULT="t12" />
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF06" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" SUM="10" MARKET="q" TYPE="test4" DEAL="test5" CLIENTN="test6" INN="test7" BIC="test8" SPEC="test9" NUMBER="2" DOC_NUM="t11" DOC_DATE="2024-03-14" PAY_VAL="test12" />
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF52" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" ACC_NAME="test2" DEAL="tes3" DATE="2024-03-14" STATUS="1" ACC_TYPE="t5" />
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF55" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT
|
||||
SEG_TYPE="1"
|
||||
DOC_TYPE="test2"
|
||||
DOCNM_REF="test3"
|
||||
DOCNMPREV="test4"
|
||||
SBANKCODE="test5"
|
||||
C_ACC_DEB="test6"
|
||||
SBANKNAM="test7"
|
||||
RBANKCODE="test8"
|
||||
C_ACC_CRED="test9"
|
||||
RBANKNAM="test10"
|
||||
OP_TYPE="11"
|
||||
OP_ORDER="2"
|
||||
PAY_DATE="2024-03-14"
|
||||
PAY_VAL="test13"
|
||||
SUM_DEB="test14"
|
||||
SCLIENTN="test15"
|
||||
INN_DEB="test16"
|
||||
KPP_DEB="test17"
|
||||
ACC_DEB="test18"
|
||||
RCLIENTN="test19"
|
||||
INN_CRED="test20"
|
||||
KPP_CRED="test21"
|
||||
ACC_KR_1="test22"
|
||||
SPECIF_1="test23"
|
||||
SEND_TYPE="test24"
|
||||
DOC_RESULT="25"
|
||||
DOC_NUM="t26"
|
||||
DOC_DATE="2024-03-15"
|
||||
VALUE_DATE="2024-03-16"
|
||||
SWIFT_BEN="test27"
|
||||
SWIFT_INT="test28"
|
||||
/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DOCUMENT MESSAGEID="qq" MESSAGETYPE="DF57" MESSAGENAME="ww" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31"
|
||||
SENDER="БИСКВИТ" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT
|
||||
ID="1"
|
||||
DEAL_DEB="test2"
|
||||
DEAL_CRED="test3"
|
||||
SBANKCODE="test4"
|
||||
C_ACC_DEB="test5"
|
||||
SBANKNAM="test6"
|
||||
RBANKCODE="test7"
|
||||
C_ACC_CRED="test8"
|
||||
RBANKNAM="test9"
|
||||
OP_TYPE="test10"
|
||||
PAY_DATE="2024-03-15"
|
||||
EXT_DATE="111"
|
||||
PAY_VAL="test11"
|
||||
SUM_DEB="test12"
|
||||
SCLIENTN="test13"
|
||||
INN_DEB="test14"
|
||||
KPP_DEB="test15"
|
||||
ACC_DEB="test16"
|
||||
RCLIENTN="test17"
|
||||
INN_CRED="test18"
|
||||
KPP_CRED="test19"
|
||||
ACC_KR="test20"
|
||||
SPECIF="test21"
|
||||
DOC_NUM="test22"
|
||||
DOC_DATE="2024-03-16"
|
||||
DT_IN="test23"
|
||||
KT_IN="test24"
|
||||
DT_OUT="test25"
|
||||
KT_OUT="test26"
|
||||
/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
Loading…
Add table
Reference in a new issue