From 65293410a38a45d217288147875937457f232cf2 Mon Sep 17 00:00:00 2001 From: eduardo.batista Date: Mon, 31 Jul 2017 09:20:24 -0300 Subject: [PATCH] [Feat] Finalizando serviços pacote 3 --- controlador_ws.php | 43 ++++++++++++++++++++++++++++++------------- rn/MdWsSeiBlocoRN.php | 19 +++++++++++++++++++ rn/MdWsSeiCredenciamentoRN.php | 22 ++++++++++++++++++++++ rn/MdWsSeiProcedimentoRN.php | 37 ++++++++++++++++++++++++++++++++----- 4 files changed, 103 insertions(+), 18 deletions(-) diff --git a/controlador_ws.php b/controlador_ws.php index eed2cc0..a17d842 100644 --- a/controlador_ws.php +++ b/controlador_ws.php @@ -220,6 +220,13 @@ $app->group('/api/v1',function(){ $dto->setNumPaginaAtual($request->getParam('start')); return $response->withJSON($rn->listarBloco($dto)); }); + $this->post('/{bloco}/retornar', function($request, $response, $args){ + /** @var $request Slim\Http\Request */ + $rn = new MdWsSeiBlocoRN(); + $dto = new BlocoDTO(); + $dto->setNumIdBloco($request->getAttribute('route')->getArgument('bloco')); + return $response->withJSON($rn->retornar($dto)); + }); $this->get('/listar/{bloco}/documentos', function($request, $response, $args){ /** @var $request Slim\Http\Request */ $rn = new MdWsSeiBlocoRN(); @@ -337,23 +344,25 @@ $app->group('/api/v1',function(){ $dto->setDblIdProtocolo($request->getAttribute('route')->getArgument('protocolo')); return $response->withJSON($rn->listarCienciaProcesso($dto)); }); - $this->post('/sobrestar/processo', function($request, $response, $args){ + $this->get('/consultar', function($request, $response, $args){ /** @var $request Slim\Http\Request */ $rn = new MdWsSeiProcedimentoRN(); - $dto = new EntradaSobrestarProcessoAPI(); - if($request->getParam('protocoloFormatado')){ - $dto->setProtocoloProcedimento($request->getParam('protocoloFormatado')); - } - if($request->getParam('protocolo')){ - $dto->setIdProcedimento($request->getParam('protocolo')); - } - if($request->getParam('protocoloVinculado')){ - $dto->setIdProcedimentoVinculado($request->getParam('protocoloVinculado')); + return $response->withJSON( + $rn->apiConsultarProcessoDigitado(MdWsSeiRest::dataToIso88591($request->getParam('protocoloFormatado'))) + ); + }); + $this->post('/{protocolo}/sobrestar/processo', function($request, $response, $args){ + /** @var $request Slim\Http\Request */ + $rn = new MdWsSeiProcedimentoRN(); + $dto = new RelProtocoloProtocoloDTO(); + if($request->getAttribute('route')->getArgument('protocolo')){ + $dto->setDblIdProtocolo2($request->getAttribute('route')->getArgument('protocolo')); } - if($request->getParam('protocoloFormatadoVinculado')){ - $dto->setProtocoloProcedimentoVinculado($request->getParam('protocoloFormatadoVinculado')); + $dto->setDblIdProtocolo1($request->getParam('protocoloDestino')); + if($request->getParam('motivo')){ + $dto->setStrMotivo(MdWsSeiRest::dataToIso88591($request->getParam('motivo'))); } - $dto->setMotivo(MdWsSeiRest::dataToIso88591($request->getParam('motivo'))); + return $response->withJSON($rn->sobrestamentoProcesso($dto)); }); $this->post('/{procedimento}/ciencia', function($request, $response, $args){ @@ -531,6 +540,14 @@ $app->group('/api/v1',function(){ return $response->withJSON($rn->concederCredenciamento($dto)); }); + $this->post('/{procedimento}/credenciamento/renunciar', function($request, $response, $args){ + /** @var $request Slim\Http\Request */ + $rn = new MdWsSeiCredenciamentoRN(); + $dto = new ProcedimentoDTO(); + $dto->setDblIdProcedimento($request->getAttribute('route')->getArgument('procedimento')); + + return $response->withJSON($rn->renunciarCredencial($dto)); + }); $this->post('/{procedimento}/credenciamento/cassar', function($request, $response, $args){ /** @var $request Slim\Http\Request */ $rn = new MdWsSeiCredenciamentoRN(); diff --git a/rn/MdWsSeiBlocoRN.php b/rn/MdWsSeiBlocoRN.php index 7b6b021..4642759 100644 --- a/rn/MdWsSeiBlocoRN.php +++ b/rn/MdWsSeiBlocoRN.php @@ -8,6 +8,25 @@ class MdWsSeiBlocoRN extends InfraRN { } /** + * Método que retorna o bloco de assinatura + * @param BlocoDTO $blocoDTO + * @return array + */ + protected function retornarControlado(BlocoDTO $blocoDTO){ + try{ + if(!$blocoDTO->isSetNumIdBloco()){ + throw new Exception('Bloco não informado!'); + } + $blocoRN = new BlocoRN(); + $blocoRN->retornar(array($blocoDTO)); + + return MdWsSeiRest::formataRetornoSucessoREST('Bloco retornado com sucesso!'); + }catch (Exception $e){ + return MdWsSeiRest::formataRetornoErroREST($e); + } + } + + /** * Consultar Blocos * @param BlocoDTO $blocoDTO * @return array diff --git a/rn/MdWsSeiCredenciamentoRN.php b/rn/MdWsSeiCredenciamentoRN.php index e99e347..01269a2 100644 --- a/rn/MdWsSeiCredenciamentoRN.php +++ b/rn/MdWsSeiCredenciamentoRN.php @@ -109,4 +109,26 @@ class MdWsSeiCredenciamentoRN extends InfraRN { } } + /** + * Método de reununcia de credencial de acesso + * @param ProcedimentoDTO $procedimentoDTO + * @return array + */ + protected function renunciarCredencialControlado(ProcedimentoDTO $procedimentoDTO){ + try{ + $temPermissao = SessaoSEI::getInstance()->verificarPermissao('procedimento_credencial_renunciar'); + if(!$temPermissao){ + throw new Exception("O usuário não tem permissão para renunciar!"); + } + if(!$procedimentoDTO->isSetDblIdProcedimento()){ + throw new Exception("O processo não foi informado!"); + } + $atividadeRN = new AtividadeRN(); + $atividadeRN->renunciarCredenciais($procedimentoDTO); + return MdWsSeiRest::formataRetornoSucessoREST("Credencial renunciada com sucesso!"); + }catch (Exception $e){ + return MdWsSeiRest::formataRetornoErroREST($e); + } + } + } \ No newline at end of file diff --git a/rn/MdWsSeiProcedimentoRN.php b/rn/MdWsSeiProcedimentoRN.php index 0ef8d7c..a535db0 100644 --- a/rn/MdWsSeiProcedimentoRN.php +++ b/rn/MdWsSeiProcedimentoRN.php @@ -10,6 +10,21 @@ class MdWsSeiProcedimentoRN extends InfraRN } /** + * Consulta o processo pelo protocolo + * @param $protocolo + * @return array + */ + public function apiConsultarProcessoDigitado($protocolo){ + try{ + $result = ProcedimentoINT::pesquisarDigitadoRI1023($protocolo); + + return MdWsSeiRest::formataRetornoSucessoREST(null, $result); + }catch (Exception $e){ + return MdWsSeiRest::formataRetornoErroREST($e); + } + } + + /** * Retorna o total de unidades do processo * @param ProtocoloDTO $protocoloDTO * @return array @@ -88,14 +103,20 @@ class MdWsSeiProcedimentoRN extends InfraRN /** * Metodo de sobrestamento de processo - * @param EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI + * @param RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO * @return array */ - protected function sobrestamentoProcessoControlado(EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI) + protected function sobrestamentoProcessoControlado(RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO) { try { - $seiRN = new SeiRN(); - $seiRN->sobrestarProcesso($entradaSobrestarProcessoAPI); + if(!$relProtocoloProtocoloDTO->isSetDblIdProtocolo2()){ + throw new Exception('Processo não informado!'); + } + if(!$relProtocoloProtocoloDTO->isSetStrMotivo()){ + throw new Exception('Informe o motivo!'); + } + $procedimentoRN = new ProcedimentoRN(); + $procedimentoRN->sobrestarRN1014(array($relProtocoloProtocoloDTO)); return MdWsSeiRest::formataRetornoSucessoREST('Processo sobrestado com sucesso'); } catch (Exception $e) { @@ -367,6 +388,7 @@ class MdWsSeiProcedimentoRN extends InfraRN $documentoNovo = 'N'; $documentoPublicado = 'N'; $possuiAnotacao = 'N'; + $podeGerenciarCredenciais = 'N'; $possuiAnotacaoPrioridade = 'N'; $usuarioVisualizacao = 'N'; $tipoVisualizacao = 'N'; @@ -548,6 +570,10 @@ class MdWsSeiProcedimentoRN extends InfraRN $arrDadosAbertura = $this->listarUnidadeAberturaProcedimento($procedimentoDTOParam); } + if($protocoloDTO->getStrStaNivelAcessoGlobal() == ProtocoloRN::$NA_SIGILOSO){ + $podeGerenciarCredenciais = SessaoSEI::getInstance()->verificarPermissao('procedimento_credencial_gerenciar') ? 'S' : 'N'; + } + $result[] = array( 'id' => $protocoloDTO->getDblIdProtocolo(), 'status' => $protocoloDTO->getStrStaProtocolo(), @@ -584,7 +610,8 @@ class MdWsSeiProcedimentoRN extends InfraRN 'processoBloqueado' => $processoBloqueado, 'processoDocumentoIncluidoAssinado' => $processoDocumentoIncluidoAssinado, 'processoPublicado' => $processoPublicado, - 'nivelAcessoGlobal' => $protocoloDTO->getStrStaNivelAcessoGlobal() + 'nivelAcessoGlobal' => $protocoloDTO->getStrStaNivelAcessoGlobal(), + 'podeGerenciarCredenciais' => $podeGerenciarCredenciais ) ) ); -- libgit2 0.21.2