Merge pull request 'AL-4273 nova tela comprovante de passagem' (!221) from AL-4273 into master

Reviewed-on: adm/ModelWeb#221
Reviewed-by: fabio <fabio.faria@rjconsultores.com.br>
master
fabio 2024-07-09 11:37:10 +00:00
commit 15982a8440
7 changed files with 293 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ModelWeb</artifactId> <artifactId>ModelWeb</artifactId>
<version>1.77.1</version> <version>1.77.2</version>
<distributionManagement> <distributionManagement>
<repository> <repository>

View File

@ -0,0 +1,13 @@
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.EmpresaComprovantePassagemConfig;
public interface EmpresaComprovantePassagemConfigDAO extends GenericDAO<EmpresaComprovantePassagemConfig, Integer> {
public EmpresaComprovantePassagemConfig buscarChave(String chave, Integer empresaId);
public List<EmpresaComprovantePassagemConfig> buscarByEmpresa(Integer empresaId);
}

View File

@ -0,0 +1,50 @@
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.EmpresaComprovantePassagemConfigDAO;
import com.rjconsultores.ventaboletos.entidad.EmpresaComprovantePassagemConfig;
@Repository("empresaComprovantePassagemConfigDAO")
public class EmpresaComprovantePassagemConfigHibernateDAO extends
GenericHibernateDAO<EmpresaComprovantePassagemConfig, Integer> implements EmpresaComprovantePassagemConfigDAO {
@Autowired
public EmpresaComprovantePassagemConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<EmpresaComprovantePassagemConfig> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
public EmpresaComprovantePassagemConfig buscarChave(String chave, Integer empresaId) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("chave", chave));
c.add(Restrictions.eq("empresa.empresaId", empresaId));
return (EmpresaComprovantePassagemConfig) c.uniqueResult();
}
public List<EmpresaComprovantePassagemConfig> buscarByEmpresa(Integer empresaId) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("empresa.empresaId", empresaId));
return c.list();
}
}

View File

@ -0,0 +1,139 @@
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;
@Entity
@SequenceGenerator(name = "EMPRESA_COMPPASSAG_CONFIG_SEQ", sequenceName = "EMPRESA_COMPPASSAG_CONFIG_SEQ", allocationSize = 1)
@Table(name = "EMPRESA_COMPPASSAGEM_CONFIG")
public class EmpresaComprovantePassagemConfig implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_COMPPASSAG_CONFIG_SEQ")
@Column(name = "EMPRESACOMPPASSAGEMCONFIG_ID")
private Integer empresaComprovantePassagemConfigId;
@OneToOne
@JoinColumn(name = "EMPRESA_ID")
private Empresa empresa;
@Column(name = "CHAVE")
private String chave;
@Column(name = "VALOR")
private String valor;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
public EmpresaComprovantePassagemConfig() {
}
public Integer getEmpresaComprovantePassagemConfigId() {
return empresaComprovantePassagemConfigId;
}
public void setEmpresaComprovantePassagemConfigId(Integer empresaComprovantePassagemConfigId) {
this.empresaComprovantePassagemConfigId = empresaComprovantePassagemConfigId;
}
public Empresa getEmpresa() {
return empresa;
}
public void setEmpresa(Empresa empresa) {
this.empresa = empresa;
}
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;
}
public String getChave() {
return chave;
}
public void setChave(String chave) {
this.chave = chave;
}
public String getValor() {
return valor;
}
public void setValor(String valor) {
this.valor = valor;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((empresaComprovantePassagemConfigId == null) ? 0 : empresaComprovantePassagemConfigId.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;
EmpresaComprovantePassagemConfig other = (EmpresaComprovantePassagemConfig) obj;
if (empresaComprovantePassagemConfigId == null) {
if (other.empresaComprovantePassagemConfigId != null)
return false;
} else if (!empresaComprovantePassagemConfigId.equals(other.empresaComprovantePassagemConfigId))
return false;
return true;
}
@Override
public String toString() {
return String.valueOf(this.getEmpresaComprovantePassagemConfigId());
}
}

View File

@ -0,0 +1,11 @@
package com.rjconsultores.ventaboletos.enums;
public enum EnumTipoIntegracao {
INFOBIT,;
private EnumTipoIntegracao() {
}
}

View File

@ -0,0 +1,14 @@
package com.rjconsultores.ventaboletos.service;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.EmpresaComprovantePassagemConfig;
public interface EmpresaComprovantePassagemConfigService
extends GenericService<EmpresaComprovantePassagemConfig, Integer> {
public EmpresaComprovantePassagemConfig buscarChave(String chave, Integer empresaId);
public List<EmpresaComprovantePassagemConfig> buscarByEmpresa(Integer empresaId);
}

View File

@ -0,0 +1,65 @@
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.EmpresaComprovantePassagemConfigDAO;
import com.rjconsultores.ventaboletos.entidad.EmpresaComprovantePassagemConfig;
import com.rjconsultores.ventaboletos.service.EmpresaComprovantePassagemConfigService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("empresaComprovantePassagemConfigService")
public class EmpresaComprovantePassagemConfigServiceImpl implements EmpresaComprovantePassagemConfigService {
@Autowired
private EmpresaComprovantePassagemConfigDAO empresaComprovantePassagemConfigDAO;
public List<EmpresaComprovantePassagemConfig> obtenerTodos() {
return empresaComprovantePassagemConfigDAO.obtenerTodos();
}
public EmpresaComprovantePassagemConfig obtenerID(Integer id) {
return empresaComprovantePassagemConfigDAO.obtenerID(id);
}
@Transactional
public EmpresaComprovantePassagemConfig suscribir(EmpresaComprovantePassagemConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaComprovantePassagemConfigDAO.suscribir(entidad);
}
@Transactional
public EmpresaComprovantePassagemConfig actualizacion(EmpresaComprovantePassagemConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaComprovantePassagemConfigDAO.actualizacion(entidad);
}
@Transactional
public void borrar(EmpresaComprovantePassagemConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
empresaComprovantePassagemConfigDAO.actualizacion(entidad);
}
public EmpresaComprovantePassagemConfig buscarChave(String chave, Integer empresaId) {
return empresaComprovantePassagemConfigDAO.buscarChave(chave, empresaId);
}
public List<EmpresaComprovantePassagemConfig> buscarByEmpresa(Integer empresaId) {
return empresaComprovantePassagemConfigDAO.buscarByEmpresa(empresaId);
}
}