Commit 0941bd81ed7a76cf192901959e922015a09cd102
Exists in
master
and in
21 other branches
Correção de bug de retransmissão de processos/documentos restritos
Showing
4 changed files
with
336 additions
and
270 deletions
Show diff stats
rn/PENAgendamentoRN.php
@@ -252,7 +252,7 @@ class PENAgendamentoRN extends InfraRN { | @@ -252,7 +252,7 @@ class PENAgendamentoRN extends InfraRN { | ||
252 | "Favor, entrar em contato com a equipe de suporte técnico."; | 252 | "Favor, entrar em contato com a equipe de suporte técnico."; |
253 | throw new InfraException($msg, $e); | 253 | throw new InfraException($msg, $e); |
254 | } else { | 254 | } else { |
255 | - LogSEI::getInstance()->gravar("Todos os serviços estão rodando."); | 255 | + LogSEI::getInstance()->gravar("Todos os serviços necessários na integração com o Processo Eletrônico Nacional - PEN estão ativos."); |
256 | } | 256 | } |
257 | } catch (Exception $e) { | 257 | } catch (Exception $e) { |
258 | throw new InfraException('Erro ao analisar status do serviços Gearmand e Supervisord', $e); | 258 | throw new InfraException('Erro ao analisar status do serviços Gearmand e Supervisord', $e); |
@@ -307,7 +307,6 @@ class PENAgendamentoRN extends InfraRN { | @@ -307,7 +307,6 @@ class PENAgendamentoRN extends InfraRN { | ||
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | - | ||
311 | LogSEI::getInstance()->gravar("Hipóteses Legais atualizadas."); | 310 | LogSEI::getInstance()->gravar("Hipóteses Legais atualizadas."); |
312 | } catch (Exception $e) { | 311 | } catch (Exception $e) { |
313 | throw new InfraException('Erro no agendamento das Hipóteses Legais', $e); | 312 | throw new InfraException('Erro no agendamento das Hipóteses Legais', $e); |
rn/PenParametroRN.php
@@ -107,7 +107,7 @@ class PenParametroRN extends InfraRN { | @@ -107,7 +107,7 @@ class PenParametroRN extends InfraRN { | ||
107 | $objPenParametroDTO->retStrValor(); | 107 | $objPenParametroDTO->retStrValor(); |
108 | 108 | ||
109 | if($this->contar($objPenParametroDTO) > 0) { | 109 | if($this->contar($objPenParametroDTO) > 0) { |
110 | - $objPenParametroDTO = $this->consultarControlado($objPenParametroDTO); | 110 | + $objPenParametroDTO = $this->consultar($objPenParametroDTO); |
111 | return $objPenParametroDTO->getStrValor(); | 111 | return $objPenParametroDTO->getStrValor(); |
112 | } | 112 | } |
113 | } | 113 | } |
rn/PendenciasTramiteRN.php
1 | -<?php | ||
2 | - | ||
3 | -require_once dirname(__FILE__) . '/../../../SEI.php'; | ||
4 | - | ||
5 | -error_reporting(E_ALL); | ||
6 | - | ||
7 | -//TODO: Modificar nome da classe e mtodo para outro mais apropriado | ||
8 | -class PendenciasTramiteRN extends InfraRN { | ||
9 | - | ||
10 | - private static $instance = null; | ||
11 | - private $strEnderecoServicoPendencias = null; | ||
12 | - private $strLocalizacaoCertificadoDigital = null; | ||
13 | - private $strSenhaCertificadoDigital = null; | ||
14 | - | ||
15 | - protected function inicializarObjInfraIBanco(){ | ||
16 | - return BancoSEI::getInstance(); | ||
17 | - } | ||
18 | - | ||
19 | - public static function getInstance() { | ||
20 | - if (self::$instance == null) { | ||
21 | - self::$instance = new PendenciasTramiteRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | ||
22 | - } | ||
23 | - | ||
24 | - return self::$instance; | ||
25 | - } | ||
26 | - | ||
27 | - public function __construct() { | ||
28 | - $objPenParametroRN = new PenParametroRN(); | ||
29 | - | ||
30 | - $this->strLocalizacaoCertificadoDigital = $objPenParametroRN->getParametro('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL'); | ||
31 | - $this->strEnderecoServicoPendencias = $objPenParametroRN->getParametro('PEN_ENDERECO_WEBSERVICE_PENDENCIAS'); | ||
32 | - //TODO: Urgente - Remover senha do certificado de autenticao dos servios do PEN da tabela de parâmetros | ||
33 | - $this->strSenhaCertificadoDigital = $objPenParametroRN->getParametro('PEN_SENHA_CERTIFICADO_DIGITAL'); | ||
34 | - | ||
35 | - if (InfraString::isBolVazia($this->strEnderecoServicoPendencias)) { | ||
36 | - throw new InfraException('Endereço do serviço de pendências de trâmite do Processo Eletrônico Nacional (PEN) não informado.'); | ||
37 | - } | ||
38 | - | ||
39 | - if (!@file_get_contents($this->strLocalizacaoCertificadoDigital)) { | ||
40 | - throw new InfraException("Certificado digital de autenticação do serviço de integração do Processo Eletrônico Nacional(PEN) não encontrado."); | ||
41 | - } | ||
42 | - | ||
43 | - if (InfraString::isBolVazia($this->strSenhaCertificadoDigital)) { | ||
44 | - throw new InfraException('Dados de autenticação do serviço de integração do Processo Eletrónico Nacional(PEN) não informados.'); | ||
45 | - } | ||
46 | - } | ||
47 | - | ||
48 | - public function monitorarPendencias() { | ||
49 | - try{ | ||
50 | - ini_set('max_execution_time','0'); | ||
51 | - ini_set('memory_limit','-1'); | ||
52 | - | ||
53 | - InfraDebug::getInstance()->setBolLigado(true); | ||
54 | - InfraDebug::getInstance()->setBolDebugInfra(false); | ||
55 | - InfraDebug::getInstance()->setBolEcho(false); | ||
56 | - InfraDebug::getInstance()->limpar(); | ||
57 | - | ||
58 | - $objPenParametroRN = new PenParametroRN(); | ||
59 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | ||
60 | - | ||
61 | - $numSeg = InfraUtil::verificarTempoProcessamento(); | ||
62 | - InfraDebug::getInstance()->gravar('MONITORANDO OS TRÂMITES PENDENTES ENVIADOS PARA O RGO (PEN)'); | ||
63 | - echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de monitoramento de pendências de trâmites de processos...\n"; | ||
64 | - | ||
65 | - try{ | ||
66 | - $numIdTramiteRecebido = 0; | ||
67 | - $strStatusTramiteRecebido = ''; | ||
68 | - $numQuantidadeErroTramite = 0; | ||
69 | - $arrQuantidadeErrosTramite = array(); | ||
70 | - | ||
71 | - //TODO: Tratar quantidade de erros o sistema consecutivos para um tramite de processo | ||
72 | - //Alcanado est quantidade, uma pendncia posterior dever ser obtida do barramento | ||
73 | - while (true) { | ||
74 | - $objPendenciaDTO = $this->obterPendenciasTramite($numIdTramiteRecebido); | ||
75 | - if(isset($objPendenciaDTO)) { | ||
76 | - if($numIdTramiteRecebido != $objPendenciaDTO->getNumIdentificacaoTramite() || | ||
77 | - $strStatusTramiteRecebido != $objPendenciaDTO->getStrStatus()) { | ||
78 | - $numIdTramiteRecebido = $objPendenciaDTO->getNumIdentificacaoTramite(); | ||
79 | - $strStatusTramiteRecebido = $objPendenciaDTO->getStrStatus(); | ||
80 | - $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | ||
81 | - } | ||
82 | - } | ||
83 | - sleep(5); | ||
84 | - } | ||
85 | - } | ||
86 | - //TODO: Urgente: Tratar erro especfico de timeout e refazer a requisio | ||
87 | - catch(Exception $e) { | ||
88 | - $strAssunto = 'Erro monitorando pendências.'; | ||
89 | - $strErro = InfraException::inspecionar($e); | ||
90 | - LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | ||
91 | - } | ||
92 | - | ||
93 | - $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | ||
94 | - InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | ||
95 | - InfraDebug::getInstance()->gravar('FIM'); | ||
96 | - LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | ||
97 | - | ||
98 | - } | ||
99 | - catch(Exception $e) { | ||
100 | - InfraDebug::getInstance()->setBolLigado(false); | ||
101 | - InfraDebug::getInstance()->setBolDebugInfra(false); | ||
102 | - InfraDebug::getInstance()->setBolEcho(false); | ||
103 | - throw new InfraException('Erro processando pendências de integração com o PEN - Processo Eletrônico Nacional.',$e); | ||
104 | - } | ||
105 | - } | ||
106 | - | ||
107 | - private function configurarRequisicao() | ||
108 | - { | ||
109 | - $curl = curl_init($this->strEnderecoServicoPendencias); | ||
110 | - curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias); | ||
111 | - curl_setopt($curl, CURLOPT_HEADER, 0); | ||
112 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | ||
113 | - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | ||
114 | - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | ||
115 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | ||
116 | - curl_setopt($curl, CURLOPT_SSLCERT, $this->strLocalizacaoCertificadoDigital); | ||
117 | - curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->strSenhaCertificadoDigital); | ||
118 | - curl_setopt($curl, CURLOPT_TIMEOUT, 60); //timeout in seconds | ||
119 | - return $curl; | ||
120 | - } | ||
121 | - | ||
122 | - private function obterPendenciasTramite($parNumIdTramiteRecebido) | ||
123 | - { | ||
124 | - $resultado = null; | ||
125 | - $curl = $this->configurarRequisicao(); | ||
126 | - | ||
127 | - try{ | ||
128 | - if(isset($parNumIdTramiteRecebido)) { | ||
129 | - curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias . "?idTramiteDaPendenciaRecebida=" . $parNumIdTramiteRecebido); | ||
130 | - } | ||
131 | - | ||
132 | - //A seguinte requisio ir aguardar a notificao do PEN sobre uma nova pendncia | ||
133 | - //ou at o lanamento da exceo de timeout definido pela infraestrutura da soluo | ||
134 | - //Ambos os comportamentos so esperados para a requisio abaixo. | ||
135 | - $strResultadoJSON = curl_exec($curl); | ||
136 | - | ||
137 | - if(curl_errno($curl)) { | ||
138 | - if (curl_errno($curl) != 28) | ||
139 | - throw new InfraException("Erro na requisição do serviço de monitoramento de pendências. Curl: " . curl_errno($curl)); | ||
140 | - } | ||
141 | - | ||
142 | - if(!InfraString::isBolVazia($strResultadoJSON)) { | ||
143 | - $strResultadoJSON = json_decode($strResultadoJSON); | ||
144 | - | ||
145 | - if(isset($strResultadoJSON) && $strResultadoJSON->encontrou) { | ||
146 | - $objPendenciaDTO = new PendenciaDTO(); | ||
147 | - $objPendenciaDTO->setNumIdentificacaoTramite($strResultadoJSON->IDT); | ||
148 | - $objPendenciaDTO->setStrStatus($strResultadoJSON->status); | ||
149 | - $resultado = $objPendenciaDTO; | ||
150 | - } | ||
151 | - } | ||
152 | - } | ||
153 | - catch(Exception $e){ | ||
154 | - curl_close($curl); | ||
155 | - throw $e; | ||
156 | - } | ||
157 | - | ||
158 | - curl_close($curl); | ||
159 | - return $resultado; | ||
160 | - } | ||
161 | - | ||
162 | - private function enviarPendenciaFilaProcessamento($objPendencia) | ||
163 | - { | ||
164 | - if(isset($objPendencia)) { | ||
165 | - | ||
166 | - $client = new GearmanClient(); | ||
167 | - $client->addServer('localhost', 4730); | ||
168 | - //$client->setCreatedCallback("create_change"); | ||
169 | - //$client->setDataCallback("data_change"); | ||
170 | - //$client->setStatusCallback("status_change"); | ||
171 | - //$client->setCompleteCallback("complete_change"); | ||
172 | - //$client->setFailCallback("fail_change"); | ||
173 | - | ||
174 | - $strWorkload = strval($objPendencia->getNumIdentificacaoTramite()); | ||
175 | - | ||
176 | - switch ($objPendencia->getStrStatus()) { | ||
177 | - | ||
178 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: | ||
179 | - $client->addTaskBackground('enviarComponenteDigital', $strWorkload, null); | ||
180 | - break; | ||
181 | - | ||
182 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE: | ||
183 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO: | ||
184 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO: | ||
185 | - $objPenParametroRN = new PenParametroRN(); | ||
186 | - $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | ||
187 | - $numCont = 0; | ||
188 | - // Executa sempre + 1 alm do configurado no parâmetro para executar a recusa | ||
189 | - while($numCont <= $numTentativas) { | ||
190 | - $client->addTaskBackground('receberProcedimento', $strWorkload, null); | ||
191 | - $numCont++; | ||
192 | - } | ||
193 | - break; | ||
194 | - | ||
195 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: | ||
196 | - $objPenParametroRN = new PenParametroRN(); | ||
197 | - $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | ||
198 | - $numCont = 0; | ||
199 | - | ||
200 | - while($numCont < $numTentativas) { | ||
201 | - $client->addTaskBackground('receberReciboTramite', $strWorkload, null); | ||
202 | - $numCont++; | ||
203 | - } | ||
204 | - break; | ||
205 | - | ||
206 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: | ||
207 | - break; | ||
208 | - | ||
209 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | ||
210 | - break; | ||
211 | - | ||
212 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | ||
213 | - $client->addTaskBackground("receberTramitesRecusados", $strWorkload, null);; | ||
214 | - break; | ||
215 | - | ||
216 | - default: | ||
217 | - //TODO: Alterar lgica para no deixar de processar demais pendncias retornadas pelo PEN | ||
218 | - throw new Exception('Situação do trâmite não pode ser identificada.'); | ||
219 | - break; | ||
220 | - } | ||
221 | - | ||
222 | - $client->runTasks(); | ||
223 | - } | ||
224 | - } | ||
225 | -} | ||
226 | - | ||
227 | -SessaoSEI::getInstance(false); | ||
228 | -PendenciasTramiteRN::getInstance()->monitorarPendencias(); | 1 | +<?php |
2 | + | ||
3 | +require_once dirname(__FILE__) . '/../../../SEI.php'; | ||
4 | + | ||
5 | +error_reporting(E_ALL); | ||
6 | + | ||
7 | +//TODO: Modificar nome da classe e mtodo para outro mais apropriado | ||
8 | +class PendenciasTramiteRN extends InfraRN { | ||
9 | + | ||
10 | + private static $instance = null; | ||
11 | + private $strEnderecoServicoPendencias = null; | ||
12 | + private $strLocalizacaoCertificadoDigital = null; | ||
13 | + private $strSenhaCertificadoDigital = null; | ||
14 | + | ||
15 | + protected function inicializarObjInfraIBanco(){ | ||
16 | + return BancoSEI::getInstance(); | ||
17 | + } | ||
18 | + | ||
19 | + public static function getInstance() { | ||
20 | + if (self::$instance == null) { | ||
21 | + self::$instance = new PendenciasTramiteRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | ||
22 | + } | ||
23 | + | ||
24 | + return self::$instance; | ||
25 | + } | ||
26 | + | ||
27 | + public function __construct() { | ||
28 | + $objPenParametroRN = new PenParametroRN(); | ||
29 | + | ||
30 | + $this->strLocalizacaoCertificadoDigital = $objPenParametroRN->getParametro('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL'); | ||
31 | + $this->strEnderecoServicoPendencias = $objPenParametroRN->getParametro('PEN_ENDERECO_WEBSERVICE_PENDENCIAS'); | ||
32 | + //TODO: Urgente - Remover senha do certificado de autenticao dos servios do PEN da tabela de parâmetros | ||
33 | + $this->strSenhaCertificadoDigital = $objPenParametroRN->getParametro('PEN_SENHA_CERTIFICADO_DIGITAL'); | ||
34 | + | ||
35 | + if (InfraString::isBolVazia($this->strEnderecoServicoPendencias)) { | ||
36 | + throw new InfraException('Endereço do serviço de pendências de trâmite do Processo Eletrônico Nacional (PEN) não informado.'); | ||
37 | + } | ||
38 | + | ||
39 | + if (!@file_get_contents($this->strLocalizacaoCertificadoDigital)) { | ||
40 | + throw new InfraException("Certificado digital de autenticação do serviço de integração do Processo Eletrônico Nacional(PEN) não encontrado."); | ||
41 | + } | ||
42 | + | ||
43 | + if (InfraString::isBolVazia($this->strSenhaCertificadoDigital)) { | ||
44 | + throw new InfraException('Dados de autenticação do serviço de integração do Processo Eletrónico Nacional(PEN) não informados.'); | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + public function monitorarPendencias() { | ||
49 | + try{ | ||
50 | + ini_set('max_execution_time','0'); | ||
51 | + ini_set('memory_limit','-1'); | ||
52 | + | ||
53 | + InfraDebug::getInstance()->setBolLigado(true); | ||
54 | + InfraDebug::getInstance()->setBolDebugInfra(false); | ||
55 | + InfraDebug::getInstance()->setBolEcho(false); | ||
56 | + InfraDebug::getInstance()->limpar(); | ||
57 | + | ||
58 | + $objPenParametroRN = new PenParametroRN(); | ||
59 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | ||
60 | + | ||
61 | + $numSeg = InfraUtil::verificarTempoProcessamento(); | ||
62 | + InfraDebug::getInstance()->gravar('MONITORANDO OS TRÂMITES PENDENTES ENVIADOS PARA O RGO (PEN)'); | ||
63 | + echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de monitoramento de pendências de trâmites de processos...\n"; | ||
64 | + | ||
65 | + try{ | ||
66 | + $numIdTramiteRecebido = 0; | ||
67 | + $strStatusTramiteRecebido = ''; | ||
68 | + $numQuantidadeErroTramite = 0; | ||
69 | + $arrQuantidadeErrosTramite = array(); | ||
70 | + | ||
71 | + //TODO: Tratar quantidade de erros o sistema consecutivos para um tramite de processo | ||
72 | + //Alcanado est quantidade, uma pendncia posterior dever ser obtida do barramento | ||
73 | + while (true) { | ||
74 | + $objPendenciaDTO = $this->obterPendenciasTramite($numIdTramiteRecebido); | ||
75 | + if(isset($objPendenciaDTO)) { | ||
76 | + if($numIdTramiteRecebido != $objPendenciaDTO->getNumIdentificacaoTramite() || | ||
77 | + $strStatusTramiteRecebido != $objPendenciaDTO->getStrStatus()) { | ||
78 | + $numIdTramiteRecebido = $objPendenciaDTO->getNumIdentificacaoTramite(); | ||
79 | + $strStatusTramiteRecebido = $objPendenciaDTO->getStrStatus(); | ||
80 | + $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | ||
81 | + } | ||
82 | + } | ||
83 | + sleep(5); | ||
84 | + } | ||
85 | + } | ||
86 | + //TODO: Urgente: Tratar erro especfico de timeout e refazer a requisio | ||
87 | + catch(Exception $e) { | ||
88 | + $strAssunto = 'Erro monitorando pendências.'; | ||
89 | + $strErro = InfraException::inspecionar($e); | ||
90 | + LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | ||
91 | + } | ||
92 | + | ||
93 | + $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | ||
94 | + InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | ||
95 | + InfraDebug::getInstance()->gravar('FIM'); | ||
96 | + LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | ||
97 | + | ||
98 | + } | ||
99 | + catch(Exception $e) { | ||
100 | + InfraDebug::getInstance()->setBolLigado(false); | ||
101 | + InfraDebug::getInstance()->setBolDebugInfra(false); | ||
102 | + InfraDebug::getInstance()->setBolEcho(false); | ||
103 | + throw new InfraException('Erro processando pendências de integração com o PEN - Processo Eletrônico Nacional.',$e); | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + private function configurarRequisicao() | ||
108 | + { | ||
109 | + $curl = curl_init($this->strEnderecoServicoPendencias); | ||
110 | + curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias); | ||
111 | + curl_setopt($curl, CURLOPT_HEADER, 0); | ||
112 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | ||
113 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | ||
114 | + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | ||
115 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | ||
116 | + curl_setopt($curl, CURLOPT_SSLCERT, $this->strLocalizacaoCertificadoDigital); | ||
117 | + curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->strSenhaCertificadoDigital); | ||
118 | + curl_setopt($curl, CURLOPT_TIMEOUT, 60); //timeout in seconds | ||
119 | + return $curl; | ||
120 | + } | ||
121 | + | ||
122 | + private function obterPendenciasTramite($parNumIdTramiteRecebido) | ||
123 | + { | ||
124 | + $resultado = null; | ||
125 | + $curl = $this->configurarRequisicao(); | ||
126 | + | ||
127 | + try{ | ||
128 | + if(isset($parNumIdTramiteRecebido)) { | ||
129 | + curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias . "?idTramiteDaPendenciaRecebida=" . $parNumIdTramiteRecebido); | ||
130 | + } | ||
131 | + | ||
132 | + //A seguinte requisio ir aguardar a notificao do PEN sobre uma nova pendncia | ||
133 | + //ou at o lanamento da exceo de timeout definido pela infraestrutura da soluo | ||
134 | + //Ambos os comportamentos so esperados para a requisio abaixo. | ||
135 | + $strResultadoJSON = curl_exec($curl); | ||
136 | + | ||
137 | + if(curl_errno($curl)) { | ||
138 | + if (curl_errno($curl) != 28) | ||
139 | + throw new InfraException("Erro na requisição do serviço de monitoramento de pendências. Curl: " . curl_errno($curl)); | ||
140 | + } | ||
141 | + | ||
142 | + if(!InfraString::isBolVazia($strResultadoJSON)) { | ||
143 | + $strResultadoJSON = json_decode($strResultadoJSON); | ||
144 | + | ||
145 | + if(isset($strResultadoJSON) && $strResultadoJSON->encontrou) { | ||
146 | + $objPendenciaDTO = new PendenciaDTO(); | ||
147 | + $objPendenciaDTO->setNumIdentificacaoTramite($strResultadoJSON->IDT); | ||
148 | + $objPendenciaDTO->setStrStatus($strResultadoJSON->status); | ||
149 | + $resultado = $objPendenciaDTO; | ||
150 | + } | ||
151 | + } | ||
152 | + } | ||
153 | + catch(Exception $e){ | ||
154 | + curl_close($curl); | ||
155 | + throw $e; | ||
156 | + } | ||
157 | + | ||
158 | + curl_close($curl); | ||
159 | + return $resultado; | ||
160 | + } | ||
161 | + | ||
162 | + private function enviarPendenciaFilaProcessamento($objPendencia) | ||
163 | + { | ||
164 | + if(isset($objPendencia)) { | ||
165 | + | ||
166 | + $client = new GearmanClient(); | ||
167 | + $client->addServer('localhost', 4730); | ||
168 | + //$client->setCreatedCallback("create_change"); | ||
169 | + //$client->setDataCallback("data_change"); | ||
170 | + //$client->setStatusCallback("status_change"); | ||
171 | + //$client->setCompleteCallback("complete_change"); | ||
172 | + //$client->setFailCallback("fail_change"); | ||
173 | + | ||
174 | + $strWorkload = strval($objPendencia->getNumIdentificacaoTramite()); | ||
175 | + | ||
176 | + switch ($objPendencia->getStrStatus()) { | ||
177 | + | ||
178 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: | ||
179 | + $client->addTaskBackground('enviarComponenteDigital', $strWorkload, null); | ||
180 | + break; | ||
181 | + | ||
182 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE: | ||
183 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO: | ||
184 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO: | ||
185 | + $objPenParametroRN = new PenParametroRN(); | ||
186 | + $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | ||
187 | + $numCont = 0; | ||
188 | + // Executa sempre + 1 alm do configurado no parâmetro para executar a recusa | ||
189 | + while($numCont <= $numTentativas) { | ||
190 | + $client->addTaskBackground('receberProcedimento', $strWorkload, null); | ||
191 | + $numCont++; | ||
192 | + } | ||
193 | + break; | ||
194 | + | ||
195 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: | ||
196 | + $objPenParametroRN = new PenParametroRN(); | ||
197 | + $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | ||
198 | + $numCont = 0; | ||
199 | + | ||
200 | + while($numCont < $numTentativas) { | ||
201 | + $client->addTaskBackground('receberReciboTramite', $strWorkload, null); | ||
202 | + $numCont++; | ||
203 | + } | ||
204 | + break; | ||
205 | + | ||
206 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: | ||
207 | + break; | ||
208 | + | ||
209 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | ||
210 | + break; | ||
211 | + | ||
212 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | ||
213 | + $client->addTaskBackground("receberTramitesRecusados", $strWorkload, null);; | ||
214 | + break; | ||
215 | + | ||
216 | + default: | ||
217 | + //TODO: Alterar lgica para no deixar de processar demais pendncias retornadas pelo PEN | ||
218 | + throw new Exception('Situação do trâmite não pode ser identificada.'); | ||
219 | + break; | ||
220 | + } | ||
221 | + | ||
222 | + $client->runTasks(); | ||
223 | + } | ||
224 | + } | ||
225 | +} | ||
226 | + | ||
227 | +SessaoSEI::getInstance(false); | ||
228 | +PendenciasTramiteRN::getInstance()->monitorarPendencias(); |
rn/ReceberProcedimentoRN.php
@@ -99,7 +99,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -99,7 +99,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
99 | 99 | ||
100 | //!Substituir a unidade destinatária para a receptora (!1!) | 100 | //!Substituir a unidade destinatária para a receptora (!1!) |
101 | if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { | 101 | if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { |
102 | - $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario->numeroDeIdentificacaoDaEstrutura; | 102 | + $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario; |
103 | $objMetadadosProcedimento->metadados->destinatario = $objMetadadosProcedimento->metadados->unidadeReceptora; | 103 | $objMetadadosProcedimento->metadados->destinatario = $objMetadadosProcedimento->metadados->unidadeReceptora; |
104 | } | 104 | } |
105 | 105 | ||
@@ -353,8 +353,10 @@ class ReceberProcedimentoRN extends InfraRN | @@ -353,8 +353,10 @@ class ReceberProcedimentoRN extends InfraRN | ||
353 | } | 353 | } |
354 | 354 | ||
355 | 355 | ||
356 | - $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | ||
357 | - $numTamDocExterno = $objInfraParametro->getValor('SEI_TAM_MB_DOC_EXTERNO'); | 356 | +// $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); |
357 | +// $numTamDocExterno = $objInfraParametro->getValor('SEI_TAM_MB_DOC_EXTERNO'); | ||
358 | + $objPenParametroRN = new PenParametroRN(); | ||
359 | + $numTamDocExterno = $objPenParametroRN->getParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO'); | ||
358 | 360 | ||
359 | 361 | ||
360 | foreach($arrObjDocumentos as $objDocument) { | 362 | foreach($arrObjDocumentos as $objDocument) { |
@@ -463,8 +465,13 @@ class ReceberProcedimentoRN extends InfraRN | @@ -463,8 +465,13 @@ class ReceberProcedimentoRN extends InfraRN | ||
463 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); | 465 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
464 | } | 466 | } |
465 | 467 | ||
466 | - $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | ||
467 | - | 468 | + |
469 | + if ($this->destinatarioReal) { | ||
470 | + $objDestinatario = $this->destinatarioReal; | ||
471 | + } else { | ||
472 | + $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | ||
473 | + } | ||
474 | + | ||
468 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la | 475 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la |
469 | 476 | ||
470 | //$objProcedimentoDTO = new ProcedimentoDTO(); | 477 | //$objProcedimentoDTO = new ProcedimentoDTO(); |
@@ -530,9 +537,13 @@ class ReceberProcedimentoRN extends InfraRN | @@ -530,9 +537,13 @@ class ReceberProcedimentoRN extends InfraRN | ||
530 | $objEntradaReabrirProcessoAPI->setIdProcedimento($parDblIdProcedimento); | 537 | $objEntradaReabrirProcessoAPI->setIdProcedimento($parDblIdProcedimento); |
531 | $objSeiRN->reabrirProcesso($objEntradaReabrirProcessoAPI); | 538 | $objSeiRN->reabrirProcesso($objEntradaReabrirProcessoAPI); |
532 | } | 539 | } |
540 | + | ||
541 | + //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | ||
542 | + if ($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura) { | ||
543 | + $this->gerarAndamentoUnidadeReceptora($parDblIdProcedimento); | ||
544 | + } | ||
533 | 545 | ||
534 | 546 | ||
535 | - | ||
536 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | 547 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
537 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | 548 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); |
538 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | 549 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
@@ -546,7 +557,11 @@ class ReceberProcedimentoRN extends InfraRN | @@ -546,7 +557,11 @@ class ReceberProcedimentoRN extends InfraRN | ||
546 | //TODO: Avaliar necessidade de restringir referência circular entre processos | 557 | //TODO: Avaliar necessidade de restringir referência circular entre processos |
547 | //TODO: Registrar que o processo foi recebido com outros apensados. Necessário para posterior reenvio | 558 | //TODO: Registrar que o processo foi recebido com outros apensados. Necessário para posterior reenvio |
548 | $this->atribuirProcessosApensados($objProcedimentoDTO, $objProcesso->processoApensado); | 559 | $this->atribuirProcessosApensados($objProcedimentoDTO, $objProcesso->processoApensado); |
549 | - | 560 | + |
561 | + //Realiza a alteração dos metadados do processo | ||
562 | + //TODO: Implementar alteração de todos os metadados | ||
563 | + $this->alterarMetadadosProcedimento($objProcedimentoDTO->getDblIdProcedimento(), $objProcesso); | ||
564 | + | ||
550 | //TODO: Finalizar o envio do documento para a respectiva unidade | 565 | //TODO: Finalizar o envio do documento para a respectiva unidade |
551 | $this->enviarProcedimentoUnidade($objProcedimentoDTO, true); | 566 | $this->enviarProcedimentoUnidade($objProcedimentoDTO, true); |
552 | 567 | ||
@@ -563,8 +578,39 @@ class ReceberProcedimentoRN extends InfraRN | @@ -563,8 +578,39 @@ class ReceberProcedimentoRN extends InfraRN | ||
563 | 578 | ||
564 | 579 | ||
565 | } | 580 | } |
581 | + | ||
582 | + private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { | ||
583 | + | ||
584 | + $objUnidadeDTO = new PenUnidadeDTO(); | ||
585 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); | ||
586 | + $objUnidadeDTO->setStrSinAtivo('S'); | ||
587 | + $objUnidadeDTO->retStrDescricao(); //descricao | ||
588 | + | ||
589 | + $objUnidadeRN = new UnidadeRN(); | ||
590 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | ||
591 | + | ||
592 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | ||
593 | + $objAtributoAndamentoDTO->setStrNome('DESCRICAO'); | ||
594 | + $objAtributoAndamentoDTO->setStrValor('Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | ||
595 | + $objAtributoAndamentoDTO->setStrIdOrigem($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); | ||
596 | + | ||
597 | + $arrObjAtributoAndamentoDTO = array($objAtributoAndamentoDTO); | ||
598 | + | ||
599 | + $objAtividadeDTO = new AtividadeDTO(); | ||
600 | + $objAtividadeDTO->setDblIdProtocolo($parNumIdProcedimento); | ||
601 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
602 | + $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
603 | + $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ATUALIZACAO_ANDAMENTO); | ||
604 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | ||
605 | + $objAtividadeDTO->setDthConclusao(null); | ||
606 | + $objAtividadeDTO->setNumIdUsuarioConclusao(null); | ||
607 | + $objAtividadeDTO->setStrSinInicial('N'); | ||
608 | + | ||
609 | + $objAtividadeRN = new AtividadeRN(); | ||
610 | + $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | ||
611 | + } | ||
566 | 612 | ||
567 | - private function gerarProcedimento($objMetadadosProcedimento, $objProcesso){ | 613 | + private function gerarProcedimento($objMetadadosProcedimento, $objProcesso){ |
568 | 614 | ||
569 | if(!isset($objMetadadosProcedimento)){ | 615 | if(!isset($objMetadadosProcedimento)){ |
570 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); | 616 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
@@ -624,7 +670,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -624,7 +670,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
624 | //!Criação da observação de aviso para qual é a real unidade emitida (!2!) | 670 | //!Criação da observação de aviso para qual é a real unidade emitida (!2!) |
625 | if ($this->destinatarioReal) { | 671 | if ($this->destinatarioReal) { |
626 | $objUnidadeDTO = new PenUnidadeDTO(); | 672 | $objUnidadeDTO = new PenUnidadeDTO(); |
627 | - $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | 673 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); |
628 | $objUnidadeDTO->setStrSinAtivo('S'); | 674 | $objUnidadeDTO->setStrSinAtivo('S'); |
629 | $objUnidadeDTO->retStrDescricao(); | 675 | $objUnidadeDTO->retStrDescricao(); |
630 | 676 | ||
@@ -711,7 +757,37 @@ class ReceberProcedimentoRN extends InfraRN | @@ -711,7 +757,37 @@ class ReceberProcedimentoRN extends InfraRN | ||
711 | return $objProcedimentoDTO; | 757 | return $objProcedimentoDTO; |
712 | } | 758 | } |
713 | 759 | ||
714 | - | 760 | + private function alterarMetadadosProcedimento($parNumIdProcedimento, $parObjMetadadoProcedimento){ |
761 | + | ||
762 | + //Realiza a alteração dos metadados do processo(Por hora, apenas do nível de sigilo e hipótese legal) | ||
763 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
764 | + $objProtocoloDTO->setDblIdProtocolo($parNumIdProcedimento); | ||
765 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($parObjMetadadoProcedimento->nivelDeSigilo)); | ||
766 | + | ||
767 | + if($parObjMetadadoProcedimento->hipoteseLegal && $parObjMetadadoProcedimento->hipoteseLegal->identificacao){ | ||
768 | + $objProtocoloDTO->setNumIdHipoteseLegal($this->obterHipoteseLegalSEI($parObjMetadadoProcedimento->hipoteseLegal->identificacao)); | ||
769 | + } | ||
770 | + | ||
771 | + $objProtocoloRN = new ProtocoloRN(); | ||
772 | + $objProtocoloRN->alterarRN0203($objProtocoloDTO); | ||
773 | + } | ||
774 | + | ||
775 | + private function alterarMetadadosDocumento($parNumIdDocumento, $parObjMetadadoDocumento){ | ||
776 | + //Realiza a alteração dos metadados do documento(Por hora, apenas do nível de sigilo e hipótese legal) | ||
777 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
778 | + $objProtocoloDTO->setDblIdProtocolo($parNumIdDocumento); | ||
779 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($parObjMetadadoDocumento->nivelDeSigilo)); | ||
780 | + | ||
781 | + if($parObjMetadadoDocumento->hipoteseLegal && $parObjMetadadoDocumento->hipoteseLegal->identificacao){ | ||
782 | + $objProtocoloDTO->setNumIdHipoteseLegal($this->obterHipoteseLegalSEI($parObjMetadadoDocumento->hipoteseLegal->identificacao)); | ||
783 | + } | ||
784 | + | ||
785 | + $objProtocoloRN = new ProtocoloRN(); | ||
786 | + $objProtocoloRN->alterarRN0203($objProtocoloDTO); | ||
787 | + | ||
788 | + } | ||
789 | + | ||
790 | + | ||
715 | private function removerAndamentosProcedimento($parObjProtocoloDTO) | 791 | private function removerAndamentosProcedimento($parObjProtocoloDTO) |
716 | { | 792 | { |
717 | //TODO: Remover apenas as atividades geradas pelo recebimento do processo, não as atividades geradas anteriormente | 793 | //TODO: Remover apenas as atividades geradas pelo recebimento do processo, não as atividades geradas anteriormente |
@@ -807,35 +883,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -807,35 +883,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
807 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | 883 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
808 | 884 | ||
809 | 885 | ||
810 | - //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | ||
811 | - if ($this->destinatarioReal) { | ||
812 | - $objUnidadeDTO = new PenUnidadeDTO(); | ||
813 | - $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | ||
814 | - $objUnidadeDTO->setStrSinAtivo('S'); | ||
815 | - $objUnidadeDTO->retStrDescricao(); //descricao | ||
816 | - $objUnidadeRN = new UnidadeRN(); | ||
817 | - $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | ||
818 | - | ||
819 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | ||
820 | - $objAtributoAndamentoDTO->setStrNome('DESCRICAO'); | ||
821 | - $objAtributoAndamentoDTO->setStrValor('Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | ||
822 | - $objAtributoAndamentoDTO->setStrIdOrigem($objNivel->numeroDeIdentificacaoDaEstrutura); | ||
823 | - | ||
824 | - $arrObjAtributoAndamentoDTO = array($objAtributoAndamentoDTO); | ||
825 | - | ||
826 | - $objAtividadeDTO = new AtividadeDTO(); | ||
827 | - $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | ||
828 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
829 | - $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
830 | - $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ATUALIZACAO_ANDAMENTO); | ||
831 | - $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | ||
832 | - $objAtividadeDTO->setDthConclusao(null); | ||
833 | - $objAtividadeDTO->setNumIdUsuarioConclusao(null); | ||
834 | - $objAtividadeDTO->setStrSinInicial('N'); | ||
835 | - | ||
836 | - $objAtividadeRN = new AtividadeRN(); | ||
837 | - $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | ||
838 | - } | 886 | + |
839 | } | 887 | } |
840 | 888 | ||
841 | 889 | ||
@@ -1005,6 +1053,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -1005,6 +1053,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
1005 | 1053 | ||
1006 | //$strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash); | 1054 | //$strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash); |
1007 | 1055 | ||
1056 | + | ||
1008 | // Caso já esteja cadastrado, de um reenvio anterior, então move para bloqueado | 1057 | // Caso já esteja cadastrado, de um reenvio anterior, então move para bloqueado |
1009 | if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) { | 1058 | if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) { |
1010 | 1059 | ||
@@ -1038,6 +1087,8 @@ class ReceberProcedimentoRN extends InfraRN | @@ -1038,6 +1087,8 @@ class ReceberProcedimentoRN extends InfraRN | ||
1038 | } | 1087 | } |
1039 | 1088 | ||
1040 | if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)){ | 1089 | if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)){ |
1090 | + $objComponenteDigitalDTO = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; | ||
1091 | + $this->alterarMetadadosDocumento($objComponenteDigitalDTO->getDblIdDocumento(), $objDocumento); | ||
1041 | continue; | 1092 | continue; |
1042 | } | 1093 | } |
1043 | 1094 | ||
@@ -1367,6 +1418,21 @@ class ReceberProcedimentoRN extends InfraRN | @@ -1367,6 +1418,21 @@ class ReceberProcedimentoRN extends InfraRN | ||
1367 | break; | 1418 | break; |
1368 | } | 1419 | } |
1369 | } | 1420 | } |
1421 | + | ||
1422 | + private function obterHipoteseLegalSEI($parNumIdHipoteseLegalPEN) { | ||
1423 | + //Atribuí a hipótese legal | ||
1424 | + $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); | ||
1425 | + $objPenParametroRN = new PenParametroRN(); | ||
1426 | + $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); | ||
1427 | + | ||
1428 | + $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($parNumIdHipoteseLegalPEN); | ||
1429 | + | ||
1430 | + if (empty($numIdHipoteseLegal)) { | ||
1431 | + return $numIdHipoteseLegalPadrao; | ||
1432 | + } else { | ||
1433 | + return $numIdHipoteseLegal; | ||
1434 | + } | ||
1435 | + } | ||
1370 | 1436 | ||
1371 | //TODO: Implementar o mapeamento entre as unidade do SEI e Barramento de Serviços (Secretaria de Saúde: 218794) | 1437 | //TODO: Implementar o mapeamento entre as unidade do SEI e Barramento de Serviços (Secretaria de Saúde: 218794) |
1372 | private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) | 1438 | private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) |
@@ -1383,6 +1449,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -1383,6 +1449,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
1383 | return $objUnidadeRN->consultarRN0125($objUnidadeDTO); | 1449 | return $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
1384 | } | 1450 | } |
1385 | 1451 | ||
1452 | + | ||
1386 | /** | 1453 | /** |
1387 | * | 1454 | * |
1388 | * @return SerieDTO | 1455 | * @return SerieDTO |