Commit 61e382069d1c01462a87a1be4b63860ad08726b1
1 parent
acbee2e2
Exists in
master
and in
1 other branch
desenvolvimento do WI = 11010 - [WorkItem][Consultar Template de Criação de Docu…
…mento] - Retornar os interessados sugeridos para o tipo de documento
Showing
2 changed files
with
73 additions
and
29 deletions
Show diff stats
controlador_ws.php
... | ... | @@ -442,8 +442,9 @@ $app->group('/api/v1',function(){ |
442 | 442 | $rn = new MdWsSeiDocumentoRN(); |
443 | 443 | $dto = new MdWsSeiDocumentoDTO(); |
444 | 444 | $dto->setNumIdTipoDocumento($request->getParam('id')); |
445 | - $dto->setNumIdTipoProcedimento($request->getParam('idTipoProcedimento')); | |
446 | - | |
445 | + //$dto->setNumIdTipoProcedimento($request->getParam('idTipoProcedimento')); | |
446 | + $dto->setNumIdProcesso($request->getParam('procedimento')); | |
447 | + | |
447 | 448 | return $response->withJSON($rn->pesquisarTemplateDocumento($dto)); |
448 | 449 | }); |
449 | 450 | $this->get('/baixar/anexo/{protocolo}', function($request, $response, $args){ | ... | ... |
rn/MdWsSeiDocumentoRN.php
... | ... | @@ -197,8 +197,11 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
197 | 197 | */ |
198 | 198 | protected function pesquisarTemplateDocumentoConectado(MdWsSeiDocumentoDTO $dto) { |
199 | 199 | try { |
200 | + | |
200 | 201 | $id_tipo_documento = $dto->getNumIdTipoDocumento(); |
201 | - $idTipoProcedimento = $dto->getNumIdTipoProcedimento(); | |
202 | + //$idTipoProcedimento = $dto->getNumIdTipoProcedimento(); | |
203 | + $idProcedimento = $dto->getNumIdProcesso(); | |
204 | + //$idProcedimento = $dto->getNumProcedimento(); | |
202 | 205 | //Consulta os assuntos sugeridos para um tipo de documento |
203 | 206 | $relSerieAssuntoDTO = new RelSerieAssuntoDTO(); |
204 | 207 | $relSerieAssuntoDTO->setNumIdSerie($id_tipo_documento); // FILTRO PELO TIPO DE DOCUMENTO |
... | ... | @@ -240,34 +243,74 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
240 | 243 | $permiteDestinatarios = false; |
241 | 244 | } |
242 | 245 | |
243 | - $arrayRetorno = array( | |
244 | - "assuntos" => $assuntos, | |
245 | - "permiteInteressados" => $permiteInteressados, | |
246 | - "permiteDestinatarios" => $permiteDestinatarios | |
247 | - ); | |
246 | + $interessados = null; | |
247 | + $arrayRetorno["nivelAcessoPermitido"] = null; | |
248 | + | |
249 | + if ($idProcedimento) { | |
250 | + $objParticipanteDTO = new ParticipanteDTO(); | |
251 | + $objParticipanteDTO->setDblIdProtocolo($idProcedimento); | |
252 | + $objParticipanteDTO->retStrNomeContato(); | |
253 | + $objParticipanteDTO->retNumIdContato(); | |
254 | + | |
255 | + $objParticipanteRN = new ParticipanteRN(); | |
256 | + $arrParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); | |
257 | + | |
258 | + if ($arrParticipanteDTO) { | |
259 | + foreach ($arrParticipanteDTO as $obj) { | |
260 | + $interessados[] = array( | |
261 | + "id" => $obj->getNumIdContato(), | |
262 | + "nome" => $obj->getStrNomeContato() | |
263 | + ); | |
264 | + } | |
265 | + } | |
266 | + | |
267 | + $objProcedimentoDTO = new ProcedimentoDTO(); | |
268 | + $objProcedimentoDTO->setDblIdProcedimento($idProcedimento); | |
269 | + $objProcedimentoDTO->retNumIdTipoProcedimento(); | |
270 | + | |
271 | + $objProcedimentoRN = new ProcedimentoRN(); | |
272 | + $objProcedimentoDTO = $objProcedimentoRN->listarRN0278($objProcedimentoDTO); | |
273 | + | |
274 | + $nivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | |
275 | + $nivelAcessoPermitidoDTO->setNumIdTipoProcedimento($objProcedimentoDTO[0]->getNumIdTipoProcedimento()); // FILTRO PELO TIPO DE PROCESSO | |
276 | + $nivelAcessoPermitidoDTO->retStrStaNivelAcesso(); // ID DO NÍVEL DE ACESSO - ProtocoloRN::$NA_PUBLICO, ProtocoloRN::$NA_RESTRITO ou ProtocoloRN::$NA_SIGILOSO | |
248 | 277 | |
249 | 278 | |
250 | - //CONSULTA QUE LISTA TODOS OS NÍVES DE ACESSOS PERMITIDOS PARA OS TIPO DE PROCESSO | |
251 | - $nivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | |
252 | - $nivelAcessoPermitidoDTO->setNumIdTipoProcedimento($idTipoProcedimento); // FILTRO PELO TIPO DE PROCESSO | |
253 | - $nivelAcessoPermitidoDTO->retStrStaNivelAcesso(); // ID DO NÍVEL DE ACESSO - ProtocoloRN::$NA_PUBLICO, ProtocoloRN::$NA_RESTRITO ou ProtocoloRN::$NA_SIGILOSO | |
254 | - // A CONSULTA RETORNARÁ OS NÍVEL DE ACESSO PERMITIDOS PARA O TIPO DE PROCESSO ESPECIFICADO NO DTO. AQUELES QUE NÃO FOREM RETORNADOS NESSA | |
255 | - $nivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | |
256 | - $arrNivelAcessoPermitido = $nivelAcessoPermitidoRN->listar($nivelAcessoPermitidoDTO); | |
257 | - if ($arrNivelAcessoPermitido) { | |
258 | - foreach ($arrNivelAcessoPermitido as $nivel) { | |
259 | - if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_PUBLICO) | |
260 | - $publico = true; | |
261 | - if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_RESTRITO) | |
262 | - $restrito = true; | |
263 | - if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_SIGILOSO) | |
264 | - $sigiloso = true; | |
279 | + $nivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | |
280 | + $arrNivelAcessoPermitido = $nivelAcessoPermitidoRN->listar($nivelAcessoPermitidoDTO); | |
281 | + if ($arrNivelAcessoPermitido) { | |
282 | + foreach ($arrNivelAcessoPermitido as $nivel) { | |
283 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_PUBLICO) | |
284 | + $publico = true; | |
285 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_RESTRITO) | |
286 | + $restrito = true; | |
287 | + if ($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_SIGILOSO) | |
288 | + $sigiloso = true; | |
289 | + } | |
265 | 290 | } |
291 | + | |
292 | + $arrayRetorno["nivelAcessoPermitido"] = array( | |
293 | + "publico" => $publico ? $publico : false, | |
294 | + "restrito" => $restrito ? $restrito : false, | |
295 | + "sigiloso" => $sigiloso ? $sigiloso : false, | |
296 | + ); | |
297 | + | |
298 | + | |
299 | + /* echo('<pre>'); | |
300 | + var_export($arrayRetorno["nivelAcessoPermitido"]); | |
301 | + die('</pre>');*/ | |
302 | + | |
303 | + | |
304 | + | |
266 | 305 | } |
267 | - $arrayRetorno["nivelAcessoPermitido"] = array( | |
268 | - "publico" => $publico ? $publico : false, | |
269 | - "restrito" => $restrito ? $restrito : false, | |
270 | - "sigiloso" => $sigiloso ? $sigiloso : false, | |
306 | + | |
307 | + | |
308 | + $arrayRetorno = array( | |
309 | + "assuntos" => $assuntos, | |
310 | + "interessados" => empty($interessados) ? array() : $interessados, | |
311 | + "nivelAcessoPermitido" => empty($arrayRetorno["nivelAcessoPermitido"]) ? array() : $arrayRetorno["nivelAcessoPermitido"], | |
312 | + "permiteInteressados" => $permiteInteressados, | |
313 | + "permiteDestinatarios" => $permiteDestinatarios | |
271 | 314 | ); |
272 | 315 | |
273 | 316 | |
... | ... | @@ -865,7 +908,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
865 | 908 | } |
866 | 909 | $relProtocoloProtocoloDTOConsulta->setDblIdProtocolo1($documentoDTOParam->getDblIdProcedimento()); |
867 | 910 | $relProtocoloProtocoloDTOConsulta->setStrStaProtocoloProtocolo2( |
868 | - array(ProtocoloRN::$TP_DOCUMENTO_GERADO, ProtocoloRN::$TP_DOCUMENTO_RECEBIDO), InfraDTO::$OPER_IN | |
911 | + array(ProtocoloRN::$TP_DOCUMENTO_GERADO, ProtocoloRN::$TP_DOCUMENTO_RECEBIDO), InfraDTO::$OPER_IN | |
869 | 912 | ); |
870 | 913 | $relProtocoloProtocoloDTOConsulta->retStrSinCiencia(); |
871 | 914 | $relProtocoloProtocoloDTOConsulta->retDblIdProtocolo1(); |
... | ... | @@ -1356,7 +1399,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
1356 | 1399 | $objParticipanteDTO->retNumSequencia(); |
1357 | 1400 | $objParticipanteDTO->setOrdStrStaParticipacao(InfraDTO::$TIPO_ORDENACAO_ASC); |
1358 | 1401 | $objParticipanteDTO->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); |
1359 | - | |
1402 | + | |
1360 | 1403 | $objParticipanteRN = new ParticipanteRN(); |
1361 | 1404 | $objArrParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); |
1362 | 1405 | $arrDadosDocumento['interessados'] = array(); | ... | ... |