diff --git a/clearing-parent/xml-exporter/.idea/dataSources.xml b/clearing-parent/xml-exporter/.idea/dataSources.xml
new file mode 100644
index 000000000..18cfcb9cf
--- /dev/null
+++ b/clearing-parent/xml-exporter/.idea/dataSources.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ postgresql
+ true
+ org.postgresql.Driver
+ jdbc:postgresql://localhost:5433/clearing
+
+
+
+
+
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/exceptions/ConfigException.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/exceptions/ConfigException.java
deleted file mode 100644
index 8c100ef35..000000000
--- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/exceptions/ConfigException.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package ru.spcex.clearing.xml.exporter.exceptions;
-
-public class ConfigException extends RuntimeException {
- public ConfigException(String msg) { super(msg); }
- public ConfigException(String msg, Throwable cause) { super(msg, cause); }
-}
diff --git a/clearing-parent/xml-importer/.idea/uiDesigner.xml b/clearing-parent/xml-importer/.idea/uiDesigner.xml
new file mode 100644
index 000000000..2b63946d5
--- /dev/null
+++ b/clearing-parent/xml-importer/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ChangeDirOfFileStage.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ChangeDirOfFileStage.java
index 0f1f1db31..a61c716de 100644
--- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ChangeDirOfFileStage.java
+++ b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ChangeDirOfFileStage.java
@@ -26,6 +26,7 @@ public class ChangeDirOfFileStage {
}
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)) {
@@ -38,6 +39,7 @@ public class ChangeDirOfFileStage {
if (!srcDir.exists()) {
log.error("SettlementHouse_DocIn does not exists!");
+ notifyWithCode(resultContainer, StageResult.ERROR);
return StageResult.ERROR;
}
if (!outDir.exists()) {
@@ -46,11 +48,13 @@ public class ChangeDirOfFileStage {
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();
@@ -59,13 +63,20 @@ public class ChangeDirOfFileStage {
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);
+ }
}
diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java
index d945e0ce4..4ff270476 100644
--- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java
+++ b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java
@@ -36,6 +36,7 @@ public class ImportToDB {
}
public StageResult process(ResultContainer resultContainer) {
+ log.info("uuid {}. Stage: Import to DB", resultContainer.getUuid());
ETable currTable = resultContainer.getXmlTable();
File xmlFile = resultContainer.getXmlFile();
DocumentTag documentTag;
@@ -45,6 +46,7 @@ public class ImportToDB {
} catch (IOException e) {
log.error(ExceptionUtils.getStackTrace(e));
kafkaMessenger.notifyUserAboutErrorParsing(e, resultContainer);
+ log.info("uuid {}. Stage import to DB finished with status {}", resultContainer.getUuid(), StageResult.ERROR);
return StageResult.ERROR;
}
@@ -71,6 +73,7 @@ public class ImportToDB {
kafkaMessenger.notifySystemIfNeeded(currTable, fileId);
kafkaMessenger.notifyUserAboutSuccessLoad(resultContainer);
+ log.info("uuid {}. Stage import to DB finished with status {}", resultContainer.getUuid(), StageResult.OK);
return StageResult.OK;
}
}
diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/services/XMLImporterService.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/services/XMLImporterService.java
index 76cad50da..7d96d4442 100644
--- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/services/XMLImporterService.java
+++ b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/services/XMLImporterService.java
@@ -54,11 +54,7 @@ public class XMLImporterService {
}
public void processTable(ETable specificTable) {
- if (specificTable == null) {
- log.trace("adding import task");
- } else {
- log.info("adding import task {}", specificTable);
- }
+ log.info("adding import task {}", specificTable == null ? "without specific table" : specificTable);
//fileChecker.checkAndLoadSFTP();
executorService.execute(() -> {
@@ -91,14 +87,8 @@ public class XMLImporterService {
log.info("uuid {}. Task started", task.getUuid());
long startMills = System.currentTimeMillis();
-
- log.info("uuid {}. Stage: Import to DB", task.getUuid());
task.setLastStageStatus(importToDB.process(task));
- log.info("uuid {}. Stage import to DB finished with status {}", task.getUuid(), task.getLastStageStatus());
- log.info("uuid {}. Stage: Change directory of file", task.getUuid());
task.setLastStageStatus(changeDirOfFileStage.process(task));
- log.info("uuid {}. Stage change directory of file finished with status {}", task.getUuid(), task.getLastStageStatus());
-
long endMills = System.currentTimeMillis();
log.info("uuid {}. Task completed, result: {}, time working: {} ms",
task.getUuid(),