This commit is contained in:
parent
1442ab6c50
commit
0e9deb8ab0
3 changed files with 4 additions and 4 deletions
|
|
@ -58,7 +58,7 @@ public class FileService {
|
|||
|
||||
public static void checkDir(Path dir) {
|
||||
if (!dir.toFile().exists() || !dir.toFile().isDirectory()) {
|
||||
throw new IllegalStateException("directory " + dir + " is not a directory");
|
||||
throw new IllegalStateException("'" + dir + "' is not a directory");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public class TroProcessor<T> {
|
|||
while ((line = reader.readLine()) != null) {
|
||||
lineNumber++;
|
||||
|
||||
// быстрый skip пустых строк
|
||||
if (line.isBlank()) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -35,8 +34,7 @@ public class TroProcessor<T> {
|
|||
result.add(parsed);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(
|
||||
"Failed to parse TRO line " + lineNumber + ": " + line,
|
||||
e
|
||||
"Failed to parse TRO line " + lineNumber + ": " + line, e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.misc.SOrders;
|
||||
import ru.spcex.clearing.csv.importer.component.FileService;
|
||||
import static ru.spcex.clearing.csv.importer.component.FileService.checkDir;
|
||||
import ru.spcex.clearing.csv.importer.component.tro.data.SOrder;
|
||||
import ru.spcex.clearing.csv.importer.component.tro.parser.TroParserType;
|
||||
import ru.spcex.clearing.csv.importer.component.tro.processor.TroProcessor;
|
||||
|
|
@ -38,6 +39,7 @@ public class SOrdersScheduler {
|
|||
@Autowired
|
||||
public SOrdersScheduler(CsvImporterSettings settings, FileService fileService, TroProcessorProvider provider, ImdgProvider imdgProvider, KafkaSender kafkaSender) {
|
||||
this.importDir = Path.of(settings.getSrcDir());
|
||||
checkDir(importDir);
|
||||
this.fileService = fileService;
|
||||
this.processor = provider.createProcessor(TroParserType.SOrder, SOrder.class);
|
||||
this.sOrderImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SOrders, SOrders.class);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue