diff --git a/Makefile b/Makefile index 2fd6d0f9..00f257ac 100755 --- a/Makefile +++ b/Makefile @@ -144,10 +144,10 @@ install: check-isalive $(CMD_COMPOSE_FUNC) exec org1-http chown -R root:root /etc/cron.d/ $(CMD_COMPOSE_FUNC) exec org1-http chmod 0644 /etc/cron.d/sei $(CMD_COMPOSE_FUNC) exec org1-http chmod 0644 /etc/cron.d/sip + $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org1-http bash -c './composer.phar update' + $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org2-http bash -c './composer.phar update' $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org1-http bash -c './composer.phar install' $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org2-http bash -c './composer.phar install' - $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org1-http bash -c './composer.phar update --lock' - $(CMD_COMPOSE_FUNC) exec -w /opt/sei/web/modulos/pen org2-http bash -c './composer.phar update --lock' $(CMD_COMPOSE_FUNC) exec -w /opt/sei/scripts/$(MODULO_PASTAS_CONFIG) org1-http bash -c "$(CMD_INSTALACAO_SEI_MODULO)" $(CMD_COMPOSE_FUNC) exec -w /opt/sip/scripts/$(MODULO_PASTAS_CONFIG) org1-http bash -c "$(CMD_INSTALACAO_SIP_MODULO)" diff --git a/src/rn/PENAgendamentoRN.php b/src/rn/PENAgendamentoRN.php index d28e16d9..7cd742fe 100755 --- a/src/rn/PENAgendamentoRN.php +++ b/src/rn/PENAgendamentoRN.php @@ -49,7 +49,7 @@ protected function atualizarHipotesesLegaisControlado() continue; } - $objDTO->setStrNome(mb_convert_encoding($hipotese->nome, 'ISO-8859-1', 'UTF-8')); + $objDTO->setStrNome(mb_convert_encoding($hipotese['nome'], 'ISO-8859-1', 'UTF-8')); if ($hipotese['status']) { $objDTO->setStrAtivo('S'); diff --git a/src/rn/ProcessoEletronicoRN.php b/src/rn/ProcessoEletronicoRN.php index 0db9f0fb..e4024528 100755 --- a/src/rn/ProcessoEletronicoRN.php +++ b/src/rn/ProcessoEletronicoRN.php @@ -212,14 +212,14 @@ public function consultarRepositoriosDeEstruturas($numIdentificacaoDoRepositorio * * @return void */ - public function listarRepositoriosDeEstruturas() + public function listarRepositoriosDeEstruturas($ativo = true) { $arrObjRepositorioDTO = []; $endpoint = 'repositorios-de-estruturas'; try { $parametros = [ - 'ativos' => true + 'ativos' => $ativo ]; $arrResultado = $this->get($endpoint, $parametros); @@ -799,37 +799,9 @@ public function consultarEspeciesDocumentais() return $arrEspecies; } - - public function enviarProcesso($parametros) - { - try { - return $this->tentarNovamenteSobErroHTTP(function($objPenWs) use ($parametros) { - return $objPenWs->enviarProcesso($parametros); - }); - - } catch (\SoapFault $e) { - $strMensagem = str_replace(array("\n", "\r"), ' ', InfraString::formatarJavaScript(mb_convert_encoding($e->faultstring, 'ISO-8859-1', 'UTF-8'))); - - if ($e instanceof \SoapFault && !empty($e->detail->interoperabilidadeException->codigoErro) && $e->detail->interoperabilidadeException->codigoErro == '0005') { - $strMensagem .= 'O código mapeado para a unidade ' . mb_convert_encoding($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome, 'ISO-8859-1', 'UTF-8') . ' está incorreto.'; - } - - $e->faultstring = $this->validarTramitaEmAndamento($parametros, $strMensagem); - $strMensagem = $e->faultstring; - $strDetalhes = str_replace(array("\n", "\r"), ' ', InfraString::formatarJavaScript($this->tratarFalhaWebService($e))); - throw new InfraException($strMensagem, $e, $strDetalhes); - } catch (\Exception $e) { - $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; - $detalhes = InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); - throw new InfraException($mensagem, $e, $detalhes); - } - } - - - public function enviarProcessoREST($parametros) - { - $endpoint = "tramites/processo"; + { + $endpoint = "tramites/processo"; try { $arrResultado = $this->post($endpoint, $parametros['novoTramiteDeProcesso']); @@ -837,8 +809,8 @@ public function enviarProcessoREST($parametros) } catch (Exception $e) { - $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; - $erroRequest = json_decode($e->getMessage()); + $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; + $erroRequest = json_decode($e->getMessage()); if ($erroRequest != null) { $mensagem = "Falha no envio externo do processo. Erro: {$erroRequest->codigoErro} - {$erroRequest->message}"; } @@ -880,17 +852,17 @@ public function listarPendencias($bolTodasPendencias) $arrResultado = $this->get($endpoint, $parametros); - if (isset($arrResultado)) { - foreach ($arrResultado as $idt) { - $pendenciaDTO = new PendenciaDTO(); - $pendenciaDTO->setNumIdentificacaoTramite($idt['IDT']); - $pendenciaDTO->setStrStatus($idt['status']); - $arrObjPendenciaDTO[] = $pendenciaDTO; + if (is_array($arrResultado) && !is_null($arrResultado)) { + foreach ($arrResultado as $strPendencia) { + $pendenciaDTO = new PendenciaDTO(); + $pendenciaDTO->setNumIdentificacaoTramite($strPendencia['IDT']); + $pendenciaDTO->setStrStatus($strPendencia['status']); + $arrObjPendenciaDTO[] = $pendenciaDTO; } - } + } } catch (Exception $e) { - $mensagem = "Falha na obtenção de unidades externas"; + $mensagem = "Falha na listagem de pendências de trâmite de processos"; $detalhes = InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); throw new InfraException($mensagem, $e, $detalhes); } @@ -2834,9 +2806,9 @@ private function getArrPenWsRest($method, $endpoint, $options = []) $base64 = $arrResultado->getBody()->getContents(); $foo = json_decode($arrResultado->getBody(), true); - if ($foo != null) { - return $foo; - } + if ($foo != null) { + return $foo; + } return $base64; } catch (RequestException $e) { @@ -2853,19 +2825,19 @@ private function getArrPenWsRest($method, $endpoint, $options = []) } } - private function get($endpoint, $params = []) { + public function get($endpoint, $params = []) { return $this->getArrPenWsRest('GET', $endpoint, ['query' => $params]); } - private function post($endpoint, $data = []) { + public function post($endpoint, $data = []) { return $this->getArrPenWsRest('POST', $endpoint, ['json' => $data]); } - private function put($endpoint, $data = []) { + public function put($endpoint, $data = []) { return $this->getArrPenWsRest('PUT', $endpoint, ['json' => $data]); } - private function delete($endpoint, $params = []) { + public function delete($endpoint, $params = []) { return $this->getArrPenWsRest('DELETE', $endpoint, ['query' => $params]); } } \ No newline at end of file diff --git a/src/rn/VerificadorInstalacaoRN.php b/src/rn/VerificadorInstalacaoRN.php index 09208818..d3ffeeaa 100755 --- a/src/rn/VerificadorInstalacaoRN.php +++ b/src/rn/VerificadorInstalacaoRN.php @@ -233,12 +233,14 @@ public function verificarConexaoBarramentoPEN() $strLocalizacaoCertificadoDigital = $objConfiguracaoModPEN->getValor("PEN", "LocalizacaoCertificado"); $strSenhaCertificadoDigital = $objConfiguracaoModPEN->getValor("PEN", "SenhaCertificado"); - $strEnderecoWSDL = $strEnderecoWebService . '?wsdl'; - $curl = curl_init($strEnderecoWSDL); + $healthcheck = 'healthcheck'; + + $strEnderecoBarramento = $strEnderecoWebService . '/' . $healthcheck; + $curl = curl_init($strEnderecoBarramento); try{ $bolEmProducao = boolval(ConfiguracaoSEI::getInstance()->getValor('SEI', 'Producao')); - curl_setopt($curl, CURLOPT_URL, $strEnderecoWSDL); + curl_setopt($curl, CURLOPT_URL, $strEnderecoBarramento); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); @@ -254,12 +256,7 @@ public function verificarConexaoBarramentoPEN() $strErrorMsg = curl_error($curl); } if (isset($strErrorMsg)) { - throw new Exception("Erro no CURL ao obter o WSDL em $strEnderecoWSDL. Erro detalhado: $strErrorMsg."); - } - $objXML = simplexml_load_string($strOutput); - - if(empty($strOutput) || $strOutput === false || empty($objXML) || $objXML === false){ - throw new Exception("Falha na validação do WSDL do webservice de integração com o Tramita GOV.BR localizado em $strEnderecoWSDL"); + throw new Exception("Erro no CURL para $strEnderecoBarramento. Erro detalhado: $strErrorMsg."); } } finally{ @@ -282,6 +279,7 @@ public function verificarAcessoPendenciasTramitePEN() try{ $objProcessoEletronicoRN = new ProcessoEletronicoRN(); $objProcessoEletronicoRN->listarPendencias(false); + return true; } catch(Exception $e){ throw new InfraException("Falha no acesso aos serviços de integração do Tramita GOV.BR: $e");