Commit 009f341c73cb66dd1c571be598a0ac61076ceb35
1 parent
c74f7ae0
Exists in
master
Alteração do método ConsultarDocumento para permitir a consulta pelo Numero do D…
…ocumento e adição de dois registros no resultado da consulta.
Showing
3 changed files
with
39 additions
and
18 deletions
Show diff stats
MdWsSeiRest.php
| ... | ... | @@ -277,22 +277,28 @@ class MdWsSeiRest extends SeiIntegracao |
| 277 | 277 | |
| 278 | 278 | public function adicionarElementoMenu() |
| 279 | 279 | { |
| 280 | - $nomeArquivo = 'QRCODE_' | |
| 281 | - . self::NOME_MODULO | |
| 282 | - . "_" | |
| 283 | - . SessaoSEI::getInstance()->getNumIdOrgaoUsuario() | |
| 284 | - . "_" | |
| 285 | - . SessaoSEI::getInstance()->getNumIdContextoUsuario() | |
| 286 | - . "_" | |
| 287 | - . self::getVersao(); | |
| 288 | - $html = CacheSEI::getInstance()->getAtributo($nomeArquivo); | |
| 289 | - | |
| 290 | - if ($html) { | |
| 291 | - return $html; | |
| 292 | - } | |
| 280 | + try{ | |
| 281 | + $nomeArquivo = 'QRCODE_' | |
| 282 | + . self::NOME_MODULO | |
| 283 | + . "_" | |
| 284 | + . SessaoSEI::getInstance()->getNumIdOrgaoUsuario() | |
| 285 | + . "_" | |
| 286 | + . SessaoSEI::getInstance()->getNumIdContextoUsuario() | |
| 287 | + . "_" | |
| 288 | + . self::getVersao(); | |
| 289 | + $html = CacheSEI::getInstance()->getAtributo($nomeArquivo); | |
| 290 | + | |
| 291 | + if ($html) { | |
| 292 | + return $html; | |
| 293 | + } | |
| 293 | 294 | |
| 294 | - $html = $this->montaCorpoHTMLQRCode($nomeArquivo); | |
| 295 | - CacheSEI::getInstance()->setAtributo($nomeArquivo, $html, CacheSEI::getInstance()->getNumTempo()); | |
| 295 | + $html = $this->montaCorpoHTMLQRCode($nomeArquivo); | |
| 296 | + CacheSEI::getInstance()->setAtributo($nomeArquivo, $html, CacheSEI::getInstance()->getNumTempo()); | |
| 297 | + } | |
| 298 | + catch(Exception $e){ | |
| 299 | + LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); | |
| 300 | + throw $e; | |
| 301 | + } | |
| 296 | 302 | |
| 297 | 303 | return $html; |
| 298 | 304 | } | ... | ... |
controlador_ws.php
| ... | ... | @@ -264,7 +264,7 @@ $app->group('/api/v1',function(){ |
| 264 | 264 | |
| 265 | 265 | $this->get('/consultar/{protocolo}', function($request, $response, $args){ |
| 266 | 266 | $rn = new MdWsSeiDocumentoRN(); |
| 267 | - return $response->withJSON($rn->consultarDocumento($request->getAttribute('route')->getArgument('protocolo'))); | |
| 267 | + return $response->withJSON($rn->consultarDocumento($request->getAttribute('route')->getArgument('protocolo'), $request->getParam('numDocumento'))); | |
| 268 | 268 | }); |
| 269 | 269 | |
| 270 | 270 | $this->get('/listar/ciencia/{protocolo}', function($request, $response, $args){ | ... | ... |
rn/MdWsSeiDocumentoRN.php
| ... | ... | @@ -1454,16 +1454,23 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 1454 | 1454 | return $podeVisualizar; |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | - public function consultarDocumento($parNumIdDocumento) { | |
| 1457 | + public function consultarDocumento($parNumIdDocumento, $parNumDocumento) { | |
| 1458 | 1458 | |
| 1459 | 1459 | try { |
| 1460 | 1460 | $arrDadosDocumento = array(); |
| 1461 | 1461 | |
| 1462 | 1462 | //Busca o tipo de documento |
| 1463 | 1463 | $objDocumentoDTO = new DocumentoDTO(); |
| 1464 | - $objDocumentoDTO->setDblIdDocumento($parNumIdDocumento); | |
| 1464 | + if ($parNumIdDocumento != 0) { | |
| 1465 | + $objDocumentoDTO->setDblIdDocumento($parNumIdDocumento); | |
| 1466 | + } | |
| 1467 | + if (isset($parNumDocumento) && !empty($parNumDocumento)){ | |
| 1468 | + $objDocumentoDTO->setStrProtocoloDocumentoFormatado($parNumDocumento); | |
| 1469 | + } | |
| 1470 | + $objDocumentoDTO->retDblIdDocumento(); | |
| 1465 | 1471 | $objDocumentoDTO->retNumIdSerie(); |
| 1466 | 1472 | $objDocumentoDTO->retStrNumero(); |
| 1473 | + $objDocumentoDTO->retDblIdProcedimento(); | |
| 1467 | 1474 | |
| 1468 | 1475 | $objDocumentoRN = new DocumentoRN(); |
| 1469 | 1476 | $objDocumentoDTO = $objDocumentoRN->consultarRN0005($objDocumentoDTO); |
| ... | ... | @@ -1475,6 +1482,10 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 1475 | 1482 | $arrDadosDocumento['tipoDocumento'] = $objDocumentoDTO->getNumIdSerie(); |
| 1476 | 1483 | $arrDadosDocumento['numero'] = $objDocumentoDTO->getStrNumero(); |
| 1477 | 1484 | |
| 1485 | + if ($parNumIdDocumento == 0) { | |
| 1486 | + $parNumIdDocumento = $objDocumentoDTO->getDblIdDocumento(); | |
| 1487 | + } | |
| 1488 | + | |
| 1478 | 1489 | //Busca os assuntos |
| 1479 | 1490 | $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); |
| 1480 | 1491 | $objRelProtocoloAssuntoDTO->setDblIdProtocolo($parNumIdDocumento); |
| ... | ... | @@ -1545,6 +1556,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 1545 | 1556 | $objProtocoloDTO->retStrStaGrauSigilo(); |
| 1546 | 1557 | $objProtocoloDTO->retDtaGeracao(); |
| 1547 | 1558 | $objProtocoloDTO->retNumIdTipoConferenciaDocumento(); |
| 1559 | + $objProtocoloDTO->retDblIdProtocoloAgrupador(); | |
| 1548 | 1560 | |
| 1549 | 1561 | $objProtocoloRN = new ProtocoloRN(); |
| 1550 | 1562 | $objProtocoloDTO = $objProtocoloRN->consultarRN0186($objProtocoloDTO); |
| ... | ... | @@ -1578,6 +1590,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 1578 | 1590 | $arrDadosDocumento['observacao'] = array(); |
| 1579 | 1591 | } |
| 1580 | 1592 | |
| 1593 | + $arrDadosDocumento['protocoloAgrupador'] = $objDocumentoDTO->getDblIdProcedimento(); | |
| 1594 | + $arrDadosDocumento['linkProcesso'] = ConfiguracaoSEI::getInstance()->getValor('SEI','URL') . '/controlador.php?acao=procedimento_trabalhar&id_procedimento='.$objDocumentoDTO->getDblIdProcedimento(); | |
| 1595 | + | |
| 1581 | 1596 | return MdWsSeiRest::formataRetornoSucessoREST(null, $arrDadosDocumento); |
| 1582 | 1597 | } catch (Exception $e) { |
| 1583 | 1598 | return MdWsSeiRest::formataRetornoErroREST($e); | ... | ... |