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