Finish Hotfix-72
This commit is contained in:
@@ -598,15 +598,13 @@ public class EmsController {
|
||||
@RequestParam(value = EmsRestConstants.TYPE) String importType,
|
||||
@RequestParam(value = EmsRestConstants.FORMAT) String importFormat,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||
@RequestBody(required = false) ImportRequestDTO requestBody) {
|
||||
@RequestBody(required = false) ImportRequestDTO requestBody) throws Exception {
|
||||
|
||||
ServiceRestResponse response;
|
||||
|
||||
try {
|
||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(importType, importFormat, requestBody, headless);
|
||||
List<EntityBase> entities = importResponse.getResponse();
|
||||
|
||||
|
||||
ServiceRestResponse response;
|
||||
if (entities != null && entities.size() > 0 && Stream.of(entities).anyMatch(x -> x instanceof EntityBase)) {
|
||||
List<MessageDTO> errorMessages = Stream.of(entities)
|
||||
.filter(x -> x.getException() != null)
|
||||
@@ -659,10 +657,6 @@ public class EmsController {
|
||||
|
||||
} else throw new Exception("Non ci sono dati da importare");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response = ServiceRestResponse.createNegativeResponse(e);
|
||||
logger.error("Import " + httpRequest.getRequestURI(), e.getMessage());
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240716105445 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsTable("stb_exchange_config"))
|
||||
return;
|
||||
|
||||
executeStatement("CREATE TABLE stb_exchange_config\n" +
|
||||
"(\n" +
|
||||
" id BIGINT IDENTITY\n" +
|
||||
" CONSTRAINT stb_exchange_config_pk\n" +
|
||||
" PRIMARY KEY,\n" +
|
||||
" description VARCHAR(MAX),\n" +
|
||||
" internal_profile_db VARCHAR(MAX) NOT NULL,\n" +
|
||||
" external_profile_db VARCHAR(MAX) NOT NULL,\n" +
|
||||
" schedulation_cron VARCHAR(MAX) NOT NULL,\n" +
|
||||
" created_at DATETIME DEFAULT GETDATE() NOT NULL,\n" +
|
||||
" last_execution DATETIME,\n" +
|
||||
" last_execution_error_message VARCHAR(MAX)\n" +
|
||||
")");
|
||||
|
||||
executeStatement("CREATE TABLE dbo.stb_exchange_config_detail\n" +
|
||||
"(\n" +
|
||||
" id BIGINT IDENTITY\n" +
|
||||
" CONSTRAINT stb_exchange_config_detail_pk\n" +
|
||||
" PRIMARY KEY,\n" +
|
||||
" stb_exchange_config_id BIGINT NOT NULL\n" +
|
||||
" CONSTRAINT stb_exchange_config_detail_stb_exchange_config_id_fk\n" +
|
||||
" REFERENCES dbo.stb_exchange_config (id),\n" +
|
||||
" type INT NOT NULL,\n" +
|
||||
" execution_order INT DEFAULT 0 NOT NULL\n" +
|
||||
")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240718125945 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateTrigger("t_UpdProgMagaInsT", "CREATE TRIGGER [dbo].[t_UpdProgMagaInsT]\n" +
|
||||
" ON [dbo].[dtb_ordt]\n" +
|
||||
" FOR INSERT\n" +
|
||||
" AS\n" +
|
||||
" DECLARE\n" +
|
||||
" @ls_codMart VARCHAR(15),\n" +
|
||||
" @ls_codComp VARCHAR(15),\n" +
|
||||
" @ls_buffer VARCHAR(15),\n" +
|
||||
" @ls_codTagl VARCHAR(15),\n" +
|
||||
" @ls_codMdep VARCHAR(5),\n" +
|
||||
" @ls_codCol VARCHAR(5),\n" +
|
||||
" @ls_partitaMag VARCHAR(20),\n" +
|
||||
" @ls_annotazioni VARCHAR(255),\n" +
|
||||
" @ls_concatena VARCHAR(50),\n" +
|
||||
" @ls_flagEvaso VARCHAR(1),\n" +
|
||||
" @ls_flagAnnulla VARCHAR(1),\n" +
|
||||
" @ls_gestione VARCHAR(1),\n" +
|
||||
" @ls_articoloComposto VARCHAR(1),\n" +
|
||||
" @ls_codProd VARCHAR(15),\n" +
|
||||
" @ls_flagEvasoProd VARCHAR(1),\n" +
|
||||
" @ls_codJcom VARCHAR(10),\n" +
|
||||
" @ls_gestioneRif VARCHAR(1),\n" +
|
||||
" @ls_descrizioneProd VARCHAR(40),\n" +
|
||||
" @ls_descrEstesaProd VARCHAR(255),\n" +
|
||||
" @ls_untMisProd VARCHAR(3),\n" +
|
||||
" @ls_flagEvasoForzato VARCHAR(1),\n" +
|
||||
" @ls_codAliq VARCHAR(5),\n" +
|
||||
" @lc_qtaConf DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaAcc DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaCol DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaOrd DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaEvasa DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaAccComp DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaColComp DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaOrdComp DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaEvasaComp DECIMAL(15, 5),\n" +
|
||||
" @lc_rapConv DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaOrdFor DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaImpLav DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaImpCli DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaStd DECIMAL(15, 5),\n" +
|
||||
" @lc_percPrezzo DECIMAL(15, 3),\n" +
|
||||
" @lc_sconto1 DECIMAL(15, 5),\n" +
|
||||
" @lc_sconto2 DECIMAL(15, 5),\n" +
|
||||
" @lc_sconto3 DECIMAL(15, 5),\n" +
|
||||
" @lc_sconto4 DECIMAL(15, 5),\n" +
|
||||
" @lc_totImponib DECIMAL(20, 5),\n" +
|
||||
" @lc_qtaProd DECIMAL(15, 5),\n" +
|
||||
" @lc_qtaEvasaProd DECIMAL(15, 5),\n" +
|
||||
" @lc_valUnt DECIMAL(20, 5),\n" +
|
||||
" @lc_cambioOrdAcq DECIMAL(20, 5),\n" +
|
||||
" @lc_cambio DECIMAL(20, 5),\n" +
|
||||
" @lc_rapConvProd DECIMAL(15, 5),\n" +
|
||||
" @ll_numOrd INTEGER,\n" +
|
||||
" @ll_rigaOrd INTEGER,\n" +
|
||||
" @ll_rigaOrdRif INTEGER,\n" +
|
||||
" @ll_numOrdRif INTEGER,\n" +
|
||||
" @ll_cifreDecAcq INTEGER,\n" +
|
||||
" @ldt_dataOrdRif DATETIME,\n" +
|
||||
" @ldt_dataConsProd DATETIME,\n" +
|
||||
" @ldt_dataOrd DATETIME,\n" +
|
||||
" @ll_numFase INTEGER,\n" +
|
||||
" @ll_totFasi INTEGER,\n" +
|
||||
" @ls_codTcolUl VARCHAR(5),\n" +
|
||||
" @lc_colliPedana DECIMAL(20, 5),\n" +
|
||||
" @ls_errorMsg VARCHAR(255),\n" +
|
||||
" @ls_codTcolUi VARCHAR(5),\n" +
|
||||
" @li_posRiga INTEGER,\n" +
|
||||
" @numCnf NUMERIC(20, 5),\n" +
|
||||
" @flagQtaCnfFissa VARCHAR(1),\n" +
|
||||
" @qtaOrd2 NUMERIC(20, 5),\n" +
|
||||
" @qtaOrd3 NUMERIC(20, 5),\n" +
|
||||
" @rapconv2 NUMERIC(20, 5),\n" +
|
||||
" @rapconv3 NUMERIC(20, 5),\n" +
|
||||
" @untOrd2 VARCHAR(3),\n" +
|
||||
" @untOrd3 VARCHAR(3),\n" +
|
||||
" @untOrd VARCHAR(3)\n" +
|
||||
"\n" +
|
||||
" /* Necessaria per connessione OLEDB */\n" +
|
||||
" SET NOCOUNT ON\n" +
|
||||
"\n" +
|
||||
"/* Inserimento riga ordine di produzione */\n" +
|
||||
" DECLARE\n" +
|
||||
" csr_ordt_insert CURSOR FOR\n" +
|
||||
" SELECT inserted.gestione,\n" +
|
||||
" inserted.data_ord,\n" +
|
||||
" inserted.num_ord,\n" +
|
||||
" inserted.riga_ord_rif,\n" +
|
||||
" inserted.cod_prod,\n" +
|
||||
" dtb_ordt.flag_evaso_prod, /* legge il valore corretto di flag_evaso_prod*/\n" +
|
||||
" inserted.flag_annulla,\n" +
|
||||
" inserted.sconto1,\n" +
|
||||
" inserted.sconto2,\n" +
|
||||
" inserted.sconto3,\n" +
|
||||
" inserted.sconto4,\n" +
|
||||
" inserted.tot_imponib - inserted.tot_merce,\n" +
|
||||
" inserted.qta_prod,\n" +
|
||||
" inserted.cod_jcom,\n" +
|
||||
" inserted.gestione_rif,\n" +
|
||||
" inserted.data_ord_rif,\n" +
|
||||
" inserted.num_ord_rif,\n" +
|
||||
" inserted.qta_evasa_prod,\n" +
|
||||
" inserted.rap_conv_prod,\n" +
|
||||
" inserted.data_cons_prod,\n" +
|
||||
" inserted.descrizione_prod,\n" +
|
||||
" inserted.descr_estesa_prod,\n" +
|
||||
" inserted.unt_mis_prod,\n" +
|
||||
" inserted.flag_evaso_forzato,\n" +
|
||||
" gtb_divi.cambio,\n" +
|
||||
" inserted.note,\n" +
|
||||
" inserted.partita_mag,\n" +
|
||||
" inserted.cod_mdep,\n" +
|
||||
" inserted.num_fase,\n" +
|
||||
" inserted.tot_fasi,\n" +
|
||||
" inserted.colli_pedana,\n" +
|
||||
" inserted.cod_tcol_ul,\n" +
|
||||
" inserted.cod_tcol_ui,\n" +
|
||||
" inserted.num_cnf_prod\n" +
|
||||
" FROM inserted,\n" +
|
||||
" gtb_divi,\n" +
|
||||
" dtb_ordt\n" +
|
||||
" WHERE inserted.cod_divi = gtb_divi.cod_divi\n" +
|
||||
" AND (dtb_ordt.gestione = inserted.gestione)\n" +
|
||||
" AND (dtb_ordt.data_ord = inserted.data_ord)\n" +
|
||||
" AND (dtb_ordt.num_ord = inserted.num_ord)\n" +
|
||||
" OPEN csr_ordt_insert\n" +
|
||||
" FETCH NEXT FROM csr_ordt_insert INTO @ls_gestione, @ldt_dataOrd, @ll_numOrd, @ll_rigaOrdRif,@ls_codProd, @ls_flagEvasoProd,\n" +
|
||||
" @ls_flagAnnulla, @lc_sconto1, @lc_sconto2, @lc_sconto3, @lc_sconto4, @lc_totImponib,\n" +
|
||||
" @lc_qtaProd, @ls_codJcom, @ls_gestioneRif, @ldt_dataOrdRif, @ll_numOrdRif,\n" +
|
||||
" @lc_qtaEvasaProd, @lc_rapConvProd, @ldt_dataconsProd, @ls_descrizioneProd,\n" +
|
||||
" @ls_descrEstesaProd, @ls_untMisProd, @ls_flagEvasoForzato, @lc_cambio, @ls_annotazioni,\n" +
|
||||
" @ls_partitaMag,@ls_codMdep, @ll_numFase, @ll_totFasi,@lc_colliPedana ,@ls_codTcolUl, @ls_codTcolui, @numCnf;\n" +
|
||||
" WHILE @@FETCH_STATUS = 0 BEGIN\n" +
|
||||
" /*\n" +
|
||||
" */\n" +
|
||||
" IF @ls_gestione = 'L' AND @ls_gestioneRif = 'A' AND @ll_rigaOrdRif IS NOT NULL AND @ll_numFase = @ll_totFasi\n" +
|
||||
" BEGIN\n" +
|
||||
" /* SELECT @ls_errorMsg = \"cod_mart = \" + @ls_codProd + \" GESTIONE = \" + @ls_gestione + \" DATA = \" + CONVERT(varchar, @ldt_dataOrd, 111) + \" NUM. = \" + CONVERT(varchar, @ll_numOrd) + \" COLLI_PED = \" +CONVERT(varchar,@lc_colliPedana) + \" TIPO_PED \" + @ls_codTcolUL\n" +
|
||||
" RAISERROR (@ls_errorMsg, 16, 1)*/\n" +
|
||||
"\n" +
|
||||
" SELECT @ls_codAliq = cod_aliq,\n" +
|
||||
" @lc_qtaConf = qta_cnf / @lc_rapConvProd ,\n" +
|
||||
" @flagQtaCnfFissa = flag_qta_cnf_fissa,\n" +
|
||||
" @untOrd = mtb_aart.unt_mis,\n" +
|
||||
" @untOrd2 = mtb_aart.unt_mis2,\n" +
|
||||
" @untOrd3 = mtb_aart.unt_mis3,\n" +
|
||||
" @rapConv2 = mtb_aart.rap_conv2,\n" +
|
||||
" @rapConv3 = mtb_aart.rap_conv3\n" +
|
||||
" FROM mtb_aart\n" +
|
||||
" WHERE cod_mart = @ls_codProd\n" +
|
||||
"\n" +
|
||||
" IF @ls_untMisProd = @untOrd\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @untOrd2 = @untOrd2\n" +
|
||||
" IF @untOrd2 IS NOT NULL AND @rapconv2 <> 0\n" +
|
||||
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd / @rapconv2, 5)\n" +
|
||||
"\n" +
|
||||
" SELECT @untOrd3 = @untOrd3\n" +
|
||||
" IF @untOrd3 IS NOT NULL AND @rapconv3 <> 0\n" +
|
||||
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd / @rapconv3, 5)\n" +
|
||||
" END\n" +
|
||||
" ELSE\n" +
|
||||
" IF @ls_untMisProd = @untOrd2\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @untOrd2 = @untOrd\n" +
|
||||
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd * @lc_rapConvProd, 5)\n" +
|
||||
"\n" +
|
||||
" SELECT @untOrd3 = @untOrd3\n" +
|
||||
" IF @untOrd3 IS NOT NULL AND @rapconv3 <> 0\n" +
|
||||
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd * @lc_rapConvProd / @rapconv3, 5)\n" +
|
||||
" END\n" +
|
||||
" ELSE\n" +
|
||||
" IF @ls_untMisProd = @untOrd3\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @untOrd3 = @untOrd\n" +
|
||||
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd * @lc_rapConvProd, 5)\n" +
|
||||
"\n" +
|
||||
" IF @untOrd2 IS NOT NULL AND @rapconv2 <> 0\n" +
|
||||
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd * @lc_rapConvProd / @rapconv2, 5)\n" +
|
||||
" END\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT @lc_cambioOrdAcq = gtb_divi.cambio,\n" +
|
||||
" @ll_cifreDecAcq = gtb_divi.cifre_dec\n" +
|
||||
" FROM dtb_ordt,\n" +
|
||||
" gtb_divi\n" +
|
||||
" WHERE dtb_ordt.cod_divi = gtb_divi.cod_divi\n" +
|
||||
" AND dtb_ordt.gestione = @ls_gestioneRif\n" +
|
||||
" AND dtb_ordt.data_ord = @ldt_dataOrdRif\n" +
|
||||
" AND dtb_ordt.num_ord = @ll_numOrdRif\n" +
|
||||
"\n" +
|
||||
" /*SELECT @lc_valUnt = round(@lc_totImponib / @lc_qtaProd / @lc_cambio * @lc_cambioOrdAcq, @ll_cifreDecAcq)*/\n" +
|
||||
" SELECT @lc_valUnt = @lc_totImponib / @lc_qtaProd / @lc_cambio * @lc_cambioOrdAcq\n" +
|
||||
" IF @lc_valUnt IS NULL SELECT @lc_valUnt = 0\n" +
|
||||
" IF @ls_flagAnnulla <> 'N' SELECT @ls_flagEvasoProd = 'A'\n" +
|
||||
"\n" +
|
||||
" SELECT @li_posRiga = ISNULL(MAX(pos_riga), 0) + 1\n" +
|
||||
" FROM dtb_ordr\n" +
|
||||
" WHERE dtb_ordr.gestione = @ls_gestioneRif\n" +
|
||||
" AND dtb_ordr.data_ord = @ldt_dataOrdRif\n" +
|
||||
" AND dtb_ordr.num_ord = @ll_numOrdRif\n" +
|
||||
"\n" +
|
||||
" IF @numCnf IS NULL\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @numCnf = CASE\n" +
|
||||
" WHEN @lc_qtaConf <> 0 THEN CASE\n" +
|
||||
" WHEN @flagQtaCnfFissa = 'N'\n" +
|
||||
" THEN ROUND(@lc_qtaProd / @lc_qtaConf, 0)\n" +
|
||||
" ELSE ROUND(@lc_qtaProd / @lc_qtaConf, 5) END\n" +
|
||||
" ELSE 0 END\n" +
|
||||
" END\n" +
|
||||
" --SELECT @numCnf = case when @lc_qtaConf <> 0 then round(@lc_qtaProd / @lc_qtaConf, 0, 1) else 0 end \n" +
|
||||
"\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" declare @numCnfEvasa numeric(20,5)\n" +
|
||||
" \n" +
|
||||
" SELECT @numCnfEvasa = CASE\n" +
|
||||
" WHEN @lc_qtaConf <> 0 THEN CASE\n" +
|
||||
" WHEN @flagQtaCnfFissa = 'N'\n" +
|
||||
" THEN ROUND(@lc_qtaEvasaProd / @lc_qtaConf, 0)\n" +
|
||||
" ELSE ROUND(@lc_qtaEvasaProd / @lc_qtaConf, 5) END\n" +
|
||||
" ELSE 0 END\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" INSERT INTO dtb_ordr (gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" riga_ord,\n" +
|
||||
" flag_evaso,\n" +
|
||||
" data_cons,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione,\n" +
|
||||
" unt_ord,\n" +
|
||||
" rap_conv,\n" +
|
||||
" qta_ord,\n" +
|
||||
" unt_ord2,\n" +
|
||||
" qta_ord2,\n" +
|
||||
" unt_ord3,\n" +
|
||||
" qta_ord3,\n" +
|
||||
" qta_evasa,\n" +
|
||||
" val_unt,\n" +
|
||||
" sconto5,\n" +
|
||||
" sconto6,\n" +
|
||||
" sconto7,\n" +
|
||||
" sconto8,\n" +
|
||||
" cod_aliq,\n" +
|
||||
" importo_riga,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" pos_riga,\n" +
|
||||
" flag_evaso_forzato,\n" +
|
||||
" perc_prov,\n" +
|
||||
" val_prov,\n" +
|
||||
" perc_ispe,\n" +
|
||||
" val_ispe,\n" +
|
||||
" perc_promo,\n" +
|
||||
" val_promo,\n" +
|
||||
" perc_oneri,\n" +
|
||||
" val_oneri,\n" +
|
||||
" qta_acc,\n" +
|
||||
" qta_col,\n" +
|
||||
" perc_gest,\n" +
|
||||
" val_gest,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" note,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" colli_pedana,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" cod_tcol_ui,\n" +
|
||||
" num_cnf,\n" +
|
||||
" id_art,\n" +
|
||||
" num_cnf_evasa)\n" +
|
||||
" VALUES (@ls_gestioneRif,\n" +
|
||||
" @ldt_dataOrdRif,\n" +
|
||||
" @ll_numOrdRif,\n" +
|
||||
" @ll_rigaOrdRif,\n" +
|
||||
" @ls_flagEvasoProd,\n" +
|
||||
" @ldt_dataConsProd,\n" +
|
||||
" @ls_codProd,\n" +
|
||||
" @ls_descrizioneProd,\n" +
|
||||
" @ls_untMisProd,\n" +
|
||||
" @lc_rapConvProd,\n" +
|
||||
" @lc_qtaProd,\n" +
|
||||
" @untOrd2,\n" +
|
||||
" @qtaOrd2,\n" +
|
||||
" @untOrd3,\n" +
|
||||
" @qtaOrd3,\n" +
|
||||
" @lc_qtaEvasaProd,\n" +
|
||||
" @lc_valUnt,\n" +
|
||||
" @lc_sconto1,\n" +
|
||||
" @lc_sconto2,\n" +
|
||||
" @lc_sconto3,\n" +
|
||||
" @lc_sconto4,\n" +
|
||||
" @ls_codAliq,\n" +
|
||||
" @lc_totImponib,\n" +
|
||||
" @ls_descrEstesaProd,\n" +
|
||||
" @ls_codJcom,\n" +
|
||||
" @li_posRiga,\n" +
|
||||
" @ls_flagEvasoForzato,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" 0,\n" +
|
||||
" @lc_qtaConf,\n" +
|
||||
" @ls_annotazioni,\n" +
|
||||
" @ls_partitaMag,\n" +
|
||||
" @ls_codMdep,\n" +
|
||||
" @lc_colliPedana,\n" +
|
||||
" @ls_codTcolUl,\n" +
|
||||
" @ls_codTcolUi,\n" +
|
||||
" @numCnf,\n" +
|
||||
" @li_posRiga,\n" +
|
||||
" @numCnfEvasa)\n" +
|
||||
"\n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
" END\n" +
|
||||
" FETCH NEXT FROM csr_ordt_insert INTO @ls_gestione, @ldt_dataOrd, @ll_numOrd, @ll_rigaOrdRif,@ls_codProd, @ls_flagEvasoProd,\n" +
|
||||
" @ls_flagAnnulla, @lc_sconto1, @lc_sconto2, @lc_sconto3, @lc_sconto4, @lc_totImponib,\n" +
|
||||
" @lc_qtaProd, @ls_codJcom, @ls_gestioneRif, @ldt_dataOrdRif, @ll_numOrdRif,\n" +
|
||||
" @lc_qtaEvasaProd, @lc_rapConvProd, @ldt_dataconsProd, @ls_descrizioneProd,\n" +
|
||||
" @ls_descrEstesaProd, @ls_untMisProd, @ls_flagEvasoForzato, @lc_cambio, @ls_annotazioni,\n" +
|
||||
" @ls_partitaMag,@ls_codMdep, @ll_numFase, @ll_totFasi,@lc_colliPedana ,@ls_codTcolUl, @ls_codTcolUi, @numCnf;\n" +
|
||||
" END\n" +
|
||||
" CLOSE csr_ordt_insert\n" +
|
||||
" DEALLOCATE csr_ordt_insert\n" +
|
||||
"\n" +
|
||||
"/* corregge il valore di flag_evaso_prod, in base alla regola:\n" +
|
||||
" le righe non annullate, in cui la quantità evasa è >= dell'ordinato > 0,\n" +
|
||||
" sono da considerare evase\n" +
|
||||
" Nota: le righe in cui ci sono valori nulli sui campi qta_evasa_prod, \n" +
|
||||
" qta_prod, flag_evaso_prod non sono prese in considerazione\n" +
|
||||
"*/\n" +
|
||||
" UPDATE dtb_ordt\n" +
|
||||
" SET flag_evaso_prod = 'E'\n" +
|
||||
" FROM dtb_ordt,\n" +
|
||||
" inserted\n" +
|
||||
" WHERE (dtb_ordt.gestione = inserted.gestione)\n" +
|
||||
" AND (dtb_ordt.data_ord = inserted.data_ord)\n" +
|
||||
" AND (dtb_ordt.num_ord = inserted.num_ord)\n" +
|
||||
" AND (dtb_ordt.flag_evaso_prod <> 'A')\n" +
|
||||
" AND (dtb_ordt.qta_evasa_prod >= dtb_ordt.qta_prod)\n" +
|
||||
" AND (dtb_ordt.qta_evasa_prod > 0) ;\n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
"/* Necessaria per connessione OLEDB */\n" +
|
||||
" SET NOCOUNT OFF");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1035,7 +1035,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
}
|
||||
numColli = colliTot.toString();
|
||||
if (sfusoTot.compareTo(BigDecimal.ZERO) > 0)
|
||||
numColli = numColli + "+" + sfusoTot.toString();
|
||||
numColli = numColli + "+" + sfusoTot;
|
||||
} else {
|
||||
int numColliLogistici = 0;
|
||||
if (colli != null) {
|
||||
|
||||
@@ -32,8 +32,8 @@ public class ScheduledOperationHandlerComponent {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private HashMap<String, ScheduledFuture<?>> scheduledOperations = new HashMap<>();
|
||||
private HashMap<String, DirectoryWatcher> directoryWatcherOperations = new HashMap<>();
|
||||
private final HashMap<String, ScheduledFuture<?>> scheduledOperations = new HashMap<>();
|
||||
private final HashMap<String, DirectoryWatcher> directoryWatcherOperations = new HashMap<>();
|
||||
|
||||
|
||||
public void scheduleOperation(BaseAutomatedOperationDTO operationModel) throws Exception {
|
||||
|
||||
@@ -10,7 +10,6 @@ import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.dto.EntityPermissionsDTO;
|
||||
import it.integry.ems.exception.InvalidPermissionsException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.model.ColumnMetadataDTO;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
@@ -33,8 +32,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.josql.Query;
|
||||
import org.josql.QueryResults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.sql.*;
|
||||
@@ -45,7 +44,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class EntityProcessor {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@@ -59,18 +57,6 @@ public class EntityProcessor {
|
||||
@Autowired
|
||||
private EntityPropertyHolder entityPropertyHolder;
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager mDbTransactManager;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
@Autowired
|
||||
private EntityLoggerService entityLoggerService;
|
||||
|
||||
@Autowired
|
||||
private EntityLoggerNewService entityLoggerNewService;
|
||||
|
||||
@@ -78,6 +64,7 @@ public class EntityProcessor {
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
public <T> T processEntity(EntityInterface entity, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
final RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
String username = "";
|
||||
|
||||
@@ -85,31 +72,42 @@ public class EntityProcessor {
|
||||
username = requestDataDTO.getUsername();
|
||||
}
|
||||
|
||||
return (T) processEntity(entity, true, false, username, multiDBTransactionManager, true, false);
|
||||
return (T) processEntity(entity, true, false, username, multiDBTransactionManager, requestDataDTO, true, false);
|
||||
}
|
||||
|
||||
public EntityBase processEntity(EntityInterface entity, boolean skipCommit, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
|
||||
final RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
String username = "";
|
||||
|
||||
if (requestDataDTO != null && requestDataDTO.isValidUsername()) {
|
||||
username = requestDataDTO.getUsername();
|
||||
}
|
||||
|
||||
return (EntityBase) processEntity(entity, true, skipCommit, username, multiDBTransactionManager, true, false);
|
||||
return (EntityBase) processEntity(entity, true, skipCommit, username, multiDBTransactionManager, requestDataDTO, true, false);
|
||||
}
|
||||
|
||||
public EntityBase processEntity(EntityInterface entity, Boolean isSync,
|
||||
boolean skipCommit, String username,
|
||||
MultiDBTransactionManager mdb) throws Exception {
|
||||
return (EntityBase) processEntity(entity, isSync, skipCommit, username, mdb, true, false);
|
||||
|
||||
final RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
return (EntityBase) processEntity(entity, isSync, skipCommit, username, mdb, requestDataDTO, true, false);
|
||||
}
|
||||
|
||||
public EntityBase processEntity(EntityInterface entity, Boolean isSync,
|
||||
boolean skipCommit, String username,
|
||||
MultiDBTransactionManager mdb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
return (EntityBase) processEntity(entity, isSync, skipCommit, username, mdb, requestDataDTO, true, false);
|
||||
}
|
||||
|
||||
public Object processEntity(EntityInterface entity, Boolean isSync,
|
||||
boolean skipCommit, String username,
|
||||
MultiDBTransactionManager mdb,
|
||||
boolean completeEntity) throws Exception {
|
||||
return processEntity(entity, isSync, skipCommit, username, mdb, completeEntity, false);
|
||||
final RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
return processEntity(entity, isSync, skipCommit, username, mdb, requestDataDTO, completeEntity, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +124,7 @@ public class EntityProcessor {
|
||||
|
||||
public Object processEntity(EntityInterface entity, Boolean isSync,
|
||||
boolean skipCommit, String username,
|
||||
MultiDBTransactionManager mdb,
|
||||
MultiDBTransactionManager mdb, RequestDataDTO requestDataDTO,
|
||||
boolean completeEntity, boolean overrideEntityChildCheck) throws Exception {
|
||||
|
||||
try {
|
||||
@@ -139,13 +137,13 @@ public class EntityProcessor {
|
||||
entity.setOperation(OperationType.NO_OP);
|
||||
}
|
||||
|
||||
if (!overrideEntityChildCheck) this.checkEntityChildsUsage(entity, mdb);
|
||||
if (!overrideEntityChildCheck) this.checkEntityChildsUsage(entity, mdb, requestDataDTO);
|
||||
|
||||
if (settingsModel.isEnablePermissionCheck() && !checkUserPermissions(entity))
|
||||
if (settingsModel.isEnablePermissionCheck() && !checkUserPermissions(entity,mdb))
|
||||
throw new InvalidPermissionsException();
|
||||
|
||||
if (entity.getOperation() == OperationType.NO_OP) {
|
||||
processInternal(entity, isSync, mdb, completeEntity);
|
||||
processInternal(entity, isSync, mdb, requestDataDTO, completeEntity);
|
||||
} else if (entity.getOperation() == OperationType.SELECT_OBJECT) {
|
||||
return entity.selectAndMergeEntity(mdb.getPrimaryConnection(), (EntityBase) entity);
|
||||
//return entity;
|
||||
@@ -155,7 +153,7 @@ public class EntityProcessor {
|
||||
return entityList;
|
||||
|
||||
} else {
|
||||
processInternal(entity, isSync, mdb, completeEntity);
|
||||
processInternal(entity, isSync, mdb, requestDataDTO, completeEntity);
|
||||
}
|
||||
|
||||
if (!skipCommit) {
|
||||
@@ -174,7 +172,7 @@ public class EntityProcessor {
|
||||
}
|
||||
|
||||
|
||||
private void checkEntityChildsUsage(EntityInterface entityInterface, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
private void checkEntityChildsUsage(EntityInterface entityInterface, MultiDBTransactionManager multiDBTransactionManager, RequestDataDTO requestDataDTO) throws Exception {
|
||||
boolean isMaster = entityPropertyHolder.isEntityMaster(((EntityBase) entityInterface).getClass());;
|
||||
OperationType operationType = entityInterface.getOperation();
|
||||
|
||||
@@ -209,12 +207,12 @@ public class EntityProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkUserPermissions(EntityInterface entity) throws Exception {
|
||||
if (!UtilityUser.checkLocalUserExist(mDbTransactManager, entity.getUsername())) return true;
|
||||
private boolean checkUserPermissions(EntityInterface entity, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
if (!UtilityUser.checkLocalUserExist(multiDBTransactionManager, entity.getUsername())) return true;
|
||||
|
||||
List<EntityPermissionsDTO> results = UtilityUser.getUserPermissions(mDbTransactManager, entity.getUsername(), (EntityBase) entity);
|
||||
List<EntityPermissionsDTO> results = UtilityUser.getUserPermissions(multiDBTransactionManager, entity.getUsername(), (EntityBase) entity);
|
||||
|
||||
if (results == null || results.size() == 0) return false;
|
||||
if (results == null || results.isEmpty()) return false;
|
||||
|
||||
EntityPermissionsDTO firstPermission = results.get(0);
|
||||
|
||||
@@ -242,7 +240,7 @@ public class EntityProcessor {
|
||||
|
||||
}
|
||||
|
||||
private void processInternal(EntityInterface entity, Boolean isSync, MultiDBTransactionManager multiDBTransactionManager, boolean completeEntity) throws Exception {
|
||||
private void processInternal(EntityInterface entity, Boolean isSync, MultiDBTransactionManager multiDBTransactionManager, RequestDataDTO requestDataDTO, boolean completeEntity) throws Exception {
|
||||
DataSource currentDs = multiDBTransactionManager.getPrimaryDatasource();
|
||||
Connection primaryDB = currentDs.getConnection();
|
||||
String currentProfileDb = currentDs.getProfile();
|
||||
@@ -415,6 +413,8 @@ public class EntityProcessor {
|
||||
}
|
||||
|
||||
public List<EntityBase> processEntityList(List<? extends EntityBase> entities, boolean singleTransaction) throws Exception {
|
||||
|
||||
final MultiDBTransactionManager mDbTransactManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
return processEntityList(entities, null, true, singleTransaction, false, mDbTransactManager, true, false);
|
||||
}
|
||||
|
||||
@@ -423,10 +423,14 @@ public class EntityProcessor {
|
||||
}
|
||||
|
||||
public List<EntityBase> processEntityList(List<? extends EntityBase> entities, boolean isSync, boolean singleTransaction, boolean ordinaSuPriorita) throws Exception {
|
||||
|
||||
final MultiDBTransactionManager mDbTransactManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
return processEntityList(entities, null, isSync, singleTransaction, ordinaSuPriorita, mDbTransactManager, true, false);
|
||||
}
|
||||
|
||||
public List<EntityBase> processEntityList(List<? extends EntityBase> entities, String username, boolean isSync, boolean singleTransaction, boolean ordinaSuPriorita) throws Exception {
|
||||
|
||||
final MultiDBTransactionManager mDbTransactManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
return processEntityList(entities, username, isSync, singleTransaction, ordinaSuPriorita, mDbTransactManager, true, false);
|
||||
}
|
||||
|
||||
@@ -449,6 +453,9 @@ public class EntityProcessor {
|
||||
MultiDBTransactionManager multiDBTransactionManager,
|
||||
boolean completeEntity, boolean overrideEntityChildCheck) throws Exception {
|
||||
|
||||
|
||||
final RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(username) && requestDataDTO != null && requestDataDTO.isValidUsername()) {
|
||||
username = requestDataDTO.getUsername();
|
||||
}
|
||||
@@ -466,7 +473,7 @@ public class EntityProcessor {
|
||||
EntityBase entity = entities.get(i);
|
||||
entity.setTransactionGroupId(prevTransactionGroupId);
|
||||
try {
|
||||
EntityBase entityResult = (EntityBase) this.processEntity(entity, isSync, singleTransaction, username, multiDBTransactionManager, completeEntity, overrideEntityChildCheck);
|
||||
EntityBase entityResult = (EntityBase) this.processEntity(entity, isSync, singleTransaction, username, multiDBTransactionManager, requestDataDTO, completeEntity, overrideEntityChildCheck);
|
||||
prevTransactionGroupId = entity.getTransactionGroupId();
|
||||
if (entityResult != null) {
|
||||
entityList.add(entityResult);
|
||||
@@ -489,7 +496,7 @@ public class EntityProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
mDbTransactManager.commitAll();
|
||||
multiDBTransactionManager.commitAll();
|
||||
|
||||
return entityList;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AsyncHistoryManager {
|
||||
private final AtomicReference<List<ExportHistoryGroupDTO>> currentlyInExecutionG = new AtomicReference<>(new ArrayList<>());
|
||||
|
||||
|
||||
@PostContextConstruct
|
||||
@PostContextConstruct(priority = 20)
|
||||
public void init() {
|
||||
this.looperService.add(this::consumeRetrieveQueue, 10 * 1000, "async-history-read");
|
||||
this.looperService.add(this::consumeProcessedQueue, 2 * 1000, "async-history-save");
|
||||
|
||||
@@ -309,7 +309,7 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
}
|
||||
|
||||
|
||||
Optional<AvailableConnectionsModel> availableConnectionsModel = Stream.of(SettingsModel.getInstance().getAvailableConnections())
|
||||
java.util.Optional<AvailableConnectionsModel> availableConnectionsModel = SettingsModel.getInstance().getAvailableConnections().stream()
|
||||
.filter(x -> x.getProfileName().equalsIgnoreCase(profileDb))
|
||||
.findFirst();
|
||||
|
||||
|
||||
@@ -29,10 +29,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
@@ -79,7 +76,7 @@ public class RemoteSynchronizationSetupService {
|
||||
publicationGroups.add(publicationGroupDTO);
|
||||
|
||||
final List<PublicationDTO> publications = stbPublicationsDetails.stream()
|
||||
.filter(x -> x.getStbPublicationId() == stbPublication.getId())
|
||||
.filter(x -> Objects.equals(x.getStbPublicationId(), stbPublication.getId()))
|
||||
.map(PublicationDTO::fromStbPublicationDetail)
|
||||
.collect(toList());
|
||||
publicationGroupDTO.setPublications(publications);
|
||||
|
||||
@@ -1438,15 +1438,21 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
||||
|
||||
insertSQL.append(")");
|
||||
|
||||
String traceSql = insertSQL.toString();
|
||||
|
||||
try (SQLServerPreparedStatement insertBulkPs =
|
||||
(SQLServerPreparedStatement) sqlServerConnection.prepareStatement(
|
||||
insertSQL.toString(),
|
||||
containsIdentity ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS)) {
|
||||
|
||||
for (int i = 1; i <= fieldsWithoutIdentityAndNotNull.size(); i++) {
|
||||
insertBulkPs.setObject(i, fieldsWithoutIdentityAndNotNull.get(i - 1).getSecond());
|
||||
final Object value = fieldsWithoutIdentityAndNotNull.get(i - 1).getSecond();
|
||||
insertBulkPs.setObject(i, value);
|
||||
|
||||
traceSql = traceSql.replaceFirst("\\?", UtilityDB.valueToString(value));
|
||||
}
|
||||
|
||||
logger.trace("Query tracing: {}", traceSql);
|
||||
|
||||
long insertedRowCount = insertBulkPs.executeLargeUpdate();
|
||||
if (insertedRowCount > 0 && containsIdentity) {
|
||||
@@ -1507,7 +1513,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
||||
ForeignKeyRules.chkConstraint(connection, this.getChkConstraintSql());
|
||||
UniqueKeyRules.chkConstraint(connection, this);
|
||||
|
||||
if (campi.size() > 0) {
|
||||
if (!campi.isEmpty()) {
|
||||
String sql = "UPDATE " + getTableName() + " SET " + StringUtils.join(campi, ",");
|
||||
|
||||
|
||||
@@ -1519,9 +1525,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
||||
|
||||
sql += " WHERE " + whereCond;
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("QUERY: " + sql);
|
||||
}
|
||||
logger.trace("Query tracing: {}", sql);
|
||||
|
||||
try {
|
||||
PreparedStatement pstm = connection.prepareStatement(sql);
|
||||
|
||||
@@ -6,14 +6,16 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbAartMarchio.ENTITY)
|
||||
@JsonTypeName(MtbAartMarchio.ENTITY)
|
||||
public class MtbAartMarchio extends EntityBase {
|
||||
public class MtbAartMarchio extends EntityBase implements EquatableEntityInterface<MtbAartMarchio> {
|
||||
|
||||
public static final String ENTITY = "mtb_aart_marchio";
|
||||
|
||||
@@ -31,7 +33,33 @@ public class MtbAartMarchio extends EntityBase {
|
||||
return marchio;
|
||||
}
|
||||
|
||||
public void setMarchio(String marchio) {
|
||||
public MtbAartMarchio setMarchio(String marchio) {
|
||||
this.marchio = marchio;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbAartMarchio other) {
|
||||
if (this == other) return true;
|
||||
return Objects.equals(getMarchio(), other.getMarchio());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsContent(MtbAartMarchio other) {
|
||||
if (this == other) return true;
|
||||
return Objects.equals(getMarchio(), other.getMarchio());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) return true;
|
||||
if (!(object instanceof MtbAartMarchio)) return false;
|
||||
MtbAartMarchio that = (MtbAartMarchio) object;
|
||||
return Objects.equals(getMarchio(), that.getMarchio());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getMarchio());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,64 +52,72 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
public MtbGrup setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
public MtbGrup setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagValMag() {
|
||||
return flagValMag;
|
||||
}
|
||||
|
||||
public void setFlagValMag(String flagValMag) {
|
||||
public MtbGrup setFlagValMag(String flagValMag) {
|
||||
this.flagValMag = flagValMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLogoWeb() {
|
||||
return logoWeb;
|
||||
}
|
||||
|
||||
public void setLogoWeb(String logoWeb) {
|
||||
public MtbGrup setLogoWeb(String logoWeb) {
|
||||
this.logoWeb = logoWeb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCriterioVal() {
|
||||
return criterioVal;
|
||||
}
|
||||
|
||||
public void setCriterioVal(String criterioVal) {
|
||||
public MtbGrup setCriterioVal(String criterioVal) {
|
||||
this.criterioVal = criterioVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoMgrp() {
|
||||
return tipoMgrp;
|
||||
}
|
||||
|
||||
public void setTipoMgrp(String tipoMgrp) {
|
||||
public MtbGrup setTipoMgrp(String tipoMgrp) {
|
||||
this.tipoMgrp = tipoMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbSgrp> getMtbSgrp() {
|
||||
return mtbSgrp;
|
||||
}
|
||||
|
||||
public void setMtbSgrp(List<MtbSgrp> mtbSgrp) {
|
||||
public MtbGrup setMtbSgrp(List<MtbSgrp> mtbSgrp) {
|
||||
this.mtbSgrp = mtbSgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbSfam> getMtbSfam() {
|
||||
return mtbSfam;
|
||||
}
|
||||
|
||||
public void setMtbSfam(List<MtbSfam> mtbSfam) {
|
||||
public MtbGrup setMtbSfam(List<MtbSfam> mtbSfam) {
|
||||
this.mtbSfam = mtbSfam;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,40 +56,45 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
public MtbSgrp setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public void setCodMsgr(String codMsgr) {
|
||||
public MtbSgrp setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
public MtbSgrp setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInclInStat() {
|
||||
return inclInStat;
|
||||
}
|
||||
|
||||
public void setInclInStat(String inclInStat) {
|
||||
public MtbSgrp setInclInStat(String inclInStat) {
|
||||
this.inclInStat = inclInStat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContoRimFin() {
|
||||
return contoRimFin;
|
||||
}
|
||||
|
||||
public void setContoRimFin(String contoRimFin) {
|
||||
public MtbSgrp setContoRimFin(String contoRimFin) {
|
||||
this.contoRimFin = contoRimFin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getOrdinamento() {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Master()
|
||||
@PropertyReactive()
|
||||
@Table(value = StbExchangeConfig.ENTITY)
|
||||
@JsonTypeName(value = StbExchangeConfig.ENTITY)
|
||||
public class StbExchangeConfig extends EntityBase {
|
||||
|
||||
public final static String ENTITY = "stb_exchange_config";
|
||||
|
||||
private final static long serialVersionUID = 1L;
|
||||
|
||||
@PK()
|
||||
@Identity()
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField(value = "description", maxLength = -1, nullable = true)
|
||||
private String description;
|
||||
|
||||
@SqlField(value = "internal_profile_db", maxLength = -1, nullable = false)
|
||||
private String internalProfileDb;
|
||||
|
||||
@SqlField(value = "external_profile_db", maxLength = -1, nullable = false)
|
||||
private String externalProfileDb;
|
||||
|
||||
@SqlField(value = "schedulation_cron", maxLength = -1, nullable = false)
|
||||
private String schedulationCron;
|
||||
|
||||
@SqlField(value = "created_at", nullable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@SqlField(value = "last_execution", nullable = true)
|
||||
private LocalDateTime lastExecution;
|
||||
|
||||
@SqlField(value = "last_execution_error_message", maxLength = -1, nullable = true)
|
||||
private String lastExecutionErrorMessage;
|
||||
|
||||
@EntityChild()
|
||||
private List<StbExchangeConfigDetail> stbExchangeConfigDetail = new ArrayList<>();
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInternalProfileDb() {
|
||||
return internalProfileDb;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setInternalProfileDb(String internalProfileDb) {
|
||||
this.internalProfileDb = internalProfileDb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getExternalProfileDb() {
|
||||
return externalProfileDb;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setExternalProfileDb(String externalProfileDb) {
|
||||
this.externalProfileDb = externalProfileDb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSchedulationCron() {
|
||||
return schedulationCron;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setSchedulationCron(String schedulationCron) {
|
||||
this.schedulationCron = schedulationCron;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getLastExecution() {
|
||||
return lastExecution;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setLastExecution(LocalDateTime lastExecution) {
|
||||
this.lastExecution = lastExecution;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLastExecutionErrorMessage() {
|
||||
return lastExecutionErrorMessage;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setLastExecutionErrorMessage(String lastExecutionErrorMessage) {
|
||||
this.lastExecutionErrorMessage = lastExecutionErrorMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbExchangeConfigDetail> getStbExchangeConfigDetail() {
|
||||
return stbExchangeConfigDetail;
|
||||
}
|
||||
|
||||
public StbExchangeConfig setStbExchangeConfigDetail(List<StbExchangeConfigDetail> stbExchangeConfigDetail) {
|
||||
this.stbExchangeConfigDetail = stbExchangeConfigDetail;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void deleteChilds() throws Exception {
|
||||
StbExchangeConfigDetail stbExchangeConfigDetail = new StbExchangeConfigDetail();
|
||||
stbExchangeConfigDetail.deleteAllEntities(connection, Query.format("stb_exchange_config_id = %s", getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = StbExchangeConfigDetail.ENTITY)
|
||||
@JsonTypeName(value = StbExchangeConfigDetail.ENTITY)
|
||||
public class StbExchangeConfigDetail extends EntityBase {
|
||||
|
||||
public final static String ENTITY = "stb_exchange_config_detail";
|
||||
|
||||
private final static long serialVersionUID = 1L;
|
||||
|
||||
@PK()
|
||||
@Identity()
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField(value = "stb_exchange_config_id", nullable = false)
|
||||
@FK(tableName = StbExchangeConfig.ENTITY, columnName = "id")
|
||||
@ImportFromParent("id")
|
||||
private Long stbExchangeConfigId;
|
||||
|
||||
@SqlField(value = "type", nullable = false)
|
||||
private Integer configType;
|
||||
|
||||
@SqlField(value = "execution_order", nullable = false)
|
||||
private Integer executionOrder;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public StbExchangeConfigDetail setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getStbExchangeConfigId() {
|
||||
return stbExchangeConfigId;
|
||||
}
|
||||
|
||||
public StbExchangeConfigDetail setStbExchangeConfigId(Long stbExchangeConfigId) {
|
||||
this.stbExchangeConfigId = stbExchangeConfigId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getConfigType() {
|
||||
return configType;
|
||||
}
|
||||
|
||||
public StbExchangeConfigDetail setConfigType(Integer configType) {
|
||||
this.configType = configType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getExecutionOrder() {
|
||||
return executionOrder;
|
||||
}
|
||||
|
||||
public StbExchangeConfigDetail setExecutionOrder(Integer executionOrder) {
|
||||
this.executionOrder = executionOrder;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.ems.system.exchange.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.service.ExchangeArticoliImportService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -21,14 +23,20 @@ public class ExchangeArticoliImportController {
|
||||
@Autowired
|
||||
private ExchangeArticoliImportService exchangeArticoliImportService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
@RequestMapping(value = "import", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importArticoli(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
exchangeArticoliImportService.importArticoli();
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
exchangeArticoliImportService.importArticoli(internalDb, exchangeDb,requestDataDTO);
|
||||
}
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.ems.system.exchange.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.service.ExchangeColliImportService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -22,13 +24,23 @@ public class ExchangeColliImportController {
|
||||
@Autowired
|
||||
private ExchangeColliImportService exchangeColliImportService;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
|
||||
@RequestMapping(value = "importLavorazione", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importColliLavorazione(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager multiDBTransactionManagerExchange = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
|
||||
exchangeColliImportService.importColliLavorazione(multiDBTransactionManager, multiDBTransactionManagerExchange, requestDataDTO);
|
||||
|
||||
}
|
||||
|
||||
exchangeColliImportService.importColliLavorazione();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@@ -43,7 +55,8 @@ public class ExchangeColliImportController {
|
||||
@RequestParam(required = false) String codVdes
|
||||
) throws Exception {
|
||||
LocalDate dataCertificato = LocalDate.parse(dataCert);
|
||||
return ServiceRestResponse.createPositiveResponse(exchangeColliImportService.getCertificati(codAnag,
|
||||
return ServiceRestResponse.createPositiveResponse(exchangeColliImportService.getCertificati(configuration,
|
||||
codAnag,
|
||||
dataCertificato,
|
||||
codMart,
|
||||
codVdes));
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package it.integry.ems.system.exchange.controller;
|
||||
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.system.exchange.dto.ExchangeUpdateRowsOrderRequestDTO;
|
||||
import it.integry.ems.system.exchange.service.ExchangeConfigService;
|
||||
import it.integry.ems.system.exchange.service.ExchangeImportSchemaManagerService;
|
||||
import it.integry.ems_model.entity.StbExchangeConfig;
|
||||
import it.integry.ems_model.entity.StbExchangeConfigDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("exchange/configuration/")
|
||||
public class ExchangeConfigController {
|
||||
|
||||
@Autowired
|
||||
private ExchangeConfigService exchangeConfigService;
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@RequestMapping(value = "available-profiles", method = RequestMethod.GET)
|
||||
public ServiceRestResponse retrieveAvailableProfiles(
|
||||
@RequestParam(defaultValue = "true") boolean onlyInternal) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(settingsModel.getAvailableConnections().stream()
|
||||
.filter(x -> x.getInternalDb() || !onlyInternal)
|
||||
.map(AvailableConnectionsModel::getProfileName)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "available-types", method = RequestMethod.GET)
|
||||
public ServiceRestResponse retrieveAvailableTypes() throws Exception {
|
||||
final HashMap<String, Integer> data = new HashMap<>();
|
||||
Arrays.stream(ExchangeImportSchemaManagerService.SchemaType.values())
|
||||
.forEach(x -> data.put(x.toString(), x.getValue()));
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(data);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieve", method = RequestMethod.GET)
|
||||
public ServiceRestResponse retrieveConfigs() throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(exchangeConfigService.retrieveConfigurations());
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "insert", method = RequestMethod.POST)
|
||||
public ServiceRestResponse insertConfig(@RequestBody StbExchangeConfig configToInsert) throws Exception {
|
||||
exchangeConfigService.addConfiguration(configToInsert);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/update", method = RequestMethod.POST)
|
||||
public ServiceRestResponse updateConfig(@PathVariable long configId,
|
||||
@RequestBody StbExchangeConfig configToUpdate) throws Exception {
|
||||
exchangeConfigService.updateConfiguration(configId, configToUpdate);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/delete", method = RequestMethod.GET)
|
||||
public ServiceRestResponse deleteConfig(@PathVariable long configId) throws Exception {
|
||||
exchangeConfigService.deleteConfiguration(configId);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/insert-row", method = RequestMethod.POST)
|
||||
public ServiceRestResponse insertRow(@PathVariable long configId,
|
||||
@RequestBody StbExchangeConfigDetail stbExchangeConfigDetail) throws Exception {
|
||||
exchangeConfigService.insertRow(configId, stbExchangeConfigDetail);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/update-row/{rowId}", method = RequestMethod.POST)
|
||||
public ServiceRestResponse updateRow(@PathVariable long configId, @PathVariable long rowId,
|
||||
@RequestBody StbExchangeConfigDetail stbExchangeConfigDetail) throws Exception {
|
||||
exchangeConfigService.updateRow(configId, stbExchangeConfigDetail);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/update-rows-order", method = RequestMethod.POST)
|
||||
public ServiceRestResponse updateRowsOrder(@PathVariable long configId,
|
||||
@RequestBody ExchangeUpdateRowsOrderRequestDTO requestDTO) throws Exception {
|
||||
exchangeConfigService.updateRowsOrder(configId, requestDTO.getOrderedRows());
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "{configId}/delete-row/{rowId}", method = RequestMethod.GET)
|
||||
public ServiceRestResponse deleteRow(@PathVariable long configId, @PathVariable long rowId) throws Exception {
|
||||
exchangeConfigService.deleteRow(configId, rowId);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.ems.system.exchange.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.service.ExchangeDocumentImportService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -21,14 +23,21 @@ public class ExchangeDocumentImportController {
|
||||
@Autowired
|
||||
private ExchangeDocumentImportService exchangeDocumentImportService;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "importLavorazione", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importDocumentiLavorazione(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
exchangeDocumentImportService.importTestateDocumentiLavorazione();
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
exchangeDocumentImportService.importTestateDocumentiLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
}
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.ems.system.exchange.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.service.ExchangeOrdiniImportService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -22,14 +24,21 @@ public class ExchangeOrdiniImportController {
|
||||
@Autowired
|
||||
private ExchangeOrdiniImportService exchangeOrdiniImportService;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
|
||||
@RequestMapping(value = "importLavorazione", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse importLavorazione(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||
@RequestParam() String profileDbExchange) throws Exception {
|
||||
|
||||
exchangeOrdiniImportService.importOrdiniLavorazione();
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
exchangeOrdiniImportService.importOrdiniLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
}
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.ems.system.exchange.dto;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ExchangeUpdateRowsOrderRequestDTO {
|
||||
|
||||
private HashMap<Long, Integer> orderedRows;
|
||||
|
||||
public HashMap<Long, Integer> getOrderedRows() {
|
||||
return orderedRows;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbGrup;
|
||||
import it.integry.ems_model.entity.MtbSfam;
|
||||
import it.integry.ems_model.entity.MtbSgrp;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -25,19 +22,14 @@ import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ExchangeArticoliImportService {
|
||||
|
||||
//TODO: To be remove, only for fast development
|
||||
private final String ROSSOGARGANO_EXCHANGE_PROFILEDB = "ROSSO_GARGANO_EXCHANGE";
|
||||
private final String ROSSOGARGANO_EXCHANGE_USER = "DBA";
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||
|
||||
@@ -46,21 +38,22 @@ public class ExchangeArticoliImportService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public void importArticoli() throws Exception {
|
||||
public void importArticoli(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
boolean useTempTable = true;
|
||||
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(ROSSOGARGANO_EXCHANGE_PROFILEDB)) {
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.Articoli, useTempTable);
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.Articoli, useTempTable);
|
||||
|
||||
importGruppiMerceologici(exchangeDb, useTempTable);
|
||||
importMarchi(internalMultiDb, exchangeMultiDb, useTempTable, requestDataDTO);
|
||||
|
||||
importGruppiMerceologici(internalMultiDb, exchangeMultiDb, useTempTable, requestDataDTO);
|
||||
|
||||
final List<MtbAart> exchangeImportedData = retrieveArticoli(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
final List<MtbAart> exchangeUpdatedData = retrieveArticoli(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
@@ -78,17 +71,18 @@ public class ExchangeArticoliImportService {
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
logger.debug("Importati {} articoli di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (MtbAart) dataToSave, useTempTable);
|
||||
multiDBTransactionManager.commitAll();
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbAart) dataToSave, useTempTable);
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
logger.error("Errore durante l'importazione del documento", ex);
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
logger.error("Errore durante l'importazione dell'articolo", ex);
|
||||
internalMultiDb.rollbackAll();
|
||||
//throw ex;
|
||||
}
|
||||
|
||||
@@ -99,8 +93,7 @@ public class ExchangeArticoliImportService {
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.Articoli);
|
||||
}
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.Articoli);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,63 +120,115 @@ public class ExchangeArticoliImportService {
|
||||
}};
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart", importedKey, useTempTable);
|
||||
connection.commit();
|
||||
}
|
||||
|
||||
private void importGruppiMerceologici(MultiDBTransactionManager exchangeDb, boolean useTempTable) throws Exception {
|
||||
final List<MtbGrup> exchangeImportedData = retrieveMtbGrup(
|
||||
private void importGruppiMerceologici(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeDb, boolean useTempTable, RequestDataDTO requestDataDTO) throws Exception {
|
||||
final List<MtbGrup> exchangeImportedDataMtbGrup = retrieveMtbGrup(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
final List<MtbGrup> exchangeUpdatedData = retrieveMtbGrup(
|
||||
final List<MtbSgrp> exchangeImportedDataMtbSgrp = retrieveMtbSgrup(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
final List<MtbSfam> exchangeImportedDataMtbSfam = retrieveMtbSfam(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
final List<MtbGrup> exchangeUpdatedDataMtbGrup = retrieveMtbGrup(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
.runSync(MtbGrup.class, exchangeImportedData, exchangeUpdatedData);
|
||||
final List<MtbSgrp> exchangeUpdatedDataMtbSgrp = retrieveMtbSgrup(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
allData.stream()
|
||||
.map(x -> (MtbGrup) x)
|
||||
final List<MtbSfam> exchangeUpdatedDataMtbSfam = retrieveMtbSfam(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
|
||||
List<EquatableEntityInterface> allMgrpData = exchangeImportDataManagerService
|
||||
.runSync(MtbGrup.class, exchangeImportedDataMtbGrup, exchangeUpdatedDataMtbGrup);
|
||||
|
||||
List<EquatableEntityInterface> allMsgrpData = exchangeImportDataManagerService
|
||||
.runSync(MtbSgrp.class, exchangeImportedDataMtbSgrp, exchangeUpdatedDataMtbSgrp);
|
||||
|
||||
List<EquatableEntityInterface> allMsfamData = exchangeImportDataManagerService
|
||||
.runSync(MtbSfam.class, exchangeImportedDataMtbSfam, exchangeUpdatedDataMtbSfam);
|
||||
|
||||
|
||||
allMgrpData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
allMsgrpData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
allMsfamData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
|
||||
|
||||
allMsfamData.stream()
|
||||
.map(x -> (MtbSfam) x)
|
||||
.filter(x -> allMsgrpData.stream()
|
||||
.map(y -> (MtbSgrp) y)
|
||||
.noneMatch(y -> x.getCodMgrp().equalsIgnoreCase(y.getCodMgrp()) &&
|
||||
x.getCodMsgr().equalsIgnoreCase(y.getCodMsgr())))
|
||||
.forEach(x -> {
|
||||
MtbSgrp testata = new MtbSgrp()
|
||||
.setCodMgrp(x.getCodMgrp())
|
||||
.setCodMsgr(x.getCodMsgr());
|
||||
|
||||
if (x.getOperation() == OperationType.INSERT)
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
|
||||
x.getMtbSgrp()
|
||||
.forEach(y -> {
|
||||
|
||||
if (y.getOperation() == OperationType.INSERT)
|
||||
y.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
|
||||
y.getMtbSfam().stream()
|
||||
.filter(z -> z.getOperation() == OperationType.INSERT)
|
||||
.forEach(z -> z.setOperation(OperationType.INSERT_OR_UPDATE));
|
||||
|
||||
y.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
testata.setOperation(OperationType.UPDATE);
|
||||
allMsgrpData.add(testata);
|
||||
});
|
||||
|
||||
|
||||
allMsgrpData.stream()
|
||||
.map(x -> (MtbSgrp) x)
|
||||
.forEach(x -> x.setMtbSfam(allMsfamData.stream()
|
||||
.map(y -> (MtbSfam) y)
|
||||
.filter(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()) &&
|
||||
y.getCodMsgr().equalsIgnoreCase(x.getCodMsgr()))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
allMsgrpData.stream()
|
||||
.map(x -> (MtbSgrp) x)
|
||||
.filter(x -> allMgrpData.stream()
|
||||
.map(y -> (MtbGrup) y)
|
||||
.noneMatch(y -> x.getCodMgrp().equalsIgnoreCase(y.getCodMgrp())))
|
||||
.forEach(x -> {
|
||||
MtbGrup testata = new MtbGrup()
|
||||
.setCodMgrp(x.getCodMgrp());
|
||||
|
||||
testata.setOperation(OperationType.UPDATE);
|
||||
allMgrpData.add(testata);
|
||||
});
|
||||
|
||||
|
||||
allMgrpData.stream()
|
||||
.map(x -> (MtbGrup) x)
|
||||
.forEach(x -> x.setMtbSgrp(allMsgrpData.stream()
|
||||
.map(y -> (MtbSgrp) y)
|
||||
.filter(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
AtomicInteger importedCounter = new AtomicInteger();
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
for (EquatableEntityInterface dataToSave : allMgrpData) {
|
||||
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} gruppi merceologici di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
logger.debug("Importati {} gruppi merceologici di {}", importedCounter.incrementAndGet(), allMgrpData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (MtbGrup) dataToSave, useTempTable);
|
||||
multiDBTransactionManager.commitAll();
|
||||
internalMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
logger.error("Errore durante l'importazione del gruppo merceologico", ex);
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
internalMultiDb.rollbackAll();
|
||||
//throw ex;
|
||||
}
|
||||
|
||||
@@ -197,49 +242,52 @@ public class ExchangeArticoliImportService {
|
||||
private List<MtbGrup> retrieveMtbGrup(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String mtbGrupOriginalTableName = "mtb_grup";
|
||||
String mtbGrupTableName = mtbGrupOriginalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + mtbGrupTableName +
|
||||
" SELECT * FROM " + mtbGrupOriginalTableName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbGrup.class,
|
||||
mtbGrupTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
private List<MtbSgrp> retrieveMtbSgrup(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String mtbSgrpOriginalTableName = "mtb_sgrp";
|
||||
String mtbSgrpTableName = mtbSgrpOriginalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + mtbSgrpTableName +
|
||||
" SELECT * FROM " + mtbSgrpOriginalTableName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbSgrp.class,
|
||||
mtbSgrpTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
private List<MtbSfam> retrieveMtbSfam(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String mtbSfamOriginalTableName = "mtb_sfam";
|
||||
String mtbSfamTableName = mtbSfamOriginalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + mtbGrupTableName +
|
||||
" SELECT * FROM " + mtbGrupOriginalTableName,
|
||||
"INSERT INTO " + mtbSgrpTableName +
|
||||
" SELECT * FROM " + mtbSgrpOriginalTableName,
|
||||
"INSERT INTO " + mtbSfamTableName +
|
||||
" SELECT * FROM " + mtbSfamOriginalTableName
|
||||
);
|
||||
}
|
||||
|
||||
List<MtbGrup> mtbGrups = exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbGrup.class,
|
||||
mtbGrupTableName, null, retrieveAlreadyImported);
|
||||
List<MtbSgrp> mtbSgrps = exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbSgrp.class,
|
||||
mtbSgrpTableName, null, retrieveAlreadyImported);
|
||||
List<MtbSfam> mtbSfams = exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbSfam.class,
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbSfam.class,
|
||||
mtbSfamTableName, null, retrieveAlreadyImported);
|
||||
|
||||
|
||||
mtbSgrps.forEach(mtbSgrp -> {
|
||||
|
||||
mtbSgrp.setMtbSfam(mtbSfams.stream()
|
||||
.filter(mtbSfam -> mtbSfam.getCodMgrp().equalsIgnoreCase(mtbSgrp.getCodMgrp()) &&
|
||||
mtbSfam.getCodMsgr().equalsIgnoreCase(mtbSgrp.getCodMsgr()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
});
|
||||
|
||||
mtbGrups.forEach(mtbGrup -> {
|
||||
|
||||
mtbGrup.setMtbSgrp(mtbSgrps.stream()
|
||||
.filter(mtbSgrp -> mtbSgrp.getCodMgrp().equalsIgnoreCase(mtbGrup.getCodMgrp()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
});
|
||||
|
||||
return mtbGrups;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,4 +322,73 @@ public class ExchangeArticoliImportService {
|
||||
}
|
||||
|
||||
|
||||
private void importMarchi(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeDb, boolean useTempTable, RequestDataDTO requestDataDTO) throws Exception {
|
||||
final List<MtbAartMarchio> exchangeImportedDataMtbAartMarchio = retrieveMtbAartMarchio(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
final List<MtbAartMarchio> exchangeUpdatedDataMtbAartMarchio = retrieveMtbAartMarchio(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
.runSync(MtbAartMarchio.class, exchangeImportedDataMtbAartMarchio, exchangeUpdatedDataMtbAartMarchio);
|
||||
|
||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
AtomicInteger importedCounter = new AtomicInteger();
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} marchi di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (MtbAartMarchio) dataToSave, useTempTable);
|
||||
internalMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
logger.error("Errore durante l'importazione del gruppo merceologico", ex);
|
||||
internalMultiDb.rollbackAll();
|
||||
//throw ex;
|
||||
}
|
||||
|
||||
// });
|
||||
}
|
||||
// UtilityThread.executeParallel(calls);
|
||||
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
}
|
||||
|
||||
private List<MtbAartMarchio> retrieveMtbAartMarchio(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String mtbGrupOriginalTableName = "mtb_aart_marchio";
|
||||
String mtbGrupTableName = mtbGrupOriginalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + mtbGrupTableName +
|
||||
" SELECT * FROM " + mtbGrupOriginalTableName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbAartMarchio.class,
|
||||
mtbGrupTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
|
||||
private void singleUpdateImported(Connection connection, MtbAartMarchio importedData, boolean useTempTable) throws Exception {
|
||||
final HashMap<String, Object> importedKey = new HashMap<String, Object>() {{
|
||||
put("marchio", importedData.getMarchio());
|
||||
}};
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_marchio", importedKey, useTempTable);
|
||||
connection.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.exchange.dto.CertificatiSinfoOneDTO;
|
||||
@@ -12,16 +12,13 @@ import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,18 +29,17 @@ import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ExchangeColliImportService {
|
||||
|
||||
//TODO: To be remove, only for fast development
|
||||
private final String ROSSOGARGANO_EXCHANGE_PROFILEDB = "ROSSO_GARGANO_EXCHANGE";
|
||||
private final String ROSSOGARGANO_EXCHANGE_USER = "DBA";
|
||||
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||
|
||||
@@ -53,28 +49,25 @@ public class ExchangeColliImportService {
|
||||
@Autowired
|
||||
private ExchangePartiteMagazzinoImportService exchangePartiteMagazzinoImportService;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
public void importColliLavorazione() throws Exception {
|
||||
public void importColliLavorazione(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
boolean useTempTable = true;
|
||||
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(ROSSOGARGANO_EXCHANGE_PROFILEDB)) {
|
||||
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione();
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione(internalMultiDb, exchangeMultiDb, requestDataDTO);
|
||||
|
||||
final List<MtbColt> exchangeImportedMtbColts = importColliLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
true, false);
|
||||
|
||||
List<MtbColt> exchangeUpdatedMtbColts = importColliLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
false, useTempTable);
|
||||
@@ -97,17 +90,16 @@ public class ExchangeColliImportService {
|
||||
AtomicInteger importedCounter = new AtomicInteger();
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
|
||||
for (EquatableEntityInterface mtbColtToSave : allMtbColts) {
|
||||
for (EquatableEntityInterface dataToSave : allMtbColts) {
|
||||
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} di {}", importedCounter.incrementAndGet(), allMtbColts.size());
|
||||
try {
|
||||
entityProcessor.processEntity(mtbColtToSave, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbColt) dataToSave, useTempTable);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (MtbColt) mtbColtToSave, useTempTable);
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
exchangeDb.commitAll();
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
@@ -123,8 +115,7 @@ public class ExchangeColliImportService {
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione);
|
||||
}
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,17 +179,16 @@ public class ExchangeColliImportService {
|
||||
}
|
||||
|
||||
|
||||
public List<CertificatiSinfoOneDTO> getCertificati(String codAnag, LocalDate dataCert, String codMart, String codVdes) throws Exception {
|
||||
public List<CertificatiSinfoOneDTO> getCertificati(String profileDb, String codAnag, LocalDate dataCert, String codMart, String codVdes) throws Exception {
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileDb)) {
|
||||
|
||||
String profileDbExchange = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "PVM", "PIAN_ACC_ROSSG", "PROFILE_DB_CERT");
|
||||
|
||||
|
||||
DataSource dsSync = new DataSource();
|
||||
dsSync.initialize(profileDbExchange);
|
||||
multiDBTransactionManager.addConnection(profileDbExchange, dsSync);
|
||||
Connection conExch = multiDBTransactionManager.getDatabaseDataSource(profileDbExchange).getConnection();
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||
|
||||
List<CertificatiSinfoOneDTO> listaCert = UtilityDB.executeSimpleQueryDTO(
|
||||
conExch,
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
Query.format("SELECT TRIM(cod_anag) AS codAnag,\n" +
|
||||
" TRIM(rag_soc) AS ragSoc,\n" +
|
||||
" TRIM(cod_Vdes) AS codVdes,\n" +
|
||||
@@ -241,7 +231,7 @@ public class ExchangeColliImportService {
|
||||
" AND cod_anag = {}\n" +
|
||||
" AND data_doc = {}\n", codDtipLavCar, codAnag, dataCert),
|
||||
DtbDoct.class);
|
||||
if (!UtilityList.isNullOrEmpty(certificatiImportati) && ! UtilityList.isNullOrEmpty(listaCert)) {
|
||||
if (!UtilityList.isNullOrEmpty(certificatiImportati) && !UtilityList.isNullOrEmpty(listaCert)) {
|
||||
listaCert = listaCert.stream().filter((CertificatiSinfoOneDTO cert) ->
|
||||
certificatiImportati.stream().noneMatch(ddt -> ddt.getNumDoc() == cert.getNumCert().intValue())
|
||||
).collect(Collectors.toList());
|
||||
@@ -249,4 +239,6 @@ public class ExchangeColliImportService {
|
||||
|
||||
return listaCert;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.StbExchangeConfig;
|
||||
import it.integry.ems_model.entity.StbExchangeConfigDetail;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope(value = "request")
|
||||
public class ExchangeConfigService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private ExchangeSystemManagerService exchangeSystemManagerService;
|
||||
|
||||
public List<StbExchangeConfig> retrieveConfigurations() throws Exception {
|
||||
|
||||
List<StbExchangeConfig> stbExchangeConfigsToRetrieve = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"SELECT * FROM " + StbExchangeConfig.ENTITY, StbExchangeConfig.class);
|
||||
if (stbExchangeConfigsToRetrieve == null) return null;
|
||||
|
||||
List<StbExchangeConfigDetail> stbExchangeConfigsDetailsToRetrieve = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"SELECT * FROM " + StbExchangeConfigDetail.ENTITY, StbExchangeConfigDetail.class);
|
||||
if (stbExchangeConfigsDetailsToRetrieve == null) stbExchangeConfigsDetailsToRetrieve = new ArrayList<>();
|
||||
|
||||
|
||||
for (StbExchangeConfig stbExchangeConfig : stbExchangeConfigsToRetrieve) {
|
||||
stbExchangeConfig.getStbExchangeConfigDetail()
|
||||
.addAll(stbExchangeConfigsDetailsToRetrieve.stream()
|
||||
.filter(x -> Objects.equals(x.getStbExchangeConfigId(), stbExchangeConfig.getId()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
return stbExchangeConfigsToRetrieve;
|
||||
}
|
||||
|
||||
public void addConfiguration(StbExchangeConfig stbExchangeConfig) throws Exception {
|
||||
stbExchangeConfig.setOperation(OperationType.INSERT);
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
|
||||
exchangeSystemManagerService.registerSchedulation(stbExchangeConfig);
|
||||
}
|
||||
|
||||
public void updateConfiguration(long idToUpdate, StbExchangeConfig stbExchangeConfig) throws Exception {
|
||||
stbExchangeConfig.setOperation(OperationType.UPDATE);
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
|
||||
exchangeSystemManagerService.registerSchedulation(stbExchangeConfig);
|
||||
}
|
||||
|
||||
|
||||
public void deleteConfiguration(long idToDelete) throws Exception {
|
||||
exchangeSystemManagerService.deregisterSchedulation(idToDelete);
|
||||
|
||||
StbExchangeConfig stbExchangeConfigToDelete = new StbExchangeConfig()
|
||||
.setId(idToDelete);
|
||||
stbExchangeConfigToDelete.setOperation(OperationType.DELETE);
|
||||
|
||||
entityProcessor.processEntity(stbExchangeConfigToDelete, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
|
||||
public void insertRow(long configId, StbExchangeConfigDetail stbExchangeConfigDetail) throws Exception {
|
||||
StbExchangeConfig stbExchangeConfig = new StbExchangeConfig()
|
||||
.setId(configId);
|
||||
|
||||
stbExchangeConfig.setOperation(OperationType.NO_OP);
|
||||
|
||||
stbExchangeConfigDetail.setOperation(OperationType.INSERT);
|
||||
stbExchangeConfig.getStbExchangeConfigDetail().add(stbExchangeConfigDetail);
|
||||
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
|
||||
public void updateRow(long configId, StbExchangeConfigDetail stbExchangeConfigDetail) throws Exception {
|
||||
StbExchangeConfig stbExchangeConfig = new StbExchangeConfig()
|
||||
.setId(configId);
|
||||
|
||||
stbExchangeConfig.setOperation(OperationType.NO_OP);
|
||||
|
||||
stbExchangeConfigDetail.setOperation(OperationType.UPDATE);
|
||||
stbExchangeConfig.getStbExchangeConfigDetail().add(stbExchangeConfigDetail);
|
||||
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
|
||||
public void deleteRow(long configId, long rowid) throws Exception {
|
||||
|
||||
StbExchangeConfig stbExchangeConfig = new StbExchangeConfig()
|
||||
.setId(configId);
|
||||
|
||||
stbExchangeConfig.setOperation(OperationType.NO_OP);
|
||||
|
||||
StbExchangeConfigDetail stbExchangeConfigDetail = new StbExchangeConfigDetail()
|
||||
.setId(rowid)
|
||||
.setStbExchangeConfigId(configId);
|
||||
stbExchangeConfigDetail.setOperation(OperationType.DELETE);
|
||||
stbExchangeConfig.getStbExchangeConfigDetail().add(stbExchangeConfigDetail);
|
||||
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public void updateRowsOrder(long configId, HashMap<Long, Integer> orderedRows) throws Exception {
|
||||
StbExchangeConfig stbExchangeConfig = new StbExchangeConfig()
|
||||
.setId(configId);
|
||||
|
||||
stbExchangeConfig.setOperation(OperationType.NO_OP);
|
||||
|
||||
orderedRows.forEach((rowId, order) -> {
|
||||
StbExchangeConfigDetail stbExchangeConfigDetail = new StbExchangeConfigDetail()
|
||||
.setId(rowId)
|
||||
.setStbExchangeConfigId(configId)
|
||||
.setExecutionOrder(order);
|
||||
stbExchangeConfigDetail.setOperation(OperationType.UPDATE);
|
||||
stbExchangeConfig.getStbExchangeConfigDetail().add(stbExchangeConfigDetail);
|
||||
});
|
||||
|
||||
|
||||
entityProcessor.processEntity(stbExchangeConfig, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
@@ -13,7 +14,6 @@ import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -27,19 +27,14 @@ import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ExchangeDocumentImportService {
|
||||
|
||||
//TODO: To be remove, only for fast development
|
||||
private final String ROSSOGARGANO_EXCHANGE_PROFILEDB = "ROSSO_GARGANO_EXCHANGE";
|
||||
private final String ROSSOGARGANO_EXCHANGE_USER = "DBA";
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||
|
||||
@@ -51,38 +46,39 @@ public class ExchangeDocumentImportService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public void importTestateDocumentiLavorazione() throws Exception {
|
||||
public void importTestateDocumentiLavorazione(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
boolean useTempTable = true;
|
||||
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(ROSSOGARGANO_EXCHANGE_PROFILEDB)) {
|
||||
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione();
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione(internalMultiDb, exchangeMultiDb, requestDataDTO);
|
||||
|
||||
|
||||
final List<DtbDoct> exchangeImportedTestateData = importTestateDocumentiLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
true, false);
|
||||
|
||||
final List<DtbDoct> exchangeUpdatedTestateData = importTestateDocumentiLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
false, useTempTable);
|
||||
|
||||
exchangeUpdatedTestateData.forEach(x -> x.setUpdProgMaga(false));
|
||||
|
||||
|
||||
final List<DtbDocr> exchangeImportedRigheData = importRigheDocumentiLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
true, false);
|
||||
|
||||
final List<DtbDocr> exchangeUpdatedRigheData = importRigheDocumentiLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
false, useTempTable);
|
||||
@@ -138,15 +134,15 @@ public class ExchangeDocumentImportService {
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importati {} di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
logger.debug("Importati {} documenti di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (DtbDoct) dataToSave, useTempTable);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (DtbDoct) dataToSave, useTempTable);
|
||||
//multiDBTransactionManager.commitAll();
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
exchangeDb.commitAll();
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
@@ -163,8 +159,7 @@ public class ExchangeDocumentImportService {
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione);
|
||||
}
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.DocumentiLavorazione);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTable;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableView;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseView;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -18,19 +20,50 @@ import java.util.stream.Collectors;
|
||||
public class ExchangeImportSchemaManagerService {
|
||||
|
||||
|
||||
public enum SchemaType {
|
||||
ColliLavorazione,
|
||||
OrdiniLavorazione,
|
||||
DocumentiLavorazione,
|
||||
Articoli,
|
||||
PartiteMagazzinoLavorazione
|
||||
public enum SchemaType implements IBaseEnum {
|
||||
ColliLavorazione(1),
|
||||
OrdiniLavorazione(2),
|
||||
DocumentiLavorazione(3),
|
||||
Articoli(4),
|
||||
PartiteMagazzinoLavorazione(5);
|
||||
|
||||
private final int value;
|
||||
|
||||
SchemaType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static SchemaType from(Object value) {
|
||||
int castValue = (int) value;
|
||||
for (SchemaType b : SchemaType.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final HashMap<SchemaType, List<String>> schemaToTableBinding = new HashMap<SchemaType, List<String>>() {{
|
||||
put(SchemaType.ColliLavorazione, Arrays.asList("mtb_colt_lav", "mtb_colr_lav"));
|
||||
put(SchemaType.OrdiniLavorazione, Arrays.asList("dtb_ordt_lav", "dtb_ordr_lav"));
|
||||
put(SchemaType.DocumentiLavorazione, Arrays.asList("dtb_doct_lav", "dtb_docr_lav"));
|
||||
put(SchemaType.Articoli, Arrays.asList("mtb_aart", "mtb_grup", "mtb_sgrp", "mtb_sfam", "mtb_tipi"));
|
||||
put(SchemaType.Articoli, Arrays.asList("mtb_aart", "mtb_grup", "mtb_sgrp", "mtb_sfam", "mtb_tipi", "mtb_aart_marchio"));
|
||||
put(SchemaType.PartiteMagazzinoLavorazione, Arrays.asList("mtb_partita_mag_lav"));
|
||||
}};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
@@ -14,7 +15,6 @@ import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -28,20 +28,16 @@ import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ExchangeOrdiniImportService {
|
||||
|
||||
//TODO: To be remove, only for fast development
|
||||
private final String ROSSOGARGANO_EXCHANGE_PROFILEDB = "ROSSO_GARGANO_EXCHANGE";
|
||||
private final String ROSSOGARGANO_EXCHANGE_USER = "DBA";
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||
|
||||
@@ -51,24 +47,23 @@ public class ExchangeOrdiniImportService {
|
||||
@Autowired
|
||||
private ExchangePartiteMagazzinoImportService exchangePartiteMagazzinoImportService;
|
||||
|
||||
public void importOrdiniLavorazione() throws Exception {
|
||||
public void importOrdiniLavorazione(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
boolean useTempTable = true;
|
||||
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(ROSSOGARGANO_EXCHANGE_PROFILEDB)) {
|
||||
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.OrdiniLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione();
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.OrdiniLavorazione, useTempTable);
|
||||
exchangePartiteMagazzinoImportService.importPartiteMagazzinoLavorazione(internalMultiDb, exchangeMultiDb, requestDataDTO);
|
||||
|
||||
final List<DtbOrdt> exchangeImportedMtbColts = importOrdiniLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
true, false);
|
||||
|
||||
final List<DtbOrdt> exchangeUpdatedMtbColts = importOrdiniLavorazione(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusWeeks(1),
|
||||
UtilityLocalDate.getNow(),
|
||||
false, useTempTable);
|
||||
@@ -105,21 +100,21 @@ public class ExchangeOrdiniImportService {
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
|
||||
|
||||
for (EquatableEntityInterface dtbOrdtToSave : listToProcess) {
|
||||
for (EquatableEntityInterface dataToSave : listToProcess) {
|
||||
//calls.add(() -> {
|
||||
|
||||
logger.debug("Importati {} di {}", importedCounter[0].incrementAndGet(), allData.size());
|
||||
logger.debug("Importati {} ordini di {}", importedCounter[0].incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dtbOrdtToSave, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (DtbOrdt) dtbOrdtToSave, useTempTable);
|
||||
multiDBTransactionManager.commitAll();
|
||||
exchangeDb.commitAll();
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (DtbOrdt) dataToSave, useTempTable);
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
logger.error("Errore durante l'importazione dell'ordine", ex);
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
internalMultiDb.rollbackAll();
|
||||
//throw ex;
|
||||
}
|
||||
//});
|
||||
@@ -133,8 +128,7 @@ public class ExchangeOrdiniImportService {
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.OrdiniLavorazione);
|
||||
}
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.OrdiniLavorazione);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import it.integry.ems_model.entity.MtbPartitaMag;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -24,7 +23,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ExchangePartiteMagazzinoImportService {
|
||||
|
||||
//TODO: To be remove, only for fast development
|
||||
@@ -35,9 +33,6 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||
|
||||
@@ -46,23 +41,22 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public void importPartiteMagazzinoLavorazione() throws Exception {
|
||||
public void importPartiteMagazzinoLavorazione(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||
|
||||
boolean useTempTable = true;
|
||||
|
||||
try (MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(ROSSOGARGANO_EXCHANGE_PROFILEDB)) {
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione, useTempTable);
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione, useTempTable);
|
||||
|
||||
final List<MtbPartitaMag> exchangeImportedData = retrievePartite(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusMonths(3),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
LocalDate.of(2022, 1, 1),
|
||||
UtilityLocalDate.getNow(),
|
||||
true, false);
|
||||
|
||||
final List<MtbPartitaMag> exchangeUpdatedData = retrievePartite(
|
||||
exchangeDb.getPrimaryConnection(),
|
||||
UtilityLocalDate.getNow().minusMonths(3),
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
LocalDate.of(2022, 1, 1),
|
||||
UtilityLocalDate.getNow(),
|
||||
false, useTempTable);
|
||||
|
||||
@@ -83,19 +77,18 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importate {} partite di magazzino di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, multiDBTransactionManager);
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbPartitaMag) dataToSave, useTempTable);
|
||||
|
||||
singleUpdateImported(exchangeDb.getPrimaryConnection(), (MtbPartitaMag) dataToSave, useTempTable);
|
||||
//multiDBTransactionManager.commitAll();
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
exchangeDb.commitAll();
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
logger.error("Errore durante l'importazione della partita di magazzino", ex);
|
||||
//multiDBTransactionManager.rollbackAll();
|
||||
internalMultiDb.rollbackAll();
|
||||
exchangeMultiDb.rollbackAll();
|
||||
//throw ex;
|
||||
}
|
||||
|
||||
@@ -107,8 +100,7 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione);
|
||||
}
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +120,7 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbPartitaMag.class,
|
||||
mtbPartitaMagLavTableName, Query.format("data_ins BETWEEN {} AND {}", minDate, maxDate), retrieveAlreadyImported);
|
||||
mtbPartitaMagLavTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.annotations.PostContextAutowired;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.StbExchangeConfig;
|
||||
import it.integry.ems_model.entity.StbExchangeConfigDetail;
|
||||
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.scheduling.TaskScheduler;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
@Component
|
||||
public class ExchangeSystemManagerService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@PostContextAutowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private TaskScheduler taskScheduler;
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
private final HashMap<Long, ScheduledFuture<?>> scheduledOperations = new HashMap<>();
|
||||
|
||||
@PostContextConstruct(priority = 20)
|
||||
public void init() throws Exception {
|
||||
|
||||
if(!settingsModel.isPrimaryInstance())
|
||||
return;
|
||||
|
||||
for (AdvancedDataSource db : multiDBTransactionManager.getActiveConnections()) {
|
||||
|
||||
String query = "SELECT cast(Count(*) as bit) existTable FROM sys.objects WHERE object_id = OBJECT_ID(N'" + StbExchangeConfig.ENTITY + "') AND type in (N'U')";
|
||||
boolean existTable = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(db.getConnection(), query);
|
||||
|
||||
if (!existTable) continue;
|
||||
|
||||
List<StbExchangeConfig> stbExchangeConfigsToRetrieve = UtilityDB.executeSimpleQueryDTO(db.getConnection(),
|
||||
"SELECT * FROM " + StbExchangeConfig.ENTITY, StbExchangeConfig.class);
|
||||
if (stbExchangeConfigsToRetrieve == null) continue;
|
||||
|
||||
for (StbExchangeConfig stbExchangeConfig : stbExchangeConfigsToRetrieve) {
|
||||
registerSchedulation(stbExchangeConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deregisterSchedulation(long configId) {
|
||||
if (scheduledOperations.containsKey(configId)) {
|
||||
scheduledOperations.get(configId).cancel(false);
|
||||
scheduledOperations.remove(configId);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerSchedulation(StbExchangeConfig stbExchangeConfig) {
|
||||
deregisterSchedulation(stbExchangeConfig.getId());
|
||||
|
||||
CronTrigger cronTrigger = new CronTrigger(stbExchangeConfig.getSchedulationCron());
|
||||
|
||||
ScheduledFuture<?> future =
|
||||
taskScheduler.schedule(() -> executeExchange(stbExchangeConfig), cronTrigger);
|
||||
|
||||
scheduledOperations.put(stbExchangeConfig.getId(), future);
|
||||
}
|
||||
|
||||
private void executeExchange(StbExchangeConfig stbExchangeConfig) {
|
||||
logger.info("Avvio EXCHANGE [" + stbExchangeConfig.getDescription() + "]");
|
||||
|
||||
|
||||
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(stbExchangeConfig.getInternalProfileDb());
|
||||
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(stbExchangeConfig.getExternalProfileDb())) {
|
||||
|
||||
List<StbExchangeConfigDetail> stbExchangeConfigs = UtilityDB.executeSimpleQueryDTO(internalDb.getPrimaryConnection(),
|
||||
"SELECT * FROM " + StbExchangeConfigDetail.ENTITY + " " +
|
||||
" WHERE stb_exchange_config_id = " + stbExchangeConfig.getId() +
|
||||
" ORDER BY execution_order", StbExchangeConfigDetail.class);
|
||||
if (stbExchangeConfigs == null) return;
|
||||
|
||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||
requestDataDTO.setUsername("EXCHANGE");
|
||||
|
||||
for (StbExchangeConfigDetail stbExchangeConfigDetail : stbExchangeConfigs) {
|
||||
final ExchangeImportSchemaManagerService.SchemaType schemaType = ExchangeImportSchemaManagerService.SchemaType.from(stbExchangeConfigDetail.getConfigType());
|
||||
|
||||
switch (schemaType) {
|
||||
case ColliLavorazione:
|
||||
final ExchangeColliImportService beanColliLavorazione = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeColliImportService.class);
|
||||
beanColliLavorazione.importColliLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
break;
|
||||
|
||||
case OrdiniLavorazione:
|
||||
final ExchangeOrdiniImportService beanOrdiniLavorazione = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeOrdiniImportService.class);
|
||||
beanOrdiniLavorazione.importOrdiniLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
break;
|
||||
|
||||
case DocumentiLavorazione:
|
||||
final ExchangeDocumentImportService beanDocumentiLavorazione = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeDocumentImportService.class);
|
||||
beanDocumentiLavorazione.importTestateDocumentiLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
break;
|
||||
|
||||
case Articoli:
|
||||
final ExchangeArticoliImportService beanArticoli = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeArticoliImportService.class);
|
||||
beanArticoli.importArticoli(internalDb, exchangeDb, requestDataDTO);
|
||||
break;
|
||||
|
||||
case PartiteMagazzinoLavorazione:
|
||||
final ExchangePartiteMagazzinoImportService beanPartiteMagazzino = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangePartiteMagazzinoImportService.class);
|
||||
beanPartiteMagazzino.importPartiteMagazzinoLavorazione(internalDb, exchangeDb, requestDataDTO);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
logger.info("Fine EXCHANGE [" + stbExchangeConfig.getDescription() + "]");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,12 +5,8 @@ import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration.dto.SqlObjectTypeEnum;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.dto.SqlObjectDTO;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.StbGestSetup;
|
||||
import it.integry.ems_model.entity.StbGestSetupQuery;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
@@ -34,8 +30,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
@Scope(value = "request")
|
||||
@@ -72,6 +66,7 @@ public class SystemMigrationService {
|
||||
sqlObjectType = SqlObjectTypeEnum.PROCEDURE;
|
||||
break;
|
||||
case "T":
|
||||
case "TR":
|
||||
sqlObjectType = SqlObjectTypeEnum.TRIGGER;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user