Commit 1cf7692571e9f2c1f94b647f31bb7df4fd216b56
1 parent
3a5e99a6
Exists in
master
and in
1 other branch
[Refact] alterando lista de processos para a mesma implementação do SEI WEB.
Showing
3 changed files
with
82 additions
and
68 deletions
Show diff stats
controlador_ws.php
| @@ -340,9 +340,6 @@ $app->group('/api/v1',function(){ | @@ -340,9 +340,6 @@ $app->group('/api/v1',function(){ | ||
| 340 | /** @var $request Slim\Http\Request */ | 340 | /** @var $request Slim\Http\Request */ |
| 341 | $rn = new MdWsSeiProcedimentoRN(); | 341 | $rn = new MdWsSeiProcedimentoRN(); |
| 342 | $dto = new MdWsSeiProtocoloDTO(); | 342 | $dto = new MdWsSeiProtocoloDTO(); |
| 343 | - if($request->getParam('unidade')){ | ||
| 344 | - $dto->setNumIdUnidadeAtividade($request->getParam('unidade')); | ||
| 345 | - } | ||
| 346 | if($request->getParam('limit')){ | 343 | if($request->getParam('limit')){ |
| 347 | $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); | 344 | $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); |
| 348 | } | 345 | } |
| @@ -354,6 +351,11 @@ $app->group('/api/v1',function(){ | @@ -354,6 +351,11 @@ $app->group('/api/v1',function(){ | ||
| 354 | }else{ | 351 | }else{ |
| 355 | $dto->setStrSinTipoBusca(null); | 352 | $dto->setStrSinTipoBusca(null); |
| 356 | } | 353 | } |
| 354 | + if($request->getParam('apenasMeus')){ | ||
| 355 | + $dto->setStrSinApenasMeus($request->getParam('apenasMeus')); | ||
| 356 | + }else{ | ||
| 357 | + $dto->setStrSinApenasMeus('N'); | ||
| 358 | + } | ||
| 357 | if(!is_null($request->getParam('start'))){ | 359 | if(!is_null($request->getParam('start'))){ |
| 358 | $dto->setNumPaginaAtual($request->getParam('start')); | 360 | $dto->setNumPaginaAtual($request->getParam('start')); |
| 359 | } | 361 | } |
dto/MdWsSeiProtocoloDTO.php
| 1 | <? | 1 | <? |
| 2 | 2 | ||
| 3 | class MdWsSeiProtocoloDTO extends ProtocoloDTO{ | 3 | class MdWsSeiProtocoloDTO extends ProtocoloDTO{ |
| 4 | - CONST SIN_TIPO_BUSCA_M = 'M'; | 4 | + CONST SIN_TIPO_BUSCA_R = 'R'; |
| 5 | CONST SIN_TIPO_BUSCA_G = 'G'; | 5 | CONST SIN_TIPO_BUSCA_G = 'G'; |
| 6 | 6 | ||
| 7 | public function montar(){ | 7 | public function montar(){ |
| @@ -44,6 +44,7 @@ class MdWsSeiProtocoloDTO extends ProtocoloDTO{ | @@ -44,6 +44,7 @@ class MdWsSeiProtocoloDTO extends ProtocoloDTO{ | ||
| 44 | 'atividade'); | 44 | 'atividade'); |
| 45 | 45 | ||
| 46 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinTipoBusca'); | 46 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinTipoBusca'); |
| 47 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinApenasMeus'); | ||
| 47 | 48 | ||
| 48 | $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); |
| 49 | $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); | 50 | $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); |
rn/MdWsSeiProcedimentoRN.php
| @@ -227,63 +227,50 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -227,63 +227,50 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
| 227 | */ | 227 | */ |
| 228 | protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam){ | 228 | protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam){ |
| 229 | try{ | 229 | try{ |
| 230 | - $mdWsSeiProtocoloDTOConsulta = new MdWsSeiProtocoloDTO(); | ||
| 231 | - $mdWsSeiProtocoloDTOConsulta->setDthConclusaoAtividade(null); | ||
| 232 | - $mdWsSeiProtocoloDTOConsulta->retDblIdProtocolo(); | ||
| 233 | - $mdWsSeiProtocoloDTOConsulta->retTodos(); | ||
| 234 | - $mdWsSeiProtocoloDTOConsulta->retStrNomeTipoProcedimentoProcedimento(); | ||
| 235 | - $mdWsSeiProtocoloDTOConsulta->retStrSiglaUnidadeGeradora(); | ||
| 236 | - $mdWsSeiProtocoloDTOConsulta->retStrSinCienciaProcedimento(); | ||
| 237 | - $mdWsSeiProtocoloDTOConsulta->setOrdDthAberturaAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); | 230 | + $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); |
| 238 | 231 | ||
| 239 | $usuarioAtribuicaoAtividade = null; | 232 | $usuarioAtribuicaoAtividade = null; |
| 240 | if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ | 233 | if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ |
| 241 | $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); | 234 | $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); |
| 242 | } | 235 | } |
| 243 | 236 | ||
| 244 | - if(!$mdWsSeiProtocoloDTOParam->isSetNumIdUnidadeAtividade()){ | ||
| 245 | - $mdWsSeiProtocoloDTOConsulta->setNumIdUnidadeAtividade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
| 246 | - }else{ | ||
| 247 | - $mdWsSeiProtocoloDTOConsulta->setNumIdUnidadeAtividade($mdWsSeiProtocoloDTOParam->getNumIdUnidadeAtividade()); | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | if(!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | 237 | if(!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ |
| 251 | - $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); | 238 | + $pesquisaPendenciaDTO->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); |
| 252 | }else{ | 239 | }else{ |
| 253 | - $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual(0); | 240 | + $pesquisaPendenciaDTO->setNumPaginaAtual(0); |
| 254 | } | 241 | } |
| 255 | 242 | ||
| 256 | if($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | 243 | if($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ |
| 257 | - $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); | 244 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); |
| 258 | }else{ | 245 | }else{ |
| 259 | - $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); | 246 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno(10); |
| 260 | } | 247 | } |
| 261 | - if(!$mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ | ||
| 262 | - $mdWsSeiProtocoloDTOParam->setNumIdUsuarioAtribuicaoAtividade(SessaoSEI::getInstance()->getNumIdUsuario()); | 248 | + if($mdWsSeiProtocoloDTOParam->getStrSinApenasMeus() == 'S'){ |
| 249 | + $pesquisaPendenciaDTO->setStrStaTipoAtribuicao('M'); | ||
| 263 | } | 250 | } |
| 264 | - if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_M){ | ||
| 265 | - $mdWsSeiProtocoloDTOConsulta->setNumIdUsuarioAtribuicaoAtividade($mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade()); | 251 | + |
| 252 | + $atividadeRN = new AtividadeRN(); | ||
| 253 | + $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
| 254 | + $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
| 255 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | ||
| 256 | + $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); | ||
| 257 | + $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | ||
| 258 | + $pesquisaPendenciaDTO->setStrSinCredenciais('S'); | ||
| 259 | + $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | ||
| 260 | + $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | ||
| 261 | + | ||
| 262 | + if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_R){ | ||
| 263 | + $pesquisaPendenciaDTO->setStrSinInicial('N'); | ||
| 264 | + $ret = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | ||
| 266 | }else if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G){ | 265 | }else if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G){ |
| 267 | - $mdWsSeiProtocoloDTOConsulta->adicionarCriterio( | ||
| 268 | - array('StaEstado', 'SinInicialAtividade'), | ||
| 269 | - array(InfraDTO::$OPER_DIFERENTE, InfraDTO::$OPER_IGUAL), | ||
| 270 | - array(1, 'S'), | ||
| 271 | - InfraDTO::$OPER_LOGICO_AND | ||
| 272 | - ); | 266 | + $pesquisaPendenciaDTO->setStrSinInicial('S'); |
| 267 | + $ret = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | ||
| 273 | }else{ | 268 | }else{ |
| 274 | - $mdWsSeiProtocoloDTOConsulta->adicionarCriterio( | ||
| 275 | - array('StaEstado', 'SinInicialAtividade', 'IdTarefaAtividade'), | ||
| 276 | - array(InfraDTO::$OPER_DIFERENTE, InfraDTO::$OPER_IGUAL, InfraDTO::$OPER_DIFERENTE), | ||
| 277 | - array(1, 'N', TarefaRN::$TI_GERACAO_PROCEDIMENTO), | ||
| 278 | - array(InfraDTO::$OPER_LOGICO_AND, InfraDTO::$OPER_LOGICO_AND) | ||
| 279 | - ); | 269 | + throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); |
| 280 | } | 270 | } |
| 281 | - | ||
| 282 | - $protocoloRN = new ProtocoloRN(); | ||
| 283 | - $ret = $protocoloRN->listarRN0668($mdWsSeiProtocoloDTOConsulta); | ||
| 284 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); | 271 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); |
| 285 | 272 | ||
| 286 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $mdWsSeiProtocoloDTOConsulta->getNumTotalRegistros()); | 273 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); |
| 287 | }catch (Exception $e){ | 274 | }catch (Exception $e){ |
| 288 | return MdWsSeiRest::formataRetornoErroREST($e); | 275 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 289 | } | 276 | } |
| @@ -299,8 +286,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -299,8 +286,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
| 299 | private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null){ | 286 | private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null){ |
| 300 | 287 | ||
| 301 | $result = array(); | 288 | $result = array(); |
| 302 | - /** @var MdWsSeiProtocoloDTO $protocoloDTO */ | ||
| 303 | - foreach($ret as $protocoloDTO){ | 289 | + $protocoloRN = new ProtocoloRN(); |
| 290 | + foreach($ret as $dto){ | ||
| 304 | $usuarioAtribuido = null; | 291 | $usuarioAtribuido = null; |
| 305 | $documentoNovo = 'N'; | 292 | $documentoNovo = 'N'; |
| 306 | $documentoPublicado = 'N'; | 293 | $documentoPublicado = 'N'; |
| @@ -310,6 +297,25 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -310,6 +297,25 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
| 310 | $tipoVisualizacao = 'N'; | 297 | $tipoVisualizacao = 'N'; |
| 311 | $retornoProgramado = 'N'; | 298 | $retornoProgramado = 'N'; |
| 312 | $retornoAtrasado = 'N'; | 299 | $retornoAtrasado = 'N'; |
| 300 | + $protocoloDTO = new MdWsSeiProtocoloDTO(); | ||
| 301 | + if($dto instanceof ProcedimentoDTO){ | ||
| 302 | + $protocoloDTO = new MdWsSeiProtocoloDTO(); | ||
| 303 | + $protocoloDTO->setDblIdProtocolo($dto->getDblIdProcedimento()); | ||
| 304 | + $protocoloDTO->retDblIdProtocolo(); | ||
| 305 | + $protocoloDTO->retNumIdUnidadeGeradora(); | ||
| 306 | + $protocoloDTO->retStrStaProtocolo(); | ||
| 307 | + $protocoloDTO->retStrProtocoloFormatado(); | ||
| 308 | + $protocoloDTO->retStrNomeTipoProcedimentoProcedimento(); | ||
| 309 | + $protocoloDTO->retStrDescricao(); | ||
| 310 | + $protocoloDTO->retStrSiglaUnidadeGeradora(); | ||
| 311 | + $protocoloDTO->retStrStaGrauSigilo(); | ||
| 312 | + $protocoloDTO->retStrStaNivelAcessoLocal(); | ||
| 313 | + $protocoloDTO->retStrSinCienciaProcedimento(); | ||
| 314 | + $protocoloDTO->retStrStaEstado(); | ||
| 315 | + $protocoloDTO = $protocoloRN->consultarRN0186($protocoloDTO); | ||
| 316 | + }else{ | ||
| 317 | + $protocoloDTO = $dto; | ||
| 318 | + } | ||
| 313 | 319 | ||
| 314 | $processoBloqueado = $protocoloDTO->getStrStaEstado() == ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO ? 'S' : 'N'; | 320 | $processoBloqueado = $protocoloDTO->getStrStaEstado() == ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO ? 'S' : 'N'; |
| 315 | $processoRemocaoSobrestamento = 'N'; | 321 | $processoRemocaoSobrestamento = 'N'; |
| @@ -340,30 +346,35 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -340,30 +346,35 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
| 340 | $usuarioVisualizacao = 'S'; | 346 | $usuarioVisualizacao = 'S'; |
| 341 | } | 347 | } |
| 342 | } | 348 | } |
| 343 | - $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | ||
| 344 | - $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
| 345 | - $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
| 346 | - $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | ||
| 347 | - $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); | ||
| 348 | - $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | ||
| 349 | - $pesquisaPendenciaDTO->setStrSinCredenciais('S'); | ||
| 350 | - $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | ||
| 351 | - $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | ||
| 352 | - $pesquisaPendenciaDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | ||
| 353 | - $arrProcedimentoDTO = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | ||
| 354 | - if($arrProcedimentoDTO){ | ||
| 355 | - $arrAtividadePendenciaDTO = $arrProcedimentoDTO[0]->getArrObjAtividadeDTO(); | ||
| 356 | - if($arrAtividadePendenciaDTO){ | ||
| 357 | - $atividadePendenciaDTO = $arrAtividadePendenciaDTO[0]; | ||
| 358 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO){ | ||
| 359 | - $processoRemocaoSobrestamento = 'S'; | ||
| 360 | - } | ||
| 361 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_ATENCAO){ | ||
| 362 | - $processoDocumentoIncluidoAssinado = 'S'; | ||
| 363 | - } | ||
| 364 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_PUBLICACAO){ | ||
| 365 | - $processoPublicado = 'S'; | ||
| 366 | - } | 349 | + $arrAtividadePendenciaDTO = array(); |
| 350 | + if($dto instanceof ProcedimentoDTO){ | ||
| 351 | + $arrAtividadePendenciaDTO = $dto->getArrObjAtividadeDTO(); | ||
| 352 | + }else{ | ||
| 353 | + $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | ||
| 354 | + $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
| 355 | + $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
| 356 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | ||
| 357 | + $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); | ||
| 358 | + $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | ||
| 359 | + $pesquisaPendenciaDTO->setStrSinCredenciais('S'); | ||
| 360 | + $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | ||
| 361 | + $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | ||
| 362 | + $pesquisaPendenciaDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | ||
| 363 | + $arrProcedimentoDTO = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | ||
| 364 | + if($arrProcedimentoDTO){ | ||
| 365 | + $arrAtividadePendenciaDTO = $arrProcedimentoDTO[0]->getArrObjAtividadeDTO(); | ||
| 366 | + } | ||
| 367 | + } | ||
| 368 | + if($arrAtividadePendenciaDTO){ | ||
| 369 | + $atividadePendenciaDTO = $arrAtividadePendenciaDTO[0]; | ||
| 370 | + if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO){ | ||
| 371 | + $processoRemocaoSobrestamento = 'S'; | ||
| 372 | + } | ||
| 373 | + if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_ATENCAO){ | ||
| 374 | + $processoDocumentoIncluidoAssinado = 'S'; | ||
| 375 | + } | ||
| 376 | + if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_PUBLICACAO){ | ||
| 377 | + $processoPublicado = 'S'; | ||
| 367 | } | 378 | } |
| 368 | } | 379 | } |
| 369 | 380 |