Commit 9e1e847e49eb661f7044f94acf4c84abfcc96455

Authored by Starlone Passos
1 parent 7d1955bc

Indicador 27 - Obtendo quantidade de acesso dos usuarios por dia

Showing 1 changed file with 21 additions and 1 deletions   Show diff stats
rn/MdEstatisticasColetarRN.php
@@ -48,7 +48,8 @@ class MdEstatisticasColetarRN extends InfraRN { @@ -48,7 +48,8 @@ class MdEstatisticasColetarRN extends InfraRN {
48 'tamanhoFilesystem' => $this->obterTamanhoFileSystem(), 48 'tamanhoFilesystem' => $this->obterTamanhoFileSystem(),
49 'anexosTamanhos' => $this->obterTamanhoDocumentosExternos(), 49 'anexosTamanhos' => $this->obterTamanhoDocumentosExternos(),
50 'extensoes' => $this->obterQuantidadeDocumentosExternosPorExtensao(), 50 'extensoes' => $this->obterQuantidadeDocumentosExternosPorExtensao(),
51 - 'velocidades' => $this->obterVelocidadePorCidade() 51 + 'velocidades' => $this->obterVelocidadePorCidade(),
  52 + 'acessosUsuarios' => $this->obterAcessosUsuarios()
52 ); 53 );
53 54
54 return $indicadores; 55 return $indicadores;
@@ -444,5 +445,24 @@ class MdEstatisticasColetarRN extends InfraRN { @@ -444,5 +445,24 @@ class MdEstatisticasColetarRN extends InfraRN {
444 return $lista; 445 return $lista;
445 } 446 }
446 447
  448 + private function obterAcessosUsuarios(){
  449 + $sgbd = $this->obterTipoSGBD();
  450 + $query = '';
  451 + if ($sgbd == 'MySql') {
  452 + $query = "select count(*) as quantidade, date(dth_acesso) as data from infra_navegador group by date(dth_acesso)";
  453 + } elseif ($sgbd == 'SqlServer') {
  454 + $query = "select count(*) as quantidade, CONVERT(date, dth_acesso) as data from infra_navegador group by CONVERT(date, dth_acesso)";
  455 + } elseif ($sgbd == 'Oracle') {
  456 + $query = "select count(*) as quantidade, to_char(dth_acesso,'YYYY-MM-DD') AS data from infra_navegador group by to_char(dth_acesso,'YYYY-MM-DD')";
  457 + }
  458 +
  459 + $rs = array();
  460 + if($query) {
  461 + $rs = BancoSEI::getInstance()->consultarSql($query);
  462 + }
  463 + InfraDebug::getInstance()->gravar('SEI27 - Quantidade de acessos por dia: ' . json_encode($rs), InfraLog::$INFORMACAO);
  464 + return $rs;
  465 + }
  466 +
447 } 467 }
448 ?> 468 ?>