Merge branch 'master' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@@ -57,8 +57,8 @@ public class ExchangeColliImportService {
|
||||
private SetupGest setupGest;
|
||||
|
||||
public void importLavorazione(MultiDBTransactionManager internalMultiDb,
|
||||
MultiDBTransactionManager exchangeMultiDb,
|
||||
RequestDataDTO requestDataDTO) throws Exception {
|
||||
MultiDBTransactionManager exchangeMultiDb,
|
||||
RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
this.internalImport(internalMultiDb, exchangeMultiDb, requestDataDTO, ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione);
|
||||
}
|
||||
@@ -72,8 +72,8 @@ public class ExchangeColliImportService {
|
||||
|
||||
|
||||
public void importVendita(MultiDBTransactionManager internalMultiDb,
|
||||
MultiDBTransactionManager exchangeMultiDb,
|
||||
RequestDataDTO requestDataDTO) throws Exception {
|
||||
MultiDBTransactionManager exchangeMultiDb,
|
||||
RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
this.internalImport(internalMultiDb, exchangeMultiDb, requestDataDTO, ExchangeImportSchemaManagerService.SchemaType.ColliVendita);
|
||||
}
|
||||
@@ -131,7 +131,6 @@ public class ExchangeColliImportService {
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
|
||||
|
||||
while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) {
|
||||
|
||||
final LocalDate tempStartDate = startDate;
|
||||
@@ -173,45 +172,49 @@ public class ExchangeColliImportService {
|
||||
|
||||
String finalLogType = logType;
|
||||
|
||||
logger.debug("Importati {} colli di " + finalLogType + " di {}", importedCounter.incrementAndGet(), dataCount);
|
||||
try (MultiDBTransactionManager exchangeMultiDbThread = new MultiDBTransactionManager(exchangeMultiDb.getPrimaryDatasource().getProfile(), false);
|
||||
MultiDBTransactionManager internalMultiDbThread = new MultiDBTransactionManager(internalMultiDb.getPrimaryDatasource().getProfile(), false)) {
|
||||
logger.debug("Importati {} colli di " + finalLogType + " di {}", importedCounter.incrementAndGet(), dataCount);
|
||||
try (MultiDBTransactionManager exchangeMultiDbThread = new MultiDBTransactionManager(exchangeMultiDb.getPrimaryDatasource().getProfile(), false);
|
||||
MultiDBTransactionManager internalMultiDbThread = new MultiDBTransactionManager(internalMultiDb.getPrimaryDatasource().getProfile(), false)) {
|
||||
|
||||
MtbColt mtbColtToSave = (MtbColt) dataToSave;
|
||||
if (mtbColtToSave.hasDocument() && mtbColtToSave.getOperation() == OperationType.DELETE) {
|
||||
MtbColt mtbColtRemoveDocument = (MtbColt) mtbColtToSave.clone();
|
||||
mtbColtRemoveDocument.setMtbColr(new ArrayList<>())
|
||||
.setCodDtip(EmsRestConstants.NULL)
|
||||
.setSerDoc(EmsRestConstants.NULL)
|
||||
.setDataDoc(EmsRestConstants.DATE_NULL)
|
||||
.setNumDoc(EmsRestConstants.INTEGER_NULL)
|
||||
.setOperation(OperationType.UPDATE);
|
||||
MtbColt mtbColtToSave = (MtbColt) dataToSave;
|
||||
if (mtbColtToSave.hasDocument() && mtbColtToSave.getOperation() == OperationType.DELETE) {
|
||||
MtbColt mtbColtRemoveDocument = (MtbColt) mtbColtToSave.clone();
|
||||
mtbColtRemoveDocument.setMtbColr(new ArrayList<>())
|
||||
.setCodDtip(EmsRestConstants.NULL)
|
||||
.setSerDoc(EmsRestConstants.NULL)
|
||||
.setDataDoc(EmsRestConstants.DATE_NULL)
|
||||
.setNumDoc(EmsRestConstants.INTEGER_NULL)
|
||||
.setOperation(OperationType.UPDATE);
|
||||
|
||||
entityProcessor.processEntity(mtbColtRemoveDocument, true, true, EXCHANGE_USER, internalMultiDbThread, requestDataDTO);
|
||||
entityProcessor.processEntity(mtbColtRemoveDocument, true, true, EXCHANGE_USER, internalMultiDbThread, requestDataDTO);
|
||||
|
||||
mtbColtToSave.setCodDtip(null)
|
||||
.setSerDoc(null)
|
||||
.setDataDoc(null)
|
||||
.setNumDoc(null);
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(mtbColtToSave, true, true, EXCHANGE_USER, internalMultiDbThread, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), mtbColtToSave, testataTableName, useTempTable);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), mtbColtToSave, righeTableName, useTempTable);
|
||||
|
||||
internalMultiDbThread.commitAll();
|
||||
exchangeMultiDbThread.commitAll();
|
||||
} catch (Exception ex) {
|
||||
MtbColt collo = (MtbColt) dataToSave;
|
||||
Exception newException = new EntityException("Errore durante l'importazione del collo di " + finalLogType +
|
||||
" [num: " + collo.getNumCollo() + ", " +
|
||||
"data: " + UtilityLocalDate.formatDate(collo.getDataCollo(), CommonConstants.DATE_FORMAT_DMY) + ", " +
|
||||
"serie: " + collo.getSerCollo() + ", " +
|
||||
"gestione: " + collo.getGestione() + "]", ex);
|
||||
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = newException;
|
||||
logger.error(newException);
|
||||
mtbColtToSave.setCodDtip(null)
|
||||
.setSerDoc(null)
|
||||
.setDataDoc(null)
|
||||
.setNumDoc(null);
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(mtbColtToSave, true, true, EXCHANGE_USER, internalMultiDbThread, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), mtbColtToSave, testataTableName, useTempTable);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), mtbColtToSave, righeTableName, useTempTable);
|
||||
|
||||
internalMultiDbThread.commitAll();
|
||||
exchangeMultiDbThread.commitAll();
|
||||
} catch (Exception ex) {
|
||||
|
||||
internalMultiDb.rollbackAll();
|
||||
exchangeMultiDb.rollbackAll();
|
||||
|
||||
MtbColt collo = (MtbColt) dataToSave;
|
||||
Exception newException = new EntityException("Errore durante l'importazione del collo di " + finalLogType +
|
||||
" [num: " + collo.getNumCollo() + ", " +
|
||||
"data: " + UtilityLocalDate.formatDate(collo.getDataCollo(), CommonConstants.DATE_FORMAT_DMY) + ", " +
|
||||
"serie: " + collo.getSerCollo() + ", " +
|
||||
"gestione: " + collo.getGestione() + "]", ex);
|
||||
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = newException;
|
||||
logger.error(newException);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.dto.Result;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
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.entity.DtbDocr;
|
||||
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.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
@@ -105,7 +105,7 @@ public class ExchangeDocumentImportService {
|
||||
AtomicInteger importedCounter = new AtomicInteger(0);
|
||||
|
||||
LocalDate startDate = LocalDate.of(2024, 7, 1);
|
||||
Result<DtbDoct> firstErrorObjectIfPresent = null;
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) {
|
||||
|
||||
@@ -169,11 +169,7 @@ public class ExchangeDocumentImportService {
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
|
||||
|
||||
if (firstErrorObjectIfPresent == null) firstErrorObjectIfPresent = new Result.Error<>(ex);
|
||||
|
||||
logger.error("Errore durante l'importazione del documento di " + logType + " [" +
|
||||
Exception newException = new EntityException("Errore durante l'importazione del documento di " + logType + " [" +
|
||||
"num: " + document.getNumDoc() + ", " +
|
||||
"serie: " + document.getSerDoc() + ", " +
|
||||
"data: " + document.getDataDoc() + ", " +
|
||||
@@ -182,13 +178,16 @@ public class ExchangeDocumentImportService {
|
||||
|
||||
internalMultiDb.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 {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), schemaType);
|
||||
|
||||
Reference in New Issue
Block a user