Finish Hotfix-1
This commit is contained in:
@@ -126,20 +126,28 @@ public class ExchangeDocumentImportService {
|
||||
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
|
||||
DtbDoct document = (DtbDoct) dataToSave;
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} documenti di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
//Inserisco prima la testata perché se inserisco testata+righe e la testata ha INSERT,
|
||||
// le righe vengono salvate con ID riga calcolato e non con ID riga passato
|
||||
DtbDoct cloneDocument = (DtbDoct) document.clone();
|
||||
cloneDocument.setDtbDocr(new ArrayList<>());
|
||||
entityProcessor.processEntity(cloneDocument, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (DtbDoct) dataToSave, useTempTable);
|
||||
//multiDBTransactionManager.commitAll();
|
||||
|
||||
if(!document.getDtbDocr().isEmpty()) {
|
||||
document.setOperation(OperationType.NO_OP);
|
||||
entityProcessor.processEntity(document, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), document.getDtbDocr(), useTempTable);
|
||||
}
|
||||
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
DtbDoct document = (DtbDoct) dataToSave;
|
||||
logger.error("Errore durante l'importazione del documento [" +
|
||||
"num: " + document.getNumDoc() + ", " +
|
||||
"serie: " + document.getSerDoc() + ", " +
|
||||
@@ -220,9 +228,10 @@ public class ExchangeDocumentImportService {
|
||||
}};
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "dtb_doct_lav", importedKey, useTempTable);
|
||||
}
|
||||
|
||||
|
||||
final List<HashMap<String, Object>> importedRowKeys = importedDtbDoct.getDtbDocr().stream()
|
||||
private void singleUpdateImported(Connection connection, List<DtbDocr> importedDtbDocr, boolean useTempTable) throws Exception {
|
||||
final List<HashMap<String, Object>> importedRowKeys = importedDtbDocr.stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("data_doc", x.getDataDoc());
|
||||
put("ser_doc", x.getSerDoc());
|
||||
@@ -232,7 +241,6 @@ public class ExchangeDocumentImportService {
|
||||
put("id_riga", x.getIdRiga());
|
||||
}}).collect(Collectors.toList());
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "dtb_docr_lav", importedRowKeys, useTempTable);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user