Merge branch 'develop' into feature/LottiScadMult
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-04-10 18:08:22 +02:00
46 changed files with 713 additions and 183 deletions

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
@@ -141,6 +142,8 @@ public class ResponseJSONObjectMapper extends ObjectMapper {
setupEntityModules(simpleModule);
registerModule(simpleModule);
configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);

View File

@@ -0,0 +1,98 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250409170559 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
createOrUpdateFunction("getDocuPrint", "CREATE FUNCTION [dbo].[getDocuPrint]\n" +
"( \n" +
" @codAnag varchar(5), @codDtip varchar(5), @dataDoc datetime, @serDoc varchar(2), @numDoc int\n" +
") RETURNS TABLE AS\n" +
"\n" +
"RETURN \n" +
"select docu.cod_anag,\n" +
" cod_dtip,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" tipo_cessione, \n" +
" id_riga,\n" +
" docu.cod_mart,\n" +
" descrizione,\n" +
" ISNULL(dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'CODICEARTICOLO_EAN_TIPO')), tipo_codice_ean) as tipo_codice_ean, \n" +
" valore_codice_ean,\n" +
" ISNULL(dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'CODICEARTICOLO_FORN_TIPO')), tipo_codice_forn) as tipo_codice_forn, \n" +
" valore_codice_forn,\n" +
" ISNULL(dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'CODICEARTICOLO_CLIE_TIPO')), tipo_codice_clie) as tipo_codice_clie,\n" +
" CASE docu.cod_anag WHEN 'C1275' THEN mtb_aart_anag.cod_mart_anag ELSE valore_codice_clie END as valore_codice_clie,\n" +
" ISNULL(dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'ALTRIDATI_CT_ART_TIPO')), tipodato_ct_art) as tipodato_ct_art,\n" +
" CASE WHEN docu.cod_anag in ('C1217', 'C1606', 'C1944', 'C0966', 'C1799', 'C1587') THEN num_cnf ELSE rifNumero_ct_art END as rifNumero_ct_art,\n" +
" rifTesto_ct_art,\n" +
" ISNULL(dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'ALTRIDATI_PZ_ART_TIPO')), tipodato_pz_art) as tipodato_pz_art,\n" +
" CASE WHEN docu.cod_anag in ('C1217', 'C1606', 'C1944', 'C0966', 'C1799', 'C1587') THEN qta_cnf ELSE rifNumero_pz_art END as rifNumero_pz_art, \n" +
" rifTesto_pz_art,\n" +
" case when dbo.getGestSetup('FATTURA_ELETTRONICA_CUSTOM', 'COD_ANAG_' + docu.cod_anag, 'UNITA_MISURA_EDI') = 'S' THEN dbo.GetDocuPrint_getUMEDI(unt_doc) ELSE unt_doc END as unt_doc , \n" +
" qta_doc,\n" +
" val_unt,\n" +
" sconto5,\n" +
" sconto6,\n" +
" sconto7,\n" +
" sconto8,\n" +
" importo_riga,\n" +
" docu.cod_aliq,\n" +
" perc_aliq, \n" +
" natura, \n" +
" data_iniz_comp,\n" +
" data_fine_comp,\n" +
" cod_kit,\n" +
" descr_kit,\n" +
" tipodato_lotto,\n" +
" rifTesto_lotto,\n" +
" ISNULL(case when docu.cod_anag = 'C0966' then 'DP' + '|' else '' end + dbo.f_emptyStr2Null((select value from stb_gest_setup where gest_name = 'FATTURA_ELETTRONICA_CUSTOM' and section = 'COD_ANAG_' + docu.cod_anag and key_section = 'ALTRIDATI_DEST_TIPO')), tipodato_dest) as tipodato_dest,\n" +
" CASE docu.cod_anag \n" +
" WHEN 'C0326' THEN null \n" +
" WHEN 'C0731' THEN null \n" +
" WHEN 'C0328' THEN null \n" +
" WHEN 'C0432' THEN null\n" +
" WHEN 'C1830' THEN null ELSE rifNumero_dest END as rifNumero_dest,\n" +
" LEFT(CASE docu.cod_anag \n" +
" WHEN 'C2499' then SPACE(1) /*Necessario per nom visualizzare l'indirizzo come richiesto dal cliente*/\n" +
" WHEN 'C1765' THEN vtb_dest.destinatario \n" +
" WHEN 'C1275' THEN vtb_dest.cod_ean\n" +
" WHEN 'C0432' THEN vtb_dest.cod_affiliazione\n" +
" WHEN 'C1830' THEN vtb_dest.cod_ean\n" +
" WHEN 'C0328' THEN vtb_dest.cod_affiliazione\n" +
" WHEN 'C0731' THEN vtb_dest.cod_ean\n" +
" WHEN 'C0326' THEN vtb_dest.cod_affiliazione ELSE\n" +
" CASE WHEN docu.cod_anag in ('C1217', 'C1606', 'C1944', 'C1799', 'C1587') THEN vtb_dest.cod_ean +';'+vtb_dest.destinatario ELSE case when docu.cod_anag in ('C0966') then vtb_dest.cod_ean +'|'+vtb_dest.destinatario else rifTesto_dest END END END, 60) as rifTesto_dest, \n" +
" data_ddt, \n" +
" CASE docu.cod_anag WHEN 'C0731' THEN \n" +
" CASE WHEN isNull(num_doc_ddt, '') = '' THEN null ELSE ser_doc_ddt + ' ' + Cast(num_doc_ddt as varchar) END \n" +
" ELSE num_ddt END as num_ddt, \n" +
" rif_data_ord, \n" +
" rif_num_ord, \n" +
" rifTesto_numDocCli, \n" +
" tipoDato_numDocCli\n" +
"from dbo.getDocuPrint_generica(@codAnag, @CodDtip, @dataDoc, @serDoc, @numDoc) docu left outer join vtb_dest on docu.cod_anag = vtb_dest.cod_anag and\n" +
" docu.cod_vdes = vtb_dest.cod_vdes\n" +
" left outer join mtb_aart_anag on docu.cod_anag = mtb_aart_anag.cod_anag and \n" +
" docu.cod_mart = mtb_aart_anag.cod_mart\n" +
"where docu.cod_anag <> 'C0326' OR (docu.cod_anag = 'C0326' AND docu.qta_doc <> 0 AND docu.val_unt <> 0 AND isnull(natura,'') <>'N2.2')");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,20 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250410120833 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("update stb_menu set descrizione = 'Situazione partite a data con giorni di dilazione' where cod_opz = 'cr091'",
"update stb_menu_opz set descrizione = 'Situazione partite a data con giorni di dilazione' where cod_opz = 'cr091'");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,23 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250410121218 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement(
"insert into stb_abil\n" +
"select stb_menu_opz.cod_opz, user_name, flag_abil, stb_menu_opz.gest_name\n" +
"from ( select * from stb_abil where stb_abil.cod_opz = 'CR012' ) stb_abil\n" +
"cross apply ( select * from stb_menu_opz where stb_menu_opz.cod_opz ='CR091' ) stb_menu_opz");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,23 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250410130654 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createSetup("W_VLISTDATA_RC", "SETUP", "SUGGESTCODE_PROMO", null,
"Se non specificato nulla viene passato alla suggestcode il partial_code = cod_vlis, altrimenti viene passato il partial_code = codice_promo specificato dall'utente", false, null, false, false,
false, false, false, null, false, null);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,41 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250410130713 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
updateSetupValue("W_VLISTDATA_RC", "SETUP", "SUGGESTCODE_PROMO", "COD_PROMO",
"Se non specificato nulla viene passato alla suggestcode il partial_code = cod_vlis, altrimenti viene passato il partial_code = codice_promo specificato dall'utente", false, null, false, false, false,
false, false, null, false, null);
executeStatement("DELETE\n" +
"FROM stb_gest_setup_depo\n" +
"WHERE gest_name = 'W_VLISTDATA_RC'\n" +
" AND section = 'SETUP'\n" +
" AND key_section = 'SUGGESTCODE_PROMO'"
);
executeStatement("DELETE\n" +
"FROM wtb_gest_setup_user\n" +
"WHERE gest_name = 'W_VLISTDATA_RC'\n" +
" AND section = 'SETUP'\n" +
" AND key_section = 'SUGGESTCODE_PROMO'"
);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250410131614 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
enableSaveToRest("dtipi");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -601,24 +601,37 @@ public class DocumentRules extends QueryRules {
public static void completeDatiDocMtbColt(Connection connection, DtbDoct testata) throws SQLException {
List<MtbColt> colli = testata.getMtbColt().stream().filter(x -> x.getNativeSql() == null).collect(Collectors.toList());
for (MtbColt mtbColt: colli) {
boolean isDelete = mtbColt.getOperation() == OperationType.DELETE;
String sql =
Query.format(
"SELECT CAST(IIF(flag_collo_anonimo='N',0,1) as bit) FROM mtb_colt WHERE gestione = %s AND data_collo = %s AND ser_collo = %s AND num_collo = %s",
mtbColt.getGestione(),
mtbColt.getDataCollo(),
mtbColt.getSerCollo(),
mtbColt.getNumCollo());
boolean cancellaRifDoc;
if ( mtbColt.getCancellaRifDoc()==null) {
if ( mtbColt.getOperation() == OperationType.DELETE) {
cancellaRifDoc = true;
mtbColt.setOperation(OperationType.UPDATE);
} else {
cancellaRifDoc = false;
}
} else {
cancellaRifDoc = mtbColt.getCancellaRifDoc();
}
if (mtbColt.getOperation() != OperationType.DELETE) {
String sql =
Query.format(
"SELECT CAST(IIF(flag_collo_anonimo='N',0,1) as bit) FROM mtb_colt WHERE gestione = %s AND data_collo = %s AND ser_collo = %s AND num_collo = %s",
mtbColt.getGestione(),
mtbColt.getDataCollo(),
mtbColt.getSerCollo(),
mtbColt.getNumCollo());
boolean colloAnonimo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
boolean colloAnonimo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
mtbColt
.setCodAnag(cancellaRifDoc && colloAnonimo ? EmsRestConstants.NULL : testata.getCodAnag())
.setCodDtip(cancellaRifDoc ? EmsRestConstants.NULL : testata.getCodDtip())
.setDataDoc(cancellaRifDoc ? EmsRestConstants.DATE_NULL : testata.getDataDoc())
.setSerDoc(cancellaRifDoc ? EmsRestConstants.NULL : testata.getSerDoc())
.setNumDoc(cancellaRifDoc ? EmsRestConstants.INTEGER_NULL : testata.getNumDoc())
.setOperation(OperationType.UPDATE);
}
mtbColt
.setCodAnag(isDelete && colloAnonimo?EmsRestConstants.NULL:testata.getCodAnag())
.setCodDtip(isDelete?EmsRestConstants.NULL:testata.getCodDtip())
.setDataDoc(isDelete?EmsRestConstants.DATE_NULL:testata.getDataDoc())
.setSerDoc(isDelete?EmsRestConstants.NULL:testata.getSerDoc())
.setNumDoc(isDelete?EmsRestConstants.INTEGER_NULL:testata.getNumDoc());
mtbColt.setOperation(OperationType.UPDATE);
}
}

View File

@@ -224,10 +224,12 @@ public class BasicConnectionPool {
}
private boolean handleConnectionRelease(DataSource ds)
throws SQLException {
throws SQLException, IOException {
String connectionName = ds.getApplicationName();
String dbName = ds.getDbName();
ds.getConnection().rollback();
if (connectionName.startsWith(ExtraConnectionNamePrefix)) {
activeConnectionNames.get(dbName).remove(connectionName);
ds.forceClose();

View File

@@ -101,6 +101,7 @@ public class UserCacheService {
}
public List<String> retrieveProfilesOfUser(String username, String password, IntegryApplicationEnum application) {
ArrayList<String> profiles = new ArrayList<>();
for (Map.Entry<String, List<UserDTO>> users : cachedUsers.entrySet()) {
@@ -115,6 +116,7 @@ public class UserCacheService {
}
public @Nullable UserDTO retrieveUser(String dbName, String md5User) {
cacheLock.lock();
List<UserDTO> users = cachedUsers.getOrDefault(dbName, null);
if (users == null || users.isEmpty())
@@ -130,10 +132,12 @@ public class UserCacheService {
})
.findFirst();
cacheLock.unlock();
return foundUser.orElse(null);
}
public @Nullable UserDTO retrieveUser(String dbName, String username, String password, IntegryApplicationEnum application) {
cacheLock.lock();
List<UserDTO> users = cachedUsers.getOrDefault(dbName, null);
if (users == null || users.isEmpty())
@@ -154,12 +158,14 @@ public class UserCacheService {
(application == IntegryApplicationEnum.GESTIONALE_BASE && x.isInternal())))
.findFirst();
cacheLock.unlock();
return foundUser.orElse(null);
}
public @Nullable UserDTO retrieveUserData(String profileDb, String username, IntegryApplicationEnum application) {
String dbName = settingsModel.getDbNameFromProfileDb(profileDb);
cacheLock.lock();
List<UserDTO> users = cachedUsers.getOrDefault(dbName, null);
if (users == null || users.isEmpty())
@@ -173,6 +179,7 @@ public class UserCacheService {
(application == IntegryApplicationEnum.WMS && x.isWeb()) ||
(application == IntegryApplicationEnum.GESTIONALE_BASE && x.isInternal())))
.findFirst();
cacheLock.unlock();
return foundUser.orElse(null);
}

View File

@@ -1686,12 +1686,10 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
String sql = "UPDATE mtb_invent SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null, flag_stato = 1 ";
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(null), false);
connection.createStatement().executeUpdate(sql);
/*for (MtbColt mtbColt : getMtbColt()) {
mtbColt.manageWithParentConnection(connection, mtbColt.getOperation(), dataCompleting, entityHolder);
} */
sql = "UPDATE mtb_colt SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null ";
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(null), false);
connection.createStatement().executeUpdate(sql);
if ("S".equals(getGeneraMovCont())) {
if (getWhereCond() == null) {
setWhereCond(getPkWhereCond());

View File

@@ -85,7 +85,7 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
private LocalDate dataOrd;
@SqlField(value = "data_collo_rif")
private Date dataColloRif;
private LocalDate dataColloRif;
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
private BigDecimal qtaCnf;
@@ -339,11 +339,11 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
return this;
}
public Date getDataColloRif() {
public LocalDate getDataColloRif() {
return dataColloRif;
}
public MtbColr setDataColloRif(Date dataColloRif) {
public MtbColr setDataColloRif(LocalDate dataColloRif) {
this.dataColloRif = dataColloRif;
return this;
}

View File

@@ -1,5 +1,6 @@
package it.integry.ems_model.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import it.integry.common.var.CommonConstants;
import it.integry.ems_model.annotation.*;
@@ -183,6 +184,8 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
private boolean updateColliFromDoc = false;
private Boolean cancellaRifDoc;
@EntityChild
@ReloadRow
private List<MtbColr> mtbColr = new ArrayList<>();
@@ -544,6 +547,15 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
return this;
}
public Boolean getCancellaRifDoc() {
return cancellaRifDoc;
}
public MtbColt setCancellaRifDoc(Boolean cancellaRifDoc) {
this.cancellaRifDoc = cancellaRifDoc;
return this;
}
public Date getDataDistribuzione() {
return dataDistribuzione;
}

View File

@@ -30,15 +30,17 @@ public class DocumentExtEntityRules {
colt.getSerCollo().equalsIgnoreCase(mtbColt.getSerCollo()) &&
colt.getNumCollo().equals(mtbColt.getNumCollo()))
.findFirst();
if (first.isPresent()) {
first.get().setCodDtip(EmsRestConstants.NULL)
.setCodAnag(EmsRestConstants.NULL)
.setDataDoc(EmsRestConstants.DATE_NULL)
.setSerDoc(EmsRestConstants.NULL)
.setNumDoc(EmsRestConstants.INTEGER_NULL)
.setCodAnag(mtbColt.getFlagColloAnonimo().equalsIgnoreCase("S")?EmsRestConstants.NULL:mtbColt.getCodAnag())
.setCodVdes(mtbColt.getFlagColloAnonimo().equalsIgnoreCase("S")?EmsRestConstants.NULL:mtbColt.getCodVdes());
first.get().setOperation(OperationType.UPDATE);
if (first.isPresent() ) {
if (first.get().getOperation() != OperationType.DELETE) {
first.get().setCodDtip(EmsRestConstants.NULL)
.setCodAnag(EmsRestConstants.NULL)
.setDataDoc(EmsRestConstants.DATE_NULL)
.setSerDoc(EmsRestConstants.NULL)
.setNumDoc(EmsRestConstants.INTEGER_NULL)
.setCodAnag(mtbColt.getFlagColloAnonimo().equalsIgnoreCase("S") ? EmsRestConstants.NULL : mtbColt.getCodAnag())
.setCodVdes(mtbColt.getFlagColloAnonimo().equalsIgnoreCase("S") ? EmsRestConstants.NULL : mtbColt.getCodVdes());
first.get().setOperation(OperationType.UPDATE);
}
} else {
mtbColt.setCodDtip(EmsRestConstants.NULL)
.setCodAnag(EmsRestConstants.NULL)

File diff suppressed because one or more lines are too long