Commit 823a7f4be90af4e718c129608f512cf4c9c25d2a
1 parent
34cd36df
Exists in
master
and in
1 other branch
[Feat] Alterando pesquisa de processos para buscar no solar.
Showing
4 changed files
with
476 additions
and
140 deletions
Show diff stats
controlador_ws.php
| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | require_once dirname(__FILE__).'/../../SEI.php'; |
| 7 | 7 | require_once dirname(__FILE__).'/vendor/autoload.php'; |
| 8 | 8 | |
| 9 | - | |
| 10 | 9 | class TokenValidationMiddleware{ |
| 11 | 10 | public function __invoke($request, $response, $next) |
| 12 | 11 | { |
| ... | ... | @@ -369,6 +368,24 @@ $app->group('/api/v1',function(){ |
| 369 | 368 | $this->get('/pesquisar', function($request, $response, $args){ |
| 370 | 369 | /** @var $request Slim\Http\Request */ |
| 371 | 370 | $rn = new MdWsSeiProcedimentoRN(); |
| 371 | + $dto = new MdWsSeiPesquisaProtocoloSolrDTO(); | |
| 372 | + if($request->getParam('grupo')){ | |
| 373 | + $dto->setNumIdGrupoAcompanhamentoProcedimento($request->getParam('grupo')); | |
| 374 | + } | |
| 375 | + if($request->getParam('protocoloPesquisa')){ | |
| 376 | + $dto->setStrProtocoloPesquisa(InfraUtil::retirarFormatacao($request->getParam('protocoloPesquisa'),false)); | |
| 377 | + } | |
| 378 | + if($request->getParam('limit')){ | |
| 379 | + $dto->setNumMaxRegistrosRetorno($request->getParam('limit')); | |
| 380 | + } | |
| 381 | + if(!is_null($request->getParam('start'))){ | |
| 382 | + $dto->setNumPaginaAtual($request->getParam('start')); | |
| 383 | + } | |
| 384 | + | |
| 385 | + return $response->withJSON($rn->pesquisarProcessosSolar($dto)); | |
| 386 | + exit; | |
| 387 | + | |
| 388 | + | |
| 372 | 389 | $dto = new MdWsSeiProtocoloDTO(); |
| 373 | 390 | if($request->getParam('grupo')){ |
| 374 | 391 | $dto->setNumIdGrupoAcompanhamentoProcedimento($request->getParam('grupo')); | ... | ... |
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +<? | |
| 2 | + | |
| 3 | +class MdWsSeiPesquisaProtocoloSolrDTO extends InfraDTO{ | |
| 4 | + | |
| 5 | + public function getStrNomeTabela() { | |
| 6 | + return null; | |
| 7 | + } | |
| 8 | + | |
| 9 | + public function montar() { | |
| 10 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'PalavrasChave'); | |
| 11 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Descricao'); | |
| 12 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Observacao'); | |
| 13 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ProtocoloPesquisa'); | |
| 14 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); | |
| 15 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdSerie'); | |
| 16 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Numero'); | |
| 17 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'StaTipoData'); | |
| 18 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'Inicio'); | |
| 19 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'Fim'); | |
| 20 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdProcedimento'); | |
| 21 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdGrupoAcompanhamentoProcedimento'); | |
| 22 | + } | |
| 23 | +} | |
| 24 | + | |
| 25 | +?> | |
| 0 | 26 | \ No newline at end of file | ... | ... |
rn/MdWsSeiProcedimentoRN.php
| 1 | 1 | <? |
| 2 | -require_once dirname(__FILE__).'/../../../SEI.php'; | |
| 2 | +require_once dirname(__FILE__) . '/../../../SEI.php'; | |
| 3 | 3 | |
| 4 | -class MdWsSeiProcedimentoRN extends InfraRN { | |
| 4 | +class MdWsSeiProcedimentoRN extends InfraRN | |
| 5 | +{ | |
| 5 | 6 | |
| 6 | - protected function inicializarObjInfraIBanco(){ | |
| 7 | + protected function inicializarObjInfraIBanco() | |
| 8 | + { | |
| 7 | 9 | return BancoSEI::getInstance(); |
| 8 | 10 | } |
| 9 | 11 | |
| ... | ... | @@ -12,9 +14,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 12 | 14 | * @param ProtocoloDTO $protocoloDTO |
| 13 | 15 | * @return array |
| 14 | 16 | */ |
| 15 | - protected function listarUnidadesProcessoConectado(ProtocoloDTO $protocoloDTO){ | |
| 16 | - try{ | |
| 17 | - if(!$protocoloDTO->getDblIdProtocolo()){ | |
| 17 | + protected function listarUnidadesProcessoConectado(ProtocoloDTO $protocoloDTO) | |
| 18 | + { | |
| 19 | + try { | |
| 20 | + if (!$protocoloDTO->getDblIdProtocolo()) { | |
| 18 | 21 | throw new InfraException('Protocolo não informado.'); |
| 19 | 22 | } |
| 20 | 23 | $result = array(); |
| ... | ... | @@ -26,7 +29,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 26 | 29 | $relProtocoloProtocoloDTOConsulta->setNumPaginaAtual(0); |
| 27 | 30 | $relProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); |
| 28 | 31 | $ret = $relProtocoloProtocoloRN->listarRN0187($relProtocoloProtocoloDTOConsulta); |
| 29 | - if($ret){ | |
| 32 | + if ($ret) { | |
| 30 | 33 | /** @var RelProtocoloProtocoloDTO $relProtocoloProtocoloDTO */ |
| 31 | 34 | $relProtocoloProtocoloDTO = $ret[0]; |
| 32 | 35 | $result['processo'] = $relProtocoloProtocoloDTO->getDblIdProtocolo1(); |
| ... | ... | @@ -34,7 +37,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | 39 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
| 37 | - }catch (Exception $e){ | |
| 40 | + } catch (Exception $e) { | |
| 38 | 41 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 39 | 42 | } |
| 40 | 43 | } |
| ... | ... | @@ -44,12 +47,13 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 44 | 47 | * @param AtividadeDTO $atividadeDTOParam |
| 45 | 48 | * @return array |
| 46 | 49 | */ |
| 47 | - protected function listarSobrestamentoProcessoConectado(AtividadeDTO $atividadeDTOParam){ | |
| 48 | - try{ | |
| 49 | - if(!$atividadeDTOParam->isSetDblIdProtocolo()){ | |
| 50 | + protected function listarSobrestamentoProcessoConectado(AtividadeDTO $atividadeDTOParam) | |
| 51 | + { | |
| 52 | + try { | |
| 53 | + if (!$atividadeDTOParam->isSetDblIdProtocolo()) { | |
| 50 | 54 | throw new InfraException('Protocolo não informado.'); |
| 51 | 55 | } |
| 52 | - if(!$atividadeDTOParam->isSetNumIdUnidade()){ | |
| 56 | + if (!$atividadeDTOParam->isSetNumIdUnidade()) { | |
| 53 | 57 | $atividadeDTOParam->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| 54 | 58 | } |
| 55 | 59 | |
| ... | ... | @@ -64,7 +68,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 64 | 68 | $ret = $atividadeRN->listarRN0036($atividadeDTOConsulta); |
| 65 | 69 | |
| 66 | 70 | /** @var AtividadeDTO $atividadeDTO */ |
| 67 | - foreach($ret as $atividadeDTO){ | |
| 71 | + foreach ($ret as $atividadeDTO) { | |
| 68 | 72 | $result[] = array( |
| 69 | 73 | 'idAtividade' => $atividadeDTO->getNumIdAtividade(), |
| 70 | 74 | 'idProtocolo' => $atividadeDTO->getDblIdProtocolo(), |
| ... | ... | @@ -77,7 +81,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 77 | 81 | } |
| 78 | 82 | |
| 79 | 83 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
| 80 | - }catch (Exception $e){ | |
| 84 | + } catch (Exception $e) { | |
| 81 | 85 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 82 | 86 | } |
| 83 | 87 | } |
| ... | ... | @@ -87,13 +91,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 87 | 91 | * @param EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI |
| 88 | 92 | * @return array |
| 89 | 93 | */ |
| 90 | - protected function sobrestamentoProcessoControlado(EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI){ | |
| 91 | - try{ | |
| 94 | + protected function sobrestamentoProcessoControlado(EntradaSobrestarProcessoAPI $entradaSobrestarProcessoAPI) | |
| 95 | + { | |
| 96 | + try { | |
| 92 | 97 | $seiRN = new SeiRN(); |
| 93 | 98 | $seiRN->sobrestarProcesso($entradaSobrestarProcessoAPI); |
| 94 | 99 | |
| 95 | 100 | return MdWsSeiRest::formataRetornoSucessoREST('Processo sobrestado com sucesso'); |
| 96 | - }catch (Exception $e){ | |
| 101 | + } catch (Exception $e) { | |
| 97 | 102 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 98 | 103 | } |
| 99 | 104 | } |
| ... | ... | @@ -102,9 +107,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 102 | 107 | * @param $protocolo |
| 103 | 108 | * @return array |
| 104 | 109 | */ |
| 105 | - protected function removerSobrestamentoProcessoControlado(ProcedimentoDTO $procedimentoDTOParam){ | |
| 106 | - try{ | |
| 107 | - if(!$procedimentoDTOParam->getDblIdProcedimento()){ | |
| 110 | + protected function removerSobrestamentoProcessoControlado(ProcedimentoDTO $procedimentoDTOParam) | |
| 111 | + { | |
| 112 | + try { | |
| 113 | + if (!$procedimentoDTOParam->getDblIdProcedimento()) { | |
| 108 | 114 | throw new InfraException('Procedimento n?o informado.'); |
| 109 | 115 | } |
| 110 | 116 | $seiRN = new SeiRN(); |
| ... | ... | @@ -114,7 +120,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 114 | 120 | $seiRN->removerSobrestamentoProcesso($entradaRemoverSobrestamentoProcessoAPI); |
| 115 | 121 | |
| 116 | 122 | return MdWsSeiRest::formataRetornoSucessoREST('Sobrestar cancelado com sucesso.'); |
| 117 | - }catch (Exception $e){ | |
| 123 | + } catch (Exception $e) { | |
| 118 | 124 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 119 | 125 | } |
| 120 | 126 | } |
| ... | ... | @@ -124,29 +130,30 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 124 | 130 | * @param MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOConsulta |
| 125 | 131 | * @return array |
| 126 | 132 | */ |
| 127 | - protected function listarProcedimentoAcompanhamentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) { | |
| 128 | - try{ | |
| 133 | + protected function listarProcedimentoAcompanhamentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) | |
| 134 | + { | |
| 135 | + try { | |
| 129 | 136 | $usuarioAtribuicaoAtividade = null; |
| 130 | 137 | $mdWsSeiProtocoloDTOConsulta = new MdWsSeiProtocoloDTO(); |
| 131 | - if($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()){ | |
| 138 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()) { | |
| 132 | 139 | $mdWsSeiProtocoloDTOConsulta->setNumIdGrupoAcompanhamentoProcedimento($mdWsSeiProtocoloDTOParam->getNumIdGrupoAcompanhamentoProcedimento()); |
| 133 | 140 | } |
| 134 | 141 | |
| 135 | - if(!$mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioGeradorAcompanhamento()){ | |
| 142 | + if (!$mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioGeradorAcompanhamento()) { | |
| 136 | 143 | $mdWsSeiProtocoloDTOConsulta->setNumIdUsuarioGeradorAcompanhamento(SessaoSEI::getInstance()->getNumIdUsuario()); |
| 137 | - }else{ | |
| 144 | + } else { | |
| 138 | 145 | $mdWsSeiProtocoloDTOConsulta->setNumIdUsuarioGeradorAcompanhamento($mdWsSeiProtocoloDTOParam->getNumIdUsuarioGeradorAcompanhamento()); |
| 139 | 146 | } |
| 140 | 147 | |
| 141 | - if(is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | |
| 148 | + if (is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())) { | |
| 142 | 149 | $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual(0); |
| 143 | - }else{ | |
| 150 | + } else { | |
| 144 | 151 | $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); |
| 145 | 152 | } |
| 146 | 153 | |
| 147 | - if(!$mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | |
| 154 | + if (!$mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { | |
| 148 | 155 | $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); |
| 149 | - }else{ | |
| 156 | + } else { | |
| 150 | 157 | $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); |
| 151 | 158 | } |
| 152 | 159 | |
| ... | ... | @@ -163,7 +170,65 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 163 | 170 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); |
| 164 | 171 | |
| 165 | 172 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $mdWsSeiProtocoloDTOConsulta->getNumTotalRegistros()); |
| 166 | - }catch (Exception $e){ | |
| 173 | + } catch (Exception $e) { | |
| 174 | + return MdWsSeiRest::formataRetornoErroREST($e); | |
| 175 | + } | |
| 176 | + } | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * Método que pesquisa todos o procedimentos em todas as unidades | |
| 180 | + * @param MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam | |
| 181 | + * @return array | |
| 182 | + */ | |
| 183 | + protected function pesquisarTodosProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) | |
| 184 | + { | |
| 185 | + try { | |
| 186 | + $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); | |
| 187 | + | |
| 188 | + $usuarioAtribuicaoAtividade = null; | |
| 189 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()) { | |
| 190 | + $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); | |
| 191 | + } | |
| 192 | + | |
| 193 | + if (!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())) { | |
| 194 | + $pesquisaPendenciaDTO->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); | |
| 195 | + } else { | |
| 196 | + $pesquisaPendenciaDTO->setNumPaginaAtual(0); | |
| 197 | + } | |
| 198 | + | |
| 199 | + if ($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { | |
| 200 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); | |
| 201 | + } else { | |
| 202 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno(10); | |
| 203 | + } | |
| 204 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()) { | |
| 205 | + $pesquisaPendenciaDTO->setNumIdGrupoAcompanhamentoProcedimento( | |
| 206 | + $mdWsSeiProtocoloDTOParam->getNumIdGrupoAcompanhamentoProcedimento() | |
| 207 | + ); | |
| 208 | + } | |
| 209 | + if ($mdWsSeiProtocoloDTOParam->isSetStrProtocoloFormatadoPesquisa()) { | |
| 210 | + $strProtocoloFormatado = InfraUtil::retirarFormatacao( | |
| 211 | + $mdWsSeiProtocoloDTOParam->getStrProtocoloFormatadoPesquisa(), false | |
| 212 | + ); | |
| 213 | + $pesquisaPendenciaDTO->setStrProtocoloFormatadoPesquisaProtocolo( | |
| 214 | + '%' . $strProtocoloFormatado . '%', | |
| 215 | + InfraDTO::$OPER_LIKE | |
| 216 | + ); | |
| 217 | + } | |
| 218 | + | |
| 219 | + $atividadeRN = new MdWsSeiAtividadeRN(); | |
| 220 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL, ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 221 | + $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); | |
| 222 | + $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | |
| 223 | + $pesquisaPendenciaDTO->setStrSinCredenciais('S'); | |
| 224 | + $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | |
| 225 | + $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | |
| 226 | + | |
| 227 | + $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); | |
| 228 | + $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); | |
| 229 | + | |
| 230 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); | |
| 231 | + } catch (Exception $e) { | |
| 167 | 232 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 168 | 233 | } |
| 169 | 234 | } |
| ... | ... | @@ -174,37 +239,38 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 174 | 239 | * @param MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam |
| 175 | 240 | * @return array |
| 176 | 241 | */ |
| 177 | - protected function pesquisarProcedimentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) { | |
| 178 | - try{ | |
| 242 | + protected function pesquisarProcedimentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) | |
| 243 | + { | |
| 244 | + try { | |
| 179 | 245 | $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); |
| 180 | 246 | |
| 181 | 247 | $usuarioAtribuicaoAtividade = null; |
| 182 | - if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ | |
| 248 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()) { | |
| 183 | 249 | $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); |
| 184 | 250 | } |
| 185 | 251 | |
| 186 | - if(!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | |
| 252 | + if (!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())) { | |
| 187 | 253 | $pesquisaPendenciaDTO->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); |
| 188 | - }else{ | |
| 254 | + } else { | |
| 189 | 255 | $pesquisaPendenciaDTO->setNumPaginaAtual(0); |
| 190 | 256 | } |
| 191 | 257 | |
| 192 | - if($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | |
| 258 | + if ($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { | |
| 193 | 259 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); |
| 194 | - }else{ | |
| 260 | + } else { | |
| 195 | 261 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno(10); |
| 196 | 262 | } |
| 197 | - if($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()){ | |
| 263 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()) { | |
| 198 | 264 | $pesquisaPendenciaDTO->setNumIdGrupoAcompanhamentoProcedimento( |
| 199 | 265 | $mdWsSeiProtocoloDTOParam->getNumIdGrupoAcompanhamentoProcedimento() |
| 200 | 266 | ); |
| 201 | 267 | } |
| 202 | - if($mdWsSeiProtocoloDTOParam->isSetStrProtocoloFormatadoPesquisa()){ | |
| 268 | + if ($mdWsSeiProtocoloDTOParam->isSetStrProtocoloFormatadoPesquisa()) { | |
| 203 | 269 | $strProtocoloFormatado = InfraUtil::retirarFormatacao( |
| 204 | 270 | $mdWsSeiProtocoloDTOParam->getStrProtocoloFormatadoPesquisa(), false |
| 205 | 271 | ); |
| 206 | 272 | $pesquisaPendenciaDTO->setStrProtocoloFormatadoPesquisaProtocolo( |
| 207 | - '%'.$strProtocoloFormatado.'%', | |
| 273 | + '%' . $strProtocoloFormatado . '%', | |
| 208 | 274 | InfraDTO::$OPER_LIKE |
| 209 | 275 | ); |
| 210 | 276 | } |
| ... | ... | @@ -212,7 +278,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 212 | 278 | $atividadeRN = new MdWsSeiAtividadeRN(); |
| 213 | 279 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
| 214 | 280 | $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| 215 | - $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 281 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL, ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 216 | 282 | $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); |
| 217 | 283 | $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); |
| 218 | 284 | $pesquisaPendenciaDTO->setStrSinCredenciais('S'); |
| ... | ... | @@ -223,7 +289,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 223 | 289 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); |
| 224 | 290 | |
| 225 | 291 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); |
| 226 | - }catch (Exception $e){ | |
| 292 | + } catch (Exception $e) { | |
| 227 | 293 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 228 | 294 | } |
| 229 | 295 | } |
| ... | ... | @@ -233,53 +299,54 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 233 | 299 | * @param MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTO |
| 234 | 300 | * @return array |
| 235 | 301 | */ |
| 236 | - protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam){ | |
| 237 | - try{ | |
| 302 | + protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) | |
| 303 | + { | |
| 304 | + try { | |
| 238 | 305 | $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); |
| 239 | 306 | |
| 240 | 307 | $usuarioAtribuicaoAtividade = null; |
| 241 | - if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ | |
| 308 | + if ($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()) { | |
| 242 | 309 | $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); |
| 243 | 310 | } |
| 244 | 311 | |
| 245 | - if(!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | |
| 312 | + if (!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())) { | |
| 246 | 313 | $pesquisaPendenciaDTO->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); |
| 247 | - }else{ | |
| 314 | + } else { | |
| 248 | 315 | $pesquisaPendenciaDTO->setNumPaginaAtual(0); |
| 249 | 316 | } |
| 250 | 317 | |
| 251 | - if($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | |
| 318 | + if ($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()) { | |
| 252 | 319 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); |
| 253 | - }else{ | |
| 320 | + } else { | |
| 254 | 321 | $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno(10); |
| 255 | 322 | } |
| 256 | - if($mdWsSeiProtocoloDTOParam->getStrSinApenasMeus() == 'S'){ | |
| 323 | + if ($mdWsSeiProtocoloDTOParam->getStrSinApenasMeus() == 'S') { | |
| 257 | 324 | $pesquisaPendenciaDTO->setStrStaTipoAtribuicao('M'); |
| 258 | 325 | } |
| 259 | 326 | |
| 260 | 327 | $atividadeRN = new MdWsSeiAtividadeRN(); |
| 261 | 328 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
| 262 | 329 | $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| 263 | - $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 330 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL, ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 264 | 331 | $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); |
| 265 | 332 | $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); |
| 266 | 333 | $pesquisaPendenciaDTO->setStrSinCredenciais('S'); |
| 267 | 334 | $pesquisaPendenciaDTO->setStrSinSituacoes('S'); |
| 268 | 335 | $pesquisaPendenciaDTO->setStrSinMarcadores('S'); |
| 269 | 336 | |
| 270 | - if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_R){ | |
| 337 | + if ($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_R) { | |
| 271 | 338 | $pesquisaPendenciaDTO->setStrSinInicial('N'); |
| 272 | 339 | $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
| 273 | - }else if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G){ | |
| 340 | + } else if ($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G) { | |
| 274 | 341 | $pesquisaPendenciaDTO->setStrSinInicial('S'); |
| 275 | 342 | $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
| 276 | - }else{ | |
| 343 | + } else { | |
| 277 | 344 | throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); |
| 278 | 345 | } |
| 279 | 346 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); |
| 280 | 347 | |
| 281 | 348 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); |
| 282 | - }catch (Exception $e){ | |
| 349 | + } catch (Exception $e) { | |
| 283 | 350 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 284 | 351 | } |
| 285 | 352 | |
| ... | ... | @@ -291,11 +358,11 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 291 | 358 | * @param null $usuarioAtribuicaoAtividade |
| 292 | 359 | * @return array |
| 293 | 360 | */ |
| 294 | - private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null){ | |
| 295 | - | |
| 361 | + private function montaRetornoListagemProcessos(array $ret, $usuarioAtribuicaoAtividade = null) | |
| 362 | + { | |
| 296 | 363 | $result = array(); |
| 297 | 364 | $protocoloRN = new ProtocoloRN(); |
| 298 | - foreach($ret as $dto){ | |
| 365 | + foreach ($ret as $dto) { | |
| 299 | 366 | $usuarioAtribuido = null; |
| 300 | 367 | $documentoNovo = 'N'; |
| 301 | 368 | $documentoPublicado = 'N'; |
| ... | ... | @@ -308,7 +375,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 308 | 375 | $arrDadosAbertura = array(); |
| 309 | 376 | $procedimentoDTO = null; |
| 310 | 377 | $protocoloDTO = new MdWsSeiProtocoloDTO(); |
| 311 | - if($dto instanceof ProcedimentoDTO){ | |
| 378 | + if ($dto instanceof ProcedimentoDTO) { | |
| 312 | 379 | $protocoloDTO = new MdWsSeiProtocoloDTO(); |
| 313 | 380 | $protocoloDTO->setDblIdProtocolo($dto->getDblIdProcedimento()); |
| 314 | 381 | $protocoloDTO->retDblIdProtocolo(); |
| ... | ... | @@ -324,7 +391,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 324 | 391 | $protocoloDTO->retStrSinCienciaProcedimento(); |
| 325 | 392 | $protocoloDTO->retStrStaEstado(); |
| 326 | 393 | $protocoloDTO = $protocoloRN->consultarRN0186($protocoloDTO); |
| 327 | - }else{ | |
| 394 | + } else { | |
| 328 | 395 | $protocoloDTO = $dto; |
| 329 | 396 | } |
| 330 | 397 | |
| ... | ... | @@ -347,25 +414,25 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 347 | 414 | $atividadeDTOConsulta->setOrdNumIdAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); |
| 348 | 415 | |
| 349 | 416 | $arrAtividades = $atividadeRN->listarRN0036($atividadeDTOConsulta); |
| 350 | - if($arrAtividades){ | |
| 417 | + if ($arrAtividades) { | |
| 351 | 418 | /** @var AtividadeDTO $atividadeDTO */ |
| 352 | 419 | $atividadeDTO = $arrAtividades[0]; |
| 353 | 420 | $documentoNovo = $atividadeDTO->getNumIdTarefa() == 1 ? 'S' : 'N'; |
| 354 | 421 | $usuarioAtribuido = $atividadeDTO->getStrNomeUsuarioAtribuicao(); |
| 355 | 422 | $tipoVisualizacao = $atividadeDTO->getNumTipoVisualizacao() == 0 ? 'S' : 'N'; |
| 356 | - if($atividadeDTO->getNumIdUsuarioVisualizacao() == $usuarioAtribuicaoAtividade){ | |
| 423 | + if ($atividadeDTO->getNumIdUsuarioVisualizacao() == $usuarioAtribuicaoAtividade) { | |
| 357 | 424 | $usuarioVisualizacao = 'S'; |
| 358 | 425 | } |
| 359 | 426 | } |
| 360 | 427 | $arrAtividadePendenciaDTO = array(); |
| 361 | - if($dto instanceof ProcedimentoDTO){ | |
| 428 | + if ($dto instanceof ProcedimentoDTO) { | |
| 362 | 429 | $procedimentoDTO = $dto; |
| 363 | 430 | $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); |
| 364 | - }else{ | |
| 365 | - $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | |
| 431 | + } else { | |
| 432 | + $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); | |
| 366 | 433 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
| 367 | 434 | $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| 368 | - $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 435 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL, ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | |
| 369 | 436 | $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); |
| 370 | 437 | $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); |
| 371 | 438 | $pesquisaPendenciaDTO->setStrSinCredenciais('S'); |
| ... | ... | @@ -373,20 +440,20 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 373 | 440 | $pesquisaPendenciaDTO->setStrSinMarcadores('S'); |
| 374 | 441 | $pesquisaPendenciaDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); |
| 375 | 442 | $arrProcedimentoDTO = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
| 376 | - if($arrProcedimentoDTO){ | |
| 443 | + if ($arrProcedimentoDTO) { | |
| 377 | 444 | $procedimentoDTO = $arrProcedimentoDTO[0]; |
| 378 | 445 | $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); |
| 379 | 446 | } |
| 380 | 447 | } |
| 381 | - if($arrAtividadePendenciaDTO){ | |
| 448 | + if ($arrAtividadePendenciaDTO) { | |
| 382 | 449 | $atividadePendenciaDTO = $arrAtividadePendenciaDTO[0]; |
| 383 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO){ | |
| 450 | + if ($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_REMOCAO_SOBRESTAMENTO) { | |
| 384 | 451 | $processoRemocaoSobrestamento = 'S'; |
| 385 | 452 | } |
| 386 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_ATENCAO){ | |
| 453 | + if ($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_ATENCAO) { | |
| 387 | 454 | $processoDocumentoIncluidoAssinado = 'S'; |
| 388 | 455 | } |
| 389 | - if($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_PUBLICACAO){ | |
| 456 | + if ($atividadePendenciaDTO->getNumTipoVisualizacao() & AtividadeRN::$TV_PUBLICACAO) { | |
| 390 | 457 | $processoPublicado = 'S'; |
| 391 | 458 | } |
| 392 | 459 | $retornoProgramadoDTOConsulta = new RetornoProgramadoDTO(); |
| ... | ... | @@ -399,12 +466,12 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 399 | 466 | $retornoProgramadoDTOConsulta->setNumIdAtividadeRetorno(null); |
| 400 | 467 | $objRetornoProgramadoRN = new RetornoProgramadoRN(); |
| 401 | 468 | $arrRetornoProgramadoDTO = $objRetornoProgramadoRN->listar($retornoProgramadoDTOConsulta); |
| 402 | - if($arrRetornoProgramadoDTO){ | |
| 469 | + if ($arrRetornoProgramadoDTO) { | |
| 403 | 470 | $retornoProgramado = 'S'; |
| 404 | 471 | $strDataAtual = InfraData::getStrDataAtual(); |
| 405 | - foreach($arrRetornoProgramadoDTO as $retornoProgramadoDTO){ | |
| 406 | - $numPrazo = InfraData::compararDatas($strDataAtual,$retornoProgramadoDTO->getDtaProgramada()); | |
| 407 | - if($numPrazo < 0){ | |
| 472 | + foreach ($arrRetornoProgramadoDTO as $retornoProgramadoDTO) { | |
| 473 | + $numPrazo = InfraData::compararDatas($strDataAtual, $retornoProgramadoDTO->getDtaProgramada()); | |
| 474 | + if ($numPrazo < 0) { | |
| 408 | 475 | $retornoAtrasado = 'S'; |
| 409 | 476 | $retornoData = array( |
| 410 | 477 | 'date' => $retornoProgramadoDTO->getDtaProgramada(), |
| ... | ... | @@ -421,10 +488,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 421 | 488 | $documentoDTOConsulta->setDblIdProcedimento($protocoloDTO->getDblIdProtocolo()); |
| 422 | 489 | $documentoDTOConsulta->retDblIdDocumento(); |
| 423 | 490 | $arrDocumentos = $documentoRN->listarRN0008($documentoDTOConsulta); |
| 424 | - if($arrDocumentos){ | |
| 491 | + if ($arrDocumentos) { | |
| 425 | 492 | $arrIdDocumentos = array(); |
| 426 | 493 | /** @var DocumentoDTO $documentoDTO */ |
| 427 | - foreach($arrDocumentos as $documentoDTO){ | |
| 494 | + foreach ($arrDocumentos as $documentoDTO) { | |
| 428 | 495 | $arrIdDocumentos[] = $documentoDTO->getDblIdDocumento(); |
| 429 | 496 | } |
| 430 | 497 | $publiacaoRN = new PublicacaoRN(); |
| ... | ... | @@ -454,15 +521,15 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 454 | 521 | //$anotacaoDTOConsulta->setNumIdUnidade($protocoloDTO->getNumIdUnidadeGeradora()); |
| 455 | 522 | $arrAnotacao = $anotacaoRN->listar($anotacaoDTOConsulta); |
| 456 | 523 | $possuiAnotacao = count($arrAnotacao) ? 'S' : 'N'; |
| 457 | - foreach($arrAnotacao as $anotacaoDTO){ | |
| 458 | - if($anotacaoDTO->getStrSinPrioridade() == 'S'){ | |
| 524 | + foreach ($arrAnotacao as $anotacaoDTO) { | |
| 525 | + if ($anotacaoDTO->getStrSinPrioridade() == 'S') { | |
| 459 | 526 | $possuiAnotacaoPrioridade = 'S'; |
| 460 | 527 | break; |
| 461 | 528 | } |
| 462 | 529 | } |
| 463 | 530 | $resultAnotacao = array(); |
| 464 | 531 | /** @var AnotacaoDTO $anotacaoDTO */ |
| 465 | - foreach($arrAnotacao as $anotacaoDTO){ | |
| 532 | + foreach ($arrAnotacao as $anotacaoDTO) { | |
| 466 | 533 | $resultAnotacao[] = array( |
| 467 | 534 | 'idAnotacao' => $anotacaoDTO->getNumIdAnotacao(), |
| 468 | 535 | 'idProtocolo' => $anotacaoDTO->getDblIdProtocolo(), |
| ... | ... | @@ -474,14 +541,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 474 | 541 | 'staAnotacao' => $anotacaoDTO->getStrStaAnotacao() |
| 475 | 542 | ); |
| 476 | 543 | } |
| 477 | - if($procedimentoDTO && $procedimentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_PROCEDIMENTO_ANEXADO){ | |
| 544 | + if ($procedimentoDTO && $procedimentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_PROCEDIMENTO_ANEXADO) { | |
| 478 | 545 | $ret = $this->listarUnidadeAberturaProcedimento($procedimentoDTO); |
| 479 | - if(!$ret['sucesso']){ | |
| 546 | + if (!$ret['sucesso']) { | |
| 480 | 547 | throw new Exception($ret['mensagem']); |
| 481 | 548 | } |
| 482 | 549 | $arrDadosAbertura = $ret['data']; |
| 483 | 550 | } |
| 484 | - | |
| 551 | + | |
| 485 | 552 | $result[] = array( |
| 486 | 553 | 'id' => $protocoloDTO->getDblIdProtocolo(), |
| 487 | 554 | 'status' => $protocoloDTO->getStrStaProtocolo(), |
| ... | ... | @@ -526,9 +593,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 526 | 593 | |
| 527 | 594 | return $result; |
| 528 | 595 | } |
| 529 | - | |
| 530 | - protected function listarUnidadeAberturaProcedimentoConectado(ProcedimentoDTO $procedimentoDTO){ | |
| 531 | - try{ | |
| 596 | + | |
| 597 | + protected function listarUnidadeAberturaProcedimentoConectado(ProcedimentoDTO $procedimentoDTO) | |
| 598 | + { | |
| 599 | + try { | |
| 532 | 600 | $result = array(); |
| 533 | 601 | $atividadeRN = new MdWsSeiAtividadeRN(); |
| 534 | 602 | $strStaNivelAcessoGlobal = $procedimentoDTO->getStrStaNivelAcessoGlobalProtocolo(); |
| ... | ... | @@ -573,14 +641,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 573 | 641 | $atividadeDTO->setNumIdUsuario(InfraArray::converterArrInfraDTO($arrAcessoDTO, 'IdUsuario'), InfraDTO::$OPER_IN); |
| 574 | 642 | } |
| 575 | 643 | $arrAtividadeDTO = $atividadeRN->listarRN0036($atividadeDTO); |
| 576 | - | |
| 644 | + | |
| 577 | 645 | if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { |
| 578 | 646 | $arrAtividadeDTO = InfraArray::distinctArrInfraDTO($arrAtividadeDTO, 'SiglaUnidade'); |
| 579 | 647 | } |
| 580 | 648 | if (count($arrAtividadeDTO) == 0) { |
| 581 | 649 | $result['info'] = 'Processo não possui andamentos abertos.'; |
| 582 | 650 | $result['lista'] = array(); |
| 583 | - }else{ | |
| 651 | + } else { | |
| 584 | 652 | if (count($arrAtividadeDTO) == 1) { |
| 585 | 653 | $atividadeDTO = $arrAtividadeDTO[0]; |
| 586 | 654 | if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { |
| ... | ... | @@ -601,7 +669,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 601 | 669 | foreach ($arrAtividadeDTO as $atividadeDTO) { |
| 602 | 670 | $sigla = $atividadeDTO->getStrSiglaUnidade(); |
| 603 | 671 | if ($atividadeDTO->getNumIdUsuarioAtribuicao() != null) { |
| 604 | - $sigla .= ' (atribuído a '.$atividadeDTO->getStrNomeUsuarioAtribuicao().')'; | |
| 672 | + $sigla .= ' (atribuído a ' . $atividadeDTO->getStrNomeUsuarioAtribuicao() . ')'; | |
| 605 | 673 | } |
| 606 | 674 | $result['lista'][] = array( |
| 607 | 675 | 'sigla' => $sigla |
| ... | ... | @@ -610,7 +678,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 610 | 678 | } else { |
| 611 | 679 | $result['info'] = 'Processo aberto com os usuários:'; |
| 612 | 680 | foreach ($arrAtividadeDTO as $atividadeDTO) { |
| 613 | - $sigla = $atividadeDTO->getStrNomeUsuario().' na unidade '.$atividadeDTO->getStrSiglaUnidade(); | |
| 681 | + $sigla = $atividadeDTO->getStrNomeUsuario() . ' na unidade ' . $atividadeDTO->getStrSiglaUnidade(); | |
| 614 | 682 | $result['lista'][] = array( |
| 615 | 683 | 'sigla' => $sigla |
| 616 | 684 | ); |
| ... | ... | @@ -618,9 +686,9 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 618 | 686 | } |
| 619 | 687 | } |
| 620 | 688 | } |
| 621 | - | |
| 689 | + | |
| 622 | 690 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
| 623 | - }catch (Exception $e){ | |
| 691 | + } catch (Exception $e) { | |
| 624 | 692 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 625 | 693 | } |
| 626 | 694 | } |
| ... | ... | @@ -630,9 +698,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 630 | 698 | * @param ProtocoloDTO $protocoloDTOParam |
| 631 | 699 | * @return array |
| 632 | 700 | */ |
| 633 | - protected function listarCienciaProcessoConectado(ProtocoloDTO $protocoloDTOParam){ | |
| 634 | - try{ | |
| 635 | - if(!$protocoloDTOParam->isSetDblIdProtocolo()){ | |
| 701 | + protected function listarCienciaProcessoConectado(ProtocoloDTO $protocoloDTOParam) | |
| 702 | + { | |
| 703 | + try { | |
| 704 | + if (!$protocoloDTOParam->isSetDblIdProtocolo()) { | |
| 636 | 705 | throw new InfraException('Protocolo não informado.'); |
| 637 | 706 | } |
| 638 | 707 | |
| ... | ... | @@ -649,7 +718,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 649 | 718 | $atividadeRN = new AtividadeRN(); |
| 650 | 719 | $ret = $atividadeRN->listarRN0036($atividadeDTOConsulta); |
| 651 | 720 | /** @var AtividadeDTO $atividadeDTO */ |
| 652 | - foreach($ret as $atividadeDTO){ | |
| 721 | + foreach ($ret as $atividadeDTO) { | |
| 653 | 722 | $mdWsSeiProcessoDTO = new MdWsSeiProcessoDTO(); |
| 654 | 723 | $mdWsSeiProcessoDTO->setStrTemplate($atividadeDTO->getStrNomeTarefa()); |
| 655 | 724 | $mdWsSeiProcessoDTO->setNumIdAtividade($atividadeDTO->getNumIdAtividade()); |
| ... | ... | @@ -662,7 +731,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 662 | 731 | } |
| 663 | 732 | |
| 664 | 733 | return MdWsSeiRest::formataRetornoSucessoREST(null, $result); |
| 665 | - }catch (Exception $e){ | |
| 734 | + } catch (Exception $e) { | |
| 666 | 735 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 667 | 736 | } |
| 668 | 737 | } |
| ... | ... | @@ -674,9 +743,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 674 | 743 | * @info E obrigatorio informar o id do procedimento |
| 675 | 744 | * @return array |
| 676 | 745 | */ |
| 677 | - protected function darCienciaControlado(ProcedimentoDTO $procedimentoDTOParam){ | |
| 678 | - try{ | |
| 679 | - if(!$procedimentoDTOParam->isSetDblIdProcedimento()){ | |
| 746 | + protected function darCienciaControlado(ProcedimentoDTO $procedimentoDTOParam) | |
| 747 | + { | |
| 748 | + try { | |
| 749 | + if (!$procedimentoDTOParam->isSetDblIdProcedimento()) { | |
| 680 | 750 | throw new InfraException('E obrigatorio informar o procedimento!'); |
| 681 | 751 | } |
| 682 | 752 | |
| ... | ... | @@ -684,7 +754,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 684 | 754 | $procedimentoRN->darCiencia($procedimentoDTOParam); |
| 685 | 755 | |
| 686 | 756 | return MdWsSeiRest::formataRetornoSucessoREST('Ciência processo realizado com sucesso!'); |
| 687 | - }catch (Exception $e){ | |
| 757 | + } catch (Exception $e) { | |
| 688 | 758 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 689 | 759 | } |
| 690 | 760 | } |
| ... | ... | @@ -695,9 +765,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 695 | 765 | * @info ele recebe o número do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo |
| 696 | 766 | * @return array |
| 697 | 767 | */ |
| 698 | - protected function concluirProcessoControlado(EntradaConcluirProcessoAPI $entradaConcluirProcessoAPI){ | |
| 699 | - try{ | |
| 700 | - if(!$entradaConcluirProcessoAPI->getProtocoloProcedimento()){ | |
| 768 | + protected function concluirProcessoControlado(EntradaConcluirProcessoAPI $entradaConcluirProcessoAPI) | |
| 769 | + { | |
| 770 | + try { | |
| 771 | + if (!$entradaConcluirProcessoAPI->getProtocoloProcedimento()) { | |
| 701 | 772 | throw new InfraException('E obrigtorio informar o protocolo do procedimento!'); |
| 702 | 773 | } |
| 703 | 774 | |
| ... | ... | @@ -705,7 +776,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 705 | 776 | $objSeiRN->concluirProcesso($entradaConcluirProcessoAPI); |
| 706 | 777 | |
| 707 | 778 | return MdWsSeiRest::formataRetornoSucessoREST('Processo concluído com sucesso!'); |
| 708 | - }catch (Exception $e){ | |
| 779 | + } catch (Exception $e) { | |
| 709 | 780 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 710 | 781 | } |
| 711 | 782 | } |
| ... | ... | @@ -717,12 +788,13 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 717 | 788 | * recebe o n?mero do ProtocoloProcedimentoFormatadoPesquisa da tabela protocolo |
| 718 | 789 | * @return array |
| 719 | 790 | */ |
| 720 | - protected function atribuirProcessoControlado(EntradaAtribuirProcessoAPI $entradaAtribuirProcessoAPI){ | |
| 721 | - try{ | |
| 722 | - if(!$entradaAtribuirProcessoAPI->getProtocoloProcedimento()){ | |
| 791 | + protected function atribuirProcessoControlado(EntradaAtribuirProcessoAPI $entradaAtribuirProcessoAPI) | |
| 792 | + { | |
| 793 | + try { | |
| 794 | + if (!$entradaAtribuirProcessoAPI->getProtocoloProcedimento()) { | |
| 723 | 795 | throw new InfraException('E obrigatorio informar o protocolo do processo!'); |
| 724 | 796 | } |
| 725 | - if(!$entradaAtribuirProcessoAPI->getIdUsuario()){ | |
| 797 | + if (!$entradaAtribuirProcessoAPI->getIdUsuario()) { | |
| 726 | 798 | throw new InfraException('E obrigatorio informar o usu?rio do processo!'); |
| 727 | 799 | } |
| 728 | 800 | |
| ... | ... | @@ -730,7 +802,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 730 | 802 | $objSeiRN->atribuirProcesso($entradaAtribuirProcessoAPI); |
| 731 | 803 | |
| 732 | 804 | return MdWsSeiRest::formataRetornoSucessoREST('Processo atribuído com sucesso!'); |
| 733 | - }catch (Exception $e){ | |
| 805 | + } catch (Exception $e) { | |
| 734 | 806 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 735 | 807 | } |
| 736 | 808 | } |
| ... | ... | @@ -740,35 +812,36 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 740 | 812 | * @param array $post |
| 741 | 813 | * @return EntradaEnviarProcessoAPI |
| 742 | 814 | */ |
| 743 | - public function encapsulaEnviarProcessoEntradaEnviarProcessoAPI(array $post){ | |
| 815 | + public function encapsulaEnviarProcessoEntradaEnviarProcessoAPI(array $post) | |
| 816 | + { | |
| 744 | 817 | $entradaEnviarProcessoAPI = new EntradaEnviarProcessoAPI(); |
| 745 | - if(isset($post['numeroProcesso'])){ | |
| 818 | + if (isset($post['numeroProcesso'])) { | |
| 746 | 819 | $entradaEnviarProcessoAPI->setProtocoloProcedimento($post['numeroProcesso']); |
| 747 | 820 | } |
| 748 | - if(isset($post['unidadesDestino'])){ | |
| 821 | + if (isset($post['unidadesDestino'])) { | |
| 749 | 822 | $entradaEnviarProcessoAPI->setUnidadesDestino(explode(',', $post['unidadesDestino'])); |
| 750 | 823 | } |
| 751 | - if(isset($post['sinManterAbertoUnidade'])){ | |
| 824 | + if (isset($post['sinManterAbertoUnidade'])) { | |
| 752 | 825 | $entradaEnviarProcessoAPI->setSinManterAbertoUnidade($post['sinManterAbertoUnidade']); |
| 753 | 826 | } |
| 754 | - if(isset($post['sinRemoverAnotacao'])){ | |
| 827 | + if (isset($post['sinRemoverAnotacao'])) { | |
| 755 | 828 | $entradaEnviarProcessoAPI->setSinRemoverAnotacao($post['sinRemoverAnotacao']); |
| 756 | 829 | } |
| 757 | - if(isset($post['sinEnviarEmailNotificacao'])){ | |
| 830 | + if (isset($post['sinEnviarEmailNotificacao'])) { | |
| 758 | 831 | $entradaEnviarProcessoAPI->setSinEnviarEmailNotificacao($post['sinEnviarEmailNotificacao']); |
| 759 | - }else{ | |
| 832 | + } else { | |
| 760 | 833 | $entradaEnviarProcessoAPI->setSinEnviarEmailNotificacao('N'); |
| 761 | 834 | } |
| 762 | - if(isset($post['dataRetornoProgramado'])){ | |
| 835 | + if (isset($post['dataRetornoProgramado'])) { | |
| 763 | 836 | $entradaEnviarProcessoAPI->setDataRetornoProgramado($post['dataRetornoProgramado']); |
| 764 | 837 | } |
| 765 | - if(isset($post['diasRetornoProgramado'])){ | |
| 838 | + if (isset($post['diasRetornoProgramado'])) { | |
| 766 | 839 | $entradaEnviarProcessoAPI->setDiasRetornoProgramado($post['diasRetornoProgramado']); |
| 767 | 840 | } |
| 768 | - if(isset($post['sinDiasUteisRetornoProgramado'])){ | |
| 841 | + if (isset($post['sinDiasUteisRetornoProgramado'])) { | |
| 769 | 842 | $entradaEnviarProcessoAPI->setSinDiasUteisRetornoProgramado($post['sinDiasUteisRetornoProgramado']); |
| 770 | 843 | } |
| 771 | - if(isset($post['sinReabrir'])){ | |
| 844 | + if (isset($post['sinReabrir'])) { | |
| 772 | 845 | $entradaEnviarProcessoAPI->setSinReabrir($post['sinReabrir']); |
| 773 | 846 | } |
| 774 | 847 | |
| ... | ... | @@ -781,13 +854,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 781 | 854 | * @info Metodo auxiliar para encapsular dados encapsulaEnviarProcessoEntradaEnviarProcessoAPI |
| 782 | 855 | * @return array |
| 783 | 856 | */ |
| 784 | - protected function enviarProcessoControlado(EntradaEnviarProcessoAPI $entradaEnviarProcessoAPI){ | |
| 785 | - try{ | |
| 857 | + protected function enviarProcessoControlado(EntradaEnviarProcessoAPI $entradaEnviarProcessoAPI) | |
| 858 | + { | |
| 859 | + try { | |
| 786 | 860 | $objSeiRN = new SeiRN(); |
| 787 | 861 | $objSeiRN->enviarProcesso($entradaEnviarProcessoAPI); |
| 788 | 862 | |
| 789 | 863 | return MdWsSeiRest::formataRetornoSucessoREST('Processo enviado com sucesso!'); |
| 790 | - }catch (Exception $e){ | |
| 864 | + } catch (Exception $e) { | |
| 791 | 865 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 792 | 866 | } |
| 793 | 867 | } |
| ... | ... | @@ -798,8 +872,9 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 798 | 872 | * - Se acesso liberado e chamar autenticação for false, o usuário não pode de jeito nenhum visualizar o processo/documento |
| 799 | 873 | * @return array |
| 800 | 874 | */ |
| 801 | - protected function verificaAcessoConectado(ProtocoloDTO $protocoloDTOParam){ | |
| 802 | - try{ | |
| 875 | + protected function verificaAcessoConectado(ProtocoloDTO $protocoloDTOParam) | |
| 876 | + { | |
| 877 | + try { | |
| 803 | 878 | $acessoLiberado = false; |
| 804 | 879 | $chamarAutenticacao = false; |
| 805 | 880 | $protocoloRN = new ProtocoloRN(); |
| ... | ... | @@ -808,10 +883,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 808 | 883 | $protocoloDTO->retStrStaNivelAcessoGlobal(); |
| 809 | 884 | $protocoloDTO->retDblIdProtocolo(); |
| 810 | 885 | $protocoloDTO = $protocoloRN->consultarRN0186($protocoloDTO); |
| 811 | - if(!$protocoloDTO){ | |
| 886 | + if (!$protocoloDTO) { | |
| 812 | 887 | throw new Exception('Processo não encontrado!'); |
| 813 | 888 | } |
| 814 | - if($protocoloDTO->getStrStaNivelAcessoGlobal() == ProtocoloRN::$NA_SIGILOSO){ | |
| 889 | + if ($protocoloDTO->getStrStaNivelAcessoGlobal() == ProtocoloRN::$NA_SIGILOSO) { | |
| 815 | 890 | $objPesquisaProtocoloDTO = new PesquisaProtocoloDTO(); |
| 816 | 891 | $objPesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_PROCEDIMENTOS); |
| 817 | 892 | $objPesquisaProtocoloDTO->setStrStaAcesso(ProtocoloRN::$TAP_AUTORIZADO); |
| ... | ... | @@ -819,10 +894,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 819 | 894 | |
| 820 | 895 | $objProtocoloRN = new ProtocoloRN(); |
| 821 | 896 | $arrProtocoloDTO = $objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO); |
| 822 | - if($arrProtocoloDTO){ | |
| 897 | + if ($arrProtocoloDTO) { | |
| 823 | 898 | $chamarAutenticacao = true; |
| 824 | 899 | } |
| 825 | - }else{ | |
| 900 | + } else { | |
| 826 | 901 | $acessoLiberado = true; |
| 827 | 902 | $chamarAutenticacao = false; |
| 828 | 903 | } |
| ... | ... | @@ -832,7 +907,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 832 | 907 | array('acessoLiberado' => $acessoLiberado, 'chamarAutenticacao' => $chamarAutenticacao) |
| 833 | 908 | ); |
| 834 | 909 | |
| 835 | - }catch (Exception $e){ | |
| 910 | + } catch (Exception $e) { | |
| 836 | 911 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 837 | 912 | } |
| 838 | 913 | } |
| ... | ... | @@ -843,30 +918,249 @@ class MdWsSeiProcedimentoRN extends InfraRN { |
| 843 | 918 | * @param ProtocoloDTO $protocoloDTO |
| 844 | 919 | * @return array |
| 845 | 920 | */ |
| 846 | - public function apiIdentificacaoAcesso(UsuarioDTO $usuarioDTO, ProtocoloDTO $protocoloDTO){ | |
| 847 | - try{ | |
| 921 | + public function apiIdentificacaoAcesso(UsuarioDTO $usuarioDTO, ProtocoloDTO $protocoloDTO) | |
| 922 | + { | |
| 923 | + try { | |
| 848 | 924 | $objInfraSip = new InfraSip(SessaoSEI::getInstance()); |
| 849 | 925 | $objInfraSip->autenticar(SessaoSEI::getInstance()->getNumIdOrgaoUsuario(), null, SessaoSEI::getInstance()->getStrSiglaUsuario(), $usuarioDTO->getStrSenha()); |
| 850 | 926 | AuditoriaSEI::getInstance()->auditar('usuario_validar_acesso'); |
| 851 | 927 | $ret = $this->verificaAcesso($protocoloDTO); |
| 852 | - if(!$ret['sucesso']){ | |
| 928 | + if (!$ret['sucesso']) { | |
| 853 | 929 | return $ret; |
| 854 | 930 | } |
| 855 | 931 | $acessoAutorizado = false; |
| 856 | - if($ret['data']['acessoLiberado'] || $ret['data']['chamarAutenticacao']){ | |
| 932 | + if ($ret['data']['acessoLiberado'] || $ret['data']['chamarAutenticacao']) { | |
| 857 | 933 | $acessoAutorizado = true; |
| 858 | 934 | } |
| 859 | 935 | |
| 860 | 936 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('acessoAutorizado' => $acessoAutorizado)); |
| 861 | - }catch (InfraException $e){ | |
| 937 | + } catch (InfraException $e) { | |
| 862 | 938 | $infraValidacaoDTO = $e->getArrObjInfraValidacao()[0]; |
| 863 | 939 | $eAuth = new Exception($infraValidacaoDTO->getStrDescricao(), $e->getCode(), $e); |
| 864 | 940 | return MdWsSeiRest::formataRetornoErroREST($eAuth); |
| 865 | - }catch (Exception $e){ | |
| 941 | + } catch (Exception $e) { | |
| 866 | 942 | return MdWsSeiRest::formataRetornoErroREST($e); |
| 867 | 943 | } |
| 868 | 944 | } |
| 869 | 945 | |
| 946 | + /** | |
| 947 | + * Método que consulta os processos no Solar | |
| 948 | + * @param MdWsSeiPesquisaProtocoloSolrDTO $pesquisaProtocoloSolrDTO | |
| 949 | + * @return array | |
| 950 | + */ | |
| 951 | + protected function pesquisarProcessosSolarConectado(MdWsSeiPesquisaProtocoloSolrDTO $pesquisaProtocoloSolrDTO) | |
| 952 | + { | |
| 953 | + try { | |
| 954 | + $partialfields = ''; | |
| 955 | + | |
| 956 | + if ($pesquisaProtocoloSolrDTO->isSetStrDescricao() && $pesquisaProtocoloSolrDTO->getStrDescricao() != null) { | |
| 957 | + if ($partialfields != '') { | |
| 958 | + $partialfields .= ' AND '; | |
| 959 | + } | |
| 960 | + $partialfields .= '(' . SolrUtil::formatarOperadores($pesquisaProtocoloSolrDTO->getStrDescricao(), 'desc') . ')'; | |
| 961 | + } | |
| 962 | + | |
| 963 | + if ($pesquisaProtocoloSolrDTO->isSetStrObservacao() && $pesquisaProtocoloSolrDTO->getStrObservacao() != null) { | |
| 964 | + if ($partialfields != '') { | |
| 965 | + $partialfields .= ' AND '; | |
| 966 | + } | |
| 967 | + $partialfields .= '(' . SolrUtil::formatarOperadores($pesquisaProtocoloSolrDTO->getStrObservacao(), 'obs_' . SessaoSEI::getInstance()->getNumIdUnidadeAtual()) . ')'; | |
| 968 | + } | |
| 969 | + | |
| 970 | + //o- verificar lógica do solar | |
| 971 | + if ($pesquisaProtocoloSolrDTO->isSetDblIdProcedimento() && $pesquisaProtocoloSolrDTO->getDblIdProcedimento() != null) { | |
| 972 | + if ($partialfields != '') { | |
| 973 | + $partialfields .= ' AND '; | |
| 974 | + } | |
| 975 | + | |
| 976 | + $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | |
| 977 | + $objRelProtocoloProtocoloDTO->retDblIdProtocolo2(); | |
| 978 | + $objRelProtocoloProtocoloDTO->setStrStaAssociacao(RelProtocoloProtocoloRN::$TA_PROCEDIMENTO_ANEXADO); | |
| 979 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo1($pesquisaProtocoloSolrDTO->getDblIdProcedimento()); | |
| 980 | + | |
| 981 | + $objRelProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); | |
| 982 | + $arrIdProcessosAnexados = InfraArray::converterArrInfraDTO($objRelProtocoloProtocoloRN->listarRN0187($objRelProtocoloProtocoloDTO), 'IdProtocolo2'); | |
| 983 | + | |
| 984 | + if (count($arrIdProcessosAnexados) == 0) { | |
| 985 | + $partialfields .= '(id_proc:' . $pesquisaProtocoloSolrDTO->getDblIdProcedimento() . ')'; | |
| 986 | + } else { | |
| 987 | + | |
| 988 | + $strProcessos = 'id_proc:' . $pesquisaProtocoloSolrDTO->getDblIdProcedimento(); | |
| 989 | + foreach ($arrIdProcessosAnexados as $dblIdProcessoAnexado) { | |
| 990 | + $strProcessos .= ' OR id_proc:' . $dblIdProcessoAnexado; | |
| 991 | + } | |
| 992 | + | |
| 993 | + $partialfields .= '(' . $strProcessos . ')'; | |
| 994 | + } | |
| 995 | + } | |
| 996 | + | |
| 997 | + if ($pesquisaProtocoloSolrDTO->isSetStrProtocoloPesquisa() && $pesquisaProtocoloSolrDTO->getStrProtocoloPesquisa() != null) { | |
| 998 | + if ($partialfields != '') { | |
| 999 | + $partialfields .= ' AND '; | |
| 1000 | + } | |
| 1001 | + $partialfields .= '(prot_pesq:*' . InfraUtil::retirarFormatacao($pesquisaProtocoloSolrDTO->getStrProtocoloPesquisa(), false) . '*)'; | |
| 1002 | + } | |
| 1003 | + | |
| 1004 | + if ($pesquisaProtocoloSolrDTO->isSetNumIdTipoProcedimento() && $pesquisaProtocoloSolrDTO->getNumIdTipoProcedimento() != null) { | |
| 1005 | + if ($partialfields != '') { | |
| 1006 | + $partialfields .= ' AND '; | |
| 1007 | + } | |
| 1008 | + $partialfields .= '(id_tipo_proc:' . $pesquisaProtocoloSolrDTO->getNumIdTipoProcedimento() . ')'; | |
| 1009 | + } | |
| 1010 | + | |
| 1011 | + if ($pesquisaProtocoloSolrDTO->isSetNumIdSerie() && $pesquisaProtocoloSolrDTO->getNumIdSerie() != null) { | |
| 1012 | + if ($partialfields != '') { | |
| 1013 | + $partialfields .= ' AND '; | |
| 1014 | + } | |
| 1015 | + $partialfields .= '(id_serie:' . $pesquisaProtocoloSolrDTO->getNumIdSerie() . ')'; | |
| 1016 | + } | |
| 1017 | + | |
| 1018 | + if ($pesquisaProtocoloSolrDTO->isSetStrNumero() && $pesquisaProtocoloSolrDTO->getStrNumero() != null) { | |
| 1019 | + if ($partialfields != '') { | |
| 1020 | + $partialfields .= ' AND '; | |
| 1021 | + } | |
| 1022 | + $partialfields .= '(numero:*' . $pesquisaProtocoloSolrDTO->getStrNumero() . '*)'; | |
| 1023 | + } | |
| 1024 | + | |
| 1025 | + $dtaInicio = null; | |
| 1026 | + $dtaFim = null; | |
| 1027 | + if($pesquisaProtocoloSolrDTO->isSetStrStaTipoData()){ | |
| 1028 | + if ($pesquisaProtocoloSolrDTO->getStrStaTipoData() == '0') { | |
| 1029 | + $dtaInicio = $pesquisaProtocoloSolrDTO->getDtaInicio(); | |
| 1030 | + $dtaFim = $pesquisaProtocoloSolrDTO->getDtaFim(); | |
| 1031 | + } else if ($pesquisaProtocoloSolrDTO->getStrStaTipoData() == '30') { | |
| 1032 | + $dtaInicio = InfraData::calcularData(30, InfraData::$UNIDADE_DIAS, InfraData::$SENTIDO_ATRAS); | |
| 1033 | + $dtaFim = InfraData::getStrDataAtual(); | |
| 1034 | + } else if ($pesquisaProtocoloSolrDTO->getStrStaTipoData() == '60') { | |
| 1035 | + $dtaInicio = InfraData::calcularData(60, InfraData::$UNIDADE_DIAS, InfraData::$SENTIDO_ATRAS); | |
| 1036 | + $dtaFim = InfraData::getStrDataAtual(); | |
| 1037 | + } | |
| 1038 | + } | |
| 1039 | + | |
| 1040 | + if ($dtaInicio != null && $dtaFim != null) { | |
| 1041 | + $dia1 = substr($dtaInicio, 0, 2); | |
| 1042 | + $mes1 = substr($dtaInicio, 3, 2); | |
| 1043 | + $ano1 = substr($dtaInicio, 6, 4); | |
| 1044 | + | |
| 1045 | + $dia2 = substr($dtaFim, 0, 2); | |
| 1046 | + $mes2 = substr($dtaFim, 3, 2); | |
| 1047 | + $ano2 = substr($dtaFim, 6, 4); | |
| 1048 | + | |
| 1049 | + if ($partialfields != '') { | |
| 1050 | + $partialfields .= ' AND '; | |
| 1051 | + } | |
| 1052 | + | |
| 1053 | + $partialfields .= 'dta_ger:[' . $ano1 . '-' . $mes1 . '-' . $dia1 . 'T00:00:00Z TO ' . $ano2 . '-' . $mes2 . '-' . $dia2 . 'T00:00:00Z]'; | |
| 1054 | + } | |
| 1055 | + | |
| 1056 | + $objUnidadeDTO = new UnidadeDTO(); | |
| 1057 | + $objUnidadeDTO->setBolExclusaoLogica(false); | |
| 1058 | + $objUnidadeDTO->retStrSinProtocolo(); | |
| 1059 | + $objUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 1060 | + | |
| 1061 | + $objUnidadeRN = new UnidadeRN(); | |
| 1062 | + $objUnidadeDTOAtual = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1063 | + | |
| 1064 | + if ($objUnidadeDTOAtual->getStrSinProtocolo() == 'N') { | |
| 1065 | + | |
| 1066 | + if ($partialfields != '') { | |
| 1067 | + $partialfields .= ' AND '; | |
| 1068 | + } | |
| 1069 | + | |
| 1070 | + $partialfields .= '(tipo_aces:P OR id_uni_aces:*;' . SessaoSEI::getInstance()->getNumIdUnidadeAtual() . ';*)'; | |
| 1071 | + } | |
| 1072 | + | |
| 1073 | + if($pesquisaProtocoloSolrDTO->isSetNumIdGrupoAcompanhamentoProcedimento() && $pesquisaProtocoloSolrDTO->getNumIdGrupoAcompanhamentoProcedimento()) { | |
| 1074 | + $protocoloRN = new ProtocoloRN(); | |
| 1075 | + $mdWsSeiProtocoloDTO = new MdWsSeiProtocoloDTO(); | |
| 1076 | + $mdWsSeiProtocoloDTO->setNumIdGrupoAcompanhamentoProcedimento($pesquisaProtocoloSolrDTO->getNumIdGrupoAcompanhamentoProcedimento()); | |
| 1077 | + $mdWsSeiProtocoloDTO->retDblIdProtocolo(); | |
| 1078 | + | |
| 1079 | + $ret = $protocoloRN->listarRN0668($mdWsSeiProtocoloDTO); | |
| 1080 | + if(!$ret){ | |
| 1081 | + return MdWsSeiRest::formataRetornoSucessoREST(null, array(), 0); | |
| 1082 | + } | |
| 1083 | + if ($partialfields != '') { | |
| 1084 | + $partialfields .= ' AND '; | |
| 1085 | + } | |
| 1086 | + $arrIdProcessosAcompanhamento = array(); | |
| 1087 | + /** @var ProtocoloDTO $protocoloDTO */ | |
| 1088 | + foreach($ret as $protocoloDTO){ | |
| 1089 | + $arrIdProcessosAcompanhamento[] = 'id_proc:' . $protocoloDTO->getDblIdProtocolo(); | |
| 1090 | + } | |
| 1091 | + $partialfields .= '(' . implode(' OR ', $arrIdProcessosAcompanhamento) . ')'; | |
| 1092 | + } | |
| 1093 | + | |
| 1094 | + $parametros = new stdClass(); | |
| 1095 | + if($pesquisaProtocoloSolrDTO->isSetStrPalavrasChave()){ | |
| 1096 | + $parametros->q = SolrUtil::formatarOperadores($pesquisaProtocoloSolrDTO->getStrPalavrasChave()); | |
| 1097 | + } | |
| 1098 | + | |
| 1099 | + if ($parametros->q != '' && $partialfields != '') { | |
| 1100 | + $parametros->q = '(' . $parametros->q . ') AND ' . $partialfields; | |
| 1101 | + } else if ($partialfields != '') { | |
| 1102 | + $parametros->q = $partialfields; | |
| 1103 | + } | |
| 1104 | + | |
| 1105 | + $parametros->q = utf8_encode($parametros->q); | |
| 1106 | + $start = 0; | |
| 1107 | + $limit = 100; | |
| 1108 | + if($pesquisaProtocoloSolrDTO->getNumPaginaAtual()){ | |
| 1109 | + $start = $pesquisaProtocoloSolrDTO->getNumPaginaAtual(); | |
| 1110 | + } | |
| 1111 | + if($pesquisaProtocoloSolrDTO->getNumMaxRegistrosRetorno()){ | |
| 1112 | + $limit = $pesquisaProtocoloSolrDTO->getNumMaxRegistrosRetorno(); | |
| 1113 | + } | |
| 1114 | + $parametros->start = $start; | |
| 1115 | + $parametros->rows = $limit; | |
| 1116 | + $parametros->sort = 'dta_ger desc, id_prot desc'; | |
| 1117 | + | |
| 1118 | + $urlBusca = ConfiguracaoSEI::getInstance()->getValor('Solr', 'Servidor') . '/' . ConfiguracaoSEI::getInstance()->getValor('Solr', 'CoreProtocolos') . '/select?' . http_build_query($parametros) . '&hl=true&hl.snippets=2&hl.fl=content&hl.fragsize=100&hl.maxAnalyzedChars=1048576&hl.alternateField=content&hl.maxAlternateFieldLength=100&fl=id,id_proc,id_doc,id_tipo_proc,id_serie,id_anexo,id_uni_ger,prot_doc,prot_proc,numero,id_usu_ger,dta_ger'; | |
| 1119 | + | |
| 1120 | + try { | |
| 1121 | + $resultados = file_get_contents($urlBusca, false); | |
| 1122 | + } catch (Exception $e) { | |
| 1123 | + throw new InfraException('Erro realizando pesquisa no Solar.', $e, urldecode($urlBusca), false); | |
| 1124 | + } | |
| 1125 | + | |
| 1126 | + if ($resultados == '') { | |
| 1127 | + throw new InfraException('Nenhum retorno encontrado no resultado da pesquisa do Solar, verificar indexação.'); | |
| 1128 | + } | |
| 1129 | + | |
| 1130 | + $xml = simplexml_load_string($resultados); | |
| 1131 | + $arrRet = $xml->xpath('/response/result/@numFound'); | |
| 1132 | + $total = array_shift($arrRet)->__toString(); | |
| 1133 | + $arrIdProcessos = array(); | |
| 1134 | + $registros = $xml->xpath('/response/result/doc'); | |
| 1135 | + $numRegistros = sizeof($registros); | |
| 1136 | + | |
| 1137 | + for ($i = 0; $i < $numRegistros; $i++) { | |
| 1138 | + $arrIdProcessos[] = SolrUtil::obterTag($registros[$i], 'id_proc', 'long'); | |
| 1139 | + } | |
| 1140 | + | |
| 1141 | + $protocoloRN = new ProtocoloRN(); | |
| 1142 | + $protocoloDTO = new MdWsSeiProtocoloDTO(); | |
| 1143 | + $protocoloDTO->setDblIdProtocolo($arrIdProcessos, InfraDTO::$OPER_IN); | |
| 1144 | + $protocoloDTO->retDblIdProtocolo(); | |
| 1145 | + $protocoloDTO->retNumIdUnidadeGeradora(); | |
| 1146 | + $protocoloDTO->retStrStaProtocolo(); | |
| 1147 | + $protocoloDTO->retStrProtocoloFormatado(); | |
| 1148 | + $protocoloDTO->retStrNomeTipoProcedimentoProcedimento(); | |
| 1149 | + $protocoloDTO->retStrDescricao(); | |
| 1150 | + $protocoloDTO->retStrSiglaUnidadeGeradora(); | |
| 1151 | + $protocoloDTO->retStrStaGrauSigilo(); | |
| 1152 | + $protocoloDTO->retStrStaNivelAcessoLocal(); | |
| 1153 | + $protocoloDTO->retStrStaNivelAcessoGlobal(); | |
| 1154 | + $protocoloDTO->retStrSinCienciaProcedimento(); | |
| 1155 | + $protocoloDTO->retStrStaEstado(); | |
| 1156 | + $arrProtocoloDTO = $protocoloRN->listarRN0668($protocoloDTO); | |
| 1157 | + $result = $this->montaRetornoListagemProcessos($arrProtocoloDTO, null); | |
| 1158 | + | |
| 1159 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $total); | |
| 1160 | + } catch (Exception $e) { | |
| 1161 | + | |
| 1162 | + } | |
| 1163 | + } | |
| 870 | 1164 | |
| 871 | 1165 | |
| 872 | 1166 | } |
| 873 | 1167 | \ No newline at end of file | ... | ... |
teste.php
| ... | ... | @@ -10,7 +10,7 @@ ini_set('xdebug.var_display_max_data', 2048); |
| 10 | 10 | echo '<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>'; |
| 11 | 11 | |
| 12 | 12 | $b = new MdWsSeiUsuarioRN(); |
| 13 | -$token = $b->tokenEncode('teste2', 'teste2'); | |
| 13 | +$token = $b->tokenEncode('teste', 'teste'); | |
| 14 | 14 | echo 'Token: '; |
| 15 | 15 | echo $token; |
| 16 | 16 | echo '<BR>'; | ... | ... |