fixes bug#20989

qua:juliane
dev:valdir
Foi criado uma função sistema 'USUARIO RELATORIO GRATUIDADE AGER > MENU RELATORIO > ESTATISTICO > RELATORIO GRATUIDADE AGER' para definir que o usuario tenha acesso somente ao órgao concedenet AGER/MT
Na descrição da espec, pede 3 tipos de passagens, porém na propria espec tem um print pedindo somente o tipo Normal. Conversei com o Régis, e foi definido para considerar somente o tipo de passagem Normal.

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@105011 d1611594-4594-4d17-8e1d-87c2c4800839
master
walace 2021-01-13 19:41:04 +00:00
parent 9a254ac5d2
commit 170b745e7d
2 changed files with 47 additions and 5 deletions

View File

@ -22,13 +22,18 @@ import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.PerfilFuncion;
import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidadeAGER; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidadeAGER;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.CategoriaService; import com.rjconsultores.ventaboletos.service.CategoriaService;
import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.RutaService; import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.service.UsuarioService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -46,6 +51,8 @@ public class RelatorioGratuidadeAGERController extends MyGenericForwardComposer
@Autowired @Autowired
private EmpresaService empresaService; private EmpresaService empresaService;
@Autowired @Autowired
private UsuarioService usuarioService;
@Autowired
private RutaService rutaService; private RutaService rutaService;
@Autowired @Autowired
private OrgaoConcedenteService orgaoConcedenteService; private OrgaoConcedenteService orgaoConcedenteService;
@ -117,7 +124,18 @@ public class RelatorioGratuidadeAGERController extends MyGenericForwardComposer
private void executarPesquisaLinha() { private void executarPesquisaLinha() {
String palavraPesquisaRuta = txtPalavraPesquisaLinha.getText(); String palavraPesquisaRuta = txtPalavraPesquisaLinha.getText();
if (temPermissao("USUARIO.RELATORIO.AGER")){
if(cmbOrgaoConcedente.getSelectedItem() == null) {
return;
}
OrgaoConcedente orgaoConcedente = (OrgaoConcedente) cmbOrgaoConcedente.getSelectedItem().getValue();
linhaList.setData(rutaService.buscaRuta(palavraPesquisaRuta, orgaoConcedente));
}else {
linhaList.setData(rutaService.buscaRuta(palavraPesquisaRuta)); linhaList.setData(rutaService.buscaRuta(palavraPesquisaRuta));
}
if (linhaList.getData().length == 0) { if (linhaList.getData().length == 0) {
try { try {
@ -234,14 +252,38 @@ public class RelatorioGratuidadeAGERController extends MyGenericForwardComposer
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp); super.doAfterCompose(comp);
lsEmpresas = empresaService.obtenerTodos(); lsEmpresas = empresaService.obtenerTodos();
if (temPermissao("USUARIO.RELATORIO.AGER")){
lsOrgaosConcedentes = orgaoConcedenteService.buscar("AGER/MT");
cmbOrgaoConcedente.setText(lsOrgaosConcedentes.isEmpty() ? "": lsOrgaosConcedentes.get(0).getDescOrgao());
lsCategorias = categoriaService.buscar("NORMAL");
cmbTipoGratuidade.setText(lsCategorias.isEmpty() ? "": lsCategorias.get(0).getDesccategoria());
}else {
lsOrgaosConcedentes = orgaoConcedenteService.obtenerTodos(); lsOrgaosConcedentes = orgaoConcedenteService.obtenerTodos();
lsCategorias = categoriaService.obtenerTodos(); lsCategorias = categoriaService.obtenerTodos();
listSelectedTipoGratuidade = new ArrayList<Categoria>(); }
listSelectedTipoGratuidade = new ArrayList<Categoria>();
linhaList.setItemRenderer(new RenderRelatorioLinhaHorario()); linhaList.setItemRenderer(new RenderRelatorioLinhaHorario());
linhaListSelList.setItemRenderer(new RenderRelatorioLinhaHorario()); linhaListSelList.setItemRenderer(new RenderRelatorioLinhaHorario());
} }
private boolean temPermissao(String permissao){
Usuario usuario = usuarioService.obtenerID(UsuarioLogado.getUsuarioLogado().getUsuarioId());
for (UsuarioPerfil up : usuario.getUsuarioPerfilList()){
List<PerfilFuncion> listPerfilFuncion = up.getPerfil().getPerfilFuncionList();
for (PerfilFuncion pf : listPerfilFuncion) {
if (pf.getFuncionSistema().getDescruta().equals(permissao)){
return true;
}
}
}
return false;
}
public List<Categoria> getLsCategorias() { public List<Categoria> getLsCategorias() {
return lsCategorias; return lsCategorias;
} }

View File

@ -36,7 +36,7 @@
<combobox id="cmbOrgaoConcedente" width="100%" <combobox id="cmbOrgaoConcedente" width="100%"
maxlength="60" mold="rounded" buttonVisible="true" maxlength="60" mold="rounded" buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioGratuidadeAGER$composer.lsOrgaosConcedentes}" /> model="@{winFiltroRelatorioGratuidadeAGER$composer.lsOrgaosConcedentes}" constraint="no empty"/>
</row> </row>
<row> <row>