From 3f6da882eb446c92de30b9264552500be71b8dc5 Mon Sep 17 00:00:00 2001 From: "lucas.taia" Date: Fri, 16 Dec 2022 19:17:43 -0300 Subject: [PATCH] AL-1231 --- .../dao/EmpresaAdyenConfigDAO.java | 14 ++ .../EmpresaAdyenConfigHibernateDAO.java | 41 ++++++ .../entidad/EmpresaAdyenConfig.java | 137 ++++++++++++++++++ .../ventaboletos/entidad/EstacionSitef.java | 22 +++ .../ventaboletos/entidad/Moneda.java | 11 ++ .../ventaboletos/enums/TipoFormapago.java | 4 +- .../ventaboletos/enums/TipoIntegracaoTEF.java | 1 + .../service/EmpresaAdyenConfigService.java | 9 ++ .../impl/EmpresaAdyenConfigServiceImpl.java | 69 +++++++++ 9 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaAdyenConfigDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaAdyenConfigHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaAdyenConfig.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaAdyenConfigService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaAdyenConfigServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaAdyenConfigDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaAdyenConfigDAO.java new file mode 100644 index 000000000..3290953a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaAdyenConfigDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig; + +public interface EmpresaAdyenConfigDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaAdyenConfig buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaAdyenConfigHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaAdyenConfigHibernateDAO.java new file mode 100644 index 000000000..06c0251e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaAdyenConfigHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaAdyenConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig; + +@Repository("empresaAdyenConfigDAO") +public class EmpresaAdyenConfigHibernateDAO extends GenericHibernateDAO + implements EmpresaAdyenConfigDAO { + + @Autowired + public EmpresaAdyenConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaAdyenConfig buscarPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return (EmpresaAdyenConfig) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaAdyenConfig.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaAdyenConfig.java new file mode 100644 index 000000000..8a942e641 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaAdyenConfig.java @@ -0,0 +1,137 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +@Entity +@SequenceGenerator(name = "EMPRESA_ADYEN_CONFIG_SEQ", sequenceName = "EMPRESA_ADYEN_CONFIG_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_ADYEN_CONFIG") +public class EmpresaAdyenConfig implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_ADYEN_CONFIG_SEQ") + @Column(name = "EMPRESAADYENCONFIG_ID") + private Integer empresaAdyenConfigId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "APIKEY") + private String apiKey; + @Column(name = "INDPRODUCAO") + private Boolean indProducao; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public EmpresaAdyenConfig() { + + } + + public Integer getEmpresaAdyenConfigId() { + return empresaAdyenConfigId; + } + + public void setEmpresaAdyenConfigId(Integer empresaAdyenConfigId) { + this.empresaAdyenConfigId = empresaAdyenConfigId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public Boolean getIndProducao() { + return indProducao; + } + + public void setIndProducao(Boolean indProducao) { + this.indProducao = indProducao; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresaAdyenConfigId == null) ? 0 : empresaAdyenConfigId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaAdyenConfig other = (EmpresaAdyenConfig) obj; + if (empresaAdyenConfigId == null) { + if (other.empresaAdyenConfigId != null) + return false; + } else if (!empresaAdyenConfigId.equals(other.empresaAdyenConfigId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaAdyenConfigId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java index 9fa5ae0a1..27a793bc8 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java @@ -69,6 +69,12 @@ public class EstacionSitef implements Serializable { @Column(name = "CNPJ") private String cnpj; + + @Column(name = "NUMERODESERIE") + private String numeroDeSerie; + + @Column(name = "DESCRICAO") + private String descricao; public EstacionSitef() { } @@ -206,4 +212,20 @@ public class EstacionSitef implements Serializable { public void setSenhaConfig(String senhaConfig) { this.senhaConfig = senhaConfig; } + + public String getNumeroDeSerie() { + return numeroDeSerie; + } + + public void setNumeroDeSerie(String numeroDeSerie) { + this.numeroDeSerie = numeroDeSerie; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Moneda.java b/src/com/rjconsultores/ventaboletos/entidad/Moneda.java index 7ee10ee63..1c42bbcee 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Moneda.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Moneda.java @@ -52,6 +52,8 @@ public class Moneda implements Serializable { private List puntoVentaList; @Column(name = "EQUIVALENCIA_ID") private String equivalenciaId; + @Column(name = "SIGLA") + private String sigla; public Moneda() { } @@ -156,4 +158,13 @@ public class Moneda implements Serializable { public void setSimbolo(String simbolo) { this.simbolo = simbolo; } + + public String getSigla() { + return sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + } diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java index b5addee29..a50363eda 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java @@ -20,7 +20,9 @@ public enum TipoFormapago { SMART_CARD(13,Labels.getLabel("editarFormaPagoController.lblSmartCard.label")), LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")), TPI(15, Labels.getLabel("editarFormaPagoController.lblTPI.label")), - MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")); + MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")), + ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")), + ; private Integer valor; private String descricao; diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java b/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java index 51266ecea..4090edbfa 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java @@ -8,6 +8,7 @@ public enum TipoIntegracaoTEF { SITEF("Sitef"), PAYGO("PayGo"), GRANITO("Granito"), + ADYEN("Adyen"), ; private String descricao; diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaAdyenConfigService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaAdyenConfigService.java new file mode 100644 index 000000000..2f53bb70b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaAdyenConfigService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig; + +public interface EmpresaAdyenConfigService extends GenericService { + + public EmpresaAdyenConfig buscarPorEmpresa(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaAdyenConfigServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaAdyenConfigServiceImpl.java new file mode 100644 index 000000000..4e3f16942 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaAdyenConfigServiceImpl.java @@ -0,0 +1,69 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaAdyenConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; +import com.rjconsultores.ventaboletos.service.EmpresaAdyenConfigService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaAdyenConfigService") +public class EmpresaAdyenConfigServiceImpl implements EmpresaAdyenConfigService { + + @Autowired + private EmpresaAdyenConfigDAO empresaAdyenConfigDAO; + + @Override + public List obtenerTodos() { + return empresaAdyenConfigDAO.obtenerTodos(); + } + + @Override + public EmpresaAdyenConfig obtenerID(Integer id) { + return empresaAdyenConfigDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaAdyenConfig suscribir(EmpresaAdyenConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaAdyenConfigDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaAdyenConfig actualizacion(EmpresaAdyenConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaAdyenConfigDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaAdyenConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaAdyenConfigDAO.actualizacion(entidad); + + } + + @Override + public EmpresaAdyenConfig buscarPorEmpresa(Empresa empresa) { + return empresaAdyenConfigDAO.buscarPorEmpresa(empresa); + } + +}