Merge pull request 'Bolivariano - Autorização de viagem fixes bug#AL-4453' (!234) from AL-4453 into master
Reviewed-on: adm/ModelWeb#234 Reviewed-by: fabio <fabio.faria@rjconsultores.com.br>master
commit
e4437b4b58
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>ModelWeb</artifactId>
|
||||
<version>1.87.1</version>
|
||||
<version>1.88.0</version>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaFormAutorizacao;
|
||||
|
||||
public interface CategoriaFormAutorizacaoDAO extends GenericDAO<CategoriaFormAutorizacao, Integer> {
|
||||
|
||||
public CategoriaFormAutorizacao pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId);
|
||||
public List<CategoriaFormAutorizacao> obtenerTodosPorCategoria(Integer categoriaId);
|
||||
public CategoriaFormAutorizacao saverOrUpdate(CategoriaFormAutorizacao form);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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.CategoriaFormAutorizacaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaFormAutorizacao;
|
||||
|
||||
@Repository("CategoriaDescuentoDAO")
|
||||
public class CategoriaFormAutorizacaoHibernateDAO extends GenericHibernateDAO<CategoriaFormAutorizacao, Integer>
|
||||
implements CategoriaFormAutorizacaoDAO {
|
||||
|
||||
@Autowired
|
||||
public CategoriaFormAutorizacaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CategoriaFormAutorizacao> obtenerTodosPorCategoria(Integer categoriaId) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass())
|
||||
.add(Restrictions.eq("activo", Boolean.TRUE))
|
||||
.add(Restrictions.eq("categoria.categoriaId", categoriaId));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoriaFormAutorizacao pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId){
|
||||
Criteria c = getSession().createCriteria(getPersistentClass())
|
||||
.add(Restrictions.eq("activo", Boolean.TRUE))
|
||||
.add(Restrictions.eq("empresaId", empresaId))
|
||||
.add(Restrictions.eq("categoriaId", categoriaId));
|
||||
c.setMaxResults(1);
|
||||
|
||||
return (CategoriaFormAutorizacao) c.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoriaFormAutorizacao saverOrUpdate(CategoriaFormAutorizacao form) {
|
||||
getHibernateTemplate().saveOrUpdate(form);
|
||||
return form;
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ 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;
|
||||
|
@ -129,6 +130,12 @@ public class Categoria implements Serializable, Auditavel<Categoria>{
|
|||
@Column(name = "INDINTEGRACAOAGR")
|
||||
private Boolean indIntegracaoAGR;
|
||||
|
||||
@Column(name = "INDEMITEFORMAUTORIZACAO")
|
||||
private Boolean indEmiteFormularioAutorizacao;
|
||||
|
||||
@OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL)
|
||||
private List<CategoriaFormAutorizacao> formsAutorizacao = new ArrayList<CategoriaFormAutorizacao>();
|
||||
|
||||
public Categoria() {
|
||||
}
|
||||
|
||||
|
@ -355,4 +362,22 @@ public class Categoria implements Serializable, Auditavel<Categoria>{
|
|||
public void setIndIntegracaoAGR(Boolean indIntegracaoAGR) {
|
||||
this.indIntegracaoAGR = indIntegracaoAGR;
|
||||
}
|
||||
|
||||
public Boolean getIndEmiteFormularioAutorizacao() {
|
||||
return indEmiteFormularioAutorizacao == null ? false : indEmiteFormularioAutorizacao;
|
||||
}
|
||||
|
||||
public void setIndEmiteFormularioAutorizacao(Boolean indEmiteFormularioAutorizacao) {
|
||||
this.indEmiteFormularioAutorizacao = indEmiteFormularioAutorizacao;
|
||||
}
|
||||
|
||||
public List<CategoriaFormAutorizacao> getFormsAutorizacao() {
|
||||
return formsAutorizacao;
|
||||
}
|
||||
|
||||
public void setFormsAutorizacao(List<CategoriaFormAutorizacao> formsAutorizacao) {
|
||||
this.formsAutorizacao = formsAutorizacao;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
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.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CATEGORIA_FORM_AUTORIZACAO")
|
||||
public class CategoriaFormAutorizacao implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
|
||||
@ManyToOne()
|
||||
private Categoria categoria;
|
||||
@Id
|
||||
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne()
|
||||
private Empresa empresa;
|
||||
@Column(name = "TEXTO")
|
||||
private String texto;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public Categoria getCategoria() {
|
||||
return categoria;
|
||||
}
|
||||
public void setCategoria(Categoria categoria) {
|
||||
this.categoria = categoria;
|
||||
}
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
public String getTexto() {
|
||||
return texto;
|
||||
}
|
||||
public void setTexto(String texto) {
|
||||
this.texto = texto;
|
||||
}
|
||||
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 Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final CategoriaFormAutorizacao other = (CategoriaFormAutorizacao) obj;
|
||||
if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) {
|
||||
return false;
|
||||
}
|
||||
if (this.empresa.getEmpresaId() != other.empresa.getEmpresaId() && (this.empresa.getEmpresaId() == null || !this.empresa.getEmpresaId().equals(other.empresa.getEmpresaId()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 97 * hash + (this.categoria != null ? this.categoria.hashCode() : 0);
|
||||
hash = 97 * hash + (this.empresa != null ? this.empresa.getEmpresaId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.CategoriaFormAutorizacao[categoriaId=" + (categoria != null ? categoria.getDesccategoria() : "") + ", empresaId=" + (empresa != null ? empresa.getNombempresa() : "") + "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaFormAutorizacao;
|
||||
|
||||
public interface CategoriaFormAutorizacaoService extends GenericService<CategoriaFormAutorizacao, Integer> {
|
||||
|
||||
public List<CategoriaFormAutorizacao> obtenerTodosPorCategoria(Integer categoriaId);
|
||||
|
||||
public CategoriaFormAutorizacao pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId);
|
||||
|
||||
public CategoriaFormAutorizacao salvar(CategoriaFormAutorizacao entidad);
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
|
||||
import com.rjconsultores.ventaboletos.dao.CategoriaFormAutorizacaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaFormAutorizacao;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaFormAutorizacaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("CategoriaFormAutorizacaoService")
|
||||
public class CategoriaFormAutorizacaoServiceImpl implements CategoriaFormAutorizacaoService{
|
||||
|
||||
@Autowired
|
||||
private CategoriaFormAutorizacaoDAO categoriaFormAutorizacaoDAO;
|
||||
private static Logger log = LogManager.getLogger(CategoriaFormAutorizacaoServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public List<CategoriaFormAutorizacao> obtenerTodos() {
|
||||
return categoriaFormAutorizacaoDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoriaFormAutorizacao obtenerID(Integer id) {
|
||||
return categoriaFormAutorizacaoDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CategoriaFormAutorizacao suscribir(CategoriaFormAutorizacao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return categoriaFormAutorizacaoDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CategoriaFormAutorizacao actualizacion(CategoriaFormAutorizacao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return categoriaFormAutorizacaoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CategoriaFormAutorizacao salvar(CategoriaFormAutorizacao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return categoriaFormAutorizacaoDAO.saverOrUpdate(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(CategoriaFormAutorizacao entidad) {
|
||||
categoriaFormAutorizacaoDAO.borrar(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CategoriaFormAutorizacao> obtenerTodosPorCategoria(Integer categoriaId) {
|
||||
return categoriaFormAutorizacaoDAO.obtenerTodosPorCategoria(categoriaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoriaFormAutorizacao pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId) {
|
||||
return categoriaFormAutorizacaoDAO.pesquisarPorCategoriaEmpresa(categoriaId, empresaId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue