Lista de Contas Bancárias no cadastro da empresa.
Cadastro da conta bancária utilizada para cada empresa do punto venta. fixes bug 6745 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@49076 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c0d955dbb0
commit
eb833fb9a6
|
@ -3,11 +3,13 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria;
|
||||
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
|
||||
|
||||
public interface InstiFinanceiraDAO extends GenericDAO<InstiFinanceira, Integer> {
|
||||
|
||||
public List<InstiFinanceira> buscar(String nome);
|
||||
|
||||
public List<EmpresaContaBancaria> buscarContasBancariasPorIdEmpresa(Integer empresaId);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
@ -12,6 +11,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria;
|
||||
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
|
||||
|
||||
@Repository("ptovtaBancoDAO")
|
||||
|
@ -28,20 +28,28 @@ public class InstiFinanceiraHibernateDAO extends GenericHibernateDAO<InstiFinanc
|
|||
public List<InstiFinanceira> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.addOrder(Order.asc("nome"));
|
||||
|
||||
c.addOrder(Order.asc("nome"));
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<InstiFinanceira> buscar(String nome) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("nome", nome));
|
||||
|
||||
|
||||
c.add(Restrictions.eq("nome", nome));
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmpresaContaBancaria> buscarContasBancariasPorIdEmpresa(Integer empresaId) {
|
||||
|
||||
Criteria c = getSession().createCriteria(EmpresaContaBancaria.class);
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("empresa.empresaId", empresaId));
|
||||
|
||||
List<EmpresaContaBancaria> empresasContaBancarias = (List<EmpresaContaBancaria>) c.list();
|
||||
return empresasContaBancarias;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,9 @@ public class Empresa implements Serializable {
|
|||
@OneToMany(mappedBy = "empresa")
|
||||
private List<InscricaoEstadual> inscricoesEstaduais;
|
||||
|
||||
@OneToMany(mappedBy = "empresa", cascade = CascadeType.ALL)
|
||||
private List<EmpresaContaBancaria> empresaContaBancaria;
|
||||
|
||||
public Empresa() {
|
||||
super();
|
||||
}
|
||||
|
@ -358,4 +361,21 @@ public class Empresa implements Serializable {
|
|||
this.numtelefono = numtelefono;
|
||||
}
|
||||
|
||||
}
|
||||
public List<EmpresaContaBancaria> getEmpresaContaBancaria() {
|
||||
|
||||
List<EmpresaContaBancaria> tempList = new ArrayList<EmpresaContaBancaria>();
|
||||
|
||||
if (empresaContaBancaria != null) {
|
||||
for (EmpresaContaBancaria empContaBancaria : this.empresaContaBancaria) {
|
||||
if (empContaBancaria.getActivo()) {
|
||||
tempList.add(empContaBancaria);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempList;
|
||||
}
|
||||
|
||||
public void setEmpresaContaBancaria(List<EmpresaContaBancaria> empresaContaBancaria) {
|
||||
this.empresaContaBancaria = empresaContaBancaria;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
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.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name="EMPRESA_CONTABANCARIA_SEQ", sequenceName="EMPRESA_CONTABANCARIA_SEQ", allocationSize=1)
|
||||
@Table(name="EMPRESA_CONTABANCARIA")
|
||||
public class EmpresaContaBancaria implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer empresaContaBancariaId;
|
||||
private Empresa empresa;
|
||||
private InstiFinanceira instituicaoFinandeira;
|
||||
private String numConta;
|
||||
private String numAgencia;
|
||||
private Boolean activo;
|
||||
private Date fecmodif;
|
||||
private Integer usuarioId;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_CONTABANCARIA_SEQ")
|
||||
@Column(name = "EMPRESACONTABANCARIA_ID")
|
||||
public Integer getEmpresaContaBancariaId() {
|
||||
return empresaContaBancariaId;
|
||||
}
|
||||
|
||||
public void setEmpresaContaBancariaId(Integer empresaContaBancariaId) {
|
||||
this.empresaContaBancariaId = empresaContaBancariaId;
|
||||
}
|
||||
|
||||
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
@JoinColumn(name = "INSTIFINANCEIRA_ID", referencedColumnName = "INSTIFINANCEIRA_ID")
|
||||
@ManyToOne
|
||||
public InstiFinanceira getInstituicaoFinandeira() {
|
||||
return instituicaoFinandeira;
|
||||
}
|
||||
|
||||
public void setInstituicaoFinandeira(InstiFinanceira instituicaoFinandeira) {
|
||||
this.instituicaoFinandeira = instituicaoFinandeira;
|
||||
}
|
||||
|
||||
@Column(name = "NUMCONTA")
|
||||
public String getNumConta() {
|
||||
return numConta;
|
||||
}
|
||||
|
||||
public void setNumConta(String numConta) {
|
||||
this.numConta = numConta;
|
||||
}
|
||||
|
||||
@Column(name = "NUMAGENCIA")
|
||||
public String getNumAgencia() {
|
||||
return numAgencia;
|
||||
}
|
||||
|
||||
public void setNumAgencia(String numAgencia) {
|
||||
this.numAgencia = numAgencia;
|
||||
}
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object old) {
|
||||
|
||||
if (!(old instanceof EmpresaContaBancaria)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EmpresaContaBancaria oldObject = (EmpresaContaBancaria) old;
|
||||
if(this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId != null) || (this.empresaContaBancariaId != null && !this.empresaContaBancariaId.equals(oldObject.empresaContaBancariaId))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getNumConta() + " - " + getNumAgencia() + " - " + getInstituicaoFinandeira().getNome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (empresaContaBancariaId != null ? empresaContaBancariaId.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
|
@ -29,32 +29,43 @@ import javax.persistence.TemporalType;
|
|||
public class PtovtaEmpresa implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EMPRESA_SEQ")
|
||||
@Column(name = "PTOVTAEMPRESA_ID")
|
||||
private Integer ptovtaempresaId;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne
|
||||
private Empresa empresa;
|
||||
|
||||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||
@ManyToOne
|
||||
private PuntoVenta puntoVenta;
|
||||
|
||||
@Column(name = "INDTERCEIRIZADA")
|
||||
private Boolean indTerceirizada;
|
||||
|
||||
@Column(name = "INDBLOQUEADA")
|
||||
private Boolean indBloqueada;
|
||||
|
||||
@Column(name = "NUMSITEF")
|
||||
private String numeroSitef;
|
||||
|
||||
@JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID")
|
||||
@ManyToOne
|
||||
private EmpresaContaBancaria empresaContaBancaria;
|
||||
|
||||
public PtovtaEmpresa() {
|
||||
}
|
||||
|
@ -109,9 +120,17 @@ public class PtovtaEmpresa implements Serializable {
|
|||
|
||||
public void setPuntoVenta(PuntoVenta puntoVenta) {
|
||||
this.puntoVenta = puntoVenta;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmpresaContaBancaria getEmpresaContaBancaria() {
|
||||
return empresaContaBancaria;
|
||||
}
|
||||
|
||||
public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) {
|
||||
this.empresaContaBancaria = empresaContaBancaria;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (ptovtaempresaId != null ? ptovtaempresaId.hashCode() : 0);
|
||||
|
@ -166,6 +185,5 @@ public class PtovtaEmpresa implements Serializable {
|
|||
|
||||
public void setNumeroSitef(String numeroSitef) {
|
||||
this.numeroSitef = numeroSitef;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,10 +6,11 @@ package com.rjconsultores.ventaboletos.service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria;
|
||||
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
|
||||
|
||||
public interface InstiFinanceiraService {
|
||||
|
||||
public List<InstiFinanceira> obtenerTodos();
|
||||
|
||||
public List<EmpresaContaBancaria> buscarContasBancariasPorIdEmpresa(Integer empresaId);
|
||||
}
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria;
|
||||
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
|
||||
import com.rjconsultores.ventaboletos.service.InstiFinanceiraService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -64,5 +66,10 @@ public class InstiFinanceiraServiceImpl implements InstiFinanceiraService {
|
|||
return ptovtaBancoDAO.buscar(nome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmpresaContaBancaria> buscarContasBancariasPorIdEmpresa(Integer empresaId) {
|
||||
return ptovtaBancoDAO.buscarContasBancariasPorIdEmpresa(empresaId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue