Commit 65293410a38a45d217288147875937457f232cf2

Authored by eduardo.batista
1 parent 472aface
Exists in master and in 1 other branch desenv

[Feat] Finalizando serviços pacote 3

controlador_ws.php
... ... @@ -220,6 +220,13 @@ $app->group('/api/v1',function(){
220 220 $dto->setNumPaginaAtual($request->getParam('start'));
221 221 return $response->withJSON($rn->listarBloco($dto));
222 222 });
  223 + $this->post('/{bloco}/retornar', function($request, $response, $args){
  224 + /** @var $request Slim\Http\Request */
  225 + $rn = new MdWsSeiBlocoRN();
  226 + $dto = new BlocoDTO();
  227 + $dto->setNumIdBloco($request->getAttribute('route')->getArgument('bloco'));
  228 + return $response->withJSON($rn->retornar($dto));
  229 + });
223 230 $this->get('/listar/{bloco}/documentos', function($request, $response, $args){
224 231 /** @var $request Slim\Http\Request */
225 232 $rn = new MdWsSeiBlocoRN();
... ... @@ -337,23 +344,25 @@ $app->group('/api/v1',function(){
337 344 $dto->setDblIdProtocolo($request->getAttribute('route')->getArgument('protocolo'));
338 345 return $response->withJSON($rn->listarCienciaProcesso($dto));
339 346 });
340   - $this->post('/sobrestar/processo', function($request, $response, $args){
  347 + $this->get('/consultar', function($request, $response, $args){
341 348 /** @var $request Slim\Http\Request */
342 349 $rn = new MdWsSeiProcedimentoRN();
343   - $dto = new EntradaSobrestarProcessoAPI();
344   - if($request->getParam('protocoloFormatado')){
345   - $dto->setProtocoloProcedimento($request->getParam('protocoloFormatado'));
346   - }
347   - if($request->getParam('protocolo')){
348   - $dto->setIdProcedimento($request->getParam('protocolo'));
349   - }
350   - if($request->getParam('protocoloVinculado')){
351   - $dto->setIdProcedimentoVinculado($request->getParam('protocoloVinculado'));
  350 + return $response->withJSON(
  351 + $rn->apiConsultarProcessoDigitado(MdWsSeiRest::dataToIso88591($request->getParam('protocoloFormatado')))
  352 + );
  353 + });
  354 + $this->post('/{protocolo}/sobrestar/processo', function($request, $response, $args){
  355 + /** @var $request Slim\Http\Request */
  356 + $rn = new MdWsSeiProcedimentoRN();
  357 + $dto = new RelProtocoloProtocoloDTO();
  358 + if($request->getAttribute('route')->getArgument('protocolo')){
  359 + $dto->setDblIdProtocolo2($request->getAttribute('route')->getArgument('protocolo'));
352 360 }
353   - if($request->getParam('protocoloFormatadoVinculado')){
354   - $dto->setProtocoloProcedimentoVinculado($request->getParam('protocoloFormatadoVinculado'));
  361 + $dto->setDblIdProtocolo1($request->getParam('protocoloDestino'));
  362 + if($request->getParam('motivo')){
  363 + $dto->setStrMotivo(MdWsSeiRest::dataToIso88591($request->getParam('motivo')));
355 364 }
356   - $dto->setMotivo(MdWsSeiRest::dataToIso88591($request->getParam('motivo')));
  365 +
357 366 return $response->withJSON($rn->sobrestamentoProcesso($dto));
358 367 });
359 368 $this->post('/{procedimento}/ciencia', function($request, $response, $args){
... ... @@ -531,6 +540,14 @@ $app->group('/api/v1',function(){
531 540  
532 541 return $response->withJSON($rn->concederCredenciamento($dto));
533 542 });
  543 + $this->post('/{procedimento}/credenciamento/renunciar', function($request, $response, $args){
  544 + /** @var $request Slim\Http\Request */
  545 + $rn = new MdWsSeiCredenciamentoRN();
  546 + $dto = new ProcedimentoDTO();
  547 + $dto->setDblIdProcedimento($request->getAttribute('route')->getArgument('procedimento'));
  548 +
  549 + return $response->withJSON($rn->renunciarCredencial($dto));
  550 + });
534 551 $this->post('/{procedimento}/credenciamento/cassar', function($request, $response, $args){
535 552 /** @var $request Slim\Http\Request */
536 553 $rn = new MdWsSeiCredenciamentoRN();
... ...
rn/MdWsSeiBlocoRN.php
... ... @@ -8,6 +8,25 @@ class MdWsSeiBlocoRN extends InfraRN {
8 8 }
9 9  
10 10 /**
  11 + * Método que retorna o bloco de assinatura
  12 + * @param BlocoDTO $blocoDTO
  13 + * @return array
  14 + */
  15 + protected function retornarControlado(BlocoDTO $blocoDTO){
  16 + try{
  17 + if(!$blocoDTO->isSetNumIdBloco()){
  18 + throw new Exception('Bloco não informado!');
  19 + }
  20 + $blocoRN = new BlocoRN();
  21 + $blocoRN->retornar(array($blocoDTO));
  22 +
  23 + return MdWsSeiRest::formataRetornoSucessoREST('Bloco retornado com sucesso!');
  24 + }catch (Exception $e){
  25 + return MdWsSeiRest::formataRetornoErroREST($e);
  26 + }
  27 + }
  28 +
  29 + /**
11 30 * Consultar Blocos
12 31 * @param BlocoDTO $blocoDTO
13 32 * @return array
... ...
rn/MdWsSeiCredenciamentoRN.php
... ... @@ -109,4 +109,26 @@ class MdWsSeiCredenciamentoRN extends InfraRN {
109 109 }
110 110 }
111 111  
  112 + /**
  113 + * Método de reununcia de credencial de acesso
  114 + * @param ProcedimentoDTO $procedimentoDTO
  115 + * @return array
  116 + */
  117 + protected function renunciarCredencialControlado(ProcedimentoDTO $procedimentoDTO){
  118 + try{
  119 + $temPermissao = SessaoSEI::getInstance()->verificarPermissao('procedimento_credencial_renunciar');
  120 + if(!$temPermissao){
  121 + throw new Exception("O usuário não tem permissão para renunciar!");
  122 + }
  123 + if(!$procedimentoDTO->isSetDblIdProcedimento()){
  124 + throw new Exception("O processo não foi informado!");
  125 + }
  126 + $atividadeRN = new AtividadeRN();
  127 + $atividadeRN->renunciarCredenciais($procedimentoDTO);
  128 + return MdWsSeiRest::formataRetornoSucessoREST("Credencial renunciada com sucesso!");
  129 + }catch (Exception $e){
  130 + return MdWsSeiRest::formataRetornoErroREST($e);
  131 + }
  132 + }
  133 +
112 134 }
113 135 \ No newline at end of file
... ...
rn/MdWsSeiProcedimentoRN.php
... ... @@ -10,6 +10,21 @@ class MdWsSeiProcedimentoRN extends InfraRN
10 10 }
11 11  
12 12 /**
  13 + * Consulta o processo pelo protocolo
  14 + * @param $protocolo
  15 + * @return array
  16 + */
  17 + public function apiConsultarProcessoDigitado($protocolo){
  18 + try{
  19 + $result = ProcedimentoINT::pesquisarDigitadoRI1023($protocolo);
  20 +
  21 + return MdWsSeiRest::formataRetornoSucessoREST(null, $result);
  22 + }catch (Exception $e){
  23 + return MdWsSeiRest::formataRetornoErroREST($e);
  24 + }
  25 + }
  26 +
  27 + /**
13 28 * Retorna o total de unidades do processo
14 29 * @param ProtocoloDTO $protocoloDTO
15 30 * @return array
... ... @@ -88,14 +103,20 @@ class MdWsSeiProcedimentoRN extends InfraRN
88 103  
89 104 /**
90 105 * Metodo de sobrestamento de processo
91   - * @param EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI
  106 + * @param RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO
92 107 * @return array
93 108 */
94   - protected function sobrestamentoProcessoControlado(EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI)
  109 + protected function sobrestamentoProcessoControlado(RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO)
95 110 {
96 111 try {
97   - $seiRN = new SeiRN();
98   - $seiRN->sobrestarProcesso($entradaSobrestarProcessoAPI);
  112 + if(!$relProtocoloProtocoloDTO->isSetDblIdProtocolo2()){
  113 + throw new Exception('Processo não informado!');
  114 + }
  115 + if(!$relProtocoloProtocoloDTO->isSetStrMotivo()){
  116 + throw new Exception('Informe o motivo!');
  117 + }
  118 + $procedimentoRN = new ProcedimentoRN();
  119 + $procedimentoRN->sobrestarRN1014(array($relProtocoloProtocoloDTO));
99 120  
100 121 return MdWsSeiRest::formataRetornoSucessoREST('Processo sobrestado com sucesso');
101 122 } catch (Exception $e) {
... ... @@ -367,6 +388,7 @@ class MdWsSeiProcedimentoRN extends InfraRN
367 388 $documentoNovo = 'N';
368 389 $documentoPublicado = 'N';
369 390 $possuiAnotacao = 'N';
  391 + $podeGerenciarCredenciais = 'N';
370 392 $possuiAnotacaoPrioridade = 'N';
371 393 $usuarioVisualizacao = 'N';
372 394 $tipoVisualizacao = 'N';
... ... @@ -548,6 +570,10 @@ class MdWsSeiProcedimentoRN extends InfraRN
548 570 $arrDadosAbertura = $this->listarUnidadeAberturaProcedimento($procedimentoDTOParam);
549 571 }
550 572  
  573 + if($protocoloDTO->getStrStaNivelAcessoGlobal() == ProtocoloRN::$NA_SIGILOSO){
  574 + $podeGerenciarCredenciais = SessaoSEI::getInstance()->verificarPermissao('procedimento_credencial_gerenciar') ? 'S' : 'N';
  575 + }
  576 +
551 577 $result[] = array(
552 578 'id' => $protocoloDTO->getDblIdProtocolo(),
553 579 'status' => $protocoloDTO->getStrStaProtocolo(),
... ... @@ -584,7 +610,8 @@ class MdWsSeiProcedimentoRN extends InfraRN
584 610 'processoBloqueado' => $processoBloqueado,
585 611 'processoDocumentoIncluidoAssinado' => $processoDocumentoIncluidoAssinado,
586 612 'processoPublicado' => $processoPublicado,
587   - 'nivelAcessoGlobal' => $protocoloDTO->getStrStaNivelAcessoGlobal()
  613 + 'nivelAcessoGlobal' => $protocoloDTO->getStrStaNivelAcessoGlobal(),
  614 + 'podeGerenciarCredenciais' => $podeGerenciarCredenciais
588 615 )
589 616 )
590 617 );
... ...