rafael.henrique 2018-02-01 19:12:25 +00:00
parent 4b3d19a0d8
commit af247d11ec
3 changed files with 42 additions and 0 deletions

View File

@ -80,6 +80,9 @@ public class Categoria implements Serializable {
@Column(name = "INDNAOUSAASSENTO") @Column(name = "INDNAOUSAASSENTO")
private Boolean indnaousaassento; private Boolean indnaousaassento;
@Column(name = "CVESISTEMA")
private String cvesistema;
public Categoria() { public Categoria() {
} }
@ -239,4 +242,11 @@ public class Categoria implements Serializable {
this.orgaosConcedentes = orgaosConcedentes; this.orgaosConcedentes = orgaosConcedentes;
} }
public String getCvesistema() {
return cvesistema;
}
public void setCvesistema(String cvesistema) {
this.cvesistema = cvesistema;
}
} }

View File

@ -4,6 +4,7 @@
*/ */
package com.rjconsultores.ventaboletos.service; package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
/** /**
@ -21,4 +22,6 @@ public interface CategoriaCtrlService {
public CategoriaCtrl actualizacion(CategoriaCtrl entidad); public CategoriaCtrl actualizacion(CategoriaCtrl entidad);
public void borrar(CategoriaCtrl entidad); public void borrar(CategoriaCtrl entidad);
public boolean validaCategoriaProgramaFidelidade(Categoria categoria);
} }

View File

@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO;
import com.rjconsultores.ventaboletos.dao.CategoriaDAO; import com.rjconsultores.ventaboletos.dao.CategoriaDAO;
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.CategoriaClase; import com.rjconsultores.ventaboletos.entidad.CategoriaClase;
import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida;
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
@ -22,6 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; import com.rjconsultores.ventaboletos.entidad.CategoriaMarca;
import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; import com.rjconsultores.ventaboletos.entidad.CategoriaMercado;
import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.service.CategoriaCtrlService; import com.rjconsultores.ventaboletos.service.CategoriaCtrlService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -33,11 +36,18 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { public class CategoriaCtrlServiceImpl implements CategoriaCtrlService {
public static final int CATEGORIA_ADULTO = 1; public static final int CATEGORIA_ADULTO = 1;
private static final String CVE_SISTEMA_CATEGORIA_FIDELIDADE = "FIDELIDADE";
private static final String CONSTANTE_URL_WS_FIDELIDADE = "URL_WS_FIDELIDADE";
private static final String CONSTANTE_SENHA_WS_FIDELIDADE = "SENHA_WS_FIDELIDADE";
private static final String CONSTANTE_USUARIO_WS_FIDELIDADE = "USUARIO_WS_FIDELIDADE";
private static final int CANT_MAX_CATEGORIA_ADULTO = 200; private static final int CANT_MAX_CATEGORIA_ADULTO = 200;
@Autowired @Autowired
private CategoriaCtrlDAO categoriaCtrlDAO; private CategoriaCtrlDAO categoriaCtrlDAO;
@Autowired @Autowired
private CategoriaDAO categoriaDAO; private CategoriaDAO categoriaDAO;
@Autowired
private ConstanteDAO constanteDAO;
@Override @Override
public CategoriaCtrl obtenerID(Integer id) { public CategoriaCtrl obtenerID(Integer id) {
@ -165,4 +175,23 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService {
return cd; return cd;
} }
@Override
public boolean validaCategoriaProgramaFidelidade(Categoria categoria){
if(categoria.getCvesistema().equals(CVE_SISTEMA_CATEGORIA_FIDELIDADE)){
Constante url = constanteDAO.buscarPorNomeConstante(CONSTANTE_URL_WS_FIDELIDADE);
Constante usuario = constanteDAO.buscarPorNomeConstante(CONSTANTE_USUARIO_WS_FIDELIDADE);
Constante senha = constanteDAO.buscarPorNomeConstante(CONSTANTE_SENHA_WS_FIDELIDADE);
if(url == null || url.getValorconstante() == null || url.getValorconstante().isEmpty() ||
usuario == null || usuario.getValorconstante() == null || usuario.getValorconstante().isEmpty() ||
senha == null || senha.getValorconstante() == null || senha.getValorconstante().isEmpty()){
return Boolean.FALSE;
}
}
return Boolean.TRUE;
}
} }