account-service http://jira.mfd.msk:8088/browse/CLS-489 продолжение обработки до SDF_53, добавил имя входного файла для запроса генерации квитанций DF-53
This commit is contained in:
parent
f54efc6b2b
commit
f95f1f241d
1 changed files with 11 additions and 8 deletions
|
|
@ -20,10 +20,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SDFProcessService {
|
public class SDFProcessService {
|
||||||
|
|
@ -70,6 +67,7 @@ public class SDFProcessService {
|
||||||
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
||||||
boolean txOk = false;
|
boolean txOk = false;
|
||||||
imdgTransaction.beginTransaction();
|
imdgTransaction.beginTransaction();
|
||||||
|
HashSet<String> fileNames = new HashSet<>();
|
||||||
try { // 2. обновление данных, в транзакции
|
try { // 2. обновление данных, в транзакции
|
||||||
Imdg<SDf53> sdf53Imdg = imdgTransaction.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
Imdg<SDf53> sdf53Imdg = imdgTransaction.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
||||||
|
|
||||||
|
|
@ -77,6 +75,7 @@ public class SDFProcessService {
|
||||||
for (Triple<SDf52, Account, String> item : toProcessSDF53) {
|
for (Triple<SDf52, Account, String> item : toProcessSDF53) {
|
||||||
SDf53 sDf53 = createBy(item.getLeft(), item.getRight(), now, generationId);
|
SDf53 sDf53 = createBy(item.getLeft(), item.getRight(), now, generationId);
|
||||||
sdf53Imdg.insert(sDf53);
|
sdf53Imdg.insert(sDf53);
|
||||||
|
fileNames.add(item.getLeft().getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
txOk = true;
|
txOk = true;
|
||||||
|
|
@ -89,8 +88,12 @@ public class SDFProcessService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Send export command for SDF53 generationId={}", generationId);
|
if (fileNames.size() > 1)
|
||||||
messageStatementToExport53(generationId);
|
log.warn("generationId={}, too many different file names in S_DF52: {}", generationId, fileNames);
|
||||||
|
String fileNameSingle = fileNames.stream().filter(Objects::nonNull).findAny().orElse(null);
|
||||||
|
log.info("Send export command for SDF53 generationId={} with source file name {}",
|
||||||
|
generationId, (fileNameSingle == null ? null : "\"" + fileNameSingle + "\""));
|
||||||
|
messageStatementToExport53(generationId, fileNameSingle);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDf53 createBy(SDf52 sdf52, String result, Instant now, Long newGenerationId) {
|
SDf53 createBy(SDf52 sdf52, String result, Instant now, Long newGenerationId) {
|
||||||
|
|
@ -130,12 +133,12 @@ public class SDFProcessService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void messageStatementToExport53(Long groupId) {
|
void messageStatementToExport53(Long groupId, String fileName) {
|
||||||
final String destination = Consts.EXPORT_PROCESS; // dbf-exporter
|
final String destination = Consts.EXPORT_PROCESS; // dbf-exporter
|
||||||
ExportToFileRequest request = new ExportToFileRequest();
|
ExportToFileRequest request = new ExportToFileRequest();
|
||||||
request.setNameOfTable("DF-53"); // SdfTable.SDF_53
|
request.setNameOfTable("DF-53"); // SdfTable.SDF_53
|
||||||
request.setSdfGroupId(groupId);
|
request.setSdfGroupId(groupId);
|
||||||
request.setFileName(null);
|
request.setFileName(fileName);
|
||||||
Long msgId = kafkaSender.sendRequestToQueue(destination, request);
|
Long msgId = kafkaSender.sendRequestToQueue(destination, request);
|
||||||
log.debug("Send ExportToFileRequest({}, {}) message id={} to kafka \"{}\"",
|
log.debug("Send ExportToFileRequest({}, {}) message id={} to kafka \"{}\"",
|
||||||
groupId, request.getNameOfTable(), msgId, destination);
|
groupId, request.getNameOfTable(), msgId, destination);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue