Commit f6e960cd5e3717baac7911c16ee20287f447cfde
1 parent
5c9a4667
Exists in
master
and in
1 other branch
[FEAT] Adicionando sobrestar proceso.
Showing
3 changed files
with
147 additions
and
9 deletions
Show diff stats
controlador_ws.php
| ... | ... | @@ -6,8 +6,10 @@ |
| 6 | 6 | require_once dirname(__FILE__).'/../../SEI.php'; |
| 7 | 7 | require_once dirname(__FILE__).'/vendor/autoload.php'; |
| 8 | 8 | |
| 9 | +ini_set('xdebug.var_display_max_depth', 100); | |
| 10 | +ini_set('xdebug.var_display_max_children', 100); | |
| 11 | +ini_set('xdebug.var_display_max_data', 2048); | |
| 9 | 12 | //echo '<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>'; |
| 10 | -mb_internal_encoding('utf-8'); | |
| 11 | 13 | |
| 12 | 14 | |
| 13 | 15 | function response_to_utf8($item){ |
| ... | ... | @@ -185,6 +187,32 @@ $app->group('/api/v1',function(){ |
| 185 | 187 | $dto->setDblIdProcedimento($request->getParam('procedimento')); |
| 186 | 188 | return $response->withJSON(response_to_utf8($rn->removerSobrestamentoProcesso($dto))); |
| 187 | 189 | }); |
| 190 | + $this->get('/listar/ciencia/{protocolo}', function($request, $response, $args){ | |
| 191 | + /** @var $request Slim\Http\Request */ | |
| 192 | + $rn = new MdWsSeiProcedimentoRN(); | |
| 193 | + $dto = new ProtocoloDTO(); | |
| 194 | + $dto->setDblIdProtocolo($request->getAttribute('route')->getArgument('protocolo')); | |
| 195 | + return $response->withJSON(response_to_utf8($rn->listarCienciaProcesso($dto))); | |
| 196 | + }); | |
| 197 | + $this->post('/sobrestar/processo', function($request, $response, $args){ | |
| 198 | + /** @var $request Slim\Http\Request */ | |
| 199 | + $rn = new MdWsSeiProcedimentoRN(); | |
| 200 | + $dto = new EntradaSobrestarProcessoAPI(); | |
| 201 | + if($request->getParam('protocoloFormatado')){ | |
| 202 | + $dto->setProtocoloProcedimento($request->getParam('protocoloFormatado')); | |
| 203 | + } | |
| 204 | + if($request->getParam('protocolo')){ | |
| 205 | + $dto->setIdProcedimento($request->getParam('protocolo')); | |
| 206 | + } | |
| 207 | + if($request->getParam('protocoloVinculado')){ | |
| 208 | + $dto->setIdProcedimentoVinculado($request->getParam('protocoloVinculado')); | |
| 209 | + } | |
| 210 | + if($request->getParam('protocoloFormatadoVinculado')){ | |
| 211 | + $dto->setProtocoloProcedimentoVinculado($request->getParam('protocoloFormatadoVinculado')); | |
| 212 | + } | |
| 213 | + $dto->setMotivo($request->getParam('motivo')); | |
| 214 | + return $response->withJSON(response_to_utf8($rn->sobrestamentoProcesso($dto))); | |
| 215 | + }); | |
| 188 | 216 | |
| 189 | 217 | })->add( new TokenValidationMiddleware()); |
| 190 | 218 | }); | ... | ... |
rn/MdWsSeiProcedimentoRN.php
| ... | ... | @@ -8,13 +8,51 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | + * Metodo de sobrestamento de processo | |
| 12 | + * @param EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI | |
| 13 | + * @return array | |
| 14 | + */ | |
| 15 | + protected function sobrestamentoProcessoControlado(EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI){ | |
| 16 | + try{ | |
| 17 | + $seiRN = new SeiRN(); | |
| 18 | + $seiRN->sobrestarProcesso($entradaSobrestarProcessoAPI); | |
| 19 | + return array( | |
| 20 | + 'sucesso' => true, | |
| 21 | + 'mensage' => 'Processo sobrestado com sucesso' | |
| 22 | + ); | |
| 23 | + }catch (Exception $e){ | |
| 24 | + $mensagem = $e->getMessage(); | |
| 25 | + if($e instanceof InfraException){ | |
| 26 | + if(!$e->getStrDescricao()){ | |
| 27 | + /** @var InfraValidacaoDTO $validacaoDTO */ | |
| 28 | + if(count($e->getArrObjInfraValidacao()) == 1){ | |
| 29 | + $mensagem = $e->getArrObjInfraValidacao()[0]->getStrDescricao(); | |
| 30 | + }else{ | |
| 31 | + foreach($e->getArrObjInfraValidacao() as $validacaoDTO){ | |
| 32 | + $mensagem[] = $validacaoDTO->getStrDescricao(); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + }else{ | |
| 36 | + $mensagem = $e->getStrDescricao(); | |
| 37 | + } | |
| 38 | + | |
| 39 | + } | |
| 40 | + return array ( | |
| 41 | + "sucesso" => false, | |
| 42 | + "mensagem" => $mensagem, | |
| 43 | + "exception" => $e | |
| 44 | + ); | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 11 | 49 | * @param $protocolo |
| 12 | 50 | * @return array |
| 13 | 51 | */ |
| 14 | 52 | protected function removerSobrestamentoProcessoControlado(ProcedimentoDTO $procedimentoDTOParam){ |
| 15 | 53 | try{ |
| 16 | 54 | if(!$procedimentoDTOParam->getDblIdProcedimento()){ |
| 17 | - throw new InfraException('Procedimento n�o informado.'); | |
| 55 | + throw new InfraException('Procedimento n?o informado.'); | |
| 18 | 56 | } |
| 19 | 57 | $seiRN = new SeiRN(); |
| 20 | 58 | $entradaRemoverSobrestamentoProcessoAPI = new EntradaRemoverSobrestamentoProcessoAPI(); |
| ... | ... | @@ -133,7 +171,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 133 | 171 | } |
| 134 | 172 | |
| 135 | 173 | if(!$mdWsSeiProtocoloDTOConsulta->isSetNumIdUnidadeAtividade()){ |
| 136 | - throw new InfraException('� obrigat�rio informar a unidade.'); | |
| 174 | + throw new InfraException('Unidade não informada.'); | |
| 137 | 175 | } |
| 138 | 176 | $mdWsSeiProtocoloDTO->setNumIdUnidadeAtividade($mdWsSeiProtocoloDTOConsulta->getNumIdUnidadeAtividade()); |
| 139 | 177 | |
| ... | ... | @@ -339,6 +377,71 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 339 | 377 | return ['retornoProgramado' => $retProgramado, 'expirado' => $expirado]; |
| 340 | 378 | } |
| 341 | 379 | |
| 380 | + /** | |
| 381 | + * Metodo que retorna as ciencias nos processos | |
| 382 | + * @param ProtocoloDTO $protocoloDTOParam | |
| 383 | + * @return array | |
| 384 | + */ | |
| 385 | + protected function listarCienciaProcessoConectado(ProtocoloDTO $protocoloDTOParam){ | |
| 386 | + try{ | |
| 387 | + if(!$protocoloDTOParam->isSetDblIdProtocolo()){ | |
| 388 | + throw new InfraException('Protocolo não informado.'); | |
| 389 | + } | |
| 390 | + | |
| 391 | + $result = array(); | |
| 392 | + $mdWsSeiProcessoRN = new MdWsSeiProcessoRN(); | |
| 393 | + $atividadeDTOConsulta = new AtividadeDTO(); | |
| 394 | + $atividadeDTOConsulta->setDblIdProtocolo($protocoloDTOParam->getDblIdProtocolo()); | |
| 395 | + $atividadeDTOConsulta->setNumIdTarefa(TarefaRN::$TI_PROCESSO_CIENCIA); | |
| 396 | + $atividadeDTOConsulta->retDthAbertura(); | |
| 397 | + $atividadeDTOConsulta->retStrSiglaUnidade(); | |
| 398 | + $atividadeDTOConsulta->retStrNomeTarefa(); | |
| 399 | + $atividadeDTOConsulta->retStrSiglaUsuarioOrigem(); | |
| 400 | + $atividadeDTOConsulta->retNumIdAtividade(); | |
| 401 | + $atividadeRN = new AtividadeRN(); | |
| 402 | + $ret = $atividadeRN->listarRN0036($atividadeDTOConsulta); | |
| 403 | + /** @var AtividadeDTO $atividadeDTO */ | |
| 404 | + foreach($ret as $atividadeDTO){ | |
| 405 | + $mdWsSeiProcessoDTO = new MdWsSeiProcessoDTO(); | |
| 406 | + $mdWsSeiProcessoDTO->setStrTemplate($atividadeDTO->getStrNomeTarefa()); | |
| 407 | + $mdWsSeiProcessoDTO->setNumIdAtividade($atividadeDTO->getNumIdAtividade()); | |
| 408 | + $result[] = array( | |
| 409 | + 'data' => $atividadeDTO->getDthAbertura(), | |
| 410 | + 'unidade' => $atividadeDTO->getStrSiglaUnidade(), | |
| 411 | + 'nome' => $atividadeDTO->getStrSiglaUsuarioOrigem(), | |
| 412 | + 'descricao' => $mdWsSeiProcessoRN->traduzirTemplate($mdWsSeiProcessoDTO) | |
| 413 | + ); | |
| 414 | + } | |
| 415 | + return array( | |
| 416 | + 'sucesso' => true, | |
| 417 | + 'data' => $result | |
| 418 | + ); | |
| 419 | + }catch (Exception $e){ | |
| 420 | + $mensagem = $e->getMessage(); | |
| 421 | + if($e instanceof InfraException){ | |
| 422 | + if(!$e->getStrDescricao()){ | |
| 423 | + /** @var InfraValidacaoDTO $validacaoDTO */ | |
| 424 | + if(count($e->getArrObjInfraValidacao()) == 1){ | |
| 425 | + $mensagem = $e->getArrObjInfraValidacao()[0]->getStrDescricao(); | |
| 426 | + }else{ | |
| 427 | + foreach($e->getArrObjInfraValidacao() as $validacaoDTO){ | |
| 428 | + $mensagem[] = $validacaoDTO->getStrDescricao(); | |
| 429 | + } | |
| 430 | + } | |
| 431 | + }else{ | |
| 432 | + $mensagem = $e->getStrDescricao(); | |
| 433 | + } | |
| 434 | + | |
| 435 | + } | |
| 436 | + | |
| 437 | + return array ( | |
| 438 | + "sucesso" => false, | |
| 439 | + "mensagem" => $mensagem, | |
| 440 | + "exception" => $e | |
| 441 | + ); | |
| 442 | + } | |
| 443 | + } | |
| 444 | + | |
| 342 | 445 | |
| 343 | 446 | /** |
| 344 | 447 | * Metodo que da ciencia ao processo/procedimento |
| ... | ... | @@ -357,7 +460,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 357 | 460 | |
| 358 | 461 | return array( |
| 359 | 462 | 'sucesso' => true, |
| 360 | - 'mensagem' => 'Ciência processo realizado com sucesso!' | |
| 463 | + 'mensagem' => 'Ciência processo realizado com sucesso!' | |
| 361 | 464 | ); |
| 362 | 465 | }catch (Exception $e){ |
| 363 | 466 | $mensagem = $e->getMessage(); |
| ... | ... | @@ -387,7 +490,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 387 | 490 | /** |
| 388 | 491 | * Metodo que conclui o procedimento/processo |
| 389 | 492 | * @param EntradaConcluirProcessoAPI $entradaConcluirProcessoAPI |
| 390 | - * @info ele recebe o n�mero do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo | |
| 493 | + * @info ele recebe o n?mero do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo | |
| 391 | 494 | * @return array |
| 392 | 495 | */ |
| 393 | 496 | protected function concluirProcessoControlado(EntradaConcluirProcessoAPI $entradaConcluirProcessoAPI){ |
| ... | ... | @@ -401,7 +504,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 401 | 504 | |
| 402 | 505 | return array( |
| 403 | 506 | 'sucesso' => true, |
| 404 | - 'mensagem' => 'Processo concluÃdo com sucesso!' | |
| 507 | + 'mensagem' => 'Processo concluído com sucesso!' | |
| 405 | 508 | ); |
| 406 | 509 | }catch (Exception $e){ |
| 407 | 510 | $mensagem = $e->getMessage(); |
| ... | ... | @@ -432,7 +535,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 432 | 535 | * Metodo que atribui o processo a uma pessoa |
| 433 | 536 | * @param EntradaAtribuirProcessoAPI $entradaAtribuirProcessoAPI |
| 434 | 537 | * @info Os parametros IdUsuario, ProtocoloProcedimento e SinReabrir sao obrigatorios. O parametro ProtocoloProcedimento |
| 435 | - * recebe o n�mero do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo | |
| 538 | + * recebe o n?mero do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo | |
| 436 | 539 | * @return array |
| 437 | 540 | */ |
| 438 | 541 | protected function atribuirProcessoControlado(EntradaAtribuirProcessoAPI $entradaAtribuirProcessoAPI){ |
| ... | ... | @@ -441,7 +544,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 441 | 544 | throw new InfraException('E obrigatorio informar o protocolo do processo!'); |
| 442 | 545 | } |
| 443 | 546 | if(!$entradaAtribuirProcessoAPI->getIdUsuario()){ |
| 444 | - throw new InfraException('E obrigatorio informar o usu�rio do processo!'); | |
| 547 | + throw new InfraException('E obrigatorio informar o usu?rio do processo!'); | |
| 445 | 548 | } |
| 446 | 549 | |
| 447 | 550 | $objSeiRN = new SeiRN(); |
| ... | ... | @@ -449,7 +552,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 449 | 552 | |
| 450 | 553 | return array( |
| 451 | 554 | 'sucesso' => true, |
| 452 | - 'mensagem' => 'Processo atribuÃdo com sucesso!' | |
| 555 | + 'mensagem' => 'Processo atribuído com sucesso!' | |
| 453 | 556 | ); |
| 454 | 557 | }catch (Exception $e){ |
| 455 | 558 | $mensagem = $e->getMessage(); | ... | ... |
teste.php
| ... | ... | @@ -101,6 +101,13 @@ class TesteProcedimento { |
| 101 | 101 | var_dump($rn->removerSobrestamentoProcesso($dto)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | + public function listarCienciaProcessoConectado(){ | |
| 105 | + $rn = new MdWsSeiProcedimentoRN(); | |
| 106 | + $dto = new ProtocoloDTO(); | |
| 107 | + $dto->setDblIdProtocolo(15); | |
| 108 | + var_dump($rn->listarCienciaProcesso($dto)); | |
| 109 | + } | |
| 110 | + | |
| 104 | 111 | //o----- |
| 105 | 112 | |
| 106 | 113 | public function concluirProcessoControlado(){ | ... | ... |