Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-04-01 11:02:59 +02:00
2 changed files with 14 additions and 16 deletions

View File

@@ -13,12 +13,13 @@ 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;
import it.integry.ems_model.utility.UtilityLocalDate;
import it.integry.ems_model.utility.UtilityDB;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
@@ -101,18 +102,21 @@ public class ExchangeDocumentImportService {
testataTableName = null;
}
String sqlDistinctDates = "SELECT DISTINCT CAST(data_doc AS DATE) FROM " + testataTableName + (useTempTable ? "_tmp" : "");
List<Date> testataDates = UtilityDB.executeSimpleQueryOnlyFirstColumn(exchangeMultiDb.getPrimaryConnection(), sqlDistinctDates);
List<LocalDate> testataLocalDates = testataDates.stream().map(Date::toLocalDate).sorted().collect(Collectors.toList());
AtomicInteger dataCount = new AtomicInteger(0);
AtomicInteger importedCounter = new AtomicInteger(0);
LocalDate startDate = LocalDate.of(2024, 7, 1);
final Exception[] firstExceptionToThrow = {null};
while (startDate.minusDays(1).isBefore(UtilityLocalDate.getNow())) {
for (LocalDate date : testataLocalDates) {
final LocalDate tempStartDate = startDate;
final LocalDate tempEndDate = startDate;
startDate = startDate.plusDays(1);
final LocalDate tempStartDate = date;
final LocalDate tempEndDate = date;
final List<DtbDoct> exchangeImportedTestateData = retrieveDocumenti(
exchangeMultiDb.getPrimaryConnection(),
@@ -135,10 +139,6 @@ public class ExchangeDocumentImportService {
dataCount.addAndGet(allTestateData.size());
// allTestateData = allTestateData.stream()
// .filter(x -> ((DtbDoct)x).getNumDoc() == 2428 && ((DtbDoct)x).getSerDoc().equalsIgnoreCase("A1"))
// .collect(Collectors.toList());
for (EquatableEntityInterface dataToSave : allTestateData) {
DtbDoct document = (DtbDoct) dataToSave;

View File

@@ -103,9 +103,9 @@ public class ExchangeOrdiniImportService {
}
String sqlDistinctDates = "SELECT DISTINCT CAST(data_ord AS DATE) FROM " + testataTableName + (useTempTable ? "_tmp" : "");
List<Date> mtbColtDates = UtilityDB.executeSimpleQueryOnlyFirstColumn(exchangeMultiDb.getPrimaryConnection(), sqlDistinctDates);
List<Date> testataDates = UtilityDB.executeSimpleQueryOnlyFirstColumn(exchangeMultiDb.getPrimaryConnection(), sqlDistinctDates);
List<LocalDate> dates = mtbColtDates.stream().map(Date::toLocalDate).sorted().collect(Collectors.toList());
List<LocalDate> testataLocalDates = testataDates.stream().map(Date::toLocalDate).sorted().collect(Collectors.toList());
AtomicInteger dataCount = new AtomicInteger(0);
@@ -113,13 +113,11 @@ public class ExchangeOrdiniImportService {
Result<DtbOrdt> firstErrorObjectIfPresent = null;
for (LocalDate date : dates) {
for (LocalDate date : testataLocalDates) {
final LocalDate tempStartDate = date;
final LocalDate tempEndDate = date;
date = date.plusDays(1);
final List<DtbOrdt> exchangeImportedMtbColts = retrieveOrdini(
exchangeMultiDb.getPrimaryConnection(),
tempStartDate,