Merge branch 'master' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2024-12-16 15:54:34 +01:00
2 changed files with 50 additions and 48 deletions

View File

@@ -131,7 +131,6 @@ public class ExchangeColliImportService {
final Exception[] firstExceptionToThrow = {null}; final Exception[] firstExceptionToThrow = {null};
while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) { while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) {
final LocalDate tempStartDate = startDate; final LocalDate tempStartDate = startDate;
@@ -202,6 +201,10 @@ public class ExchangeColliImportService {
internalMultiDbThread.commitAll(); internalMultiDbThread.commitAll();
exchangeMultiDbThread.commitAll(); exchangeMultiDbThread.commitAll();
} catch (Exception ex) { } catch (Exception ex) {
internalMultiDb.rollbackAll();
exchangeMultiDb.rollbackAll();
MtbColt collo = (MtbColt) dataToSave; MtbColt collo = (MtbColt) dataToSave;
Exception newException = new EntityException("Errore durante l'importazione del collo di " + finalLogType + Exception newException = new EntityException("Errore durante l'importazione del collo di " + finalLogType +
" [num: " + collo.getNumCollo() + ", " + " [num: " + collo.getNumCollo() + ", " +

View File

@@ -1,6 +1,5 @@
package it.integry.ems.system.exchange.service; package it.integry.ems.system.exchange.service;
import it.integry.ems.dto.Result;
import it.integry.ems.javabeans.RequestDataDTO; import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.service.EntityProcessor; import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.Connection; import it.integry.ems.sync.MultiDBTransaction.Connection;
@@ -10,6 +9,7 @@ import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaMana
import it.integry.ems_model.base.EquatableEntityInterface; import it.integry.ems_model.base.EquatableEntityInterface;
import it.integry.ems_model.entity.DtbDocr; import it.integry.ems_model.entity.DtbDocr;
import it.integry.ems_model.entity.DtbDoct; import it.integry.ems_model.entity.DtbDoct;
import it.integry.ems_model.exception.EntityException;
import it.integry.ems_model.exception.MergeEntityDBToObjectException; import it.integry.ems_model.exception.MergeEntityDBToObjectException;
import it.integry.ems_model.types.OperationType; import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query; import it.integry.ems_model.utility.Query;
@@ -105,7 +105,7 @@ public class ExchangeDocumentImportService {
AtomicInteger importedCounter = new AtomicInteger(0); AtomicInteger importedCounter = new AtomicInteger(0);
LocalDate startDate = LocalDate.of(2024, 7, 1); LocalDate startDate = LocalDate.of(2024, 7, 1);
Result<DtbDoct> firstErrorObjectIfPresent = null; final Exception[] firstExceptionToThrow = {null};
while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) { while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) {
@@ -169,11 +169,7 @@ public class ExchangeDocumentImportService {
internalMultiDb.commitAll(); internalMultiDb.commitAll();
exchangeMultiDb.commitAll(); exchangeMultiDb.commitAll();
} catch (Exception ex) { } catch (Exception ex) {
Exception newException = new EntityException("Errore durante l'importazione del documento di " + logType + " [" +
if (firstErrorObjectIfPresent == null) firstErrorObjectIfPresent = new Result.Error<>(ex);
logger.error("Errore durante l'importazione del documento di " + logType + " [" +
"num: " + document.getNumDoc() + ", " + "num: " + document.getNumDoc() + ", " +
"serie: " + document.getSerDoc() + ", " + "serie: " + document.getSerDoc() + ", " +
"data: " + document.getDataDoc() + ", " + "data: " + document.getDataDoc() + ", " +
@@ -182,13 +178,16 @@ public class ExchangeDocumentImportService {
internalMultiDb.rollbackAll(); internalMultiDb.rollbackAll();
exchangeMultiDb.rollbackAll(); exchangeMultiDb.rollbackAll();
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = newException;
logger.error(newException);
} }
} }
} }
if (firstErrorObjectIfPresent != null) throw ((Result.Error) firstErrorObjectIfPresent).getError(); if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
} finally { } finally {
if (useTempTable) if (useTempTable)
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), schemaType); exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), schemaType);