diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java new file mode 100644 index 000000000..f9bc1ff86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java @@ -0,0 +1,20 @@ +/* +// * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface EmpresaImpostoDAO extends GenericDAO { + public List buscarByEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java index 896542ece..829de53c9 100644 --- a/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.Pais; import java.util.List; @@ -15,4 +16,6 @@ import java.util.List; public interface EstadoDAO extends GenericDAO { public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java new file mode 100644 index 000000000..d04f9c0e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * 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.SessionFactory; +import org.hibernate.criterion.Order; +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.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Repository("empresaImpostoDAO") +public class EmpresaImpostoHibernateDAO extends GenericHibernateDAO + implements EmpresaImpostoDAO { + + @Autowired + public EmpresaImpostoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarByEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + c.addOrder(Order.asc("estado")); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java index a8110bfb1..f207e72f8 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java @@ -5,10 +5,13 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.Pais; + 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; @@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; + /** * * @author MCosso @@ -46,4 +50,28 @@ public class EstadoHibernateDAO extends GenericHibernateDAO return c.list(); } + + + public List buscarNotInEmpresaImposto(Empresa empresa) { + StringBuilder sb = new StringBuilder(); + + sb.append(" select es "); + sb.append(" from Estado es "); + sb.append(" where es.activo = 1 "); + sb.append(" and es.estadoId not in ( "); + sb.append(" select ei.estado.estadoId from EmpresaImposto ei "); + sb.append(" where ei.activo = 1 and ei.empresa.empresaId =:empresaId "); + sb.append(" )"); + sb.append(" order by es.nombestado"); + + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("empresaId", empresa.getEmpresaId()); + + List lsEstado = query.list(); + + + return lsEstado; + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java index 92417c9bb..0556a407b 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -7,7 +7,6 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.util.Date; import java.util.List; - import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -23,6 +22,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; + /** * * @author Rafius @@ -81,6 +81,8 @@ public class Empresa implements Serializable { @OneToOne(cascade = CascadeType.MERGE) @JoinColumn(name = "CIUDAD_ID") private Ciudad cidade; + @OneToMany(mappedBy = "empresa") + private List empresaImpostoList; public Empresa() { } @@ -285,4 +287,13 @@ public class Empresa implements Serializable { public void setCorridaList1(List corridaList1) { this.corridaList1 = corridaList1; } + + public List getEmpresaImpostoList() { + + return this.empresaImpostoList; + } + + public void setEmpresaImpostoList(List empresaImpostoList) { + this.empresaImpostoList = empresaImpostoList; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java new file mode 100644 index 000000000..3f39d26b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -0,0 +1,595 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +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.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_IMPOSTO") +public class EmpresaImposto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_IMPOSTO_SEQ") + @Column(name = "EMPRESAIMPOSTO_ID") + private Integer empresaImpostoId; + + @Column(name = "ICMS") + private BigDecimal icms; + + @Column(name = "INDTARIFAMUNICIPAL") + private Boolean indTarifaMunicipal; + @Column(name = "INDSEGUROMUNICIPAL") + private Boolean indSeguroMunicipal; + @Column(name = "INDTXEMBARQUEMUNICIPAL") + private Boolean indTxEmbarqueMunicipal; + @Column(name = "INDPEDAGIOMUNICIPAL") + private Boolean indPedagioMunicipal; + @Column(name = "INDTARIFAESTADUAL") + private Boolean indTarifaEstadual; + @Column(name = "INDSEGUROESTADUAL") + private Boolean indSeguroEstadual; + @Column(name = "INDTXEMBARQUEESTADUAL") + private Boolean indTxEmbarqueEstadual; + @Column(name = "INDPEDAGIOESTDUAL") + private Boolean indPedadioEstdual; + + @Column(name = "PORCREDMUNICIPAL") + private BigDecimal porCredMunicipal; + @Column(name = "PORCREDESTADUAL") + private BigDecimal porCredEstadual; + @Column(name = "PORCREDBASEICMS") + private BigDecimal porCredBaseIcms; + + @Column(name = "INDJANEIRO") + private Boolean indJaneiro; + @Column(name = "INDFEVEREIRO") + private Boolean indFevereiro; + @Column(name = "INDMARCO") + private Boolean indMarco; + @Column(name = "INDABRIL") + private Boolean indAbril; + @Column(name = "INDMAIO") + private Boolean indMaio; + @Column(name = "INDJUNHO") + private Boolean indJunho; + @Column(name = "INDJULHO") + private Boolean indJulho; + @Column(name = "INDAGOSTO") + private Boolean indAgosto; + @Column(name = "INDSETEMBRO") + private Boolean indSetembro; + @Column(name = "INDOUTUBRO") + private Boolean indOutubro; + @Column(name = "INDNOVEMBRO") + private Boolean indNovembro; + @Column(name = "INDDEZEMBRO") + private Boolean indDezembro; + + @Column(name = "INDOUTROSISENTO") + private Boolean indOutrosIsento; + + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @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 = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + + public EmpresaImposto() { + } + + /** + * @return the empresaImpostoId + */ + public Integer getEmpresaImpostoId() { + return empresaImpostoId; + } + + /** + * @param empresaImpostoId + * the empresaImpostoId to set + */ + public void setEmpresaImpostoId(Integer empresaImpostoId) { + this.empresaImpostoId = empresaImpostoId; + } + + /** + * @return the icms + */ + public BigDecimal getIcms() { + return icms; + } + + /** + * @param icms + * the icms to set + */ + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + /** + * @return the indTarifaMunicipal + */ + public Boolean getIndTarifaMunicipal() { + return indTarifaMunicipal; + } + + /** + * @param indTarifaMunicipal + * the indTarifaMunicipal to set + */ + public void setIndTarifaMunicipal(Boolean indTarifaMunicipal) { + this.indTarifaMunicipal = indTarifaMunicipal; + } + + /** + * @return the indSeguroMunicipal + */ + public Boolean getIndSeguroMunicipal() { + return indSeguroMunicipal; + } + + /** + * @param indSeguroMunicipal + * the indSeguroMunicipal to set + */ + public void setIndSeguroMunicipal(Boolean indSeguroMunicipal) { + this.indSeguroMunicipal = indSeguroMunicipal; + } + + /** + * @return the indTxEmbarqueMunicipal + */ + public Boolean getIndTxEmbarqueMunicipal() { + return indTxEmbarqueMunicipal; + } + + /** + * @param indTxEmbarqueMunicipal + * the indTxEmbarqueMunicipal to set + */ + public void setIndTxEmbarqueMunicipal(Boolean indTxEmbarqueMunicipal) { + this.indTxEmbarqueMunicipal = indTxEmbarqueMunicipal; + } + + /** + * @return the indPedagioMunicipal + */ + public Boolean getIndPedagioMunicipal() { + return indPedagioMunicipal; + } + + /** + * @param indPedagioMunicipal + * the indPedagioMunicipal to set + */ + public void setIndPedagioMunicipal(Boolean indPedagioMunicipal) { + this.indPedagioMunicipal = indPedagioMunicipal; + } + + /** + * @return the indTarifaEstadual + */ + public Boolean getIndTarifaEstadual() { + return indTarifaEstadual; + } + + /** + * @param indTarifaEstadual + * the indTarifaEstadual to set + */ + public void setIndTarifaEstadual(Boolean indTarifaEstadual) { + this.indTarifaEstadual = indTarifaEstadual; + } + + /** + * @return the indSeguroEstadual + */ + public Boolean getIndSeguroEstadual() { + return indSeguroEstadual; + } + + /** + * @param indSeguroEstadual + * the indSeguroEstadual to set + */ + public void setIndSeguroEstadual(Boolean indSeguroEstadual) { + this.indSeguroEstadual = indSeguroEstadual; + } + + /** + * @return the indTxEmbarqueEstadual + */ + public Boolean getIndTxEmbarqueEstadual() { + return indTxEmbarqueEstadual; + } + + /** + * @param indTxEmbarqueEstadual + * the indTxEmbarqueEstadual to set + */ + public void setIndTxEmbarqueEstadual(Boolean indTxEmbarqueEstadual) { + this.indTxEmbarqueEstadual = indTxEmbarqueEstadual; + } + + /** + * @return the indPedadioEstdual + */ + public Boolean getIndPedadioEstdual() { + return indPedadioEstdual; + } + + /** + * @param indPedadioEstdual + * the indPedadioEstdual to set + */ + public void setIndPedadioEstdual(Boolean 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 + */ + public BigDecimal getPorCredBaseIcms() { + return porCredBaseIcms; + } + + /** + * @param porCredBaseIcms + * the porCredBaseIcms to set + */ + public void setPorCredBaseIcms(BigDecimal porCredBaseIcms) { + this.porCredBaseIcms = porCredBaseIcms; + } + + /** + * @return the indJaneiro + */ + public Boolean getIndJaneiro() { + return indJaneiro; + } + + /** + * @param indJaneiro + * the indJaneiro to set + */ + public void setIndJaneiro(Boolean indJaneiro) { + this.indJaneiro = indJaneiro; + } + + /** + * @return the indFevereiro + */ + public Boolean getIndFevereiro() { + return indFevereiro; + } + + /** + * @param indFevereiro + * the indFevereiro to set + */ + public void setIndFevereiro(Boolean indFevereiro) { + this.indFevereiro = indFevereiro; + } + + /** + * @return the indMarco + */ + public Boolean getIndMarco() { + return indMarco; + } + + /** + * @param indMarco + * the indMarco to set + */ + public void setIndMarco(Boolean indMarco) { + this.indMarco = indMarco; + } + + /** + * @return the indAbril + */ + public Boolean getIndAbril() { + return indAbril; + } + + /** + * @param indAbril + * the indAbril to set + */ + public void setIndAbril(Boolean indAbril) { + this.indAbril = indAbril; + } + + /** + * @return the indMaio + */ + public Boolean getIndMaio() { + return indMaio; + } + + /** + * @param indMaio + * the indMaio to set + */ + public void setIndMaio(Boolean indMaio) { + this.indMaio = indMaio; + } + + /** + * @return the indJunho + */ + public Boolean getIndJunho() { + return indJunho; + } + + /** + * @param indJunho + * the indJunho to set + */ + public void setIndJunho(Boolean indJunho) { + this.indJunho = indJunho; + } + + /** + * @return the indJulho + */ + public Boolean getIndJulho() { + return indJulho; + } + + /** + * @param indJulho + * the indJulho to set + */ + public void setIndJulho(Boolean indJulho) { + this.indJulho = indJulho; + } + + /** + * @return the indAgosto + */ + public Boolean getIndAgosto() { + return indAgosto; + } + + /** + * @param indAgosto + * the indAgosto to set + */ + public void setIndAgosto(Boolean indAgosto) { + this.indAgosto = indAgosto; + } + + /** + * @return the indSetembro + */ + public Boolean getIndSetembro() { + return indSetembro; + } + + /** + * @param indSetembro + * the indSetembro to set + */ + public void setIndSetembro(Boolean indSetembro) { + this.indSetembro = indSetembro; + } + + /** + * @return the indOutubro + */ + public Boolean getIndOutubro() { + return indOutubro; + } + + /** + * @param indOutubro + * the indOutubro to set + */ + public void setIndOutubro(Boolean indOutubro) { + this.indOutubro = indOutubro; + } + + /** + * @return the indNovembro + */ + public Boolean getIndNovembro() { + return indNovembro; + } + + /** + * @param indNovembro + * the indNovembro to set + */ + public void setIndNovembro(Boolean indNovembro) { + this.indNovembro = indNovembro; + } + + /** + * @return the indDezembro + */ + public Boolean getIndDezembro() { + return indDezembro; + } + + /** + * @param indDezembro + * the indDezembro to set + */ + public void setIndDezembro(Boolean indDezembro) { + this.indDezembro = indDezembro; + } + + /** + * @return the indOutrosIsento + */ + public Boolean getIndOutrosIsento() { + return indOutrosIsento; + } + + /** + * @param indOutrosIsento + * the indOutrosIsento to set + */ + public void setIndOutrosIsento(Boolean indOutrosIsento) { + this.indOutrosIsento = indOutrosIsento; + } + + /** + * @return the activo + */ + public Boolean getActivo() { + return activo; + } + + /** + * @param activo + * the activo to set + */ + public void setActivo(Boolean activo) { + this.activo = activo; + } + + /** + * @return the fecmodif + */ + public Date getFecmodif() { + return fecmodif; + } + + /** + * @param fecmodif + * the fecmodif to set + */ + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + /** + * @return the usuarioId + */ + public Integer getUsuarioId() { + return usuarioId; + } + + /** + * @param usuarioId + * the usuarioId to set + */ + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * @return the empresa + */ + public Empresa getEmpresa() { + return empresa; + } + + /** + * @param empresa + * the empresa to set + */ + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + + public Estado getEstado() { + return estado; + } + + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaImpostoId != null ? empresaImpostoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EmpresaImposto)) { + return false; + } + EmpresaImposto other = (EmpresaImposto) object; + if ((this.empresaImpostoId == null && other.empresaImpostoId != null) || (this.empresaImpostoId != null && !this.empresaImpostoId.equals(other.empresaImpostoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EmpresaImposto[empresaImpostoId=" + empresaImpostoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estado.java b/src/com/rjconsultores/ventaboletos/entidad/Estado.java index de745ef3f..842440342 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Estado.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Estado.java @@ -58,6 +58,8 @@ public class Estado implements Serializable { private List ciudadList; @Column(name = "ICMS") private BigDecimal icms; + @OneToMany(mappedBy = "estado") + private List empresaImpostoList; public Estado() { } diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java new file mode 100644 index 000000000..9980d19fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Administrador + */ +public interface EmpresaImpostoService extends GenericService { + + public List buscarByEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstadoService.java b/src/com/rjconsultores/ventaboletos/service/EstadoService.java index 1f4fc4500..ac2491b08 100644 --- a/src/com/rjconsultores/ventaboletos/service/EstadoService.java +++ b/src/com/rjconsultores/ventaboletos/service/EstadoService.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service; import java.util.List; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.Pais; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; @@ -27,4 +28,6 @@ public interface EstadoService { public void borrar(Estado entidad) throws RegistroConDependenciaException; public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java new file mode 100644 index 000000000..2f7dbc545 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java @@ -0,0 +1,84 @@ +/* + * 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.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("empresaImpostoService") +public class EmpresaImpostoServiceImpl implements EmpresaImpostoService { + + @Autowired + private EmpresaImpostoDAO empresaImpostoDAO; + + @Transactional + public EmpresaImposto suscribir(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaImpostoDAO.suscribir(entidad); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerTodos() + */ + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerID(java.lang.Object) + */ + @Override + public EmpresaImposto obtenerID(Integer id) { + return empresaImpostoDAO.obtenerID(id); + } + + @Transactional + public EmpresaImposto actualizacion(EmpresaImposto entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return empresaImpostoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaImpostoDAO.actualizacion(entidad); + + } + + @Override + public List buscarByEmpresa(Empresa empresa) { + return empresaImpostoDAO.buscarByEmpresa(empresa); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java index 7a270bcf8..99ca0d35c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CiudadDAO; import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.Pais; import com.rjconsultores.ventaboletos.service.EstadoService; @@ -20,58 +21,63 @@ import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; /** - * + * * @author MCosso */ @Service("estadoService") public class EstadoServiceImpl implements EstadoService { - @Autowired - private EstadoDAO estadoDAO; - @Autowired - private CiudadDAO ciudadDAO; + @Autowired + private EstadoDAO estadoDAO; + @Autowired + private CiudadDAO ciudadDAO; - public List obtenerTodos() { - return estadoDAO.obtenerTodos(); - } + public List obtenerTodos() { + return estadoDAO.obtenerTodos(); + } - public Estado obtenerID(Integer id) { - return estadoDAO.obtenerID(id); - } + public Estado obtenerID(Integer id) { + return estadoDAO.obtenerID(id); + } - @Transactional - public Estado suscribir(Estado entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + @Transactional + public Estado suscribir(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return estadoDAO.suscribir(entidad); - } + return estadoDAO.suscribir(entidad); + } - @Transactional - public Estado actualizacion(Estado entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + @Transactional + public Estado actualizacion(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return estadoDAO.actualizacion(entidad); - } + return estadoDAO.actualizacion(entidad); + } - @Transactional - public void borrar(Estado entidad) throws RegistroConDependenciaException { - - if (ciudadDAO.count("estado", entidad) > 0l){ - throw new RegistroConDependenciaException(); - } - - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.FALSE); + @Transactional + public void borrar(Estado entidad) throws RegistroConDependenciaException { - estadoDAO.actualizacion(entidad); - } + if (ciudadDAO.count("estado", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } - public List buscar(String nombestado, Pais pais) { - return estadoDAO.buscar(nombestado, pais); - } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + estadoDAO.actualizacion(entidad); + } + + public List buscar(String nombestado, Pais pais) { + return estadoDAO.buscar(nombestado, pais); + } + + public List buscarNotInEmpresaImposto(Empresa empresa) { + return estadoDAO.buscarNotInEmpresaImposto(empresa); + + } }