Merge branch 'develop' into feature/JDK11
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:
@@ -750,6 +750,24 @@ public class EmsController {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@GetMapping(value = "downloadFileFromRefUuid")
|
||||
public ResponseEntity<byte[]> downloadFileFromRefUuid(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String refUuid,
|
||||
@RequestParam() String fileName) throws Exception {
|
||||
AttachmentDTO attached = emsServices.downloadFileFromRefUuid(refUuid, fileName);
|
||||
|
||||
if (attached == null) return ResponseEntity.notFound().build();
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attached.getMimeType()))
|
||||
.contentLength(attached.getFileSize())
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.attachment()
|
||||
.filename(attached.getFileName())
|
||||
.build()
|
||||
.toString())
|
||||
.body(attached.getFileContent());
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.GET)
|
||||
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
|
||||
|
||||
@@ -28,6 +28,7 @@ import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.media.MediaImageService;
|
||||
import it.integry.ems.media.MediaVideoService;
|
||||
import it.integry.ems.media.MimeTypesHandler;
|
||||
import it.integry.ems.object_storage.minio.MinIOService;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.properties.EnvProperties;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
@@ -138,6 +139,9 @@ public class EmsServices {
|
||||
@Autowired
|
||||
private BasicConnectionPool basicConnectionPool;
|
||||
|
||||
@Autowired
|
||||
private MinIOService minIOService;
|
||||
|
||||
public EntityImportResponse<List<EntityBase>> importEntity(String type, String format, ImportRequestDTO body, boolean headless) throws Exception {
|
||||
logger.debug("Starting import [Type: " + type + ", Format: " + format + "]");
|
||||
String gestName = "IMPORT_" + type;
|
||||
@@ -587,8 +591,6 @@ public class EmsServices {
|
||||
}
|
||||
|
||||
public AttachmentDTO downloadStbFileAttachment(String idAttach, boolean requestThumbnail) throws Exception {
|
||||
|
||||
|
||||
StbFilesAttached stbFilesAttached = new StbFilesAttached();
|
||||
stbFilesAttached.setIdAttach(idAttach);
|
||||
stbFilesAttached.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -631,6 +633,17 @@ public class EmsServices {
|
||||
return null;
|
||||
}
|
||||
|
||||
public AttachmentDTO downloadFileFromRefUuid(String refUuid, String fileName) throws Exception {
|
||||
byte[] bytes = minIOService.downloadObject(refUuid, multiDBTransactionManager.getPrimaryConnection());
|
||||
String mimeType = mimeTypesHandler.getContentType(fileName).toString();
|
||||
|
||||
return new AttachmentDTO()
|
||||
.setFileContent(bytes)
|
||||
.setFileSize(bytes != null ? bytes.length : 0)
|
||||
.setMimeType(mimeType)
|
||||
.setFileName(fileName);
|
||||
}
|
||||
|
||||
public String createZipFromFiles(CreateZipDTO createZipDTO) throws Exception {
|
||||
if (createZipDTO == null) {
|
||||
throw new MissingDataException("createZipFromFiles");
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.ems.order.crm.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.order.crm.dto.CRMProspectRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.CRMActivityDTO;
|
||||
import it.integry.ems.order.crm.dto.CRMAnagRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.CRMRetrieveActivityRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.completeOrder.CRMCompleteOrderRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.createContact.CRMCreateContactRequestDTO;
|
||||
@@ -13,7 +15,6 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@RestController
|
||||
@@ -24,72 +25,79 @@ public class CrmController {
|
||||
@Autowired
|
||||
private CrmService crmService;
|
||||
|
||||
@RequestMapping(value = "createContact", method = RequestMethod.POST)
|
||||
@PostMapping(value = "createContact")
|
||||
public ServiceRestResponse createContact(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMCreateContactRequestDTO createContactDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.createContact(createContactDTO));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveActivity", method = RequestMethod.POST)
|
||||
@PostMapping(value = "saveActivity")
|
||||
public ServiceRestResponse saveActivity(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMActivityDTO activityRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.saveActivity(activityRequest));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "completeOrder", method = RequestMethod.POST)
|
||||
@PostMapping(value = "completeOrder")
|
||||
public ServiceRestResponse completeOrder(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMCompleteOrderRequestDTO completeOrder) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.completeOrder(completeOrder));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "transferProspect", method = RequestMethod.POST)
|
||||
@PostMapping(value = "transferProspect")
|
||||
public ServiceRestResponse transferProspect(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody CRMTransferProspectRequestDTO prospectToTransfer) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.transferProspect(prospectToTransfer));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveActivity", method = RequestMethod.POST)
|
||||
@PostMapping(value = "retrieveActivity")
|
||||
public ServiceRestResponse retrieveActivity(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody CRMRetrieveActivityRequestDTO crmRetrieveActivityRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveActivity(crmRetrieveActivityRequest));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveCommesse", method = RequestMethod.GET)
|
||||
@GetMapping(value = "retrieveCommesse")
|
||||
public ServiceRestResponse retrieveCommesse(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dateFilter) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveCommesse(dateFilter));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveProspect", method = RequestMethod.GET)
|
||||
@PostMapping(value = "retrieveProspect")
|
||||
public ServiceRestResponse retrieveProspect(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dateFilter) throws Exception {
|
||||
@RequestBody CRMProspectRequestDTO request) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveProspect(dateFilter));
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveProspect(request));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveClienti", method = RequestMethod.GET)
|
||||
@PostMapping(value = "retrieveClienti")
|
||||
public ServiceRestResponse retrieveClienti(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dateFilter) throws Exception {
|
||||
@RequestBody CRMAnagRequestDTO request) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveClienti(dateFilter));
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveClienti(request));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveSettings", method = RequestMethod.GET)
|
||||
@GetMapping(value = "retrieveSettings")
|
||||
public ServiceRestResponse retrieveSettings(@RequestParam(CommonConstants.PROFILE_DB) String profileDB) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveSettings());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveJobProgress", method = RequestMethod.GET)
|
||||
@GetMapping(value = "retrieveJobProgress")
|
||||
public ServiceRestResponse retrieveJobProgress(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam() String codJcom) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveJobProgress(codJcom));
|
||||
}
|
||||
|
||||
@GetMapping(value = "retrieveAttachedForCodJcom")
|
||||
public ServiceRestResponse retrieveAttachedForCodJcom(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam() String codJcom) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(crmService.retrieveAttached(codJcom));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class CRMAnagRequestDTO {
|
||||
|
||||
private Date filterDate;
|
||||
|
||||
private String flagStato;
|
||||
private String partitaIva;
|
||||
private String codAnag;
|
||||
|
||||
private boolean returnPersRif;
|
||||
|
||||
public Date getFilterDate() {
|
||||
return filterDate;
|
||||
}
|
||||
|
||||
public CRMAnagRequestDTO setFilterDate(Date filterDate) {
|
||||
this.filterDate = filterDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagStato() {
|
||||
return flagStato;
|
||||
}
|
||||
|
||||
public CRMAnagRequestDTO setFlagStato(String flagStato) {
|
||||
this.flagStato = flagStato;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaIva() {
|
||||
return partitaIva;
|
||||
}
|
||||
|
||||
public CRMAnagRequestDTO setPartitaIva(String partitaIva) {
|
||||
this.partitaIva = partitaIva;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public CRMAnagRequestDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean ReturnPersRif() {
|
||||
return returnPersRif;
|
||||
}
|
||||
|
||||
public CRMAnagRequestDTO setReturnPersRif(boolean returnPersRif) {
|
||||
this.returnPersRif = returnPersRif;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class CRMAttachedResponseDTO {
|
||||
|
||||
@SqlField(value = "file_name")
|
||||
private String fileName;
|
||||
|
||||
@SqlField(value = "description")
|
||||
private String description;
|
||||
|
||||
@SqlField(value = "date_attached")
|
||||
private Date dateAttached;
|
||||
|
||||
@SqlField(value = "file_size")
|
||||
private BigDecimal fileSize;
|
||||
|
||||
@SqlField(value = "ref_uuid")
|
||||
private String refUuid;
|
||||
|
||||
@SqlField(value = "ref_attached")
|
||||
private String refAttached;
|
||||
|
||||
@SqlField(value = "is_activity")
|
||||
private boolean isActivity;
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDateAttached() {
|
||||
return dateAttached;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setDateAttached(Date dateAttached) {
|
||||
this.dateAttached = dateAttached;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setFileSize(BigDecimal fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRefUuid() {
|
||||
return refUuid;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setRefUuid(String refUuid) {
|
||||
this.refUuid = refUuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRefAttached() {
|
||||
return refAttached;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setRefAttached(String refAttached) {
|
||||
this.refAttached = refAttached;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isActivity() {
|
||||
return isActivity;
|
||||
}
|
||||
|
||||
public CRMAttachedResponseDTO setActivity(boolean activity) {
|
||||
isActivity = activity;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class CRMProspectRequestDTO {
|
||||
|
||||
private Date filterDate;
|
||||
|
||||
private String partitaIva;
|
||||
private String codPpro;
|
||||
|
||||
private boolean returnPersRif;
|
||||
|
||||
public Date getFilterDate() {
|
||||
return filterDate;
|
||||
}
|
||||
|
||||
public CRMProspectRequestDTO setFilterDate(Date filterDate) {
|
||||
this.filterDate = filterDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaIva() {
|
||||
return partitaIva;
|
||||
}
|
||||
|
||||
public CRMProspectRequestDTO setPartitaIva(String partitaIva) {
|
||||
this.partitaIva = partitaIva;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodPpro() {
|
||||
return codPpro;
|
||||
}
|
||||
|
||||
public CRMProspectRequestDTO setCodPpro(String codPpro) {
|
||||
this.codPpro = codPpro;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean ReturnPersRif() {
|
||||
return returnPersRif;
|
||||
}
|
||||
|
||||
public CRMProspectRequestDTO setReturnPersRif(boolean returnPersRif) {
|
||||
this.returnPersRif = returnPersRif;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,15 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
public class CRMRetrieveActivityRequestDTO {
|
||||
|
||||
private String dateFilter;
|
||||
private String codJcom;
|
||||
private String activityId;
|
||||
private String codAnag;
|
||||
|
||||
public String getDateFilter() {
|
||||
return dateFilter;
|
||||
}
|
||||
|
||||
public CRMRetrieveActivityRequestDTO setDateFilter(String dateFilter) {
|
||||
this.dateFilter = dateFilter;
|
||||
return this;
|
||||
}
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
@@ -24,4 +19,40 @@ public class CRMRetrieveActivityRequestDTO {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public CRMRetrieveActivityRequestDTO setActivityId(String activityId) {
|
||||
this.activityId = activityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public CRMRetrieveActivityRequestDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public CRMRetrieveActivityRequestDTO setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public CRMRetrieveActivityRequestDTO setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package it.integry.ems.order.crm.dto;
|
||||
|
||||
import it.integry.ems_model.entity.StbActivityResult;
|
||||
import it.integry.ems_model.entity.StbActivityType;
|
||||
import it.integry.ems_model.entity.StbUser;
|
||||
import it.integry.ems_model.entity.VtbTipi;
|
||||
import it.integry.ems_model.entity.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CRMSettingsResponseDTO {
|
||||
|
||||
private List<StbActivityType> activityTypes;
|
||||
private List<SrlActivityTypeUser> activityTypeUsers;
|
||||
private List<StbActivityResult> activityResults;
|
||||
private List<StbUser> stbUsers;
|
||||
private List<VtbTipi> vtbTipi;
|
||||
@@ -24,6 +22,15 @@ public class CRMSettingsResponseDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<SrlActivityTypeUser> getActivityTypeUsers() {
|
||||
return activityTypeUsers;
|
||||
}
|
||||
|
||||
public CRMSettingsResponseDTO setActivityTypeUsers(List<SrlActivityTypeUser> activityTypeUsers) {
|
||||
this.activityTypeUsers = activityTypeUsers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbActivityResult> getActivityResults() {
|
||||
return activityResults;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.ems.order.crm.service;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.order.crm.dto.CRMProspectRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.*;
|
||||
import it.integry.ems.order.crm.dto.completeOrder.CRMCompleteOrderRequestDTO;
|
||||
import it.integry.ems.order.crm.dto.completeOrder.CRMCompleteOrderResponseDTO;
|
||||
@@ -763,26 +764,31 @@ public class CrmService {
|
||||
}
|
||||
|
||||
public List<StbActivity> retrieveActivity(CRMRetrieveActivityRequestDTO crmRetrieveActivityRequest) throws Exception {
|
||||
if (crmRetrieveActivityRequest.getDateFilter() != null) {
|
||||
String sql = Query.format("SELECT *\n" +
|
||||
"FROM stb_activity\n" +
|
||||
"WHERE ora_mod_act >= %s\n" +
|
||||
" OR data_ins_act >= %s",
|
||||
crmRetrieveActivityRequest.getDateFilter(), crmRetrieveActivityRequest.getDateFilter()
|
||||
);
|
||||
String sql = "SELECT * FROM stb_activity";
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbActivity.class);
|
||||
} else if (crmRetrieveActivityRequest.getCodJcom() != null) {
|
||||
String sql = Query.format("SELECT *\n" +
|
||||
"FROM stb_activity\n" +
|
||||
"WHERE cod_jcom = %s",
|
||||
crmRetrieveActivityRequest.getCodJcom()
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbActivity.class);
|
||||
if (crmRetrieveActivityRequest.getActivityId() != null) {
|
||||
sql = UtilityDB.addwhereCond(sql, "activity_id = " + UtilityDB.valueToString(crmRetrieveActivityRequest.getActivityId()), false);
|
||||
}
|
||||
|
||||
return null;
|
||||
if (crmRetrieveActivityRequest.getCodJcom() != null) {
|
||||
sql = UtilityDB.addwhereCond(sql, "cod_jcom = " + UtilityDB.valueToString(crmRetrieveActivityRequest.getCodJcom()), false);
|
||||
}
|
||||
|
||||
if (crmRetrieveActivityRequest.getCodAnag() != null) {
|
||||
sql = UtilityDB.addwhereCond(sql, "cod_anag = " + UtilityDB.valueToString(crmRetrieveActivityRequest.getCodAnag()), false);
|
||||
}
|
||||
|
||||
if (crmRetrieveActivityRequest.getStartDate() != null && crmRetrieveActivityRequest.getEndDate() != null) {
|
||||
String whereCond = "(effective_date IS NULL AND estimated_date >= {start} AND estimated_date <= {end})\n" +
|
||||
" OR (effective_date >= {start} AND effective_date <= {end})";
|
||||
whereCond = whereCond
|
||||
.replace("{start}", UtilityDB.valueToString(crmRetrieveActivityRequest.getStartDate()))
|
||||
.replace("{end}", UtilityDB.valueToString(crmRetrieveActivityRequest.getEndDate()));
|
||||
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
||||
}
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbActivity.class);
|
||||
}
|
||||
|
||||
public List<JtbComt> retrieveCommesse(LocalDate dateFilter) throws Exception {
|
||||
@@ -793,40 +799,48 @@ public class CrmService {
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, JtbComt.class);
|
||||
}
|
||||
|
||||
public CRMSyncResponseDTO retrieveProspect(LocalDate dateFilter) throws Exception {
|
||||
public CRMSyncResponseDTO retrieveProspect(CRMProspectRequestDTO requestDTO) throws Exception {
|
||||
CRMSyncResponseDTO taskSyncResponse = new CRMSyncResponseDTO();
|
||||
|
||||
String sql = "SELECT * FROM ptb_pros WHERE cod_anag IS NULL";
|
||||
if (dateFilter != null) {
|
||||
sql += " AND data_ins >= " + UtilityDB.valueToString(dateFilter);
|
||||
}
|
||||
if (requestDTO.getFilterDate() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND data_ins >= " + UtilityDB.valueToString(requestDTO.getFilterDate()), false);
|
||||
|
||||
if (requestDTO.getPartitaIva() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND part_iva = " + UtilityDB.valueToString(requestDTO.getPartitaIva()), false);
|
||||
|
||||
if (requestDTO.getCodPpro() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND cod_ppro = " + UtilityDB.valueToString(requestDTO.getCodPpro()), false);
|
||||
|
||||
taskSyncResponse.setPtbPros(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PtbPros.class)
|
||||
);
|
||||
|
||||
if (dateFilter == null) {
|
||||
sql = "SELECT *\n" +
|
||||
"FROM ptb_pros_rif\n" +
|
||||
"WHERE EXISTS(SELECT * FROM ptb_pros WHERE ptb_pros.cod_anag IS NULL AND ptb_pros.cod_ppro = ptb_pros_rif.cod_ppro)";
|
||||
} else {
|
||||
sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM ptb_pros_rif\n" +
|
||||
"WHERE EXISTS(SELECT * FROM ptb_pros WHERE ptb_pros.cod_anag IS NULL\n" +
|
||||
" AND data_ins >= %s\n" +
|
||||
" AND ptb_pros.cod_ppro = ptb_pros_rif.cod_ppro)",
|
||||
dateFilter
|
||||
if (requestDTO.ReturnPersRif()) {
|
||||
if (requestDTO.getFilterDate() == null) {
|
||||
sql = "SELECT *\n" +
|
||||
"FROM ptb_pros_rif\n" +
|
||||
"WHERE EXISTS(SELECT * FROM ptb_pros WHERE ptb_pros.cod_anag IS NULL AND ptb_pros.cod_ppro = ptb_pros_rif.cod_ppro)";
|
||||
} else {
|
||||
sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM ptb_pros_rif\n" +
|
||||
"WHERE EXISTS(SELECT * FROM ptb_pros WHERE ptb_pros.cod_anag IS NULL\n" +
|
||||
" AND data_ins >= %s\n" +
|
||||
" AND ptb_pros.cod_ppro = ptb_pros_rif.cod_ppro)",
|
||||
requestDTO.getFilterDate()
|
||||
);
|
||||
}
|
||||
|
||||
taskSyncResponse.setPtbProsRif(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PtbProsRif.class)
|
||||
);
|
||||
}
|
||||
|
||||
taskSyncResponse.setPtbProsRif(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PtbProsRif.class)
|
||||
);
|
||||
|
||||
return taskSyncResponse;
|
||||
}
|
||||
|
||||
public CRMSyncResponseDTO retrieveClienti(LocalDate dateFilter) throws Exception {
|
||||
public CRMSyncResponseDTO retrieveClienti(CRMAnagRequestDTO requestDTO) throws Exception {
|
||||
CRMSyncResponseDTO taskSyncResponse = new CRMSyncResponseDTO();
|
||||
|
||||
String sql = "SELECT gtb_anag.cod_anag,\n" +
|
||||
@@ -858,15 +872,28 @@ public class CrmService {
|
||||
"FROM gtb_anag\n" +
|
||||
" INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag";
|
||||
|
||||
if (dateFilter != null) {
|
||||
sql += " WHERE data_ins >= " + UtilityDB.valueToString(dateFilter) + " OR data_mod >= " + UtilityDB.valueToString(dateFilter);
|
||||
if (requestDTO.getFilterDate() != null) {
|
||||
sql = UtilityDB.addwhereCond(
|
||||
sql,
|
||||
"data_ins >= " + UtilityDB.valueToString(requestDTO.getFilterDate()) + " OR data_mod >= " + UtilityDB.valueToString(requestDTO.getFilterDate()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if (requestDTO.getCodAnag() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, "gtb_anag.cod_anag = " + UtilityDB.valueToString(requestDTO.getCodAnag()), false);
|
||||
|
||||
if (requestDTO.getPartitaIva() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, "part_iva = " + UtilityDB.valueToString(requestDTO.getPartitaIva()), false);
|
||||
|
||||
if (requestDTO.getFlagStato() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, "flag_stato = " + UtilityDB.valueToString(requestDTO.getFlagStato()), false);
|
||||
|
||||
taskSyncResponse.setAnagClie(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, AnagClieDTO.class)
|
||||
);
|
||||
|
||||
if (dateFilter == null) {
|
||||
if (requestDTO.ReturnPersRif()) {
|
||||
sql = "SELECT *\n" +
|
||||
"FROM vtb_dest\n" +
|
||||
"WHERE EXISTS(SELECT * FROM vtb_clie WHERE vtb_clie.cod_anag = vtb_dest.cod_anag)";
|
||||
@@ -894,6 +921,15 @@ public class CrmService {
|
||||
UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivityType.class)
|
||||
);
|
||||
|
||||
sql = "SELECT srl_activity_type_user.*\n" +
|
||||
"FROM srl_activity_type_user\n" +
|
||||
" INNER JOIN stb_User ON stb_user.user_name = srl_activity_type_user.user_name\n" +
|
||||
"WHERE flag_attivo = 'S'\n" +
|
||||
" AND flag_tipologia = 'A'";
|
||||
crmSettingsResponse.setActivityTypeUsers(
|
||||
UtilityDB.executeSimpleQueryDTO(conn, sql, SrlActivityTypeUser.class)
|
||||
);
|
||||
|
||||
sql = "SELECT * FROM stb_activity_result WHERE flag_attivo = 'S'";
|
||||
crmSettingsResponse.setActivityResults(
|
||||
UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivityResult.class)
|
||||
@@ -1126,4 +1162,67 @@ public class CrmService {
|
||||
|
||||
return jobProgressResponse;
|
||||
}
|
||||
|
||||
public List<CRMAttachedResponseDTO> retrieveAttached(String codJcom) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
String sql = Query.format(
|
||||
"DECLARE @codJcom VARCHAR(10) = %s\n" +
|
||||
"SELECT file_name,\n" +
|
||||
" NULL AS description,\n" +
|
||||
" last_upd AS date_attached,\n" +
|
||||
" original_size AS file_size,\n" +
|
||||
" ref_uuid,\n" +
|
||||
" activity_id AS ref_attached,\n" +
|
||||
" CAST(1 AS BIT) AS is_activity\n" +
|
||||
"FROM stb_activity_file\n" +
|
||||
" INNER JOIN stb_activity\n" +
|
||||
" ON stb_activity.activity_id = stb_activity_file.id\n" +
|
||||
"WHERE cod_jcom = @codJcom\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT file_name,\n" +
|
||||
" description,\n" +
|
||||
" datetime_attach AS date_attached,\n" +
|
||||
" file_size,\n" +
|
||||
" ref_uuid,\n" +
|
||||
" CONCAT(files.cod_dtip, '_',\n" +
|
||||
" files.num_doc, '_',\n" +
|
||||
" files.ser_doc, '_',\n" +
|
||||
" FORMAT(files.data_doc, 'dd/MM/yyyy')) AS ref_attached,\n" +
|
||||
" CAST(0 AS BIT) AS is_activity\n" +
|
||||
"FROM drl_doc_attached files\n" +
|
||||
" INNER JOIN stb_files_attached attached\n" +
|
||||
" ON files.id_attach = attached.id_attach\n" +
|
||||
" INNER JOIN dtb_doct\n" +
|
||||
" ON dtb_doct.cod_dtip = files.cod_dtip\n" +
|
||||
" AND dtb_doct.cod_anag = files.cod_anag\n" +
|
||||
" AND dtb_doct.data_doc = files.data_doc\n" +
|
||||
" AND dtb_doct.ser_doc = files.ser_doc\n" +
|
||||
" AND files.num_doc = dtb_doct.num_doc\n" +
|
||||
"WHERE cod_jcom = @codJcom\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT filename AS file_name,\n" +
|
||||
" NULL AS description,\n" +
|
||||
" data_stampa AS date_attached,\n" +
|
||||
" filesize AS file_size,\n" +
|
||||
" ref_uuid,\n" +
|
||||
" CONCAT(doc.cod_dtip, '_',\n" +
|
||||
" doc.num_doc, '_',\n" +
|
||||
" doc.ser_doc, '_',\n" +
|
||||
" FORMAT(doc.data_doc, 'dd/MM/yyyy')) AS ref_attached,\n" +
|
||||
" CAST(0 AS BIT) AS is_activity\n" +
|
||||
"FROM dtb_doc_pdf pdf\n" +
|
||||
" INNER JOIN dtb_doct doc\n" +
|
||||
" ON pdf.data_doc = doc.data_doc\n" +
|
||||
" AND pdf.ser_doc = doc.ser_doc\n" +
|
||||
" AND pdf.num_doc = doc.num_doc\n" +
|
||||
" AND pdf.cod_anag = doc.cod_anag\n" +
|
||||
" AND doc.cod_dtip = pdf.cod_dtip\n" +
|
||||
"WHERE cod_jcom = @codJcom\n" +
|
||||
"ORDER BY date_attached DESC",
|
||||
codJcom
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(conn, sql, CRMAttachedResponseDTO.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user