From 7785c352e3f96556bc6c9f787cb8f3de5cb757c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aristides=20dos=20Reis=20J=C3=BAnior?= Date: Mon, 26 Aug 2024 16:39:19 -0300 Subject: [PATCH] bug #AL-4274 --- pom.xml | 2 +- .../dao/EmpresaNequiConfigDAO.java | 8 ++ .../EmpresaNequiConfigHibernateDAO.java | 39 ++++++ .../entidad/CampanhaCupomSorteado.java | 125 +++++++++++++++++ .../entidad/EmpresaNequiConfig.java | 127 ++++++++++++++++++ .../ventaboletos/enums/TipoFormapago.java | 1 + .../service/EmpresaNequiConfigService.java | 8 ++ .../impl/EmpresaNequiConfigServiceImpl.java | 60 +++++++++ 8 files changed, 369 insertions(+), 1 deletion(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaNequiConfigDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaNequiConfigHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CampanhaCupomSorteado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaNequiConfig.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaNequiConfigService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaNequiConfigServiceImpl.java diff --git a/pom.xml b/pom.xml index 69570683a..d526905a7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ModelWeb - 1.99.0 + 1.100.0 diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaNequiConfigDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaNequiConfigDAO.java new file mode 100644 index 000000000..2cccb2bbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaNequiConfigDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig; + +public interface EmpresaNequiConfigDAO extends GenericDAO { + + public EmpresaNequiConfig buscarByEmpresa(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaNequiConfigHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaNequiConfigHibernateDAO.java new file mode 100644 index 000000000..00abd6b02 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaNequiConfigHibernateDAO.java @@ -0,0 +1,39 @@ +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.EmpresaNequiConfigDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig; + +@Repository("empresaNequiConfigDAO") +public class EmpresaNequiConfigHibernateDAO extends GenericHibernateDAO + implements EmpresaNequiConfigDAO { + + @Autowired + public EmpresaNequiConfigHibernateDAO(@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(); + } + + public EmpresaNequiConfig buscarByEmpresa(Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq(ACTIVO, Boolean.TRUE)); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + + return (EmpresaNequiConfig) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CampanhaCupomSorteado.java b/src/com/rjconsultores/ventaboletos/entidad/CampanhaCupomSorteado.java new file mode 100644 index 000000000..ccd493bf7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CampanhaCupomSorteado.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; + +public class CampanhaCupomSorteado { + + @Id + @Column(name = "CONVENIOCUPOMSORTEADO_ID") + private Integer campanhaCupomSorteadoId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "BOLETOSORTEADO_ID", referencedColumnName = "BOLETO_ID") + @ManyToOne + private Boleto boletoSorteado; + @JoinColumn(name = "BOLETOCUPOM_ID", referencedColumnName = "BOLETO_ID") + @ManyToOne + private Boleto boletoCupom; + private String codigoCupom; + + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + private Date feccreacion; + + public Integer getCampanhaCupomSorteadoId() { + return campanhaCupomSorteadoId; + } + + public void setCampanhaCupomSorteadoId(Integer campanhaCupomSorteadoId) { + this.campanhaCupomSorteadoId = campanhaCupomSorteadoId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boleto getBoletoSorteado() { + return boletoSorteado; + } + + public void setBoletoSorteado(Boleto boletoSorteado) { + this.boletoSorteado = boletoSorteado; + } + + public Boleto getBoletoCupom() { + return boletoCupom; + } + + public void setBoletoCupom(Boleto boletoCupom) { + this.boletoCupom = boletoCupom; + } + + public String getCodigoCupom() { + return codigoCupom; + } + + public void setCodigoCupom(String codigoCupom) { + this.codigoCupom = codigoCupom; + } + + 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; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFeccreacion() { + return feccreacion; + } + + public void setFeccreacion(Date feccreacion) { + this.feccreacion = feccreacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaNequiConfig.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaNequiConfig.java new file mode 100644 index 000000000..abe59c691 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaNequiConfig.java @@ -0,0 +1,127 @@ +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; + +@Entity +@SequenceGenerator(name = "EMP_NEQUI_CONFIG_SEQ", sequenceName = "EMP_NEQUI_CONFIG_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_NEQUI_CONFIG") +public class EmpresaNequiConfig implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMP_NEQUI_CONFIG_SEQ") + @Column(name = "EMPRESANEQUICONFIG_ID") + private Integer empresaNequiConfigId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "CLIENTID_NEQUI") + private String clienteIdNequi; + @Column(name = "HASH") + private String hash; + @Column(name = "API_KEY_NEQUI") + private String apiKey; + @Column(name = "URL") + private String url; + @Column(name = "CODE") + private String code; + + private Boolean activo; + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getEmpresaNequiConfigId() { + return empresaNequiConfigId; + } + + public void setEmpresaNequiConfigId(Integer empresaNequiConfigId) { + this.empresaNequiConfigId = empresaNequiConfigId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getClienteIdNequi() { + return clienteIdNequi; + } + + public void setClienteIdNequi(String clienteIdNequi) { + this.clienteIdNequi = clienteIdNequi; + } + + public String getHash() { + return hash; + } + + public void setHash(String hash) { + this.hash = hash; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + 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; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java index 06b8fee7b..47870a148 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java @@ -24,6 +24,7 @@ public enum TipoFormapago { ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")), MERCADO_PAGO(18,Labels.getLabel("editarFormaPagoController.lblMercadoPago.label")), EMBARQUE_JA(19,Labels.getLabel("editarFormaPagoController.lblEmbarqueJa.label")), + NEQUI(19,Labels.getLabel("editarFormaPagoController.lblNequi.label")) ; private Integer valor; diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaNequiConfigService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaNequiConfigService.java new file mode 100644 index 000000000..ba6bc572f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaNequiConfigService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig; + +public interface EmpresaNequiConfigService extends GenericService { + + public EmpresaNequiConfig buscarByEmpresa(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaNequiConfigServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaNequiConfigServiceImpl.java new file mode 100644 index 000000000..d1431a2e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaNequiConfigServiceImpl.java @@ -0,0 +1,60 @@ +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.EmpresaNequiConfigDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig; +import com.rjconsultores.ventaboletos.service.EmpresaNequiConfigService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaNequiConfigService") +public class EmpresaNequiConfigServiceImpl implements EmpresaNequiConfigService { + + @Autowired + private EmpresaNequiConfigDAO empresaNequiConfigDAO; + + public List obtenerTodos() { + return empresaNequiConfigDAO.obtenerTodos(); + } + + public EmpresaNequiConfig obtenerID(Integer id) { + return empresaNequiConfigDAO.obtenerID(id); + } + + @Transactional + public EmpresaNequiConfig suscribir(EmpresaNequiConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaNequiConfigDAO.suscribir(entidad); + } + + @Transactional + public EmpresaNequiConfig actualizacion(EmpresaNequiConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaNequiConfigDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaNequiConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaNequiConfigDAO.actualizacion(entidad); + } + + public EmpresaNequiConfig buscarByEmpresa(Integer empresaId) { + return empresaNequiConfigDAO.buscarByEmpresa(empresaId); + } + +}