Aggiunta join di StbPosizioni in StbActivity
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_20250730152443 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE stb_posizioni ADD descrizione VARCHAR(50) 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_20250730153210 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE stb_activity\n" +
|
||||
" ADD id_posizione BIGINT\n" +
|
||||
" CONSTRAINT fk_stb_activity_stb_posizioni REFERENCES dbo.stb_posizioni");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -196,6 +196,10 @@ public class StbActivity extends EntityBase {
|
||||
@SqlField(value = "plan_id", maxLength = 15)
|
||||
private Long planId;
|
||||
|
||||
@FK(tableName = StbPosizioni.ENTITY, columnName = "id")
|
||||
@SqlField(value = "id_posizione")
|
||||
private Long idPosizione;
|
||||
|
||||
@EntityChild
|
||||
private List<StbActivityCosts> stbActivityCosts = new ArrayList<>();
|
||||
|
||||
@@ -744,6 +748,15 @@ public class StbActivity extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getIdPosizione() {
|
||||
return idPosizione;
|
||||
}
|
||||
|
||||
public StbActivity setIdPosizione(Long idPosizione) {
|
||||
this.idPosizione = idPosizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbActivityCosts> getStbActivityCosts() {
|
||||
return stbActivityCosts;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public class StbPosizioni extends EntityBase {
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField(value = "descrizione", maxLength = 50)
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "lat")
|
||||
private BigDecimal lat;
|
||||
|
||||
@@ -60,6 +63,15 @@ public class StbPosizioni extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public StbPosizioni setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
@@ -1046,7 +1048,7 @@ public class DocumentController {
|
||||
|
||||
@PostMapping(value = "allineaCostoSuddivisioni")
|
||||
public ServiceRestResponse allineaCostoSuddivisioni(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam ( required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dataInizio) throws Exception {
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dataInizio) throws Exception {
|
||||
|
||||
allinementoCostoSuddivisioneService.allineaCosto(dataInizio);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
@@ -25,28 +25,28 @@ public class CrmController {
|
||||
|
||||
@RequestMapping(value = "createContact", method = RequestMethod.POST)
|
||||
public ServiceRestResponse createContact(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMCreateContactRequestDTO createContactDTO) throws Exception {
|
||||
@RequestBody CRMCreateContactRequestDTO createContactDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.createContact(createContactDTO));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveActivity", method = RequestMethod.POST)
|
||||
public ServiceRestResponse saveActivity(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMActivityDTO activityRequest) throws Exception {
|
||||
@RequestBody CRMActivityDTO activityRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.saveActivity(activityRequest));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "completeOrder", method = RequestMethod.POST)
|
||||
public ServiceRestResponse completeOrder(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMCompleteOrderRequestDTO completeOrder) throws Exception {
|
||||
@RequestBody CRMCompleteOrderRequestDTO completeOrder) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.completeOrder(completeOrder));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "transferProspect", method = RequestMethod.POST)
|
||||
public ServiceRestResponse transferProspect(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMTransferProspectRequestDTO prospectToTransfer) throws Exception {
|
||||
@RequestBody CRMTransferProspectRequestDTO prospectToTransfer) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.transferProspect(prospectToTransfer));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import it.integry.ems_model.entity.StbPosizioni;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -29,6 +31,8 @@ public class CRMActivityDTO {
|
||||
|
||||
private List<String> userNameList;
|
||||
|
||||
private StbPosizioni stbPosizioni;
|
||||
|
||||
public String getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
@@ -213,4 +217,13 @@ public class CRMActivityDTO {
|
||||
this.effectiveEndtime = effectiveEndtime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StbPosizioni getStbPosizioni() {
|
||||
return stbPosizioni;
|
||||
}
|
||||
|
||||
public CRMActivityDTO setStbPosizioni(StbPosizioni stbPosizioni) {
|
||||
this.stbPosizioni = stbPosizioni;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class CRMCreateContactRequestDTO {
|
||||
private String codAnag;
|
||||
private String tipoAnag;
|
||||
private String codVdes;
|
||||
private String codVage;
|
||||
private String processActivityId;
|
||||
|
||||
private CRMClienteDTO cliente;
|
||||
@@ -55,6 +56,15 @@ public class CRMCreateContactRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVage() {
|
||||
return codVage;
|
||||
}
|
||||
|
||||
public CRMCreateContactRequestDTO setCodVage(String codVage) {
|
||||
this.codVage = codVage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProcessActivityId() {
|
||||
return processActivityId;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package it.integry.ems.order.crm.dto.createContact;
|
||||
|
||||
import it.integry.ems.order.crm.dto.AnagClieDTO;
|
||||
import it.integry.ems_model.entity.JtbComt;
|
||||
import it.integry.ems_model.entity.PtbPros;
|
||||
import it.integry.ems_model.entity.StbActivity;
|
||||
import it.integry.ems_model.entity.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CRMCreateContactResponseDTO {
|
||||
|
||||
private AnagClieDTO anagClie;
|
||||
private PtbPros ptbPros;
|
||||
|
||||
private List<VtbCliePersRif> vtbCliePersRif;
|
||||
private List<PtbProsRif> ptbProsRifs;
|
||||
|
||||
private JtbComt jtbComt;
|
||||
private StbActivity stbActivity;
|
||||
|
||||
@@ -31,6 +34,24 @@ public class CRMCreateContactResponseDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VtbCliePersRif> getVtbCliePersRif() {
|
||||
return vtbCliePersRif;
|
||||
}
|
||||
|
||||
public CRMCreateContactResponseDTO setVtbCliePersRif(List<VtbCliePersRif> vtbCliePersRif) {
|
||||
this.vtbCliePersRif = vtbCliePersRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<PtbProsRif> getPtbProsRifs() {
|
||||
return ptbProsRifs;
|
||||
}
|
||||
|
||||
public CRMCreateContactResponseDTO setPtbProsRifs(List<PtbProsRif> ptbProsRifs) {
|
||||
this.ptbProsRifs = ptbProsRifs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JtbComt getJtbComt() {
|
||||
return jtbComt;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.order.crm.dto.transferProspect;
|
||||
|
||||
import it.integry.ems.order.crm.dto.AnagClieDTO;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
|
||||
@@ -7,16 +8,28 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CRMTransferProspectResponseDTO {
|
||||
private String codAnag;
|
||||
|
||||
private GtbAnag gtbAnag;
|
||||
private CtbAnag ctbAnag;
|
||||
|
||||
private AnagClieDTO anagClie;
|
||||
|
||||
private List<WdtbOrdt> wdtbOrdts = new ArrayList<>();
|
||||
private List<JtbComt> jtbComts = new ArrayList<>();
|
||||
private List<PtbPros> ptbPros = new ArrayList<>();
|
||||
private List<StbActivity> stbActivities = new ArrayList<>();
|
||||
private List<PtbPrevt> ptbPrevts = new ArrayList<>();
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public CRMTransferProspectResponseDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GtbAnag getGtbAnag() {
|
||||
return gtbAnag;
|
||||
}
|
||||
@@ -35,6 +48,15 @@ public class CRMTransferProspectResponseDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnagClieDTO getAnagClie() {
|
||||
return anagClie;
|
||||
}
|
||||
|
||||
public CRMTransferProspectResponseDTO setAnagClie(AnagClieDTO anagClie) {
|
||||
this.anagClie = anagClie;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<WdtbOrdt> getWdtbOrdts() {
|
||||
return wdtbOrdts;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static it.integry.ems_model.config.EmsRestConstants.DATE_NULL;
|
||||
|
||||
@@ -72,10 +69,13 @@ public class CrmService {
|
||||
CRMClienteDTO cliente = createContact.getCliente();
|
||||
CRMDestinazioneDTO crmDestinazione = createContact.getDestinazione();
|
||||
|
||||
List<VtbCliePersRif> vtbCliePersRif = null;
|
||||
List<PtbProsRif> ptbProsRifs = null;
|
||||
|
||||
try {
|
||||
switch (createContact.getTipoAnag()) {
|
||||
case "C":
|
||||
List<VtbCliePersRif> vtbCliePersRif = CRMUtility.buildEntityPersRif(conn, codAnag, createContact.getPersRif(), VtbCliePersRif.class);
|
||||
vtbCliePersRif = CRMUtility.buildEntityPersRif(conn, codAnag, createContact.getPersRif(), VtbCliePersRif.class);
|
||||
|
||||
GtbAnag gtbAnag = new GtbAnag()
|
||||
.setCodAnag(createContact.getCodAnag())
|
||||
@@ -100,7 +100,7 @@ public class CrmService {
|
||||
}
|
||||
break;
|
||||
case "P":
|
||||
List<PtbProsRif> ptbProsRifs = CRMUtility.buildEntityPersRif(conn, codAnag, createContact.getPersRif(), PtbProsRif.class);
|
||||
ptbProsRifs = CRMUtility.buildEntityPersRif(conn, codAnag, createContact.getPersRif(), PtbProsRif.class);
|
||||
|
||||
PtbPros ptbPros = CRMUtility.buildEntityCustomer(codAnag, cliente, PtbPros.class);
|
||||
|
||||
@@ -112,6 +112,8 @@ public class CrmService {
|
||||
if (codAnag == null && createContact.getCommessa() != null && !UtilityString.isNullOrEmpty(createContact.getCommessa().getCodJflav())) {
|
||||
ptbPros.setCodVage(CRMUtility.getCodVageFromCodJflav(conn, createContact.getCommessa().getCodJflav()))
|
||||
.setCodVlis(getDefaultCodVlis());
|
||||
} else if (!UtilityString.isNullOrEmpty(createContact.getCodVage())) {
|
||||
ptbPros.setCodVage(createContact.getCodVage());
|
||||
}
|
||||
|
||||
if (crmDestinazione != null) {
|
||||
@@ -211,10 +213,12 @@ public class CrmService {
|
||||
);
|
||||
|
||||
response.setAnagClie(UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, AnagClieDTO.class));
|
||||
response.setVtbCliePersRif(vtbCliePersRif);
|
||||
} else if ("P".equals(createContact.getTipoAnag())) {
|
||||
String sql = Query.format("SELECT * FROM ptb_pros WHERE cod_ppro = %s", codAnag);
|
||||
|
||||
response.setPtbPros(UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, PtbPros.class));
|
||||
response.setPtbProsRifs(ptbProsRifs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Rollback in caso di errore
|
||||
@@ -504,7 +508,7 @@ public class CrmService {
|
||||
return response;
|
||||
}
|
||||
|
||||
public GtbAnag transferProspect(CRMTransferProspectRequestDTO request) throws Exception {
|
||||
public CRMTransferProspectResponseDTO transferProspect(CRMTransferProspectRequestDTO request) throws Exception {
|
||||
CRMTransferProspectResponseDTO transferProspectResponse =
|
||||
CRMUtility.prospectToClie(
|
||||
multiDBTransactionManager.getPrimaryConnection(), request.getCodAnag(), request.getCodPpro()
|
||||
@@ -512,7 +516,46 @@ public class CrmService {
|
||||
|
||||
try {
|
||||
entityProcessor.processEntityList(transferProspectResponse.getEntityToProcess(), multiDBTransactionManager, true);
|
||||
return transferProspectResponse.getGtbAnag();
|
||||
transferProspectResponse.setCodAnag(transferProspectResponse.getGtbAnag().getCodAnag());
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT gtb_anag.cod_anag,\n" +
|
||||
" vtb_clie.cod_vtip,\n" +
|
||||
" vtb_clie.cod_vage,\n" +
|
||||
" vtb_clie.flag_stato,\n" +
|
||||
" rag_soc,\n" +
|
||||
" indirizzo,\n" +
|
||||
" cap,\n" +
|
||||
" citta,\n" +
|
||||
" prov,\n" +
|
||||
" nazione,\n" +
|
||||
" telefono,\n" +
|
||||
" fax,\n" +
|
||||
" part_iva,\n" +
|
||||
" cod_fisc,\n" +
|
||||
" gtb_anag.note,\n" +
|
||||
" persona_rif,\n" +
|
||||
" e_mail,\n" +
|
||||
" nome,\n" +
|
||||
" data_ins,\n" +
|
||||
" num_cell,\n" +
|
||||
" e_mail_pec,\n" +
|
||||
" cognome,\n" +
|
||||
" diacod,\n" +
|
||||
" lat,\n" +
|
||||
" lng,\n" +
|
||||
" data_mod\n" +
|
||||
"FROM gtb_anag\n" +
|
||||
" INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag\n" +
|
||||
"WHERE gtb_anag.cod_anag = %s",
|
||||
transferProspectResponse.getCodAnag()
|
||||
);
|
||||
|
||||
transferProspectResponse.setAnagClie(UtilityDB.executeSimpleQueryOnlyFirstRowDTO(
|
||||
multiDBTransactionManager.getPrimaryConnection(), sql, AnagClieDTO.class
|
||||
));
|
||||
|
||||
return transferProspectResponse;
|
||||
} catch (Exception e) {
|
||||
// Rollback in caso di errore
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
|
||||
@@ -229,7 +229,8 @@ public class CRMUtility {
|
||||
.setEffectiveDate(activityRequest.getEffectiveTime())
|
||||
.setEffectiveTime(activityRequest.getEffectiveTime())
|
||||
.setEffectiveEnddate(activityRequest.getEffectiveEndtime())
|
||||
.setEffectiveEndtime(activityRequest.getEffectiveEndtime());
|
||||
.setEffectiveEndtime(activityRequest.getEffectiveEndtime())
|
||||
.setIdPosizione(activityRequest.getStbPosizioni() != null ? activityRequest.getStbPosizioni().getId() : null);
|
||||
}
|
||||
|
||||
public static <T> T buildEntityCustomer(String codAnag, CRMClienteDTO cliente, Class<T> clazz) {
|
||||
|
||||
Reference in New Issue
Block a user