Espec Bolivariano - Integração Infobit. fixes bug#AL-4273
parent
998629d197
commit
d009439696
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>ModelWeb</artifactId>
|
||||
<version>1.82.0</version>
|
||||
<version>1.83.0</version>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
|
|
@ -44,4 +44,6 @@ public class ConstantesFuncionSistema {
|
|||
|
||||
public static final String CLAVE_MENU_RELATORIOS_VIAJAR_DETALHADO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.RELATORIOSESTATISTICOS.PASSAGEIROSVIAJARDETALHADO";
|
||||
public static final String FUNCION_RECOLECCION = "COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.RECOLECCION";
|
||||
|
||||
public static final String CLAVE_INTEGRACAO_COMPROVANTE_PASSAGEM = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.INTEGRACAOCOMPROVANTEPASSAGEM";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfComprovantePassagem;
|
||||
|
||||
public interface ConfComprovantePassagemDAO extends GenericDAO<ConfComprovantePassagem, Long> {
|
||||
|
||||
public ConfComprovantePassagem buscarPorEmpresaId(Integer empresaId);
|
||||
|
||||
public ConfComprovantePassagem buscarConfiguracao(Integer empresaId, String tipoIntegracao, String viaComprovante);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
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.ConfComprovantePassagemDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfComprovantePassagem;
|
||||
|
||||
@Repository("comfComprovantePassagemDAO")
|
||||
public class ConfComprovantePassagemHibernateDAO extends GenericHibernateDAO<ConfComprovantePassagem, Long> implements ConfComprovantePassagemDAO {
|
||||
|
||||
@Autowired
|
||||
public ConfComprovantePassagemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfComprovantePassagem buscarPorEmpresaId(Integer empresaId) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("empresa.empresaId", empresaId));
|
||||
|
||||
return (ConfComprovantePassagem) c.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfComprovantePassagem buscarConfiguracao(Integer empresaId, String tipoIntegracao, String viaComprovante) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("empresa.empresaId", empresaId));
|
||||
c.add(Restrictions.eq("tipoIntegracao", tipoIntegracao));
|
||||
c.add(Restrictions.eq("viaComprovante", viaComprovante));
|
||||
|
||||
return (ConfComprovantePassagem) c.uniqueResult();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
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.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CONF_COMPROVANTE_PASSAGEM")
|
||||
@SequenceGenerator(name = "CONF_COMPROVANTE_PASSAGEM_SEQ", sequenceName = "CONF_COMPROVANTE_PASSAGEM_SEQ", allocationSize = 1)
|
||||
public class ConfComprovantePassagem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_COMPROVANTE_PASSAGEM_SEQ")
|
||||
@Column(name = "CONFCOMPROVANTEPASSAGEM_ID")
|
||||
private Long ConfComprovantePassagemId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
private Empresa empresa;
|
||||
|
||||
@Column(name = "TIPO_INTEGRACAO")
|
||||
private String tipoIntegracao;
|
||||
|
||||
@Column(name = "VIA_COMPROVANTE")
|
||||
private String viaComprovante;
|
||||
|
||||
@Column(name = "URL")
|
||||
private String url;
|
||||
|
||||
@Column(name = "API_KEY")
|
||||
private String apiKey;
|
||||
|
||||
@Column(name = "REMETENTE")
|
||||
private String remetente;
|
||||
|
||||
@Column(name = "NOME_TEMPLATE")
|
||||
private String nomeTemplate;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "USUARIO_ID")
|
||||
private Usuario usuario;
|
||||
|
||||
public Long getConfComprovantePassagemId() {
|
||||
return ConfComprovantePassagemId;
|
||||
}
|
||||
|
||||
public void setConfComprovantePassagemId(Long confComprovantePassagemId) {
|
||||
ConfComprovantePassagemId = confComprovantePassagemId;
|
||||
}
|
||||
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
public String getViaComprovante() {
|
||||
return viaComprovante;
|
||||
}
|
||||
|
||||
public void setViaComprovante(String viaComprovante) {
|
||||
this.viaComprovante = viaComprovante;
|
||||
}
|
||||
|
||||
public String getTipoIntegracao() {
|
||||
return tipoIntegracao;
|
||||
}
|
||||
|
||||
public void setTipoIntegracao(String tipoIntegracao) {
|
||||
this.tipoIntegracao = tipoIntegracao;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getRemetente() {
|
||||
return remetente;
|
||||
}
|
||||
|
||||
public void setRemetente(String remetente) {
|
||||
this.remetente = remetente;
|
||||
}
|
||||
|
||||
public String getNomeTemplate() {
|
||||
return nomeTemplate;
|
||||
}
|
||||
|
||||
public void setNomeTemplate(String nomeTemplate) {
|
||||
this.nomeTemplate = nomeTemplate;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Usuario getUsuario() {
|
||||
return usuario;
|
||||
}
|
||||
|
||||
public void setUsuario(Usuario usuario) {
|
||||
this.usuario = usuario;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package com.rjconsultores.ventaboletos.enums;
|
|||
|
||||
public enum EnumTipoIntegracao {
|
||||
|
||||
INFOBIT,;
|
||||
INFOBIP,;
|
||||
|
||||
private EnumTipoIntegracao() {
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.rjconsultores.ventaboletos.enums;
|
||||
|
||||
public enum EnumViaComprovantePassagem {
|
||||
|
||||
EMAIL,
|
||||
SMS,
|
||||
WhatsApp
|
||||
;
|
||||
|
||||
private EnumViaComprovantePassagem() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfComprovantePassagem;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
|
||||
public interface ConfComprovantePassagemService {
|
||||
|
||||
ConfComprovantePassagem suscribirActualizar(ConfComprovantePassagem conf) throws BusinessException;
|
||||
|
||||
void apagar(ConfComprovantePassagem conf) throws BusinessException;
|
||||
|
||||
public ConfComprovantePassagem buscarConfComprovantePassagemPorEmpresaId(Integer empresaID);
|
||||
|
||||
public ConfComprovantePassagem buscarConfiguracao(Integer empresaID, String tipoIntegracao, String viaComprovante);
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.ConfComprovantePassagemDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfComprovantePassagem;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.ConfComprovantePassagemService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("confComprovantePassagemService")
|
||||
public class ConfComprovantePassagemServiceImpl implements ConfComprovantePassagemService {
|
||||
|
||||
@Autowired
|
||||
private ConfComprovantePassagemDAO confCompPassDAO;
|
||||
|
||||
@Transactional(rollbackFor = BusinessException.class)
|
||||
@Override
|
||||
public ConfComprovantePassagem suscribirActualizar(ConfComprovantePassagem conf) throws BusinessException {
|
||||
|
||||
conf.setFecmodif(new Date());
|
||||
conf.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||
|
||||
if (conf.getConfComprovantePassagemId() == null) {
|
||||
conf = confCompPassDAO.suscribir(conf);
|
||||
} else {
|
||||
conf = confCompPassDAO.actualizacion(conf);
|
||||
}
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void apagar(ConfComprovantePassagem empresaTroco) throws BusinessException {
|
||||
confCompPassDAO.borrar(empresaTroco);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfComprovantePassagem buscarConfComprovantePassagemPorEmpresaId(Integer empresaID) {
|
||||
return confCompPassDAO.buscarPorEmpresaId(empresaID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfComprovantePassagem buscarConfiguracao(Integer empresaID, String tipoIntegracao, String viaComprovante) {
|
||||
return confCompPassDAO.buscarConfiguracao(empresaID, tipoIntegracao, viaComprovante);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue