Modifica puddy
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.ems.migration.model;
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
import it.integry.ems.migration._base.BaseMigration;
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
public class Migration_20250307174630 extends BaseMigration implements MigrationModelInterface {
|
public class Migration_20250307174630 extends BaseMigration implements MigrationModelInterface {
|
||||||
@@ -10,6 +11,9 @@ public class Migration_20250307174630 extends BaseMigration implements Migration
|
|||||||
if (isHistoryDB())
|
if (isHistoryDB())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||||
|
return;
|
||||||
|
|
||||||
createOrUpdateFunction("f_ExplodeDistProdCosti", "CREATE Function [dbo].[f_ExplodeDistProdCosti] ( @as_codPArent varchar(15), \n" +
|
createOrUpdateFunction("f_ExplodeDistProdCosti", "CREATE Function [dbo].[f_ExplodeDistProdCosti] ( @as_codPArent varchar(15), \n" +
|
||||||
" @as_codProd varchar(15), \n" +
|
" @as_codProd varchar(15), \n" +
|
||||||
" @ac_qtaProd decimal(20,5), \n" +
|
" @ac_qtaProd decimal(20,5), \n" +
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
package it.integry.ems.migration.model;import it.integry.ems.migration._base.BaseMigration;
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
public class Migration_20250310151343 extends BaseMigration implements MigrationModelInterface{
|
public class Migration_20250310151343 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void up()throws Exception {
|
public void up() throws Exception {
|
||||||
if(isHistoryDB())
|
if (isHistoryDB())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
executeStatement("delete from dbo.stb_gest_setup where gest_name = 'PUDDY' and section = 'ORDINI_VENDITA'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void down()throws Exception {
|
public void down() throws Exception {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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_20250310152927 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Salpar_MasabaSrl))
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateSetupValue("IMPORT_ORDINI", "PUDDY", "EMAIL_FOR_LOG", "test@integry.it",
|
||||||
|
"Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false, false,
|
||||||
|
false, false, null, false, null);
|
||||||
|
|
||||||
|
executeStatement("DELETE\n" +
|
||||||
|
"FROM stb_gest_setup_depo\n" +
|
||||||
|
"WHERE gest_name = 'IMPORT_ORDINI'\n" +
|
||||||
|
" AND section = 'PUDDY'\n" +
|
||||||
|
" AND key_section = 'EMAIL_FOR_LOG'"
|
||||||
|
);
|
||||||
|
|
||||||
|
executeStatement("DELETE\n" +
|
||||||
|
"FROM wtb_gest_setup_user\n" +
|
||||||
|
"WHERE gest_name = 'IMPORT_ORDINI'\n" +
|
||||||
|
" AND section = 'PUDDY'\n" +
|
||||||
|
" AND key_section = 'EMAIL_FOR_LOG'"
|
||||||
|
);
|
||||||
|
createSetup("IMPORT_ORDINI", "PUDDY", "NUOVO_CLIENT_AGENTE_0001", "CX001",
|
||||||
|
"Nuovo cliente per agente 0001", false, null, false, false,
|
||||||
|
false, false, false, null, false, null);
|
||||||
|
createSetup("IMPORT_ORDINI", "PUDDY", "NUOVO_CLIENT_AGENTE_0006", "CX001",
|
||||||
|
"Nuovo cliente per agente 0006", false, null, false, false,
|
||||||
|
false, false, false, null, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import it.integry.ems_model.utility.UtilityLocalDate;
|
|||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.ListableBeanFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -62,6 +63,8 @@ public class PuddyService {
|
|||||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||||
private String condResi = " ((qta_resi <> 0 AND flag_tipo_reso = 'R') OR (qta_resi <> 0 AND flag_tipo_reso = 'S')) ";
|
private String condResi = " ((qta_resi <> 0 AND flag_tipo_reso = 'R') OR (qta_resi <> 0 AND flag_tipo_reso = 'S')) ";
|
||||||
private String condEsclResi = " (NOT " + condResi + ") ";
|
private String condEsclResi = " (NOT " + condResi + ") ";
|
||||||
|
@Autowired
|
||||||
|
private ListableBeanFactory listableBeanFactory;
|
||||||
|
|
||||||
private void setLog(List<ImportLog> logs, Date dataOrd, Integer numOrd, String errorMsg, String tipoImport) {
|
private void setLog(List<ImportLog> logs, Date dataOrd, Integer numOrd, String errorMsg, String tipoImport) {
|
||||||
ImportLog log = new ImportLog();
|
ImportLog log = new ImportLog();
|
||||||
@@ -640,7 +643,7 @@ public class PuddyService {
|
|||||||
" ,x_puddy3_prev_ordini.sconto2 " +
|
" ,x_puddy3_prev_ordini.sconto2 " +
|
||||||
" ,x_puddy3_prev_ordini.sconto3 " +
|
" ,x_puddy3_prev_ordini.sconto3 " +
|
||||||
" ,x_puddy3_prev_ordini.sconto4 " +
|
" ,x_puddy3_prev_ordini.sconto4 " +
|
||||||
" ,x_puddy3_prev_ordini.cod_promo " +
|
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <> 'SE' then x_puddy3_prev_ordini.cod_promo else 'SE' + replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg, " +
|
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg, " +
|
||||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||||
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
||||||
@@ -676,7 +679,7 @@ public class PuddyService {
|
|||||||
" ,x_puddy3_prev_ordini.sconto2 " +
|
" ,x_puddy3_prev_ordini.sconto2 " +
|
||||||
" ,x_puddy3_prev_ordini.sconto3 " +
|
" ,x_puddy3_prev_ordini.sconto3 " +
|
||||||
" ,x_puddy3_prev_ordini.sconto4 " +
|
" ,x_puddy3_prev_ordini.sconto4 " +
|
||||||
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) ='SE' then x_puddy3_prev_ordini.cod_promo else 'SE' + replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <>'SE' then x_puddy3_prev_ordini.cod_promo else 'SE' + replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg " +
|
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg " +
|
||||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||||
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
||||||
@@ -724,7 +727,7 @@ public class PuddyService {
|
|||||||
|
|
||||||
// Se si tratta di un cliente non presente in VG allora viene letto il codice cliente nuovo fittizio dell'agente
|
// Se si tratta di un cliente non presente in VG allora viene letto il codice cliente nuovo fittizio dell'agente
|
||||||
if (codAnagVG == null){
|
if (codAnagVG == null){
|
||||||
codAnagVG = setupGest.getSetup("PUDDY", "ORDINI_VENDITA", "NUOVO_CLIENT_AGENTE_" + codVage);
|
codAnagVG = setupGest.getSetup("IMPORT_ORDINI", "PUDDY", "NUOVO_CLIENT_AGENTE_" + codVage);
|
||||||
codVdesVG = (String) getSingleValue(conn, "select cod_vdes from vtb_dest where cod_anag = " + UtilityDB.valueToString(codAnagVG));
|
codVdesVG = (String) getSingleValue(conn, "select cod_vdes from vtb_dest where cod_anag = " + UtilityDB.valueToString(codAnagVG));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,9 +865,13 @@ public class PuddyService {
|
|||||||
multiDBTransactionManager.commitAll();
|
multiDBTransactionManager.commitAll();
|
||||||
multiDBTransactionManagerVG.commitAll();
|
multiDBTransactionManagerVG.commitAll();
|
||||||
|
|
||||||
|
List.setEsito(EsitoType.OK);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
multiDBTransactionManager.rollbackAll();
|
multiDBTransactionManager.rollbackAll();
|
||||||
multiDBTransactionManagerVG.rollbackAll();
|
multiDBTransactionManagerVG.rollbackAll();
|
||||||
|
|
||||||
|
/* List.setEsito(EsitoType.KO);
|
||||||
|
List.setErrorMessage("ERRORE ORDINE PROVV. N." + numOrdProv + " agente " + codVage + CommonConstants.A_CAPO + e.getMessage());*/
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,11 +928,25 @@ public class PuddyService {
|
|||||||
res.close();
|
res.close();
|
||||||
info.close();
|
info.close();
|
||||||
|
|
||||||
|
String oggetto = null, messaggio = null;
|
||||||
|
String emailForLog = setupGest.getSetup("IMPORT_ORDINI", "PUDDY", "EMAIL_FOR_LOG");
|
||||||
if (existAnomalia) {
|
if (existAnomalia) {
|
||||||
|
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
||||||
|
oggetto = "ERRORE Importazione ordini agente " + codVage;
|
||||||
|
messaggio = resp.getErrorMessage();
|
||||||
|
}
|
||||||
|
|
||||||
multiDBTransactionManager.rollbackAll();
|
multiDBTransactionManager.rollbackAll();
|
||||||
} else {
|
} else {
|
||||||
|
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
||||||
|
oggetto = "Importazione ordini agente " + codVage + " avvenuta con successo";
|
||||||
|
messaggio = oggetto + CommonConstants.A_CAPO;
|
||||||
|
}
|
||||||
|
|
||||||
multiDBTransactionManager.commitAll();
|
multiDBTransactionManager.commitAll();
|
||||||
}
|
}
|
||||||
|
mailService.sendMail(emailForLog, null, oggetto, messaggio);
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user