Commit 98a213521de656603d374dd5977edb09881b210d
1 parent
e79a8d8a
Exists in
master
and in
21 other branches
Sprint 5
Showing
4 changed files
with
77 additions
and
19 deletions
Show diff stats
pen_procedimento_expedir.php
@@ -99,7 +99,11 @@ try { | @@ -99,7 +99,11 @@ try { | ||
99 | 99 | ||
100 | $objUnidadeRN = new UnidadeRN(); | 100 | $objUnidadeRN = new UnidadeRN(); |
101 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | 101 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
102 | - | 102 | + |
103 | + if (!$objUnidadeDTO) { | ||
104 | + throw new InfraException("A unidade atual não foi mapeada."); | ||
105 | + } | ||
106 | + | ||
103 | $numIdUnidadeOrigem = $objUnidadeDTO->getNumIdUnidadeRH(); | 107 | $numIdUnidadeOrigem = $objUnidadeDTO->getNumIdUnidadeRH(); |
104 | $numIdProcedimento = $_POST['hdnIdProcedimento']; | 108 | $numIdProcedimento = $_POST['hdnIdProcedimento']; |
105 | $strProtocoloProcedimentoFormatado = $_POST['txtProtocoloExibir']; | 109 | $strProtocoloProcedimentoFormatado = $_POST['txtProtocoloExibir']; |
rn/ExpedirProcedimentoRN.php
@@ -1651,7 +1651,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1651,7 +1651,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1651 | $objPenRelHipoteseLegalEnvioRN = new PenRelHipoteseLegalEnvioRN(); | 1651 | $objPenRelHipoteseLegalEnvioRN = new PenRelHipoteseLegalEnvioRN(); |
1652 | 1652 | ||
1653 | foreach($arrDocumentoDTO as $objDocumentoDTO) { | 1653 | foreach($arrDocumentoDTO as $objDocumentoDTO) { |
1654 | - | ||
1655 | $objDocMapDTO->unSetTodos(); | 1654 | $objDocMapDTO->unSetTodos(); |
1656 | $objDocMapDTO->setNumIdSerie($objDocumentoDTO->getNumIdSerie()); | 1655 | $objDocMapDTO->setNumIdSerie($objDocumentoDTO->getNumIdSerie()); |
1657 | 1656 | ||
@@ -1675,7 +1674,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1675,7 +1674,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1675 | $objHipoteseLegalRN = new HipoteseLegalRN(); | 1674 | $objHipoteseLegalRN = new HipoteseLegalRN(); |
1676 | $dados = $objHipoteseLegalRN->consultar($objHipoteseLegalDTO); | 1675 | $dados = $objHipoteseLegalRN->consultar($objHipoteseLegalDTO); |
1677 | 1676 | ||
1678 | - $objInfraException->adicionarValidacao('Hipótese Legal "'.$dados->getStrNome().'" do Documento Não foi Mapeada', $strAtributoValidacao); | 1677 | + $objInfraException->adicionarValidacao('Hipótese Legal "'.$dados->getStrNome().'" do Documento '.$objDocumentoDTO->getStrNomeSerie(). ' ' . $objDocumentoDTO->getStrProtocoloDocumentoFormatado() .' Não foi Mapeada', $strAtributoValidacao); |
1679 | } | 1678 | } |
1680 | } | 1679 | } |
1681 | } | 1680 | } |
@@ -1723,7 +1722,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1723,7 +1722,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1723 | if (empty($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo())) { | 1722 | if (empty($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo())) { |
1724 | $objInfraException->adicionarValidacao('Não é possível expedir processo de nível restrito sem a hipótese legal mapeada.', $strAtributoValidacao); | 1723 | $objInfraException->adicionarValidacao('Não é possível expedir processo de nível restrito sem a hipótese legal mapeada.', $strAtributoValidacao); |
1725 | } | 1724 | } |
1726 | - | ||
1727 | } | 1725 | } |
1728 | } | 1726 | } |
1729 | 1727 | ||
@@ -2309,10 +2307,10 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -2309,10 +2307,10 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
2309 | throw new InfraException("O sistema destinatário já recebeu esse processo, portanto não é possivel realizar o cancelamento"); | 2307 | throw new InfraException("O sistema destinatário já recebeu esse processo, portanto não é possivel realizar o cancelamento"); |
2310 | break; | 2308 | break; |
2311 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | 2309 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: |
2312 | - throw new InfraException("O processo já se encontra cancelado"); | 2310 | + throw new InfraException("O trâmite externo para esse processo já se encontra cancelado."); |
2313 | break; | 2311 | break; |
2314 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | 2312 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: |
2315 | - throw new InfraException("O processo se encontra recusado"); | 2313 | + throw new InfraException("O trâmite externo para esse processo se encontra recusado."); |
2316 | break; | 2314 | break; |
2317 | } | 2315 | } |
2318 | 2316 |
rn/ProcessoEletronicoRN.php
@@ -402,10 +402,13 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -402,10 +402,13 @@ class ProcessoEletronicoRN extends InfraRN { | ||
402 | //error_log("PARAMETROS:" . print_r($parametros, true)); | 402 | //error_log("PARAMETROS:" . print_r($parametros, true)); |
403 | return $this->getObjPenWs()->enviarProcesso($parametros); | 403 | return $this->getObjPenWs()->enviarProcesso($parametros); |
404 | } catch (\SoapFault $fault) { | 404 | } catch (\SoapFault $fault) { |
405 | - //error_log("REQUEST:" . $this->getObjPenWs()->__getLastRequest()); | ||
406 | - //error_log("ERROR:" . print_r($fault, true)); | ||
407 | - $mensagem = $this->tratarFalhaWebService($fault); | ||
408 | - | 405 | + |
406 | + | ||
407 | + if (!empty($fault->detail->interoperabilidadeException->codigoErro) && $fault->detail->interoperabilidadeException->codigoErro == '0005') { | ||
408 | + $mensagem = 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; | ||
409 | + } else { | ||
410 | + $mensagem = $this->tratarFalhaWebService($fault); | ||
411 | + } | ||
409 | //TODO: Remover formatação do javascript após resolução do BUG enviado para Mairon | 412 | //TODO: Remover formatação do javascript após resolução do BUG enviado para Mairon |
410 | //relacionado ao a renderização de mensagens de erro na barra de progresso | 413 | //relacionado ao a renderização de mensagens de erro na barra de progresso |
411 | error_log($mensagem); | 414 | error_log($mensagem); |
rn/ReceberProcedimentoRN.php
@@ -11,6 +11,8 @@ class ReceberProcedimentoRN extends InfraRN | @@ -11,6 +11,8 @@ class ReceberProcedimentoRN extends InfraRN | ||
11 | private $objInfraParametro; | 11 | private $objInfraParametro; |
12 | private $objProcedimentoAndamentoRN; | 12 | private $objProcedimentoAndamentoRN; |
13 | private $documentosRetirados = array(); | 13 | private $documentosRetirados = array(); |
14 | + | ||
15 | + public $destinatarioReal = null; | ||
14 | 16 | ||
15 | public function __construct() | 17 | public function __construct() |
16 | { | 18 | { |
@@ -90,9 +92,16 @@ class ReceberProcedimentoRN extends InfraRN | @@ -90,9 +92,16 @@ class ReceberProcedimentoRN extends InfraRN | ||
90 | if (!isset($parNumIdentificacaoTramite)) { | 92 | if (!isset($parNumIdentificacaoTramite)) { |
91 | throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | 93 | throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); |
92 | } | 94 | } |
93 | - | 95 | + |
96 | + | ||
94 | //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados | 97 | //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados |
95 | $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); | 98 | $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); |
99 | + | ||
100 | + //!Substituir a unidade destinatária para a receptora (!1!) | ||
101 | + if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { | ||
102 | + $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario->numeroDeIdentificacaoDaEstrutura; | ||
103 | + $objMetadadosProcedimento->metadados->destinatario = $objMetadadosProcedimento->metadados->unidadeReceptora; | ||
104 | + } | ||
96 | 105 | ||
97 | if (isset($objMetadadosProcedimento)) { | 106 | if (isset($objMetadadosProcedimento)) { |
98 | 107 | ||
@@ -453,8 +462,6 @@ class ReceberProcedimentoRN extends InfraRN | @@ -453,8 +462,6 @@ class ReceberProcedimentoRN extends InfraRN | ||
453 | if(!isset($objMetadadosProcedimento)){ | 462 | if(!isset($objMetadadosProcedimento)){ |
454 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); | 463 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
455 | } | 464 | } |
456 | - | ||
457 | - $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | ||
458 | 465 | ||
459 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la | 466 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la |
460 | 467 | ||
@@ -489,7 +496,6 @@ class ReceberProcedimentoRN extends InfraRN | @@ -489,7 +496,6 @@ class ReceberProcedimentoRN extends InfraRN | ||
489 | $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); | 496 | $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); |
490 | } | 497 | } |
491 | 498 | ||
492 | - | ||
493 | $objSeiRN = new SeiRN(); | 499 | $objSeiRN = new SeiRN(); |
494 | 500 | ||
495 | $objAtividadeDTO = new AtividadeDTO(); | 501 | $objAtividadeDTO = new AtividadeDTO(); |
@@ -528,7 +534,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -528,7 +534,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
528 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | 534 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
529 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | 535 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); |
530 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | 536 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
531 | - | 537 | + |
532 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento | 538 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento |
533 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); | 539 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); |
534 | 540 | ||
@@ -612,9 +618,25 @@ class ReceberProcedimentoRN extends InfraRN | @@ -612,9 +618,25 @@ class ReceberProcedimentoRN extends InfraRN | ||
612 | $strDescricao .= $objProcesso->observacao; | 618 | $strDescricao .= $objProcesso->observacao; |
613 | 619 | ||
614 | $objObservacaoDTO = new ObservacaoDTO(); | 620 | $objObservacaoDTO = new ObservacaoDTO(); |
615 | - $objObservacaoDTO->setStrDescricao($strDescricao); | ||
616 | - $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | 621 | + |
622 | + //!Criação da observação de aviso para qual é a real unidade emitida (!2!) | ||
623 | + if ($this->destinatarioReal) { | ||
624 | + $objUnidadeDTO = new PenUnidadeDTO(); | ||
625 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | ||
626 | + $objUnidadeDTO->setStrSinAtivo('S'); | ||
627 | + $objUnidadeDTO->retStrDescricao(); | ||
617 | 628 | ||
629 | + $objUnidadeRN = new UnidadeRN(); | ||
630 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | ||
631 | + $objObservacaoDTO->setStrDescricao($strDescricao . PHP_EOL .'Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | ||
632 | + } else { | ||
633 | + $objObservacaoDTO->setStrDescricao($strDescricao); | ||
634 | + } | ||
635 | + | ||
636 | + //throw new InfraException(var_export($objObservacaoDTO, true)); | ||
637 | + | ||
638 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | ||
639 | + | ||
618 | //Atribuição de dados do procedimento | 640 | //Atribuição de dados do procedimento |
619 | //TODO: Validar cada uma das informações de entrada do webservice | 641 | //TODO: Validar cada uma das informações de entrada do webservice |
620 | $objProcedimentoDTO = new ProcedimentoDTO(); | 642 | $objProcedimentoDTO = new ProcedimentoDTO(); |
@@ -768,6 +790,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -768,6 +790,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
768 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | 790 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
769 | } | 791 | } |
770 | 792 | ||
793 | + | ||
771 | $objAtividadeDTO = new AtividadeDTO(); | 794 | $objAtividadeDTO = new AtividadeDTO(); |
772 | $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | 795 | $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); |
773 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | 796 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
@@ -780,7 +803,37 @@ class ReceberProcedimentoRN extends InfraRN | @@ -780,7 +803,37 @@ class ReceberProcedimentoRN extends InfraRN | ||
780 | 803 | ||
781 | $objAtividadeRN = new AtividadeRN(); | 804 | $objAtividadeRN = new AtividadeRN(); |
782 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | 805 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
783 | - | 806 | + |
807 | + | ||
808 | + //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | ||
809 | + if ($this->destinatarioReal) { | ||
810 | + $objUnidadeDTO = new PenUnidadeDTO(); | ||
811 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | ||
812 | + $objUnidadeDTO->setStrSinAtivo('S'); | ||
813 | + $objUnidadeDTO->retStrDescricao(); //descricao | ||
814 | + $objUnidadeRN = new UnidadeRN(); | ||
815 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | ||
816 | + | ||
817 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | ||
818 | + $objAtributoAndamentoDTO->setStrNome('DESCRICAO'); | ||
819 | + $objAtributoAndamentoDTO->setStrValor('Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | ||
820 | + $objAtributoAndamentoDTO->setStrIdOrigem($objNivel->numeroDeIdentificacaoDaEstrutura); | ||
821 | + | ||
822 | + $arrObjAtributoAndamentoDTO = array($objAtributoAndamentoDTO); | ||
823 | + | ||
824 | + $objAtividadeDTO = new AtividadeDTO(); | ||
825 | + $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | ||
826 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
827 | + $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
828 | + $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ATUALIZACAO_ANDAMENTO); | ||
829 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | ||
830 | + $objAtividadeDTO->setDthConclusao(null); | ||
831 | + $objAtividadeDTO->setNumIdUsuarioConclusao(null); | ||
832 | + $objAtividadeDTO->setStrSinInicial('N'); | ||
833 | + | ||
834 | + $objAtividadeRN = new AtividadeRN(); | ||
835 | + $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | ||
836 | + } | ||
784 | } | 837 | } |
785 | 838 | ||
786 | 839 | ||
@@ -879,7 +932,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -879,7 +932,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
879 | } | 932 | } |
880 | 933 | ||
881 | protected function atribuirDadosUnidade(ProcedimentoDTO $objProcedimentoDTO, $objDestinatario){ | 934 | protected function atribuirDadosUnidade(ProcedimentoDTO $objProcedimentoDTO, $objDestinatario){ |
882 | - | 935 | + |
883 | if(!isset($objDestinatario)){ | 936 | if(!isset($objDestinatario)){ |
884 | throw new InfraException('Parâmetro $objDestinatario não informado.'); | 937 | throw new InfraException('Parâmetro $objDestinatario não informado.'); |
885 | } | 938 | } |