Cadastro de contratos corporativos fixes bug#AL-4276
parent
15982a8440
commit
a452f55c7c
|
@ -2,4 +2,9 @@
|
|||
/.project
|
||||
/.settings
|
||||
/target
|
||||
/settings.xml
|
||||
/dist
|
||||
/.factorypath
|
||||
/*.BASE.xml
|
||||
/*.LOCAL.xml
|
||||
/*.REMOTE.xml
|
||||
|
|
|
@ -6,10 +6,8 @@ import com.rjconsultores.ventaboletos.entidad.ContratoCorporativo;
|
|||
|
||||
public interface ContratoDAO extends GenericDAO<ContratoCorporativo, Long>{
|
||||
|
||||
public List<ContratoCorporativo> buscar(Integer classe,Integer alias,Integer orgaoConcedente);
|
||||
|
||||
public ContratoCorporativo existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer aliasClasseId);
|
||||
|
||||
public List<ContratoCorporativo> buscaLike(String strContratoCorporativo);
|
||||
|
||||
public boolean existe(ContratoCorporativo contrato);
|
||||
|
||||
}
|
|
@ -22,49 +22,6 @@ public class ContratoHibernateDAO extends GenericHibernateDAO<ContratoCorporativ
|
|||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContratoCorporativo existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer aliasClasseId) {
|
||||
Criteria c = makeCriteria();
|
||||
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
if( classe != null ) {
|
||||
c.add(Restrictions.eq("classe.claseservicioId",classe));
|
||||
}
|
||||
|
||||
if ( alias != null ) {
|
||||
c.add(Restrictions.eq("alias.claseservicioId",alias));
|
||||
}
|
||||
|
||||
if( orgaoConcedente != null ) {
|
||||
c.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedente));
|
||||
}
|
||||
|
||||
if( aliasClasseId != null ) {
|
||||
c.add(Restrictions.eq("aliasClasseId",aliasClasseId));
|
||||
}
|
||||
|
||||
return (ContratoCorporativo) c.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContratoCorporativo> buscar(Integer classe, Integer alias, Integer orgaoConcedente) {
|
||||
Criteria c = makeCriteria();
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
if( classe != null ) {
|
||||
c.add(Restrictions.eq("classe.claseservicioId",classe));
|
||||
}
|
||||
|
||||
if ( alias != null ) {
|
||||
c.add(Restrictions.eq("alias.claseservicioId",alias));
|
||||
}
|
||||
|
||||
if( orgaoConcedente != null ) {
|
||||
c.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedente));
|
||||
}
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContratoCorporativo> buscaLike(String nome) {
|
||||
Criteria c = makeCriteria();
|
||||
|
@ -77,4 +34,14 @@ public class ContratoHibernateDAO extends GenericHibernateDAO<ContratoCorporativ
|
|||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existe(ContratoCorporativo contrato) {
|
||||
Criteria c = makeCriteria();
|
||||
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("numContrato", contrato.getNumContrato()));
|
||||
|
||||
return c.uniqueResult() != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ import javax.persistence.Table;
|
|||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import com.rjconsultores.ventaboletos.anotacao.Renderizado;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CLIENTE_CORPORATIVO")
|
||||
@SequenceGenerator(name = "CLIENTE_CORPORATIVO_SEQ", sequenceName = "CLIENTE_CORPORATIVO_SEQ", allocationSize = 1)
|
||||
|
@ -22,15 +24,18 @@ public class ClienteCorporativo implements Serializable {
|
|||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CLIENTE_CORPORATIVO_SEQ")
|
||||
@Renderizado
|
||||
@Column(name = "CLIENTECORPORATIVO_ID")
|
||||
private Long clienteCorporativoId;
|
||||
|
||||
@Column(name = "EMPRESA_ID", nullable = false)
|
||||
private Integer empresaId;
|
||||
|
||||
@Renderizado
|
||||
@Column(name = "IDENTIFICACAO")
|
||||
private Long identificacao;
|
||||
|
||||
@Renderizado
|
||||
@Column(name = "NOMCLIENTECORP", length = 255)
|
||||
private String nomeClienteCorp;
|
||||
|
||||
|
@ -71,6 +76,7 @@ public class ClienteCorporativo implements Serializable {
|
|||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecModif;
|
||||
|
||||
@Renderizado
|
||||
private transient String nombEmpresa;
|
||||
|
||||
public Long getClienteCorporativoId() {
|
||||
|
@ -202,7 +208,7 @@ public class ClienteCorporativo implements Serializable {
|
|||
}
|
||||
|
||||
public String getNombEmpresa() {
|
||||
return nombEmpresa;
|
||||
return nombEmpresa !=null ?nombEmpresa :"";
|
||||
}
|
||||
|
||||
public void setNombEmpresa(String nombEmpresa) {
|
||||
|
|
|
@ -20,6 +20,8 @@ import javax.persistence.TemporalType;
|
|||
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import com.rjconsultores.ventaboletos.anotacao.Renderizado;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -35,9 +37,11 @@ public class GrupoContrato implements Serializable {
|
|||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_CONTRATO_SEQ")
|
||||
@Renderizado
|
||||
@Column(name = "GRUPOCONTRATO_ID")
|
||||
private Integer grupoContratoId;
|
||||
|
||||
@Renderizado
|
||||
@Column(name = "NOMEGRUPOCONTRATO")
|
||||
private String nomeGrupoContrato;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import javax.persistence.Temporal;
|
|||
import javax.persistence.TemporalType;
|
||||
|
||||
import com.rjconsultores.ventaboletos.anotacao.Renderizado;
|
||||
import com.rjconsultores.ventaboletos.enums.CustomTipo;
|
||||
import com.rjconsultores.ventaboletos.enums.EnumStatus;
|
||||
|
||||
import lombok.Getter;
|
||||
|
@ -36,7 +35,7 @@ public class Transportadora implements Serializable{
|
|||
@Column(name = "TRANSPORTADORA_ID")
|
||||
private Long transportadoraId;
|
||||
|
||||
@Renderizado( conversor = CustomTipo.class)
|
||||
@Renderizado()
|
||||
@Column(name = "NIT")
|
||||
private String nit;
|
||||
|
||||
|
@ -47,8 +46,8 @@ public class Transportadora implements Serializable{
|
|||
@Column(name = "CLASSE_PAGAMENTO")
|
||||
private Integer classePagamento;
|
||||
|
||||
@Column(name = "FORMA_PAGAMENTO")
|
||||
private Integer formaPagamento;
|
||||
@Column(name = "EMAIL", length = 150)
|
||||
private String email;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
|
|
@ -15,9 +15,7 @@ public interface ContratoService{
|
|||
|
||||
public void borrar(ContratoCorporativo entidad);
|
||||
|
||||
public ContratoCorporativo existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer aliasClasseId);
|
||||
|
||||
public List<ContratoCorporativo> buscar(Integer classe,Integer alias,Integer orgaoConcedente);
|
||||
|
||||
public List<ContratoCorporativo> buscaLike(String numContrato);
|
||||
|
||||
public boolean existe(ContratoCorporativo contrato);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
*/
|
||||
public interface GenericService<T, ID> {
|
||||
|
||||
public List<T> obtenerTodos();
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.ClienteCorporativoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteCorporativo;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.ClienteCorporativoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
|
@ -28,15 +27,7 @@ public class ClienteCorporativoServiceImpl implements ClienteCorporativoService
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public ClienteCorporativo suscribirActualizar(ClienteCorporativo entidad) throws BusinessException {
|
||||
|
||||
if ( entidad.getEmpresaId() == null ||
|
||||
entidad.getNomeClienteCorp() == null ||
|
||||
entidad.getIdentificacao() == null ||
|
||||
entidad.getDataCriacao() == null ){
|
||||
throw new BusinessException("editarClienteCorporativoController.MSG.camposObrigatorios");
|
||||
}
|
||||
|
||||
public ClienteCorporativo suscribirActualizar(ClienteCorporativo entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecModif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.ContratoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ContratoCorporativo;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.ContratoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
|
@ -28,16 +27,7 @@ public class ContratoServiceImpl implements ContratoService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public ContratoCorporativo suscribirActualizar(ContratoCorporativo entidad) throws BusinessException {
|
||||
|
||||
if ( entidad.getClienteCorporativoId() == null ||
|
||||
entidad.getGrupoContratoId() == null ||
|
||||
entidad.getNumContrato() == null ||
|
||||
entidad.getDataFinal() == null ||
|
||||
entidad.getDataInicial() == null ){
|
||||
throw new BusinessException("editarContratoController.MSG.camposObrigatorios");
|
||||
}
|
||||
|
||||
public ContratoCorporativo suscribirActualizar(ContratoCorporativo entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecModif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
@ -59,18 +49,13 @@ public class ContratoServiceImpl implements ContratoService {
|
|||
contratoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContratoCorporativo existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer clienteCorpId) {
|
||||
return contratoDAO.existe(classe, alias, orgaoConcedente, clienteCorpId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContratoCorporativo> buscar(Integer classe, Integer alias, Integer orgaoConcedente) {
|
||||
return contratoDAO.buscar(classe, alias, orgaoConcedente);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContratoCorporativo> buscaLike(String strContratoCorporativo) {
|
||||
return contratoDAO.buscaLike( strContratoCorporativo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existe(ContratoCorporativo contrato) {
|
||||
return contratoDAO.existe(contrato);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue