Commit 472afacec67698777f0159bb15f131c3874b8420
1 parent
d0acf77a
Exists in
master
and in
1 other branch
[FEAT] Subindo novos serviços pacote 3
Showing
7 changed files
with
335 additions
and
13 deletions
Show diff stats
MdWsSeiRest.php
@@ -33,6 +33,23 @@ class MdWsSeiRest extends SeiIntegracao | @@ -33,6 +33,23 @@ class MdWsSeiRest extends SeiIntegracao | ||
33 | return $response; | 33 | return $response; |
34 | } | 34 | } |
35 | 35 | ||
36 | + public static function dataToIso88591($item){ | ||
37 | + if(is_array($item)){ | ||
38 | + $itemArr = $item; | ||
39 | + }else if(is_object($item)) { | ||
40 | + $itemArr = get_object_vars($item); | ||
41 | + }else if(is_bool($item)){ | ||
42 | + return $item; | ||
43 | + }else{ | ||
44 | + return mb_convert_encoding($item, 'ISO-8859-1'); | ||
45 | + } | ||
46 | + $response = array(); | ||
47 | + foreach($itemArr as $key => $val){ | ||
48 | + $response[$key] = MdWsSeiRest::dataToIso88591($val); | ||
49 | + } | ||
50 | + return $response; | ||
51 | + } | ||
52 | + | ||
36 | /** | 53 | /** |
37 | * Formata o retorno da mensagem para o padrão do controlador de serviços REST | 54 | * Formata o retorno da mensagem para o padrão do controlador de serviços REST |
38 | * @param null $mensagem | 55 | * @param null $mensagem |
controlador_ws.php
@@ -154,6 +154,22 @@ $app->group('/api/v1',function(){ | @@ -154,6 +154,22 @@ $app->group('/api/v1',function(){ | ||
154 | $rn = new MdWsSeiUsuarioRN(); | 154 | $rn = new MdWsSeiUsuarioRN(); |
155 | return $response->withJSON($rn->listarUsuarios($dto)); | 155 | return $response->withJSON($rn->listarUsuarios($dto)); |
156 | }); | 156 | }); |
157 | + $this->get('/pesquisar', function($request, $response, $args){ | ||
158 | + /** @var $request Slim\Http\Request */ | ||
159 | + $rn = new MdWsSeiUsuarioRN(); | ||
160 | + return $response->withJSON( | ||
161 | + $rn->apiPesquisarUsuario( | ||
162 | + $request->getParam('palavrachave'), | ||
163 | + $request->getParam('orgao')) | ||
164 | + ); | ||
165 | + }); | ||
166 | + $this->get('/unidades', function($request, $response, $args){ | ||
167 | + /** @var $request Slim\Http\Request */ | ||
168 | + $dto = new UsuarioDTO(); | ||
169 | + $dto->setNumIdUsuario($request->getParam('usuario')); | ||
170 | + $rn = new MdWsSeiUsuarioRN(); | ||
171 | + return $response->withJSON($rn->listarUnidadesUsuario($dto)); | ||
172 | + }); | ||
157 | 173 | ||
158 | })->add( new TokenValidationMiddleware()); | 174 | })->add( new TokenValidationMiddleware()); |
159 | 175 | ||
@@ -184,8 +200,9 @@ $app->group('/api/v1',function(){ | @@ -184,8 +200,9 @@ $app->group('/api/v1',function(){ | ||
184 | */ | 200 | */ |
185 | $this->group('/anotacao', function(){ | 201 | $this->group('/anotacao', function(){ |
186 | $this->post('/', function($request, $response, $args){ | 202 | $this->post('/', function($request, $response, $args){ |
203 | + /** @var $request Slim\Http\Request */ | ||
187 | $rn = new MdWsSeiAnotacaoRN(); | 204 | $rn = new MdWsSeiAnotacaoRN(); |
188 | - $dto = $rn->encapsulaAnotacao($request->getParams()); | 205 | + $dto = $rn->encapsulaAnotacao(MdWsSeiRest::dataToIso88591($request->getParams())); |
189 | return $response->withJSON($rn->cadastrarAnotacao($dto)); | 206 | return $response->withJSON($rn->cadastrarAnotacao($dto)); |
190 | }); | 207 | }); |
191 | 208 | ||
@@ -218,7 +235,7 @@ $app->group('/api/v1',function(){ | @@ -218,7 +235,7 @@ $app->group('/api/v1',function(){ | ||
218 | $dto = new RelBlocoProtocoloDTO(); | 235 | $dto = new RelBlocoProtocoloDTO(); |
219 | $dto->setNumIdBloco($request->getAttribute('route')->getArgument('bloco')); | 236 | $dto->setNumIdBloco($request->getAttribute('route')->getArgument('bloco')); |
220 | $dto->setDblIdProtocolo($request->getParam('protocolo')); | 237 | $dto->setDblIdProtocolo($request->getParam('protocolo')); |
221 | - $dto->setStrAnotacao($request->getParam('anotacao')); | 238 | + $dto->setStrAnotacao(MdWsSeiRest::dataToIso88591($request->getParam('anotacao'))); |
222 | return $response->withJSON($rn->cadastrarAnotacaoBloco($dto)); | 239 | return $response->withJSON($rn->cadastrarAnotacaoBloco($dto)); |
223 | }); | 240 | }); |
224 | 241 | ||
@@ -255,7 +272,7 @@ $app->group('/api/v1',function(){ | @@ -255,7 +272,7 @@ $app->group('/api/v1',function(){ | ||
255 | return $response->withJSON($rn->apiAssinarDocumentos( | 272 | return $response->withJSON($rn->apiAssinarDocumentos( |
256 | $request->getParam('arrDocumento'), | 273 | $request->getParam('arrDocumento'), |
257 | $request->getParam('orgao'), | 274 | $request->getParam('orgao'), |
258 | - $request->getParam('cargo'), | 275 | + MdWsSeiRest::dataToIso88591($request->getParam('cargo')), |
259 | $request->getParam('login'), | 276 | $request->getParam('login'), |
260 | $request->getParam('senha'), | 277 | $request->getParam('senha'), |
261 | $request->getParam('usuario') | 278 | $request->getParam('usuario') |
@@ -267,7 +284,7 @@ $app->group('/api/v1',function(){ | @@ -267,7 +284,7 @@ $app->group('/api/v1',function(){ | ||
267 | return $response->withJSON($rn->apiAssinarDocumento( | 284 | return $response->withJSON($rn->apiAssinarDocumento( |
268 | $request->getParam('documento'), | 285 | $request->getParam('documento'), |
269 | $request->getParam('orgao'), | 286 | $request->getParam('orgao'), |
270 | - $request->getParam('cargo'), | 287 | + MdWsSeiRest::dataToIso88591($request->getParam('cargo')), |
271 | $request->getParam('login'), | 288 | $request->getParam('login'), |
272 | $request->getParam('senha'), | 289 | $request->getParam('senha'), |
273 | $request->getParam('usuario') | 290 | $request->getParam('usuario') |
@@ -336,7 +353,7 @@ $app->group('/api/v1',function(){ | @@ -336,7 +353,7 @@ $app->group('/api/v1',function(){ | ||
336 | if($request->getParam('protocoloFormatadoVinculado')){ | 353 | if($request->getParam('protocoloFormatadoVinculado')){ |
337 | $dto->setProtocoloProcedimentoVinculado($request->getParam('protocoloFormatadoVinculado')); | 354 | $dto->setProtocoloProcedimentoVinculado($request->getParam('protocoloFormatadoVinculado')); |
338 | } | 355 | } |
339 | - $dto->setMotivo($request->getParam('motivo')); | 356 | + $dto->setMotivo(MdWsSeiRest::dataToIso88591($request->getParam('motivo'))); |
340 | return $response->withJSON($rn->sobrestamentoProcesso($dto)); | 357 | return $response->withJSON($rn->sobrestamentoProcesso($dto)); |
341 | }); | 358 | }); |
342 | $this->post('/{procedimento}/ciencia', function($request, $response, $args){ | 359 | $this->post('/{procedimento}/ciencia', function($request, $response, $args){ |
@@ -450,7 +467,7 @@ $app->group('/api/v1',function(){ | @@ -450,7 +467,7 @@ $app->group('/api/v1',function(){ | ||
450 | $this->post('/enviar', function($request, $response, $args){ | 467 | $this->post('/enviar', function($request, $response, $args){ |
451 | /** @var $request Slim\Http\Request */ | 468 | /** @var $request Slim\Http\Request */ |
452 | $rn = new MdWsSeiProcedimentoRN(); | 469 | $rn = new MdWsSeiProcedimentoRN(); |
453 | - $dto = $rn->encapsulaEnviarProcessoEntradaEnviarProcessoAPI($request->getParams()); | 470 | + $dto = $rn->encapsulaEnviarProcessoEntradaEnviarProcessoAPI(MdWsSeiRest::dataToIso88591($request->getParams())); |
454 | return $response->withJSON($rn->enviarProcesso($dto)); | 471 | return $response->withJSON($rn->enviarProcesso($dto)); |
455 | }); | 472 | }); |
456 | $this->post('/concluir', function($request, $response, $args){ | 473 | $this->post('/concluir', function($request, $response, $args){ |
@@ -465,19 +482,19 @@ $app->group('/api/v1',function(){ | @@ -465,19 +482,19 @@ $app->group('/api/v1',function(){ | ||
465 | $this->post('/acompanhar', function($request, $response, $args){ | 482 | $this->post('/acompanhar', function($request, $response, $args){ |
466 | /** @var $request Slim\Http\Request */ | 483 | /** @var $request Slim\Http\Request */ |
467 | $rn = new MdWsSeiAcompanhamentoRN(); | 484 | $rn = new MdWsSeiAcompanhamentoRN(); |
468 | - $dto = $rn->encapsulaAcompanhamento($request->getParams()); | 485 | + $dto = $rn->encapsulaAcompanhamento(MdWsSeiRest::dataToIso88591($request->getParams())); |
469 | return $response->withJSON($rn->cadastrarAcompanhamento($dto)); | 486 | return $response->withJSON($rn->cadastrarAcompanhamento($dto)); |
470 | }); | 487 | }); |
471 | $this->post('/agendar/retorno/programado', function($request, $response, $args){ | 488 | $this->post('/agendar/retorno/programado', function($request, $response, $args){ |
472 | /** @var $request Slim\Http\Request */ | 489 | /** @var $request Slim\Http\Request */ |
473 | $rn = new MdWsSeiRetornoProgramadoRN(); | 490 | $rn = new MdWsSeiRetornoProgramadoRN(); |
474 | - $dto = $rn->encapsulaRetornoProgramado($request->getParams()); | 491 | + $dto = $rn->encapsulaRetornoProgramado(MdWsSeiRest::dataToIso88591($request->getParams())); |
475 | return $response->withJSON($rn->agendarRetornoProgramado($dto)); | 492 | return $response->withJSON($rn->agendarRetornoProgramado($dto)); |
476 | }); | 493 | }); |
477 | $this->post('/atribuir', function($request, $response, $args){ | 494 | $this->post('/atribuir', function($request, $response, $args){ |
478 | /** @var $request Slim\Http\Request */ | 495 | /** @var $request Slim\Http\Request */ |
479 | $api = new EntradaAtribuirProcessoAPI(); | 496 | $api = new EntradaAtribuirProcessoAPI(); |
480 | - | 497 | + |
481 | if($request->getParam('numeroProcesso')) { | 498 | if($request->getParam('numeroProcesso')) { |
482 | $api->setProtocoloProcedimento($request->getParam('numeroProcesso')); | 499 | $api->setProtocoloProcedimento($request->getParam('numeroProcesso')); |
483 | } | 500 | } |
@@ -504,6 +521,38 @@ $app->group('/api/v1',function(){ | @@ -504,6 +521,38 @@ $app->group('/api/v1',function(){ | ||
504 | 521 | ||
505 | return $response->withJSON($rn->apiIdentificacaoAcesso($usuarioDTO, $protocoloDTO)); | 522 | return $response->withJSON($rn->apiIdentificacaoAcesso($usuarioDTO, $protocoloDTO)); |
506 | }); | 523 | }); |
524 | + $this->post('/{procedimento}/credenciamento/conceder', function($request, $response, $args){ | ||
525 | + /** @var $request Slim\Http\Request */ | ||
526 | + $rn = new MdWsSeiCredenciamentoRN(); | ||
527 | + $dto = new ConcederCredencialDTO(); | ||
528 | + $dto->setDblIdProcedimento($request->getAttribute('route')->getArgument('procedimento')); | ||
529 | + $dto->setNumIdUnidade($request->getParam('unidade')); | ||
530 | + $dto->setNumIdUsuario($request->getParam('usuario')); | ||
531 | + | ||
532 | + return $response->withJSON($rn->concederCredenciamento($dto)); | ||
533 | + }); | ||
534 | + $this->post('/{procedimento}/credenciamento/cassar', function($request, $response, $args){ | ||
535 | + /** @var $request Slim\Http\Request */ | ||
536 | + $rn = new MdWsSeiCredenciamentoRN(); | ||
537 | + $dto = new AtividadeDTO(); | ||
538 | + $dto->setNumIdAtividade($request->getParam('atividade')); | ||
539 | + | ||
540 | + return $response->withJSON($rn->cassarCredencial($dto)); | ||
541 | + }); | ||
542 | + $this->get('/{procedimento}/credenciamento/listar', function($request, $response, $args){ | ||
543 | + /** @var $request Slim\Http\Request */ | ||
544 | + $rn = new MdWsSeiCredenciamentoRN(); | ||
545 | + $dto = new ProcedimentoDTO(); | ||
546 | + if($request->getParam('limit')){ | ||
547 | + $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); | ||
548 | + } | ||
549 | + if(!is_null($request->getParam('start'))){ | ||
550 | + $dto->setNumPaginaAtual($request->getParam('start')); | ||
551 | + } | ||
552 | + $dto->setDblIdProcedimento($request->getAttribute('route')->getArgument('procedimento')); | ||
553 | + | ||
554 | + return $response->withJSON($rn->listarCredenciaisProcesso($dto)); | ||
555 | + }); | ||
507 | 556 | ||
508 | })->add( new TokenValidationMiddleware()); | 557 | })->add( new TokenValidationMiddleware()); |
509 | 558 | ||
@@ -529,7 +578,7 @@ $app->group('/api/v1',function(){ | @@ -529,7 +578,7 @@ $app->group('/api/v1',function(){ | ||
529 | $this->post('/lancar/andamento/processo', function($request, $response, $args){ | 578 | $this->post('/lancar/andamento/processo', function($request, $response, $args){ |
530 | /** @var $request Slim\Http\Request */ | 579 | /** @var $request Slim\Http\Request */ |
531 | $rn = new MdWsSeiAtividadeRN(); | 580 | $rn = new MdWsSeiAtividadeRN(); |
532 | - $dto = $rn->encapsulaLancarAndamentoProcesso($request->getParams()); | 581 | + $dto = $rn->encapsulaLancarAndamentoProcesso(MdWsSeiRest::dataToIso88591($request->getParams())); |
533 | 582 | ||
534 | return $response->withJSON($rn->lancarAndamentoProcesso($dto)); | 583 | return $response->withJSON($rn->lancarAndamentoProcesso($dto)); |
535 | }); | 584 | }); |
@@ -555,7 +604,7 @@ $app->group('/api/v1',function(){ | @@ -555,7 +604,7 @@ $app->group('/api/v1',function(){ | ||
555 | } | 604 | } |
556 | return $response->withJSON($rn->listarAssinante($dto)); | 605 | return $response->withJSON($rn->listarAssinante($dto)); |
557 | }); | 606 | }); |
558 | - | 607 | + |
559 | $this->get('/orgao', function($request, $response, $args){ | 608 | $this->get('/orgao', function($request, $response, $args){ |
560 | /** @var $request Slim\Http\Request */ | 609 | /** @var $request Slim\Http\Request */ |
561 | $rn = new MdWsSeiOrgaoRN(); | 610 | $rn = new MdWsSeiOrgaoRN(); |
@@ -600,7 +649,7 @@ $app->group('/api/v1',function(){ | @@ -600,7 +649,7 @@ $app->group('/api/v1',function(){ | ||
600 | $this->post('/', function($request, $response, $args){ | 649 | $this->post('/', function($request, $response, $args){ |
601 | /** @var $request Slim\Http\Request */ | 650 | /** @var $request Slim\Http\Request */ |
602 | $rn = new MdWsSeiObservacaoRN(); | 651 | $rn = new MdWsSeiObservacaoRN(); |
603 | - $dto = $rn->encapsulaObservacao($request->getParams()); | 652 | + $dto = $rn->encapsulaObservacao(MdWsSeiRest::dataToIso88591($request->getParams())); |
604 | return $response->withJSON($rn->criarObservacao($dto)); | 653 | return $response->withJSON($rn->criarObservacao($dto)); |
605 | }); | 654 | }); |
606 | 655 |
rn/MdWsSeiAnotacaoRN.php
@@ -32,6 +32,8 @@ class MdWsSeiAnotacaoRN extends InfraRN { | @@ -32,6 +32,8 @@ class MdWsSeiAnotacaoRN extends InfraRN { | ||
32 | $anotacaoDTO->setStrSinPrioridade( | 32 | $anotacaoDTO->setStrSinPrioridade( |
33 | ($post['prioridade']) ? 'S' : 'N' | 33 | ($post['prioridade']) ? 'S' : 'N' |
34 | ); | 34 | ); |
35 | + }else{ | ||
36 | + $anotacaoDTO->setStrSinPrioridade('N'); | ||
35 | } | 37 | } |
36 | $anotacaoDTO->setStrStaAnotacao('U'); | 38 | $anotacaoDTO->setStrStaAnotacao('U'); |
37 | 39 |
rn/MdWsSeiAtividadeRN.php
@@ -423,6 +423,96 @@ class MdWsSeiAtividadeRN extends AtividadeRN { | @@ -423,6 +423,96 @@ class MdWsSeiAtividadeRN extends AtividadeRN { | ||
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
426 | + /** | ||
427 | + * Sobrescrevendo método para colocar paginação | ||
428 | + * @param ProcedimentoDTO $objProcedimentoDTO | ||
429 | + * @return mixed | ||
430 | + * @throws InfraException | ||
431 | + */ | ||
432 | + protected function listarCredenciaisConectado(ProcedimentoDTO $objProcedimentoDTO) { | ||
433 | + try{ | ||
434 | + $objInfraException = new InfraException(); | ||
435 | + | ||
436 | + $objProtocoloDTO = new ProtocoloDTO(); | ||
437 | + $objProtocoloDTO->retDblIdProtocolo(); | ||
438 | + $objProtocoloDTO->retStrProtocoloFormatado(); | ||
439 | + $objProtocoloDTO->retStrStaNivelAcessoGlobal(); | ||
440 | + $objProtocoloDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | ||
441 | + | ||
442 | + $objProtocoloRN = new ProtocoloRN(); | ||
443 | + $objProtocoloDTO = $objProtocoloRN->consultarRN0186($objProtocoloDTO); | ||
444 | + | ||
445 | + $objAcessoDTO = new AcessoDTO(); | ||
446 | + $objAcessoDTO->retNumIdAcesso(); | ||
447 | + $objAcessoDTO->setDblIdProtocolo($objProtocoloDTO->getDblIdProtocolo()); | ||
448 | + $objAcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
449 | + $objAcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
450 | + $objAcessoDTO->setStrStaTipo(AcessoRN::$TA_CREDENCIAL_PROCESSO); | ||
451 | + $objAcessoDTO->setNumMaxRegistrosRetorno(1); | ||
452 | + | ||
453 | + $objAcessoRN = new AcessoRN(); | ||
454 | + | ||
455 | + if ($objAcessoRN->consultar($objAcessoDTO) == null){ | ||
456 | + $objInfraException->adicionarValidacao('Usuário atual não possui credencial de acesso ao processo '.$objProtocoloDTO->getStrProtocoloFormatado().' nesta unidade.'); | ||
457 | + } | ||
458 | + | ||
459 | + if ($objProtocoloDTO->getStrStaNivelAcessoGlobal()!=ProtocoloRN::$NA_SIGILOSO){ | ||
460 | + $objInfraException->adicionarValidacao('Não é possível listar credenciais de acesso para um processo não sigiloso ('.$objProtocoloDTO->getStrProtocoloFormatado().').'); | ||
461 | + } | ||
462 | + | ||
463 | + $objInfraException->lancarValidacoes(); | ||
464 | + | ||
465 | + $objAtividadeDTO = new AtividadeDTO(); | ||
466 | + $objAtividadeDTO->retNumIdAtividade(); | ||
467 | + $objAtividadeDTO->retStrSiglaUsuario(); | ||
468 | + $objAtividadeDTO->retStrNomeUsuario(); | ||
469 | + $objAtividadeDTO->retStrSiglaUnidade(); | ||
470 | + $objAtividadeDTO->retStrDescricaoUnidade(); | ||
471 | + $objAtividadeDTO->retDthAbertura(); | ||
472 | + $objAtividadeDTO->retNumIdTarefa(); | ||
473 | + $objAtividadeDTO->setNumIdUsuarioOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
474 | + $objAtividadeDTO->setDblIdProtocolo($objProtocoloDTO->getDblIdProtocolo()); | ||
475 | + $objAtividadeDTO->setNumIdTarefa(array_merge(TarefaRN::getArrTarefasConcessaoCredencial(false), TarefaRN::getArrTarefasCassacaoCredencial(false)), InfraDTO::$OPER_IN); | ||
476 | + | ||
477 | + // INICIO SOBRESCRITA | ||
478 | + if($objProcedimentoDTO->isSetNumMaxRegistrosRetorno()){ | ||
479 | + $objAtividadeDTO->setNumMaxRegistrosRetorno($objProcedimentoDTO->getNumMaxRegistrosRetorno()); | ||
480 | + } | ||
481 | + if(!is_null($objProcedimentoDTO->getNumPaginaAtual())){ | ||
482 | + $objAtividadeDTO->setNumPaginaAtual($objProcedimentoDTO->getNumPaginaAtual()); | ||
483 | + } | ||
484 | + | ||
485 | + $objAtividadeDTO->setOrdNumIdAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); | ||
486 | + $arrObjAtividadeDTO = $this->listarRN0036($objAtividadeDTO); | ||
487 | + $objProcedimentoDTO->setNumTotalRegistros($objAtividadeDTO->getNumTotalRegistros()); | ||
488 | + // FIM SOBRESCRITA | ||
489 | + | ||
490 | + if (count($arrObjAtividadeDTO)){ | ||
491 | + | ||
492 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | ||
493 | + $objAtributoAndamentoDTO->retNumIdAtividade(); | ||
494 | + $objAtributoAndamentoDTO->retStrNome(); | ||
495 | + $objAtributoAndamentoDTO->retStrValor(); | ||
496 | + $objAtributoAndamentoDTO->setNumIdAtividade(InfraArray::converterArrInfraDTO($arrObjAtividadeDTO,'IdAtividade'), InfraDTO::$OPER_IN); | ||
497 | + | ||
498 | + $objAtributoAndamentoRN = new AtributoAndamentoRN(); | ||
499 | + $arrObjAtributoAndamentoDTO = InfraArray::indexarArrInfraDTO($objAtributoAndamentoRN->listarRN1367($objAtributoAndamentoDTO),'IdAtividade',true); | ||
500 | + | ||
501 | + foreach($arrObjAtividadeDTO as $objAtividadeDTO){ | ||
502 | + if (isset($arrObjAtributoAndamentoDTO[$objAtividadeDTO->getNumIdAtividade()])){ | ||
503 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO[$objAtividadeDTO->getNumIdAtividade()]); | ||
504 | + }else{ | ||
505 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO(array()); | ||
506 | + } | ||
507 | + } | ||
508 | + } | ||
509 | + | ||
510 | + return $arrObjAtividadeDTO; | ||
511 | + | ||
512 | + }catch(Exception $e){ | ||
513 | + throw new InfraException('Erro listando credenciais.',$e); | ||
514 | + } | ||
515 | + } | ||
426 | 516 | ||
427 | 517 | ||
428 | } | 518 | } |
429 | \ No newline at end of file | 519 | \ No newline at end of file |
@@ -0,0 +1,112 @@ | @@ -0,0 +1,112 @@ | ||
1 | +<? | ||
2 | +require_once dirname(__FILE__).'/../../../SEI.php'; | ||
3 | + | ||
4 | +class MdWsSeiCredenciamentoRN extends InfraRN { | ||
5 | + | ||
6 | + protected function inicializarObjInfraIBanco(){ | ||
7 | + return BancoSEI::getInstance(); | ||
8 | + } | ||
9 | + | ||
10 | + /** | ||
11 | + * Concede a credencial de acesso a um processo sigiloso | ||
12 | + * @param ConcederCredencialDTO $concederCredencialDTO | ||
13 | + * @return array | ||
14 | + */ | ||
15 | + protected function concederCredenciamentoControlado(ConcederCredencialDTO $concederCredencialDTO){ | ||
16 | + try{ | ||
17 | + if(!$concederCredencialDTO->isSetDblIdProcedimento() || !$concederCredencialDTO->getDblIdProcedimento()){ | ||
18 | + throw new Exception('Processo não informado!'); | ||
19 | + } | ||
20 | + if(!$concederCredencialDTO->isSetNumIdUnidade() || !$concederCredencialDTO->getNumIdUnidade()){ | ||
21 | + throw new Exception('Unidade não informada!'); | ||
22 | + } | ||
23 | + if(!$concederCredencialDTO->isSetNumIdUsuario() || !$concederCredencialDTO->getNumIdUsuario()){ | ||
24 | + throw new Exception('Usuário não informado!'); | ||
25 | + } | ||
26 | + | ||
27 | + $atividadeRN = new AtividadeRN(); | ||
28 | + $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | ||
29 | + $pesquisaPendenciaDTO->setDblIdProtocolo($concederCredencialDTO->getDblIdProcedimento()); | ||
30 | + $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
31 | + $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
32 | + $arrProcedimentoDTO = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | ||
33 | + | ||
34 | + if (count($arrProcedimentoDTO)==0){ | ||
35 | + throw new Exception('Processo não encontrado.'); | ||
36 | + } | ||
37 | + $arrAtividadesOrigem = $arrProcedimentoDTO[0]->getArrObjAtividadeDTO(); | ||
38 | + $concederCredencialDTO->setArrAtividadesOrigem($arrAtividadesOrigem); | ||
39 | + $atividadeRN->concederCredencial($concederCredencialDTO); | ||
40 | + | ||
41 | + return MdWsSeiRest::formataRetornoSucessoREST("Credencial concedida com sucesso!"); | ||
42 | + }catch (Exception $e){ | ||
43 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Remove a credencial de acesso a um processo sigiloso | ||
49 | + * @param AtividadeDTO $atividadeDTO | ||
50 | + * @return array | ||
51 | + */ | ||
52 | + protected function cassarCredencialControlado(AtividadeDTO $atividadeDTO){ | ||
53 | + try{ | ||
54 | + if(!$atividadeDTO->isSetNumIdAtividade() || !$atividadeDTO->getNumIdAtividade()){ | ||
55 | + throw new Exception('Atividade não informado!'); | ||
56 | + } | ||
57 | + | ||
58 | + $objAtividadeRN = new AtividadeRN(); | ||
59 | + $objAtividadeRN->cassarCredenciais(array($atividadeDTO)); | ||
60 | + return MdWsSeiRest::formataRetornoSucessoREST("Credencial cassada com sucesso!"); | ||
61 | + }catch (Exception $e){ | ||
62 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Lista as credenciais de acesso de um processo sigiloso | ||
68 | + * @param ProcedimentoDTO $procedimentoDTOParam | ||
69 | + * @return array | ||
70 | + */ | ||
71 | + protected function listarCredenciaisProcessoConectado(ProcedimentoDTO $procedimentoDTOParam){ | ||
72 | + try{ | ||
73 | + if(!$procedimentoDTOParam->isSetDblIdProcedimento() || !$procedimentoDTOParam->getDblIdProcedimento()){ | ||
74 | + throw new Exception('Atividade não informado!'); | ||
75 | + } | ||
76 | + if(is_null($procedimentoDTOParam->getNumPaginaAtual())){ | ||
77 | + $procedimentoDTOParam->setNumPaginaAtual(0); | ||
78 | + } | ||
79 | + if (!$procedimentoDTOParam->isSetNumMaxRegistrosRetorno()) { | ||
80 | + $procedimentoDTOParam->setNumMaxRegistrosRetorno(10); | ||
81 | + } | ||
82 | + | ||
83 | + $result = array(); | ||
84 | + $objAtividadeRN = new MdWsSeiAtividadeRN(); | ||
85 | + $ret = $objAtividadeRN->listarCredenciais($procedimentoDTOParam); | ||
86 | + /** @var AtividadeDTO $atividadeDTO */ | ||
87 | + foreach($ret as $atividadeDTO){ | ||
88 | + $dataCassacao = null; | ||
89 | + foreach ($atividadeDTO->getArrObjAtributoAndamentoDTO() as $atributoAndamentoDTO) { | ||
90 | + if ($atributoAndamentoDTO->getStrNome() == 'DATA_HORA') { | ||
91 | + $dataCassacao .= substr($atributoAndamentoDTO->getStrValor(), 0, 16); | ||
92 | + } | ||
93 | + } | ||
94 | + $result[] = array( | ||
95 | + 'atividade' => $atividadeDTO->getNumIdAtividade(), | ||
96 | + 'siglaUsuario' => $atividadeDTO->getStrSiglaUsuario(), | ||
97 | + 'siglaUnidade' => $atividadeDTO->getStrSiglaUnidade(), | ||
98 | + 'nomeUsuario' => $atividadeDTO->getStrNomeUsuario(), | ||
99 | + 'descricaoUnidade' => $atividadeDTO->getStrDescricaoUnidade(), | ||
100 | + 'dataAbertura' => substr($atividadeDTO->getDthAbertura(),0,16), | ||
101 | + 'credencialCassada' => in_array($atividadeDTO->getNumIdTarefa(), TarefaRN::getArrTarefasCassacaoCredencial(false)), | ||
102 | + 'dataCassacao' => $dataCassacao, | ||
103 | + ); | ||
104 | + } | ||
105 | + | ||
106 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $procedimentoDTOParam->getNumTotalRegistros()); | ||
107 | + }catch (Exception $e){ | ||
108 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
109 | + } | ||
110 | + } | ||
111 | + | ||
112 | +} | ||
0 | \ No newline at end of file | 113 | \ No newline at end of file |
rn/MdWsSeiObservacaoRN.php
@@ -36,7 +36,7 @@ class MdWsSeiObservacaoRN extends InfraRN { | @@ -36,7 +36,7 @@ class MdWsSeiObservacaoRN extends InfraRN { | ||
36 | $observacaoRN = new ObservacaoRN(); | 36 | $observacaoRN = new ObservacaoRN(); |
37 | $observacaoRN->cadastrarRN0222($observacaoDTO); | 37 | $observacaoRN->cadastrarRN0222($observacaoDTO); |
38 | 38 | ||
39 | - return MdWsSeiRest::formataRetornoSucessoREST('Observação cadastrada com sucesso!'); | 39 | + return MdWsSeiRest::formataRetornoSucessoREST('Observação cadastrada com sucesso!'); |
40 | }catch (Exception $e){ | 40 | }catch (Exception $e){ |
41 | return MdWsSeiRest::formataRetornoErroREST($e); | 41 | return MdWsSeiRest::formataRetornoErroREST($e); |
42 | } | 42 | } |
rn/MdWsSeiUsuarioRN.php
@@ -308,4 +308,56 @@ class MdWsSeiUsuarioRN extends InfraRN { | @@ -308,4 +308,56 @@ class MdWsSeiUsuarioRN extends InfraRN { | ||
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | + /** | ||
312 | + * Retorna as unidades do usuário | ||
313 | + * @param UsuarioDTO $usuarioDTO | ||
314 | + */ | ||
315 | + public function listarUnidadesUsuarioConectado(UsuarioDTO $usuarioDTO){ | ||
316 | + try{ | ||
317 | + $objInfraSip = new InfraSip(SessaoSEI::getInstance()); | ||
318 | + $ret = array_values($objInfraSip->carregarUnidades(SessaoSEI::getInstance()->getNumIdSistema(), $usuarioDTO->getNumIdUsuario())); | ||
319 | + InfraArray::ordenarArray($ret,InfraSip::$WS_UNIDADE_SIGLA,InfraArray::$TIPO_ORDENACAO_ASC); | ||
320 | + $result = array(); | ||
321 | + foreach($ret as $uni){ | ||
322 | + //somente unidades ativas, todas as unidades de outros usuários, se for o usuário atual não mostra a unidade atual | ||
323 | + if ($uni[InfraSip::$WS_UNIDADE_SIN_ATIVO]=='S' && ($usuarioDTO->getNumIdUsuario() != SessaoSEI::getInstance()->getNumIdUsuario() ||$uni[InfraSip::$WS_UNIDADE_ID] != SessaoSEI::getInstance()->getNumIdUnidadeAtual())){ | ||
324 | + $result[] = array( | ||
325 | + 'id' => $uni[InfraSip::$WS_UNIDADE_ID], | ||
326 | + 'sigla' => $uni[InfraSip::$WS_UNIDADE_SIGLA], | ||
327 | + 'nome' => $uni[InfraSip::$WS_UNIDADE_DESCRICAO] | ||
328 | + ); | ||
329 | + } | ||
330 | + } | ||
331 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | ||
332 | + }catch (Exception $e){ | ||
333 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
334 | + } | ||
335 | + } | ||
336 | + | ||
337 | + /** | ||
338 | + * Pesquisa o usuário pelo nome | ||
339 | + * @param $palavrachave | ||
340 | + * @param null $orgao | ||
341 | + * @return array | ||
342 | + */ | ||
343 | + public function apiPesquisarUsuario($palavrachave, $orgao = null){ | ||
344 | + try{ | ||
345 | + $result = array(); | ||
346 | + $arrUsuarioDTO = UsuarioINT::autoCompletarUsuarios($orgao,$palavrachave,false,false,true,false); | ||
347 | + /** @var UsuarioDTO $usuarioDTO */ | ||
348 | + foreach($arrUsuarioDTO as $usuarioDTO){ | ||
349 | + $result[] = array( | ||
350 | + 'id_contato' => $usuarioDTO->getNumIdContato(), | ||
351 | + 'id_usuario' => $usuarioDTO->getNumIdUsuario(), | ||
352 | + 'sigla' => $usuarioDTO->getStrSigla(), | ||
353 | + 'nome' => $usuarioDTO->getStrNome() | ||
354 | + ); | ||
355 | + } | ||
356 | + | ||
357 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | ||
358 | + }catch (Exception $e){ | ||
359 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
360 | + } | ||
361 | + } | ||
362 | + | ||
311 | } | 363 | } |
312 | \ No newline at end of file | 364 | \ No newline at end of file |