Commit 3c6464d60371bbc006045e6b86a8ad6bfec4a94f
Exists in
master
and in
1 other branch
Merge revisão 05 do próxima release do módulo
Showing
21 changed files
with
2812 additions
and
92 deletions
Show diff stats
MdWsSeiRest.php
@@ -150,7 +150,7 @@ class MdWsSeiRest extends SeiIntegracao | @@ -150,7 +150,7 @@ class MdWsSeiRest extends SeiIntegracao | ||
150 | 150 | ||
151 | public function getVersao() | 151 | public function getVersao() |
152 | { | 152 | { |
153 | - return '0.7.10'; | 153 | + return '0.7.11'; |
154 | } | 154 | } |
155 | 155 | ||
156 | public function getInstituicao() | 156 | public function getInstituicao() |
controlador_ws.php
1 | -<? | 1 | +<?php |
2 | /** | 2 | /** |
3 | * Controlador (API v1) de servicos REST usando o framework Slim | 3 | * Controlador (API v1) de servicos REST usando o framework Slim |
4 | */ | 4 | */ |
@@ -79,6 +79,13 @@ $app = new \Slim\App($config); | @@ -79,6 +79,13 @@ $app = new \Slim\App($config); | ||
79 | * Grupo para a versao v1 de servicos REST | 79 | * Grupo para a versao v1 de servicos REST |
80 | */ | 80 | */ |
81 | $app->group('/api/v1',function(){ | 81 | $app->group('/api/v1',function(){ |
82 | + | ||
83 | + $this->get('/versao', function($request, $response, $args){ | ||
84 | + return $response->withJSON(MdWsSeiRest::formataRetornoSucessoREST(null, ['versao' => SEI_VERSAO])); | ||
85 | + }); | ||
86 | + /** | ||
87 | + * | ||
88 | + */ | ||
82 | /** | 89 | /** |
83 | * Grupo de autenticacao <publico> | 90 | * Grupo de autenticacao <publico> |
84 | */ | 91 | */ |
@@ -254,6 +261,12 @@ $app->group('/api/v1',function(){ | @@ -254,6 +261,12 @@ $app->group('/api/v1',function(){ | ||
254 | * Grupo de controlador de documentos | 261 | * Grupo de controlador de documentos |
255 | */ | 262 | */ |
256 | $this->group('/documento', function(){ | 263 | $this->group('/documento', function(){ |
264 | + | ||
265 | + $this->get('/consultar/{protocolo}', function($request, $response, $args){ | ||
266 | + $rn = new MdWsSeiDocumentoRN(); | ||
267 | + return $response->withJSON($rn->consultarDocumento($request->getAttribute('route')->getArgument('protocolo'))); | ||
268 | + }); | ||
269 | + | ||
257 | $this->get('/listar/ciencia/{protocolo}', function($request, $response, $args){ | 270 | $this->get('/listar/ciencia/{protocolo}', function($request, $response, $args){ |
258 | /** @var $request Slim\Http\Request */ | 271 | /** @var $request Slim\Http\Request */ |
259 | $rn = new MdWsSeiDocumentoRN(); | 272 | $rn = new MdWsSeiDocumentoRN(); |
@@ -280,6 +293,89 @@ $app->group('/api/v1',function(){ | @@ -280,6 +293,89 @@ $app->group('/api/v1',function(){ | ||
280 | $request->getParam('usuario') | 293 | $request->getParam('usuario') |
281 | )); | 294 | )); |
282 | }); | 295 | }); |
296 | + $this->post('/externo/alterar', function($request, $response, $args){ | ||
297 | + | ||
298 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
299 | + | ||
300 | + $nomeArquivoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('nomeArquivo')); | ||
301 | + $descricaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('descricao')); | ||
302 | + $observacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacao')); | ||
303 | + $binarioFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('conteudoDocumento')); | ||
304 | + $numeroFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('numero')); | ||
305 | + | ||
306 | + /** @var $request Slim\Http\Request */ | ||
307 | + $dados["documento"] = $request->getParam('documento'); | ||
308 | + $dados["numero"] = $numeroFormatado; | ||
309 | + $dados["idTipoDocumento"] = $request->getParam('idTipoDocumento'); | ||
310 | + $dados["data"] = $request->getParam('data'); | ||
311 | + $dados["assuntos"] = json_decode($request->getParam('assuntos'), TRUE); | ||
312 | + $dados["interessados"] = json_decode($request->getParam('interessados'), TRUE); | ||
313 | + $dados["destinatarios"] = json_decode($request->getParam('destinatarios'), TRUE); | ||
314 | + $dados["remetentes"] = json_decode($request->getParam('remetentes'), TRUE); | ||
315 | + $dados["nivelAcesso"] = $request->getParam('nivelAcesso'); | ||
316 | + $dados["hipoteseLegal"] = $request->getParam('hipoteseLegal'); | ||
317 | + $dados["grauSigilo"] = $request->getParam('grauSigilo'); | ||
318 | + $dados["observacao"] = $observacaoFormatado; | ||
319 | + $dados["descricao"] = $descricaoFormatado; | ||
320 | + | ||
321 | + $dados["nomeArquivo"] = $nomeArquivoFormatado; | ||
322 | + $dados["tipoConferencia"] = $request->getParam('tipoConferencia'); | ||
323 | + | ||
324 | + if (array_key_exists("conteudoDocumento",$request->getParams())){ | ||
325 | + $dados["conteudoDocumento"] = false; | ||
326 | + if($request->getParam('conteudoDocumento')) $dados["conteudoDocumento"] = $binarioFormatado; | ||
327 | + }else{ | ||
328 | + $dados["conteudoDocumento"] = null; | ||
329 | + } | ||
330 | + | ||
331 | + | ||
332 | + $rn = new MdWsSeiDocumentoRN(); | ||
333 | + return $response->withJSON( | ||
334 | + $rn->alterarDocumentoExterno($dados) | ||
335 | + ); | ||
336 | + }); | ||
337 | + $this->post('/interno/alterar', function($request, $response, $args){ | ||
338 | + | ||
339 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
340 | + | ||
341 | + $descricaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('descricao')); | ||
342 | + $observacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacao')); | ||
343 | + | ||
344 | + /** @var $request Slim\Http\Request */ | ||
345 | + $dados["documento"] = $request->getParam('documento'); | ||
346 | + $dados["assuntos"] = json_decode($request->getParam('assuntos'), TRUE); | ||
347 | + $dados["interessados"] = json_decode($request->getParam('interessados'), TRUE); | ||
348 | + $dados["destinatarios"] = json_decode($request->getParam('destinatarios'), TRUE); | ||
349 | + $dados["nivelAcesso"] = $request->getParam('nivelAcesso'); | ||
350 | + $dados["hipoteseLegal"] = $request->getParam('hipoteseLegal'); | ||
351 | + $dados["grauSigilo"] = $request->getParam('grauSigilo'); | ||
352 | + $dados["observacao"] = $observacaoFormatado; | ||
353 | + $dados["descricao"] = $descricaoFormatado; | ||
354 | + | ||
355 | + | ||
356 | + | ||
357 | + $rn = new MdWsSeiDocumentoRN(); | ||
358 | + return $response->withJSON( | ||
359 | + $rn->alterarDocumentoInterno($dados) | ||
360 | + ); | ||
361 | + }); | ||
362 | + $this->post('/secao/alterar', function($request, $response, $args){ | ||
363 | + /** @var $request Slim\Http\Request */ | ||
364 | + $dados["documento"] = $request->getParam('documento'); | ||
365 | + $dados["secoes"] = json_decode($request->getParam('secoes'), TRUE); | ||
366 | + $dados["versao"] = $request->getParam('versao'); | ||
367 | + | ||
368 | + // Ajuste de encoding das secoes | ||
369 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
370 | + for ($i = 0; $i < count($dados["secoes"]); $i++) { | ||
371 | + $dados["secoes"][$i]['conteudo'] = iconv('UTF-8', 'ISO-8859-1', $dados["secoes"][$i]['conteudo']); | ||
372 | + } | ||
373 | + | ||
374 | + $rn = new MdWsSeiDocumentoRN(); | ||
375 | + return $response->withJSON( | ||
376 | + $rn->alterarSecaoDocumento($dados) | ||
377 | + ); | ||
378 | + }); | ||
283 | $this->post('/ciencia', function($request, $response, $args){ | 379 | $this->post('/ciencia', function($request, $response, $args){ |
284 | /** @var $request Slim\Http\Request */ | 380 | /** @var $request Slim\Http\Request */ |
285 | $rn = new MdWsSeiDocumentoRN(); | 381 | $rn = new MdWsSeiDocumentoRN(); |
@@ -316,6 +412,41 @@ $app->group('/api/v1',function(){ | @@ -316,6 +412,41 @@ $app->group('/api/v1',function(){ | ||
316 | } | 412 | } |
317 | return $response->withJSON($rn->listarDocumentosProcesso($dto)); | 413 | return $response->withJSON($rn->listarDocumentosProcesso($dto)); |
318 | }); | 414 | }); |
415 | + $this->get('/secao/listar', function($request, $response, $args){ | ||
416 | + /** @var $request Slim\Http\Request */ | ||
417 | + $rn = new MdWsSeiDocumentoRN(); | ||
418 | + $dto = new DocumentoDTO(); | ||
419 | + $dto->setDblIdDocumento($request->getParam('id')); | ||
420 | + | ||
421 | + return $response->withJSON($rn->listarSecaoDocumento($dto)); | ||
422 | + }); | ||
423 | + $this->get('/tipo/pesquisar', function($request, $response, $args){ | ||
424 | + /** @var $request Slim\Http\Request */ | ||
425 | + $rn = new MdWsSeiDocumentoRN(); | ||
426 | + $dto = new MdWsSeiDocumentoDTO(); | ||
427 | + | ||
428 | + $dto->setNumIdTipoDocumento($request->getParam('id')); | ||
429 | + $dto->setStrNomeTipoDocumento($request->getParam('filter')); | ||
430 | + $dto->setStrFavoritos($request->getParam('favoritos')); | ||
431 | + | ||
432 | + $arrAplicabilidade = explode(",",$request->getParam('aplicabilidade')); | ||
433 | + | ||
434 | + $dto->setArrAplicabilidade($arrAplicabilidade); | ||
435 | + $dto->setNumStart($request->getParam('start')); | ||
436 | + $dto->setNumLimit($request->getParam('limit')); | ||
437 | + | ||
438 | + return $response->withJSON($rn->pesquisarTipoDocumento($dto)); | ||
439 | + }); | ||
440 | + $this->get('/tipo/template', function($request, $response, $args){ | ||
441 | + /** @var $request Slim\Http\Request */ | ||
442 | + $rn = new MdWsSeiDocumentoRN(); | ||
443 | + $dto = new MdWsSeiDocumentoDTO(); | ||
444 | + $dto->setNumIdTipoDocumento($request->getParam('id')); | ||
445 | + //$dto->setNumIdTipoProcedimento($request->getParam('idTipoProcedimento')); | ||
446 | + $dto->setNumIdProcesso($request->getParam('procedimento')); | ||
447 | + | ||
448 | + return $response->withJSON($rn->pesquisarTemplateDocumento($dto)); | ||
449 | + }); | ||
319 | $this->get('/baixar/anexo/{protocolo}', function($request, $response, $args){ | 450 | $this->get('/baixar/anexo/{protocolo}', function($request, $response, $args){ |
320 | /** @var $request Slim\Http\Request */ | 451 | /** @var $request Slim\Http\Request */ |
321 | $rn = new MdWsSeiDocumentoRN(); | 452 | $rn = new MdWsSeiDocumentoRN(); |
@@ -325,7 +456,120 @@ $app->group('/api/v1',function(){ | @@ -325,7 +456,120 @@ $app->group('/api/v1',function(){ | ||
325 | } | 456 | } |
326 | return $response->withJSON($rn->downloadAnexo($dto)); | 457 | return $response->withJSON($rn->downloadAnexo($dto)); |
327 | }); | 458 | }); |
459 | + $this->post('/interno/criar', function($request, $response, $args){ | ||
460 | + | ||
461 | + /** @var $request Slim\Http\Request */ | ||
462 | + | ||
463 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
464 | + | ||
465 | + $observacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacao')); | ||
466 | + $descricaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('descricao')); | ||
467 | + | ||
468 | + | ||
469 | + $dto = new MdWsSeiDocumentoDTO(); | ||
470 | + $dto->setNumIdProcesso($request->getParam('processo')); | ||
471 | + $dto->setNumIdTipoDocumento($request->getParam('tipoDocumento')); | ||
472 | + $dto->setStrDescricao($descricaoFormatado); | ||
473 | + $dto->setStrNivelAcesso($request->getParam('nivelAcesso')); | ||
474 | + $dto->setNumIdHipoteseLegal($request->getParam('hipoteseLegal')); | ||
475 | + $dto->setStrGrauSigilo($request->getParam('grauSigilo')); | ||
476 | + $dto->setArrAssuntos(json_decode($request->getParam('assuntos'), TRUE)); | ||
477 | + $dto->setArrInteressados(json_decode($request->getParam('interessados'), TRUE)); | ||
478 | + $dto->setArrDestinatarios(json_decode($request->getParam('destinatarios'), TRUE)); | ||
479 | + $dto->setStrObservacao($observacaoFormatado); | ||
328 | 480 | ||
481 | + $rn = new MdWsSeiDocumentoRN(); | ||
482 | + | ||
483 | + return $response->withJSON( | ||
484 | + $rn->documentoInternoCriar($dto) | ||
485 | + ); | ||
486 | + }); | ||
487 | + $this->post('/externo/criar', function($request, $response, $args){ | ||
488 | + | ||
489 | + | ||
490 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
491 | + | ||
492 | + $nomeArquivoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('nomeArquivo')); | ||
493 | + $descricaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('descricao')); | ||
494 | + $observacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacao')); | ||
495 | + $binarioFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('conteudoDocumento')); | ||
496 | + $numeroFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('numero')); | ||
497 | + | ||
498 | + /** @var $request Slim\Http\Request */ | ||
499 | + $dto = new MdWsSeiDocumentoDTO(); | ||
500 | + $dto->setNumIdProcesso($request->getParam('processo')); | ||
501 | + $dto->setNumIdTipoDocumento($request->getParam('tipoDocumento')); | ||
502 | + $dto->setDtaDataGeracaoDocumento(InfraData::getStrDataAtual()); | ||
503 | + $dto->setStrNumero($numeroFormatado); | ||
504 | + $dto->setStrDescricao($descricaoFormatado); | ||
505 | + $dto->setStrNomeArquivo($nomeArquivoFormatado); | ||
506 | + $dto->setStrNivelAcesso($request->getParam('nivelAcesso')); | ||
507 | + $dto->setNumIdHipoteseLegal($request->getParam('hipoteseLegal')); | ||
508 | + $dto->setStrGrauSigilo($request->getParam('grauSigilo')); | ||
509 | + $dto->setArrAssuntos(json_decode($request->getParam('assuntos'), TRUE)); | ||
510 | + $dto->setArrInteressados(json_decode($request->getParam('interessados'), TRUE)); | ||
511 | + $dto->setArrDestinatarios(json_decode($request->getParam('destinatarios'), TRUE)); | ||
512 | + $dto->setArrRemetentes(json_decode($request->getParam('remetentes'), TRUE)); | ||
513 | + $dto->setStrConteudoDocumento($binarioFormatado); | ||
514 | + $dto->setStrObservacao($observacaoFormatado); | ||
515 | + $dto->setNumTipoConferencia($request->getParam('tipoConferencia')); | ||
516 | + | ||
517 | + | ||
518 | + $rn = new MdWsSeiDocumentoRN(); | ||
519 | + | ||
520 | + return $response->withJSON( | ||
521 | + $rn->documentoExternoCriar($dto) | ||
522 | + ); | ||
523 | + }); | ||
524 | + $this->post('/incluir', function($request, $response, $args){ | ||
525 | + try{ | ||
526 | + /** @var $request Slim\Http\Request */ | ||
527 | + $objDocumentoAPI = new DocumentoAPI(); | ||
528 | + //Se o ID do processo é conhecido utilizar setIdProcedimento no lugar de | ||
529 | + //setProtocoloProcedimento | ||
530 | + //evitando uma consulta ao banco | ||
531 | + $objDocumentoAPI->setProtocoloProcedimento('99990.000109/2018-36'); | ||
532 | + //$objDocumentoAPI->setIdProcedimento(); | ||
533 | + $objDocumentoAPI->setTipo('G'); | ||
534 | + $objDocumentoAPI->setIdSerie(371); | ||
535 | + $objDocumentoAPI->setConteudo(base64_encode('Texto do documento interno')); | ||
536 | + $objSeiRN = new SeiRN(); | ||
537 | + $objSeiRN->incluirDocumento($objDocumentoAPI); | ||
538 | + } catch (InfraException $e) { | ||
539 | + die($e->getStrDescricao()); | ||
540 | + } | ||
541 | + //return $response->withJSON(); | ||
542 | + }); | ||
543 | + | ||
544 | + $this->post('/linkedicao', function ($request, $response, $args) { | ||
545 | + try { | ||
546 | + session_start(); | ||
547 | + | ||
548 | + if(empty($request->getParam('id_documento'))) | ||
549 | + throw new InfraException('Deve ser passado valor para o (id_documento).'); | ||
550 | + | ||
551 | + // Recupera o id do procedimento | ||
552 | + $protocoloDTO = new DocumentoDTO(); | ||
553 | + $protocoloDTO->setDblIdDocumento($request->getParam('id_documento')); | ||
554 | + $protocoloDTO->retDblIdProcedimento(); | ||
555 | + $protocoloRN = new DocumentoRN(); | ||
556 | + $protocoloDTO = $protocoloRN->consultarRN0005($protocoloDTO); | ||
557 | + | ||
558 | + if(empty($protocoloDTO)) | ||
559 | + throw new InfraException('Documento não encontrado'); | ||
560 | + | ||
561 | + $linkassinado = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=editor_montar&acao_origem=arvore_visualizar&id_procedimento=' . $protocoloDTO->getDblIdProcedimento() . '&id_documento=' . $request->getParam('id_documento')); | ||
562 | + | ||
563 | + return $response->withJSON( | ||
564 | + array("link" => $linkassinado, "phpsessid" => session_id()) | ||
565 | + ); | ||
566 | + | ||
567 | + } catch (InfraException $e) { | ||
568 | + die($e->getStrDescricao()); | ||
569 | + } | ||
570 | + }); | ||
571 | + | ||
572 | + | ||
329 | })->add( new TokenValidationMiddleware()); | 573 | })->add( new TokenValidationMiddleware()); |
330 | 574 | ||
331 | /** | 575 | /** |
@@ -380,6 +624,68 @@ $app->group('/api/v1',function(){ | @@ -380,6 +624,68 @@ $app->group('/api/v1',function(){ | ||
380 | $rn->apiConsultarProcessoDigitado(MdWsSeiRest::dataToIso88591($request->getParam('protocoloFormatado'))) | 624 | $rn->apiConsultarProcessoDigitado(MdWsSeiRest::dataToIso88591($request->getParam('protocoloFormatado'))) |
381 | ); | 625 | ); |
382 | }); | 626 | }); |
627 | + | ||
628 | + | ||
629 | + $this->get('/tipo/listar', function($request, $response, $args){ | ||
630 | + /** @var $request Slim\Http\Request */ | ||
631 | + $rn = new MdWsSeiProcedimentoRN(); | ||
632 | + | ||
633 | + $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO(); | ||
634 | + $objGetMdWsSeiTipoProcedimentoDTO->setNumIdTipoProcedimento($request->getParam('id')); | ||
635 | + $objGetMdWsSeiTipoProcedimentoDTO->setStrNome($request->getParam('filter')); | ||
636 | +// $objGetMdWsSeiTipoProcedimentoDTO->setStrSinInterno($request->getParam('internos')); | ||
637 | + $objGetMdWsSeiTipoProcedimentoDTO->setStrFavoritos($request->getParam('favoritos')); | ||
638 | + $objGetMdWsSeiTipoProcedimentoDTO->setNumStart($request->getParam('start')); | ||
639 | + $objGetMdWsSeiTipoProcedimentoDTO->setNumLimit($request->getParam('limit')); | ||
640 | + | ||
641 | + return $response->withJSON( | ||
642 | + $rn->listarTipoProcedimento($objGetMdWsSeiTipoProcedimentoDTO) | ||
643 | + ); | ||
644 | + }); | ||
645 | + | ||
646 | + $this->get('/consultar/{id}', function($request, $response, $args){ | ||
647 | + /** @var $request Slim\Http\Request */ | ||
648 | + $rn = new MdWsSeiProcedimentoRN(); | ||
649 | + | ||
650 | + $dto = new MdWsSeiProcedimentoDTO(); | ||
651 | + //Atribuir parametros para o DTO | ||
652 | + if($request->getAttribute('route')->getArgument('id')){ | ||
653 | + $dto->setNumIdProcedimento($request->getAttribute('route')->getArgument('id')); | ||
654 | + } | ||
655 | + | ||
656 | + return $response->withJSON($rn->consultarProcesso($dto)); | ||
657 | + }); | ||
658 | + | ||
659 | + $this->get('/assunto/pesquisar', function($request, $response, $args){ | ||
660 | + /** @var $request Slim\Http\Request */ | ||
661 | + $rn = new MdWsSeiProcedimentoRN(); | ||
662 | + $objGetMdWsSeiAssuntoDTO = new MdWsSeiAssuntoDTO(); | ||
663 | + $objGetMdWsSeiAssuntoDTO->setNumIdAssunto($request->getParam('id')); | ||
664 | + $objGetMdWsSeiAssuntoDTO->setStrFilter($request->getParam('filter')); | ||
665 | + $objGetMdWsSeiAssuntoDTO->setNumStart($request->getParam('start')); | ||
666 | + $objGetMdWsSeiAssuntoDTO->setNumLimit($request->getParam('limit')); | ||
667 | + | ||
668 | + return $response->withJSON( | ||
669 | + $rn->listarAssunto($objGetMdWsSeiAssuntoDTO) | ||
670 | + ); | ||
671 | + }); | ||
672 | + | ||
673 | + $this->get('/tipo/template', function($request, $response, $args){ | ||
674 | + /** @var $request Slim\Http\Request */ | ||
675 | + $rn = new MdWsSeiProcedimentoRN(); | ||
676 | + | ||
677 | + $dto = new MdWsSeiTipoProcedimentoDTO(); | ||
678 | + $dto->setNumIdTipoProcedimento($request->getParam('id')); | ||
679 | + | ||
680 | + return $response->withJSON( | ||
681 | + $rn->buscarTipoTemplate($dto) | ||
682 | + ); | ||
683 | + }); | ||
684 | + | ||
685 | + | ||
686 | + | ||
687 | + | ||
688 | + | ||
383 | $this->post('/{protocolo}/sobrestar/processo', function($request, $response, $args){ | 689 | $this->post('/{protocolo}/sobrestar/processo', function($request, $response, $args){ |
384 | /** @var $request Slim\Http\Request */ | 690 | /** @var $request Slim\Http\Request */ |
385 | $rn = new MdWsSeiProcedimentoRN(); | 691 | $rn = new MdWsSeiProcedimentoRN(); |
@@ -428,6 +734,11 @@ $app->group('/api/v1',function(){ | @@ -428,6 +734,11 @@ $app->group('/api/v1',function(){ | ||
428 | /** @var $request Slim\Http\Request */ | 734 | /** @var $request Slim\Http\Request */ |
429 | $rn = new MdWsSeiProcedimentoRN(); | 735 | $rn = new MdWsSeiProcedimentoRN(); |
430 | $dto = new MdWsSeiProtocoloDTO(); | 736 | $dto = new MdWsSeiProtocoloDTO(); |
737 | + | ||
738 | + if($request->getParam('id')){ | ||
739 | + $dto->setDblIdProtocolo($request->getParam('id')); | ||
740 | + } | ||
741 | + | ||
431 | if($request->getParam('limit')){ | 742 | if($request->getParam('limit')){ |
432 | $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); | 743 | $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); |
433 | } | 744 | } |
@@ -622,6 +933,80 @@ $app->group('/api/v1',function(){ | @@ -622,6 +933,80 @@ $app->group('/api/v1',function(){ | ||
622 | return $response->withJSON($rn->listarCredenciaisProcesso($dto)); | 933 | return $response->withJSON($rn->listarCredenciaisProcesso($dto)); |
623 | }); | 934 | }); |
624 | 935 | ||
936 | + $this->post('/criar', function($request, $response, $args){ | ||
937 | + /** @var $request Slim\Http\Request */ | ||
938 | + //Assunto explode lista de objetos | ||
939 | + $assuntos = array(); | ||
940 | + $assuntos = json_decode($request->getParam('assuntos'), TRUE); | ||
941 | +// if($request->getParam('assunto')){ | ||
942 | +// $assuntos = explode(",",$request->getParam('assunto')); | ||
943 | +// } | ||
944 | + | ||
945 | + //Interessado explode lista de objetos | ||
946 | + $interessados = array(); | ||
947 | + $interessados = json_decode($request->getParam('interessados'), TRUE); | ||
948 | +// if($request->getParam('interessado')){ | ||
949 | +// $interessados = explode(",",$request->getParam('interessado')); | ||
950 | +// } | ||
951 | + | ||
952 | + $rn = new MdWsSeiProcedimentoRN(); | ||
953 | + $dto = new MdWsSeiProcedimentoDTO(); | ||
954 | + | ||
955 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
956 | + | ||
957 | + $especificacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('especificacao')); | ||
958 | + $observacoesFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacoes')); | ||
959 | + | ||
960 | + //Atribuir parametros para o DTO | ||
961 | + $dto->setArrObjInteressado($interessados); | ||
962 | + $dto->setArrObjAssunto($assuntos); | ||
963 | + $dto->setNumIdTipoProcedimento($request->getParam('tipoProcesso')); | ||
964 | + $dto->setStrEspecificacao($especificacaoFormatado); | ||
965 | + $dto->setStrObservacao($observacoesFormatado); | ||
966 | + $dto->setNumNivelAcesso($request->getParam('nivelAcesso')); | ||
967 | + $dto->setNumIdHipoteseLegal($request->getParam('hipoteseLegal')); | ||
968 | + $dto->setStrStaGrauSigilo($request->getParam('grauSigilo')); | ||
969 | + | ||
970 | + return $response->withJSON($rn->gerarProcedimento($dto)); | ||
971 | + }); | ||
972 | + | ||
973 | + $this->post('/alterar', function($request, $response, $args){ | ||
974 | + /** @var $request Slim\Http\Request */ | ||
975 | + | ||
976 | + //Assunto explode lista de objetos | ||
977 | + $assuntos = array(); | ||
978 | + if($request->getParam('assuntos')){ | ||
979 | + $assuntos = json_decode($request->getParam('assuntos'), TRUE); | ||
980 | + } | ||
981 | + //Interessado explode lista de objetos | ||
982 | + $interessados = array(); | ||
983 | + if($request->getParam('interessados')){ | ||
984 | + $interessados = json_decode($request->getParam('interessados'), TRUE); | ||
985 | + } | ||
986 | + | ||
987 | + $rn = new MdWsSeiProcedimentoRN(); | ||
988 | + $dto = new MdWsSeiProcedimentoDTO(); | ||
989 | + | ||
990 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
991 | + | ||
992 | + $especificacaoFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('especificacao')); | ||
993 | + $observacoesFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('observacoes')); | ||
994 | + | ||
995 | + //Atribuir parametros para o DTO | ||
996 | + $dto->setNumIdProcedimento($request->getParam('id')); | ||
997 | + $dto->setArrObjInteressado($interessados); | ||
998 | + $dto->setArrObjAssunto($assuntos); | ||
999 | + $dto->setNumIdTipoProcedimento($request->getParam('tipoProcesso')); | ||
1000 | + $dto->setStrEspecificacao($especificacaoFormatado); | ||
1001 | + $dto->setStrObservacao($observacoesFormatado); | ||
1002 | + $dto->setNumNivelAcesso($request->getParam('nivelAcesso')); | ||
1003 | + $dto->setNumIdHipoteseLegal($request->getParam('hipoteseLegal')); | ||
1004 | + $dto->setStrStaGrauSigilo($request->getParam('grauSigilo')); | ||
1005 | + | ||
1006 | + return $response->withJSON($rn->alterarProcedimento($dto)); | ||
1007 | + }); | ||
1008 | + | ||
1009 | + | ||
625 | })->add( new TokenValidationMiddleware()); | 1010 | })->add( new TokenValidationMiddleware()); |
626 | 1011 | ||
627 | /** | 1012 | /** |
@@ -709,6 +1094,64 @@ $app->group('/api/v1',function(){ | @@ -709,6 +1094,64 @@ $app->group('/api/v1',function(){ | ||
709 | }); | 1094 | }); |
710 | 1095 | ||
711 | })->add( new TokenValidationMiddleware()); | 1096 | })->add( new TokenValidationMiddleware()); |
1097 | + | ||
1098 | + | ||
1099 | + /** | ||
1100 | + * Grupo de controlador contato | ||
1101 | + */ | ||
1102 | + $this->group('/contato', function(){ | ||
1103 | + $this->get('/pesquisar', function($request, $response, $args){ | ||
1104 | + /** @var $request Slim\Http\Request */ | ||
1105 | + | ||
1106 | + $dto = new MdWsSeiContatoDTO(); | ||
1107 | + $dto->setNumIdContato($request->getParam('id')); | ||
1108 | + $dto->setStrFilter($request->getParam('filter')); | ||
1109 | + $dto->setNumStart($request->getParam('start')); | ||
1110 | + $dto->setNumLimit($request->getParam('limit')); | ||
1111 | + | ||
1112 | + $rn = new MdWsSeiContatoRN(); | ||
1113 | + return $response->withJSON($rn->listarContato($dto)); | ||
1114 | + }); | ||
1115 | + | ||
1116 | + $this->post('/criar', function($request, $response, $args){ | ||
1117 | + /** @var $request Slim\Http\Request */ | ||
1118 | + | ||
1119 | + $dto = new MdWsSeiContatoDTO(); | ||
1120 | + | ||
1121 | + | ||
1122 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
1123 | + | ||
1124 | + $nomeFormatado = iconv('UTF-8', 'ISO-8859-1', $request->getParam('nome')); | ||
1125 | + | ||
1126 | + $dto->setStrNome($nomeFormatado); | ||
1127 | + | ||
1128 | + $rn = new MdWsSeiContatoRN(); | ||
1129 | + return $response->withJSON($rn->criarContato($dto)); | ||
1130 | + }); | ||
1131 | + | ||
1132 | + | ||
1133 | + })->add( new TokenValidationMiddleware()); | ||
1134 | + | ||
1135 | + /** | ||
1136 | + * Grupo de controlador HipoteseLegal | ||
1137 | + */ | ||
1138 | + $this->group('/hipoteseLegal', function(){ | ||
1139 | + $this->get('/pesquisar', function($request, $response, $args){ | ||
1140 | + /** @var $request Slim\Http\Request */ | ||
1141 | + | ||
1142 | + $dto = new MdWsSeiHipoteseLegalDTO(); | ||
1143 | + $dto->setNumIdHipoteseLegal($request->getParam('id')); | ||
1144 | + $dto->setNumNivelAcesso($request->getParam('nivelAcesso')); | ||
1145 | + $dto->setStrFilter($request->getParam('filter')); | ||
1146 | + $dto->setNumStart($request->getParam('start')); | ||
1147 | + $dto->setNumLimit($request->getParam('limit')); | ||
1148 | + | ||
1149 | + $rn = new MdWsSeiHipoteseLegalRN(); | ||
1150 | + return $response->withJSON($rn->listarHipoteseLegal($dto)); | ||
1151 | + }); | ||
1152 | + })->add( new TokenValidationMiddleware()); | ||
1153 | + | ||
1154 | + | ||
712 | $this->group('/debug', function() { | 1155 | $this->group('/debug', function() { |
713 | $this->get('/', function ($request, $response, $args) { | 1156 | $this->get('/', function ($request, $response, $args) { |
714 | /** @var $request Slim\Http\Request */ | 1157 | /** @var $request Slim\Http\Request */ |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiTipoProcedimentoDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiAssuntoDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + public function montar(){ | ||
16 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdAssunto'); | ||
17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Filter'); | ||
18 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Start'); | ||
19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Limit'); | ||
20 | + } | ||
21 | + | ||
22 | +} | ||
23 | + |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiTipoProcedimentoDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiContatoDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + public function montar(){ | ||
16 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdContato'); | ||
17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Nome'); | ||
18 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Filter'); | ||
19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Start'); | ||
20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Limit'); | ||
21 | + } | ||
22 | + | ||
23 | +} | ||
24 | + |
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiDocumentoDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiDocumentoDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + public function montar(){ | ||
20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdProcesso'); | ||
21 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataGeracaoDocumento'); | ||
22 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Numero'); | ||
23 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoDocumento'); | ||
24 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); | ||
25 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Descricao'); | ||
26 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeArquivo'); | ||
27 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NivelAcesso'); | ||
28 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal'); | ||
29 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'GrauSigilo'); | ||
30 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Assuntos'); | ||
31 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Interessados'); | ||
32 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Destinatarios'); | ||
33 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Remetentes'); | ||
34 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ConteudoDocumento'); | ||
35 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Observacao'); | ||
36 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'TipoConferencia'); | ||
37 | + | ||
38 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeTipoDocumento'); | ||
39 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Favoritos'); | ||
40 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Aplicabilidade'); | ||
41 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Start'); | ||
42 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Limit'); | ||
43 | + } | ||
44 | + | ||
45 | +} | ||
46 | + |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiHipoteseLegalDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiHipoteseLegalDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + public function montar(){ | ||
16 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal'); | ||
17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Nome'); | ||
18 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Filter'); | ||
19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'NivelAcesso'); | ||
20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Start'); | ||
21 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Limit'); | ||
22 | + } | ||
23 | + | ||
24 | +} | ||
25 | + |
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiProcedimentoDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiProcedimentoDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + public function montar(){ | ||
16 | + | ||
17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdProcedimento'); | ||
18 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); | ||
19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Especificacao'); | ||
20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjAssunto'); | ||
21 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjInteressado'); | ||
22 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Observacao'); | ||
23 | + // 0 publico | ||
24 | + // 1 restrito | ||
25 | + // 2 sigiloso | ||
26 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'NivelAcesso'); | ||
27 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal'); | ||
28 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'StaGrauSigilo'); | ||
29 | + } | ||
30 | + | ||
31 | +} |
dto/MdWsSeiProtocoloDTO.php
@@ -45,7 +45,7 @@ class MdWsSeiProtocoloDTO extends ProtocoloDTO{ | @@ -45,7 +45,7 @@ class MdWsSeiProtocoloDTO extends ProtocoloDTO{ | ||
45 | 45 | ||
46 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinTipoBusca'); | 46 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinTipoBusca'); |
47 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinApenasMeus'); | 47 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinApenasMeus'); |
48 | - | 48 | + |
49 | $this->configurarFK('IdProtocolo', 'procedimento p2', 'p2.id_procedimento', InfraDTO::$TIPO_FK_OBRIGATORIA); | 49 | $this->configurarFK('IdProtocolo', 'procedimento p2', 'p2.id_procedimento', InfraDTO::$TIPO_FK_OBRIGATORIA); |
50 | $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); | 50 | $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); |
51 | } | 51 | } |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/** | ||
4 | + * Class MdWsSeiTipoProcedimentoDTO | ||
5 | + * DTO somente para encapsulamento de dados. | ||
6 | + * OBS: Nao estou usando API pois em modulos do SEI o autoload nao carrega as API's. | ||
7 | + */ | ||
8 | +class MdWsSeiTipoProcedimentoDTO extends InfraDTO{ | ||
9 | + | ||
10 | + public function getStrNomeTabela() | ||
11 | + { | ||
12 | + throw new InfraException('DTO nao utilizavel para consulta!'); | ||
13 | + } | ||
14 | + | ||
15 | + public function montar(){ | ||
16 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); | ||
17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Nome'); | ||
18 | +// $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinInterno'); | ||
19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Favoritos'); | ||
20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Start'); | ||
21 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'Limit'); | ||
22 | + } | ||
23 | + | ||
24 | +} | ||
25 | + |
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
1 | +<?php | ||
2 | +session_start(); | ||
3 | + | ||
4 | +/** | ||
5 | + * Controlador (API v1) de servicos REST usando o framework Slim | ||
6 | + */ | ||
7 | + | ||
8 | +require_once dirname(__FILE__) . '/../../SEI.php'; | ||
9 | +require_once dirname(__FILE__) . '/vendor/autoload.php'; | ||
10 | + | ||
11 | + | ||
12 | +//// parada da validação do token e login | ||
13 | + | ||
14 | +session_start(); | ||
15 | + | ||
16 | + | ||
17 | +//$_REQUEST['documento_id'] = '105'; | ||
18 | +//$_REQUEST['token'] = 'YTE5YzgzNDM0OWFhMDNlNzAxMWY3OWNkN2UwZTYwZDdlZDAxNzFkM2FUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9'; | ||
19 | + | ||
20 | +if(empty($_REQUEST['id_documento'])) | ||
21 | + throw new InfraException('Deve ser passado valor para o (id_documento).'); | ||
22 | + | ||
23 | +if(empty($_REQUEST['token'])) | ||
24 | + throw new InfraException('Deve ser passado token no header.'); | ||
25 | + | ||
26 | + | ||
27 | +$token = $_REQUEST['token']; | ||
28 | + | ||
29 | +if(!$token) | ||
30 | + return new InfraException('Acesso negado!'); | ||
31 | + | ||
32 | +$rn = new MdWsSeiUsuarioRN(); | ||
33 | + | ||
34 | +$result = $rn->autenticarToken($token); | ||
35 | + | ||
36 | +if(!$result['sucesso']){ | ||
37 | + new InfraException('Token inválido!'); | ||
38 | +} | ||
39 | + | ||
40 | +$tokenData = $rn->tokenDecode($token); | ||
41 | + | ||
42 | +$rn = new MdWsSeiUsuarioRN(); | ||
43 | +$usuarioDTO = new UsuarioDTO(); | ||
44 | +$contextoDTO = new ContextoDTO(); | ||
45 | +$usuarioDTO->setStrSigla($tokenData[0]); | ||
46 | +$usuarioDTO->setStrSenha($tokenData[1]); | ||
47 | +$contextoDTO->setNumIdContexto(null); | ||
48 | +$orgaoDTO = new OrgaoDTO(); | ||
49 | +$orgaoDTO->setNumIdOrgao(null); | ||
50 | +$return = $rn->apiAutenticar($usuarioDTO, $contextoDTO, $orgaoDTO); | ||
51 | + | ||
52 | +// Recupera o id do procedimento | ||
53 | +$protocoloDTO = new DocumentoDTO(); | ||
54 | +$protocoloDTO->setDblIdDocumento($_REQUEST['id_documento']); | ||
55 | +$protocoloDTO->retDblIdProcedimento(); | ||
56 | +$protocoloRN = new DocumentoRN(); | ||
57 | +$protocoloDTO = $protocoloRN->consultarRN0005($protocoloDTO); | ||
58 | + | ||
59 | +if(empty($protocoloDTO)) | ||
60 | + return new InfraException('Documento não encontrado'); | ||
61 | + | ||
62 | + | ||
63 | +$linkassinado = SessaoSEI::getInstance()->assinarLink('/sei/controlador.php?acao=editor_montar&acao_origem=arvore_visualizar&id_procedimento=' . $protocoloDTO->getDblIdProcedimento() . '&id_documento=' . $_REQUEST['id_documento']); | ||
64 | + | ||
65 | + header('Location: ' . $linkassinado); | ||
66 | + |
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/teste.pdf"); | ||
4 | +//$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/c.pdf"); | ||
5 | + | ||
6 | +$ch = curl_init("http://192.168.99.100/sei/modulos/mod-wssei/controlador_ws.php/api/v1/documento/externo/alterar"); | ||
7 | + | ||
8 | +//distribuindo a informação a ser enviada | ||
9 | +$post = array( | ||
10 | + 'documento' => '241', | ||
11 | + 'data' => '31/01/2017', | ||
12 | + 'idTipoDocumento' => '106', | ||
13 | + 'numero' => '12321313', | ||
14 | + 'nomeArquivo' => 'teste.pdf', | ||
15 | + 'nivelAcesso' => '1', | ||
16 | + 'hipoteseLegal' => '1', | ||
17 | + 'grauSigilo' => '', | ||
18 | + 'assuntos' => '[{"id": 79}]', | ||
19 | + 'interessados' => '[{"id": 100000012 },{"id":100000044}]', | ||
20 | + 'destinatarios' => '[{"id":100000044}]', | ||
21 | + 'remetentes' => '[{"id":100000044}]', | ||
22 | + 'conteudoDocumento' => $file, | ||
23 | +// 'conteudoDocumento' => "", | ||
24 | + 'observacao' => 'paçoca', | ||
25 | + 'tipoConferencia' => '3', | ||
26 | +); | ||
27 | + | ||
28 | +$headers = array(); | ||
29 | + | ||
30 | +curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | ||
31 | +curl_setopt($ch, CURLOPT_HTTPHEADER, array('token: YTRhZDBmOTEyYjUxY2MzYTgzNjc3NDMwNWNjM2JiMzFmY2U4ZTkxYmFUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9')); | ||
32 | + | ||
33 | +$data = curl_exec($ch); | ||
34 | + | ||
35 | +//Fecha a conexão para economizar recursos do servidor | ||
36 | +curl_close($ch); | ||
37 | + | ||
38 | +var_dump($data); | ||
39 | +die(); | ||
40 | + | ||
41 | +?> | ||
0 | \ No newline at end of file | 42 | \ No newline at end of file |
rn/MdWsSeiBlocoRN.php
@@ -157,7 +157,7 @@ class MdWsSeiBlocoRN extends InfraRN { | @@ -157,7 +157,7 @@ class MdWsSeiBlocoRN extends InfraRN { | ||
157 | if($blocoDTOConsulta->getNumMaxRegistrosRetorno()){ | 157 | if($blocoDTOConsulta->getNumMaxRegistrosRetorno()){ |
158 | $relBlocoProtocoloDTOConsulta->setNumMaxRegistrosRetorno($blocoDTOConsulta->getNumMaxRegistrosRetorno()); | 158 | $relBlocoProtocoloDTOConsulta->setNumMaxRegistrosRetorno($blocoDTOConsulta->getNumMaxRegistrosRetorno()); |
159 | }else{ | 159 | }else{ |
160 | - $relBlocoProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); | 160 | + $relBlocoProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10000000); |
161 | } | 161 | } |
162 | if(!is_null($blocoDTOConsulta->getNumPaginaAtual())){ | 162 | if(!is_null($blocoDTOConsulta->getNumPaginaAtual())){ |
163 | $relBlocoProtocoloDTOConsulta->setNumPaginaAtual($blocoDTOConsulta->getNumPaginaAtual()); | 163 | $relBlocoProtocoloDTOConsulta->setNumPaginaAtual($blocoDTOConsulta->getNumPaginaAtual()); |
@@ -179,6 +179,7 @@ class MdWsSeiBlocoRN extends InfraRN { | @@ -179,6 +179,7 @@ class MdWsSeiBlocoRN extends InfraRN { | ||
179 | /** @var RelBlocoProtocoloDTO $relBlocoProtocoloDTO */ | 179 | /** @var RelBlocoProtocoloDTO $relBlocoProtocoloDTO */ |
180 | foreach($arrRelProtocolo as $relBlocoProtocoloDTO){ | 180 | foreach($arrRelProtocolo as $relBlocoProtocoloDTO){ |
181 | $relProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | 181 | $relProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); |
182 | + $relProtocoloProtocoloDTO->setStrStaAssociacao($protocoloProtocoloRN::$TA_DOCUMENTO_CIRCULAR , InfraDTO::$OPER_DIFERENTE); | ||
182 | $relProtocoloProtocoloDTO->setDblIdProtocolo2($relBlocoProtocoloDTO->getDblIdProtocolo()); | 183 | $relProtocoloProtocoloDTO->setDblIdProtocolo2($relBlocoProtocoloDTO->getDblIdProtocolo()); |
183 | $relProtocoloProtocoloDTO->retDblIdProtocolo1(); | 184 | $relProtocoloProtocoloDTO->retDblIdProtocolo1(); |
184 | $relProtocoloProtocoloDTO = $protocoloProtocoloRN->consultarRN0841($relProtocoloProtocoloDTO); | 185 | $relProtocoloProtocoloDTO = $protocoloProtocoloRN->consultarRN0841($relProtocoloProtocoloDTO); |
@@ -237,7 +238,8 @@ class MdWsSeiBlocoRN extends InfraRN { | @@ -237,7 +238,8 @@ class MdWsSeiBlocoRN extends InfraRN { | ||
237 | } | 238 | } |
238 | } | 239 | } |
239 | 240 | ||
240 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $relBlocoProtocoloDTOConsulta->getNumTotalRegistros()); | 241 | + |
242 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, count($result)); | ||
241 | }catch (Exception $e){ | 243 | }catch (Exception $e){ |
242 | return MdWsSeiRest::formataRetornoErroREST($e); | 244 | return MdWsSeiRest::formataRetornoErroREST($e); |
243 | } | 245 | } |
@@ -0,0 +1,115 @@ | @@ -0,0 +1,115 @@ | ||
1 | +<?php | ||
2 | +require_once dirname(__FILE__).'/../../../SEI.php'; | ||
3 | + | ||
4 | +class MdWsSeiContatoRN extends InfraRN | ||
5 | +{ | ||
6 | + | ||
7 | + protected function inicializarObjInfraIBanco() | ||
8 | + { | ||
9 | + return BancoSEI::getInstance(); | ||
10 | + } | ||
11 | + | ||
12 | + | ||
13 | + /** | ||
14 | + * Retorna todos tipos de procedimentos filtrados | ||
15 | + * @param MdWsSeiTipoProcedimentoDTO $objGetMdWsSeiTipoProcedimentoDTO | ||
16 | + * @return array | ||
17 | + */ | ||
18 | + protected function listarContatoConectado(MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO) | ||
19 | + { | ||
20 | + try { | ||
21 | + | ||
22 | + $id = $objGetMdWsSeiContatoDTO->getNumIdContato(); | ||
23 | + $filter = $objGetMdWsSeiContatoDTO->getStrFilter(); | ||
24 | + $start = $objGetMdWsSeiContatoDTO->getNumStart(); | ||
25 | + $limit = $objGetMdWsSeiContatoDTO->getNumLimit(); | ||
26 | + $bool = false; | ||
27 | + | ||
28 | + $contatoDTO = new ContatoDTO(); | ||
29 | + | ||
30 | + if($id) | ||
31 | + $contatoDTO->setNumIdContato($id); | ||
32 | + | ||
33 | + if($filter) { | ||
34 | + $contatoDTO->adicionarCriterio(array('Nome', 'Nome'), | ||
35 | + array(InfraDTO::$OPER_LIKE, InfraDTO::$OPER_LIKE), | ||
36 | + array('%' . utf8_decode(str_replace("-"," ", $filter)) . '%', '%' . utf8_decode(str_replace(" ","-", $filter)) . '%'), | ||
37 | + array(InfraDTO::$OPER_LOGICO_OR)); | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | + $contatoCountDTO = new ContatoDTO(); | ||
42 | + $contatoCountDTO->retNumIdContato(); | ||
43 | + | ||
44 | + IF($limit) { | ||
45 | + $contatoDTO->setNumMaxRegistrosRetorno($limit); | ||
46 | + $bool = true; | ||
47 | + } | ||
48 | + | ||
49 | + IF($start) { | ||
50 | + $contatoDTO->setNumPaginaAtual($start); | ||
51 | + $bool = true; | ||
52 | + } | ||
53 | + | ||
54 | + $contatoDTO->retNumIdContato(); | ||
55 | + $contatoDTO->retStrSigla(); | ||
56 | + $contatoDTO->retStrNome(); | ||
57 | + | ||
58 | + $contatoRN = new ContatoRN(); | ||
59 | + $arrContatoDTO = $contatoRN->listarRN0325($contatoDTO); | ||
60 | + | ||
61 | + $contatoCountDTO = $contatoRN->listarRN0325($contatoCountDTO); | ||
62 | + | ||
63 | + $arrayRetorno = array(); | ||
64 | + if($arrContatoDTO){ | ||
65 | + foreach ($arrContatoDTO as $obj) { | ||
66 | + $arrayRetorno[] = array( | ||
67 | + "id" => $obj->getNumIdContato(), | ||
68 | + "sigla" => $obj->getStrSigla(), | ||
69 | + "nome" => $obj->getStrNome() | ||
70 | + ); | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + $total = 0; | ||
75 | + $total = count($arrayRetorno); | ||
76 | + | ||
77 | + if($bool){ | ||
78 | + $total = count($contatoCountDTO); | ||
79 | + } | ||
80 | + | ||
81 | + | ||
82 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
83 | + } catch (Exception $e) { | ||
84 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
85 | + } | ||
86 | + } | ||
87 | + | ||
88 | + | ||
89 | + /** | ||
90 | + * Realiza a inclusão de um contato no SEI. | ||
91 | + * @param MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO | ||
92 | + * @return array | ||
93 | + */ | ||
94 | + protected function criarContatoConectado(MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO) | ||
95 | + { | ||
96 | + try { | ||
97 | + | ||
98 | + $nome = $objGetMdWsSeiContatoDTO->getStrNome(); | ||
99 | + | ||
100 | + $objContatoDTO = new ContatoDTO(); | ||
101 | + $objContatoDTO->setStrNome($nome); | ||
102 | + | ||
103 | + $objContatoRN = new ContatoRN(); | ||
104 | + $objContatoDTO = $objContatoRN->cadastrarContextoTemporario($objContatoDTO); | ||
105 | + | ||
106 | + return MdWsSeiRest::formataRetornoSucessoREST(null,array("id"=>$objContatoDTO->getNumIdContato())); | ||
107 | + } catch (Exception $e) { | ||
108 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
109 | + } | ||
110 | + } | ||
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | ||
115 | +} | ||
0 | \ No newline at end of file | 116 | \ No newline at end of file |
rn/MdWsSeiDocumentoRN.php
1 | -<? | ||
2 | -require_once dirname(__FILE__).'/../../../SEI.php'; | 1 | +<?php |
2 | + | ||
3 | +require_once dirname(__FILE__) . '/../../../SEI.php'; | ||
3 | 4 | ||
4 | class MdWsSeiDocumentoRN extends DocumentoRN { | 5 | class MdWsSeiDocumentoRN extends DocumentoRN { |
5 | 6 | ||
6 | CONST NOME_ATRIBUTO_ANDAMENTO_DOCUMENTO = 'DOCUMENTO'; | 7 | CONST NOME_ATRIBUTO_ANDAMENTO_DOCUMENTO = 'DOCUMENTO'; |
7 | 8 | ||
8 | - protected function inicializarObjInfraIBanco(){ | 9 | + protected function inicializarObjInfraIBanco() { |
9 | return BancoSEI::getInstance(); | 10 | return BancoSEI::getInstance(); |
10 | } | 11 | } |
11 | 12 | ||
12 | /** | 13 | /** |
14 | + * Alterar Seção do documento | ||
15 | + * @param DocumentoDTO DocumentoDTO | ||
16 | + * @return array | ||
17 | + */ | ||
18 | + public function alterarSecaoDocumento($dados) { | ||
19 | + try { | ||
20 | + $idDocumento = $dados["documento"]; | ||
21 | + $numVersao = $dados["versao"]; | ||
22 | + $arrSecoes = $dados["secoes"]; | ||
23 | + | ||
24 | + // Criação do DTO de editor que realiza a edição das seções. | ||
25 | + $objEditorDTO = new EditorDTO(); | ||
26 | + | ||
27 | + $objEditorDTO->setDblIdDocumento($idDocumento); // Informa o id do documento | ||
28 | + $objEditorDTO->setNumVersao($numVersao); // Número da versão | ||
29 | + $objEditorDTO->setNumIdBaseConhecimento(null); | ||
30 | + $objEditorDTO->setStrSinIgnorarNovaVersao('N'); | ||
31 | + | ||
32 | + // Percorre as seções do documento alteradas | ||
33 | + $arrObjSecaoDocumentoDTO = array(); | ||
34 | + // var_dump($arrSecoes); die(); | ||
35 | + | ||
36 | + if ($arrSecoes) { | ||
37 | + foreach ($arrSecoes as $secao) { | ||
38 | + $objSecaoDocumentoDTO = new SecaoDocumentoDTO(); | ||
39 | +// $objSecaoDocumentoDTO->setNumIdSecaoModelo($secao['id']); | ||
40 | + $objSecaoDocumentoDTO->setNumIdSecaoDocumento($secao['id']); | ||
41 | + $objSecaoDocumentoDTO->setNumIdSecaoModelo($secao['idSecaoModelo']); | ||
42 | + $objSecaoDocumentoDTO->setStrConteudo($secao['conteudo']); | ||
43 | + $arrObjSecaoDocumentoDTO[] = $objSecaoDocumentoDTO; | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + $objEditorDTO->setArrObjSecaoDocumentoDTO($arrObjSecaoDocumentoDTO); | ||
48 | + | ||
49 | + // Realiza a alteração das seções. | ||
50 | + $objEditorRN = new EditorRN(); | ||
51 | + $numVersao = $objEditorRN->adicionarVersao($objEditorDTO); | ||
52 | + | ||
53 | + | ||
54 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $numVersao); | ||
55 | + } catch (Exception $e) { | ||
56 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Listar Seção do documento | ||
62 | + * @param DocumentoDTO DocumentoDTO | ||
63 | + * @return array | ||
64 | + */ | ||
65 | + protected function listarSecaoDocumentoConectado(DocumentoDTO $dto) { | ||
66 | + try { | ||
67 | + $id = $dto->getDblIdDocumento(); | ||
68 | + | ||
69 | + //Consulta que retorna todas as se | ||
70 | + $objVersaoSecaoDocumentoDTO = new VersaoSecaoDocumentoDTO(); | ||
71 | + $objVersaoSecaoDocumentoDTO->retNumIdSecaoModeloSecaoDocumento(); | ||
72 | + $objVersaoSecaoDocumentoDTO->retStrSinAssinaturaSecaoDocumento(); | ||
73 | + $objVersaoSecaoDocumentoDTO->retStrSinSomenteLeituraSecaoDocumento(); | ||
74 | + | ||
75 | + $objVersaoSecaoDocumentoDTO->retStrSinAssinaturaSecaoDocumento(); | ||
76 | + $objVersaoSecaoDocumentoDTO->retStrSinPrincipalSecaoDocumento(); | ||
77 | + $objVersaoSecaoDocumentoDTO->retStrSinDinamicaSecaoDocumento(); | ||
78 | + | ||
79 | + $objVersaoSecaoDocumentoDTO->retStrConteudo(); | ||
80 | + $objVersaoSecaoDocumentoDTO->retNumVersao(); | ||
81 | + $objVersaoSecaoDocumentoDTO->retNumIdSecaoDocumento(); | ||
82 | + $objVersaoSecaoDocumentoDTO->setDblIdDocumentoSecaoDocumento($id); | ||
83 | + $objVersaoSecaoDocumentoDTO->setNumIdBaseConhecimentoSecaoDocumento(null); | ||
84 | + $objVersaoSecaoDocumentoDTO->setStrSinUltima('S'); | ||
85 | + $objVersaoSecaoDocumentoDTO->setOrdNumOrdemSecaoDocumento(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
86 | + | ||
87 | + $objVersaoSecaoDocumentoRN = new VersaoSecaoDocumentoRN(); | ||
88 | + $arrObjVersaoSecaoDocumentoDTO = $objVersaoSecaoDocumentoRN->listar($objVersaoSecaoDocumentoDTO); | ||
89 | + | ||
90 | + $dadosSecaoDocumento = array(); | ||
91 | + $numVersao = 0; | ||
92 | + | ||
93 | + | ||
94 | + //Monta as seções que precisam ser retornadas e resgata o número da última versão | ||
95 | + $arrayRetorno = array(); | ||
96 | + if ($arrObjVersaoSecaoDocumentoDTO) { | ||
97 | + foreach ($arrObjVersaoSecaoDocumentoDTO as $obj) { | ||
98 | + if ($obj->getStrSinAssinaturaSecaoDocumento() == 'N') { | ||
99 | + $arrayRetorno["secoes"][] = array( | ||
100 | + "id" => $obj->getNumIdSecaoDocumento(), | ||
101 | + "idSecaoModelo" => $obj->getNumIdSecaoModeloSecaoDocumento(), | ||
102 | + "conteudo" => $obj->getStrConteudo(), | ||
103 | + "somenteLeitura" => $obj->getStrSinSomenteLeituraSecaoDocumento(), | ||
104 | + "AssinaturaSecaoDocumento" => $obj->getStrSinAssinaturaSecaoDocumento(), | ||
105 | + "PrincipalSecaoDocumento" => $obj->getStrSinPrincipalSecaoDocumento(), | ||
106 | + "DinamicaSecaoDocumento" => $obj->getStrSinDinamicaSecaoDocumento() | ||
107 | + ); | ||
108 | + } | ||
109 | + | ||
110 | + if ($obj->getNumVersao() > $numVersao) { | ||
111 | + $arrayRetorno["ultimaVersaoDocumento"] = $numVersao = $obj->getNumVersao(); | ||
112 | + } else { | ||
113 | + $arrayRetorno["ultimaVersaoDocumento"] = $numVersao; | ||
114 | + } | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
119 | + } catch (Exception $e) { | ||
120 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * Realiza a pesquisa dos tipos de documento do SEI. | ||
126 | + * @param MdWsSeiDocumentoDTO $dto | ||
127 | + * @return array | ||
128 | + */ | ||
129 | + protected function pesquisarTipoDocumentoConectado(MdWsSeiDocumentoDTO $dto) { | ||
130 | + try { | ||
131 | + | ||
132 | + $favoritos = $dto->getStrFavoritos(); | ||
133 | + $id = $dto->getNumIdTipoDocumento(); | ||
134 | + $nome = $dto->getStrNomeTipoDocumento(); | ||
135 | + $aplicabilidade = $dto->getArrAplicabilidade(); | ||
136 | + $start = $dto->getNumStart(); | ||
137 | + $limit = $dto->getNumLimit(); | ||
138 | +//PARÂMETROS DE ENTRADA | ||
139 | +// $ID = 0; | ||
140 | +// $FILTER = ''; | ||
141 | +// $START = 0; | ||
142 | +// $LIMIT = 5; | ||
143 | +// $favoritos = 'N'; | ||
144 | + //REALIZA A BUSCA DE TODOS OS TIPOS DA UNIDADE FILTRANDO APENAS PELOS FAVORITOS. APÓS A BUSCA, OS FILTROS POR ID, NOME E APLICABILIDADE DEVERÃO SER FEITOS PERCORRENDO CADA UM DOS TIPOS. | ||
145 | + | ||
146 | + $serieDTO = new SerieDTO(); | ||
147 | + $serieDTO->setStrSinSomenteUtilizados($favoritos); | ||
148 | + $serieDTO->retNumIdSerie(); | ||
149 | + $serieDTO->retStrNome(); | ||
150 | + $serieDTO->retStrStaAplicabilidade(); | ||
151 | + | ||
152 | + $serieRN = new SerieRN(); | ||
153 | + $arrObjSerieDTO = $serieRN->listarTiposUnidade($serieDTO); | ||
154 | + | ||
155 | + $arrayRetorno = array(); | ||
156 | + //FILTRA NOME, ID e APLICABILIDADE | ||
157 | + if ($arrObjSerieDTO) { | ||
158 | + foreach ($arrObjSerieDTO as $aux) { | ||
159 | + | ||
160 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
161 | + | ||
162 | + $objDtoFormatado = str_replace('?','',strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $aux->getStrNome()))); | ||
163 | + $nomeFormatado = str_replace('?','',strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $nome))); | ||
164 | + | ||
165 | + if ( | ||
166 | + ($aux->getNumIdSerie() == $id || !$id) && | ||
167 | + (($nomeFormatado && strpos(utf8_encode($objDtoFormatado), $nomeFormatado) !== false) || !$nomeFormatado) && | ||
168 | + (in_array($aux->getStrStaAplicabilidade(), $aplicabilidade) == $aplicabilidade || !$aplicabilidade[0]) | ||
169 | + ) { | ||
170 | + $arrayRetorno[] = array( | ||
171 | + "id" => $aux->getNumIdSerie(), | ||
172 | + "nome" => $aux->getStrNome() | ||
173 | + ); | ||
174 | + } | ||
175 | + } | ||
176 | + } | ||
177 | + | ||
178 | + $total = 0; | ||
179 | + $total = count($arrayRetorno); | ||
180 | + | ||
181 | + | ||
182 | + if ($start) | ||
183 | + $arrayRetorno = array_slice($arrayRetorno, ($start - 1)); | ||
184 | + if ($limit) | ||
185 | + $arrayRetorno = array_slice($arrayRetorno, 0, ($limit)); | ||
186 | + | ||
187 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
188 | + } catch (Exception $e) { | ||
189 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
190 | + } | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * O serviço de consulta de template de criação de processo informa ao client todas as variações existentes em um fomulário de criação de um documento. Entre essas variações estão: Assuntos Sugeridos , Existência de Destinatários_ e Existência de Interessados_ . | ||
195 | + * @param MdWsSeiDocumentoDTO $dto | ||
196 | + * @return array | ||
197 | + */ | ||
198 | + protected function pesquisarTemplateDocumentoConectado(MdWsSeiDocumentoDTO $dto) { | ||
199 | + try { | ||
200 | + | ||
201 | + $objProcedimentoDTO = new ProcedimentoDTO(); | ||
202 | + $objProcedimentoDTO->setDblIdProcedimento($dto->getNumIdProcesso()); | ||
203 | + $objProcedimentoDTO->retNumIdTipoProcedimento(); | ||
204 | + | ||
205 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
206 | + $objProcedimentoDTO = $objProcedimentoRN->listarRN0278($objProcedimentoDTO); | ||
207 | + | ||
208 | + if (!$objProcedimentoDTO) { | ||
209 | + throw new Exception('Não foi encontrado processo com id ' . $dto->getNumIdProcesso()); | ||
210 | + } | ||
211 | + | ||
212 | + // Consulta se o tipo de documento permite a inclusão de destinatários e interessados | ||
213 | + $serieDTO = new SerieDTO(); | ||
214 | + $serieDTO->setNumIdSerie($dto->getNumIdTipoDocumento()); | ||
215 | + $serieDTO->retStrSinDestinatario(); | ||
216 | + $serieDTO->retStrSinInteressado(); | ||
217 | + | ||
218 | + $serieRN = new SerieRN(); | ||
219 | + $arrSerieDTO = $serieRN->listarRN0646($serieDTO); | ||
220 | + | ||
221 | + if (!$arrSerieDTO) { | ||
222 | + throw new Exception('Não foi encontrado processo um tipo de processo ' . $dto->getNumIdTipoDocumento()); | ||
223 | + } | ||
224 | + | ||
225 | + $id_tipo_documento = $dto->getNumIdTipoDocumento(); | ||
226 | + //$idTipoProcedimento = $dto->getNumIdTipoProcedimento(); | ||
227 | + $idProcedimento = $dto->getNumIdProcesso(); | ||
228 | + //$idProcedimento = $dto->getNumProcedimento(); | ||
229 | + //Consulta os assuntos sugeridos para um tipo de documento | ||
230 | + $relSerieAssuntoDTO = new RelSerieAssuntoDTO(); | ||
231 | + $relSerieAssuntoDTO->setNumIdSerie($id_tipo_documento); // FILTRO PELO TIPO DE DOCUMENTO | ||
232 | + $relSerieAssuntoDTO->retNumIdAssuntoProxy(); // ID DO ASSUNTO QUE DEVE SE RETORNADO | ||
233 | + $relSerieAssuntoDTO->retStrCodigoEstruturadoAssunto(); // CÓDIGO DO ASSUNTO QUE DEVE SE RETORNADO | ||
234 | + $relSerieAssuntoDTO->retStrDescricaoAssunto(); // DESCRIÇÃO DO ASSUNTO | ||
235 | + | ||
236 | + $relSerieAssuntoRN = new RelSerieAssuntoRN(); | ||
237 | + $arrRelSerieAssuntoDTO = $relSerieAssuntoRN->listar($relSerieAssuntoDTO); | ||
238 | + | ||
239 | + $assuntos = array(); | ||
240 | + if ($arrRelSerieAssuntoDTO) { | ||
241 | + foreach ($arrRelSerieAssuntoDTO as $obj) { | ||
242 | + $assuntos[] = array( | ||
243 | + "id" => $obj->getNumIdAssuntoProxy(), | ||
244 | + "codigo" => $obj->getStrCodigoEstruturadoAssunto(), | ||
245 | + "descricao" => $obj->getStrDescricaoAssunto() | ||
246 | + ); | ||
247 | + } | ||
248 | + } | ||
249 | + | ||
250 | + $serie = ""; | ||
251 | + if ($arrSerieDTO) { | ||
252 | + $serie = $arrSerieDTO[0]; | ||
253 | + $permiteInteressados = true; | ||
254 | + $permiteDestinatarios = true; | ||
255 | + if ($serie->getStrSinInteressado() == "N") | ||
256 | + $permiteInteressados = false; | ||
257 | + if ($serie->getStrSinDestinatario() == "N") | ||
258 | + $permiteDestinatarios = false; | ||
259 | + } | ||
260 | + | ||
261 | + $interessados = null; | ||
262 | + $arrayRetorno["nivelAcessoPermitido"] = null; | ||
263 | + | ||
264 | + if ($idProcedimento) { | ||
265 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
266 | + $objParticipanteDTO->setDblIdProtocolo($idProcedimento); | ||
267 | + $objParticipanteDTO->retStrNomeContato(); | ||
268 | + $objParticipanteDTO->retNumIdContato(); | ||
269 | + | ||
270 | + $objParticipanteRN = new ParticipanteRN(); | ||
271 | + $arrParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); | ||
272 | + | ||
273 | + if ($arrParticipanteDTO) { | ||
274 | + foreach ($arrParticipanteDTO as $obj) { | ||
275 | + $interessados[] = array( | ||
276 | + "id" => $obj->getNumIdContato(), | ||
277 | + "nome" => $obj->getStrNomeContato() | ||
278 | + ); | ||
279 | + } | ||
280 | + } | ||
281 | + | ||
282 | + | ||
283 | + $nivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | ||
284 | + $nivelAcessoPermitidoDTO->setNumIdTipoProcedimento($objProcedimentoDTO[0]->getNumIdTipoProcedimento()); // FILTRO PELO TIPO DE PROCESSO | ||
285 | + $nivelAcessoPermitidoDTO->retStrStaNivelAcesso(); // ID DO NÍVEL DE ACESSO - ProtocoloRN::$NA_PUBLICO, ProtocoloRN::$NA_RESTRITO ou ProtocoloRN::$NA_SIGILOSO | ||
286 | + | ||
287 | + | ||
288 | + $nivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | ||
289 | + $arrNivelAcessoPermitido = $nivelAcessoPermitidoRN->listar($nivelAcessoPermitidoDTO); | ||
290 | + if ($arrNivelAcessoPermitido) { | ||
291 | + foreach ($arrNivelAcessoPermitido as $nivel) { | ||
292 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_PUBLICO) | ||
293 | + $publico = true; | ||
294 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_RESTRITO) | ||
295 | + $restrito = true; | ||
296 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_SIGILOSO) | ||
297 | + $sigiloso = true; | ||
298 | + } | ||
299 | + } | ||
300 | + | ||
301 | + $arrayRetorno["nivelAcessoPermitido"] = array( | ||
302 | + "publico" => $publico ? $publico : false, | ||
303 | + "restrito" => $restrito ? $restrito : false, | ||
304 | + "sigiloso" => $sigiloso ? $sigiloso : false, | ||
305 | + ); | ||
306 | + } | ||
307 | + | ||
308 | + if(!$permiteInteressados) | ||
309 | + $interessados =null; | ||
310 | + | ||
311 | + $arrayRetorno = array( | ||
312 | + "assuntos" => $assuntos, | ||
313 | + "interessados" => empty($interessados) ? array() : $interessados, | ||
314 | + "nivelAcessoPermitido" => empty($arrayRetorno["nivelAcessoPermitido"]) ? array() : $arrayRetorno["nivelAcessoPermitido"], | ||
315 | + "permiteInteressados" => $permiteInteressados, | ||
316 | + "permiteDestinatarios" => $permiteDestinatarios | ||
317 | + ); | ||
318 | + | ||
319 | + | ||
320 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE A HIPÓTESE LEGAL É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | ||
321 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | ||
322 | + $obrigatoriedadeHipoteseLegal = $objInfraParametro->getValor('SEI_HABILITAR_HIPOTESE_LEGAL'); | ||
323 | + | ||
324 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE UM GRAU DE SIGILO É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | ||
325 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | ||
326 | + $obrigatoriedadeGrauSigilo = $objInfraParametro->getValor('SEI_HABILITAR_GRAU_SIGILO'); | ||
327 | + | ||
328 | + $arrayRetorno["obrigatoriedadeHipoteseLegal"] = $obrigatoriedadeHipoteseLegal; | ||
329 | + $arrayRetorno["obrigatoriedadeGrauSigilo"] = $obrigatoriedadeGrauSigilo; | ||
330 | + | ||
331 | + | ||
332 | + | ||
333 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
334 | + } catch (Exception $e) { | ||
335 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
336 | + } | ||
337 | + } | ||
338 | + | ||
339 | + /** | ||
340 | + * Alterar Documento Externo | ||
341 | + * @param DocumentoDTO DocumentoDTO | ||
342 | + * @return array | ||
343 | + */ | ||
344 | + public function alterarDocumentoExterno($dados) { | ||
345 | + try { | ||
346 | + $documento = $dados['documento']; | ||
347 | + $idTipoDocumento = $dados['idTipoDocumento']; | ||
348 | + $numero = $dados['numero']; | ||
349 | + $data = $dados['data']; | ||
350 | + $arrAssuntos = $dados['assuntos']; | ||
351 | + $arrInteressados = $dados['interessados']; | ||
352 | + $arrDestinatarios = $dados['destinatarios']; | ||
353 | + $arrRemetentes = $dados['remetentes']; | ||
354 | + $nivelAcesso = $dados['nivelAcesso']; | ||
355 | + $hipoteseLegal = $dados['hipoteseLegal']; | ||
356 | + $grauSigilo = $dados['grauSigilo']; | ||
357 | + $observacao = $dados['observacao']; | ||
358 | + $conteudoDocumento = $dados['conteudoDocumento']; | ||
359 | + $nomeArquivo = $dados['nomeArquivo']; | ||
360 | + $tipoConferencia = $dados['tipoConferencia']; | ||
361 | + $descricao = $dados['descricao']; | ||
362 | + | ||
363 | + //Altera os dados do documento | ||
364 | + $protocoloDTO = new ProtocoloDTO(); | ||
365 | + $protocoloDTO->setDblIdProtocolo($documento); | ||
366 | + $protocoloDTO->setDtaGeracao($data); | ||
367 | + $protocoloDTO->setStrNumeroDocumento($numero); | ||
368 | + $protocoloDTO->setStrDescricao($descricao); | ||
369 | + $protocoloDTO->setStrStaNivelAcessoLocal($nivelAcesso); | ||
370 | + $protocoloDTO->setNumIdHipoteseLegal($hipoteseLegal); | ||
371 | + $protocoloDTO->setStrStaGrauSigilo($grauSigilo); | ||
372 | + | ||
373 | + | ||
374 | + $protocoloDTOauxiliar = new ProtocoloDTO(); | ||
375 | + $protocoloDTOauxiliar->setDblIdProtocolo($documento); | ||
376 | + $protocoloDTOauxiliar->retStrStaProtocolo(); | ||
377 | + $protocoloRN = new ProtocoloRN(); | ||
378 | + $retProtoculoDTO = $protocoloRN->consultarRN0186($protocoloDTOauxiliar); | ||
379 | + | ||
380 | + if(empty($retProtoculoDTO)){ | ||
381 | + throw new InfraException('Documento não encontrado.'); | ||
382 | + } | ||
383 | + | ||
384 | + if($retProtoculoDTO->getStrStaProtocolo() != ProtocoloRN::$TP_DOCUMENTO_RECEBIDO){ | ||
385 | + throw new InfraException('A alteração deve ser apenas de documentos externos.'); | ||
386 | + } | ||
387 | + | ||
388 | + //Altera os Destinatários, Remetentes e Interessados | ||
389 | + $arrParticipantes = array(); | ||
390 | + | ||
391 | + $i = 0; | ||
392 | + if ($arrInteressados) { | ||
393 | + foreach ($arrInteressados as $interessado) { | ||
394 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
395 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
396 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
397 | + $objParticipanteDTO->setNumSequencia($i); | ||
398 | + $i++; | ||
399 | + | ||
400 | + $arrParticipantes[] = $objParticipanteDTO; | ||
401 | + } | ||
402 | + } | ||
403 | + | ||
404 | + $i = 0; | ||
405 | + if ($arrDestinatarios) { | ||
406 | + foreach ($arrDestinatarios as $destinatario) { | ||
407 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
408 | + $objParticipanteDTO->setNumIdContato($destinatario['id']); | ||
409 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_DESTINATARIO); | ||
410 | + $objParticipanteDTO->setNumSequencia($i); | ||
411 | + $i++; | ||
412 | + | ||
413 | + $arrParticipantes[] = $objParticipanteDTO; | ||
414 | + } | ||
415 | + } | ||
416 | + | ||
417 | + $i = 0; | ||
418 | + if ($arrRemetentes) { | ||
419 | + foreach ($arrRemetentes as $remetente) { | ||
420 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
421 | + $objParticipanteDTO->setNumIdContato($remetente['id']); | ||
422 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_REMETENTE); | ||
423 | + $objParticipanteDTO->setNumSequencia($i); | ||
424 | + $i++; | ||
425 | + | ||
426 | + $arrParticipantes[] = $objParticipanteDTO; | ||
427 | + } | ||
428 | + } | ||
429 | + | ||
430 | + $protocoloDTO->setArrObjParticipanteDTO($arrParticipantes); | ||
431 | + | ||
432 | + //Altera os assuntos | ||
433 | + $arrRelProtocoloAssuntoDTO = array(); | ||
434 | + | ||
435 | + $i = 0; | ||
436 | + if ($arrAssuntos) { | ||
437 | + foreach ($arrAssuntos as $assunto) { | ||
438 | + $relProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
439 | + $relProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
440 | + $relProtocoloAssuntoDTO->setDblIdProtocolo($documento); | ||
441 | + $relProtocoloAssuntoDTO->setNumSequencia($i); | ||
442 | + $arrRelProtocoloAssuntoDTO[] = $relProtocoloAssuntoDTO; | ||
443 | + | ||
444 | + $i++; | ||
445 | + } | ||
446 | + } | ||
447 | + | ||
448 | + $protocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrRelProtocoloAssuntoDTO); | ||
449 | + | ||
450 | + //Edita a observação | ||
451 | + $observacaoDTO = new ObservacaoDTO(); | ||
452 | + $observacaoDTO->setStrDescricao($observacao); | ||
453 | + $protocoloDTO->setArrObjObservacaoDTO(array($observacaoDTO)); | ||
454 | + | ||
455 | + //Edita o tipo de documento e número | ||
456 | + $documentoDTO = new DocumentoDTO(); | ||
457 | + $documentoDTO->setDblIdDocumento($documento); | ||
458 | + $documentoDTO->setNumIdSerie($idTipoDocumento); | ||
459 | + $documentoDTO->setStrNumero($numero); | ||
460 | + $documentoDTO->setObjProtocoloDTO($protocoloDTO); | ||
461 | + $documentoDTO->setNumIdTipoConferencia($tipoConferencia); | ||
462 | + | ||
463 | + if ($conteudoDocumento === false) { | ||
464 | + $objAnexoDTO = new AnexoDTO(); | ||
465 | + $objAnexoDTO->retNumIdAnexo(); | ||
466 | + $objAnexoDTO->setDblIdProtocolo($documento); | ||
467 | + | ||
468 | + $objAnexoRN = new AnexoRN(); | ||
469 | + $arrObjAnexoDTO = $objAnexoRN->listarRN0218($objAnexoDTO); | ||
470 | + $objAnexoRN->excluirRN0226($arrObjAnexoDTO); | ||
471 | + } | ||
472 | + if ($conteudoDocumento) { | ||
473 | + $objAnexoDTO = new AnexoDTO(); | ||
474 | + $objAnexoDTO->setStrNome($nomeArquivo); | ||
475 | + $protocoloDTO->setArrObjAnexoDTO(array($objAnexoDTO)); | ||
476 | + | ||
477 | + $documentoDTO->setStrConteudo(null); | ||
478 | + $documentoDTO->setStrStaDocumento(DocumentoRN::$TD_EXTERNO); | ||
479 | + | ||
480 | + $arrObjAnexoDTO = $documentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); | ||
481 | + | ||
482 | + //Adiciona o anexo | ||
483 | + if (count($arrObjAnexoDTO) == 1) { | ||
484 | + | ||
485 | + if (!$arrObjAnexoDTO[0]->isSetNumIdAnexoOrigem()) { | ||
486 | + $objAnexoRN = new AnexoRN(); | ||
487 | + $strNomeArquivoUpload = $objAnexoRN->gerarNomeArquivoTemporario(); | ||
488 | + | ||
489 | + $fp = fopen(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload, 'w'); | ||
490 | + fwrite($fp, $conteudoDocumento); | ||
491 | + fclose($fp); | ||
492 | + | ||
493 | + $arrObjAnexoDTO[0]->setNumIdAnexo($strNomeArquivoUpload); | ||
494 | + $arrObjAnexoDTO[0]->setDthInclusao(InfraData::getStrDataHoraAtual()); | ||
495 | + $arrObjAnexoDTO[0]->setNumTamanho(filesize(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload)); | ||
496 | + $arrObjAnexoDTO[0]->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
497 | + } | ||
498 | + } | ||
499 | + } | ||
500 | + | ||
501 | + | ||
502 | + $documentoRN = new DocumentoRN(); | ||
503 | + $documentoRN->alterarRN0004($documentoDTO); | ||
504 | + | ||
505 | + | ||
506 | + return MdWsSeiRest::formataRetornoSucessoREST(nulL); | ||
507 | + } catch (Exception $e) { | ||
508 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
509 | + } | ||
510 | + } | ||
511 | + | ||
512 | + /** | ||
513 | + * Alterar Documento Iterno | ||
514 | + * @param DocumentoDTO DocumentoDTO | ||
515 | + * @return array | ||
516 | + */ | ||
517 | + public function alterarDocumentoInterno($dados) { | ||
518 | + try { | ||
519 | + $documento = $dados['documento']; | ||
520 | + $idTipoDocumento = $dados['idTipoDocumento']; | ||
521 | + $arrAssuntos = $dados['assuntos']; | ||
522 | + $arrInteressados = $dados['interessados']; | ||
523 | + $arrDestinatarios = $dados['destinatarios']; | ||
524 | + $nivelAcesso = $dados['nivelAcesso']; | ||
525 | + $hipoteseLegal = $dados['hipoteseLegal']; | ||
526 | + $grauSigilo = $dados['grauSigilo']; | ||
527 | + $observacao = $dados['observacao']; | ||
528 | + $descricao = $dados['descricao']; | ||
529 | + | ||
530 | + //PARÂMETROS DE ENTRADA | ||
531 | + // $documento = 106; | ||
532 | + // $descricao = "DESCRIÇÃO E TESTE"; | ||
533 | + // $arrAssuntos = array(array('id' => 2), array('id' => 4)); | ||
534 | + // $arrInteressados = array(array('id' => 100000008), array('id' => 100000010), array('id' => 100000002), array('id' => 100000006)); | ||
535 | + // $arrDestinatarios = array(array('id' => 100000008)); | ||
536 | + // $nivelAcesso = 0; | ||
537 | + // $hipoteseLegal = ""; | ||
538 | + // $grauSigilo = ""; | ||
539 | + // $observacao = "OBSERVAÇÃO TESTE UM"; | ||
540 | + //Altera os dados do documento | ||
541 | + $protocoloDTO = new ProtocoloDTO(); | ||
542 | + $protocoloDTO->setDblIdProtocolo($documento); | ||
543 | + $protocoloDTO->setStrDescricao($descricao); | ||
544 | + $protocoloDTO->setStrStaNivelAcessoLocal($nivelAcesso); | ||
545 | + $protocoloDTO->setNumIdHipoteseLegal($hipoteseLegal); | ||
546 | + $protocoloDTO->setStrStaGrauSigilo($grauSigilo); | ||
547 | + | ||
548 | + $protocoloDTOauxiliar = new ProtocoloDTO(); | ||
549 | + $protocoloDTOauxiliar->setDblIdProtocolo($documento); | ||
550 | + $protocoloDTOauxiliar->retStrStaProtocolo(); | ||
551 | + $protocoloRN = new ProtocoloRN(); | ||
552 | + $retProtoculoDTO = $protocoloRN->consultarRN0186($protocoloDTOauxiliar); | ||
553 | + | ||
554 | + if(empty($retProtoculoDTO)){ | ||
555 | + throw new InfraException('Documento não encontrado.'); | ||
556 | + } | ||
557 | + | ||
558 | + if($retProtoculoDTO->getStrStaProtocolo() != ProtocoloRN::$TP_DOCUMENTO_GERADO){ | ||
559 | + throw new InfraException('A alteração deve ser apenas de documentos internos.'); | ||
560 | + } | ||
561 | + | ||
562 | + | ||
563 | + //Altera os Destinatários e Interessados | ||
564 | + $arrParticipantes = array(); | ||
565 | + | ||
566 | + $i = 0; | ||
567 | + if ($arrInteressados) { | ||
568 | + foreach ($arrInteressados as $interessado) { | ||
569 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
570 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
571 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
572 | + $objParticipanteDTO->setNumSequencia($i); | ||
573 | + $i++; | ||
574 | + | ||
575 | + $arrParticipantes[] = $objParticipanteDTO; | ||
576 | + } | ||
577 | + } | ||
578 | + | ||
579 | + $i = 0; | ||
580 | + if ($arrDestinatarios) { | ||
581 | + foreach ($arrDestinatarios as $destinatario) { | ||
582 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
583 | + $objParticipanteDTO->setNumIdContato($destinatario['id']); | ||
584 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_DESTINATARIO); | ||
585 | + $objParticipanteDTO->setNumSequencia($i); | ||
586 | + $i++; | ||
587 | + | ||
588 | + $arrParticipantes[] = $objParticipanteDTO; | ||
589 | + } | ||
590 | + } | ||
591 | + | ||
592 | + $protocoloDTO->setArrObjParticipanteDTO($arrParticipantes); | ||
593 | + | ||
594 | + //Altera os assuntos | ||
595 | + $arrRelProtocoloAssuntoDTO = array(); | ||
596 | + | ||
597 | + $i = 0; | ||
598 | + if ($arrAssuntos) { | ||
599 | + foreach ($arrAssuntos as $assunto) { | ||
600 | + $relProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
601 | + $relProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
602 | + $relProtocoloAssuntoDTO->setDblIdProtocolo($documento); | ||
603 | + $relProtocoloAssuntoDTO->setNumSequencia($i); | ||
604 | + $arrRelProtocoloAssuntoDTO[] = $relProtocoloAssuntoDTO; | ||
605 | + | ||
606 | + $i++; | ||
607 | + } | ||
608 | + } | ||
609 | + $protocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrRelProtocoloAssuntoDTO); | ||
610 | + | ||
611 | + //Edita a observação | ||
612 | + $observacaoDTO = new ObservacaoDTO(); | ||
613 | + $observacaoDTO->setStrDescricao($observacao); | ||
614 | + $protocoloDTO->setArrObjObservacaoDTO(array($observacaoDTO)); | ||
615 | + | ||
616 | + //Edita o tipo de documento e número | ||
617 | + $documentoDTO = new DocumentoDTO(); | ||
618 | + $documentoDTO->setDblIdDocumento($documento); | ||
619 | + $documentoDTO->setObjProtocoloDTO($protocoloDTO); | ||
620 | + | ||
621 | + $documentoRN = new DocumentoRN(); | ||
622 | + $documentoRN->alterarRN0004($documentoDTO); | ||
623 | + | ||
624 | + | ||
625 | + return MdWsSeiRest::formataRetornoSucessoREST(nulL); | ||
626 | + } catch (Exception $e) { | ||
627 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
628 | + } | ||
629 | + } | ||
630 | + | ||
631 | + /** | ||
632 | + * Método que cria um documento interno | ||
633 | + * @param MdWsSeiDocumentoDTO $dto | ||
634 | + * @return array | ||
635 | + */ | ||
636 | + protected function documentoInternoCriarConectado(MdWsSeiDocumentoDTO $dto) { | ||
637 | + try { | ||
638 | + $idProcesso = $dto->getNumIdProcesso(); | ||
639 | + $idTipoDocumento = $dto->getNumIdTipoDocumento(); | ||
640 | + $descricao = $dto->getStrDescricao(); | ||
641 | + $nivelAcesso = $dto->getStrNivelAcesso(); | ||
642 | + $hipoteseLegal = $dto->getNumIdHipoteseLegal(); | ||
643 | + $grauSigilo = $dto->getStrGrauSigilo(); | ||
644 | + $arrAssuntos = $dto->getArrAssuntos(); | ||
645 | + $arrInteressados = $dto->getArrInteressados(); | ||
646 | + $arrDestinatarios = $dto->getArrDestinatarios(); | ||
647 | + $observacao = $dto->getStrObservacao(); | ||
648 | + | ||
649 | +// $idProcesso = 13; | ||
650 | +// $idTipoDocumento = 12; | ||
651 | +// $descricao = 'descrição de teste'; | ||
652 | +// $nivelAcesso = 1; | ||
653 | +// $hipoteseLegal = 1; | ||
654 | +// $grauSigilo = ''; | ||
655 | +// $arrAssuntos = array(array('id' => 2), array('id' => 4)); | ||
656 | +// $arrInteressados = array(array('id' => 100000008), array('id' => 100000010), array('id' => 100000002), array('id' => 100000006)); | ||
657 | +// $arrDestinatarios = array(array('id' => 100000008)); | ||
658 | +// $observacao = 'teste'; | ||
659 | + | ||
660 | + $objDocumentoDTO = new DocumentoDTO(); | ||
661 | + $objDocumentoDTO->setDblIdDocumento(null); | ||
662 | + $objDocumentoDTO->setDblIdProcedimento($idProcesso); | ||
663 | + | ||
664 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
665 | + $objProtocoloDTO->setDblIdProtocolo(null); | ||
666 | + $objProtocoloDTO->setStrStaProtocolo('G'); | ||
667 | + // $objProtocoloDTO->setDtaGeracao($dtaGeracao); | ||
668 | + | ||
669 | + $objDocumentoDTO->setNumIdSerie($idTipoDocumento); | ||
670 | + // $objDocumentoDTO->setStrNomeSerie($nomeTipo); | ||
671 | + | ||
672 | + $objDocumentoDTO->setDblIdDocumentoEdoc(null); | ||
673 | + $objDocumentoDTO->setDblIdDocumentoEdocBase(null); | ||
674 | + $objDocumentoDTO->setNumIdUnidadeResponsavel(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
675 | + $objDocumentoDTO->setNumIdTipoConferencia(null); | ||
676 | + $objDocumentoDTO->setStrNumero(''); | ||
677 | + // $objDocumentoDTO->setNumIdTipoConferencia($objDocumentoAPI->getIdTipoConferencia()); | ||
678 | + | ||
679 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($nivelAcesso); | ||
680 | + $objProtocoloDTO->setNumIdHipoteseLegal($hipoteseLegal); | ||
681 | + $objProtocoloDTO->setStrDescricao($descricao); | ||
682 | + $objProtocoloDTO->setStrStaGrauSigilo($grauSigilo); | ||
683 | + | ||
684 | + $arrParticipantesDTO = array(); | ||
685 | + if ($arrInteressados) { | ||
686 | + foreach ($arrInteressados as $k => $interessado) { | ||
687 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
688 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
689 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
690 | + $objParticipanteDTO->setNumSequencia($k); | ||
691 | + $arrParticipantesDTO[] = $objParticipanteDTO; | ||
692 | + } | ||
693 | + } | ||
694 | + | ||
695 | + if ($arrDestinatarios) { | ||
696 | + foreach ($arrDestinatarios as $k => $destinatario) { | ||
697 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
698 | + $objParticipanteDTO->setNumIdContato($destinatario['id']); | ||
699 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_DESTINATARIO); | ||
700 | + $objParticipanteDTO->setNumSequencia($k); | ||
701 | + $arrParticipantesDTO[] = $objParticipanteDTO; | ||
702 | + } | ||
703 | + } | ||
704 | + $arrRelProtocoloAssuntoDTO = array(); | ||
705 | + | ||
706 | + if ($arrAssuntos) { | ||
707 | + foreach ($arrAssuntos as $k => $assunto) { | ||
708 | + $relProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
709 | + $relProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
710 | + $relProtocoloAssuntoDTO->setDblIdProtocolo($idProcesso); | ||
711 | + $relProtocoloAssuntoDTO->setNumSequencia($k); | ||
712 | + $arrRelProtocoloAssuntoDTO[] = $relProtocoloAssuntoDTO; | ||
713 | + } | ||
714 | + } | ||
715 | + | ||
716 | + $objProtocoloDTO->setArrObjParticipanteDTO($arrParticipantesDTO); | ||
717 | + $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrRelProtocoloAssuntoDTO); | ||
718 | + | ||
719 | + //OBSERVACOES | ||
720 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
721 | + $objObservacaoDTO->setStrDescricao($observacao); | ||
722 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | ||
723 | + | ||
724 | + $objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); | ||
725 | + $objDocumentoDTO->setStrStaDocumento(DocumentoRN::$TD_EDITOR_INTERNO); | ||
726 | + | ||
727 | + $objDocumentoRN = new DocumentoRN(); | ||
728 | + $obj = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | ||
729 | + | ||
730 | + $arrayRetorno = array(); | ||
731 | + if ($obj) { | ||
732 | + $arrayRetorno = array( | ||
733 | + "IdDocumento" => $obj->getDblIdDocumento(), | ||
734 | + "ProtocoloDocumentoFormatado" => $obj->getStrProtocoloDocumentoFormatado() | ||
735 | + ); | ||
736 | + } | ||
737 | + | ||
738 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
739 | + } catch (Exception $e) { | ||
740 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
741 | + } | ||
742 | + } | ||
743 | + | ||
744 | + /** | ||
745 | + * Método que cria um documento interno | ||
746 | + * @param MdWsSeiDocumentoDTO $dto | ||
747 | + * @return array | ||
748 | + */ | ||
749 | + protected function documentoExternoCriarConectado(MdWsSeiDocumentoDTO $dto) { | ||
750 | + try { | ||
751 | + $idProcesso = $dto->getNumIdProcesso(); | ||
752 | + $idTipoDocumento = $dto->getNumIdTipoDocumento(); | ||
753 | + $dataGeracaoDocumento = $dto->getDtaDataGeracaoDocumento(); | ||
754 | + $numero = $dto->getStrNumero(); | ||
755 | + $descricao = $dto->getStrDescricao(); | ||
756 | + $nomeArquivo = $dto->getStrNomeArquivo(); | ||
757 | + $nivelAcesso = $dto->getStrNivelAcesso(); | ||
758 | + $hipoteseLegal = $dto->getNumIdHipoteseLegal(); | ||
759 | + $grauSigilo = $dto->getStrGrauSigilo(); | ||
760 | + $arrAssuntos = $dto->getArrAssuntos(); | ||
761 | + $arrInteressados = $dto->getArrInteressados(); | ||
762 | + $arrDestinatarios = $dto->getArrDestinatarios(); | ||
763 | + $arrRemetentes = $dto->getArrRemetentes(); | ||
764 | + $conteudoDocumento = $dto->getStrConteudoDocumento(); | ||
765 | + $observacao = $dto->getStrObservacao(); | ||
766 | + $tipoConferencia = $dto->getNumTipoConferencia(); | ||
767 | + | ||
768 | + | ||
769 | + //Parâmetros de entrada | ||
770 | +// $idProcesso = 15; | ||
771 | +// $dataGeracaoDocumento = '25/01/2017'; | ||
772 | +// $idTipoDocumento = 8; | ||
773 | +// $numero = '598714789156'; | ||
774 | +// $descricao = 'descrição de teste'; | ||
775 | +// $nome_arquivo = 'teste.pdf'; | ||
776 | +// $nivelAcesso = 1; | ||
777 | +// $hipoteseLegal = 1; | ||
778 | +// $grauSigilo = ''; | ||
779 | +// $arrAssuntos = array(array('id' => 2), array('id' => 4)); | ||
780 | +// $arrInteressados = array(array('id' => 100000008), array('id' => 100000010), array('id' => 100000002), array('id' => 100000006)); | ||
781 | +// $arrDestinatarios = array(array('id' => 100000008)); | ||
782 | +// $arrRemetentes = array(array('id' => 100000008)); | ||
783 | +// $conteudoDocumento = file_get_contents('/opt/sei/web/modulos/mod-wssei/codigo-fonte/mod-wssei/rn/c.pdf'); // DEVE CONTER O BINÁRIO DO ARQUIVO. ESSE FILE_GET_CONTENTS É UM EXEMPLO APENAS | ||
784 | +// $observacao = 'ewefwe'; | ||
785 | + //Popula os dados do documento para salvamento | ||
786 | + $objDocumentoDTO = new DocumentoDTO(); | ||
787 | + $objDocumentoDTO->setDblIdDocumento(null); | ||
788 | + $objDocumentoDTO->setDblIdProcedimento($idProcesso); | ||
789 | + $objDocumentoDTO->setNumIdSerie($idTipoDocumento); | ||
790 | + $objDocumentoDTO->setDblIdDocumentoEdoc(null); | ||
791 | + $objDocumentoDTO->setDblIdDocumentoEdocBase(null); | ||
792 | + $objDocumentoDTO->setNumIdUnidadeResponsavel(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
793 | + $objDocumentoDTO->setNumIdTipoConferencia($tipoConferencia); | ||
794 | + $objDocumentoDTO->setStrNumero($numero); | ||
795 | + | ||
796 | + //Popula os dados do protocolo do documento | ||
797 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
798 | + $objProtocoloDTO->setDblIdProtocolo(null); | ||
799 | + $objProtocoloDTO->setStrStaProtocolo('R'); | ||
800 | + $objProtocoloDTO->setDtaGeracao($dataGeracaoDocumento); | ||
801 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($nivelAcesso); | ||
802 | + $objProtocoloDTO->setNumIdHipoteseLegal($hipoteseLegal); | ||
803 | + $objProtocoloDTO->setStrDescricao($descricao); | ||
804 | + $objProtocoloDTO->setStrStaGrauSigilo($grauSigilo); | ||
805 | + | ||
806 | + //Popula os remetentes, destinatários e interessados | ||
807 | + $arrParticipantesDTO = array(); | ||
808 | + if ($arrRemetentes) { | ||
809 | + foreach ($arrRemetentes as $k => $remetente) { | ||
810 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
811 | + $objParticipanteDTO->setNumIdContato($remetente['id']); | ||
812 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_REMETENTE); | ||
813 | + $objParticipanteDTO->setNumSequencia($k); | ||
814 | + $arrParticipantesDTO[] = $objParticipanteDTO; | ||
815 | + } | ||
816 | + } | ||
817 | + if ($arrInteressados) { | ||
818 | + foreach ($arrInteressados as $k => $interessado) { | ||
819 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
820 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
821 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
822 | + $objParticipanteDTO->setNumSequencia($k); | ||
823 | + $arrParticipantesDTO[] = $objParticipanteDTO; | ||
824 | + } | ||
825 | + } | ||
826 | + if ($arrDestinatarios) { | ||
827 | + foreach ($arrDestinatarios as $k => $destinatario) { | ||
828 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
829 | + $objParticipanteDTO->setNumIdContato($destinatario['id']); | ||
830 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_DESTINATARIO); | ||
831 | + $objParticipanteDTO->setNumSequencia($k); | ||
832 | + $arrParticipantesDTO[] = $objParticipanteDTO; | ||
833 | + } | ||
834 | + } | ||
835 | + //Popula os assuntos | ||
836 | + $arrRelProtocoloAssuntoDTO = array(); | ||
837 | + if ($arrAssuntos) { | ||
838 | + foreach ($arrAssuntos as $k => $assunto) { | ||
839 | + $relProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
840 | + $relProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
841 | + $relProtocoloAssuntoDTO->setDblIdProtocolo($idProcesso); | ||
842 | + $relProtocoloAssuntoDTO->setNumSequencia($k); | ||
843 | + $arrRelProtocoloAssuntoDTO[] = $relProtocoloAssuntoDTO; | ||
844 | + } | ||
845 | + } | ||
846 | + $objProtocoloDTO->setArrObjParticipanteDTO($arrParticipantesDTO); | ||
847 | + $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrRelProtocoloAssuntoDTO); | ||
848 | + | ||
849 | + //OBSERVACOES | ||
850 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
851 | + $objObservacaoDTO->setStrDescricao($observacao); | ||
852 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | ||
853 | + | ||
854 | + $objAnexoDTO = new AnexoDTO(); | ||
855 | + $objAnexoDTO->setStrNome($nomeArquivo); | ||
856 | + $objProtocoloDTO->setArrObjAnexoDTO(array($objAnexoDTO)); | ||
857 | + | ||
858 | + $objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); | ||
859 | + $objDocumentoDTO->setStrConteudo(null); | ||
860 | + $objDocumentoDTO->setStrStaDocumento(DocumentoRN::$TD_EXTERNO); | ||
861 | + | ||
862 | + $arrObjAnexoDTO = $objDocumentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); | ||
863 | + | ||
864 | + //Adiciona o anexo | ||
865 | + if (count($arrObjAnexoDTO) == 1) { | ||
866 | + | ||
867 | + if (!$arrObjAnexoDTO[0]->isSetNumIdAnexoOrigem()) { | ||
868 | + $objAnexoRN = new AnexoRN(); | ||
869 | + $strNomeArquivoUpload = $objAnexoRN->gerarNomeArquivoTemporario(); | ||
870 | + | ||
871 | + $fp = fopen(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload, 'w'); | ||
872 | + fwrite($fp, $conteudoDocumento); | ||
873 | + fclose($fp); | ||
874 | + | ||
875 | + $arrObjAnexoDTO[0]->setNumIdAnexo($strNomeArquivoUpload); | ||
876 | + $arrObjAnexoDTO[0]->setDthInclusao(InfraData::getStrDataHoraAtual()); | ||
877 | + $arrObjAnexoDTO[0]->setNumTamanho(filesize(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload)); | ||
878 | + $arrObjAnexoDTO[0]->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
879 | + } | ||
880 | + } | ||
881 | + | ||
882 | + //Gera o documento | ||
883 | + $objDocumentoRN = new DocumentoRN(); | ||
884 | + $objDocumentoDTOGerado = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | ||
885 | + | ||
886 | + | ||
887 | + | ||
888 | + $arrayRetorno = array(); | ||
889 | + if ($objDocumentoDTOGerado) { | ||
890 | + $arrayRetorno = array( | ||
891 | + "IdDocumento" => $objDocumentoDTOGerado->getDblIdDocumento(), | ||
892 | + "ProtocoloDocumentoFormatado" => $objDocumentoDTOGerado->getStrProtocoloDocumentoFormatado() | ||
893 | + ); | ||
894 | + } | ||
895 | + | ||
896 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
897 | + } catch (Exception $e) { | ||
898 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
899 | + } | ||
900 | + } | ||
901 | + | ||
902 | + /** | ||
13 | * Método que retorna os documentos de um processo | 903 | * Método que retorna os documentos de um processo |
14 | * @param DocumentoDTO $documentoDTOParam | 904 | * @param DocumentoDTO $documentoDTOParam |
15 | * @return array | 905 | * @return array |
16 | */ | 906 | */ |
17 | - protected function listarDocumentosProcessoConectado(DocumentoDTO $documentoDTOParam){ | ||
18 | - try{ | 907 | + protected function listarDocumentosProcessoConectado(DocumentoDTO $documentoDTOParam) { |
908 | + try { | ||
909 | + | ||
910 | + global $SEI_MODULOS; | ||
911 | + | ||
19 | $arrDocHtml = array( | 912 | $arrDocHtml = array( |
20 | DocumentoRN::$TD_EDITOR_EDOC, | 913 | DocumentoRN::$TD_EDITOR_EDOC, |
21 | DocumentoRN::$TD_FORMULARIO_AUTOMATICO, | 914 | DocumentoRN::$TD_FORMULARIO_AUTOMATICO, |
@@ -24,34 +917,36 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -24,34 +917,36 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
24 | ); | 917 | ); |
25 | $result = array(); | 918 | $result = array(); |
26 | $relProtocoloProtocoloDTOConsulta = new RelProtocoloProtocoloDTO(); | 919 | $relProtocoloProtocoloDTOConsulta = new RelProtocoloProtocoloDTO(); |
27 | - if(!$documentoDTOParam->isSetDblIdProcedimento()){ | 920 | + if (!$documentoDTOParam->isSetDblIdProcedimento()) { |
28 | throw new InfraException('O procedimento deve ser informado.'); | 921 | throw new InfraException('O procedimento deve ser informado.'); |
29 | } | 922 | } |
30 | $relProtocoloProtocoloDTOConsulta->setDblIdProtocolo1($documentoDTOParam->getDblIdProcedimento()); | 923 | $relProtocoloProtocoloDTOConsulta->setDblIdProtocolo1($documentoDTOParam->getDblIdProcedimento()); |
31 | $relProtocoloProtocoloDTOConsulta->setStrStaProtocoloProtocolo2( | 924 | $relProtocoloProtocoloDTOConsulta->setStrStaProtocoloProtocolo2( |
32 | - array(ProtocoloRN::$TP_DOCUMENTO_GERADO, ProtocoloRN::$TP_DOCUMENTO_RECEBIDO), | ||
33 | - InfraDTO::$OPER_IN | 925 | + array(ProtocoloRN::$TP_DOCUMENTO_GERADO, ProtocoloRN::$TP_DOCUMENTO_RECEBIDO), InfraDTO::$OPER_IN |
34 | ); | 926 | ); |
35 | $relProtocoloProtocoloDTOConsulta->retStrSinCiencia(); | 927 | $relProtocoloProtocoloDTOConsulta->retStrSinCiencia(); |
36 | $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo1(); | 928 | $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo1(); |
37 | $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo2(); | 929 | $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo2(); |
930 | + $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo2(); | ||
38 | $relProtocoloProtocoloDTOConsulta->retNumSequencia(); | 931 | $relProtocoloProtocoloDTOConsulta->retNumSequencia(); |
39 | $relProtocoloProtocoloDTOConsulta->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); | 932 | $relProtocoloProtocoloDTOConsulta->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); |
40 | - if($documentoDTOParam->getNumMaxRegistrosRetorno()){ | 933 | + if ($documentoDTOParam->getNumMaxRegistrosRetorno()) { |
41 | $relProtocoloProtocoloDTOConsulta->setNumMaxRegistrosRetorno($documentoDTOParam->getNumMaxRegistrosRetorno()); | 934 | $relProtocoloProtocoloDTOConsulta->setNumMaxRegistrosRetorno($documentoDTOParam->getNumMaxRegistrosRetorno()); |
42 | - }else{ | 935 | + } else { |
43 | $relProtocoloProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); | 936 | $relProtocoloProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); |
44 | } | 937 | } |
45 | - if(is_null($documentoDTOParam->getNumPaginaAtual())){ | 938 | + if (is_null($documentoDTOParam->getNumPaginaAtual())) { |
46 | $relProtocoloProtocoloDTOConsulta->setNumPaginaAtual(0); | 939 | $relProtocoloProtocoloDTOConsulta->setNumPaginaAtual(0); |
47 | - }else{ | 940 | + } else { |
48 | $relProtocoloProtocoloDTOConsulta->setNumPaginaAtual($documentoDTOParam->getNumPaginaAtual()); | 941 | $relProtocoloProtocoloDTOConsulta->setNumPaginaAtual($documentoDTOParam->getNumPaginaAtual()); |
49 | } | 942 | } |
50 | 943 | ||
51 | $relProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); | 944 | $relProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); |
52 | $ret = $relProtocoloProtocoloRN->listarRN0187($relProtocoloProtocoloDTOConsulta); | 945 | $ret = $relProtocoloProtocoloRN->listarRN0187($relProtocoloProtocoloDTOConsulta); |
946 | + | ||
947 | + | ||
53 | $arrDocumentos = array(); | 948 | $arrDocumentos = array(); |
54 | - if($ret){ | 949 | + if ($ret) { |
55 | $unidadeDTO = new UnidadeDTO(); | 950 | $unidadeDTO = new UnidadeDTO(); |
56 | $unidadeDTO->setBolExclusaoLogica(false); | 951 | $unidadeDTO->setBolExclusaoLogica(false); |
57 | $unidadeDTO->retStrSinProtocolo(); | 952 | $unidadeDTO->retStrSinProtocolo(); |
@@ -78,11 +973,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -78,11 +973,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
78 | $documentoDTOConsulta->retNumIdUnidadeGeradoraProtocolo(); | 973 | $documentoDTOConsulta->retNumIdUnidadeGeradoraProtocolo(); |
79 | $documentoDTOConsulta->retStrCrcAssinatura(); | 974 | $documentoDTOConsulta->retStrCrcAssinatura(); |
80 | $documentoDTOConsulta->retStrStaEstadoProtocolo(); | 975 | $documentoDTOConsulta->retStrStaEstadoProtocolo(); |
81 | - $documentoDTOConsulta->setDblIdDocumento(array_keys(InfraArray::indexarArrInfraDTO($ret,'IdProtocolo2')), InfraDTO::$OPER_IN); | 976 | + $documentoDTOConsulta->retNumIdTipoConferencia(); |
977 | + $documentoDTOConsulta->setDblIdDocumento(array_keys(InfraArray::indexarArrInfraDTO($ret, 'IdProtocolo2')), InfraDTO::$OPER_IN); | ||
82 | $documentoBD = new DocumentoBD($this->getObjInfraIBanco()); | 978 | $documentoBD = new DocumentoBD($this->getObjInfraIBanco()); |
83 | $retDocumentos = $documentoBD->listar($documentoDTOConsulta); | 979 | $retDocumentos = $documentoBD->listar($documentoDTOConsulta); |
980 | + | ||
981 | +// var_dump($retDocumentos); | ||
982 | +// die(); | ||
84 | /** @var DocumentoDTO $documentoDTOOrd */ | 983 | /** @var DocumentoDTO $documentoDTOOrd */ |
85 | - foreach ($retDocumentos as $documentoDTOOrd){ | 984 | + foreach ($retDocumentos as $documentoDTOOrd) { |
86 | $arrDocumentos[$documentoDTOOrd->getDblIdDocumento()] = $documentoDTOOrd; | 985 | $arrDocumentos[$documentoDTOOrd->getDblIdDocumento()] = $documentoDTOOrd; |
87 | } | 986 | } |
88 | } | 987 | } |
@@ -90,18 +989,20 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -90,18 +989,20 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
90 | $anexoRN = new AnexoRN(); | 989 | $anexoRN = new AnexoRN(); |
91 | $observacaoRN = new ObservacaoRN(); | 990 | $observacaoRN = new ObservacaoRN(); |
92 | $publicacaoRN = new PublicacaoRN(); | 991 | $publicacaoRN = new PublicacaoRN(); |
992 | + | ||
993 | + | ||
93 | /** @var RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO */ | 994 | /** @var RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO */ |
94 | - foreach($ret as $relProtocoloProtocoloDTO){ | 995 | + foreach ($ret as $relProtocoloProtocoloDTO) { |
95 | $documentoDTO = $arrDocumentos[$relProtocoloProtocoloDTO->getDblIdProtocolo2()]; | 996 | $documentoDTO = $arrDocumentos[$relProtocoloProtocoloDTO->getDblIdProtocolo2()]; |
96 | $mimetype = null; | 997 | $mimetype = null; |
97 | $nomeAnexo = null; | 998 | $nomeAnexo = null; |
98 | $informacao = null; | 999 | $informacao = null; |
99 | $tamanhoAnexo = null; | 1000 | $tamanhoAnexo = null; |
100 | $ciencia = 'N'; | 1001 | $ciencia = 'N'; |
101 | - $documentoCancelado = $documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO | ||
102 | - ? 'S' : 'N'; | 1002 | + $documentoCancelado = $documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO ? 'S' : 'N'; |
103 | 1003 | ||
104 | - if(!in_array($documentoDTO->getStrStaDocumento(), $arrDocHtml)){ | 1004 | + |
1005 | + if (!in_array($documentoDTO->getStrStaDocumento(), $arrDocHtml)) { | ||
105 | $anexoDTOConsulta = new AnexoDTO(); | 1006 | $anexoDTOConsulta = new AnexoDTO(); |
106 | $anexoDTOConsulta->retStrNome(); | 1007 | $anexoDTOConsulta->retStrNome(); |
107 | $anexoDTOConsulta->retNumTamanho(); | 1008 | $anexoDTOConsulta->retNumTamanho(); |
@@ -109,25 +1010,38 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -109,25 +1010,38 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
109 | $anexoDTOConsulta->setStrSinAtivo('S'); | 1010 | $anexoDTOConsulta->setStrSinAtivo('S'); |
110 | $anexoDTOConsulta->setNumMaxRegistrosRetorno(1); | 1011 | $anexoDTOConsulta->setNumMaxRegistrosRetorno(1); |
111 | $resultAnexo = $anexoRN->listarRN0218($anexoDTOConsulta); | 1012 | $resultAnexo = $anexoRN->listarRN0218($anexoDTOConsulta); |
112 | - if($resultAnexo){ | 1013 | + if ($resultAnexo) { |
113 | /** @var AnexoDTO $anexoDTO */ | 1014 | /** @var AnexoDTO $anexoDTO */ |
114 | $anexoDTO = $resultAnexo[0]; | 1015 | $anexoDTO = $resultAnexo[0]; |
115 | $mimetype = $anexoDTO->getStrNome(); | 1016 | $mimetype = $anexoDTO->getStrNome(); |
116 | - $mimetype = substr($mimetype, strrpos($mimetype, '.')+1); | 1017 | + $mimetype = substr($mimetype, strrpos($mimetype, '.') + 1); |
117 | $nomeAnexo = $anexoDTO->getStrNome(); | 1018 | $nomeAnexo = $anexoDTO->getStrNome(); |
118 | $tamanhoAnexo = $anexoDTO->getNumTamanho(); | 1019 | $tamanhoAnexo = $anexoDTO->getNumTamanho(); |
119 | } | 1020 | } |
120 | } | 1021 | } |
121 | $observacaoDTOConsulta = new ObservacaoDTO(); | 1022 | $observacaoDTOConsulta = new ObservacaoDTO(); |
1023 | + | ||
1024 | + | ||
122 | $observacaoDTOConsulta->setNumMaxRegistrosRetorno(1); | 1025 | $observacaoDTOConsulta->setNumMaxRegistrosRetorno(1); |
123 | $observacaoDTOConsulta->setOrdNumIdObservacao(InfraDTO::$TIPO_ORDENACAO_DESC); | 1026 | $observacaoDTOConsulta->setOrdNumIdObservacao(InfraDTO::$TIPO_ORDENACAO_DESC); |
124 | $observacaoDTOConsulta->retStrDescricao(); | 1027 | $observacaoDTOConsulta->retStrDescricao(); |
125 | $resultObservacao = $observacaoRN->listarRN0219($observacaoDTOConsulta); | 1028 | $resultObservacao = $observacaoRN->listarRN0219($observacaoDTOConsulta); |
126 | - if($resultObservacao){ | ||
127 | - /** @var ObservacaoDTO $observacaoDTO */ | 1029 | + |
1030 | + | ||
1031 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
1032 | + $objProtocoloDTO->setDblIdProtocolo($relProtocoloProtocoloDTO->getDblIdProtocolo2()); | ||
1033 | + $objProtocoloDTO->retStrDescricao(); | ||
1034 | + $objTempProtocoloRN = new ProtocoloRN(); | ||
1035 | + $objProtocoloDTO = $objTempProtocoloRN->consultarRN0186($objProtocoloDTO); | ||
1036 | + $informacao = $objProtocoloDTO->getStrDescricao(); | ||
1037 | + | ||
1038 | + | ||
1039 | + /* if ($resultObservacao) { | ||
1040 | + // @var ObservacaoDTO $observacaoDTO | ||
128 | $observacaoDTO = $resultObservacao[0]; | 1041 | $observacaoDTO = $resultObservacao[0]; |
129 | $informacao = substr($observacaoDTO->getStrDescricao(), 0, 250); | 1042 | $informacao = substr($observacaoDTO->getStrDescricao(), 0, 250); |
130 | - } | 1043 | + }*/ |
1044 | + | ||
131 | $publicacaoDTOConsulta = new PublicacaoDTO(); | 1045 | $publicacaoDTOConsulta = new PublicacaoDTO(); |
132 | $publicacaoDTOConsulta->setDblIdDocumento($documentoDTO->getDblIdDocumento()); | 1046 | $publicacaoDTOConsulta->setDblIdDocumento($documentoDTO->getDblIdDocumento()); |
133 | $publicacaoDTOConsulta->retDblIdDocumento(); | 1047 | $publicacaoDTOConsulta->retDblIdDocumento(); |
@@ -137,6 +1051,81 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -137,6 +1051,81 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
137 | $ciencia = $relProtocoloProtocoloDTO->getStrSinCiencia(); | 1051 | $ciencia = $relProtocoloProtocoloDTO->getStrSinCiencia(); |
138 | $podeVisualizarDocumento = $this->podeVisualizarDocumento($documentoDTO, $bolFlagProtocolo); | 1052 | $podeVisualizarDocumento = $this->podeVisualizarDocumento($documentoDTO, $bolFlagProtocolo); |
139 | 1053 | ||
1054 | + $arrObjProtocoloDTO = ""; | ||
1055 | + $objPesquisaProtocoloDTO = new PesquisaProtocoloDTO(); | ||
1056 | + $objPesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_DOCUMENTOS_GERADOS); | ||
1057 | + $objPesquisaProtocoloDTO->setStrStaAcesso(ProtocoloRN::$TAP_TODOS); | ||
1058 | + $objPesquisaProtocoloDTO->setDblIdProtocolo($relProtocoloProtocoloDTO->getDblIdProtocolo2()); | ||
1059 | + $objProtocoloRN = new ProtocoloRN(); | ||
1060 | + $arrObjProtocoloDTO = $objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO); | ||
1061 | + | ||
1062 | + | ||
1063 | + //recupera documentos disponibilizados pela unidade atual | ||
1064 | + $objRelBlocoProtocoloDTO = new RelBlocoProtocoloDTO(); | ||
1065 | + $objRelBlocoProtocoloDTO->setDistinct(true); | ||
1066 | + $objRelBlocoProtocoloDTO->retDblIdProtocolo(); | ||
1067 | + $objRelBlocoProtocoloDTO->setNumIdUnidadeBloco(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
1068 | + $objRelBlocoProtocoloDTO->setStrStaTipoBloco(BlocoRN::$TB_ASSINATURA); | ||
1069 | + $objRelBlocoProtocoloDTO->setStrStaEstadoBloco(BlocoRN::$TE_DISPONIBILIZADO); | ||
1070 | + | ||
1071 | + | ||
1072 | + $objRelBlocoProtocoloRN = new RelBlocoProtocoloRN(); | ||
1073 | + $arrDocumentosDisponibilizados = InfraArray::indexarArrInfraDTO($objRelBlocoProtocoloRN->listarRN1291($objRelBlocoProtocoloDTO),'IdProtocolo'); | ||
1074 | + | ||
1075 | + | ||
1076 | + if (isset($arrDocumentosDisponibilizados[$documentoDTOParam->getDblIdProcedimento()])) { | ||
1077 | + $disponibilizado = "S"; | ||
1078 | + } else { | ||
1079 | + $disponibilizado = "N"; | ||
1080 | + } | ||
1081 | + | ||
1082 | + $strStaDocumento = $documentoDTO->getStrStaDocumento(); | ||
1083 | + $numIdUnidadeGeradoraProtocolo = $documentoDTO->getNumIdUnidadeGeradoraProtocolo(); | ||
1084 | + $numIdUnidadeAtual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); | ||
1085 | + $strSinDisponibilizadoParaOutraUnidade = $disponibilizado; | ||
1086 | + | ||
1087 | + $permiteAssinatura = false; | ||
1088 | + $hasBloco = false; | ||
1089 | + | ||
1090 | + //recupera blocos disponibilizados para a unidade atual | ||
1091 | + $objRelBlocoUnidadeDTO = new RelBlocoUnidadeDTO(); | ||
1092 | + $objRelBlocoUnidadeDTO->retNumIdBloco(); | ||
1093 | + $objRelBlocoUnidadeDTO->retStrStaTipoBloco(); | ||
1094 | + $objRelBlocoUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
1095 | + $objRelBlocoUnidadeDTO->setStrSinRetornado('N'); | ||
1096 | + $objRelBlocoUnidadeDTO->setStrStaEstadoBloco(BlocoRN::$TE_DISPONIBILIZADO); | ||
1097 | + | ||
1098 | + $objRelBlocoUnidadeRN = new RelBlocoUnidadeRN(); | ||
1099 | + $arrObjRelBlocoUnidadeDTO = $objRelBlocoUnidadeRN->listarRN1304($objRelBlocoUnidadeDTO); | ||
1100 | + | ||
1101 | + | ||
1102 | + //se tem blocos disponibilizados | ||
1103 | + if (count($arrObjRelBlocoUnidadeDTO)){ | ||
1104 | + //busca documentos dos blocos que foram disponibilizados para a unidade atual | ||
1105 | + $objRelBlocoProtocoloDTO = new RelBlocoProtocoloDTO(); | ||
1106 | + $objRelBlocoProtocoloDTO->retDblIdProtocolo(); | ||
1107 | + $objRelBlocoProtocoloDTO->retNumIdUnidadeBloco(); | ||
1108 | + $objRelBlocoProtocoloDTO->retStrStaTipoBloco(); | ||
1109 | + $objRelBlocoProtocoloDTO->retStrStaProtocoloProtocolo(); | ||
1110 | + $objRelBlocoProtocoloDTO->retDblIdProcedimentoDocumento(); | ||
1111 | + $objRelBlocoProtocoloDTO->setNumIdBloco(InfraArray::converterArrInfraDTO($arrObjRelBlocoUnidadeDTO,'IdBloco'),InfraDTO::$OPER_IN); | ||
1112 | + $objRelBlocoProtocoloDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); | ||
1113 | + | ||
1114 | + $objRelBlocoProtocoloRN = new RelBlocoProtocoloRN(); | ||
1115 | + $arrObjRelBlocoProtocoloDTO = $objRelBlocoProtocoloRN->listarRN1291($objRelBlocoProtocoloDTO); | ||
1116 | + | ||
1117 | + if(count($arrObjRelBlocoProtocoloDTO)){ | ||
1118 | + $hasBloco = true; | ||
1119 | + } | ||
1120 | + } | ||
1121 | + | ||
1122 | + | ||
1123 | + if((($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO || $strStaDocumento==DocumentoRN::$TD_FORMULARIO_GERADO) && | ||
1124 | + ($numIdUnidadeGeradoraProtocolo == $numIdUnidadeAtual && $strSinDisponibilizadoParaOutraUnidade == 'N')) || $hasBloco){ | ||
1125 | + $permiteAssinatura = true; | ||
1126 | + } | ||
1127 | + | ||
1128 | + | ||
140 | $result[] = array( | 1129 | $result[] = array( |
141 | 'id' => $documentoDTO->getDblIdDocumento(), | 1130 | 'id' => $documentoDTO->getDblIdDocumento(), |
142 | 'atributos' => array( | 1131 | 'atributos' => array( |
@@ -151,22 +1140,25 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -151,22 +1140,25 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
151 | 'tamanho' => $tamanhoAnexo, | 1140 | 'tamanho' => $tamanhoAnexo, |
152 | 'idUnidade' => $documentoDTO->getNumIdUnidadeGeradoraProtocolo(), | 1141 | 'idUnidade' => $documentoDTO->getNumIdUnidadeGeradoraProtocolo(), |
153 | 'siglaUnidade' => $documentoDTO->getStrSiglaUnidadeGeradoraProtocolo(), | 1142 | 'siglaUnidade' => $documentoDTO->getStrSiglaUnidadeGeradoraProtocolo(), |
1143 | + 'nomeComposto' => DocumentoINT::montarIdentificacaoArvore($documentoDTO), | ||
1144 | + 'tipoConferencia' => $documentoDTO->getNumIdTipoConferencia(), | ||
154 | 'status' => array( | 1145 | 'status' => array( |
155 | 'sinBloqueado' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 1 ? 'S' : 'N', | 1146 | 'sinBloqueado' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 1 ? 'S' : 'N', |
156 | 'documentoSigiloso' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 2 ? 'S' : 'N', | 1147 | 'documentoSigiloso' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 2 ? 'S' : 'N', |
157 | 'documentoRestrito' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 1 ? 'S' : 'N', | 1148 | 'documentoRestrito' => $documentoDTO->getStrStaNivelAcessoLocalProtocolo() == 1 ? 'S' : 'N', |
158 | 'documentoPublicado' => $documentoPublicado, | 1149 | 'documentoPublicado' => $documentoPublicado, |
159 | - 'documentoAssinado' => $documentoDTO->getStrCrcAssinatura() ? 'S' : 'N', | 1150 | + 'documentoAssinado' => $documentoDTO->getStrCrcAssinatura() ? 'S' : 'N', |
160 | 'ciencia' => $ciencia, | 1151 | 'ciencia' => $ciencia, |
161 | 'documentoCancelado' => $documentoCancelado, | 1152 | 'documentoCancelado' => $documentoCancelado, |
162 | - 'podeVisualizarDocumento' => $podeVisualizarDocumento ? 'S' : 'N' | 1153 | + 'podeVisualizarDocumento' => $podeVisualizarDocumento ? 'S' : 'N', |
1154 | + 'permiteAssinatura' => $permiteAssinatura | ||
163 | ) | 1155 | ) |
164 | ) | 1156 | ) |
165 | ); | 1157 | ); |
166 | } | 1158 | } |
167 | 1159 | ||
168 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $relProtocoloProtocoloDTOConsulta->getNumTotalRegistros()); | 1160 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $relProtocoloProtocoloDTOConsulta->getNumTotalRegistros()); |
169 | - }catch (Exception $e){ | 1161 | + } catch (Exception $e) { |
170 | return MdWsSeiRest::formataRetornoErroREST($e); | 1162 | return MdWsSeiRest::formataRetornoErroREST($e); |
171 | } | 1163 | } |
172 | } | 1164 | } |
@@ -181,15 +1173,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -181,15 +1173,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
181 | * @param int $idUsuario | 1173 | * @param int $idUsuario |
182 | * @return array | 1174 | * @return array |
183 | */ | 1175 | */ |
184 | - public function apiAssinarDocumentos($arrIdDocumento, $idOrgao, $strCargoFuncao, $siglaUsuario, $senhaUsuario, $idUsuario){ | 1176 | + public function apiAssinarDocumentos($arrIdDocumento, $idOrgao, $strCargoFuncao, $siglaUsuario, $senhaUsuario, $idUsuario) { |
185 | //transforma os dados no array | 1177 | //transforma os dados no array |
186 | - if(strpos($arrIdDocumento, ',') !== false) { | 1178 | + if (strpos($arrIdDocumento, ',') !== false) { |
187 | $arrDocs = explode(',', $arrIdDocumento); | 1179 | $arrDocs = explode(',', $arrIdDocumento); |
188 | } else { | 1180 | } else { |
189 | $arrDocs = array($arrIdDocumento); | 1181 | $arrDocs = array($arrIdDocumento); |
190 | } | 1182 | } |
191 | - | ||
192 | - foreach($arrDocs as $dblIdDocumento){ | 1183 | + |
1184 | + foreach ($arrDocs as $dblIdDocumento) { | ||
193 | $documentoDTO = new DocumentoDTO(); | 1185 | $documentoDTO = new DocumentoDTO(); |
194 | $documentoDTO->setDblIdDocumento($dblIdDocumento); | 1186 | $documentoDTO->setDblIdDocumento($dblIdDocumento); |
195 | $arrDocumentoDTO[] = $documentoDTO; | 1187 | $arrDocumentoDTO[] = $documentoDTO; |
@@ -214,7 +1206,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -214,7 +1206,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
214 | * @param $idUsuario | 1206 | * @param $idUsuario |
215 | * @return array | 1207 | * @return array |
216 | */ | 1208 | */ |
217 | - public function apiAssinarDocumento($idDocumento, $idOrgao, $strCargoFuncao, $siglaUsuario, $senhaUsuario, $idUsuario){ | 1209 | + public function apiAssinarDocumento($idDocumento, $idOrgao, $strCargoFuncao, $siglaUsuario, $senhaUsuario, $idUsuario) { |
218 | $arrDocumentoDTO = array(); | 1210 | $arrDocumentoDTO = array(); |
219 | $documentoDTO = new DocumentoDTO(); | 1211 | $documentoDTO = new DocumentoDTO(); |
220 | $documentoDTO->setDblIdDocumento($idDocumento); | 1212 | $documentoDTO->setDblIdDocumento($idDocumento); |
@@ -234,14 +1226,14 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -234,14 +1226,14 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
234 | * @param AssinaturaDTO $assinaturaDTO | 1226 | * @param AssinaturaDTO $assinaturaDTO |
235 | * @return array | 1227 | * @return array |
236 | */ | 1228 | */ |
237 | - public function assinarDocumentoControlado(AssinaturaDTO $assinaturaDTO){ | ||
238 | - try{ | 1229 | + public function assinarDocumentoControlado(AssinaturaDTO $assinaturaDTO) { |
1230 | + try { | ||
239 | $assinaturaDTO->setStrStaFormaAutenticacao(AssinaturaRN::$TA_SENHA); | 1231 | $assinaturaDTO->setStrStaFormaAutenticacao(AssinaturaRN::$TA_SENHA); |
240 | $assinaturaDTO->setNumIdContextoUsuario(null); | 1232 | $assinaturaDTO->setNumIdContextoUsuario(null); |
241 | $documentoRN = new DocumentoRN(); | 1233 | $documentoRN = new DocumentoRN(); |
242 | $documentoRN->assinarInterno($assinaturaDTO); | 1234 | $documentoRN->assinarInterno($assinaturaDTO); |
243 | return MdWsSeiRest::formataRetornoSucessoREST('Documento em bloco assinado com sucesso.'); | 1235 | return MdWsSeiRest::formataRetornoSucessoREST('Documento em bloco assinado com sucesso.'); |
244 | - }catch (Exception $e){ | 1236 | + } catch (Exception $e) { |
245 | return MdWsSeiRest::formataRetornoErroREST($e); | 1237 | return MdWsSeiRest::formataRetornoErroREST($e); |
246 | } | 1238 | } |
247 | } | 1239 | } |
@@ -251,22 +1243,22 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -251,22 +1243,22 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
251 | * id documento obrigatorio | 1243 | * id documento obrigatorio |
252 | * @return array | 1244 | * @return array |
253 | */ | 1245 | */ |
254 | - protected function darCienciaControlado(DocumentoDTO $documentoDTO){ | ||
255 | - try{ | 1246 | + protected function darCienciaControlado(DocumentoDTO $documentoDTO) { |
1247 | + try { | ||
256 | $documentoRN = new DocumentoRN(); | 1248 | $documentoRN = new DocumentoRN(); |
257 | - if(!$documentoDTO->isSetDblIdDocumento()){ | 1249 | + if (!$documentoDTO->isSetDblIdDocumento()) { |
258 | throw new InfraException('O documento não foi informado.'); | 1250 | throw new InfraException('O documento não foi informado.'); |
259 | } | 1251 | } |
260 | $documentoRN->darCiencia($documentoDTO); | 1252 | $documentoRN->darCiencia($documentoDTO); |
261 | return MdWsSeiRest::formataRetornoSucessoREST('Ciência documento realizado com sucesso.'); | 1253 | return MdWsSeiRest::formataRetornoSucessoREST('Ciência documento realizado com sucesso.'); |
262 | - }catch (Exception $e){ | 1254 | + } catch (Exception $e) { |
263 | return MdWsSeiRest::formataRetornoErroREST($e); | 1255 | return MdWsSeiRest::formataRetornoErroREST($e); |
264 | } | 1256 | } |
265 | } | 1257 | } |
266 | 1258 | ||
267 | - protected function downloadAnexoConectado(ProtocoloDTO $protocoloDTOParam){ | ||
268 | - try{ | ||
269 | - if(!$protocoloDTOParam->isSetDblIdProtocolo() || !$protocoloDTOParam->getDblIdProtocolo()){ | 1259 | + protected function downloadAnexoConectado(ProtocoloDTO $protocoloDTOParam) { |
1260 | + try { | ||
1261 | + if (!$protocoloDTOParam->isSetDblIdProtocolo() || !$protocoloDTOParam->getDblIdProtocolo()) { | ||
270 | throw new InfraException('O protocolo deve ser informado!'); | 1262 | throw new InfraException('O protocolo deve ser informado!'); |
271 | } | 1263 | } |
272 | $documentoDTOConsulta = new DocumentoDTO(); | 1264 | $documentoDTOConsulta = new DocumentoDTO(); |
@@ -283,7 +1275,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -283,7 +1275,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
283 | $documentoRN = new DocumentoRN(); | 1275 | $documentoRN = new DocumentoRN(); |
284 | $documentoDTO = $documentoRN->consultarRN0005($documentoDTOConsulta); | 1276 | $documentoDTO = $documentoRN->consultarRN0005($documentoDTOConsulta); |
285 | 1277 | ||
286 | - if ($documentoDTO->getStrStaDocumento()==DocumentoRN::$TD_EDITOR_EDOC) { | 1278 | + if ($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_EDOC) { |
287 | if ($documentoDTO->getDblIdDocumentoEdoc() == null) { | 1279 | if ($documentoDTO->getDblIdDocumentoEdoc() == null) { |
288 | throw new InfraException('Documento sem conteúdo!'); | 1280 | throw new InfraException('Documento sem conteúdo!'); |
289 | } | 1281 | } |
@@ -291,11 +1283,11 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -291,11 +1283,11 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
291 | $html = $eDocRN->consultarHTMLDocumentoRN1204($documentoDTO); | 1283 | $html = $eDocRN->consultarHTMLDocumentoRN1204($documentoDTO); |
292 | 1284 | ||
293 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | 1285 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
294 | - }else if(in_array($documentoDTO->getStrStaDocumento(), array(DocumentoRN::$TD_FORMULARIO_AUTOMATICO, DocumentoRN::$TD_FORMULARIO_GERADO))) { | 1286 | + } else if (in_array($documentoDTO->getStrStaDocumento(), array(DocumentoRN::$TD_FORMULARIO_AUTOMATICO, DocumentoRN::$TD_FORMULARIO_GERADO))) { |
295 | $html = $documentoRN->consultarHtmlFormulario($documentoDTO); | 1287 | $html = $documentoRN->consultarHtmlFormulario($documentoDTO); |
296 | 1288 | ||
297 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | 1289 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
298 | - }else if($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO){ | 1290 | + } else if ($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO) { |
299 | $editorDTOConsulta = new EditorDTO(); | 1291 | $editorDTOConsulta = new EditorDTO(); |
300 | $editorDTOConsulta->setDblIdDocumento($documentoDTO->getDblIdDocumento()); | 1292 | $editorDTOConsulta->setDblIdDocumento($documentoDTO->getDblIdDocumento()); |
301 | $editorDTOConsulta->setNumIdBaseConhecimento(null); | 1293 | $editorDTOConsulta->setNumIdBaseConhecimento(null); |
@@ -304,7 +1296,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -304,7 +1296,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
304 | $editorDTOConsulta->setStrSinIdentificacaoVersao('S'); | 1296 | $editorDTOConsulta->setStrSinIdentificacaoVersao('S'); |
305 | $editorDTOConsulta->setStrSinProcessarLinks('S'); | 1297 | $editorDTOConsulta->setStrSinProcessarLinks('S'); |
306 | 1298 | ||
307 | - if(MdWsSeiEditorRN::versaoCarimboPublicacaoObrigatorio()){ | 1299 | + if (MdWsSeiEditorRN::versaoCarimboPublicacaoObrigatorio()) { |
308 | $editorDTOConsulta->setStrSinCarimboPublicacao('N'); | 1300 | $editorDTOConsulta->setStrSinCarimboPublicacao('N'); |
309 | } | 1301 | } |
310 | 1302 | ||
@@ -323,7 +1315,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -323,7 +1315,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
323 | $auditoriaProtocoloRN->auditarVisualizacao($auditoriaProtocoloDTO); | 1315 | $auditoriaProtocoloRN->auditarVisualizacao($auditoriaProtocoloDTO); |
324 | 1316 | ||
325 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | 1317 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
326 | - }else{ | 1318 | + } else { |
327 | $anexoDTO = new AnexoDTO(); | 1319 | $anexoDTO = new AnexoDTO(); |
328 | $anexoDTO->retNumIdAnexo(); | 1320 | $anexoDTO->retNumIdAnexo(); |
329 | $anexoDTO->retDthInclusao(); | 1321 | $anexoDTO->retDthInclusao(); |
@@ -334,14 +1326,14 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -334,14 +1326,14 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
334 | $anexoDTO->setStrSinAtivo('S'); | 1326 | $anexoDTO->setStrSinAtivo('S'); |
335 | $anexoRN = new AnexoRN(); | 1327 | $anexoRN = new AnexoRN(); |
336 | $resultAnexo = $anexoRN->listarRN0218($anexoDTO); | 1328 | $resultAnexo = $anexoRN->listarRN0218($anexoDTO); |
337 | - if(empty($resultAnexo)){ | 1329 | + if (empty($resultAnexo)) { |
338 | throw new InfraException('Documento não encontrado!'); | 1330 | throw new InfraException('Documento não encontrado!'); |
339 | } | 1331 | } |
340 | $anexo = $resultAnexo[0]; | 1332 | $anexo = $resultAnexo[0]; |
341 | SeiINT::download($anexo); | 1333 | SeiINT::download($anexo); |
342 | exit; | 1334 | exit; |
343 | } | 1335 | } |
344 | - }catch (Exception $e){ | 1336 | + } catch (Exception $e) { |
345 | return MdWsSeiRest::formataRetornoErroREST($e); | 1337 | return MdWsSeiRest::formataRetornoErroREST($e); |
346 | } | 1338 | } |
347 | } | 1339 | } |
@@ -352,9 +1344,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -352,9 +1344,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
352 | * *valor = protocoloformatado? | 1344 | * *valor = protocoloformatado? |
353 | * @return array | 1345 | * @return array |
354 | */ | 1346 | */ |
355 | - protected function listarCienciaDocumentoConectado(MdWsSeiProcessoDTO $mdWsSeiProcessoDTOParam){ | ||
356 | - try{ | ||
357 | - if(!$mdWsSeiProcessoDTOParam->isSetStrValor()){ | 1347 | + protected function listarCienciaDocumentoConectado(MdWsSeiProcessoDTO $mdWsSeiProcessoDTOParam) { |
1348 | + try { | ||
1349 | + if (!$mdWsSeiProcessoDTOParam->isSetStrValor()) { | ||
358 | throw new InfraException('Número do documento não informado.'); | 1350 | throw new InfraException('Número do documento não informado.'); |
359 | } | 1351 | } |
360 | 1352 | ||
@@ -376,7 +1368,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -376,7 +1368,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
376 | $tarefaDTO = $tarefaRN->consultar($tarefaDTO); | 1368 | $tarefaDTO = $tarefaRN->consultar($tarefaDTO); |
377 | $mdWsSeiProcessoRN = new MdWsSeiProcessoRN(); | 1369 | $mdWsSeiProcessoRN = new MdWsSeiProcessoRN(); |
378 | /** @var AtributoAndamentoDTO $atributoAndamentoDTO */ | 1370 | /** @var AtributoAndamentoDTO $atributoAndamentoDTO */ |
379 | - foreach($ret as $atributoAndamentoDTO){ | 1371 | + foreach ($ret as $atributoAndamentoDTO) { |
380 | $mdWsSeiProcessoDTO = new MdWsSeiProcessoDTO(); | 1372 | $mdWsSeiProcessoDTO = new MdWsSeiProcessoDTO(); |
381 | $mdWsSeiProcessoDTO->setNumIdAtividade($atributoAndamentoDTO->getNumIdAtividade()); | 1373 | $mdWsSeiProcessoDTO->setNumIdAtividade($atributoAndamentoDTO->getNumIdAtividade()); |
382 | $mdWsSeiProcessoDTO->setStrTemplate($tarefaDTO->getStrNome()); | 1374 | $mdWsSeiProcessoDTO->setStrTemplate($tarefaDTO->getStrNome()); |
@@ -389,7 +1381,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -389,7 +1381,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
389 | } | 1381 | } |
390 | 1382 | ||
391 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | 1383 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
392 | - }catch (Exception $e){ | 1384 | + } catch (Exception $e) { |
393 | return MdWsSeiRest::formataRetornoErroREST($e); | 1385 | return MdWsSeiRest::formataRetornoErroREST($e); |
394 | } | 1386 | } |
395 | } | 1387 | } |
@@ -399,9 +1391,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -399,9 +1391,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
399 | * @param DocumentoDTO $documentoDTOParam | 1391 | * @param DocumentoDTO $documentoDTOParam |
400 | * @return array | 1392 | * @return array |
401 | */ | 1393 | */ |
402 | - protected function listarAssinaturasDocumentoConectado(DocumentoDTO $documentoDTOParam){ | ||
403 | - try{ | ||
404 | - if(!$documentoDTOParam->isSetDblIdDocumento()){ | 1394 | + protected function listarAssinaturasDocumentoConectado(DocumentoDTO $documentoDTOParam) { |
1395 | + try { | ||
1396 | + if (!$documentoDTOParam->isSetDblIdDocumento()) { | ||
405 | throw new InfraException('O documento não foi informado.'); | 1397 | throw new InfraException('O documento não foi informado.'); |
406 | } | 1398 | } |
407 | 1399 | ||
@@ -413,7 +1405,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -413,7 +1405,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
413 | $assinaturaRN = new AssinaturaRN(); | 1405 | $assinaturaRN = new AssinaturaRN(); |
414 | $ret = $assinaturaRN->listarRN1323($assinaturaDTOConsulta); | 1406 | $ret = $assinaturaRN->listarRN1323($assinaturaDTOConsulta); |
415 | /** @var AssinaturaDTO $assinaturaDTO */ | 1407 | /** @var AssinaturaDTO $assinaturaDTO */ |
416 | - foreach($ret as $assinaturaDTO){ | 1408 | + foreach ($ret as $assinaturaDTO) { |
417 | $result[] = array( | 1409 | $result[] = array( |
418 | 'nome' => $assinaturaDTO->getStrNome(), | 1410 | 'nome' => $assinaturaDTO->getStrNome(), |
419 | 'cargo' => $assinaturaDTO->getStrTratamento(), | 1411 | 'cargo' => $assinaturaDTO->getStrTratamento(), |
@@ -422,7 +1414,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -422,7 +1414,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
422 | } | 1414 | } |
423 | 1415 | ||
424 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | 1416 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
425 | - }catch (Exception $e){ | 1417 | + } catch (Exception $e) { |
426 | return MdWsSeiRest::formataRetornoErroREST($e); | 1418 | return MdWsSeiRest::formataRetornoErroREST($e); |
427 | } | 1419 | } |
428 | } | 1420 | } |
@@ -433,8 +1425,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -433,8 +1425,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
433 | * @param bool $bolFlagProtocolo | 1425 | * @param bool $bolFlagProtocolo |
434 | * @return bool | 1426 | * @return bool |
435 | */ | 1427 | */ |
436 | - protected function podeVisualizarDocumento(DocumentoDTO $documentoDTO, $bolFlagProtocolo = false) | ||
437 | - { | 1428 | + protected function podeVisualizarDocumento(DocumentoDTO $documentoDTO, $bolFlagProtocolo = false) { |
438 | $podeVisualizar = false; | 1429 | $podeVisualizar = false; |
439 | $pesquisaProtocoloDTO = new PesquisaProtocoloDTO(); | 1430 | $pesquisaProtocoloDTO = new PesquisaProtocoloDTO(); |
440 | $pesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_TODOS); | 1431 | $pesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_TODOS); |
@@ -445,7 +1436,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -445,7 +1436,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
445 | $protocoloDTODocumento = $arrProtocoloDTO[$documentoDTO->getDblIdDocumento()]; | 1436 | $protocoloDTODocumento = $arrProtocoloDTO[$documentoDTO->getDblIdDocumento()]; |
446 | 1437 | ||
447 | $numCodigoAcesso = $protocoloDTODocumento->getNumCodigoAcesso(); | 1438 | $numCodigoAcesso = $protocoloDTODocumento->getNumCodigoAcesso(); |
448 | - if ($numCodigoAcesso > 0 || $bolFlagProtocolo) { | 1439 | + if ($numCodigoAcesso > 0) { |
449 | $podeVisualizar = true; | 1440 | $podeVisualizar = true; |
450 | } | 1441 | } |
451 | if ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) { | 1442 | if ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) { |
@@ -454,4 +1445,135 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | @@ -454,4 +1445,135 @@ class MdWsSeiDocumentoRN extends DocumentoRN { | ||
454 | 1445 | ||
455 | return $podeVisualizar; | 1446 | return $podeVisualizar; |
456 | } | 1447 | } |
457 | -} | ||
458 | \ No newline at end of file | 1448 | \ No newline at end of file |
1449 | + | ||
1450 | + public function consultarDocumento($parNumIdDocumento) { | ||
1451 | + | ||
1452 | + try { | ||
1453 | + $arrDadosDocumento = array(); | ||
1454 | + | ||
1455 | + //Busca o tipo de documento | ||
1456 | + $objDocumentoDTO = new DocumentoDTO(); | ||
1457 | + $objDocumentoDTO->setDblIdDocumento($parNumIdDocumento); | ||
1458 | + $objDocumentoDTO->retNumIdSerie(); | ||
1459 | + $objDocumentoDTO->retStrNumero(); | ||
1460 | + | ||
1461 | + $objDocumentoRN = new DocumentoRN(); | ||
1462 | + $objDocumentoDTO = $objDocumentoRN->consultarRN0005($objDocumentoDTO); | ||
1463 | + | ||
1464 | + if (!$objDocumentoDTO) { | ||
1465 | + throw new Exception('Não foi encontrado documento com id ' . $parNumIdDocumento); | ||
1466 | + } | ||
1467 | + | ||
1468 | + $arrDadosDocumento['tipoDocumento'] = $objDocumentoDTO->getNumIdSerie(); | ||
1469 | + $arrDadosDocumento['numero'] = $objDocumentoDTO->getStrNumero(); | ||
1470 | + | ||
1471 | + //Busca os assuntos | ||
1472 | + $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
1473 | + $objRelProtocoloAssuntoDTO->setDblIdProtocolo($parNumIdDocumento); | ||
1474 | + $objRelProtocoloAssuntoDTO->retNumIdAssunto(); | ||
1475 | + $objRelProtocoloAssuntoDTO->retStrCodigoEstruturadoAssunto(); | ||
1476 | + $objRelProtocoloAssuntoDTO->retStrDescricaoAssunto(); | ||
1477 | + $objRelProtocoloAssuntoDTO->retNumSequencia(); | ||
1478 | + $objRelProtocoloAssuntoDTO->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
1479 | + | ||
1480 | + $objRelProtocoloAssuntoRN = new RelProtocoloAssuntoRN(); | ||
1481 | + $objArrRelProtocoloAssuntoDTO = $objRelProtocoloAssuntoRN->listarRN0188($objRelProtocoloAssuntoDTO); | ||
1482 | + | ||
1483 | + if ($objArrRelProtocoloAssuntoDTO) { | ||
1484 | + foreach ($objArrRelProtocoloAssuntoDTO as $key => $objProtocoloAssuntoDTO) { | ||
1485 | + $arrDadosDocumento['assuntos'][$key]['id'] = $objProtocoloAssuntoDTO->getNumIdAssunto(); | ||
1486 | + $arrDadosDocumento['assuntos'][$key]['codigo'] = $objProtocoloAssuntoDTO->getStrCodigoEstruturadoAssunto(); | ||
1487 | + $arrDadosDocumento['assuntos'][$key]['descricao'] = $objProtocoloAssuntoDTO->getStrDescricaoAssunto(); | ||
1488 | + } | ||
1489 | + } | ||
1490 | + | ||
1491 | + //Busca os interessados, destinatários e remetentes | ||
1492 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
1493 | + $objParticipanteDTO->setDblIdProtocolo($parNumIdDocumento); | ||
1494 | + $objParticipanteDTO->setStrStaParticipacao(array(ParticipanteRN::$TP_INTERESSADO, ParticipanteRN::$TP_DESTINATARIO, ParticipanteRN::$TP_REMETENTE), InfraDTO::$OPER_IN); | ||
1495 | + $objParticipanteDTO->retNumIdContato(); | ||
1496 | + $objParticipanteDTO->retStrStaParticipacao(); | ||
1497 | + $objParticipanteDTO->retStrSiglaContato(); | ||
1498 | + $objParticipanteDTO->retStrNomeContato(); | ||
1499 | + $objParticipanteDTO->retNumSequencia(); | ||
1500 | + $objParticipanteDTO->setOrdStrStaParticipacao(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
1501 | + $objParticipanteDTO->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
1502 | + | ||
1503 | + $objParticipanteRN = new ParticipanteRN(); | ||
1504 | + $objArrParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); | ||
1505 | + $arrDadosDocumento['interessados'] = array(); | ||
1506 | + $arrDadosDocumento['destinatarios'] = array(); | ||
1507 | + $arrDadosDocumento['remetentes'] = array(); | ||
1508 | + | ||
1509 | + if ($objArrParticipanteDTO) { | ||
1510 | + foreach ($objArrParticipanteDTO as $key => $objParticipanteDTO) { | ||
1511 | + if ($objParticipanteDTO->getStrStaParticipacao() == ParticipanteRN::$TP_INTERESSADO) { | ||
1512 | + $arrDadosDocumento['interessados'][$objParticipanteDTO->getNumSequencia()]['id'] = $objParticipanteDTO->getNumIdContato(); | ||
1513 | + $arrDadosDocumento['interessados'][$objParticipanteDTO->getNumSequencia()]['sigla'] = $objParticipanteDTO->getStrSiglaContato(); | ||
1514 | + $arrDadosDocumento['interessados'][$objParticipanteDTO->getNumSequencia()]['nome'] = $objParticipanteDTO->getStrNomeContato(); | ||
1515 | + } | ||
1516 | + | ||
1517 | + if ($objParticipanteDTO->getStrStaParticipacao() == ParticipanteRN::$TP_DESTINATARIO) { | ||
1518 | + $arrDadosDocumento['destinatarios'][$objParticipanteDTO->getNumSequencia()]['id'] = $objParticipanteDTO->getNumIdContato(); | ||
1519 | + $arrDadosDocumento['destinatarios'][$objParticipanteDTO->getNumSequencia()]['sigla'] = $objParticipanteDTO->getStrSiglaContato(); | ||
1520 | + $arrDadosDocumento['destinatarios'][$objParticipanteDTO->getNumSequencia()]['nome'] = $objParticipanteDTO->getStrNomeContato(); | ||
1521 | + } | ||
1522 | + | ||
1523 | + if ($objParticipanteDTO->getStrStaParticipacao() == ParticipanteRN::$TP_REMETENTE) { | ||
1524 | + $arrDadosDocumento['remetentes'][$objParticipanteDTO->getNumSequencia()]['id'] = $objParticipanteDTO->getNumIdContato(); | ||
1525 | + $arrDadosDocumento['remetentes'][$objParticipanteDTO->getNumSequencia()]['sigla'] = $objParticipanteDTO->getStrSiglaContato(); | ||
1526 | + $arrDadosDocumento['remetentes'][$objParticipanteDTO->getNumSequencia()]['nome'] = $objParticipanteDTO->getStrNomeContato(); | ||
1527 | + } | ||
1528 | + } | ||
1529 | + } | ||
1530 | + | ||
1531 | + | ||
1532 | + //Busca os dados do documento referentes ao protocolo | ||
1533 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
1534 | + $objProtocoloDTO->setDblIdProtocolo($parNumIdDocumento); | ||
1535 | + $objProtocoloDTO->retStrDescricao(); | ||
1536 | + $objProtocoloDTO->retStrStaNivelAcessoLocal(); | ||
1537 | + $objProtocoloDTO->retNumIdHipoteseLegal(); | ||
1538 | + $objProtocoloDTO->retStrStaGrauSigilo(); | ||
1539 | + $objProtocoloDTO->retDtaGeracao(); | ||
1540 | + $objProtocoloDTO->retNumIdTipoConferenciaDocumento(); | ||
1541 | + | ||
1542 | + $objProtocoloRN = new ProtocoloRN(); | ||
1543 | + $objProtocoloDTO = $objProtocoloRN->consultarRN0186($objProtocoloDTO); | ||
1544 | + | ||
1545 | + $arrDadosDocumento['descricao'] = $objProtocoloDTO->getStrDescricao(); | ||
1546 | + $arrDadosDocumento['nivelAcesso'] = $objProtocoloDTO->getStrStaNivelAcessoLocal(); | ||
1547 | + $arrDadosDocumento['hipoteseLegal'] = $objProtocoloDTO->getNumIdHipoteseLegal(); | ||
1548 | + $arrDadosDocumento['grauSigilo'] = $objProtocoloDTO->getStrStaGrauSigilo(); | ||
1549 | + $arrDadosDocumento['dataGeracao'] = $objProtocoloDTO->getDtaGeracao(); | ||
1550 | + $arrDadosDocumento['tipoConferencia'] = $objProtocoloDTO->getNumIdTipoConferenciaDocumento(); | ||
1551 | + | ||
1552 | + //Busca as observações | ||
1553 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
1554 | + $objObservacaoDTO->setDblIdProtocolo($parNumIdDocumento); | ||
1555 | + $objObservacaoDTO->retNumIdUnidade(); | ||
1556 | + $objObservacaoDTO->retStrSiglaUnidade(); | ||
1557 | + $objObservacaoDTO->retStrDescricaoUnidade(); | ||
1558 | + $objObservacaoDTO->retStrDescricao(); | ||
1559 | + | ||
1560 | + $objObservacaoRN = new ObservacaoRN(); | ||
1561 | + $arrObjObservacaoDTO = $objObservacaoRN->listarRN0219($objObservacaoDTO); | ||
1562 | + | ||
1563 | + if ($arrObjObservacaoDTO) { | ||
1564 | + foreach ($arrObjObservacaoDTO as $key => $objObservacaoDTO) { | ||
1565 | + $arrDadosDocumento['observacoes'][$key]['unidade'] = $objObservacaoDTO->getNumIdUnidade(); | ||
1566 | + $arrDadosDocumento['observacoes'][$key]['siglaUnidade'] = $objObservacaoDTO->getStrSiglaUnidade(); | ||
1567 | + $arrDadosDocumento['observacoes'][$key]['nomeUnidade'] = $objObservacaoDTO->getStrDescricaoUnidade(); | ||
1568 | + $arrDadosDocumento['observacoes'][$key]['observacao'] = $objObservacaoDTO->getStrDescricao(); | ||
1569 | + } | ||
1570 | + } else { | ||
1571 | + $arrDadosDocumento['observacao'] = array(); | ||
1572 | + } | ||
1573 | + | ||
1574 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrDadosDocumento); | ||
1575 | + } catch (Exception $e) { | ||
1576 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
1577 | + } | ||
1578 | + } | ||
1579 | + | ||
1580 | +} |
@@ -0,0 +1,95 @@ | @@ -0,0 +1,95 @@ | ||
1 | +<?php | ||
2 | +require_once dirname(__FILE__).'/../../../SEI.php'; | ||
3 | + | ||
4 | +class MdWsSeiHipoteseLegalRN extends InfraRN | ||
5 | +{ | ||
6 | + | ||
7 | + protected function inicializarObjInfraIBanco() | ||
8 | + { | ||
9 | + return BancoSEI::getInstance(); | ||
10 | + } | ||
11 | + | ||
12 | + | ||
13 | + /** | ||
14 | + * O serviço realiza a pesquisa das hipóteses legais do SEI. | ||
15 | + * @param MdWsSeiHipoteseLegalDTO $dto | ||
16 | + * @return array | ||
17 | + */ | ||
18 | + protected function listarHipoteseLegalConectado(MdWsSeiHipoteseLegalDTO $dto) | ||
19 | + { | ||
20 | + try { | ||
21 | + $id = $dto->getNumIdHipoteseLegal(); | ||
22 | + $nivelAcesso = $dto->getNumNivelAcesso(); | ||
23 | + $filter = $dto->getStrFilter(); | ||
24 | + $start = $dto->getNumStart(); | ||
25 | + $limit = $dto->getNumLimit(); | ||
26 | + | ||
27 | + $hipoteseLegalDTO = new HipoteseLegalDTO(); | ||
28 | + | ||
29 | + if ($id) | ||
30 | + $hipoteseLegalDTO->setNumIdHipoteseLegal($id); | ||
31 | + | ||
32 | + if ($nivelAcesso) | ||
33 | + $hipoteseLegalDTO->setStrStaNivelAcesso($nivelAcesso); | ||
34 | + | ||
35 | + if ($filter) | ||
36 | + $hipoteseLegalDTO->setStrNome('%' . utf8_decode ($filter) . '%', InfraDTO::$OPER_LIKE); | ||
37 | + | ||
38 | + IF ($limit) | ||
39 | + $hipoteseLegalDTO->setNumMaxRegistrosRetorno($limit); | ||
40 | + | ||
41 | + IF ($start) | ||
42 | + $hipoteseLegalDTO->setNumPaginaAtual($start); | ||
43 | + | ||
44 | + $hipoteseLegalDTO->retNumIdHipoteseLegal(); | ||
45 | + $hipoteseLegalDTO->retStrNome(); | ||
46 | + | ||
47 | + $hipoteseLegalRN = new HipoteseLegalRN(); | ||
48 | + $arrHipoteseLegalDTO = $hipoteseLegalRN->listar($hipoteseLegalDTO); | ||
49 | + | ||
50 | + $arrayRetorno = array(); | ||
51 | + if($arrHipoteseLegalDTO){ | ||
52 | + foreach ($arrHipoteseLegalDTO as $obj) { | ||
53 | + $arrayRetorno[] = array( | ||
54 | + "id" => $obj->getNumIdHipoteseLegal(), | ||
55 | + "nome" => $obj->getStrNome() | ||
56 | + ); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + $total = count($arrayRetorno); | ||
61 | + | ||
62 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
63 | + } catch (Exception $e) { | ||
64 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | + /** | ||
70 | + * Realiza a inclusão de um contato no SEI. | ||
71 | + * @param MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO | ||
72 | + * @return array | ||
73 | + */ | ||
74 | + protected function criarContatoConectado(MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO) | ||
75 | + { | ||
76 | + try { | ||
77 | + | ||
78 | + $nome = $objGetMdWsSeiContatoDTO->getStrNome(); | ||
79 | + | ||
80 | + $objContatoDTO = new ContatoDTO(); | ||
81 | + $objContatoDTO->setStrNome($nome); | ||
82 | + | ||
83 | + $objContatoRN = new ContatoRN(); | ||
84 | + $objContatoDTO = $objContatoRN->cadastrarContextoTemporario($objContatoDTO); | ||
85 | + | ||
86 | + return MdWsSeiRest::formataRetornoSucessoREST(null,array("id"=>$objContatoDTO->getNumIdContato())); | ||
87 | + } catch (Exception $e) { | ||
88 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
89 | + } | ||
90 | + } | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | +} | ||
0 | \ No newline at end of file | 96 | \ No newline at end of file |
rn/MdWsSeiProcedimentoRN.php
1 | -<? | ||
2 | -require_once dirname(__FILE__) . '/../../../SEI.php'; | 1 | +<?php |
2 | +require_once dirname(__FILE__).'/../../../SEI.php'; | ||
3 | 3 | ||
4 | class MdWsSeiProcedimentoRN extends InfraRN | 4 | class MdWsSeiProcedimentoRN extends InfraRN |
5 | { | 5 | { |
@@ -57,6 +57,572 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -57,6 +57,572 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | + /** | ||
61 | + * Retorna todos tipos de procedimentos filtrados | ||
62 | + * @param MdWsSeiTipoProcedimentoDTO $objGetMdWsSeiTipoProcedimentoDTO | ||
63 | + * @return array | ||
64 | + */ | ||
65 | + protected function listarTipoProcedimentoConectado(MdWsSeiTipoProcedimentoDTO $objGetMdWsSeiTipoProcedimentoDTO) | ||
66 | + { | ||
67 | + try { | ||
68 | + | ||
69 | + $id = $objGetMdWsSeiTipoProcedimentoDTO->getNumIdTipoProcedimento(); | ||
70 | + $nome = $objGetMdWsSeiTipoProcedimentoDTO->getStrNome(); | ||
71 | +// $interno = $objGetMdWsSeiTipoProcedimentoDTO->getStrSinInterno(); | ||
72 | + $favoritos = $objGetMdWsSeiTipoProcedimentoDTO->getStrFavoritos(); | ||
73 | + $start = $objGetMdWsSeiTipoProcedimentoDTO->getNumStart(); | ||
74 | + $limit = $objGetMdWsSeiTipoProcedimentoDTO->getNumLimit(); | ||
75 | + | ||
76 | + | ||
77 | + // DTO QUE REPRESENTA OS TIPOS DE PROCESSO. | ||
78 | + $objTipoProcedimentoDTO = new TipoProcedimentoDTO(); | ||
79 | + $objTipoProcedimentoDTO->setStrSinSomenteUtilizados($favoritos); //Flag de FAVORITOS S (true) / N (false) | ||
80 | + | ||
81 | + //RETORNOS ESPERADOS NOS PARÂMETROS DE SAÍDA | ||
82 | + $objTipoProcedimentoDTO->retNumIdTipoProcedimento(); | ||
83 | + $objTipoProcedimentoDTO->retStrNome(); | ||
84 | + $objTipoProcedimentoDTO->retStrSinInterno(); | ||
85 | + | ||
86 | + //MÉTODO QUE RETORNA A BUSCA DOS TIPOS DE PROCESSO APLICANDO AS REGRAS DE RESTRIÇÃO POR ÓRGÃO, UNIDADE E OUVIDORIA | ||
87 | + $objTipoProcedimentoRN = new TipoProcedimentoRN(); | ||
88 | + $arrObjTipoProcedimentoDTO = $objTipoProcedimentoRN->listarTiposUnidade($objTipoProcedimentoDTO); //Lista os tipos de processo | ||
89 | + | ||
90 | + $arrayObjs = array(); | ||
91 | + //FILTRA NOME, ID e INTERNO | ||
92 | + if($arrObjTipoProcedimentoDTO){ | ||
93 | + foreach ($arrObjTipoProcedimentoDTO as $aux) { | ||
94 | + | ||
95 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | ||
96 | + | ||
97 | + $objDtoFormatado = strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $aux->getStrNome())); | ||
98 | + $nomeFormatado = str_replace('?','',strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $nome))); | ||
99 | + | ||
100 | + if( | ||
101 | + ($aux->getNumIdTipoProcedimento() == $id || !$id) | ||
102 | + && | ||
103 | + (($nome && strpos($objDtoFormatado, $nomeFormatado) !== false) || !$nomeFormatado) | ||
104 | +// && | ||
105 | +// ($aux->getStrSinInterno() == $interno || !$interno) | ||
106 | + ){ | ||
107 | + $arrayObjs[] = array( | ||
108 | + "id" => $aux->getNumIdTipoProcedimento(), | ||
109 | + "nome" => $aux->getStrNome() | ||
110 | + ); | ||
111 | + } | ||
112 | + } | ||
113 | + } | ||
114 | + | ||
115 | + $arrayRetorno = array(); | ||
116 | + $i = 0; | ||
117 | + //PERMITE SIGILOSO | ||
118 | + if(count($arrayObjs) > 0){ | ||
119 | + foreach ($arrayObjs as $aux) { | ||
120 | + $i++; | ||
121 | + $objNivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | ||
122 | + $objNivelAcessoPermitidoDTO->setNumIdTipoProcedimento($aux["id"]); // ID DO TIPO DE PROCESSO | ||
123 | + $objNivelAcessoPermitidoDTO->setStrStaNivelAcesso(ProtocoloRN::$NA_SIGILOSO); | ||
124 | + | ||
125 | + $objNivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | ||
126 | + $permiteSigiloso = $objNivelAcessoPermitidoRN->contar($objNivelAcessoPermitidoDTO) > 0 ? true : false; | ||
127 | + | ||
128 | + | ||
129 | + $arrayRetorno[] = array( | ||
130 | + "id" => $aux["id"], | ||
131 | + "nome" => $aux["nome"], | ||
132 | + "permiteSigiloso" => $permiteSigiloso | ||
133 | + ); | ||
134 | + } | ||
135 | + } | ||
136 | + | ||
137 | + $total = 0; | ||
138 | + $total = count($arrayRetorno); | ||
139 | + | ||
140 | + if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1)); | ||
141 | + if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit)); | ||
142 | + | ||
143 | + | ||
144 | + /*$total = 0; | ||
145 | + $total = count($arrayRetorno);*/ | ||
146 | + | ||
147 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
148 | + } catch (Exception $e) { | ||
149 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
150 | + } | ||
151 | + } | ||
152 | + | ||
153 | + | ||
154 | + | ||
155 | + /** | ||
156 | + * Retorna todos tipos de procedimentos filtrados | ||
157 | + * @param MdWsSeiTipoProcedimentoDTO $objGetMdWsSeiTipoProcedimentoDTO | ||
158 | + * @return array | ||
159 | + */ | ||
160 | + protected function buscarTipoTemplateConectado(MdWsSeiTipoProcedimentoDTO $dto) | ||
161 | + { | ||
162 | + try { | ||
163 | + | ||
164 | + $id = $dto->getNumIdTipoProcedimento(); | ||
165 | + | ||
166 | + //DTO QUE REPRESENTA A RELAÇÃO ENTRE OS ASSUNTOS E OS TIPOS DE PROCESSO | ||
167 | + $relTipoProcedimentoAssuntoDTO = new RelTipoProcedimentoAssuntoDTO(); | ||
168 | + $relTipoProcedimentoAssuntoDTO->setNumIdTipoProcedimento($id); // FILTRO PELO TIPO DE PROCESSO | ||
169 | + $relTipoProcedimentoAssuntoDTO->retNumIdAssunto(); // ID DO ASSUNTO QUE DEVE SE RETORNADO | ||
170 | + $relTipoProcedimentoAssuntoDTO->retStrCodigoEstruturadoAssunto(); // CÓDIGO DO ASSUNTO QUE DEVE SE RETORNADO | ||
171 | + $relTipoProcedimentoAssuntoDTO->retStrDescricaoAssunto(); // DESCRIÇÃO DO ASSUNTO QUE DEVE SER RETORNADA | ||
172 | + | ||
173 | + //CONSULTA QUE LISTA TODOS OS ASSUNTOS SUGERIDOS PARA O TIPO DE PROCESSO | ||
174 | + $relTipoProcedimentoAssuntoRN = new RelTipoProcedimentoAssuntoRN(); | ||
175 | + $arrRelTipoProcedimentoAssuntoDTO = $relTipoProcedimentoAssuntoRN->listarRN0192($relTipoProcedimentoAssuntoDTO); | ||
176 | + | ||
177 | + $arrayRetorno = array(); | ||
178 | + if($arrRelTipoProcedimentoAssuntoDTO){ | ||
179 | + foreach ($arrRelTipoProcedimentoAssuntoDTO as $obj) { | ||
180 | + $arrayRetorno["assuntos"][] = array( | ||
181 | + "id" => $obj->getNumIdAssunto(), | ||
182 | + "codigo" => $obj->getStrCodigoEstruturadoAssunto(), | ||
183 | + "descricao" => $obj->getStrDescricaoAssunto() | ||
184 | + ); | ||
185 | + } | ||
186 | + } | ||
187 | + | ||
188 | + //CONSULTA QUE LISTA TODOS OS NÍVES DE ACESSOS PERMITIDOS PARA OS TIPO DE PROCESSO | ||
189 | + $nivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | ||
190 | + $nivelAcessoPermitidoDTO->setNumIdTipoProcedimento($id); // FILTRO PELO TIPO DE PROCESSO | ||
191 | + $nivelAcessoPermitidoDTO->retStrStaNivelAcesso(); // ID DO NÍVEL DE ACESSO - ProtocoloRN::$NA_PUBLICO, ProtocoloRN::$NA_RESTRITO ou ProtocoloRN::$NA_SIGILOSO | ||
192 | + | ||
193 | + // A CONSULTA RETORNARÁ OS NÍVEL DE ACESSO PERMITIDOS PARA O TIPO DE PROCESSO ESPECIFICADO NO DTO. AQUELES QUE NÃO FOREM RETORNADOS NESSA | ||
194 | + $nivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | ||
195 | + $arrNivelAcessoPermitido = $nivelAcessoPermitidoRN->listar($nivelAcessoPermitidoDTO); | ||
196 | + if($arrNivelAcessoPermitido){ | ||
197 | + foreach ($arrNivelAcessoPermitido as $nivel) { | ||
198 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_PUBLICO) $publico = true; | ||
199 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_RESTRITO) $restrito = true; | ||
200 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_SIGILOSO) $sigiloso = true; | ||
201 | + } | ||
202 | + } | ||
203 | + $arrayRetorno["nivelAcessoPermitido"] = array( | ||
204 | + "publico" =>$publico ? $publico : false, | ||
205 | + "restrito" =>$restrito ? $restrito : false, | ||
206 | + "sigiloso" =>$sigiloso ? $sigiloso : false, | ||
207 | + ); | ||
208 | + | ||
209 | + | ||
210 | + $tipoProcedimentoDTO = new TipoProcedimentoDTO(); | ||
211 | + $tipoProcedimentoDTO->setNumIdTipoProcedimento($id); | ||
212 | + $tipoProcedimentoDTO->retStrStaNivelAcessoSugestao(); | ||
213 | + $tipoProcedimentoDTO->retStrStaGrauSigiloSugestao(); | ||
214 | + $tipoProcedimentoDTO->retNumIdHipoteseLegalSugestao(); | ||
215 | + | ||
216 | + $tipoProcedimentoRN = new TipoProcedimentoRN(); | ||
217 | + $tipoProcedimentoDTO = $tipoProcedimentoRN->consultarRN0267($tipoProcedimentoDTO); | ||
218 | + | ||
219 | +// $arrayRetorno["nivelAcessoSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaNivelAcessoSugestao() : false; | ||
220 | +// $arrayRetorno["hipoteseLegalSugerida"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getNumIdHipoteseLegalSugestao() : false; | ||
221 | +// $arrayRetorno["grauSigiloSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaGrauSigiloSugestao() : false; | ||
222 | + | ||
223 | + | ||
224 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE A HIPÓTESE LEGAL É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | ||
225 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | ||
226 | + $obrigatoriedadeHipoteseLegal = $objInfraParametro->getValor('SEI_HABILITAR_HIPOTESE_LEGAL'); | ||
227 | + | ||
228 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE UM GRAU DE SIGILO É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | ||
229 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | ||
230 | + $obrigatoriedadeGrauSigilo = $objInfraParametro->getValor('SEI_HABILITAR_GRAU_SIGILO'); | ||
231 | + | ||
232 | + $arrayRetorno["obrigatoriedadeHipoteseLegal"] = $obrigatoriedadeHipoteseLegal; | ||
233 | + $arrayRetorno["obrigatoriedadeGrauSigilo"] = $obrigatoriedadeGrauSigilo; | ||
234 | + | ||
235 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
236 | + } catch (Exception $e) { | ||
237 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
238 | + } | ||
239 | + } | ||
240 | + | ||
241 | + | ||
242 | + | ||
243 | + /** | ||
244 | + * Retorna todos tipos de procedimentos filtrados | ||
245 | + * @param MdWsSeiTipoProcedimentoDTO $objGetMdWsSeiTipoProcedimentoDTO | ||
246 | + * @return array | ||
247 | + */ | ||
248 | + protected function listarAssuntoConectado(MdWsSeiAssuntoDTO $objGetMdWsSeiAssuntoDTO) | ||
249 | + { | ||
250 | + try { | ||
251 | + $id = $objGetMdWsSeiAssuntoDTO->getNumIdAssunto(); | ||
252 | + $filter = $objGetMdWsSeiAssuntoDTO->getStrFilter(); | ||
253 | + $start = $objGetMdWsSeiAssuntoDTO->getNumStart(); | ||
254 | + $limit = $objGetMdWsSeiAssuntoDTO->getNumLimit(); | ||
255 | + | ||
256 | + $assuntoDTO = new AssuntoDTO(); | ||
257 | + if($id) | ||
258 | + $assuntoDTO->setNumIdAssunto($id); | ||
259 | + | ||
260 | + if($filter) $assuntoDTO->adicionarCriterio(array('CodigoEstruturado','Descricao','Observacao'),array(InfraDTO::$OPER_LIKE,InfraDTO::$OPER_LIKE,InfraDTO::$OPER_LIKE),array('%'.utf8_decode($filter).'%','%'.utf8_decode($filter).'%','%'.utf8_decode($filter).'%'), array(InfraDTO::$OPER_LOGICO_OR,InfraDTO::$OPER_LOGICO_OR)); | ||
261 | +// $objInfraAgendamentoTarefaDTO->adicionarCriterio(array('SinAtivo','IdInfraAgendamentoTarefa'),array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL),array('S',$strValorItemSelecionado),InfraDTO::$OPER_LOGICO_OR); | ||
262 | +// $assuntoDTO->setStrCodigoEstruturado('%'.$filter.'%',InfraDTO::$OPER_LIKE); | ||
263 | + | ||
264 | + | ||
265 | + $assuntoRN = new AssuntoRN(); | ||
266 | + | ||
267 | + $assuntoCountDTO = $assuntoDTO; // APENAS PARA TOTALIZAR OS REGISTROS DE RETORNO | ||
268 | + $assuntoCountDTO->retNumIdAssunto(); | ||
269 | + $assuntoCountDTO = $assuntoRN->listarRN0247($assuntoCountDTO); | ||
270 | + | ||
271 | + | ||
272 | + if($limit) | ||
273 | + $assuntoDTO->setNumMaxRegistrosRetorno($limit); | ||
274 | + if($start) | ||
275 | + $assuntoDTO->setNumPaginaAtual($start); | ||
276 | + | ||
277 | + $assuntoDTO->retNumIdAssunto(); | ||
278 | + $assuntoDTO->retStrCodigoEstruturado(); | ||
279 | + $assuntoDTO->retStrDescricao(); | ||
280 | + $assuntoDTO->retStrSinEstrutural(); | ||
281 | + | ||
282 | + // REALIZA A CHAMADA DA DE ASSUNTOS | ||
283 | + | ||
284 | + $arrAssuntoDTO = $assuntoRN->listarRN0247($assuntoDTO); | ||
285 | + | ||
286 | + $arrayRetorno = array(); | ||
287 | + if($arrAssuntoDTO){ | ||
288 | + foreach ($arrAssuntoDTO as $obj) { | ||
289 | + | ||
290 | + $arrayRetorno[] = array( | ||
291 | + "id" => $obj->getNumIdAssunto(), | ||
292 | + "codigo" => $obj->getStrCodigoEstruturado(), | ||
293 | + "descricao" => $obj->getStrDescricao(), | ||
294 | + "item_apenas_estrutural" => ($obj->getStrSinEstrutural() == "S") ? true : false | ||
295 | + ); | ||
296 | + } | ||
297 | + } | ||
298 | + | ||
299 | +// $arrayRetorno = array(); | ||
300 | +// if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1)); | ||
301 | +// if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit)); | ||
302 | + | ||
303 | + $total = 0; | ||
304 | + $total = count($assuntoCountDTO); | ||
305 | + | ||
306 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
307 | + } catch (Exception $e) { | ||
308 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
309 | + } | ||
310 | + } | ||
311 | + | ||
312 | + /** | ||
313 | + * Realiza a consulta dos metadados de um processo especifico. | ||
314 | + * @param MdWsSeiProcedimentoDTO $dto | ||
315 | + * @return array | ||
316 | + */ | ||
317 | + protected function consultarProcessoConectado(MdWsSeiProcedimentoDTO $dto) | ||
318 | + { | ||
319 | + try { | ||
320 | + $arrayRetorno = array(); | ||
321 | + $id = $dto->getNumIdProcedimento(); | ||
322 | + | ||
323 | + //Id do processo enviado por parâmetro | ||
324 | + $processo = $id; | ||
325 | + | ||
326 | + // Recupera os dados do processo inseridos na tabela de protocolo | ||
327 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
328 | + $objProtocoloDTO->setDblIdProtocolo($processo); | ||
329 | + $objProtocoloDTO->retStrDescricao(); // Recupera a especificação do processo | ||
330 | + $objProtocoloDTO->retStrStaNivelAcessoLocal(); // Recupera o nível de acesso do processo | ||
331 | + $objProtocoloDTO->retNumIdHipoteseLegal(); // Recupera o id da hipótese legal | ||
332 | + $objProtocoloDTO->retStrStaGrauSigilo(); // Recupera o grau de sigilo | ||
333 | + | ||
334 | + $protocoloRN = new ProtocoloRN(); | ||
335 | + $objProtocoloDTO = $protocoloRN->consultarRN0186($objProtocoloDTO); | ||
336 | + | ||
337 | + | ||
338 | + if (!$objProtocoloDTO) { | ||
339 | + throw new Exception('Não foi encontrado processo com id ' . $processo); | ||
340 | + } | ||
341 | + | ||
342 | + // Recupera o tipo de processo da tabela de procedimento | ||
343 | + $objProcedimentoDTO = new ProcedimentoDTO(); | ||
344 | + $objProcedimentoDTO->setDblIdProcedimento($processo); | ||
345 | + $objProcedimentoDTO->retNumIdTipoProcedimento(); | ||
346 | + | ||
347 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
348 | + $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); | ||
349 | + | ||
350 | + // Recupera os assuntos do processo | ||
351 | + $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
352 | + $objRelProtocoloAssuntoDTO->setDblIdProtocolo($processo); | ||
353 | + $objRelProtocoloAssuntoDTO->retStrCodigoEstruturadoAssunto(); | ||
354 | + $objRelProtocoloAssuntoDTO->retStrDescricaoAssunto(); | ||
355 | + $objRelProtocoloAssuntoDTO->retNumIdAssunto(); | ||
356 | + | ||
357 | + $objRelProtocoloAssuntoRN = new RelProtocoloAssuntoRN(); | ||
358 | + $objRelProtocoloAssuntoDTO = $objRelProtocoloAssuntoRN->listarRN0188($objRelProtocoloAssuntoDTO); | ||
359 | + | ||
360 | + $assuntos = array(); | ||
361 | + if($objRelProtocoloAssuntoDTO){ | ||
362 | + foreach ($objRelProtocoloAssuntoDTO as $obj) { | ||
363 | + $assuntos[] = array( | ||
364 | + "id" => $obj->getNumIdAssunto(), | ||
365 | + "codigo" => $obj->getStrCodigoEstruturadoAssunto(), | ||
366 | + "descricao" => $obj->getStrDescricaoAssunto() | ||
367 | + ); | ||
368 | + } | ||
369 | + } | ||
370 | + | ||
371 | + //Recupera os interessados do processo | ||
372 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
373 | + $objParticipanteDTO->setDblIdProtocolo($processo); | ||
374 | + $objParticipanteDTO->setStrStaParticipacao('I'); | ||
375 | + $objParticipanteDTO->retNumIdContato(); | ||
376 | + $objParticipanteDTO->retStrNomeContato(); | ||
377 | + | ||
378 | + $objParticipanteRN = new ParticipanteRN(); | ||
379 | + $objParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); | ||
380 | + | ||
381 | + $interessados = array(); | ||
382 | + if($objParticipanteDTO){ | ||
383 | + foreach ($objParticipanteDTO as $obj) { | ||
384 | + $interessados[] = array( | ||
385 | + "id" => $obj->getNumIdContato(), | ||
386 | + "nome" => $obj->getStrNomeContato() | ||
387 | + ); | ||
388 | + } | ||
389 | + } | ||
390 | + | ||
391 | + //Recupera as observações do process | ||
392 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
393 | + $objObservacaoDTO->setDblIdProtocolo($processo); | ||
394 | + $objObservacaoDTO->retStrDescricao(); | ||
395 | + $objObservacaoDTO->retNumIdUnidade(); | ||
396 | + | ||
397 | + $objObservacaoRN = new ObservacaoRN(); | ||
398 | + $objObservacaoDTO = $objObservacaoRN->listarRN0219($objObservacaoDTO); | ||
399 | + | ||
400 | + $observacoes = array(); | ||
401 | + if($objObservacaoDTO){ | ||
402 | + foreach ($objObservacaoDTO as $obj) { | ||
403 | + $observacoes[] = array( | ||
404 | + "unidade" =>$obj->getNumIdUnidade(), | ||
405 | + "observacao" =>$obj->getStrDescricao() | ||
406 | + ); | ||
407 | + } | ||
408 | + } | ||
409 | + | ||
410 | + $arrayRetorno = array( | ||
411 | + "especificacao" => $objProtocoloDTO->getStrDescricao(), | ||
412 | + "tipoProcesso" => $objProcedimentoDTO->getNumIdTipoProcedimento(), | ||
413 | + "assuntos" => $assuntos, | ||
414 | + "interessados" => $interessados, | ||
415 | + "nivelAcesso" => $objProtocoloDTO->getStrStaNivelAcessoLocal(), | ||
416 | + "hipoteseLegal" => $objProtocoloDTO->getNumIdHipoteseLegal(), | ||
417 | + "grauSigilo" => $objProtocoloDTO->getStrStaGrauSigilo(), | ||
418 | + "observacoes" => $observacoes | ||
419 | + ); | ||
420 | + | ||
421 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); | ||
422 | + } catch (Exception $e) { | ||
423 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
424 | + } | ||
425 | + } | ||
426 | + | ||
427 | + | ||
428 | + | ||
429 | + /** | ||
430 | + * Gerar Procedimento | ||
431 | + * @param ProtocoloDTO $protocoloDTO | ||
432 | + * @return array | ||
433 | + */ | ||
434 | + protected function gerarProcedimentoConectado(MdWsSeiProcedimentoDTO $procedimentoDTO) | ||
435 | + { | ||
436 | + try { | ||
437 | + | ||
438 | +// Assuntos | ||
439 | + $arrayAssuntos = array(); | ||
440 | + if($procedimentoDTO->getArrObjAssunto()){ | ||
441 | + $i = 0; | ||
442 | + foreach ($procedimentoDTO->getArrObjAssunto() as $assunto) { | ||
443 | + $i++; | ||
444 | + $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
445 | + $objRelProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
446 | + $objRelProtocoloAssuntoDTO->setNumSequencia($i); | ||
447 | + $arrayAssuntos[] = $objRelProtocoloAssuntoDTO; | ||
448 | + } | ||
449 | + } | ||
450 | +// Interessados | ||
451 | + $arrayInteressados = array(); | ||
452 | + if($procedimentoDTO->getArrObjInteressado()){ | ||
453 | + $i = 0; | ||
454 | + foreach ($procedimentoDTO->getArrObjInteressado() as $interessado) { | ||
455 | + $i++; | ||
456 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
457 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
458 | + $objParticipanteDTO->setNumSequencia($i); | ||
459 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
460 | + | ||
461 | + $arrayInteressados[] = $objParticipanteDTO; | ||
462 | + } | ||
463 | + } | ||
464 | + | ||
465 | + | ||
466 | + | ||
467 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
468 | + $objObservacaoDTO->setStrDescricao($procedimentoDTO->getStrObservacao()); | ||
469 | + | ||
470 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
471 | + $objProtocoloDTO->setStrDescricao($procedimentoDTO->getStrEspecificacao()); | ||
472 | + // $objProtocoloDTO->setStrDescricaoObservacao('praxedes'); | ||
473 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($procedimentoDTO->getNumNivelAcesso()); | ||
474 | + $objProtocoloDTO->setNumIdHipoteseLegal($procedimentoDTO->getNumIdHipoteseLegal()); | ||
475 | +// $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO(array($objRelProtocoloAssuntoDTO)); | ||
476 | + $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrayAssuntos); | ||
477 | + $objProtocoloDTO->setArrObjParticipanteDTO($arrayInteressados); | ||
478 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | ||
479 | + $objProtocoloDTO->setStrStaGrauSigilo($procedimentoDTO->getStrStaGrauSigilo()); | ||
480 | + | ||
481 | + $objProcedimentoDTO = new ProcedimentoDTO(); | ||
482 | + $objProcedimentoDTO->setNumIdTipoProcedimento($procedimentoDTO->getNumIdTipoProcedimento()); | ||
483 | + $objProcedimentoDTO->setDblIdProcedimento(null); | ||
484 | + $objProcedimentoDTO->setObjProtocoloDTO($objProtocoloDTO); | ||
485 | + $objProcedimentoDTO->setStrSinGerarPendencia('S'); | ||
486 | + | ||
487 | + | ||
488 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
489 | + $retorno = $objProcedimentoRN->gerarRN0156($objProcedimentoDTO); | ||
490 | +// var_dump($retorno); | ||
491 | + | ||
492 | + | ||
493 | + //ObjParticipanteDTO | ||
494 | + //ObjRelProtocoloAssuntoDTO | ||
495 | + | ||
496 | + | ||
497 | + /* $objProcedimentoAPI = new ProcedimentoAPI(); | ||
498 | + $objProcedimentoAPI->setIdTipoProcedimento($procedimentoDTO->getNumIdTipoProcedimento()); | ||
499 | + $objProcedimentoAPI->setEspecificacao($procedimentoDTO->getStrEspecificacao()); | ||
500 | + $objProcedimentoAPI->setAssuntos($procedimentoDTO->getArrObjAssunto()); | ||
501 | + $objProcedimentoAPI->setInteressados($procedimentoDTO->getArrObjInteressado()); | ||
502 | + $objProcedimentoAPI->setObservacao($procedimentoDTO->getStrObservacao()); | ||
503 | + | ||
504 | + // 0 publico | ||
505 | + // 1 restrito | ||
506 | + // 2 sigiloso | ||
507 | + $objProcedimentoAPI->setNivelAcesso($procedimentoDTO->getNumNivelAcesso()); | ||
508 | + $objProcedimentoAPI->setIdHipoteseLegal($procedimentoDTO->getNumIdHipoteseLegal()); | ||
509 | + | ||
510 | + | ||
511 | + $objEntradaGerarProcedimentoAPI = new EntradaGerarProcedimentoAPI(); | ||
512 | + $objEntradaGerarProcedimentoAPI->setProcedimento($objProcedimentoAPI); | ||
513 | + | ||
514 | + // var_dump($objEntradaGerarProcedimentoAPI); die(); | ||
515 | + $objSeiRN = new SeiRN(); | ||
516 | + $aux = $objSeiRN->gerarProcedimento($objEntradaGerarProcedimentoAPI);*/ | ||
517 | + | ||
518 | + return MdWsSeiRest::formataRetornoSucessoREST(null, | ||
519 | + array( | ||
520 | + "IdProcedimento" => $retorno->getDblIdProcedimento(), | ||
521 | + "ProtocoloFormatado" => $retorno->getStrProtocoloProcedimentoFormatado()) | ||
522 | + ); | ||
523 | + | ||
524 | + } catch (InfraException $e) { | ||
525 | + //die($e->getStrDescricao()); | ||
526 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
527 | + } | ||
528 | + } | ||
529 | + | ||
530 | + | ||
531 | + | ||
532 | + /** | ||
533 | + * Alterar Procedimento | ||
534 | + * @param ProtocoloDTO $protocoloDTO | ||
535 | + * @return array | ||
536 | + */ | ||
537 | + protected function alterarProcedimentoConectado(MdWsSeiProcedimentoDTO $procedimentoDTO) | ||
538 | + { | ||
539 | + try { | ||
540 | + | ||
541 | + $processo = $procedimentoDTO->getNumIdProcedimento(); | ||
542 | + $tipoProcesso = $procedimentoDTO->getNumIdTipoProcedimento(); | ||
543 | + $especificacao = $procedimentoDTO->getStrEspecificacao(); | ||
544 | + $arrAssuntos = $procedimentoDTO->getArrObjAssunto(); | ||
545 | + $arrInteressados = $procedimentoDTO->getArrObjInteressado(); | ||
546 | + $observacoes = $procedimentoDTO->getStrObservacao(); | ||
547 | + $nivelAcesso = $procedimentoDTO->getNumNivelAcesso(); | ||
548 | + $hipoteseLegal = $procedimentoDTO->getNumIdHipoteseLegal(); | ||
549 | + $grauSigilo = $procedimentoDTO->getStrStaGrauSigilo(); | ||
550 | + | ||
551 | + $objTipoProcedimentoDTO = new TipoProcedimentoDTO(); | ||
552 | + $objTipoProcedimentoDTO->setBolExclusaoLogica(false); | ||
553 | + $objTipoProcedimentoDTO->retStrNome(); | ||
554 | + $objTipoProcedimentoDTO->retStrSinIndividual(); | ||
555 | + $objTipoProcedimentoDTO->setNumIdTipoProcedimento($tipoProcesso); | ||
556 | + | ||
557 | + $objTipoProcedimentoRN = new TipoProcedimentoRN(); | ||
558 | + $objTipoProcedimentoDTO = $objTipoProcedimentoRN->consultarRN0267($objTipoProcedimentoDTO); | ||
559 | + | ||
560 | + | ||
561 | + if ($objTipoProcedimentoDTO && $objTipoProcedimentoDTO->getStrSinIndividual() == 'S') { | ||
562 | + if (count($arrInteressados) > 1) { | ||
563 | + throw new InfraException('Mais de um Interessado informado.'); | ||
564 | + } | ||
565 | + } | ||
566 | + // PREENCHE OS ASSUNTOS | ||
567 | + $arrayAssuntos = array(); | ||
568 | + | ||
569 | + if($arrAssuntos){ | ||
570 | + foreach ($arrAssuntos as $k => $assunto) { | ||
571 | + $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); | ||
572 | + $objRelProtocoloAssuntoDTO->setNumIdAssunto($assunto['id']); | ||
573 | + $objRelProtocoloAssuntoDTO->setNumSequencia($k); | ||
574 | + $arrayAssuntos[] = $objRelProtocoloAssuntoDTO; | ||
575 | + } | ||
576 | + } | ||
577 | + | ||
578 | + // PREENCHE OS INTERESSADOS | ||
579 | + $arrayParticipantes = array(); | ||
580 | + | ||
581 | + if($arrInteressados){ | ||
582 | + foreach ($arrInteressados as $k => $interessado) { | ||
583 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
584 | + $objParticipanteDTO->setNumIdContato($interessado['id']); | ||
585 | + $objParticipanteDTO->setStrStaParticipacao('I'); | ||
586 | + $objParticipanteDTO->setNumSequencia($k); | ||
587 | + $arrayParticipantes[] = $objParticipanteDTO; | ||
588 | + } | ||
589 | + } | ||
590 | + // EDITA AS OBSERVAÇÕES | ||
591 | + $objObservacaoDTO = new ObservacaoDTO(); | ||
592 | + $objObservacaoDTO->setStrDescricao($observacoes); | ||
593 | + | ||
594 | + // EDITA OS DADOS DO PROCESSO | ||
595 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
596 | + $objProtocoloDTO->setDblIdProtocolo($processo); | ||
597 | + $objProtocoloDTO->setStrDescricao($especificacao); | ||
598 | + $objProtocoloDTO->setStrStaNivelAcessoLocal($nivelAcesso); | ||
599 | + $objProtocoloDTO->setNumIdHipoteseLegal($hipoteseLegal); | ||
600 | + $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrayAssuntos); | ||
601 | + $objProtocoloDTO->setArrObjParticipanteDTO($arrayParticipantes); | ||
602 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | ||
603 | + $objProtocoloDTO->setStrStaGrauSigilo($grauSigilo); | ||
604 | + | ||
605 | + $objProcedimentoDTO = new ProcedimentoDTO(); | ||
606 | + $objProcedimentoDTO->setDblIdProcedimento($processo); | ||
607 | + $objProcedimentoDTO->setNumIdTipoProcedimento($tipoProcesso); | ||
608 | + $objProcedimentoDTO->setObjProtocoloDTO($objProtocoloDTO); | ||
609 | + $objProcedimentoDTO->setStrSinGerarPendencia('S'); | ||
610 | + | ||
611 | + // REALIZA A ALTERAÇÃO DOS DADOS DO PROCESSO | ||
612 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
613 | + $retorno = $objProcedimentoRN->alterarRN0202($objProcedimentoDTO); | ||
614 | + | ||
615 | + return MdWsSeiRest::formataRetornoSucessoREST(null); | ||
616 | + | ||
617 | + | ||
618 | + //return MdWsSeiRest::formataRetornoSucessoREST(null); | ||
619 | + | ||
620 | + } catch (InfraException $e) { | ||
621 | +// die($e->getStrDescricao()); | ||
622 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
623 | + } | ||
624 | + } | ||
625 | + | ||
60 | /** | 626 | /** |
61 | * Método que lista o sobrestamento de um processo | 627 | * Método que lista o sobrestamento de um processo |
62 | * @param AtividadeDTO $atividadeDTOParam | 628 | * @param AtividadeDTO $atividadeDTOParam |
@@ -379,6 +945,10 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -379,6 +945,10 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
379 | } else { | 945 | } else { |
380 | $pesquisaPendenciaDTO->setNumPaginaAtual(0); | 946 | $pesquisaPendenciaDTO->setNumPaginaAtual(0); |
381 | } | 947 | } |
948 | + | ||
949 | + if($mdWsSeiProtocoloDTOParam->isSetDblIdProtocolo()) { | ||
950 | + $pesquisaPendenciaDTO->setDblIdProtocolo($mdWsSeiProtocoloDTOParam->getDblIdProtocolo()); | ||
951 | + } | ||
382 | 952 | ||
383 | if ($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { | 953 | if ($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { |
384 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); | 954 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); |
@@ -403,11 +973,11 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -403,11 +973,11 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
403 | $pesquisaPendenciaDTO->setStrSinInicial('N'); | 973 | $pesquisaPendenciaDTO->setStrSinInicial('N'); |
404 | } else if ($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G) { | 974 | } else if ($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G) { |
405 | $pesquisaPendenciaDTO->setStrSinInicial('S'); | 975 | $pesquisaPendenciaDTO->setStrSinInicial('S'); |
406 | - } else { | 976 | + } /* else { |
407 | throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); | 977 | throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); |
408 | - } | 978 | + }*/ |
409 | $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); | 979 | $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
410 | - $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); | 980 | + $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade, $mdWsSeiProtocoloDTOParam->getStrSinTipoBusca()); |
411 | 981 | ||
412 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); | 982 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); |
413 | } catch (Exception $e) { | 983 | } catch (Exception $e) { |
@@ -422,8 +992,9 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -422,8 +992,9 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
422 | * @param null $usuarioAtribuicaoAtividade | 992 | * @param null $usuarioAtribuicaoAtividade |
423 | * @return array | 993 | * @return array |
424 | */ | 994 | */ |
425 | - private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null) | 995 | + private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null , $typeSource = null) |
426 | { | 996 | { |
997 | + | ||
427 | $result = array(); | 998 | $result = array(); |
428 | $protocoloRN = new ProtocoloRN(); | 999 | $protocoloRN = new ProtocoloRN(); |
429 | foreach ($ret as $dto) { | 1000 | foreach ($ret as $dto) { |
@@ -487,18 +1058,6 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -487,18 +1058,6 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
487 | $atividadeDTOConsulta->setNumMaxRegistrosRetorno(1); | 1058 | $atividadeDTOConsulta->setNumMaxRegistrosRetorno(1); |
488 | $atividadeDTOConsulta->setOrdNumIdAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); | 1059 | $atividadeDTOConsulta->setOrdNumIdAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); |
489 | 1060 | ||
490 | - $arrAtividades = $atividadeRN->listarRN0036($atividadeDTOConsulta); | ||
491 | - | ||
492 | - if ($arrAtividades) { | ||
493 | - /** @var AtividadeDTO $atividadeDTO */ | ||
494 | - $atividadeDTO = $arrAtividades[0]; | ||
495 | - $documentoNovo = $atividadeDTO->getNumIdTarefa() == 1 ? 'S' : 'N'; | ||
496 | - $usuarioAtribuido = $atividadeDTO->getStrNomeUsuarioAtribuicao(); | ||
497 | - $tipoVisualizacao = $atividadeDTO->getNumTipoVisualizacao() == 0 ? 'S' : 'N'; | ||
498 | - if ($atividadeDTO->getNumIdUsuarioVisualizacao() == $usuarioAtribuicaoAtividade) { | ||
499 | - $usuarioVisualizacao = 'S'; | ||
500 | - } | ||
501 | - } | ||
502 | $arrAtividadePendenciaDTO = array(); | 1061 | $arrAtividadePendenciaDTO = array(); |
503 | if ($dto instanceof ProcedimentoDTO && $dto->isSetArrObjAtividadeDTO()) { | 1062 | if ($dto instanceof ProcedimentoDTO && $dto->isSetArrObjAtividadeDTO()) { |
504 | $procedimentoDTO = $dto; | 1063 | $procedimentoDTO = $dto; |
@@ -520,6 +1079,37 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -520,6 +1079,37 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
520 | $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); | 1079 | $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); |
521 | } | 1080 | } |
522 | } | 1081 | } |
1082 | + | ||
1083 | + /*$arrAtividades = $procedimentoDTO ? $procedimentoDTO->getArrObjAtividadeDTO() : null; | ||
1084 | + if ($arrAtividades) { | ||
1085 | + $atividadeDTO = $arrAtividades[0]; | ||
1086 | + | ||
1087 | + $numTipoVisualizacao=$atividadeDTO->getNumTipoVisualizacao(); | ||
1088 | + | ||
1089 | + if ($numTipoVisualizacao != AtividadeRN::$TV_NAO_VISUALIZADO && | ||
1090 | + $protocoloDTO->getStrStaNivelAcessoGlobal() != ProtocoloRN::$NA_SIGILOSO){ | ||
1091 | + $usuarioVisualizacao = 'S'; | ||
1092 | + } | ||
1093 | + }*/ | ||
1094 | + | ||
1095 | + $objAtividadesAbertasDTO = new AtividadeDTO(); | ||
1096 | + $objAtividadesAbertasDTO->retNumIdAtividade(); | ||
1097 | + $objAtividadesAbertasDTO->retNumTipoVisualizacao(); | ||
1098 | + $objAtividadesAbertasDTO->setDthConclusao(null); | ||
1099 | + $objAtividadesAbertasDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | ||
1100 | + $objAtividadesAbertasDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
1101 | + $arrObjAtividadesAbertasDTO = $atividadeRN->listarRN0036($objAtividadesAbertasDTO); | ||
1102 | + | ||
1103 | + $numTipoVisualizacao=$arrObjAtividadesAbertasDTO[0]->getNumTipoVisualizacao(); | ||
1104 | + | ||
1105 | + if ($numTipoVisualizacao && ($numTipoVisualizacao == AtividadeRN::$TV_NAO_VISUALIZADO)){ | ||
1106 | + $usuarioVisualizacao = 'N'; | ||
1107 | + } | ||
1108 | + else { | ||
1109 | + $usuarioVisualizacao = 'S'; | ||
1110 | + } | ||
1111 | + | ||
1112 | + | ||
523 | if ($arrAtividadePendenciaDTO) { | 1113 | if ($arrAtividadePendenciaDTO) { |
524 | $atividadePendenciaDTO = $arrAtividadePendenciaDTO[0]; | 1114 | $atividadePendenciaDTO = $arrAtividadePendenciaDTO[0]; |
525 | if ($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO) { | 1115 | if ($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO) { |
@@ -662,6 +1252,7 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -662,6 +1252,7 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
662 | } | 1252 | } |
663 | 1253 | ||
664 | $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | 1254 | $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); |
1255 | + $processoGeradoRecebido = $dto->getNumIdUnidadeGeradoraProtocolo() == SessaoSEI::getInstance()->getNumIdUnidadeAtual() ? 'G' : 'R'; | ||
665 | 1256 | ||
666 | $result[] = array( | 1257 | $result[] = array( |
667 | 'id' => $protocoloDTO->getDblIdProtocolo(), | 1258 | 'id' => $protocoloDTO->getDblIdProtocolo(), |
@@ -705,6 +1296,8 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -705,6 +1296,8 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
705 | 'processoAnexado' => $processoAnexado ? 'S' : 'N', | 1296 | 'processoAnexado' => $processoAnexado ? 'S' : 'N', |
706 | 'podeReabrirProcesso' => $podeReabrirProcesso ? 'S' : 'N', | 1297 | 'podeReabrirProcesso' => $podeReabrirProcesso ? 'S' : 'N', |
707 | 'podeRegistrarAnotacao' => $podeRegistrarAnotacao ? 'S' : 'N', | 1298 | 'podeRegistrarAnotacao' => $podeRegistrarAnotacao ? 'S' : 'N', |
1299 | + 'tipo' => $typeSource, | ||
1300 | + 'processoGeradoRecebido' => $processoGeradoRecebido | ||
708 | ) | 1301 | ) |
709 | ) | 1302 | ) |
710 | ); | 1303 | ); |
@@ -1294,6 +1887,7 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -1294,6 +1887,7 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
1294 | if($arrIdProcessos){ | 1887 | if($arrIdProcessos){ |
1295 | $protocoloRN = new ProtocoloRN(); | 1888 | $protocoloRN = new ProtocoloRN(); |
1296 | $protocoloDTO = new MdWsSeiProtocoloDTO(); | 1889 | $protocoloDTO = new MdWsSeiProtocoloDTO(); |
1890 | + | ||
1297 | $protocoloDTO->setDblIdProtocolo($arrIdProcessos, InfraDTO::$OPER_IN); | 1891 | $protocoloDTO->setDblIdProtocolo($arrIdProcessos, InfraDTO::$OPER_IN); |
1298 | $protocoloDTO->retDblIdProtocolo(); | 1892 | $protocoloDTO->retDblIdProtocolo(); |
1299 | $protocoloDTO->retNumIdUnidadeGeradora(); | 1893 | $protocoloDTO->retNumIdUnidadeGeradora(); |
rn/MdWsSeiUsuarioRN.php
1 | -<? | 1 | +<?php |
2 | require_once dirname(__FILE__).'/../../../SEI.php'; | 2 | require_once dirname(__FILE__).'/../../../SEI.php'; |
3 | 3 | ||
4 | + | ||
4 | class MdWsSeiUsuarioRN extends InfraRN { | 5 | class MdWsSeiUsuarioRN extends InfraRN { |
5 | 6 | ||
6 | CONST TOKEN_SECRET = '<!RWR1YXJkbyBSb23Do28!>'; | 7 | CONST TOKEN_SECRET = '<!RWR1YXJkbyBSb23Do28!>'; |
@@ -181,10 +182,29 @@ class MdWsSeiUsuarioRN extends InfraRN { | @@ -181,10 +182,29 @@ class MdWsSeiUsuarioRN extends InfraRN { | ||
181 | } | 182 | } |
182 | $this->setaVariaveisAutenticacao(get_object_vars($ret)); | 183 | $this->setaVariaveisAutenticacao(get_object_vars($ret)); |
183 | 184 | ||
185 | + $objInfraDadoUsuario = new InfraDadoUsuario(SessaoSEI::getInstance()); | ||
186 | + | ||
187 | + //Obtem os dados do carto da assinatura | ||
188 | + $numIdCargoAssinatura = null; | ||
189 | + $strNomeCargoAssinatura = $objInfraDadoUsuario->getValor('ASSINATURA_CARGO_FUNCAO_'.SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
190 | + | ||
191 | + $objAssinanteDTO = new AssinanteDTO(); | ||
192 | + $objAssinanteDTO->setStrCargoFuncao($strNomeCargoAssinatura); | ||
193 | + $objAssinanteDTO->retNumIdAssinante(); | ||
194 | + | ||
195 | + $objAssinanteRN = new AssinanteRN(); | ||
196 | + | ||
197 | + if($objAssinanteRN->contarRN1340($objAssinanteDTO) == 1){ | ||
198 | + $objAssinanteDTO = $objAssinanteRN->consultarRN1338($objAssinanteDTO); | ||
199 | + $numIdCargoAssinatura = $objAssinanteDTO->getNumIdAssinante(); | ||
200 | + } | ||
201 | + | ||
184 | //dados usuário | 202 | //dados usuário |
185 | $ret->IdUnidadeAtual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); | 203 | $ret->IdUnidadeAtual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); |
186 | $ret->sigla = $usuarioDTO->getStrSigla(); | 204 | $ret->sigla = $usuarioDTO->getStrSigla(); |
187 | $ret->nome = SessaoSEI::getInstance()->getStrNomeUsuario(); | 205 | $ret->nome = SessaoSEI::getInstance()->getStrNomeUsuario(); |
206 | + $ret->idUltimoCargoAssinatura = $numIdCargoAssinatura; | ||
207 | + $ret->ultimoCargoAssinatura = $strNomeCargoAssinatura; | ||
188 | 208 | ||
189 | $token = $this->tokenEncode($usuarioDTO->getStrSigla(), $usuarioDTO->getStrSenha(), $orgao, $contexto); | 209 | $token = $this->tokenEncode($usuarioDTO->getStrSigla(), $usuarioDTO->getStrSenha(), $orgao, $contexto); |
190 | 210 | ||
@@ -197,17 +217,20 @@ class MdWsSeiUsuarioRN extends InfraRN { | @@ -197,17 +217,20 @@ class MdWsSeiUsuarioRN extends InfraRN { | ||
197 | ); | 217 | ); |
198 | } | 218 | } |
199 | 219 | ||
200 | - $arrPerfis = array(); | ||
201 | $retPerfis = $this->listarPerfisUsuario($ret->IdSistema, $ret->IdUsuario); | 220 | $retPerfis = $this->listarPerfisUsuario($ret->IdSistema, $ret->IdUsuario); |
202 | - if($retPerfis && $retPerfis['data']){ | 221 | + |
222 | + /* ANTIGA | ||
223 | + | ||
224 | + if($retPerfis && $retPerfis['data']){ | ||
203 | $arrPerfis = $retPerfis['data']; | 225 | $arrPerfis = $retPerfis['data']; |
204 | - } | 226 | + }*/ |
205 | 227 | ||
206 | return MdWsSeiRest::formataRetornoSucessoREST( | 228 | return MdWsSeiRest::formataRetornoSucessoREST( |
207 | null, | 229 | null, |
208 | array( | 230 | array( |
209 | 'loginData'=> $ret, | 231 | 'loginData'=> $ret, |
210 | - 'perfis' => $arrPerfis, | 232 | + // ANTIGA 'perfis' => $arrPerfis, |
233 | + 'perfis' => $retPerfis, | ||
211 | 'unidades' => $arrUnidades, | 234 | 'unidades' => $arrUnidades, |
212 | 'token' => $token | 235 | 'token' => $token |
213 | ) | 236 | ) |
@@ -241,7 +264,7 @@ class MdWsSeiUsuarioRN extends InfraRN { | @@ -241,7 +264,7 @@ class MdWsSeiUsuarioRN extends InfraRN { | ||
241 | ); | 264 | ); |
242 | } | 265 | } |
243 | 266 | ||
244 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $arrPerfis); | 267 | + return $arrPerfis; |
245 | 268 | ||
246 | }catch (Exception $e){ | 269 | }catch (Exception $e){ |
247 | return MdWsSeiRest::formataRetornoErroREST($e); | 270 | return MdWsSeiRest::formataRetornoErroREST($e); |
No preview for this file type
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +//$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/teste.pdf"); | ||
4 | +$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/c.pdf"); | ||
5 | + | ||
6 | +$ch = curl_init("http://192.168.99.100/sei/modulos/mod-wssei/controlador_ws.php/api/v1/documento/externo/criar"); | ||
7 | + | ||
8 | +//distribuindo a informação a ser enviada | ||
9 | +$post = array( | ||
10 | + 'processo' => '232', | ||
11 | + 'dataGeracaoDocumeto' => '29/01/2017', | ||
12 | + 'tipoDocumento' => '46', | ||
13 | + 'numero' => '12321313', | ||
14 | + 'descricao' => 'Descricao de teste', | ||
15 | + 'nomeArquivo' => 'teste.pdf', | ||
16 | + 'nivelAcesso' => '1', | ||
17 | + 'hipoteseLegal' => '1', | ||
18 | + 'grauSigilo' => '', | ||
19 | + 'assuntos' => '[{"id": 79}]', | ||
20 | + 'interessados' => '[{"id": 100000012 },{"id":100000044}]', | ||
21 | + 'destinatarios' => '[{"id":100000044}]', | ||
22 | + 'remetentes' => '[{"id":100000044}]', | ||
23 | + 'conteudoDocumento' => $file, | ||
24 | + 'observacao' => 'documento Externo', | ||
25 | + 'tipoConferencia' => '2', | ||
26 | +); | ||
27 | + | ||
28 | +$headers = array(); | ||
29 | + | ||
30 | +curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | ||
31 | +curl_setopt($ch, CURLOPT_HTTPHEADER, array('token: YTRhZDBmOTEyYjUxY2MzYTgzNjc3NDMwNWNjM2JiMzFmY2U4ZTkxYmFUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9')); | ||
32 | + | ||
33 | +$data = curl_exec($ch); | ||
34 | + | ||
35 | +//Fecha a conexão para economizar recursos do servidor | ||
36 | +curl_close($ch); | ||
37 | + | ||
38 | +var_dump($data); | ||
39 | +die(); | ||
40 | + | ||
41 | +?> | ||
0 | \ No newline at end of file | 42 | \ No newline at end of file |