Commit 4c310faa187839ac0d03674cf651b10d8d86b0f1
1 parent
640f095e
Exists in
master
and in
7 other branches
Sprint 01 - Release 5: US039, US043, US041, US040
Showing
5 changed files
with
70 additions
and
0 deletions
Show diff stats
pen_map_hipotese_legal_enviado_listar.php
| @@ -49,6 +49,8 @@ try { | @@ -49,6 +49,8 @@ try { | ||
| 49 | $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO(); | 49 | $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO(); |
| 50 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | 50 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); |
| 51 | 51 | ||
| 52 | + $arrParam['hdnInfraItensSelecionados'] = explode(',',$arrParam['hdnInfraItensSelecionados']); | ||
| 53 | + | ||
| 52 | if(is_array($arrParam['hdnInfraItensSelecionados'])) { | 54 | if(is_array($arrParam['hdnInfraItensSelecionados'])) { |
| 53 | 55 | ||
| 54 | foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { | 56 | foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { |
pen_map_hipotese_legal_recebido_listar.php
| @@ -53,6 +53,8 @@ try { | @@ -53,6 +53,8 @@ try { | ||
| 53 | $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO(); | 53 | $objPenRelHipoteseLegalDTO = new PenRelHipoteseLegalDTO(); |
| 54 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalRecebidoRN(); | 54 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalRecebidoRN(); |
| 55 | 55 | ||
| 56 | + $arrParam['hdnInfraItensSelecionados'] = explode(',', $arrParam['hdnInfraItensSelecionados']); | ||
| 57 | + | ||
| 56 | if(is_array($arrParam['hdnInfraItensSelecionados'])) { | 58 | if(is_array($arrParam['hdnInfraItensSelecionados'])) { |
| 57 | 59 | ||
| 58 | foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { | 60 | foreach($arrParam['hdnInfraItensSelecionados'] as $dblIdMap) { |
rn/PENAgendamentoRN.php
| @@ -264,6 +264,36 @@ class PENAgendamentoRN extends InfraRN { | @@ -264,6 +264,36 @@ class PENAgendamentoRN extends InfraRN { | ||
| 264 | throw new InfraException('Erro ao rodar verificação de status do serviços Gearmand e Supervisord', $e); | 264 | throw new InfraException('Erro ao rodar verificação de status do serviços Gearmand e Supervisord', $e); |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| 267 | + | ||
| 268 | + /** | ||
| 269 | + * Atualização das hipóteses legais vindas do barramento | ||
| 270 | + * @throws InfraException | ||
| 271 | + */ | ||
| 272 | + public function atualizarHipotesesLegais() { | ||
| 273 | + $objBD = new PenHipoteseLegalBD($this->inicializarObjInfraIBanco()); | ||
| 274 | + $processoEletronicoRN = new ProcessoEletronicoRN(); | ||
| 275 | + $hipotesesPen = $processoEletronicoRN->consultarHipotesesLegais(); | ||
| 276 | + | ||
| 277 | + //Para cada hipótese vinda do PEN será verificado a existencia. | ||
| 278 | + foreach ($hipotesesPen as $hipotese) { | ||
| 279 | + $objDTO = new PenHipoteseLegalDTO(); | ||
| 280 | + $objDTO->setStrNome($hipotese->hipotese->nome); | ||
| 281 | + $objDTO->setNumMaxRegistrosRetorno(1); | ||
| 282 | + $objDTO->retNumIdHipoteseLegal(); | ||
| 283 | + $objConsulta = $objBD->consultar($objDTO); | ||
| 284 | + | ||
| 285 | + //Caso não exista a hipótese irá cadastra-la no sei. | ||
| 286 | + if (empty($objConsulta)) { | ||
| 287 | + $objBD->cadastrar($objDTO); | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + try { | ||
| 292 | + LogSEI::getInstance()->gravar("Hipóteses Legais atualizadas."); | ||
| 293 | + } catch (Exception $e) { | ||
| 294 | + throw new InfraException('Erro no agendamento das Hipóteses Legais', $e); | ||
| 295 | + } | ||
| 296 | + } | ||
| 267 | } | 297 | } |
| 268 | // $client = new GearmanClient(); | 298 | // $client = new GearmanClient(); |
| 269 | // $client->addServer('localhost', 4730); | 299 | // $client->addServer('localhost', 4730); |
rn/PenAtualizarSeiRN.php
| @@ -1044,6 +1044,29 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | @@ -1044,6 +1044,29 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | ||
| 1044 | $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); | 1044 | $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); |
| 1045 | $objInfraParametroDTO->setStrValor('1.0.1'); | 1045 | $objInfraParametroDTO->setStrValor('1.0.1'); |
| 1046 | $objInfraParametroBD->alterar($objInfraParametroDTO); | 1046 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
| 1047 | + | ||
| 1048 | + | ||
| 1049 | + //Agendamento | ||
| 1050 | + $objDTO = new InfraAgendamentoTarefaDTO(); | ||
| 1051 | + | ||
| 1052 | + $fnCadastrar = function($strComando, $strDesc) use($objDTO, $objBD, $objRN) { | ||
| 1053 | + | ||
| 1054 | + $objDTO->unSetTodos(); | ||
| 1055 | + $objDTO->setStrComando($strComando); | ||
| 1056 | + | ||
| 1057 | + if ($objBD->contar($objDTO) == 0) { | ||
| 1058 | + | ||
| 1059 | + $objDTO->setStrDescricao($strDesc); | ||
| 1060 | + $objDTO->setStrStaPeriodicidadeExecucao('D'); | ||
| 1061 | + $objDTO->setStrPeriodicidadeComplemento('0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23'); | ||
| 1062 | + $objDTO->setStrSinAtivo('S'); | ||
| 1063 | + $objDTO->setStrSinSucesso('S'); | ||
| 1064 | + | ||
| 1065 | + $objBD->cadastrar($objDTO); | ||
| 1066 | + } | ||
| 1067 | + }; | ||
| 1068 | + | ||
| 1069 | + $fnCadastrar('PENAgendamentoRN::atualizarHipotesesLegais', 'Verificação se há novas hipóteses legais do barramento.'); | ||
| 1047 | } | 1070 | } |
| 1048 | 1071 | ||
| 1049 | } | 1072 | } |
rn/ProcessoEletronicoRN.php
| @@ -1437,6 +1437,19 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -1437,6 +1437,19 @@ class ProcessoEletronicoRN extends InfraRN { | ||
| 1437 | return false; | 1437 | return false; |
| 1438 | } | 1438 | } |
| 1439 | } | 1439 | } |
| 1440 | + | ||
| 1441 | + public function consultarHipotesesLegais() { | ||
| 1442 | + try{ | ||
| 1443 | + $hipoteses = $this->getObjPenWs()->consultarHipotesesLegais(); | ||
| 1444 | + if (empty($hipoteses)) { | ||
| 1445 | + return []; | ||
| 1446 | + } | ||
| 1447 | + return $hipoteses; | ||
| 1448 | + | ||
| 1449 | + } catch(Exception $e){ | ||
| 1450 | + throw new InfraException("Erro durante obtenção da resposta das hipóteses legais", $e); | ||
| 1451 | + } | ||
| 1452 | + } | ||
| 1440 | } | 1453 | } |
| 1441 | 1454 | ||
| 1442 | 1455 |