aumentata la dimensione del campo annotazioni

This commit is contained in:
2024-03-25 14:41:18 +01:00
parent e6074d2b14
commit d1638842e7
3 changed files with 81 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20240325130406 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE dtb_doct\n" +
" ALTER COLUMN annotazioni VARCHAR(1024)",
"ALTER TABLE dtb_dift\n" +
" ALTER COLUMN annotazioni VARCHAR(1024)",
"ALTER TABLE dtb_dif_bolle\n" +
" ALTER COLUMN annotazioni VARCHAR(1024)");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -60,7 +60,7 @@ public class DtbDoct extends DtbBaseDocT {
@SqlField(value = "activity_id", maxLength = 15, nullable = true)
private String activityId;
@SqlField(value = "annotazioni", maxLength = 80, nullable = true)
@SqlField(value = "annotazioni", maxLength = 1024, nullable = true)
private String annotazioni;
@SqlField(value = "aspetto_beni", maxLength = 30, nullable = true)

View File

@@ -12,6 +12,7 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.utility.UtilityDebug;
import it.integry.ems.utility.UtilityEntity;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.db.ResultSetMapper;
import it.integry.ems_model.entity.*;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.*;
@@ -53,13 +54,16 @@ public class RossoGarganoSyncService {
logger.info("Importazione causali: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
saveGtbPaga(rgExchange.getConnection());
logger.info("Importazione codici pagamento: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");;
logger.info("Importazione codici pagamento: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
saveGtbAliq(rgExchange.getConnection());
logger.info("Importazione codici aliquota: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");;
logger.info("Importazione codici aliquota: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
saveVtbAgen(rgExchange.getConnection());
logger.info("Importazione agenti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");;
logger.info("Importazione agenti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
savePdc(rgExchange.getConnection());
logger.info("Importazione agenti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
String sql =
"SELECT CAST(FORMAT(DATEPART(YEAR, data_iniz), '0000') +\n" +
@@ -244,7 +248,7 @@ public class RossoGarganoSyncService {
codCcon = UtilityHashMap.getValueIfExists(datiAnag, "cod_ccon" );
tipoAnag = UtilityHashMap.getValueIfExists(datiAnag, "tipo_anag" );
if (UtilityString.isNullOrEmpty(codCcon))
throw new Exception(String.format("Codice conto non agganacito al cliente %s", codAnag));
throw new Exception(String.format("Codice conto non agganciato al cliente %s ( %s)", codAnag, pnCodAnag));
}
String sezionaleIva = UtilityHashMap.getValueIfExists(c, "PN_SEZIONALE_IVA");
@@ -596,6 +600,52 @@ public class RossoGarganoSyncService {
}
UtilityEntity.throwEntitiesException(entityProcessor.processEntityList(entityList, true));
}
private void savePdc(Connection sourceData) throws Exception {
String sql =
"WITH mov AS (SELECT DISTINCT pn_cod_anag\n" +
" FROM [dbo].[PNOTA]\n" +
" WHERE pn_data_competenza > 20210701)\n" +
" , conti AS (SELECT *\n" +
" FROM mov\n" +
" WHERE pn_cod_anag NOT IN (SELECT diacod\n" +
" FROM rossogargano.dbo.ctb_cont\n" +
" WHERE diacod IS NOT NULL\n" +
" UNION\n" +
" SELECT diacod\n" +
" FROM rossogargano.dbo.gtb_anag\n" +
" WHERE diacod IS NOT NULL))\n" +
" , conti_new AS (SELECT SUBSTRING(cl_codice, 2, 4) AS cod_cmas,\n" +
" SUBSTRING(cl_codice, 2, 2) AS cod_cgrp,\n" +
" cl_ragione_soc AS descrizione,\n" +
" NULL AS tipo_riep,\n" +
" 0 AS saldo_att,\n" +
" 'N' AS flag_cont_att,\n" +
" NULL AS cod_biva,\n" +
" NULL AS cod_jfas,\n" +
" NULL AS cod_csct,\n" +
" 'N' AS flag_risconto,\n" +
" 0 AS perc_ded,\n" +
" cl_codice AS diacod\n" +
" FROM anag\n" +
" WHERE cl_codice IN (SELECT pn_cod_anag FROM conti)\n" +
" AND cl_codice NOT LIKE '9%'\n" +
" AND cl_codice NOT LIKE '1%')\n" +
"\n" +
"\n" +
"SELECT FORMAT(CAST(conti_rg.max_id AS INT) +\n" +
" ROW_NUMBER() OVER (PARTITION BY conti_new.cod_cgrp, conti_new.cod_cmas ORDER BY conti_new.diacod),\n" +
" '000000') AS cod_ccon,\n" +
" conti_new.*\n" +
"FROM conti_new\n" +
" INNER JOIN (SELECT cod_cgrp, cod_cmas, MAX(cod_ccon) AS max_id\n" +
" FROM rossogargano.dbo.ctb_cont\n" +
" GROUP BY cod_cgrp, cod_cmas) conti_rg\n" +
" ON conti_new.cod_cgrp = conti_rg.cod_cgrp AND conti_new.cod_cmas = conti_rg.cod_cmas";
List<CtbCont> ctbConts = new ResultSetMapper().mapQuerySetToList(sourceData, sql, CtbCont.class, OperationType.INSERT);
UtilityEntity.throwEntitiesException(entityProcessor.processEntityList(ctbConts, true));
}
private void saveVtbAgen(Connection sourceData) throws Exception {
String sql =
" select distinct PN_COD_AGENTE\n" +