Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240919130154 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
dropFunction("getListinoVenditaOld");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240923111741 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_COLLI", "DESADV", "ATTIVO", "N",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "EMAIL_FOR_LOG", null,
|
||||
"Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "FILE_FILTER", null,
|
||||
"Inserire il criterio di filtro dei file o il nome del file specifio (seguire la sintassi di java)", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "GG_CANC_FILE", null,
|
||||
"Giorni per la cancellazione dei file dalla cartella di appoggio", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "IMPORT_REST", "S",
|
||||
"Inserire S/N per attivare/disattivare il salvataggio con i servizi REST", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "LISTENING", "N",
|
||||
"Se LISTENIG = 'N' la procedura di importazione non si potrà mai mettere in ascolto sulla directory perchè nella procedura vengono prese in considerazione più file.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "PATH_FILE", null,
|
||||
"Directory contente i file da importare.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "DESADV", "PATH_FILE_IMPORTED", null,
|
||||
"Directory dove vengono spostati i file dopo l'importazione.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240924152410 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table jtb_flav add altre_mansioni varchar(8000)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,6 +71,9 @@ public class GtbBancAzi extends EntityBase implements EquatableEntityInterface<
|
||||
@EntityChild
|
||||
private List<GtbBancAziEff> gtbBancAziEff = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<GtbBancAziIntercode> gtbBancAziIntercode = new ArrayList<>();
|
||||
|
||||
public GtbBancAzi() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -79,140 +82,152 @@ public class GtbBancAzi extends EntityBase implements EquatableEntityInterface<
|
||||
return codBancAzi;
|
||||
}
|
||||
|
||||
public void setCodBancAzi(String codBancAzi) {
|
||||
public GtbBancAzi setCodBancAzi(String codBancAzi) {
|
||||
this.codBancAzi = codBancAzi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodBanc() {
|
||||
return codBanc;
|
||||
}
|
||||
|
||||
public void setCodBanc(String codBanc) {
|
||||
public GtbBancAzi setCodBanc(String codBanc) {
|
||||
this.codBanc = codBanc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCconOrdinario() {
|
||||
return codCconOrdinario;
|
||||
}
|
||||
|
||||
public void setCodCconOrdinario(String codCconOrdinario) {
|
||||
public GtbBancAzi setCodCconOrdinario(String codCconOrdinario) {
|
||||
this.codCconOrdinario = codCconOrdinario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
public GtbBancAzi setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIndirizzo() {
|
||||
return indirizzo;
|
||||
}
|
||||
|
||||
public void setIndirizzo(String indirizzo) {
|
||||
public GtbBancAzi setIndirizzo(String indirizzo) {
|
||||
this.indirizzo = indirizzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTelFax() {
|
||||
return telFax;
|
||||
}
|
||||
|
||||
public void setTelFax(String telFax) {
|
||||
public GtbBancAzi setTelFax(String telFax) {
|
||||
this.telFax = telFax;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodSwift() {
|
||||
return codSwift;
|
||||
}
|
||||
|
||||
public void setCodSwift(String codSwift) {
|
||||
public GtbBancAzi setCodSwift(String codSwift) {
|
||||
this.codSwift = codSwift;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAbi() {
|
||||
return codAbi;
|
||||
}
|
||||
|
||||
public void setCodAbi(String codAbi) {
|
||||
public GtbBancAzi setCodAbi(String codAbi) {
|
||||
this.codAbi = codAbi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCab() {
|
||||
return codCab;
|
||||
}
|
||||
|
||||
public void setCodCab(String codCab) {
|
||||
public GtbBancAzi setCodCab(String codCab) {
|
||||
this.codCab = codCab;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNumCc() {
|
||||
return numCc;
|
||||
}
|
||||
|
||||
public void setNumCc(String numCc) {
|
||||
public GtbBancAzi setNumCc(String numCc) {
|
||||
this.numCc = numCc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodIban() {
|
||||
return codIban;
|
||||
}
|
||||
|
||||
public void setCodIban(String codIban) {
|
||||
public GtbBancAzi setCodIban(String codIban) {
|
||||
this.codIban = codIban;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getFidoOrdinario() {
|
||||
return fidoOrdinario;
|
||||
}
|
||||
|
||||
public void setFidoOrdinario(BigDecimal fidoOrdinario) {
|
||||
public GtbBancAzi setFidoOrdinario(BigDecimal fidoOrdinario) {
|
||||
this.fidoOrdinario = fidoOrdinario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodBic() {
|
||||
return codBic;
|
||||
}
|
||||
|
||||
public void setCodBic(String codBic) {
|
||||
public GtbBancAzi setCodBic(String codBic) {
|
||||
this.codBic = codBic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
public GtbBancAzi setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<GtbBancAziEff> getGtbBancAziEff() {
|
||||
return gtbBancAziEff;
|
||||
}
|
||||
|
||||
public void setGtbBancAziEff(List<GtbBancAziEff> gtbBancAziEff) {
|
||||
public GtbBancAzi setGtbBancAziEff(List<GtbBancAziEff> gtbBancAziEff) {
|
||||
this.gtbBancAziEff = gtbBancAziEff;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (GtbBancAziEff gtbBancAziEff : getGtbBancAziEff()) {
|
||||
gtbBancAziEff.manageWithParentConnection(connection, gtbBancAziEff.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public List<GtbBancAziIntercode> getGtbBancAziIntercode() {
|
||||
return gtbBancAziIntercode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateChilds() throws Exception {
|
||||
for (GtbBancAziEff gtbBancAziEff : getGtbBancAziEff()) {
|
||||
gtbBancAziEff.manageWithParentConnection(connection, gtbBancAziEff.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public GtbBancAzi setGtbBancAziIntercode(List<GtbBancAziIntercode> gtbBancAziIntercode) {
|
||||
this.gtbBancAziIntercode = gtbBancAziIntercode;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
GtbBancAziEff gtbBancAziEff = new GtbBancAziEff();
|
||||
gtbBancAziEff.deleteAllEntities(connection, this);
|
||||
GtbBancAziIntercode gtbBancAziIntercode = new GtbBancAziIntercode();
|
||||
gtbBancAziIntercode.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,15 +3,17 @@ 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.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
@Master()
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = GtbBancAziIntercode.ENTITY)
|
||||
@JsonTypeName(value = GtbBancAziIntercode.ENTITY)
|
||||
public class GtbBancAziIntercode extends EntityBase {
|
||||
public class GtbBancAziIntercode extends EntityBase implements EquatableEntityInterface<GtbBancAziIntercode> {
|
||||
|
||||
public final static String ENTITY = "gtb_banc_azi_intercode";
|
||||
|
||||
@@ -73,4 +75,20 @@ public class GtbBancAziIntercode extends EntityBase {
|
||||
this.intercode = intercode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(GtbBancAziIntercode other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getId(), other.getId());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.Master;
|
||||
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.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@@ -70,6 +69,9 @@ public class GtbTipiPaga extends EntityBase {
|
||||
@SqlField(value = "tipo_tracciato", maxLength = 30)
|
||||
private String tipoTracciato;
|
||||
|
||||
@EntityChild
|
||||
private List<GtbTipiPagaIntercode> gtbTipiPagaIntercode = new ArrayList<>();
|
||||
|
||||
public GtbTipiPaga() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -193,4 +195,19 @@ public class GtbTipiPaga extends EntityBase {
|
||||
public void setTipoTracciato(String tipoTracciato) {
|
||||
this.tipoTracciato = tipoTracciato;
|
||||
}
|
||||
|
||||
public List<GtbTipiPagaIntercode> getGtbTipiPagaIntercode() {
|
||||
return gtbTipiPagaIntercode;
|
||||
}
|
||||
|
||||
public void setGtbTipiPagaIntercode(List<GtbTipiPagaIntercode> gtbTipiPagaIntercode) {
|
||||
this.gtbTipiPagaIntercode = gtbTipiPagaIntercode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
GtbTipiPagaIntercode gtbTipiPagaIntercode = new GtbTipiPagaIntercode();
|
||||
gtbTipiPagaIntercode.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
@Master()
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = GtbTipiPagaIntercode.ENTITY)
|
||||
@JsonTypeName(value = GtbTipiPagaIntercode.ENTITY)
|
||||
|
||||
@@ -3,13 +3,14 @@ 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 org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@@ -156,8 +157,12 @@ public class JtbFlav extends EntityBase {
|
||||
@SqlField(value = "iban", maxLength = 40)
|
||||
private String iban;
|
||||
|
||||
@SqlField(value = "altre_mansioni", maxLength = 8000)
|
||||
private String altre_mansioni;
|
||||
|
||||
private String precode;
|
||||
|
||||
|
||||
@EntityChild
|
||||
private List<JtbFlavEventi> jtbFlavEventi = new ArrayList<>();
|
||||
|
||||
@@ -534,6 +539,14 @@ public class JtbFlav extends EntityBase {
|
||||
this.jtbFlavEventi = jtbFlavEventi;
|
||||
}
|
||||
|
||||
public String getAltre_mansioni() {
|
||||
return altre_mansioni;
|
||||
}
|
||||
|
||||
public void setAltre_mansioni(String altre_mansioni) {
|
||||
this.altre_mansioni = altre_mansioni;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (JtbFlavEventi jtbFlavEventi : getJtbFlavEventi()) {
|
||||
|
||||
@@ -91,23 +91,22 @@ public class UtilityExcel {
|
||||
/**
|
||||
* Reads an XLSX file from the provided ImportRequestDTO and returns an iterator over the rows.
|
||||
*
|
||||
* @param requestDTO the import request containing the base64 encoded content of the XLSX file
|
||||
* @param requestDTO the import request containing the base64 encoded content of the XLSX file
|
||||
* @param ignoreHeader whether to ignore the first row (header) of the sheet
|
||||
* @return an iterator over the rows of the first sheet in the XLSX file
|
||||
* @throws Exception if an error occurs while reading the file or if the file is empty
|
||||
*/
|
||||
public static Iterator<Row> readXlsxFile(ImportRequestDTO requestDTO, boolean ignoreHeader) throws Exception {
|
||||
InputStream stream = null;
|
||||
if (requestDTO.getRawContentB64() != null )
|
||||
InputStream stream;
|
||||
|
||||
if (requestDTO.getRawContentB64() != null)
|
||||
stream = new ByteArrayInputStream(Base64.decodeBase64(requestDTO.getRawContentB64()));
|
||||
else if (requestDTO.getRawContent() != null ) {
|
||||
else if (requestDTO.getPathFile() != null) {
|
||||
File file = new File(requestDTO.getPathFile());
|
||||
stream = Files.newInputStream(file.toPath());
|
||||
}
|
||||
//stream = IOUtils.toInputStream(requestDTO.getRawContent(), StandardCharsets.UTF_8);
|
||||
else
|
||||
} else
|
||||
throw new Exception("Errore nella lettura del file");
|
||||
return readXlsxFile(stream,ignoreHeader);
|
||||
return readXlsxFile(stream, ignoreHeader);
|
||||
}
|
||||
|
||||
public static Iterator<Row> readXlsxFile(InputStream stream, boolean ignoreHeader) throws Exception {
|
||||
|
||||
@@ -1011,6 +1011,12 @@ public class DocumentiAcquistoImportService {
|
||||
|
||||
HashMap<String, Object> result = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, sql);
|
||||
|
||||
if (result == null){
|
||||
anomalie.add(
|
||||
AnomalieDTO.error(String.format("Nessun deposito agganciato all'intercode %s", rifOrdApulia.getCodicePv() ))
|
||||
);
|
||||
}
|
||||
|
||||
String codMdep = result.get("cod_mdep").toString();
|
||||
String codForn = result.get("cod_forn").toString();
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ public class ColliImporter extends BaseEntityImporter implements IEntityImporter
|
||||
case EVIOSYS:
|
||||
entities = context.getBean(ColliEviosysImportService.class).importColli(type, format, requestDto, anomalie);
|
||||
break;
|
||||
case PIEGARESE:
|
||||
entities = context.getBean(ColliImportService.class).importColliVebad(type, format, requestDto, anomalie);
|
||||
break;
|
||||
default:
|
||||
throw new Exception(String.format("Tipo %s non supportato", format));
|
||||
}
|
||||
@@ -79,7 +82,8 @@ public class ColliImporter extends BaseEntityImporter implements IEntityImporter
|
||||
STEUP("STEUP"),
|
||||
METALSISTEM("METALSISTEM"),
|
||||
BAIONE("BAIONE"),
|
||||
EVIOSYS("EVIOSYS");
|
||||
EVIOSYS("EVIOSYS"),
|
||||
PIEGARESE("DESADV");
|
||||
|
||||
private String text;
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems.logistic.dto;
|
||||
|
||||
import it.integry.ems.logistic.dto.piegarese.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VebadDTO {
|
||||
|
||||
public VebadDesadvEstremiDTO estremiFile;
|
||||
public VebadDesadvTestataDTO testataDoc;
|
||||
public VebadDesadvCorpoDTO corpoDoc;
|
||||
public List<VebadDesadvDettagliLottiDTO> dettagliLotti;
|
||||
|
||||
public VebadDesadvEstremiDTO getEstremiFile() {
|
||||
return estremiFile;
|
||||
}
|
||||
|
||||
public VebadDTO setEstremiFile(VebadDesadvEstremiDTO estremiFile) {
|
||||
this.estremiFile = estremiFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO getTestataDoc() {
|
||||
return testataDoc;
|
||||
}
|
||||
|
||||
public VebadDTO setTestataDoc(VebadDesadvTestataDTO testataDoc) {
|
||||
this.testataDoc = testataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO getCorpoDoc() {
|
||||
return corpoDoc;
|
||||
}
|
||||
|
||||
public VebadDTO setCorpoDoc(VebadDesadvCorpoDTO corpoDoc) {
|
||||
this.corpoDoc = corpoDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VebadDesadvDettagliLottiDTO> getDettagliLotti() {
|
||||
return dettagliLotti;
|
||||
}
|
||||
|
||||
public VebadDTO setDettagliLotti(List<VebadDesadvDettagliLottiDTO> dettagliLotti) {
|
||||
this.dettagliLotti = dettagliLotti;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package it.integry.ems.logistic.dto.piegarese;
|
||||
|
||||
public class VebadDesadvCorpoDTO {
|
||||
|
||||
public String tipoRecord;
|
||||
public Integer numRigaDoc;
|
||||
public String noteDesc;
|
||||
public String rifOrdineCliente;
|
||||
public String ordineVend;
|
||||
public String codArtCliente;
|
||||
public String codArt;
|
||||
public String descBreveArt;
|
||||
public String untMis;
|
||||
public String qtaRiga;
|
||||
public Integer flagOmaggio;
|
||||
public Integer flagTrattamentoImballi;
|
||||
|
||||
public String getTipoRecord() {
|
||||
return tipoRecord;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setTipoRecord(String tipoRecord) {
|
||||
this.tipoRecord = tipoRecord;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumRigaDoc() {
|
||||
return numRigaDoc;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setNumRigaDoc(Integer numRigaDoc) {
|
||||
this.numRigaDoc = numRigaDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNoteDesc() {
|
||||
return noteDesc;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setNoteDesc(String noteDesc) {
|
||||
this.noteDesc = noteDesc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRifOrdineCliente() {
|
||||
return rifOrdineCliente;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setRifOrdineCliente(String rifOrdineCliente) {
|
||||
this.rifOrdineCliente = rifOrdineCliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrdineVend() {
|
||||
return ordineVend;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setOrdineVend(String ordineVend) {
|
||||
this.ordineVend = ordineVend;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodArtCliente() {
|
||||
return codArtCliente;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setCodArtCliente(String codArtCliente) {
|
||||
this.codArtCliente = codArtCliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodArt() {
|
||||
return codArt;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setCodArt(String codArt) {
|
||||
this.codArt = codArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescBreveArt() {
|
||||
return descBreveArt;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setDescBreveArt(String descBreveArt) {
|
||||
this.descBreveArt = descBreveArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getQtaRiga() {
|
||||
return qtaRiga;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setQtaRiga(String qtaRiga) {
|
||||
this.qtaRiga = qtaRiga;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFlagOmaggio() {
|
||||
return flagOmaggio;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setFlagOmaggio(Integer flagOmaggio) {
|
||||
this.flagOmaggio = flagOmaggio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFlagTrattamentoImballi() {
|
||||
return flagTrattamentoImballi;
|
||||
}
|
||||
|
||||
public VebadDesadvCorpoDTO setFlagTrattamentoImballi(Integer flagTrattamentoImballi) {
|
||||
this.flagTrattamentoImballi = flagTrattamentoImballi;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package it.integry.ems.logistic.dto.piegarese;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class VebadDesadvDettagliLottiDTO {
|
||||
|
||||
public String tipoRecord;
|
||||
public Integer numRigaDoc;
|
||||
public Integer numRigaLotti;
|
||||
public String gtin;
|
||||
public String lotto;
|
||||
public String codSscc;
|
||||
public String dataProd;
|
||||
public Date dataScad;
|
||||
public Integer qtaSscc;
|
||||
public Integer qtaInColli;
|
||||
public String qta;
|
||||
public String transcodifica;
|
||||
public String codStabilimentoProd;
|
||||
public String descStabilimentoProd;
|
||||
public Integer oraProd;
|
||||
public String codLineaProd;
|
||||
|
||||
public String getTipoRecord() {
|
||||
return tipoRecord;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setTipoRecord(String tipoRecord) {
|
||||
this.tipoRecord = tipoRecord;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumRigaDoc() {
|
||||
return numRigaDoc;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setNumRigaDoc(Integer numRigaDoc) {
|
||||
this.numRigaDoc = numRigaDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumRigaLotti() {
|
||||
return numRigaLotti;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setNumRigaLotti(Integer numRigaLotti) {
|
||||
this.numRigaLotti = numRigaLotti;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGtin() {
|
||||
return gtin;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setGtin(String gtin) {
|
||||
this.gtin = gtin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLotto() {
|
||||
return lotto;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setLotto(String lotto) {
|
||||
this.lotto = lotto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodSscc() {
|
||||
return codSscc;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setCodSscc(String codSscc) {
|
||||
this.codSscc = codSscc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataProd() {
|
||||
return dataProd;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setDataProd(String dataProd) {
|
||||
this.dataProd = dataProd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setDataScad(Date dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQtaSscc() {
|
||||
return qtaSscc;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setQtaSscc(Integer qtaSscc) {
|
||||
this.qtaSscc = qtaSscc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQtaInColli() {
|
||||
return qtaInColli;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setQtaInColli(Integer qtaInColli) {
|
||||
this.qtaInColli = qtaInColli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getQta() {
|
||||
return qta;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setQta(String qta) {
|
||||
this.qta = qta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTranscodifica() {
|
||||
return transcodifica;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setTranscodifica(String transcodifica) {
|
||||
this.transcodifica = transcodifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodStabilimentoProd() {
|
||||
return codStabilimentoProd;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setCodStabilimentoProd(String codStabilimentoProd) {
|
||||
this.codStabilimentoProd = codStabilimentoProd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescStabilimentoProd() {
|
||||
return descStabilimentoProd;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setDescStabilimentoProd(String descStabilimentoProd) {
|
||||
this.descStabilimentoProd = descStabilimentoProd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getOraProd() {
|
||||
return oraProd;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setOraProd(Integer oraProd) {
|
||||
this.oraProd = oraProd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodLineaProd() {
|
||||
return codLineaProd;
|
||||
}
|
||||
|
||||
public VebadDesadvDettagliLottiDTO setCodLineaProd(String codLineaProd) {
|
||||
this.codLineaProd = codLineaProd;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.ems.logistic.dto.piegarese;
|
||||
|
||||
public class VebadDesadvEstremiDTO {
|
||||
|
||||
public String tipoRecord;
|
||||
public String pIvaFornitore;
|
||||
public String ragSocFornitore;
|
||||
public String DataGenerazione;
|
||||
public String OraGenerazione;
|
||||
|
||||
public String getTipoRecord() {
|
||||
return tipoRecord;
|
||||
}
|
||||
|
||||
public VebadDesadvEstremiDTO setTipoRecord(String tipoRecord) {
|
||||
this.tipoRecord = tipoRecord;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getpIvaFornitore() {
|
||||
return pIvaFornitore;
|
||||
}
|
||||
|
||||
public VebadDesadvEstremiDTO setpIvaFornitore(String pIvaFornitore) {
|
||||
this.pIvaFornitore = pIvaFornitore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRagSocFornitore() {
|
||||
return ragSocFornitore;
|
||||
}
|
||||
|
||||
public VebadDesadvEstremiDTO setRagSocFornitore(String ragSocFornitore) {
|
||||
this.ragSocFornitore = ragSocFornitore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataGenerazione() {
|
||||
return DataGenerazione;
|
||||
}
|
||||
|
||||
public VebadDesadvEstremiDTO setDataGenerazione(String dataGenerazione) {
|
||||
DataGenerazione = dataGenerazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOraGenerazione() {
|
||||
return OraGenerazione;
|
||||
}
|
||||
|
||||
public VebadDesadvEstremiDTO setOraGenerazione(String oraGenerazione) {
|
||||
OraGenerazione = oraGenerazione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package it.integry.ems.logistic.dto.piegarese;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class VebadDesadvTestataDTO {
|
||||
|
||||
public String numDoc;
|
||||
public String dataDDT;
|
||||
public String destinazioneMerce;
|
||||
public String codCondizioneDiPorto;
|
||||
public String pIvaVettoreTrasporto;
|
||||
public String nominativoAutista;
|
||||
public String targaMezzo;
|
||||
public Integer totColliSpediti;
|
||||
public Integer totPalletSpediti;
|
||||
public String totKgLegniSpediti;
|
||||
public String totKgLordiSpediti;
|
||||
public String totKgNettiSpediti;
|
||||
|
||||
public String getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setNumDoc(String numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataDDT() {
|
||||
return dataDDT;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setDataDDT(String dataDDT) {
|
||||
this.dataDDT = dataDDT;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDestinazioneMerce() {
|
||||
return destinazioneMerce;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setDestinazioneMerce(String destinazioneMerce) {
|
||||
this.destinazioneMerce = destinazioneMerce;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCondizioneDiPorto() {
|
||||
return codCondizioneDiPorto;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setCodCondizioneDiPorto(String codCondizioneDiPorto) {
|
||||
this.codCondizioneDiPorto = codCondizioneDiPorto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getpIvaVettoreTrasporto() {
|
||||
return pIvaVettoreTrasporto;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setpIvaVettoreTrasporto(String pIvaVettoreTrasporto) {
|
||||
this.pIvaVettoreTrasporto = pIvaVettoreTrasporto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNominativoAutista() {
|
||||
return nominativoAutista;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setNominativoAutista(String nominativoAutista) {
|
||||
this.nominativoAutista = nominativoAutista;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTargaMezzo() {
|
||||
return targaMezzo;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTargaMezzo(String targaMezzo) {
|
||||
this.targaMezzo = targaMezzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotColliSpediti() {
|
||||
return totColliSpediti;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTotColliSpediti(Integer totColliSpediti) {
|
||||
this.totColliSpediti = totColliSpediti;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotPalletSpediti() {
|
||||
return totPalletSpediti;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTotPalletSpediti(Integer totPalletSpediti) {
|
||||
this.totPalletSpediti = totPalletSpediti;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTotKgLegniSpediti() {
|
||||
return totKgLegniSpediti;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTotKgLegniSpediti(String totKgLegniSpediti) {
|
||||
this.totKgLegniSpediti = totKgLegniSpediti;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTotKgLordiSpediti() {
|
||||
return totKgLordiSpediti;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTotKgLordiSpediti(String totKgLordiSpediti) {
|
||||
this.totKgLordiSpediti = totKgLordiSpediti;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTotKgNettiSpediti() {
|
||||
return totKgNettiSpediti;
|
||||
}
|
||||
|
||||
public VebadDesadvTestataDTO setTotKgNettiSpediti(String totKgNettiSpediti) {
|
||||
this.totKgNettiSpediti = totKgNettiSpediti;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,15 @@ package it.integry.ems.logistic.service;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.logistic.dto.ColliImportDTO;
|
||||
import it.integry.ems.logistic.dto.VebadDTO;
|
||||
import it.integry.ems.logistic.dto.piegarese.VebadDesadvCorpoDTO;
|
||||
import it.integry.ems.logistic.dto.piegarese.VebadDesadvDettagliLottiDTO;
|
||||
import it.integry.ems.logistic.dto.piegarese.VebadDesadvEstremiDTO;
|
||||
import it.integry.ems.logistic.dto.piegarese.VebadDesadvTestataDTO;
|
||||
import it.integry.ems.rules.businessLogic.LoadColliService;
|
||||
import it.integry.ems.rules.businessLogic.dto.LoadColliDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
@@ -16,16 +23,14 @@ import it.integry.ems_model.entity.MtbColr;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
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.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
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.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -274,36 +279,36 @@ public class ColliImportService {
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
|
||||
String profileDb = setup.get("PROFILE_DB");
|
||||
if ( UtilityString.isNullOrEmpty(profileDb)) throw new Exception("Profile DB non configurato");
|
||||
if (UtilityString.isNullOrEmpty(profileDb)) throw new Exception("Profile DB non configurato");
|
||||
String codMdep = setup.get("COD_MDEP");
|
||||
if ( UtilityString.isNullOrEmpty(codMdep)) throw new Exception("Codice Deposito dei default non configurato");
|
||||
if (UtilityString.isNullOrEmpty(codMdep)) throw new Exception("Codice Deposito dei default non configurato");
|
||||
|
||||
MultiDBTransactionManager mdbSteup = new MultiDBTransactionManager();
|
||||
mdbSteup.setPrimaryDs(profileDb);
|
||||
|
||||
String sql =
|
||||
"select mtb_colt.gestione, " +
|
||||
" mtb_colt.data_collo, " +
|
||||
" mtb_colt.ser_collo, " +
|
||||
" mtb_colt.num_collo, " +
|
||||
" Cast(mtb_colt.segno as int) as segno, " +
|
||||
" mtb_depo.cod_jfas, " +
|
||||
" stb_activity.user_name, " +
|
||||
" stb_activity.activity_id, " +
|
||||
" ctb_amac.cod_cmac + ' ' + ctb_amac.descrizione as note, " +
|
||||
" mtb_colr.cod_mart, " +
|
||||
" mtb_colr.qta_col " +
|
||||
"from mtb_colt " +
|
||||
" inner join stb_activity on mtb_colt.activity_id = stb_activity.activity_id " +
|
||||
" inner join stb_activity p on stb_activity.parent_activity_id = p.activity_id " +
|
||||
" inner join stb_user on stb_activity.user_creator = stb_user.user_name and stb_user.key_group = '22' " +
|
||||
" inner join mtb_depo on mtb_colt.cod_mdep = mtb_depo.cod_mdep " +
|
||||
" inner join mtb_colr on mtb_colt.gestione = mtb_colr.gestione and " +
|
||||
" mtb_colt.data_collo = mtb_colr.data_collo and " +
|
||||
" mtb_colt.ser_collo = mtb_colr.ser_collo and " +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" left outer join ctb_amac on stb_activity.cod_cmac = ctb_amac.cod_cmac " +
|
||||
"WHERE mtb_colt.data_doc_provv is null";
|
||||
" mtb_colt.data_collo, " +
|
||||
" mtb_colt.ser_collo, " +
|
||||
" mtb_colt.num_collo, " +
|
||||
" Cast(mtb_colt.segno as int) as segno, " +
|
||||
" mtb_depo.cod_jfas, " +
|
||||
" stb_activity.user_name, " +
|
||||
" stb_activity.activity_id, " +
|
||||
" ctb_amac.cod_cmac + ' ' + ctb_amac.descrizione as note, " +
|
||||
" mtb_colr.cod_mart, " +
|
||||
" mtb_colr.qta_col " +
|
||||
"from mtb_colt " +
|
||||
" inner join stb_activity on mtb_colt.activity_id = stb_activity.activity_id " +
|
||||
" inner join stb_activity p on stb_activity.parent_activity_id = p.activity_id " +
|
||||
" inner join stb_user on stb_activity.user_creator = stb_user.user_name and stb_user.key_group = '22' " +
|
||||
" inner join mtb_depo on mtb_colt.cod_mdep = mtb_depo.cod_mdep " +
|
||||
" inner join mtb_colr on mtb_colt.gestione = mtb_colr.gestione and " +
|
||||
" mtb_colt.data_collo = mtb_colr.data_collo and " +
|
||||
" mtb_colt.ser_collo = mtb_colr.ser_collo and " +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" left outer join ctb_amac on stb_activity.cod_cmac = ctb_amac.cod_cmac " +
|
||||
"WHERE mtb_colt.data_doc_provv is null";
|
||||
List<HashMap<String, Object>> datiCollo = UtilityDB.executeSimpleQuery(mdbSteup.getPrimaryConnection(), sql);
|
||||
|
||||
ArrayList<EntityBase> entities = new ArrayList<>();
|
||||
@@ -333,7 +338,7 @@ public class ColliImportService {
|
||||
.setDataColloRif(UtilityHashMap.getValueIfExists(x, "data_collo"))
|
||||
.setSerColloRif(UtilityHashMap.getValueIfExists(x, "ser_collo"))
|
||||
.setNumColloRif(UtilityHashMap.getValueIfExists(x, "num_collo"))
|
||||
)
|
||||
)
|
||||
.toList();
|
||||
mtbColt.setMtbColr(mtbColrs);
|
||||
entities.add(mtbColt);
|
||||
@@ -342,28 +347,28 @@ public class ColliImportService {
|
||||
List<EntityBase> entityRet = entityProcessor.processEntityList(entities, false);
|
||||
List<MtbColt> colliUpd = new ArrayList<>();
|
||||
Stream.of(entityRet)
|
||||
.filter(x->x instanceof MtbColt && x.getException() == null)
|
||||
.filter(x -> x instanceof MtbColt && x.getException() == null)
|
||||
.forEach(colli -> {
|
||||
List<MtbColt> elencoColli =
|
||||
Stream.of(((MtbColt) colli).getMtbColr())
|
||||
.distinctBy(x -> x.getGestioneRif() + x.getDataColloRif() + x.getSerColloRif() + x.getNumColloRif())
|
||||
.map(x -> {
|
||||
MtbColt collo = new MtbColt()
|
||||
.setGestione(x.getGestioneRif())
|
||||
.setDataCollo(UtilityLocalDate.localDateFromDate(x.getDataColloRif()))
|
||||
.setSerCollo(x.getSerColloRif())
|
||||
.setNumCollo(x.getNumColloRif())
|
||||
.setDataDocProvv(new Date());
|
||||
collo.setOperation(OperationType.UPDATE);
|
||||
return collo;
|
||||
}
|
||||
)
|
||||
.toList();
|
||||
Stream.of(((MtbColt) colli).getMtbColr())
|
||||
.distinctBy(x -> x.getGestioneRif() + x.getDataColloRif() + x.getSerColloRif() + x.getNumColloRif())
|
||||
.map(x -> {
|
||||
MtbColt collo = new MtbColt()
|
||||
.setGestione(x.getGestioneRif())
|
||||
.setDataCollo(UtilityLocalDate.localDateFromDate(x.getDataColloRif()))
|
||||
.setSerCollo(x.getSerColloRif())
|
||||
.setNumCollo(x.getNumColloRif())
|
||||
.setDataDocProvv(new Date());
|
||||
collo.setOperation(OperationType.UPDATE);
|
||||
return collo;
|
||||
}
|
||||
)
|
||||
.toList();
|
||||
colliUpd.addAll(elencoColli);
|
||||
});
|
||||
|
||||
if (colliUpd != null && colliUpd.size() > 0 ) {
|
||||
entityProcessor.processEntityList(colliUpd, mdbSteup, true);
|
||||
if (colliUpd != null && colliUpd.size() > 0) {
|
||||
entityProcessor.processEntityList(colliUpd, mdbSteup, true);
|
||||
}
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
@@ -371,4 +376,132 @@ public class ColliImportService {
|
||||
|
||||
return entityRet;
|
||||
}
|
||||
|
||||
public List<EntityBase> importColliVebad(String format, String type, ImportRequestDTO requestDTO, List<AnomalieDTO> anomalie) throws Exception {
|
||||
List<EntityBase> entityList = new ArrayList<>();
|
||||
VebadDTO vebadDesadv = new VebadDTO().setDettagliLotti(new ArrayList<>());
|
||||
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
if (requestDTO == null || requestDTO.getRawContent() == null) {
|
||||
throw new Exception("Nessun file da importare");
|
||||
}
|
||||
|
||||
List<String> lines = UtilityString.splitStringToMultipleLine(requestDTO.getRawContent());
|
||||
if (!lines.isEmpty()) {
|
||||
for (String line : lines) {
|
||||
String tipoRecord = line.substring(0, 3).trim();
|
||||
|
||||
if (tipoRecord.equalsIgnoreCase("A01")) {
|
||||
//A. Estremi del file
|
||||
|
||||
vebadDesadv.setEstremiFile(
|
||||
new VebadDesadvEstremiDTO()
|
||||
.setTipoRecord(line.substring(0, 3))
|
||||
.setpIvaFornitore(line.substring(3, 3 + 30).trim())
|
||||
.setRagSocFornitore(line.substring(33, 33 + 100).trim())
|
||||
.setDataGenerazione(line.substring(133, 133 + 8))
|
||||
.setOraGenerazione(line.substring(141, 141 + 8))
|
||||
);
|
||||
} else if (tipoRecord.equalsIgnoreCase("B01")) {
|
||||
//B. Testata del documento
|
||||
|
||||
vebadDesadv.setTestataDoc(
|
||||
new VebadDesadvTestataDTO()
|
||||
.setNumDoc(line.substring(9, 9 + 40))
|
||||
.setDataDDT(line.substring(49, 49 + 8))
|
||||
.setDestinazioneMerce(line.substring(57, 57 + 20))
|
||||
.setCodCondizioneDiPorto(line.substring(539, 539 + 10))
|
||||
.setpIvaVettoreTrasporto(line.substring(709, 709 + 30))
|
||||
.setNominativoAutista(line.substring(739, 739 + 20))
|
||||
.setTargaMezzo(line.substring(759, 759 + 20))
|
||||
.setTotColliSpediti(Integer.parseInt(line.substring(779, 779 + 6)))
|
||||
.setTotPalletSpediti(Integer.parseInt(line.substring(785, 785 + 6)))
|
||||
.setTotKgLegniSpediti(line.substring(791, 791 + 12))
|
||||
.setTotKgLordiSpediti(line.substring(803, 803 + 12))
|
||||
.setTotKgNettiSpediti(line.substring(815, 815 + 12))
|
||||
);
|
||||
} else if (tipoRecord.equalsIgnoreCase("C01")) {
|
||||
//C. Corpo del documento
|
||||
|
||||
String flagTracciamentoImballi = UtilityString.emptyStr2Null(line.substring(187, 187 + 1).trim());
|
||||
|
||||
vebadDesadv.setCorpoDoc(
|
||||
new VebadDesadvCorpoDTO()
|
||||
.setTipoRecord(line.substring(0, 3))
|
||||
.setNumRigaDoc(Integer.parseInt(line.substring(3, 3 + 5).trim()))
|
||||
.setNoteDesc(line.substring(8, 8 + 40).trim())
|
||||
.setRifOrdineCliente(line.substring(48, 48 + 15).trim())
|
||||
.setOrdineVend(line.substring(63, 63 + 20).trim())
|
||||
.setCodArtCliente(line.substring(83, 83 + 13).trim())
|
||||
.setCodArt(line.substring(96, 96 + 30).trim())
|
||||
.setDescBreveArt(line.substring(126, 126 + 40).trim())
|
||||
.setUntMis(line.substring(166, 166 + 5).trim())
|
||||
.setQtaRiga(line.substring(171, 171 + 15))
|
||||
.setFlagOmaggio(Integer.parseInt(line.substring(186, 186 + 1)))
|
||||
.setFlagTrattamentoImballi(flagTracciamentoImballi != null ? Integer.parseInt(flagTracciamentoImballi) : null)
|
||||
);
|
||||
} else if (tipoRecord.equalsIgnoreCase("D01")) {
|
||||
//D. Dettagli del documento
|
||||
|
||||
Date dataScad;
|
||||
try {
|
||||
dataScad = new SimpleDateFormat("yyyyMMdd").parse(line.substring(101, 101 + 6));
|
||||
} catch (Exception e) {
|
||||
dataScad = new Date();
|
||||
}
|
||||
|
||||
vebadDesadv.getDettagliLotti()
|
||||
.add(
|
||||
new VebadDesadvDettagliLottiDTO()
|
||||
.setTipoRecord(tipoRecord)
|
||||
.setNumRigaDoc(Integer.parseInt(line.substring(3, 3 + 5)))
|
||||
.setNumRigaLotti(Integer.parseInt(line.substring(8, 8 + 5)))
|
||||
.setGtin(line.substring(13, 13 + 14))
|
||||
.setLotto(line.substring(27, 27 + 50).trim())
|
||||
.setCodSscc(line.substring(77, 77 + 18))
|
||||
.setDataProd(line.substring(95, 95 + 6))
|
||||
.setDataScad(dataScad)
|
||||
.setQtaSscc(Integer.parseInt(line.substring(107, 107 + 6)))
|
||||
.setQtaInColli(Integer.parseInt(line.substring(113, 113 + 6)))
|
||||
.setQta(line.substring(119, 119 + 15))
|
||||
.setTranscodifica(line.substring(134, 134 + 20))
|
||||
.setCodStabilimentoProd(line.substring(154, 154 + 20))
|
||||
.setDescStabilimentoProd(line.substring(174, 174 + 50))
|
||||
.setOraProd(Integer.parseInt(line.substring(224, 224 + 4)))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<MtbColt> mtbColts = new ArrayList<>();
|
||||
|
||||
for (VebadDesadvDettagliLottiDTO dettagliLotti : vebadDesadv.getDettagliLotti()) {
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setGestione("A")
|
||||
.setSegno(1)
|
||||
.setCodMdep("01")
|
||||
.setDataCollo(UtilityString.parseLocalDate(vebadDesadv.testataDoc.getDataDDT()))
|
||||
.setBarcodeUl(dettagliLotti.getCodSscc());
|
||||
|
||||
mtbColt.setOperation(OperationType.INSERT);
|
||||
|
||||
String sql = Query.format("SELECT cod_mart from mtb_lisa WHERE cod_barre_imb = %s", dettagliLotti.getGtin());
|
||||
String codMart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
MtbColr mtbColr = new MtbColr()
|
||||
.setDataScadPartita(dettagliLotti.getDataScad())
|
||||
.setPartitaMag(dettagliLotti.getLotto())
|
||||
.setCodBarre(dettagliLotti.getGtin())
|
||||
.setNumCnf(new BigDecimal(dettagliLotti.getQtaSscc()))
|
||||
.setCodMart(codMart);
|
||||
|
||||
mtbColt.setMtbColr(new ArrayList<>())
|
||||
.getMtbColr()
|
||||
.add(mtbColr);
|
||||
|
||||
mtbColts.add(mtbColt);
|
||||
}
|
||||
|
||||
return entityProcessor.processEntityList(mtbColts, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ 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.GtbBancAzi;
|
||||
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;
|
||||
@@ -46,30 +46,67 @@ public class ExchangeBancheAziendaliImportService {
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.BancheAziendali, useTempTable);
|
||||
|
||||
final List<GtbBancAzi> exchangeImportedData = retrieveBanche(
|
||||
final List<GtbBancAzi> exchangeImportedDataBanche = retrieveBanche(
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
|
||||
true, false);
|
||||
|
||||
final List<GtbBancAzi> exchangeUpdatedData = retrieveBanche(
|
||||
final List<GtbBancAziIntercode> exchangeImportedDataBancheIntercode = retrieveBancheIntercode(
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
true, false);
|
||||
|
||||
|
||||
final List<GtbBancAzi> exchangeUpdatedDataBanche = retrieveBanche(
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
.runSync(GtbBancAzi.class, exchangeImportedData, exchangeUpdatedData);
|
||||
final List<GtbBancAziIntercode> exchangeUpdatedDataBancheIntercode = retrieveBancheIntercode(
|
||||
exchangeMultiDb.getPrimaryConnection(),
|
||||
false, useTempTable);
|
||||
|
||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
List<EquatableEntityInterface> allDataBanche = exchangeImportDataManagerService
|
||||
.runSync(GtbBancAzi.class, exchangeImportedDataBanche, exchangeUpdatedDataBanche);
|
||||
|
||||
allData = allData.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
List<EquatableEntityInterface> allDataBancheIntercode = exchangeImportDataManagerService
|
||||
.runSync(GtbBancAziIntercode.class, exchangeImportedDataBancheIntercode, exchangeUpdatedDataBancheIntercode );
|
||||
|
||||
allDataBanche.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
allDataBancheIntercode.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
allDataBanche = allDataBanche.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
.collect(Collectors.toList());
|
||||
allDataBancheIntercode = allDataBancheIntercode.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<EquatableEntityInterface> finalAllBancheData = allDataBanche;
|
||||
List<EquatableEntityInterface> finalAllBancheDataIntercode = allDataBancheIntercode;
|
||||
|
||||
allDataBancheIntercode.stream()
|
||||
.map(x -> (GtbBancAziIntercode) x)
|
||||
.filter(x -> finalAllBancheData.stream()
|
||||
.map(y -> (GtbBancAzi) y)
|
||||
.noneMatch(y -> x.getCodBancAzi().equalsIgnoreCase(y.getCodBancAzi()) ))
|
||||
.forEach(x -> {
|
||||
GtbBancAzi testata = new GtbBancAzi()
|
||||
.setCodBancAzi(x.getCodBancAzi());
|
||||
|
||||
testata.setOperation(OperationType.UPDATE);
|
||||
finalAllBancheData.add(testata);
|
||||
});
|
||||
|
||||
allDataBanche.stream()
|
||||
.map(x -> (GtbBancAzi) x)
|
||||
.forEach(x -> x.setGtbBancAziIntercode(finalAllBancheDataIntercode.stream()
|
||||
.map(y -> (GtbBancAziIntercode) y)
|
||||
.filter(y -> y.getCodBancAzi().equalsIgnoreCase(x.getCodBancAzi()))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
AtomicInteger importedCounter = new AtomicInteger();
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
|
||||
for (EquatableEntityInterface dataToSave : allData) {
|
||||
logger.debug("Importate {} banche aziendali di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
for (EquatableEntityInterface dataToSave : allDataBanche) {
|
||||
logger.debug("Importate {} banche aziendali di {}", importedCounter.incrementAndGet(), allDataBanche.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (GtbBancAzi) dataToSave, useTempTable);
|
||||
@@ -109,11 +146,27 @@ public class ExchangeBancheAziendaliImportService {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, GtbBancAzi.class,
|
||||
gtbBancAziTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
private List<GtbBancAziIntercode> retrieveBancheIntercode(Connection connection,
|
||||
boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
|
||||
String gtbBancAziIntercodeOriginalName = "gtb_banc_azi_intercode";
|
||||
String gtbBancAziIntercodeTableName = gtbBancAziIntercodeOriginalName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + gtbBancAziIntercodeTableName +
|
||||
" SELECT * FROM " + gtbBancAziIntercodeOriginalName
|
||||
);
|
||||
}
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, GtbBancAziIntercode.class,
|
||||
gtbBancAziIntercodeTableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
|
||||
private void singleUpdateImported(Connection connection, GtbBancAzi importedData, boolean useTempTable) throws Exception {
|
||||
final HashMap<String, Object> importedKey = new HashMap<String, Object>() {{
|
||||
@@ -121,6 +174,14 @@ public class ExchangeBancheAziendaliImportService {
|
||||
}};
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "gtb_banc_azi", importedKey, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedIntercodeKey = importedData.getGtbBancAziIntercode().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("id", x.getId());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "gtb_banc_azi_intercode", importedIntercodeKey, useTempTable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ public class ExchangeImportDataManagerService {
|
||||
|
||||
public <T extends EquatableEntityInterface> List<T> retrieveDataFromExchange(Connection connection,
|
||||
Class<T> clazz,
|
||||
String tableName, String whereCond, boolean retrieveAlreadyImported) throws Exception {
|
||||
String tableName,
|
||||
String whereCond, boolean retrieveAlreadyImported) throws Exception {
|
||||
|
||||
String query = "SELECT * FROM " + tableName + (retrieveAlreadyImported ? "_prev" : "") + " ";
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ExchangeImportSchemaManagerService {
|
||||
put(SchemaType.PartiteMagazzinoLavorazione, Arrays.asList("mtb_partita_mag_lav"));
|
||||
put(SchemaType.VersamentoGrezzo, Arrays.asList("mtb_colt_versamento_grezzo", "mtb_colr_versamento_grezzo"));
|
||||
put(SchemaType.CampiRaccolta, Collections.singletonList("campi_raccolta"));
|
||||
put(SchemaType.BancheAziendali, Arrays.asList("gtb_banc_azi"));
|
||||
put(SchemaType.BancheAziendali, Arrays.asList("gtb_banc_azi","gtb_banc_azi_intercode" ));
|
||||
put(SchemaType.ValorizzazioneCertificati, Collections.singletonList("valorizzazione_certificati"));
|
||||
}};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user