Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -61,7 +61,7 @@ public class BasicConnectionPool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeConnections() throws Exception {
|
private void initializeConnections() {
|
||||||
final List<AvailableConnectionsModel> availableConnections =
|
final List<AvailableConnectionsModel> availableConnections =
|
||||||
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||||
|
|
||||||
@@ -111,15 +111,9 @@ public class BasicConnectionPool {
|
|||||||
|
|
||||||
private void registerDataSourceIfNotExists(AvailableConnectionsModel connectionModel) throws Exception {
|
private void registerDataSourceIfNotExists(AvailableConnectionsModel connectionModel) throws Exception {
|
||||||
String dbName = connectionModel.getDbName();
|
String dbName = connectionModel.getDbName();
|
||||||
registeredDatasources.computeIfAbsent(dbName, k -> {
|
if (!registeredDatasources.containsKey(dbName)) {
|
||||||
try {
|
registeredDatasources.put(dbName, createNewDataSource(connectionModel));
|
||||||
return createNewDataSource(connectionModel);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Errore creazione lazy DataSource per {}", dbName, e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -52,11 +52,13 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
|||||||
public MultiDBTransactionManager() {
|
public MultiDBTransactionManager() {
|
||||||
connectionPool = ApplicationContextProvider.getApplicationContext().getBean(BasicConnectionPool.class);
|
connectionPool = ApplicationContextProvider.getApplicationContext().getBean(BasicConnectionPool.class);
|
||||||
settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
||||||
|
emsDBConst = ApplicationContextProvider.getApplicationContext().getBean(EmsDBConst.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiDBTransactionManager(BasicConnectionPool connectionPool) throws Exception {
|
public MultiDBTransactionManager(BasicConnectionPool connectionPool) throws Exception {
|
||||||
this.connectionPool = connectionPool;
|
this.connectionPool = connectionPool;
|
||||||
settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
||||||
|
emsDBConst = ApplicationContextProvider.getApplicationContext().getBean(EmsDBConst.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiDBTransactionManager(AvailableConnectionsModel connectionsModel) throws Exception {
|
public MultiDBTransactionManager(AvailableConnectionsModel connectionsModel) throws Exception {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class Slim2kLogisticController {
|
|||||||
List<ServiceRestResponse> list = new ArrayList<ServiceRestResponse>();
|
List<ServiceRestResponse> list = new ArrayList<ServiceRestResponse>();
|
||||||
try {
|
try {
|
||||||
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
||||||
|
multiDBTransactionManager.setPrimaryDB(configuration);
|
||||||
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiCarico(scode, dcode, docdate, docnum, refdoc)));
|
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiCarico(scode, dcode, docdate, docnum, refdoc)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ public class Slim2kLogisticService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try (MultiDBTransactionManager dsSlim2k = new MultiDBTransactionManager(profileSlim2k)) {
|
try (MultiDBTransactionManager dsSlim2k = new MultiDBTransactionManager(profileSlim2k)) {
|
||||||
|
HashMap<String, Object> lista = new HashMap<>();
|
||||||
if (!UtilityString.isNullOrEmpty(refdoc)) {
|
if (!UtilityString.isNullOrEmpty(refdoc)) {
|
||||||
String sql = "SELECT DISTINCT scode,"
|
String sql = "SELECT DISTINCT scode,"
|
||||||
+ " docnum,"
|
+ " docnum,"
|
||||||
@@ -403,13 +404,16 @@ public class Slim2kLogisticService {
|
|||||||
+ " FROM documents_export "
|
+ " FROM documents_export "
|
||||||
+ " WHERE refdoc = " + UtilityDB.valueToString(refdoc);
|
+ " WHERE refdoc = " + UtilityDB.valueToString(refdoc);
|
||||||
|
|
||||||
HashMap<String, Object> lista = UtilityDB.executeSimpleQueryOnlyFirstRow(dsSlim2k.getPrimaryConnection(), sql);
|
lista = UtilityDB.executeSimpleQueryOnlyFirstRow(dsSlim2k.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
|
|
||||||
if (UtilityHashMap.isPresent(lista)) {
|
if (UtilityHashMap.isPresent(lista)) {
|
||||||
scode = ((String) lista.get("scode")).trim();
|
scode = ((String) lista.get("scode")).trim();
|
||||||
docnum = ((String) lista.get("docnum")).trim();
|
docnum = ((String) lista.get("docnum")).trim();
|
||||||
docDate = ((String) lista.get("docdate")).trim();
|
docDate = ((String) lista.get("docdate")).trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String whereCond = "";
|
String whereCond = "";
|
||||||
if (!UtilityString.isNullOrEmpty(scode)) {
|
if (!UtilityString.isNullOrEmpty(scode)) {
|
||||||
whereCond = "trim(documents_export.scode) = " + UtilityDB.valueToString(scode);
|
whereCond = "trim(documents_export.scode) = " + UtilityDB.valueToString(scode);
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ public class BilanceService {
|
|||||||
UtilityEntity.throwEntitiesException(entityList);
|
UtilityEntity.throwEntitiesException(entityList);
|
||||||
|
|
||||||
// Move a file to imported directory
|
// Move a file to imported directory
|
||||||
File importedFile = new File(pathFileImported + File.separator + fileName);
|
// File importedFile = new File(pathFileImported + File.separator + fileName);
|
||||||
FileUtils.moveFile(file, importedFile);
|
// FileUtils.moveFile(file, importedFile);
|
||||||
|
|
||||||
returnList.addAll(entityList);
|
returnList.addAll(entityList);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user