Commit 7af7bfa3d4a037c7a655661c695eeabffabfd9f0
1 parent
b0f5d5c8
Exists in
master
and in
1 other branch
Indicador 16 - FIltrando para enviar apenas os recursos ainda nao enviados
Showing
3 changed files
with
14 additions
and
4 deletions
Show diff stats
rn/MdEstatisticasAgendamentoRN.php
| ... | ... | @@ -45,7 +45,8 @@ class MdEstatisticasAgendamentoRN extends InfraRN |
| 45 | 45 | $logs = $coletor->obterQuantidadeLogErro(); |
| 46 | 46 | $enviar->enviarLogsErro($logs, $id); |
| 47 | 47 | |
| 48 | - $recursos = $coletor->obterQuantidadeRecursos(); | |
| 48 | + $dataultimorecurso = $enviar->obterUltimoRecurso(); | |
| 49 | + $recursos = $coletor->obterQuantidadeRecursos($dataultimorecurso); | |
| 49 | 50 | $enviar->enviarRecursos($recursos, $id); |
| 50 | 51 | } |
| 51 | 52 | ... | ... |
rn/MdEstatisticasColetarRN.php
| ... | ... | @@ -485,8 +485,12 @@ class MdEstatisticasColetarRN extends InfraRN |
| 485 | 485 | return $lista; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - public function obterQuantidadeRecursos() { | |
| 489 | - $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM sei.infra_auditoria group by 1, 2, 3 order by 1, 2, 3"; | |
| 488 | + public function obterQuantidadeRecursos($dataultimorecurso) { | |
| 489 | + if ($dataultimorecurso == null) { | |
| 490 | + $dataultimorecurso = "'1900-01-01'"; | |
| 491 | + } | |
| 492 | + $current_month = date("'Y-m-01'"); | |
| 493 | + $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM sei.infra_auditoria where date(dth_acesso) > " . $dataultimorecurso . " and date(dth_acesso) < ". $current_month . " group by 1, 2, 3 order by 1, 2, 3"; | |
| 490 | 494 | return BancoSEI::getInstance()->consultarSql($query); |
| 491 | 495 | } |
| 492 | 496 | ... | ... |
rn/MdEstatisticasEnviarRN.php
| ... | ... | @@ -21,7 +21,12 @@ class MdEstatisticasEnviarRN extends InfraRN |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function obterUltimoAcesso() { |
| 24 | - $data = $this->doGet($this->url . '/ultimoacesso?sigla=' . $this->orgaoSigla, false); | |
| 24 | + $data = $this->doGet($this->url . '/acessos/ultimo?sigla=' . $this->orgaoSigla, false); | |
| 25 | + return date($data); | |
| 26 | + } | |
| 27 | + | |
| 28 | + public function obterUltimoRecurso() { | |
| 29 | + $data = $this->doGet($this->url . '/recursos/ultimo?sigla=' . $this->orgaoSigla, false); | |
| 25 | 30 | return date($data); |
| 26 | 31 | } |
| 27 | 32 | ... | ... |