0017509: [BPe] GLPI 16571 - Aliquota por UF de destino
bug#0017509 dev:Valdevir qua:Debora git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@100024 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d95c3d5f6e
commit
2e264ea587
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||||
|
|
||||||
|
public interface AliquotaEstadoDestinoDAO extends GenericDAO<AliquotaEstadoDestino, Integer> {
|
||||||
|
|
||||||
|
public List<AliquotaEstadoDestino> getChildrens(EmpresaImposto parent);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.AliquotaEstadoDestinoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||||
|
|
||||||
|
@Repository("aliquotaEstadoDestinoDAO")
|
||||||
|
public class AliquotaEstadoDestinoHibernateDAO extends GenericHibernateDAO<AliquotaEstadoDestino, Integer>
|
||||||
|
implements AliquotaEstadoDestinoDAO{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AliquotaEstadoDestinoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AliquotaEstadoDestino> getChildrens(EmpresaImposto parent){
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.append(" select als from AliquotaEstadoDestino als ");
|
||||||
|
sb.append(" where als.activo = 1 ");
|
||||||
|
sb.append(" and als.empresaImposto.empresaImpostoId =:empresaImpostoId ");
|
||||||
|
sb.append(" order by als.aliquotaEstadoDestinoId ");
|
||||||
|
|
||||||
|
Query query = getSession().createQuery(sb.toString());
|
||||||
|
query.setParameter("empresaImpostoId", parent.getEmpresaImpostoId());
|
||||||
|
|
||||||
|
List<AliquotaEstadoDestino> lsAliquotaEstadoDestino = query.list();
|
||||||
|
|
||||||
|
return lsAliquotaEstadoDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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
|
||||||
|
@SequenceGenerator(name = "ALIQUOTAESTADODESTINO_SEQ", sequenceName = "ALIQUOTAESTADODESTINO_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "ALIQUOTA_ESTADO_DESTINO")
|
||||||
|
public class AliquotaEstadoDestino implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ALIQUOTAESTADODESTINO_SEQ")
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "ALIQUOTAESTADODESTINO_ID")
|
||||||
|
private Integer aliquotaEstadoDestinoId;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "ESTADO_ID")
|
||||||
|
private Estado estado;
|
||||||
|
|
||||||
|
@Column(name = "ALIQUOTA")
|
||||||
|
private BigDecimal aliquota;
|
||||||
|
|
||||||
|
@JoinColumn(name = "EMPRESAIMPOSTO_ID", referencedColumnName = "EMPRESAIMPOSTO_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private EmpresaImposto empresaImposto;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (!(object instanceof AliquotaEstadoDestino)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
AliquotaEstadoDestino other = (AliquotaEstadoDestino) object;
|
||||||
|
if ((this.getAliquotaEstadoDestinoId() == null && other.getAliquotaEstadoDestinoId() != null) || (this.getAliquotaEstadoDestinoId() != null && !this.getAliquotaEstadoDestinoId().equals(other.getAliquotaEstadoDestinoId()))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAliquotaEstadoDestinoId() {
|
||||||
|
return aliquotaEstadoDestinoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAliquotaEstadoDestinoId(Integer aliquotaEstadoDestinoId) {
|
||||||
|
this.aliquotaEstadoDestinoId = aliquotaEstadoDestinoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Estado getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(Estado estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getAliquota() {
|
||||||
|
return aliquota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAliquota(BigDecimal aliquota) {
|
||||||
|
this.aliquota = aliquota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpresaImposto getEmpresaImposto() {
|
||||||
|
return empresaImposto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaImposto(EmpresaImposto empresaImposto) {
|
||||||
|
this.empresaImposto = empresaImposto;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,9 +6,12 @@ package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -16,6 +19,7 @@ import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -53,10 +57,6 @@ public class EmpresaImposto implements Serializable {
|
||||||
@Column(name = "INDPEDAGIOESTDUAL")
|
@Column(name = "INDPEDAGIOESTDUAL")
|
||||||
private Boolean indPedadioEstdual;
|
private Boolean indPedadioEstdual;
|
||||||
|
|
||||||
@Column(name = "PORCREDMUNICIPAL")
|
|
||||||
private BigDecimal porCredMunicipal;
|
|
||||||
@Column(name = "PORCREDESTADUAL")
|
|
||||||
private BigDecimal porCredEstadual;
|
|
||||||
@Column(name = "PORCREDBASEICMS")
|
@Column(name = "PORCREDBASEICMS")
|
||||||
private BigDecimal porCredBaseIcms;
|
private BigDecimal porCredBaseIcms;
|
||||||
@Column(name = "PORCREDBASEICMSIM")
|
@Column(name = "PORCREDBASEICMSIM")
|
||||||
|
@ -151,15 +151,22 @@ public class EmpresaImposto implements Serializable {
|
||||||
|
|
||||||
@Column(name = "INDREDBASEICMSBPE")
|
@Column(name = "INDREDBASEICMSBPE")
|
||||||
private Boolean indRedutorBaseIcmsBPe;
|
private Boolean indRedutorBaseIcmsBPe;
|
||||||
|
|
||||||
@Column(name = "INDTRIBEMISSAO")
|
@Column(name = "INDALIQUOTABPEUFDESTINO")
|
||||||
private Boolean indTribEmissao;
|
private Boolean indAliquotaBPeUfDestino;
|
||||||
|
|
||||||
@Column(name = "INDTRIBVIAGEM")
|
@Column(name = "INDTRIBVIAGEM")
|
||||||
private Boolean indTribViagem;
|
private Boolean indTribViagem;
|
||||||
|
|
||||||
@Column(name = "PORCFECP")
|
@Column(name = "PORCFECP")
|
||||||
private BigDecimal porcFECP;
|
private BigDecimal porcFECP;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "empresaImposto", cascade = CascadeType.ALL, orphanRemoval=true)
|
||||||
|
private List<AliquotaEstadoDestino> lsAliquotaEstadoDestino;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public EmpresaImposto() {
|
public EmpresaImposto() {
|
||||||
super();
|
super();
|
||||||
|
@ -187,8 +194,9 @@ public class EmpresaImposto implements Serializable {
|
||||||
this.indOutrasUFBloqueadas = false;
|
this.indOutrasUFBloqueadas = false;
|
||||||
this.isBPe = false;
|
this.isBPe = false;
|
||||||
this.indRedutorBaseIcmsBPe = false;
|
this.indRedutorBaseIcmsBPe = false;
|
||||||
this.indTribEmissao = false;
|
this.indAliquotaBPeUfDestino = false;
|
||||||
this.indTribViagem = false;
|
this.indTribViagem = false;
|
||||||
|
this.lsAliquotaEstadoDestino = new ArrayList<AliquotaEstadoDestino>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,35 +349,6 @@ public class EmpresaImposto implements Serializable {
|
||||||
this.indPedadioEstdual = indPedadioEstdual;
|
this.indPedadioEstdual = indPedadioEstdual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the porCredMunicipal
|
|
||||||
*/
|
|
||||||
public BigDecimal getPorCredMunicipal() {
|
|
||||||
return porCredMunicipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param porCredMunicipal
|
|
||||||
* the porCredMunicipal to set
|
|
||||||
*/
|
|
||||||
public void setPorCredMunicipal(BigDecimal porCredMunicipal) {
|
|
||||||
this.porCredMunicipal = porCredMunicipal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the porCredEstadual
|
|
||||||
*/
|
|
||||||
public BigDecimal getPorCredEstadual() {
|
|
||||||
return porCredEstadual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param porCredEstadual
|
|
||||||
* the porCredEstadual to set
|
|
||||||
*/
|
|
||||||
public void setPorCredEstadual(BigDecimal porCredEstadual) {
|
|
||||||
this.porCredEstadual = porCredEstadual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the porCredBaseIcms
|
* @return the porCredBaseIcms
|
||||||
|
@ -800,13 +779,6 @@ public class EmpresaImposto implements Serializable {
|
||||||
this.indRedutorBaseIcmsBPe = indRedutorBaseIcmsBPe;
|
this.indRedutorBaseIcmsBPe = indRedutorBaseIcmsBPe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIndTribEmissao() {
|
|
||||||
return indTribEmissao;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndTribEmissao(Boolean indTribEmissao) {
|
|
||||||
this.indTribEmissao = indTribEmissao;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIndTribViagem() {
|
public Boolean getIndTribViagem() {
|
||||||
return indTribViagem;
|
return indTribViagem;
|
||||||
|
@ -831,4 +803,20 @@ public class EmpresaImposto implements Serializable {
|
||||||
public void setPorcFECP(BigDecimal porcFECP) {
|
public void setPorcFECP(BigDecimal porcFECP) {
|
||||||
this.porcFECP = porcFECP;
|
this.porcFECP = porcFECP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIndAliquotaBPeUfDestino() {
|
||||||
|
return indAliquotaBPeUfDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndAliquotaBPeUfDestino(Boolean indAliquotaBPeUfDestino) {
|
||||||
|
this.indAliquotaBPeUfDestino = indAliquotaBPeUfDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AliquotaEstadoDestino> getLsAliquotaEstadoDestino() {
|
||||||
|
return lsAliquotaEstadoDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsAliquotaEstadoDestino(List<AliquotaEstadoDestino> lsAliquotaEstadoDestino) {
|
||||||
|
this.lsAliquotaEstadoDestino = lsAliquotaEstadoDestino;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||||
|
|
||||||
|
public interface AliquotaEstadoDestinoService {
|
||||||
|
|
||||||
|
public AliquotaEstadoDestino suscribir(AliquotaEstadoDestino entidad);
|
||||||
|
|
||||||
|
public List<AliquotaEstadoDestino> getChildrens(EmpresaImposto parent);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
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.AliquotaEstadoDestinoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||||
|
import com.rjconsultores.ventaboletos.service.AliquotaEstadoDestinoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("aliquotaEstadoDestinoService")
|
||||||
|
public class AliquotaEstadoDestinoServiceImpl implements AliquotaEstadoDestinoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AliquotaEstadoDestinoDAO aliquotaEstadoDestinoDAO;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public AliquotaEstadoDestino suscribir(AliquotaEstadoDestino entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
entidad = aliquotaEstadoDestinoDAO.suscribir(entidad);
|
||||||
|
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AliquotaEstadoDestino> getChildrens(EmpresaImposto parent){
|
||||||
|
return aliquotaEstadoDestinoDAO.getChildrens(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue