Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -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_20241211173736 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("UPDATE stb_gest_setup SET gest_name = 'VTB_DIST_INCAT' WHERE gest_name = 'W_VDOCU_PAGA_DLG' AND section = 'COD_PAGA'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.util.Date;
|
||||
@@ -25,7 +26,7 @@ public class VtbDistIncat extends EntityBase {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@PK
|
||||
@SqlField(value = "data_dist", nullable = false)
|
||||
@SqlField(value = "data_dist", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataDist;
|
||||
|
||||
@PK
|
||||
|
||||
@@ -2,12 +2,16 @@ package it.integry.ems.logistic.conSegna.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.logistic.conSegna.dto.ConSegnaRequestDataDTO;
|
||||
import it.integry.ems.logistic.conSegna.dto.DatiConsegneDTO;
|
||||
import it.integry.ems.logistic.conSegna.dto.SospesiClienteDTO;
|
||||
import it.integry.ems.logistic.conSegna.service.ConSegnaService;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Scope(value = "request")
|
||||
@RequestMapping("/consegna")
|
||||
@@ -28,4 +32,25 @@ public class ConSegnaController {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(conSegnaService.getCertificato());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "syncSospesi", method = RequestMethod.POST)
|
||||
public ServiceRestResponse syncSospesi(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String username,
|
||||
@RequestBody List<SospesiClienteDTO> sospesi) throws Exception {
|
||||
|
||||
if (sospesi == null || sospesi.isEmpty())
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
conSegnaService.syncSospesi(sospesi, username);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "syncDocumenti", method = RequestMethod.POST)
|
||||
public ServiceRestResponse syncDocumenti(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String username,
|
||||
@RequestBody DatiConsegneDTO datiConsegna) throws Exception {
|
||||
|
||||
conSegnaService.syncDocumenti(datiConsegna);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,9 @@ public class DatiConsegneDTO {
|
||||
@SqlField(value = "data_doc")
|
||||
private Date dataDoc;
|
||||
|
||||
@SqlField(value = "note")
|
||||
private String note;
|
||||
|
||||
private List<DettaglioRigheDTO> dettaglioRighe;
|
||||
|
||||
public Integer getNumDoc() {
|
||||
@@ -186,4 +189,13 @@ public class DatiConsegneDTO {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public DatiConsegneDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ public class SospesiClienteDTO {
|
||||
@SqlField(value = "num_doc")
|
||||
private Integer numDoc;
|
||||
|
||||
@SqlField(value = "ser_doc")
|
||||
private String serDoc;
|
||||
|
||||
@SqlField(value = "cod_vdes")
|
||||
private String codVdes;
|
||||
|
||||
@@ -34,6 +37,12 @@ public class SospesiClienteDTO {
|
||||
@SqlField(value = "data_scad")
|
||||
private Date dataScad;
|
||||
|
||||
private BigDecimal importoPagato;
|
||||
|
||||
private boolean contanti;
|
||||
private boolean assegni;
|
||||
private boolean carte;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
@@ -114,4 +123,34 @@ public class SospesiClienteDTO {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public SospesiClienteDTO setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getImportoPagato() {
|
||||
return importoPagato;
|
||||
}
|
||||
|
||||
public SospesiClienteDTO setImportoPagato(BigDecimal importoPagato) {
|
||||
this.importoPagato = importoPagato;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoPaga() {
|
||||
if (contanti) {
|
||||
return "CONTANTI";
|
||||
} else if (assegni) {
|
||||
return "ASSEGNI";
|
||||
} else if (carte) {
|
||||
return "CARTE";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package it.integry.ems.logistic.conSegna.service;
|
||||
|
||||
import it.integry.ems.logistic.conSegna.dto.*;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.entity.DtbDocr;
|
||||
import it.integry.ems_model.entity.StbFilesAttached;
|
||||
import it.integry.ems_model.entity.VtbDistIncar;
|
||||
import it.integry.ems_model.entity.VtbDistIncat;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.josql.expressions.SelectItemExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -20,6 +27,9 @@ public class ConSegnaService {
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
public List<DatiClientiDTO> getDatiConsegne(ConSegnaRequestDataDTO consegnaRequestData) throws Exception {
|
||||
String username = consegnaRequestData.getUsername();
|
||||
Date dataDoc = consegnaRequestData.getDataDoc();
|
||||
@@ -154,4 +164,66 @@ public class ConSegnaService {
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbFilesAttached.class);
|
||||
}
|
||||
|
||||
public void syncSospesi(List<SospesiClienteDTO> sospesi, String username) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
Date data = new Date();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT User_code\n" +
|
||||
"FROM Wtb_users\n" +
|
||||
"WHERE User_name = %s",
|
||||
username
|
||||
);
|
||||
|
||||
String codVvet = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM vtb_dist_incat\n" +
|
||||
"WHERE data_dist = %s\n" +
|
||||
" AND cod_vvet = %s",
|
||||
data, codVvet
|
||||
);
|
||||
|
||||
VtbDistIncat vtbDistIncat = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, VtbDistIncat.class);
|
||||
|
||||
if (vtbDistIncat == null) {
|
||||
vtbDistIncat = new VtbDistIncat();
|
||||
vtbDistIncat.setCodVvet(codVvet).setDataDist(data);
|
||||
vtbDistIncat.setOperation(OperationType.INSERT);
|
||||
} else {
|
||||
vtbDistIncat.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
|
||||
for (SospesiClienteDTO sospeso : sospesi) {
|
||||
VtbDistIncar vtbDistIncar = new VtbDistIncar();
|
||||
vtbDistIncar.setCodAnag(sospeso.getCodAnag());
|
||||
vtbDistIncar.setCodDtip(sospeso.getCodDtip());
|
||||
vtbDistIncar.setDataDoc(sospeso.getDataDoc());
|
||||
vtbDistIncar.setNumDoc(sospeso.getNumDoc());
|
||||
vtbDistIncar.setSerDoc(sospeso.getSerDoc());
|
||||
vtbDistIncar.setImpIncasso(sospeso.getImportoPagato());
|
||||
|
||||
sql = Query.format(
|
||||
"SELECT value\n" +
|
||||
"FROM stb_gest_setup\n" +
|
||||
"WHERE gest_name = 'VTB_DIST_INCAT'\n" +
|
||||
" AND section = 'COD_PAGA'\n" +
|
||||
" AND key_section = %s",
|
||||
sospeso.getTipoPaga()
|
||||
);
|
||||
String codPaga = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
vtbDistIncar.setCodPaga(codPaga);
|
||||
vtbDistIncar.setOperation(OperationType.INSERT);
|
||||
vtbDistIncat.getVtbDistIncar().add(vtbDistIncar);
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(vtbDistIncat, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public void syncDocumenti(DatiConsegneDTO datiConsegna) throws Exception {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user