Commit d0acf77a7d30f2d8c74304c464f725c304ac2ca1
1 parent
8e8fb0e5
Exists in
master
and in
1 other branch
[Feat] Alterando para retornar as unidades de abertura do processo independente …
…de haver ou não pendências na unidade do usuário.
Showing
2 changed files
with
89 additions
and
111 deletions
Show diff stats
controlador_ws.php
| ... | ... | @@ -413,23 +413,6 @@ $app->group('/api/v1',function(){ |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | return $response->withJSON($rn->pesquisarProcessosSolar($dto)); |
| 416 | - exit; | |
| 417 | - | |
| 418 | - | |
| 419 | - $dto = new MdWsSeiProtocoloDTO(); | |
| 420 | - if($request->getParam('grupo')){ | |
| 421 | - $dto->setNumIdGrupoAcompanhamentoProcedimento($request->getParam('grupo')); | |
| 422 | - } | |
| 423 | - if($request->getParam('protocoloPesquisa')){ | |
| 424 | - $dto->setStrProtocoloFormatadoPesquisa($request->getParam('protocoloPesquisa')); | |
| 425 | - } | |
| 426 | - if($request->getParam('limit')){ | |
| 427 | - $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); | |
| 428 | - } | |
| 429 | - if(!is_null($request->getParam('start'))){ | |
| 430 | - $dto->setNumPaginaAtual($request->getParam('start')); | |
| 431 | - } | |
| 432 | - return $response->withJSON($rn->pesquisarProcedimento($dto)); | |
| 433 | 416 | }); |
| 434 | 417 | $this->get('/listar/meus/acompanhamentos', function($request, $response, $args){ |
| 435 | 418 | /** @var $request Slim\Http\Request */ | ... | ... |
rn/MdWsSeiProcedimentoRN.php
| ... | ... | @@ -541,12 +541,11 @@ class MdWsSeiProcedimentoRN extends InfraRN |
| 541 | 541 | 'staAnotacao' => $anotacaoDTO->getStrStaAnotacao() |
| 542 | 542 | ); |
| 543 | 543 | } |
| 544 | - if ($procedimentoDTO && $procedimentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_PROCEDIMENTO_ANEXADO) { | |
| 545 | - $ret = $this->listarUnidadeAberturaProcedimento($procedimentoDTO); | |
| 546 | - if (!$ret['sucesso']) { | |
| 547 | - throw new Exception($ret['mensagem']); | |
| 548 | - } | |
| 549 | - $arrDadosAbertura = $ret['data']; | |
| 544 | + if ($protocoloDTO->getStrStaEstado() != ProtocoloRN::$TE_PROCEDIMENTO_ANEXADO) { | |
| 545 | + $procedimentoDTOParam = new ProcedimentoDTO(); | |
| 546 | + $procedimentoDTOParam->setDblIdProcedimento($protocoloDTO->getDblIdProtocolo()); | |
| 547 | + $procedimentoDTOParam->setStrStaNivelAcessoGlobalProtocolo($protocoloDTO->getStrStaNivelAcessoGlobal()); | |
| 548 | + $arrDadosAbertura = $this->listarUnidadeAberturaProcedimento($procedimentoDTOParam); | |
| 550 | 549 | } |
| 551 | 550 | |
| 552 | 551 | $result[] = array( |
| ... | ... | @@ -596,118 +595,114 @@ class MdWsSeiProcedimentoRN extends InfraRN |
| 596 | 595 | |
| 597 | 596 | protected function listarUnidadeAberturaProcedimentoConectado(ProcedimentoDTO $procedimentoDTO) |
| 598 | 597 | { |
| 599 | - try { | |
| 600 | - $result = array(); | |
| 601 | - $atividadeRN = new MdWsSeiAtividadeRN(); | |
| 602 | - $strStaNivelAcessoGlobal = $procedimentoDTO->getStrStaNivelAcessoGlobalProtocolo(); | |
| 603 | - $dblIdProcedimento = $procedimentoDTO->getDblIdProcedimento(); | |
| 604 | - $atividadeDTO = new AtividadeDTO(); | |
| 605 | - $atividadeDTO->setDistinct(true); | |
| 606 | - $atividadeDTO->retStrSiglaUnidade(); | |
| 607 | - $atividadeDTO->retNumIdUnidade(); | |
| 608 | - $atividadeDTO->retStrDescricaoUnidade(); | |
| 609 | - | |
| 610 | - $atividadeDTO->setOrdStrSiglaUnidade(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 611 | - | |
| 612 | - if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | |
| 613 | - $atividadeDTO->retNumIdUsuario(); | |
| 614 | - $atividadeDTO->retStrSiglaUsuario(); | |
| 615 | - $atividadeDTO->retStrNomeUsuario(); | |
| 616 | - } else { | |
| 617 | - $atividadeDTO->retNumIdUsuarioAtribuicao(); | |
| 618 | - $atividadeDTO->retStrSiglaUsuarioAtribuicao(); | |
| 619 | - $atividadeDTO->retStrNomeUsuarioAtribuicao(); | |
| 598 | + $result = array(); | |
| 599 | + $atividadeRN = new MdWsSeiAtividadeRN(); | |
| 600 | + $strStaNivelAcessoGlobal = $procedimentoDTO->getStrStaNivelAcessoGlobalProtocolo(); | |
| 601 | + $dblIdProcedimento = $procedimentoDTO->getDblIdProcedimento(); | |
| 602 | + $atividadeDTO = new AtividadeDTO(); | |
| 603 | + $atividadeDTO->setDistinct(true); | |
| 604 | + $atividadeDTO->retStrSiglaUnidade(); | |
| 605 | + $atividadeDTO->retNumIdUnidade(); | |
| 606 | + $atividadeDTO->retStrDescricaoUnidade(); | |
| 607 | + | |
| 608 | + $atividadeDTO->setOrdStrSiglaUnidade(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 609 | + | |
| 610 | + if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | |
| 611 | + $atividadeDTO->retNumIdUsuario(); | |
| 612 | + $atividadeDTO->retStrSiglaUsuario(); | |
| 613 | + $atividadeDTO->retStrNomeUsuario(); | |
| 614 | + } else { | |
| 615 | + $atividadeDTO->retNumIdUsuarioAtribuicao(); | |
| 616 | + $atividadeDTO->retStrSiglaUsuarioAtribuicao(); | |
| 617 | + $atividadeDTO->retStrNomeUsuarioAtribuicao(); | |
| 620 | 618 | |
| 621 | - //ordena descendente pois no envio de processo que já existe na unidade e está atribuído ficará com mais de um andamento em aberto | |
| 622 | - //desta forma os andamentos com usuário nulo (envios do processo) serão listados depois | |
| 623 | - $atividadeDTO->setOrdStrSiglaUsuarioAtribuicao(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 619 | + //ordena descendente pois no envio de processo que já existe na unidade e está atribuído ficará com mais de um andamento em aberto | |
| 620 | + //desta forma os andamentos com usuário nulo (envios do processo) serão listados depois | |
| 621 | + $atividadeDTO->setOrdStrSiglaUsuarioAtribuicao(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 624 | 622 | |
| 625 | - } | |
| 626 | - $atividadeDTO->setDblIdProtocolo($dblIdProcedimento); | |
| 627 | - $atividadeDTO->setDthConclusao(null); | |
| 623 | + } | |
| 624 | + $atividadeDTO->setDblIdProtocolo($dblIdProcedimento); | |
| 625 | + $atividadeDTO->setDthConclusao(null); | |
| 628 | 626 | |
| 629 | - //sigiloso sem credencial nao considera o usuario atual | |
| 630 | - if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | |
| 627 | + //sigiloso sem credencial nao considera o usuario atual | |
| 628 | + if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | |
| 631 | 629 | |
| 632 | - $acessoDTO = new AcessoDTO(); | |
| 633 | - $acessoDTO->setDistinct(true); | |
| 634 | - $acessoDTO->retNumIdUsuario(); | |
| 635 | - $acessoDTO->setDblIdProtocolo($dblIdProcedimento); | |
| 636 | - $acessoDTO->setStrStaTipo(AcessoRN::$TA_CREDENCIAL_PROCESSO); | |
| 630 | + $acessoDTO = new AcessoDTO(); | |
| 631 | + $acessoDTO->setDistinct(true); | |
| 632 | + $acessoDTO->retNumIdUsuario(); | |
| 633 | + $acessoDTO->setDblIdProtocolo($dblIdProcedimento); | |
| 634 | + $acessoDTO->setStrStaTipo(AcessoRN::$TA_CREDENCIAL_PROCESSO); | |
| 637 | 635 | |
| 638 | - $acessoRN = new AcessoRN(); | |
| 639 | - $arrAcessoDTO = $acessoRN->listar($acessoDTO); | |
| 636 | + $acessoRN = new AcessoRN(); | |
| 637 | + $arrAcessoDTO = $acessoRN->listar($acessoDTO); | |
| 640 | 638 | |
| 641 | - $atividadeDTO->setNumIdUsuario(InfraArray::converterArrInfraDTO($arrAcessoDTO, 'IdUsuario'), InfraDTO::$OPER_IN); | |
| 642 | - } | |
| 643 | - $arrAtividadeDTO = $atividadeRN->listarRN0036($atividadeDTO); | |
| 639 | + $atividadeDTO->setNumIdUsuario(InfraArray::converterArrInfraDTO($arrAcessoDTO, 'IdUsuario'), InfraDTO::$OPER_IN); | |
| 640 | + } | |
| 641 | + $arrAtividadeDTO = $atividadeRN->listarRN0036($atividadeDTO); | |
| 644 | 642 | |
| 645 | - if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 646 | - $arrAtividadeDTO = InfraArray::distinctArrInfraDTO($arrAtividadeDTO, 'SiglaUnidade'); | |
| 647 | - } | |
| 648 | - if (count($arrAtividadeDTO) == 0) { | |
| 649 | - $result['info'] = 'Processo não possui andamentos abertos.'; | |
| 650 | - $result['lista'] = array(); | |
| 651 | - $result['unidades'] = array(); | |
| 652 | - } else { | |
| 653 | - if (count($arrAtividadeDTO) == 1) { | |
| 643 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 644 | + $arrAtividadeDTO = InfraArray::distinctArrInfraDTO($arrAtividadeDTO, 'SiglaUnidade'); | |
| 645 | + } | |
| 646 | + if (count($arrAtividadeDTO) == 0) { | |
| 647 | + $result['info'] = 'Processo não possui andamentos abertos.'; | |
| 648 | + $result['lista'] = array(); | |
| 649 | + $result['unidades'] = array(); | |
| 650 | + } else { | |
| 651 | + if (count($arrAtividadeDTO) == 1) { | |
| 652 | + $atividadeDTO = $arrAtividadeDTO[0]; | |
| 653 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 654 | + $result['info'] = 'Processo aberto somente na unidade:'; | |
| 655 | + $result['unidades'][] = array( | |
| 656 | + 'id' => $atividadeDTO->getNumIdUnidade(), | |
| 657 | + 'nome' => $atividadeDTO->getStrSiglaUnidade() | |
| 658 | + ); | |
| 659 | + $result['lista'][] = array( | |
| 660 | + 'sigla' => $atividadeDTO->getStrSiglaUnidade() | |
| 661 | + ); | |
| 662 | + } else { | |
| 663 | + $result['info'] = 'Processo aberto com o usuário:'; | |
| 654 | 664 | $atividadeDTO = $arrAtividadeDTO[0]; |
| 655 | - if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 656 | - $result['info'] = 'Processo aberto somente na unidade:'; | |
| 665 | + $result['unidades'][] = array( | |
| 666 | + 'id' => $atividadeDTO->getNumIdUnidade(), | |
| 667 | + 'nome' => $atividadeDTO->getStrSiglaUnidade() | |
| 668 | + ); | |
| 669 | + $result['lista'][] = array( | |
| 670 | + 'sigla' => $atividadeDTO->getStrNomeUsuario() | |
| 671 | + ); | |
| 672 | + } | |
| 673 | + } else { | |
| 674 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 675 | + $result['info'] = 'Processo aberto nas unidades:'; | |
| 676 | + foreach ($arrAtividadeDTO as $atividadeDTO) { | |
| 657 | 677 | $result['unidades'][] = array( |
| 658 | 678 | 'id' => $atividadeDTO->getNumIdUnidade(), |
| 659 | 679 | 'nome' => $atividadeDTO->getStrSiglaUnidade() |
| 660 | 680 | ); |
| 681 | + $sigla = $atividadeDTO->getStrSiglaUnidade(); | |
| 682 | + if ($atividadeDTO->getNumIdUsuarioAtribuicao() != null) { | |
| 683 | + $sigla .= ' (atribuído a ' . $atividadeDTO->getStrNomeUsuarioAtribuicao() . ')'; | |
| 684 | + } | |
| 661 | 685 | $result['lista'][] = array( |
| 662 | - 'sigla' => $atividadeDTO->getStrSiglaUnidade() | |
| 686 | + 'sigla' => $sigla | |
| 663 | 687 | ); |
| 664 | - } else { | |
| 665 | - $result['info'] = 'Processo aberto com o usuário:'; | |
| 666 | - $atividadeDTO = $arrAtividadeDTO[0]; | |
| 688 | + } | |
| 689 | + } else { | |
| 690 | + $result['info'] = 'Processo aberto com os usuários:'; | |
| 691 | + foreach ($arrAtividadeDTO as $atividadeDTO) { | |
| 667 | 692 | $result['unidades'][] = array( |
| 668 | 693 | 'id' => $atividadeDTO->getNumIdUnidade(), |
| 669 | 694 | 'nome' => $atividadeDTO->getStrSiglaUnidade() |
| 670 | 695 | ); |
| 696 | + $sigla = $atividadeDTO->getStrNomeUsuario() . ' na unidade ' . $atividadeDTO->getStrSiglaUnidade(); | |
| 671 | 697 | $result['lista'][] = array( |
| 672 | - 'sigla' => $atividadeDTO->getStrNomeUsuario() | |
| 698 | + 'sigla' => $sigla | |
| 673 | 699 | ); |
| 674 | 700 | } |
| 675 | - } else { | |
| 676 | - if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | |
| 677 | - $result['info'] = 'Processo aberto nas unidades:'; | |
| 678 | - foreach ($arrAtividadeDTO as $atividadeDTO) { | |
| 679 | - $result['unidades'][] = array( | |
| 680 | - 'id' => $atividadeDTO->getNumIdUnidade(), | |
| 681 | - 'nome' => $atividadeDTO->getStrSiglaUnidade() | |
| 682 | - ); | |
| 683 | - $sigla = $atividadeDTO->getStrSiglaUnidade(); | |
| 684 | - if ($atividadeDTO->getNumIdUsuarioAtribuicao() != null) { | |
| 685 | - $sigla .= ' (atribuído a ' . $atividadeDTO->getStrNomeUsuarioAtribuicao() . ')'; | |
| 686 | - } | |
| 687 | - $result['lista'][] = array( | |
| 688 | - 'sigla' => $sigla | |
| 689 | - ); | |
| 690 | - } | |
| 691 | - } else { | |
| 692 | - $result['info'] = 'Processo aberto com os usuários:'; | |
| 693 | - foreach ($arrAtividadeDTO as $atividadeDTO) { | |
| 694 | - $result['unidades'][] = array( | |
| 695 | - 'id' => $atividadeDTO->getNumIdUnidade(), | |
| 696 | - 'nome' => $atividadeDTO->getStrSiglaUnidade() | |
| 697 | - ); | |
| 698 | - $sigla = $atividadeDTO->getStrNomeUsuario() . ' na unidade ' . $atividadeDTO->getStrSiglaUnidade(); | |
| 699 | - $result['lista'][] = array( | |
| 700 | - 'sigla' => $sigla | |
| 701 | - ); | |
| 702 | - } | |
| 703 | - } | |
| 704 | 701 | } |
| 705 | 702 | } |
| 706 | - | |
| 707 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | |
| 708 | - } catch (Exception $e) { | |
| 709 | - return MdWsSeiRest::formataRetornoErroREST($e); | |
| 710 | 703 | } |
| 704 | + | |
| 705 | + return $result; | |
| 711 | 706 | } |
| 712 | 707 | |
| 713 | 708 | /** | ... | ... |