Commit cc3301d0a0a83956ac91ae5a35e0b697cc263211
1 parent
c2aacb8a
Exists in
master
and in
1 other branch
Criando arquivo MDEstatisticasEnviarRN. Criando objeto e transformando em json p…
…reparando para enviar
Showing
3 changed files
with
51 additions
and
15 deletions
Show diff stats
rn/MdEstatisticasAgendamentoRN.php
@@ -9,8 +9,16 @@ class MdEstatisticasAgendamentoRN extends InfraRN { | @@ -9,8 +9,16 @@ class MdEstatisticasAgendamentoRN extends InfraRN { | ||
9 | } | 9 | } |
10 | 10 | ||
11 | public function coletarIndicadores() { | 11 | public function coletarIndicadores() { |
12 | - $coletarRN = new MdEstatisticasColetarRN(); | ||
13 | - $objIndicadoresDTO = $coletarRN->coletarIndicadores(); | 12 | + |
13 | + InfraDebug::getInstance()->setBolLigado(true); | ||
14 | + InfraDebug::getInstance()->setBolDebugInfra(false); | ||
15 | + InfraDebug::getInstance()->setBolEcho(false); | ||
16 | + InfraDebug::getInstance()->limpar(); | ||
17 | + | ||
18 | + $indicadores = (new MdEstatisticasColetarRN())-> coletarIndicadores(); | ||
19 | + (new MdEstatisticasEnviarRN())-> enviarIndicadores($indicadores); | ||
20 | + | ||
21 | + LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug(),InfraLog::$INFORMACAO); | ||
14 | } | 22 | } |
15 | 23 | ||
16 | } | 24 | } |
rn/MdEstatisticasColetarRN.php
@@ -16,10 +16,6 @@ class MdEstatisticasColetarRN extends InfraRN { | @@ -16,10 +16,6 @@ class MdEstatisticasColetarRN extends InfraRN { | ||
16 | 16 | ||
17 | try { | 17 | try { |
18 | 18 | ||
19 | - InfraDebug::getInstance()->setBolLigado(true); | ||
20 | - InfraDebug::getInstance()->setBolDebugInfra(false); | ||
21 | - InfraDebug::getInstance()->setBolEcho(false); | ||
22 | - InfraDebug::getInstance()->limpar(); | ||
23 | 19 | ||
24 | //IMPLEMENTAÇÃO DA EXTRAÇÃO DE INDICADORES | 20 | //IMPLEMENTAÇÃO DA EXTRAÇÃO DE INDICADORES |
25 | //1) Criar o objeto DTO representativo dos indicadores | 21 | //1) Criar o objeto DTO representativo dos indicadores |
@@ -36,16 +32,15 @@ class MdEstatisticasColetarRN extends InfraRN { | @@ -36,16 +32,15 @@ class MdEstatisticasColetarRN extends InfraRN { | ||
36 | $objIndicadoresDTO->setNumQuantidadeProcedimentos($this->obterQuantidadeProcessosAdministrativos()); | 32 | $objIndicadoresDTO->setNumQuantidadeProcedimentos($this->obterQuantidadeProcessosAdministrativos()); |
37 | $objIndicadoresDTO->setStrNavegadores($this->obterNavegadores()); | 33 | $objIndicadoresDTO->setStrNavegadores($this->obterNavegadores()); |
38 | 34 | ||
39 | - //... | ||
40 | - | ||
41 | - //3) Salvar indicador no banco de dados ???? | ||
42 | - // | ||
43 | - | ||
44 | - //4) Enviar indicadores para webservice | ||
45 | - // | 35 | + $indicadores = array( |
36 | + 'seiVersao' => $this->obterVersaoSEI(), | ||
37 | + 'phpVersao' => $this->obterVersaoPHP(), | ||
38 | + 'protocolo' => $this->obterProtocolo(), | ||
39 | + 'quantidadeProcedimentos' => $this->obterQuantidadeProcessosAdministrativos(), | ||
40 | + 'quantidadeUnidades' => $this->obterQuantidadeUnidades() | ||
41 | + ); | ||
46 | 42 | ||
47 | - LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug(),InfraLog::$INFORMACAO); | ||
48 | - return $objIndicadoresDTO; | 43 | + return $indicadores; |
49 | 44 | ||
50 | } catch(Exception $e) { | 45 | } catch(Exception $e) { |
51 | InfraDebug::getInstance()->setBolLigado(false); | 46 | InfraDebug::getInstance()->setBolLigado(false); |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +<? | ||
2 | +require_once dirname(__FILE__).'/../../../SEI.php'; | ||
3 | + | ||
4 | + | ||
5 | +class MdEstatisticasEnviarRN extends InfraRN { | ||
6 | + | ||
7 | + public function __construct(){ | ||
8 | + parent::__construct(); | ||
9 | + } | ||
10 | + | ||
11 | + protected function inicializarObjInfraIBanco(){ | ||
12 | + return BancoSEI::getInstance(); | ||
13 | + } | ||
14 | + | ||
15 | + public function enviarIndicadores($indicadores) { | ||
16 | + | ||
17 | + try { | ||
18 | + | ||
19 | + $json = json_encode($indicadores); | ||
20 | + InfraDebug::getInstance()->gravar('JSON: ' . $json, InfraLog::$INFORMACAO); | ||
21 | + | ||
22 | + return true; | ||
23 | + | ||
24 | + } catch(Exception $e) { | ||
25 | + InfraDebug::getInstance()->setBolLigado(false); | ||
26 | + InfraDebug::getInstance()->setBolDebugInfra(false); | ||
27 | + InfraDebug::getInstance()->setBolEcho(false); | ||
28 | + throw new InfraException('Erro processando estatísticas do sistema.',$e); | ||
29 | + } | ||
30 | + } | ||
31 | + | ||
32 | +} | ||
33 | +?> |