Gerar lançamento comissão no conta corrente da agência (issue 8900)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@69286 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
dea88b5a1d
commit
32d7ff9520
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
public interface PtovtaEmpresaContaBancariaDAO extends GenericDAO<PtovtaEmpresaContaBancaria, Integer> {
|
||||
public void borrarFisico(PtovtaEmpresaContaBancaria pto);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
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.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.PtovtaEmpresaContaBancariaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
@Repository("ptovtaEmpresaContaBancariaHibernateDAO")
|
||||
public class PtovtaEmpresaContaBancariaHibernateDAO extends GenericHibernateDAO<PtovtaEmpresaContaBancaria, Integer> implements PtovtaEmpresaContaBancariaDAO {
|
||||
@Autowired
|
||||
public PtovtaEmpresaContaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PtovtaEmpresaContaBancaria> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public void borrarFisico(PtovtaEmpresaContaBancaria pto) {
|
||||
String hql = " delete from PtovtaEmpresaContaBancaria "
|
||||
+ " where ptovtaEmpresaContaBancariaId = " + pto.getPtovtaEmpresaContaBancariaId();
|
||||
Query sq = getSession().createQuery(hql);
|
||||
sq.executeUpdate();
|
||||
}
|
||||
}
|
|
@ -5,19 +5,26 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,13 +73,20 @@ public class PtovtaEmpresa implements Serializable {
|
|||
@Column(name = "NUMSITEF")
|
||||
private String numeroSitef;
|
||||
|
||||
@JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID")
|
||||
@ManyToOne
|
||||
private EmpresaContaBancaria empresaContaBancaria;
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID")
|
||||
private List<PtovtaEmpresaContaBancaria> lsPtovtaEmpresaContaBancaria;
|
||||
|
||||
// @JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID")
|
||||
// @ManyToOne
|
||||
// private EmpresaContaBancaria empresaContaBancaria;
|
||||
|
||||
@Column(name = "INDIMPCOMPCARTAO")
|
||||
private Boolean indImpCompCartao;
|
||||
|
||||
@Transient
|
||||
private List<EmpresaContaBancaria> contasBancaria;
|
||||
|
||||
public PtovtaEmpresa() {
|
||||
}
|
||||
|
||||
|
@ -128,43 +142,13 @@ public class PtovtaEmpresa implements Serializable {
|
|||
this.puntoVenta = puntoVenta;
|
||||
}
|
||||
|
||||
public EmpresaContaBancaria getEmpresaContaBancaria() {
|
||||
return empresaContaBancaria;
|
||||
}
|
||||
|
||||
public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) {
|
||||
this.empresaContaBancaria = empresaContaBancaria;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((ptovtaempresaId == null) ? 0 : ptovtaempresaId.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;
|
||||
PtovtaEmpresa other = (PtovtaEmpresa) obj;
|
||||
if (ptovtaempresaId == null) {
|
||||
if (other.ptovtaempresaId != null)
|
||||
return false;
|
||||
} else if (!ptovtaempresaId.equals(other.ptovtaempresaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa[ptovtaempresaId=" + ptovtaempresaId + "]";
|
||||
}
|
||||
// public EmpresaContaBancaria getEmpresaContaBancaria() {
|
||||
// return empresaContaBancaria;
|
||||
// }
|
||||
//
|
||||
// public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) {
|
||||
// this.empresaContaBancaria = empresaContaBancaria;
|
||||
// }
|
||||
|
||||
public Boolean getIndTerceirizada() {
|
||||
return indTerceirizada;
|
||||
|
@ -212,4 +196,75 @@ public class PtovtaEmpresa implements Serializable {
|
|||
this.indImpCompCartao = indImpCompCartao;
|
||||
}
|
||||
|
||||
public List<PtovtaEmpresaContaBancaria> getLsPtovtaEmpresaContaBancaria() {
|
||||
if (lsPtovtaEmpresaContaBancaria == null) {
|
||||
lsPtovtaEmpresaContaBancaria = new ArrayList<PtovtaEmpresaContaBancaria>(0);
|
||||
}
|
||||
|
||||
return lsPtovtaEmpresaContaBancaria;
|
||||
}
|
||||
|
||||
public void setLsPtovtaEmpresaContaBancaria(List<PtovtaEmpresaContaBancaria> lsPtovtaEmpresaContaBancaria) {
|
||||
this.lsPtovtaEmpresaContaBancaria = lsPtovtaEmpresaContaBancaria;
|
||||
}
|
||||
|
||||
public List<EmpresaContaBancaria> getContasBancaria() {
|
||||
if (contasBancaria == null) {
|
||||
contasBancaria = new ArrayList<EmpresaContaBancaria>(0);
|
||||
}
|
||||
|
||||
return contasBancaria;
|
||||
}
|
||||
|
||||
public void setContasBancaria(List<EmpresaContaBancaria> contasBancaria) {
|
||||
this.contasBancaria = contasBancaria;
|
||||
}
|
||||
|
||||
public String getContasBancariaInfo() {
|
||||
if (!getContasBancaria().isEmpty()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (EmpresaContaBancaria ecb : getContasBancaria()) {
|
||||
if (!sb.toString().isEmpty()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
|
||||
sb.append(ecb.getInstituicaoFinandeira().getNome());
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((ptovtaempresaId == null) ? 0 : ptovtaempresaId.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;
|
||||
PtovtaEmpresa other = (PtovtaEmpresa) obj;
|
||||
if (ptovtaempresaId == null) {
|
||||
if (other.ptovtaempresaId != null)
|
||||
return false;
|
||||
} else if (!ptovtaempresaId.equals(other.ptovtaempresaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa[ptovtaempresaId=" + ptovtaempresaId + "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "PTOVTAEMPCONBAN_SEQ", sequenceName = "PTOVTAEMPCONBAN_SEQ", allocationSize = 1)
|
||||
@Table(name = "PTOVTA_EMPRESA_CONTABANCARIA")
|
||||
public class PtovtaEmpresaContaBancaria implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTAEMPCONBAN_SEQ")
|
||||
@Column(name = "PTOVTAEMPRESACONTABANCARIA_ID")
|
||||
private Integer ptovtaEmpresaContaBancariaId;
|
||||
|
||||
@JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID")
|
||||
@ManyToOne
|
||||
private PtovtaEmpresa ptovtaEmpresa;
|
||||
|
||||
@JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID")
|
||||
@ManyToOne
|
||||
private EmpresaContaBancaria empresaContaBancaria;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public PtovtaEmpresaContaBancaria() {
|
||||
}
|
||||
|
||||
public Integer getPtovtaEmpresaContaBancariaId() {
|
||||
return ptovtaEmpresaContaBancariaId;
|
||||
}
|
||||
|
||||
public void setPtovtaEmpresaContaBancariaId(Integer ptovtaEmpresaContaBancariaId) {
|
||||
this.ptovtaEmpresaContaBancariaId = ptovtaEmpresaContaBancariaId;
|
||||
}
|
||||
|
||||
public PtovtaEmpresa getPtovtaEmpresa() {
|
||||
return ptovtaEmpresa;
|
||||
}
|
||||
|
||||
public void setPtovtaEmpresa(PtovtaEmpresa ptovtaEmpresa) {
|
||||
this.ptovtaEmpresa = ptovtaEmpresa;
|
||||
}
|
||||
|
||||
public EmpresaContaBancaria getEmpresaContaBancaria() {
|
||||
return empresaContaBancaria;
|
||||
}
|
||||
|
||||
public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) {
|
||||
this.empresaContaBancaria = empresaContaBancaria;
|
||||
}
|
||||
|
||||
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 + ((ptovtaEmpresaContaBancariaId == null) ? 0 : ptovtaEmpresaContaBancariaId.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;
|
||||
PtovtaEmpresaContaBancaria other = (PtovtaEmpresaContaBancaria) obj;
|
||||
if (ptovtaEmpresaContaBancariaId == null) {
|
||||
if (other.ptovtaEmpresaContaBancariaId != null)
|
||||
return false;
|
||||
} else if (!ptovtaEmpresaContaBancariaId.equals(other.ptovtaEmpresaContaBancariaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria[ptovtaEmpresaContaBancariaId=" + ptovtaEmpresaContaBancariaId + "]";
|
||||
}
|
||||
}
|
|
@ -460,14 +460,23 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
public List<PtovtaEmpresa> getLsPtovtaEmpresa() {
|
||||
List<PtovtaEmpresa> tmp = new ArrayList<PtovtaEmpresa>();
|
||||
|
||||
if (this.lsPtovtaEmpresa != null) {
|
||||
for (PtovtaEmpresa ddab : this.lsPtovtaEmpresa) {
|
||||
if (ddab.getActivo()) {
|
||||
ddab.getContasBancaria().clear();
|
||||
|
||||
for (PtovtaEmpresaContaBancaria cb : ddab.getLsPtovtaEmpresaContaBancaria()) {
|
||||
ddab.getContasBancaria().add(cb.getEmpresaContaBancaria());
|
||||
}
|
||||
|
||||
tmp.add(ddab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lsPtovtaEmpresa = tmp;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
public interface PtovtaEmpresaContaBancariaService extends GenericService<PtovtaEmpresaContaBancaria, Integer> {
|
||||
public void borrarFisico(PtovtaEmpresaContaBancaria pto);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
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.PtovtaEmpresaContaBancariaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria;
|
||||
import com.rjconsultores.ventaboletos.service.PtovtaEmpresaContaBancariaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
@Service("ptovtaEmpresaContaBancariaService")
|
||||
public class PtovtaEmpresaContaBancariaServiceImpl implements PtovtaEmpresaContaBancariaService {
|
||||
|
||||
@Autowired
|
||||
private PtovtaEmpresaContaBancariaDAO ptovtaEmpresaContaBancariaDAO;
|
||||
|
||||
public List<PtovtaEmpresaContaBancaria> obtenerTodos() {
|
||||
return ptovtaEmpresaContaBancariaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public PtovtaEmpresaContaBancaria obtenerID(Integer id) {
|
||||
return ptovtaEmpresaContaBancariaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public PtovtaEmpresaContaBancaria suscribir(PtovtaEmpresaContaBancaria entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return ptovtaEmpresaContaBancariaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public PtovtaEmpresaContaBancaria actualizacion(PtovtaEmpresaContaBancaria entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return ptovtaEmpresaContaBancariaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(PtovtaEmpresaContaBancaria entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
ptovtaEmpresaContaBancariaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public void borrarFisico(PtovtaEmpresaContaBancaria pto) {
|
||||
ptovtaEmpresaContaBancariaDAO.borrarFisico(pto);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue