Merge branch 'refs/heads/develop' into feature/Feature-variazioni2
This commit is contained in:
@@ -11,10 +11,7 @@ public class Migration_20240516144054 extends BaseMigration implements Migration
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("getListinoVendita", "/*declare @dataValidita DATETIME, @codVlis VARCHAR(5), @codMart VARCHAR(15)\n" +
|
||||
"\n" +
|
||||
"set @dataValidita = '2024/01/01'\n" +
|
||||
"--set @codVlis = '01' */\n" +
|
||||
createOrUpdateFunction("getListinoVendita",
|
||||
"CREATE FUNCTION [dbo].[getListinoVendita](@dataValidita DATETIME, @codVlis VARCHAR(5), @codMart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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_20240517120317 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("update stb_gest_setup set section = 'GESTISCI_QTA_MULTIPLA' where section = 'KIT_MANUTENZIONE';");
|
||||
|
||||
if (!isCustomerDb(
|
||||
IntegryCustomerDB.Gramm_Gramm)){
|
||||
return;
|
||||
}
|
||||
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "ARTICOLO_RIFERIMENTO_INS_KIT", "TOTALE_NETTO", "Indicare il cod_vart_rif subito prima il quale verrà inserito il kit manutenzione", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "ARTICOLO_RIFERIMENTO_KIT", "KIT_MANUTENZIONE", "Indicare il cod_vart_rif con cui il kit verrà inserito nell'offerta", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "ATTIVO", "S", "Se impoststo S viene visualizzato un testo in menù modalità scheda che se cliccato permette di visualizzare eventuali articoli che prevedono quantità multipla con la relativa quantità da aggiungere all'offerta come kit manutenzione", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "PARAGRAFO_RIGHE", "COMPUTO MATERIALI", "Inserire il nome del cod_vart_rif con cui verranno inseriti gli articoli nel kit", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "PARAGRAFO_SUBTOTALE", "SUBTOTALE", "Paragrafo subtotale modulo kit manutenzione", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "PARAGRAFO_TITOLO", "DESCRIZIONE MODULO", "Indicare il paragrafo titolo che verrà inserito nell'offerta", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("w_pprevt_rc", "KIT_MANUTENZIONE", "PARAGRAFO_TITOLO_DESCRIZIONE", "Elenco articoli per compensazione articoli multipli", "Descrizione paragrafo titolo", false, null, false, false, false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,8 @@ public class JasperDTO {
|
||||
|
||||
private int colorScale = BufferedImage.TYPE_INT_RGB;
|
||||
|
||||
private int copies = 0;
|
||||
|
||||
public Long getReportId() {
|
||||
return reportId;
|
||||
}
|
||||
@@ -173,6 +175,15 @@ public class JasperDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCopies() {
|
||||
return copies;
|
||||
}
|
||||
|
||||
public JasperDTO setCopies(int copies) {
|
||||
this.copies = copies;
|
||||
return this;
|
||||
}
|
||||
|
||||
public enum TypeExportEnum {
|
||||
PDF("PDF"),
|
||||
XLSX("XLSX"),
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
import net.sf.jasperreports.engine.data.JsonDataSource;
|
||||
import net.sf.jasperreports.engine.design.JRDesignQuery;
|
||||
import net.sf.jasperreports.engine.design.JasperDesign;
|
||||
import net.sf.jasperreports.engine.export.JRPdfExporter;
|
||||
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
|
||||
import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory;
|
||||
import net.sf.jasperreports.engine.type.OrientationEnum;
|
||||
@@ -31,6 +32,7 @@ import net.sf.jasperreports.engine.util.JRXmlUtils;
|
||||
import net.sf.jasperreports.engine.xml.JRXmlLoader;
|
||||
import net.sf.jasperreports.export.SimpleExporterInput;
|
||||
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
|
||||
import net.sf.jasperreports.export.SimplePdfExporterConfiguration;
|
||||
import net.sf.jasperreports.export.SimpleXlsxReportConfiguration;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -296,17 +298,17 @@ public class ReportProcessor {
|
||||
}
|
||||
|
||||
private void completeParameter(JasperDTO jasperDTO, HashMap<String, Object> hm_parameters) throws Exception {
|
||||
String sql =
|
||||
Query.format("SELECT wtb_jrepr.parameter_name,\n" +
|
||||
" wtb_jrepr.expression\n" +
|
||||
"FROM wtb_jrept\n" +
|
||||
" INNER JOIN wtb_jrepr ON wtb_jrept.id = wtb_jrepr.report_id\n" +
|
||||
"WHERE ( wtb_jrept.report_name = %s OR wtb_jrept.id = %s) \n" +
|
||||
" AND expression IS NOT NULL", jasperDTO.getReportName(), jasperDTO.getReportId());
|
||||
String sql =
|
||||
Query.format("SELECT wtb_jrepr.parameter_name,\n" +
|
||||
" wtb_jrepr.expression\n" +
|
||||
"FROM wtb_jrept\n" +
|
||||
" INNER JOIN wtb_jrepr ON wtb_jrept.id = wtb_jrepr.report_id\n" +
|
||||
"WHERE ( wtb_jrept.report_name = %s OR wtb_jrept.id = %s) \n" +
|
||||
" AND expression IS NOT NULL", jasperDTO.getReportName(), jasperDTO.getReportId());
|
||||
|
||||
List<HashMap<String, Object>> listParm = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
for ( HashMap<String, Object> parametri: listParm) {
|
||||
for (HashMap<String, Object> parametri : listParm) {
|
||||
String parameterName = parametri.get("parameter_name").toString();
|
||||
String parameterValue = (String) parametri.get("expression");
|
||||
if (!hm_parameters.containsKey(parameterName)) {
|
||||
@@ -355,9 +357,9 @@ public class ReportProcessor {
|
||||
|
||||
HashMap<String, String> ipAddressAndPort = UtilityURL.getIpAddressAndPort();
|
||||
String url = null;
|
||||
if ( ipAddressAndPort.get("host") != null ) {
|
||||
if (ipAddressAndPort.get("host") != null) {
|
||||
url = ipAddressAndPort.get("host");
|
||||
url = url + (UtilityHashMap.getValueIfExists(ipAddressAndPort, "port")!=null?":"+UtilityHashMap.getValueIfExists(ipAddressAndPort, "port"):"" );
|
||||
url = url + (UtilityHashMap.getValueIfExists(ipAddressAndPort, "port") != null ? ":" + UtilityHashMap.getValueIfExists(ipAddressAndPort, "port") : "");
|
||||
}
|
||||
hm_parameters.put("api_webservices", url);
|
||||
|
||||
@@ -396,7 +398,7 @@ public class ReportProcessor {
|
||||
throw new Exception("JasperPrint non valido");
|
||||
}
|
||||
|
||||
if (jp.getPages().size() > 0) {/*
|
||||
if (!jp.getPages().isEmpty()) {/*
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
JRAbstractExporter exporter = null;
|
||||
|
||||
@@ -429,7 +431,26 @@ public class ReportProcessor {
|
||||
break;
|
||||
case PDF:
|
||||
default:
|
||||
bytes = JasperExportManager.exportReportToPdf(jp);
|
||||
List<JasperPrint> jasperPrintList = new ArrayList<>();
|
||||
|
||||
jasperPrintList.add(jp);
|
||||
|
||||
if (jasperDTO.getCopies() > 0) {
|
||||
for (int copies = 0; copies < jasperDTO.getCopies(); copies++) {
|
||||
jasperPrintList.add(jp);
|
||||
}
|
||||
}
|
||||
|
||||
JRPdfExporter exporter = new JRPdfExporter();
|
||||
|
||||
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(baos));
|
||||
|
||||
exporter.exportReport();
|
||||
|
||||
bytes = baos.toByteArray();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
|
||||
@@ -120,9 +120,9 @@ public class MtbLisv extends EntityBase {
|
||||
|
||||
@SqlField(value = "add_ric_spese", defaultObjectValue = "false", nullable = false)
|
||||
private Boolean addRicSpese;
|
||||
@SqlField(value = "flag_add_val_spese", defaultObjectValue = "false", nullable = false)
|
||||
@SqlField(value = "add_val_spese", defaultObjectValue = "false", nullable = false)
|
||||
private Boolean addValSpese;
|
||||
@SqlField(value = "add_soc_spese", defaultObjectValue = "false", nullable = false)
|
||||
@SqlField(value = "add_sco_spese", defaultObjectValue = "false", nullable = false)
|
||||
private Boolean addScoSpese;
|
||||
|
||||
public String getCodMart() {
|
||||
|
||||
@@ -524,6 +524,8 @@ public class ActivityService {
|
||||
//Date startDate = UtilityDate.getWeekStartDate(planActivityDTO.getData());
|
||||
|
||||
if ("S".equalsIgnoreCase(planActivityDTO.getCreaAttivita())) {
|
||||
boolean modifyUser = planActivityDTO.getUsers().size() > 0 ;
|
||||
if (modifyUser) parentStbActivity.setUserName(planActivityDTO.getUsers().get(0).getUsername());
|
||||
for (PlanActivityDTO.User user : planActivityDTO.getUsers()) {
|
||||
for (PlanActivityDTO.Agenda agenda : planActivityDTO.getAgenda()) {
|
||||
Date startDate = agenda.getData();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.ems.product.importaz.service;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
@@ -12,10 +11,13 @@ import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.AtbListData;
|
||||
import it.integry.ems_model.entity.MtbLisa;
|
||||
import it.integry.ems_model.entity.MtbLisaData;
|
||||
import it.integry.ems_model.entity.VtbListData;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -43,6 +45,7 @@ public class ImportApuliaPromoService {
|
||||
throw new Exception("Nessun csv da importare.");
|
||||
}
|
||||
|
||||
|
||||
final CsvMapper<PromoDto> mapper = new CsvMapper<>();
|
||||
List<PromoDto> promozioni = mapper.deserialize(request.getRawContent(), PromoDto.class, ";");
|
||||
|
||||
@@ -60,7 +63,7 @@ public class ImportApuliaPromoService {
|
||||
}
|
||||
|
||||
List<EntityBase> entityList = new ArrayList<>();
|
||||
|
||||
List<MtbLisaData> mtbLisaDataList = new ArrayList<>();
|
||||
for (PromoDto promozione : promozioni) {
|
||||
try {
|
||||
String partitaIva = promozione.getPartIva();
|
||||
@@ -80,13 +83,13 @@ public class ImportApuliaPromoService {
|
||||
" INNER JOIN mtb_lisa art ON mtb_lisa.cod_mart = art.cod_mart AND mtb_lisa.cod_alis = art.cod_alis\n" +
|
||||
"WHERE mtb_lisa.cod_art_for = " + UtilityDB.valueToString(promozione.getCodArtForn()) + "\n" +
|
||||
" AND mtb_lisa.cod_alis = " + UtilityDB.valueToString(codAlis) + "\n" +
|
||||
"UNION " +
|
||||
"SELECT art.cod_mart, art.cod_art_for\n" +
|
||||
"FROM mtb_lisa\n" +
|
||||
" INNER JOIN mtb_lisa art ON mtb_lisa.cod_barre = art.cod_barre AND mtb_lisa.cod_alis = art.cod_alis\n" +
|
||||
"WHERE mtb_lisa.cod_art_for = " + UtilityDB.valueToString(promozione.getCodArtForn()) + "\n" +
|
||||
" AND mtb_lisa.cod_alis = " + UtilityDB.valueToString(codAlis) + "\n" +
|
||||
" AND mtb_lisa.cod_barre is not null \n";
|
||||
"UNION " +
|
||||
"SELECT art.cod_mart, art.cod_art_for\n" +
|
||||
"FROM mtb_lisa\n" +
|
||||
" INNER JOIN mtb_lisa art ON mtb_lisa.cod_barre = art.cod_barre AND mtb_lisa.cod_alis = art.cod_alis\n" +
|
||||
"WHERE mtb_lisa.cod_art_for = " + UtilityDB.valueToString(promozione.getCodArtForn()) + "\n" +
|
||||
" AND mtb_lisa.cod_alis = " + UtilityDB.valueToString(codAlis) + "\n" +
|
||||
" AND mtb_lisa.cod_barre is not null \n";
|
||||
|
||||
List<MtbLisaData> mtbLisaData = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, MtbLisaData.class, OperationType.INSERT_OR_UPDATE);
|
||||
|
||||
@@ -98,14 +101,36 @@ public class ImportApuliaPromoService {
|
||||
mtbLisaData.add(lisa);
|
||||
|
||||
}
|
||||
|
||||
Date dataIniz = promozione.getDataIniz();
|
||||
Date dataFine = promozione.getDataFine();
|
||||
|
||||
for (MtbLisaData lisa: mtbLisaData) {
|
||||
//Verifichiamo se esiste una promozione contemporanea nel file
|
||||
Date finalDataIniz = dataIniz;
|
||||
Optional<MtbLisaData> first = mtbLisaDataList.stream().filter(x -> x.getCodArtFor().equalsIgnoreCase(lisa.getCodArtFor()) &&
|
||||
x.getDataIniz().before(finalDataIniz) &&
|
||||
x.getDataFine().after(finalDataIniz))
|
||||
.findFirst();
|
||||
|
||||
if (first.isPresent()) {
|
||||
dataIniz = first.get().getDataFine();
|
||||
dataIniz = UtilityDate.dateAdd(dataIniz, 1);
|
||||
}
|
||||
|
||||
lisa
|
||||
.setNote(EmsRestConstants.NULL)
|
||||
.setPercPromo1(promozione.getSconto1())
|
||||
.setPercPromo2(promozione.getSconto2())
|
||||
.setPercPromo3(promozione.getSconto3());
|
||||
.setPercPromo3(promozione.getSconto3())
|
||||
.setDataIniz(dataIniz)
|
||||
.setDataFine(dataFine)
|
||||
.setCodAlis(codAlis);
|
||||
}
|
||||
|
||||
mtbLisaDataList.addAll(mtbLisaData);
|
||||
|
||||
/*
|
||||
Optional<AtbListData> atbListDataOptional = Stream.of(entityList)
|
||||
.map(entityBase -> (AtbListData) entityBase)
|
||||
.filter(atbListData -> {
|
||||
@@ -144,14 +169,34 @@ public class ImportApuliaPromoService {
|
||||
atbListData
|
||||
.setFlagTipoPromo("E")
|
||||
.setNote("INTERNA")
|
||||
.getMtbLisaData().addAll(mtbLisaData);
|
||||
.getMtbLisaData().addAll(mtbLisaData);*/
|
||||
} catch (Exception e) {
|
||||
anomalie.add(AnomalieDTO.error(e));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (entityList.size() > 0) {
|
||||
entityList = entityProcessor.processEntityList(entityList, true);
|
||||
if ( mtbLisaDataList.size() > 0 ) {
|
||||
List<Map.Entry<AtbListData, List<MtbLisaData>>> list = Stream.of(mtbLisaDataList).groupBy(x -> {
|
||||
AtbListData atbListData =
|
||||
new AtbListData()
|
||||
.setCodAlis(x.getCodAlis())
|
||||
.setDataIniz(x.getDataIniz())
|
||||
.setDataFine(x.getDataFine())
|
||||
.setFlagTipoPromo("E")
|
||||
.setNote("INTERNA");
|
||||
atbListData.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
return atbListData;
|
||||
}
|
||||
).toList();
|
||||
|
||||
for (Map.Entry<AtbListData, List<MtbLisaData>> listino: list) {
|
||||
entityList.add(listino.getKey().setMtbLisaData(listino.getValue()));
|
||||
}
|
||||
|
||||
if (entityList.size() > 0) {
|
||||
entityList = entityProcessor.processEntityList(entityList, true);
|
||||
}
|
||||
}
|
||||
|
||||
return entityList;
|
||||
|
||||
@@ -386,8 +386,11 @@ public class AgribookOrderService {
|
||||
" mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
|
||||
" mtb_colt.ser_collo = mtb_colr.ser_collo AND\n" +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" INNER JOIN jtb_lotr ON jtb_lotr.num_ord = dtb_ordr.num_ord\n" +
|
||||
" INNER JOIN jtb_lott ON jtb_lott.id_lotto = jtb_lotr.id_lotto\n" +
|
||||
" INNER JOIN jtb_lotr ON jtb_lotr.num_ord = dtb_ordr.num_ord AND\n" +
|
||||
" jtb_lotr.data_ord = dtb_ordr.data_ord AND\n" +
|
||||
" jtb_lotr.gestione = dtb_ordr.gestione\n" +
|
||||
" INNER JOIN jtb_lott ON jtb_lott.id_lotto = jtb_lotr.id_lotto AND\n" +
|
||||
" jtb_lott.cod_jfas = jtb_lotr.cod_jfas\n" +
|
||||
" INNER JOIN jtb_flav ON jtb_lott.cod_jflav = jtb_flav.cod_jflav\n" +
|
||||
"WHERE dtb_ordr.gestione = 'L'\n" +
|
||||
" AND dtb_ordr.cod_mart = %s\n" +
|
||||
|
||||
Reference in New Issue
Block a user