Commit 072d5b7c9b175d1bff97360c4e2d5a6cd62a94ae

Authored by Eduardo Heinske
1 parent 8b03f071

Correção no recebimento de processos com documentos cancelados e com hash's igua…

…is. Recebimento de processos com a unidade geradora
rn/PenAtualizadorRN.php
... ... @@ -14,7 +14,7 @@ abstract class PenAtualizadorRN extends InfraRN {
14 14 const VER_005 = '0.0.5';
15 15 const VER_006 = '0.0.6';
16 16 const VER_007 = '0.0.7';
17   - // const VER_008 = '0.0.8';
  17 + const VER_008 = '0.0.8';
18 18  
19 19 protected $sei_versao;
20 20  
... ...
rn/PenAtualizarSeiRN.php
... ... @@ -929,6 +929,23 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
929 929 $objInfraSequencia->criarSequencia('md_pen_recibo_tramite_hash', '1', '1', '9999999999');
930 930 }
931 931 }
  932 +
  933 + protected function instalarV008R004S006IW003(){
  934 +
  935 + $objBD = new GenericoBD($this->inicializarObjInfraIBanco());
  936 +
  937 + $objTarefaDTO = new TarefaDTO();
  938 + $objTarefaDTO->setStrIdTarefaModulo('PEN_PROCESSO_RECEBIDO');
  939 + $objTarefaDTO->retNumIdTarefa();
  940 +
  941 + $objTarefaDTO = $objBD->consultar($objTarefaDTO);
  942 +
  943 + $objTarefaDTO->setStrSinLancarAndamentoFechado('N');
  944 + $objTarefaDTO->setStrSinPermiteProcessoFechado('S');
  945 +
  946 + $objBD->alterar($objTarefaDTO);
  947 +
  948 + }
932 949  
933 950 /* protected function instalarV008R004S006WI001(){
934 951 $objMetaBD = $this->inicializarObjMetaBanco();
... ...
rn/PendenciasTramiteRN.php
... ... @@ -55,7 +55,8 @@ class PendenciasTramiteRN extends InfraRN {
55 55 InfraDebug::getInstance()->setBolEcho(false);
56 56 InfraDebug::getInstance()->limpar();
57 57  
58   - SessaoSEI::getInstance(false)->simularLogin(SessaoSEI::$USUARIO_SEI, SessaoSEI::$UNIDADE_TESTE);
  58 + $objInfraParametro = new InfraParametro(BancoSEI::getInstance());
  59 + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objInfraParametro->getValor('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO'));
59 60  
60 61 $numSeg = InfraUtil::verificarTempoProcessamento();
61 62 InfraDebug::getInstance()->gravar('MONITORANDO OS TRÂMITES PENDENTES ENVIADOS PARA O ÓRGÃO (PEN)');
... ...
rn/ReceberProcedimentoRN.php
... ... @@ -81,6 +81,9 @@ class ReceberProcedimentoRN extends InfraRN
81 81 protected function receberProcedimentoControlado($parNumIdentificacaoTramite)
82 82 {
83 83  
  84 + $objInfraParametro = new InfraParametro(BancoSEI::getInstance());
  85 + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objInfraParametro->getValor('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO'));
  86 +
84 87 $objSeiRN = new SeiRN();
85 88  
86 89 error_log(__METHOD__.'('.$parNumIdentificacaoTramite.')');
... ... @@ -487,10 +490,9 @@ class ReceberProcedimentoRN extends InfraRN
487 490 $numIdUnidade = $objAtividadeDTO->getNumIdUnidade();
488 491 }
489 492  
490   - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $numIdUnidade);
491 493  
492 494 $objSeiRN = new SeiRN();
493   -
  495 +
494 496 $objAtividadeDTO = new AtividadeDTO();
495 497 $objAtividadeDTO->retDthConclusao();
496 498 $objAtividadeDTO->setDblIdProtocolo($parDblIdProcedimento);
... ... @@ -504,7 +506,18 @@ class ReceberProcedimentoRN extends InfraRN
504 506 $flgReabrir = false;
505 507 }
506 508 }
  509 +
  510 + $objProcedimentoDTO = new ProcedimentoDTO();
  511 + $objProcedimentoDTO->setDblIdProcedimento($parDblIdProcedimento);
  512 + $objProcedimentoDTO->retTodos();
  513 + $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado();
507 514  
  515 + $objProcedimentoRN = new ProcedimentoRN();
  516 + $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO);
  517 +
  518 + $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento);
  519 +
  520 +
508 521 if($flgReabrir){
509 522 $objEntradaReabrirProcessoAPI = new EntradaReabrirProcessoAPI();
510 523 $objEntradaReabrirProcessoAPI->setIdProcedimento($parDblIdProcedimento);
... ... @@ -516,21 +529,10 @@ class ReceberProcedimentoRN extends InfraRN
516 529 $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI();
517 530 $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento);
518 531 $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI);
519   -
520   -
521   -
522   - $objProcedimentoDTO = new ProcedimentoDTO();
523   - $objProcedimentoDTO->setDblIdProcedimento($parDblIdProcedimento);
524   - $objProcedimentoDTO->retTodos();
525   - $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado();
526   -
527   - $objProcedimentoRN = new ProcedimentoRN();
528   - $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO);
529   -
  532 +
530 533 //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento
531 534 $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario);
532 535  
533   - $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento, $objUnidadeDTO);
534 536 $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento);
535 537 $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTO);
536 538  
... ... @@ -641,7 +643,7 @@ class ReceberProcedimentoRN extends InfraRN
641 643 $objProcedimentoDTOGerado = $objProcedimentoRN->gerarRN0156($objProcedimentoDTO);
642 644 $objProcedimentoDTO->setDblIdProcedimento($objProcedimentoDTOGerado->getDblIdProcedimento());
643 645  
644   - $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento, $objUnidadeDTO);
  646 + $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento);
645 647 $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento);
646 648 $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTOGerado);
647 649  
... ... @@ -677,7 +679,7 @@ class ReceberProcedimentoRN extends InfraRN
677 679 $objAtividadeRN->excluirRN0034($objAtividadeRN->listarRN0036($objAtividadeDTO));
678 680 }
679 681  
680   - private function registrarAndamentoRecebimentoProcesso(ProcedimentoDTO $objProcedimentoDTO, $parObjMetadadosProcedimento, $objUnidadeDTO)
  682 + private function registrarAndamentoRecebimentoProcesso(ProcedimentoDTO $objProcedimentoDTO, $parObjMetadadosProcedimento)
681 683 {
682 684 //Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@
683 685 //TODO: Atribuir atributos necessários para formação da mensagem do andamento
... ... @@ -751,7 +753,10 @@ class ReceberProcedimentoRN extends InfraRN
751 753 $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario());
752 754 $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO));
753 755 $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO);
754   -
  756 + $objAtividadeDTO->setDthConclusao(null);
  757 + $objAtividadeDTO->setNumIdUsuarioConclusao(null);
  758 + $objAtividadeDTO->setStrSinInicial('N');
  759 +
755 760 $objAtividadeRN = new AtividadeRN();
756 761 $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO);
757 762  
... ... @@ -910,7 +915,7 @@ class ReceberProcedimentoRN extends InfraRN
910 915 $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco());
911 916 $arrObjComponenteDigitalDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO);
912 917 $arrObjComponenteDigitalDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjComponenteDigitalDTO, "Ordem");
913   - $arrStrHashConteudo = InfraArray::converterArrInfraDTO($arrObjComponenteDigitalDTO, 'IdDocumento', 'HashConteudo');
  918 + // $arrStrHashConteudo = InfraArray::converterArrInfraDTO($arrObjComponenteDigitalDTO, 'IdDocumento', 'HashConteudo');
914 919  
915 920 $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco());
916 921 $objSeiRN = new SeiRN();
... ... @@ -920,16 +925,17 @@ class ReceberProcedimentoRN extends InfraRN
920 925 foreach($arrObjDocumentos as $objDocumento){
921 926  
922 927 // @join_tec US027 (#3498)
923   - // Previne que o documento digital seja cadastrado na base de dados
924 928 if(isset($objDocumento->retirado) && $objDocumento->retirado === true) {
925 929  
926   - $strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash);
  930 + //$strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash);
927 931  
928 932 // Caso já esteja cadastrado, de um reenvio anterior, então move para bloqueado
929   - if(array_key_exists($strHashConteudo, $arrStrHashConteudo)) {
  933 + if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) {
930 934  
931 935 //Busca o ID do protocolo
932   - $dblIdProtocolo = $arrStrHashConteudo[$strHashConteudo];
  936 + //$dblIdProtocolo = $arrStrHashConteudo[$strHashConteudo];
  937 + $objComponenteIndexado = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem];
  938 + $dblIdProtocolo = $objComponenteIndexado->getDblIdDocumento();
933 939  
934 940 //Instancia o DTO do protocolo
935 941 $objProtocoloDTO = new ProtocoloDTO();
... ... @@ -939,12 +945,12 @@ class ReceberProcedimentoRN extends InfraRN
939 945 $objProtocoloDTO = $objProtocoloBD->consultar($objProtocoloDTO);
940 946  
941 947 if($objProtocoloDTO->getStrStaEstado() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){
942   - //Instancia o DTO do protocolo
943   - $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI();
944   - $objEntradaCancelarDocumentoAPI->setIdDocumento($dblIdProtocolo);
945   - $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente');
946   -
947   - $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI);
  948 + //Instancia o DTO do protocolo
  949 + $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI();
  950 + $objEntradaCancelarDocumentoAPI->setIdDocumento($dblIdProtocolo);
  951 + $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente');
  952 +
  953 + $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI);
948 954  
949 955 }
950 956  
... ... @@ -1103,13 +1109,8 @@ class ReceberProcedimentoRN extends InfraRN
1103 1109 $objDocumentoDTO->setStrConteudo(null);
1104 1110 //$objDocumentoDTO->setStrSinFormulario('N');
1105 1111  
1106   - // @join_tec US027 (#3498)
1107   - $numIdUnidadeGeradora = $this->objInfraParametro->getValor('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO', false);
1108   - // Registro existe e pode estar vazio
1109   - if(!empty($numIdUnidadeGeradora)) {
1110   - $objDocumentoDTO->getObjProtocoloDTO()->setNumIdUnidadeGeradora($numIdUnidadeGeradora);
1111   - }
1112   - $objDocumentoDTO->setStrSinBloqueado('S');
  1112 + $objDocumentoDTO->getObjProtocoloDTO()->setNumIdUnidadeGeradora(SessaoSEI::getInstance()->getNumIdUnidadeAtual());
  1113 + $objDocumentoDTO->setStrSinBloqueado('S');
1113 1114  
1114 1115 //TODO: Fazer a atribuição dos componentes digitais do processo a partir desse ponto
1115 1116 $this->atribuirComponentesDigitais($objDocumentoDTO, $objDocumento->componenteDigital);
... ... @@ -1136,7 +1137,7 @@ class ReceberProcedimentoRN extends InfraRN
1136 1137 }
1137 1138  
1138 1139 }
1139   -
  1140 +
1140 1141 foreach($this->documentosRetirados as $documentoCancelado){
1141 1142 //Instancia o DTO do protocolo
1142 1143 $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI();
... ... @@ -1147,6 +1148,10 @@ class ReceberProcedimentoRN extends InfraRN
1147 1148 }
1148 1149  
1149 1150 $objProcedimentoDTO->setArrObjDocumentoDTO($arrObjDocumentoDTO);
  1151 +
  1152 + /* if($numIdUnidadeAtual != $numIdUnidadeGeradora){
  1153 + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $numIdUnidadeAtual);
  1154 + } */
1150 1155 }
1151 1156  
1152 1157 //TODO: Método deverá poderá ser transferido para a classe responsável por fazer o recebimento dos componentes digitais
... ...