Finish Hotfix-100
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit

This commit is contained in:
2025-04-17 15:12:24 +02:00
3 changed files with 137 additions and 169 deletions

View File

@@ -8,6 +8,7 @@ import it.integry.ems.properties.EmsProperties;
import it.integry.ems.response.EsitoType;
import it.integry.ems.response.FileItem;
import it.integry.ems.response.ServiceRestResponse;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.utility.UtilityString;
@@ -192,20 +193,18 @@ public class EmailWatcherListener extends TimerTask {
private void notifyErrorToEmail(String emailListen, String mittente, String messageObj, Date messageDate,
String emailDbg, String errorMessage) throws Exception {
if (!UtilityString.isNullOrEmpty(emailDbg)) {
DataSource ds = new DataSource();
ds.initialize(emailListenerInfo.getDatabase());
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(emailListenerInfo.getDatabase())) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
String nomeAzienda = "";
PreparedStatement ps = ds.getConnection().prepareStatement("select nome_ditta from azienda");
PreparedStatement ps = mdb.prepareStatement("select nome_ditta from azienda");
ResultSet rs = ps.executeQuery();
if (rs.next()) {
nomeAzienda = rs.getString("nome_ditta");
}
rs.close();
ps.close();
ds.forceClose();
String htmlMailBody = "Gentile Amministratore,<br> si e' verificato il seguente errore <br><b>" + errorMessage + "</b><br> del servizio " + emailListenerInfo.getServiceRest() +
"<br> in ascolto sulla mail " + emailListen + " provocato dal messaggio (mittente " + mittente + ") con oggetto " + messageObj + " in data " + sdf.format(messageDate);
@@ -255,5 +254,6 @@ public class EmailWatcherListener extends TimerTask {
});
}
}
}
}

View File

@@ -524,35 +524,6 @@ public class OrdiniAcquistoExportServices {
}
public EntityExportResponse exportOrdiniVendita(String type, String format) throws Exception {
Connection connection = multiDBTransactionManager.getPrimaryConnection();
DataSource dsSlim2k = new DataSource();
Map<String, String> setup = setupGest.getImportSetupSection(connection, type, format);
EntityExportResponse<List<File>> entityExportResponse = new EntityExportResponse<List<File>>();
String profileSlim2k = setup.get("PROFILE");
if (UtilityString.isNullOrEmpty(profileSlim2k)) {
throw new Exception("Profile non configurato per la procedura di importazione liste di scarico SLIM2K");
}
try {
dsSlim2k.initialize(profileSlim2k);
String listaSingoloOrdine = setup.get("LISTA_SINGOLO_ORDINE");
} catch (Exception e) {
throw e;
} finally {
if (!dsSlim2k.isClosed()) {
dsSlim2k.forceClose();
}
}
return entityExportResponse;
}
public EntityExportResponse exportOrdiniSlim2K(String type, String format) throws Exception {
EntityExportResponse<List<File>> entityExportResponse = new EntityExportResponse<List<File>>();

View File

@@ -92,15 +92,12 @@ public class ProductServices {
public List<MtbAart> exportArtDialogo(String whereCond) throws Exception {
//PROCEDURA DI IMPORTAZIONE ARTICOLI FORMAT - CARELLI
String query;
FileItem fileItem;
DataSource dsArticoli = new DataSource();
HashMap<String, String> setup = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), "w_marti_rc", "DIALOGO");
String profileDbArt = setup.get("PROFILE_DB");
dsArticoli.initialize(profileDbArt);
try(MultiDBTransactionManager mdb = new MultiDBTransactionManager(profileDbArt)) {
String queryArticoli =
"SELECT mtb_aart.cod_mart " +
@@ -113,7 +110,7 @@ public class ProductServices {
sql = UtilityDB.addwhereCond(sql, "mtb_aart.cod_mart IN (" + queryArticoli + ") ", false);
ResultSetMapper rsArt = new ResultSetMapper();
List<MtbAart> articoli = rsArt.mapQuerySetToList(dsArticoli.getConnection(), sql, MtbAart.class, OperationType.SELECT_OBJECT);
List<MtbAart> articoli = rsArt.mapQuerySetToList(mdb.getPrimaryConnection(), sql, MtbAart.class, OperationType.SELECT_OBJECT);
if (articoli == null || articoli.isEmpty()) {
throw new Exception("Nessun articolo trovato");
@@ -127,7 +124,7 @@ public class ProductServices {
"WHERE mtb_aart_bar_code.cod_mart IN (" + queryArticoli + ") ";
ResultSetMapper rsBarcode = new ResultSetMapper();
List<MtbAartBarCode> barcode = rsBarcode.mapQuerySetToList(dsArticoli.getConnection(), sql, MtbAartBarCode.class, OperationType.SELECT_OBJECT);
List<MtbAartBarCode> barcode = rsBarcode.mapQuerySetToList(mdb.getPrimaryConnection(), sql, MtbAartBarCode.class, OperationType.SELECT_OBJECT);
sql =
"SELECT mtb_lisa.cod_mart, " +
@@ -139,11 +136,11 @@ public class ProductServices {
" WHERE mtb_lisa.cod_mart IN (" + queryArticoli + ") ";
List<MtbLisa> listini = rsBarcode.mapQuerySetToList(dsArticoli.getConnection(), sql, MtbLisa.class, OperationType.SELECT_OBJECT);
List<MtbLisa> listini = rsBarcode.mapQuerySetToList(mdb.getPrimaryConnection(), sql, MtbLisa.class, OperationType.SELECT_OBJECT);
sql = "SELECT where_cond_sql FROM stb_subscription WHERE user_name = " + UtilityDB.valueToString(multiDBTransactionManager.getPrimaryDatasource().getDbName());
String whereCondSync = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(dsArticoli.getConnection(), sql);
String whereCondSync = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(mdb.getPrimaryConnection(), sql);
if (!UtilityString.isNullOrEmpty(whereCondSync) && !listini.isEmpty()) {
List<MtbLisa> myObjs = new ArrayList<>();
@@ -178,9 +175,9 @@ public class ProductServices {
}
}
return articoli;
}
}
private String exportArtDialogoExclude(String[] elencoCampi, String nomeCampo) {
if (Stream.of(elencoCampi).filter(x -> x.equalsIgnoreCase(nomeCampo)).count() > 0) {
@@ -784,11 +781,10 @@ public class ProductServices {
public void popolaTabellaRiassegnazione() throws Exception {
String profileDB = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "w_mriassegna_costo_dlg", "TABELLA COSTI", "PROFILE_DB");
try(MultiDBTransactionManager mdb = new MultiDBTransactionManager(profileDB)) {
Connection conn = null;
if (!UtilityString.isNullOrEmpty(profileDB) && !profileDB.equalsIgnoreCase(multiDBTransactionManager.getPrimaryDatasource().getProfile())) {
DataSource ds = new DataSource();
ds.initialize(profileDB);
conn = ds.getConnection();
conn = mdb.getPrimaryConnection();
} else {
conn = multiDBTransactionManager.getPrimaryConnection();
}
@@ -796,6 +792,7 @@ public class ProductServices {
cs.execute();
cs.close();
}
}
public void aggCostiDaTabella(Date dataIniz, Date dataFine, String whereCond) throws Exception {
HashMap<String, String> setup = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), "w_mriassegna_costo_dlg", "TABELLA COSTI");