From 3675502c50a27f573a02d954e38a4742795caf49 Mon Sep 17 00:00:00 2001 From: Rafael Ferreira Date: Mon, 13 Nov 2017 12:23:43 -0200 Subject: [PATCH] complementando first commit --- MdCguWsComplementarIntegracao.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dto/WSCguRetornoConsultarDocumentoDTO.php | 36 ++++++++++++++++++++++++++++++++++++ dto/WSCguRetornoListarAndamentosDTO.php | 25 +++++++++++++++++++++++++ dto/WSEntradaListarAndamentosDTO.php | 23 +++++++++++++++++++++++ dto/WSEntradaListarDocumentoDTO.php | 31 +++++++++++++++++++++++++++++++ dto/WSEntradaListarObterTramitadosDTO.php | 22 ++++++++++++++++++++++ dto/WSEntradaListarProcedimentoDTO.php | 28 ++++++++++++++++++++++++++++ dto/WSEntradaListarProcedimentosTramitadosDTO.php | 23 +++++++++++++++++++++++ dto/WSRetornoConsultarProcedimentoDTO.php | 36 ++++++++++++++++++++++++++++++++++++ rn/CguRN.php | 831 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ws/CguWS.php | 596 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ws/cgu.wsdl | 411 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 2118 insertions(+), 0 deletions(-) create mode 100644 MdCguWsComplementarIntegracao.php create mode 100644 dto/WSCguRetornoConsultarDocumentoDTO.php create mode 100644 dto/WSCguRetornoListarAndamentosDTO.php create mode 100644 dto/WSEntradaListarAndamentosDTO.php create mode 100644 dto/WSEntradaListarDocumentoDTO.php create mode 100644 dto/WSEntradaListarObterTramitadosDTO.php create mode 100644 dto/WSEntradaListarProcedimentoDTO.php create mode 100644 dto/WSEntradaListarProcedimentosTramitadosDTO.php create mode 100644 dto/WSRetornoConsultarProcedimentoDTO.php create mode 100644 rn/CguRN.php create mode 100644 ws/CguWS.php create mode 100644 ws/cgu.wsdl diff --git a/MdCguWsComplementarIntegracao.php b/MdCguWsComplementarIntegracao.php new file mode 100644 index 0000000..979e1ef --- /dev/null +++ b/MdCguWsComplementarIntegracao.php @@ -0,0 +1,56 @@ +getNome().'" ('.$this->getVersao().') não é compatível com esta versão do SEI ('.$strVersaoSEI.').'); +// } +// */ +// } + + public function processarControladorWebServices($strServico) + { + $strArq = null; + switch ($strServico) { + case 'cgu': + $strArq = 'cgu.wsdl'; + break; + } + + if ($strArq!=null){ + $strArq = dirname(__FILE__).'/ws/'.$strArq; + } + return $strArq; + } +} + +?> \ No newline at end of file diff --git a/dto/WSCguRetornoConsultarDocumentoDTO.php b/dto/WSCguRetornoConsultarDocumentoDTO.php new file mode 100644 index 0000000..f3afcb8 --- /dev/null +++ b/dto/WSCguRetornoConsultarDocumentoDTO.php @@ -0,0 +1,36 @@ +adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ProcedimentoFormatado'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdDocumento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'DocumentoFormatado'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'LinkAcesso'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdSerie'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeSerie'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Numero'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdUnidadeGeradora'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SiglaUnidadeGeradora'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'DescricaoUnidadeGeradora'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'GeracaoProtocolo'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'AtividadeDTOGeracao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjAssinaturaDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'PublicacaoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjParticipanteDTO'); + } +} +?> \ No newline at end of file diff --git a/dto/WSCguRetornoListarAndamentosDTO.php b/dto/WSCguRetornoListarAndamentosDTO.php new file mode 100644 index 0000000..d185a8d --- /dev/null +++ b/dto/WSCguRetornoListarAndamentosDTO.php @@ -0,0 +1,25 @@ +adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ProcedimentoFormatado'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeTipoProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjAtividadeDTO'); + } +} +?> \ No newline at end of file diff --git a/dto/WSEntradaListarAndamentosDTO.php b/dto/WSEntradaListarAndamentosDTO.php new file mode 100644 index 0000000..98227c3 --- /dev/null +++ b/dto/WSEntradaListarAndamentosDTO.php @@ -0,0 +1,23 @@ +adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'ServicoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'ProcedimentoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'UnidadeDTO'); + } +} +?> \ No newline at end of file diff --git a/dto/WSEntradaListarDocumentoDTO.php b/dto/WSEntradaListarDocumentoDTO.php new file mode 100644 index 0000000..02d19c6 --- /dev/null +++ b/dto/WSEntradaListarDocumentoDTO.php @@ -0,0 +1,31 @@ +adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'ServicoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'DocumentoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'UnidadeDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdUnidadeGeradoraProtocolo'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataInicialGeracaoProtocolo'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataFinalGeracaoProtocolo'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinRetornarAndamentoGeracao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinRetornarAssinaturas'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinRetornarPublicacao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'SinRetornarDestinatarios'); + + } +} +?> \ No newline at end of file diff --git a/dto/WSEntradaListarObterTramitadosDTO.php b/dto/WSEntradaListarObterTramitadosDTO.php new file mode 100644 index 0000000..f820f2c --- /dev/null +++ b/dto/WSEntradaListarObterTramitadosDTO.php @@ -0,0 +1,22 @@ +adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'RequisicaoConsultaTramiteDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdUnidade'); + } +} +?> \ No newline at end of file diff --git a/dto/WSEntradaListarProcedimentoDTO.php b/dto/WSEntradaListarProcedimentoDTO.php new file mode 100644 index 0000000..0d2b69d --- /dev/null +++ b/dto/WSEntradaListarProcedimentoDTO.php @@ -0,0 +1,28 @@ +adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'ServicoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'ProcedimentoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'UnidadeDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Interessado'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ClassificacaoAssunto'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataInicialRegistroProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataFinalRegistroProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'UnidadeProcedimentoAberto'); + } +} +?> \ No newline at end of file diff --git a/dto/WSEntradaListarProcedimentosTramitadosDTO.php b/dto/WSEntradaListarProcedimentosTramitadosDTO.php new file mode 100644 index 0000000..174ca5d --- /dev/null +++ b/dto/WSEntradaListarProcedimentosTramitadosDTO.php @@ -0,0 +1,23 @@ +adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTH, 'DataReferencia'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdUnidadePesquisa'); + } +} +?> \ No newline at end of file diff --git a/dto/WSRetornoConsultarProcedimentoDTO.php b/dto/WSRetornoConsultarProcedimentoDTO.php new file mode 100644 index 0000000..c944d7c --- /dev/null +++ b/dto/WSRetornoConsultarProcedimentoDTO.php @@ -0,0 +1,36 @@ +adicionarAtributo(InfraDTO::$PREFIXO_DBL, 'IdProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ProcedimentoFormatado'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeTipoProcedimento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Especificacao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'Autuacao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'LinkAcesso'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'AtividadeDTOGeracao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'AtividadeDTOConclusao'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_OBJ, 'AtividadeDTOUltimoAndamento'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjAtividadeDTOAberto'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjRelProtocoloAssuntoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjObservacaoDTO'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjParticipanteDTOInteressados'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjRelProtocoloProtocoloDTORelacionados'); + $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ObjRelProtocoloProtocoloDTOAnexados'); + } +} +?> \ No newline at end of file diff --git a/rn/CguRN.php b/rn/CguRN.php new file mode 100644 index 0000000..03b5f00 --- /dev/null +++ b/rn/CguRN.php @@ -0,0 +1,831 @@ +getObjServicoDTO(); + + $objDocumentoDTO = $objWSEntradaListarDocumentoDTO->getObjDocumentoDTO(); + + $objUnidadeDTO = $objWSEntradaListarDocumentoDTO->getObjUnidadeDTO(); + + if (!InfraUtil::isBolSinalizadorValido($objWSEntradaListarDocumentoDTO->getStrSinRetornarAndamentoGeracao())) { + $objInfraException->adicionarValidacao('Sinalizador de retorno para andamento de geração inválido.'); + } + + if (!InfraUtil::isBolSinalizadorValido($objWSEntradaListarDocumentoDTO->getStrSinRetornarAssinaturas())) { + $objInfraException->adicionarValidacao('Sinalizador de retorno para assinaturas inválido.'); + } + + if (!InfraUtil::isBolSinalizadorValido($objWSEntradaListarDocumentoDTO->getStrSinRetornarPublicacao())) { + $objInfraException->adicionarValidacao('Sinalizador de retorno para publicação inválido.'); + } + + if (!InfraUtil::isBolSinalizadorValido($objWSEntradaListarDocumentoDTO->getStrSinRetornarDestinatarios())) { + $objInfraException->adicionarValidacao('Sinalizador de retorno para destinatários inválido.'); + } + + + $dto = new DocumentoDTO(); + $dto->retDblIdDocumento(); + $dto->retDblIdProcedimento(); + $dto->retStrProtocoloDocumentoFormatado(); + $dto->retStrProtocoloProcedimentoFormatado(); + $dto->retNumIdSerie(); + $dto->retStrNomeSerie(); + $dto->retStrNumero(); + $dto->retStrStaNivelAcessoGlobalProtocolo(); + $dto->retDtaGeracaoProtocolo(); + $dto->retStrStaProtocoloProtocolo(); + $dto->retStrSinBloqueado(); + + $dto->retNumIdUnidadeGeradoraProtocolo(); + $dto->retStrSiglaUnidadeGeradoraProtocolo(); + $dto->retStrDescricaoUnidadeGeradoraProtocolo(); + + + + if ($objDocumentoDTO!='') { + + if ($objDocumentoDTO->getStrProtocoloDocumentoFormatado()!='') { + $dto->setStrProtocoloDocumentoFormatadoPesquisa($objDocumentoDTO->getStrProtocoloDocumentoFormatado()); + } + if ($objDocumentoDTO->getStrProtocoloProcedimentoFormatado()!='') { + $dto->setStrProtocoloProcedimentoFormatado($objDocumentoDTO->getStrProtocoloProcedimentoFormatado()); + } + if ($objDocumentoDTO->getStrNumero()!='') { + $dto->setStrNumero('%'.$objDocumentoDTO->getStrNumero().'%', InfraDTO::$OPER_LIKE); + } + if ($objDocumentoDTO->getNumIdSerie()!='') { + $dto->setNumIdSerie($objDocumentoDTO->getNumIdSerie()); + } + if ($objDocumentoDTO->getNumIdUnidadeGeradoraProtocolo()!='') { + $dto->setNumIdUnidadeGeradoraProtocolo($objDocumentoDTO->getNumIdUnidadeGeradoraProtocolo()); + } + } + + $dto->setStrStaProtocoloProtocolo(array(ProtocoloRN::$TP_DOCUMENTO_GERADO, ProtocoloRN::$TP_DOCUMENTO_RECEBIDO), InfraDTO::$OPER_IN); + $dto->setStrStaNivelAcessoGlobalProtocolo(ProtocoloRN::$NA_SIGILOSO, InfraDTO::$OPER_DIFERENTE); + + if(trim($objWSEntradaListarDocumentoDTO->getDtaDataInicialGeracaoProtocolo())!=null&&trim($objWSEntradaListarDocumentoDTO->getDtaDataFinalGeracaoProtocolo())!=null) { + $dto->adicionarCriterio(array('GeracaoProtocolo', 'GeracaoProtocolo'), + array(InfraDTO::$OPER_MAIOR_IGUAL, InfraDTO::$OPER_MENOR_IGUAL), + array($objWSEntradaListarDocumentoDTO->getDtaDataInicialGeracaoProtocolo(), $objWSEntradaListarDocumentoDTO->getDtaDataFinalGeracaoProtocolo()), + array(InfraDTO::$OPER_LOGICO_AND)); + } + else{ + if(trim($objWSEntradaListarDocumentoDTO->getDtaDataInicialGeracaoProtocolo())!=null){ + $dto->setDtaGeracaoProtocolo($objWSEntradaListarDocumentoDTO->getDtaDataInicialGeracaoProtocolo(), InfraDTO::$OPER_MAIOR_IGUAL); + } + if(trim($objWSEntradaListarDocumentoDTO->getDtaDataFinalGeracaoProtocolo())!=null){ + $dto->setDtaGeracaoProtocolo($objWSEntradaListarDocumentoDTO->getDtaDataFinalGeracaoProtocolo(), InfraDTO::$OPER_MENOR_IGUAL); + } + } + + $objDocumentoRN = new DocumentoRN(); + $arrDto = $objDocumentoRN->listarRN0008($dto); + + if ($arrDto==null){ + $objInfraException->lancarValidacao('Nenhum documento encontrado com os parâmetros informados.'); + } + + $i = 0; + + foreach($arrDto as $objDocumentoDTOEncontrado) { + $objDocumentoRN->bloquearConsultado($objDocumentoDTOEncontrado); + + $objDocumentoDTO = $objDocumentoDTOEncontrado; + + + /* + * Comentado, verificar depois! + * if ($objUnidadeDTO != null) { + $objPesquisaProtocoloDTO = new PesquisaProtocoloDTO(); + $objPesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_DOCUMENTOS); + $objPesquisaProtocoloDTO->setStrStaAcesso(ProtocoloRN::$TAP_AUTORIZADO); + $objPesquisaProtocoloDTO->setDblIdProtocolo(array($objDocumentoDTO->getDblIdDocumento())); + + $objProtocoloRN = new ProtocoloRN(); + if (count($objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO)) == 0) { + $objInfraException->lancarValidacao('Unidade [' . $objUnidadeDTO->getStrSigla() . '] não possui acesso ao documento [' . $objDocumentoDTO->getStrProtocoloDocumentoFormatado() . '].'); + } + }*/ + + $objProcedimentoDTO = new ProcedimentoDTO(); + $objProcedimentoDTO->retDblIdProcedimento(); + $objProcedimentoDTO->retNumIdTipoProcedimento(); + $objProcedimentoDTO->setDblIdProcedimento($objDocumentoDTO->getDblIdProcedimento()); + + $objProcedimentoRN = new ProcedimentoRN(); + $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); + + $objOperacaoServicoDTO = new OperacaoServicoDTO(); + + if ($objUnidadeDTO == null) { + $this->adicionarCriteriosProcessoDocumento($objOperacaoServicoDTO, $objProcedimentoDTO, $objDocumentoDTO); + } else { + $this->adicionarCriteriosUnidadeProcessoDocumento($objOperacaoServicoDTO, $objUnidadeDTO, $objProcedimentoDTO, $objDocumentoDTO); + } + $objOperacaoServicoDTO->setNumStaOperacaoServico(OperacaoServicoRN::$TS_CONSULTAR_DOCUMENTO); + $objOperacaoServicoDTO->setNumIdServico($objServicoDTO->getNumIdServico()); + + $objOperacaoServicoRN = new OperacaoServicoRN(); + if ($objOperacaoServicoRN->contar($objOperacaoServicoDTO) == 0) { + if ($objUnidadeDTO == null) { + $objInfraException->lancarValidacao('Nenhum serviço configurado para consulta deste documento [' . $objDocumentoDTO->getStrProtocoloDocumentoFormatado() . '] pelo Serviço [' . $objServicoDTO->getStrIdentificacao() . '].'); + } else { + $objInfraException->lancarValidacao('Nenhum serviço configurado para consulta deste documento [' . $objDocumentoDTO->getStrProtocoloDocumentoFormatado() . '] na unidade [' . $objUnidadeDTO->getStrSigla() . '] pelo Serviço [' . $objServicoDTO->getStrIdentificacao() . '].'); + } + + } + + $objInfraException->lancarValidacoes(); + + //verifica se o usuário já tem acesso ao processo + $objAcessoExternoDTO = new AcessoExternoDTO(); + $objAcessoExternoDTO->retNumIdAcessoExterno(); + $objAcessoExternoDTO->setDblIdProtocoloAtividade($objDocumentoDTO->getDblIdProcedimento()); + $objAcessoExternoDTO->setNumIdContatoParticipante($objServicoDTO->getNumIdContatoUsuario()); + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA); + + $objAcessoExternoRN = new AcessoExternoRN(); + $objAcessoExternoDTO = $objAcessoExternoRN->consultar($objAcessoExternoDTO); + + if ($objAcessoExternoDTO == null) { + + $objParticipanteDTO = new ParticipanteDTO(); + $objParticipanteDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); + $objParticipanteDTO->setNumIdContato($objServicoDTO->getNumIdContatoUsuario()); + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_ACESSO_EXTERNO); + $objParticipanteDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); + $objParticipanteDTO->setNumSequencia(0); + + $objParticipanteRN = new ParticipanteRN(); + $objParticipanteDTO = $objParticipanteRN->cadastrarRN0170($objParticipanteDTO); + + $objAcessoExternoDTO = new AcessoExternoDTO(); + $objAcessoExternoDTO->setNumIdParticipante($objParticipanteDTO->getNumIdParticipante()); + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA); + + $objAcessoExternoRN = new AcessoExternoRN(); + $objAcessoExternoDTO = $objAcessoExternoRN->cadastrar($objAcessoExternoDTO); + } + + $arrObjWSRetornoConsultarDocumentoDTO[$i] = new WSCguRetornoConsultarDocumentoDTO(); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setDblIdProcedimento($objDocumentoDTO->getDblIdProcedimento()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrProcedimentoFormatado($objDocumentoDTO->getStrProtocoloProcedimentoFormatado()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrDocumentoFormatado($objDocumentoDTO->getStrProtocoloDocumentoFormatado()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setNumIdSerie($objDocumentoDTO->getNumIdSerie()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrNomeSerie($objDocumentoDTO->getStrNomeSerie()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrNumero($objDocumentoDTO->getStrNumero()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setDtaGeracaoProtocolo($objDocumentoDTO->getDtaGeracaoProtocolo()); + + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setNumIdUnidadeGeradora($objDocumentoDTO->getNumIdUnidadeGeradoraProtocolo()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrSiglaUnidadeGeradora($objDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo()); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrDescricaoUnidadeGeradora($objDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); + + if ($objWSEntradaListarDocumentoDTO->getStrSinRetornarAndamentoGeracao() == 'S') { + $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); + $objProcedimentoHistoricoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); + $objProcedimentoHistoricoDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); + $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_PERSONALIZADO); + $objProcedimentoHistoricoDTO->setStrSinGerarLinksHistorico('N'); + $objProcedimentoHistoricoDTO->setNumIdTarefa(array(TarefaRN::$TI_GERACAO_DOCUMENTO, TarefaRN::$TI_RECEBIMENTO_DOCUMENTO), InfraDTO::$OPER_IN); + $objProcedimentoHistoricoDTO->setNumMaxRegistrosRetorno(1); + $objProcedimentoDTOHistorico = $objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); + $arrObjAtividadeDTOHistorico = $objProcedimentoDTOHistorico->getArrObjAtividadeDTO(); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setObjAtividadeDTOGeracao($arrObjAtividadeDTOHistorico[0]); + } else { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setObjAtividadeDTOGeracao(null); + } + + + if ($objWSEntradaListarDocumentoDTO->getStrSinRetornarAssinaturas() == 'S') { + $objAssinaturaDTO = new AssinaturaDTO(); + $objAssinaturaDTO->retNumIdAssinatura(); + $objAssinaturaDTO->retStrNome(); + $objAssinaturaDTO->retStrTratamento(); + $objAssinaturaDTO->retDthAberturaAtividade(); + $objAssinaturaDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); + $objAssinaturaDTO->setOrdNumIdAssinatura(InfraDTO::$TIPO_ORDENACAO_ASC); + + $objAssinaturaRN = new AssinaturaRN(); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setArrObjAssinaturaDTO($objAssinaturaRN->listarRN1323($objAssinaturaDTO)); + } else { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setArrObjAssinaturaDTO(array()); + } + + if ($objWSEntradaListarDocumentoDTO->getStrSinRetornarPublicacao() == 'S') { + $objPublicacaoDTO = new PublicacaoDTO(); + $objPublicacaoDTO->retNumIdPublicacao(); + $objPublicacaoDTO->retDtaDisponibilizacao(); + $objPublicacaoDTO->retNumIdVeiculoIO(); + $objPublicacaoDTO->retDtaPublicacaoIO(); + $objPublicacaoDTO->retStrPaginaIO(); + $objPublicacaoDTO->retDtaPublicacao(); + $objPublicacaoDTO->retNumNumero(); + $objPublicacaoDTO->retStrNomeVeiculoPublicacao(); + $objPublicacaoDTO->retStrDescricaoVeiculoImprensaNacional(); + $objPublicacaoDTO->retStrStaEstado(); + $objPublicacaoDTO->retStrSiglaVeiculoImprensaNacional(); + $objPublicacaoDTO->retStrNomeSecaoImprensaNacional(); + $objPublicacaoDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); + + $objPublicacaoRN = new PublicacaoRN(); + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setObjPublicacaoDTO($objPublicacaoRN->consultarRN1044($objPublicacaoDTO)); + } else { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setObjPublicacaoDTO(null); + } + + if ($objWSEntradaListarDocumentoDTO->getStrSinRetornarDestinatarios() == 'S') { + + $objParticipanteDTO = new ParticipanteDTO(); + $objParticipanteDTO->retNumIdContato(); + $objParticipanteDTO->retStrNomeContato(); + $objParticipanteDTO->retStrEmailContato(); + $objParticipanteDTO->retStrSiglaUnidade(); + + $objParticipanteDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdDocumento()); + $objParticipanteDTO->setStrStaParticipacao(array(ParticipanteRN::$TP_DESTINATARIO),InfraDTO::$OPER_IN); + + $objParticipanteDTO->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); + + $objParticipanteRN = new ParticipanteRN(); + //$arrObjParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); + + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setArrObjParticipanteDTO($objParticipanteRN->listarRN0189($objParticipanteDTO)); + } else { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setArrObjParticipanteDTO(array()); + } + + if ($objServicoDTO->getStrSinLinkExterno() == 'S') { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrLinkAcesso(SessaoSEIExterna::getInstance($objAcessoExternoDTO->getNumIdAcessoExterno())->assinarLink(ConfiguracaoSEI::getInstance()->getValor('SEI', 'URL') . '/documento_consulta_externa.php?id_acesso_externo=' . $objAcessoExternoDTO->getNumIdAcessoExterno() . '&id_documento=' . $objDocumentoDTO->getDblIdDocumento())); + } else { + $arrObjWSRetornoConsultarDocumentoDTO[$i]->setStrLinkAcesso(ConfiguracaoSEI::getInstance()->getValor('SEI', 'URL') . '/controlador.php?acao=procedimento_trabalhar&id_procedimento=' . $objDocumentoDTO->getDblIdProcedimento() . '&id_documento=' . $objDocumentoDTO->getDblIdDocumento()); + } + + $i++; + + } + + return $arrObjWSRetornoConsultarDocumentoDTO; + + }catch(Exception $e){ + throw new InfraException('Erro no serviço de consulta de documento.',$e); + } + } + + protected function listarProcedimentoControlado(WSEntradaListarProcedimentoDTO $objWSEntradaListarProcedimentoDTO){ + + + try{ + + $objInfraException = new InfraException(); + + $objAtividadeRN = new AtividadeRN(); + $objProcedimentoRN = new ProcedimentoRN(); + + $objServicoDTO = $objWSEntradaListarProcedimentoDTO->getObjServicoDTO(); + $objProcedimentoDTO = $objWSEntradaListarProcedimentoDTO->getObjProcedimentoDTO(); + $objUnidadeDTO = $objWSEntradaListarProcedimentoDTO->getObjUnidadeDTO(); + + $dto = new ProcedimentoDTO(); + + $dto->retDblIdProcedimento(); + $dto->retStrProtocoloProcedimentoFormatado(); + $dto->retStrStaNivelAcessoGlobalProtocolo(); + $dto->retNumIdTipoProcedimento(); + $dto->retStrNomeTipoProcedimento(); + $dto->retStrDescricaoProtocolo(); + $dto->retDtaGeracaoProtocolo(); + + if ($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()!='') { + $dto->setStrProtocoloProcedimentoFormatadoPesquisa(InfraUtil::retirarFormatacao($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); + } + + if(trim($objWSEntradaListarProcedimentoDTO->getStrClassificacaoAssunto())!=null){ + $arrProtocolosResultadoAssuntos = $this->prepararClassificacaoAssunto($objWSEntradaListarProcedimentoDTO->getStrClassificacaoAssunto()); + } + else{ + $arrProtocolosResultadoAssuntos = array(); + } + + if(trim($objWSEntradaListarProcedimentoDTO->getStrInteressado())!=null){ + $arrProtocolosResultadoInteressados = $this->prepararParticipantes($objWSEntradaListarProcedimentoDTO->getStrInteressado()); + } + else{ + $arrProtocolosResultadoInteressados = array(); + } + + if($objWSEntradaListarProcedimentoDTO->getNumUnidadeProcedimentoAberto()!=null) { + $arrProtocolosResultadoAbertos = $this->prepararUnidadeProcedimentoAberto($objWSEntradaListarProcedimentoDTO->getNumUnidadeProcedimentoAberto(), $objServicoDTO->getNumIdContatoUsuario()); + } + else{ + $arrProtocolosResultadoAbertos = array(); + } + + $arrJuncaoProtocolos = array('arrProtocolosResultadoAssuntos', 'arrProtocolosResultadoInteressados','arrProtocolosResultadoAbertos'); + $arrResultadoProtocolos = $arrProtocolosResultadoAssuntos; + + foreach($arrJuncaoProtocolos as $k){ + if(!empty(${$k})) $out = array_intersect($arrResultadoProtocolos,${$k}); + }; + + if (count($arrResultadoProtocolos)>0) { + $dto->setDblIdProcedimento($arrResultadoProtocolos, InfraDTO::$OPER_IN); + } + + if($objProcedimentoDTO->getStrDescricaoProtocolo()!='') { + $dto->setStrDescricaoProtocolo('%'.$objProcedimentoDTO->getStrDescricaoProtocolo().'%',InfraDTO::$OPER_LIKE); + } + + if($objProcedimentoDTO->getNumIdTipoProcedimento()!='') { + $dto->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); + } + + if($objProcedimentoDTO->getStrNomeTipoProcedimento()!='') { + $dto->setStrNomeTipoProcedimento('%'.$objProcedimentoDTO->getStrNomeTipoProcedimento().'%',InfraDTO::$OPER_LIKE); + } + + if(trim($objWSEntradaListarProcedimentoDTO->getDtaDataInicialRegistroProcedimento())!=null&&trim($objWSEntradaListarProcedimentoDTO->getDtaDataFinalRegistroProcedimento())!=null) { + $dto->adicionarCriterio(array('GeracaoProtocolo', 'GeracaoProtocolo'), + array(InfraDTO::$OPER_MAIOR_IGUAL, InfraDTO::$OPER_MENOR_IGUAL), + array($objWSEntradaListarProcedimentoDTO->getDtaDataInicialRegistroProcedimento(), $objWSEntradaListarProcedimentoDTO->getDtaDataFinalRegistroProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND)); + } + else{ + if(trim($objWSEntradaListarProcedimentoDTO->getDtaDataInicialRegistroProcedimento())!=null){ + $dto->setDtaGeracaoProtocolo($objWSEntradaListarProcedimentoDTO->getDtaDataInicialRegistroProcedimento(), InfraDTO::$OPER_MAIOR_IGUAL); + } + if(trim($objWSEntradaListarProcedimentoDTO->getDtaDataFinalRegistroProcedimento())!=null){ + $dto->setDtaGeracaoProtocolo($objWSEntradaListarProcedimentoDTO->getDtaDataFinalRegistroProcedimento(), InfraDTO::$OPER_MENOR_IGUAL); + } + } + + //$dto->setStrProtocoloProcedimentoFormatadoPesquisa(InfraUtil::retirarFormatacao($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); + $dto->setStrStaNivelAcessoGlobalProtocolo(ProtocoloRN::$NA_SIGILOSO, InfraDTO::$OPER_DIFERENTE); + + $dto->setNumMaxRegistrosRetorno(1000); + + $arrDto = $objProcedimentoRN->listarRN0278($dto); + + if ($arrDto==null){ + $objInfraException->lancarValidacao('Nenhum processo encontrado para os parâmetros informados.'); + } + + $i = 0; + + foreach($arrDto as $objProcedimentoDTO) { + + //$objProcedimentoDTO = $dto; + + if ($objUnidadeDTO != null) { + $objPesquisaProtocoloDTO = new PesquisaProtocoloDTO(); + $objPesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_PROCEDIMENTOS); + $objPesquisaProtocoloDTO->setStrStaAcesso(ProtocoloRN::$TAP_AUTORIZADO); + $objPesquisaProtocoloDTO->setDblIdProtocolo(array($objProcedimentoDTO->getDblIdProcedimento())); + + $objProtocoloRN = new ProtocoloRN(); + if (count($objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO)) == 0) { + $objInfraException->lancarValidacao('Unidade [' . $objUnidadeDTO->getStrSigla() . '] não possui acesso ao processo [' . $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado() . '].'); + } + } + + + $objOperacaoServicoDTO = new OperacaoServicoDTO(); + + if ($objUnidadeDTO == null) { + $this->adicionarCriteriosProcesso($objOperacaoServicoDTO, $objProcedimentoDTO); + } else { + $this->adicionarCriteriosUnidadeProcesso($objOperacaoServicoDTO, $objUnidadeDTO, $objProcedimentoDTO); + } + + $objOperacaoServicoDTO->setNumStaOperacaoServico(OperacaoServicoRN::$TS_CONSULTAR_PROCEDIMENTO); + $objOperacaoServicoDTO->setNumIdServico($objServicoDTO->getNumIdServico()); + + + $objOperacaoServicoRN = new OperacaoServicoRN(); + if ($objOperacaoServicoRN->contar($objOperacaoServicoDTO) == 0) { + if ($objUnidadeDTO == null) { + $objInfraException->lancarValidacao('Nenhum serviço configurado para consulta deste processo [' . $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado() . '] pelo Serviço [' . $objServicoDTO->getStrIdentificacao() . '].'); + } else { + $objInfraException->lancarValidacao('Nenhum serviço configurado para consulta deste processo [' . $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado() . '] na unidade [' . $objUnidadeDTO->getStrSigla() . '] pelo Serviço [' . $objServicoDTO->getStrIdentificacao() . '].'); + } + } + + $objInfraException->lancarValidacoes(); + + //verifica se o usuário já tem acesso ao processo + $objAcessoExternoDTO = new AcessoExternoDTO(); + $objAcessoExternoDTO->retNumIdAcessoExterno(); + $objAcessoExternoDTO->setDblIdProtocoloAtividade($objProcedimentoDTO->getDblIdProcedimento()); + $objAcessoExternoDTO->setNumIdContatoParticipante($objServicoDTO->getNumIdContatoUsuario()); + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA); + + $objAcessoExternoRN = new AcessoExternoRN(); + $objAcessoExternoDTO = $objAcessoExternoRN->consultar($objAcessoExternoDTO); + + if ($objAcessoExternoDTO == null) { + + $objParticipanteDTO = new ParticipanteDTO(); + $objParticipanteDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); + $objParticipanteDTO->setNumIdContato($objServicoDTO->getNumIdContatoUsuario()); + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_ACESSO_EXTERNO); + $objParticipanteDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); + $objParticipanteDTO->setNumSequencia(0); + + $objParticipanteRN = new ParticipanteRN(); + $objParticipanteDTO = $objParticipanteRN->cadastrarRN0170($objParticipanteDTO); + + $objAcessoExternoDTO = new AcessoExternoDTO(); + $objAcessoExternoDTO->setNumIdParticipante($objParticipanteDTO->getNumIdParticipante()); + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA); + + $objAcessoExternoRN = new AcessoExternoRN(); + $objAcessoExternoDTO = $objAcessoExternoRN->cadastrar($objAcessoExternoDTO); + } + + $ArrObjWSRetornoConsultarProcedimentoDTO[$i] = new WSRetornoConsultarProcedimentoDTO(); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setStrProcedimentoFormatado($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setStrNomeTipoProcedimento($objProcedimentoDTO->getStrNomeTipoProcedimento()); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setDtaAutuacao($objProcedimentoDTO->getDtaGeracaoProtocolo()); + $ArrObjWSRetornoConsultarProcedimentoDTO[$i]->setStrEspecificacao($objProcedimentoDTO->getStrDescricaoProtocolo()); + + $i++; + } + + return $ArrObjWSRetornoConsultarProcedimentoDTO; + + }catch(Exception $e){ + throw new InfraException('Erro no serviço de consulta de procedimento.',$e); + } + } + + protected function listarAndamentosControlado(WSEntradaListarAndamentosDTO $objWSEntradaListarAndamentosDTO){ + try{ + + $objInfraException = new InfraException(); + + $objAtividadeRN = new AtividadeRN(); + $objProcedimentoRN = new ProcedimentoRN(); + + $objServicoDTO = $objWSEntradaListarAndamentosDTO->getObjServicoDTO(); + $objProcedimentoDTO = $objWSEntradaListarAndamentosDTO->getObjProcedimentoDTO(); + $objUnidadeDTO = $objWSEntradaListarAndamentosDTO->getObjUnidadeDTO(); + + $dto = new ProcedimentoDTO(); + $dto->retDblIdProcedimento(); + $dto->retStrProtocoloProcedimentoFormatado(); + $dto->retStrStaNivelAcessoGlobalProtocolo(); + $dto->retNumIdTipoProcedimento(); + $dto->retStrNomeTipoProcedimento(); + $dto->retStrDescricaoProtocolo(); + $dto->retDtaGeracaoProtocolo(); + $dto->setStrProtocoloProcedimentoFormatadoPesquisa(InfraUtil::retirarFormatacao($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); + $dto->setStrStaNivelAcessoGlobalProtocolo(ProtocoloRN::$NA_SIGILOSO, InfraDTO::$OPER_DIFERENTE); + + $dto = $objProcedimentoRN->consultarRN0201($dto); + + if ($dto==null){ + $objInfraException->lancarValidacao('Processo '.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().' não encontrado.'); + } + + $objProcedimentoDTO = $dto; + + $objWSRetornoListarAndamentosDTO = new WSCguRetornoListarAndamentosDTO(); + + $objWSRetornoListarAndamentosDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); + $objWSRetornoListarAndamentosDTO->setStrProcedimentoFormatado($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); + $objWSRetornoListarAndamentosDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); + $objWSRetornoListarAndamentosDTO->setStrNomeTipoProcedimento($objProcedimentoDTO->getStrNomeTipoProcedimento()); + + $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); + $objProcedimentoHistoricoDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); + $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_RESUMIDO); + $objProcedimentoHistoricoDTO->setStrSinGerarLinksHistorico('N'); + //$objProcedimentoHistoricoDTO->setNumMaxRegistrosRetorno(1); + $objProcedimentoDTOHistorico = $objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); + $arrObjAtividadeDTOHistorico = $objProcedimentoDTOHistorico->getArrObjAtividadeDTO(); + + $objWSRetornoListarAndamentosDTO->setArrObjAtividadeDTO($arrObjAtividadeDTOHistorico); + + return $objWSRetornoListarAndamentosDTO; + + }catch(Exception $e){ + throw new InfraException('Erro no serviço de consulta de andamentos.',$e); + } + } + + + protected function listarProcedimentosTramitadosParaAreaControlado(WSEntradaListarProcedimentosTramitadosDTO $objWsEntradaListarProcedimentosTramitadosDTO){ + try{ + + $objInfraException = new InfraException(); + + $objAtividadeRN = new AtividadeRN(); + $objProcedimentoRN = new ProcedimentoRN(); + + /*$dto = new ProcedimentoDTO(); + $dto->retDblIdProcedimento(); + $dto->retStrProtocoloProcedimentoFormatado(); + $dto->retStrStaNivelAcessoGlobalProtocolo(); + $dto->retNumIdTipoProcedimento(); + $dto->retStrNomeTipoProcedimento(); + $dto->retStrDescricaoProtocolo(); + $dto->retDtaGeracaoProtocolo(); + $dto->setStrProtocoloProcedimentoFormatadoPesquisa(InfraUtil::retirarFormatacao($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); + $dto->setStrStaNivelAcessoGlobalProtocolo(ProtocoloRN::$NA_SIGILOSO, InfraDTO::$OPER_DIFERENTE); + + $dto = $objProcedimentoRN->consultarRN0201($dto); + + if ($dto==null){ + $objInfraException->lancarValidacao('Processo '.$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado().' não encontrado.'); + } + + $objProcedimentoDTO = $dto;*/ + + $objWSRetornoListarAndamentosDTO = new WSCguRetornoListarAndamentosDTO(); + + /*$objWSRetornoListarAndamentosDTO->setDblIdProcedimento($objProcedimentoDTO->getDblIdProcedimento()); + $objWSRetornoListarAndamentosDTO->setStrProcedimentoFormatado($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); + $objWSRetornoListarAndamentosDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); + $objWSRetornoListarAndamentosDTO->setStrNomeTipoProcedimento($objProcedimentoDTO->getStrNomeTipoProcedimento());*/ + + $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); + $objProcedimentoHistoricoDTO->setDblIdProcedimento($objWsEntradaListarProcedimentosTramitadosDTO->getDblIdProcedimento()); + $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_RESUMIDO); + $objProcedimentoHistoricoDTO->setStrSinGerarLinksHistorico('N'); + //$objProcedimentoHistoricoDTO->setNumMaxRegistrosRetorno(1); + $objProcedimentoDTOHistorico = $objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); + $arrObjAtividadeDTOHistorico = $objProcedimentoDTOHistorico->getArrObjAtividadeDTO(); + + $objWSRetornoListarAndamentosDTO->setArrObjAtividadeDTO($arrObjAtividadeDTOHistorico); + + return $objWSRetornoListarAndamentosDTO; + + }catch(Exception $e){ + throw new InfraException('Erro no serviço de consulta de andamentos.',$e); + } + } + + private function prepararParticipantes($Interessado){ + + $objParticipanteDTO = new ParticipanteDTO(); + $objParticipanteDTO->retDblIdProtocolo(); + $objParticipanteDTO->retNumIdParticipante(); + $objParticipanteDTO->retNumIdContato(); + $objParticipanteDTO->retStrNomeContato(); + $objParticipanteDTO->retStrSiglaContato(); + $objParticipanteDTO->setStrNomeContato('%'.$Interessado.'%',InfraDTO::$OPER_LIKE); + + //filtra somente processos + $objParticipanteDTO->setStrStaProtocoloProtocolo(ProtocoloRN::$TP_PROCEDIMENTO); + + //como não tem paginação é bom limitar + $objParticipanteDTO->setNumMaxRegistrosRetorno(500); + + $objParticipanteRN = new ParticipanteRN(); + $arrObjParticipanteDTO = $objParticipanteRN->listarRN0189($objParticipanteDTO); + + if (count($arrObjParticipanteDTO)==0){ + throw new InfraException('Nenhum interessado encontrado!'); } + + $ret = array(); + + foreach($arrObjParticipanteDTO as $Participante){ + $ret[] = $Participante->getDblIdProtocolo(); + } + + return $ret; + } + + private function prepararClassificacaoAssunto($ClassificacaoAssunto){ + + + $objRelProtocoloAssuntoDTO = new RelProtocoloAssuntoDTO(); + $objRelProtocoloAssuntoDTO->retDblIdProtocolo(); + $objRelProtocoloAssuntoDTO->retNumIdAssunto(); + $objRelProtocoloAssuntoDTO->setStrCodigoEstruturadoAssunto($ClassificacaoAssunto); + + //como não tem paginação é bom limitar + $objRelProtocoloAssuntoDTO->setNumMaxRegistrosRetorno(500); + + $objRelProtocoloAssuntoRN = new RelProtocoloAssuntoRN(); + $arrAssuntos = $objRelProtocoloAssuntoRN->listarRN0188($objRelProtocoloAssuntoDTO); + + if (count($arrAssuntos)==0){ + throw new InfraException('Nenhuma Classificação de Assunto encontrado!'); } + + $ret = array(); + foreach($arrAssuntos as $Assuntos){ + $ret[] = $Assuntos->getDblIdProtocolo(); + } + + return $ret; + } + + private function prepararUnidadeProcedimentoAberto($numIdUnidade, $numIdUsuario){ + + $objPesquisaPendenciaDTO = new PesquisaPendenciaDTO(); + $objPesquisaPendenciaDTO->retDblIdProtocolo(); + $objPesquisaPendenciaDTO->retNumIdUsuario(); + $objPesquisaPendenciaDTO->setNumIdUsuario($numIdUsuario); + $objPesquisaPendenciaDTO->setNumIdUnidade($numIdUnidade); + + $objAtividadeRN = new AtividadeRN(); + + $arrObjPendenciaDTO = $objAtividadeRN->listarPendenciasRN0754($objPesquisaPendenciaDTO); + + if (count($arrObjPendenciaDTO)==0){ + throw new InfraException('Nenhum Procedimento com Pendência para a Unidade Informada!'); } + + $ret = array(); + + foreach($arrObjPendenciaDTO as $objPendenciaDTO){ + $ret[] = $objPendenciaDTO->getDblIdProcedimento(); + } + + return $ret; + } + + private function adicionarCriteriosProcesso(OperacaoServicoDTO $objOperacaoServicoDTO, ProcedimentoDTO $objProcedimentoDTO){ + + //tipo informado ou qualquer um + $objOperacaoServicoDTO->adicionarCriterio(array('IdTipoProcedimento','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objProcedimentoDTO->getNumIdTipoProcedimento(),null), + InfraDTO::$OPER_LOGICO_OR); + } + + private function adicionarCriteriosUnidade(OperacaoServicoDTO $objOperacaoServicoDTO, UnidadeDTO $objUnidadeDTO){ + + //unidade informada ou qualquer uma + $objOperacaoServicoDTO->adicionarCriterio(array('IdUnidade','IdUnidade'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objUnidadeDTO->getNumIdUnidade(),null), + InfraDTO::$OPER_LOGICO_OR); + } + + private function adicionarCriteriosUnidadeProcesso(OperacaoServicoDTO $objOperacaoServicoDTO, UnidadeDTO $objUnidadeDTO, ProcedimentoDTO $objProcedimentoDTO){ + + //qualquer tipo em qualquer unidade + $objOperacaoServicoDTO->adicionarCriterio(array('IdTipoProcedimento','IdUnidade'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null,null), + InfraDTO::$OPER_LOGICO_AND, + 'c1'); + + //este tipo em qualquer unidade + $objOperacaoServicoDTO->adicionarCriterio(array('IdTipoProcedimento','IdUnidade'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objProcedimentoDTO->getNumIdTipoProcedimento(),null), + InfraDTO::$OPER_LOGICO_AND, + 'c2'); + + //qualquer tipo nesta unidade + $objOperacaoServicoDTO->adicionarCriterio(array('IdTipoProcedimento','IdUnidade'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null, $objUnidadeDTO->getNumIdUnidade()), + InfraDTO::$OPER_LOGICO_AND, + 'c3'); + + //este tipo nesta unidade + $objOperacaoServicoDTO->adicionarCriterio(array('IdTipoProcedimento','IdUnidade'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objProcedimentoDTO->getNumIdTipoProcedimento(), $objUnidadeDTO->getNumIdUnidade()), + InfraDTO::$OPER_LOGICO_AND, + 'c4'); + + $objOperacaoServicoDTO->agruparCriterios(array('c1','c2','c3','c4'), + array(InfraDTO::$OPER_LOGICO_OR, InfraDTO::$OPER_LOGICO_OR, InfraDTO::$OPER_LOGICO_OR)); + } + + private function adicionarCriteriosProcessoDocumento(OperacaoServicoDTO $objOperacaoServicoDTO, ProcedimentoDTO $objProcedimentoDTO, DocumentoDTO $objDocumentoDTO){ + + //qualquer série em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null,null), + array(InfraDTO::$OPER_LOGICO_AND), + 'c1'); + + //esta série em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(),null), + array(InfraDTO::$OPER_LOGICO_AND), + 'c2'); + + //qualquer série neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null, $objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND), + 'c3'); + + //esta série neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(), $objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND), + 'c4'); + + $objOperacaoServicoDTO->agruparCriterios(array('c1','c2','c3','c4'), + array(InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR)); + } + + private function adicionarCriteriosUnidadeProcessoDocumento(OperacaoServicoDTO $objOperacaoServicoDTO, UnidadeDTO $objUnidadeDTO, ProcedimentoDTO $objProcedimentoDTO, DocumentoDTO $objDocumentoDTO){ + + //qualquer série em qualquer unidade em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null,null,null), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c1'); + + //esta série em qualquer unidade em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(),null,null), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c2'); + + //qualquer série nesta unidade em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null, $objUnidadeDTO->getNumIdUnidade(),null), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c3'); + + //qualquer série em qualquer unidade neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null, null ,$objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c4'); + + //esta série nesta unidade em qualquer tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(), $objUnidadeDTO->getNumIdUnidade(),null), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c5'); + + //esta série em qualquer unidade neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(), null,$objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c6'); + + //qualquer série nesta unidade neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array(null, $objUnidadeDTO->getNumIdUnidade(),$objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c7'); + + //esta série nesta unidade neste tipo de procedimento + $objOperacaoServicoDTO->adicionarCriterio(array('IdSerie','IdUnidade','IdTipoProcedimento'), + array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), + array($objDocumentoDTO->getNumIdSerie(), $objUnidadeDTO->getNumIdUnidade(),$objProcedimentoDTO->getNumIdTipoProcedimento()), + array(InfraDTO::$OPER_LOGICO_AND,InfraDTO::$OPER_LOGICO_AND), + 'c8'); + + $objOperacaoServicoDTO->agruparCriterios(array('c1','c2','c3','c4','c5','c6','c7','c8'), + array(InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR, + InfraDTO::$OPER_LOGICO_OR)); + } +} +?> \ No newline at end of file diff --git a/ws/CguWS.php b/ws/CguWS.php new file mode 100644 index 0000000..d50bb03 --- /dev/null +++ b/ws/CguWS.php @@ -0,0 +1,596 @@ +setBolLigado(false); + InfraDebug::getInstance()->setBolDebugInfra(false); + InfraDebug::getInstance()->limpar(); + + InfraDebug::getInstance()->gravar(__METHOD__); + InfraDebug::getInstance()->gravar('SIGLA SISTEMA:'.$SiglaSistema); + InfraDebug::getInstance()->gravar('IDENTIFICACAO SERVICO:'.$IdentificacaoServico); + InfraDebug::getInstance()->gravar('ID UNIDADE:'.$IdUnidade); + InfraDebug::getInstance()->gravar('PROTOCOLO PROCEDIMENTO:'.$ProtocoloProcedimento); + InfraDebug::getInstance()->gravar('PROTOCOLO DOCUMENTO:'.$ProtocoloDocumento); + InfraDebug::getInstance()->gravar('NUMERO DOCUMENTO:'.$NumeroDocumento); + InfraDebug::getInstance()->gravar('SERIE:'.$Serie); + InfraDebug::getInstance()->gravar('UNIDADE ELABORADORA:'.$UnidadeElaboradora); + InfraDebug::getInstance()->gravar('DATA INICIAL:'.$DataInicial); + InfraDebug::getInstance()->gravar('DATA FINAL:'.$DataFinal); + InfraDebug::getInstance()->gravar('RETORNAR ANDAMENTO GERACAO:'.$SinRetornarAndamentoGeracao); + InfraDebug::getInstance()->gravar('RETORNAR ASSINATURAS:'.$SinRetornarAssinaturas); + InfraDebug::getInstance()->gravar('RETORNAR PUBLICACAO:'.$SinRetornarPublicacao); + InfraDebug::getInstance()->gravar('RETORNAR DESTINATARIOS:'.$SinRetornarDestinatarios); + + SessaoSEI::getInstance(false); + + $objServicoDTO = $this->obterServico($SiglaSistema, $IdentificacaoServico); + + if ($IdUnidade!=null){ + $objUnidadeDTO = $this->obterUnidade($IdUnidade,null); + }else{ + $objUnidadeDTO = null; + } + + $this->validarAcessoAutorizado(explode(',',str_replace(' ','',$objServicoDTO->getStrServidor()))); + + if ($objUnidadeDTO==null){ + SessaoSEI::getInstance()->simularLogin(null, SessaoSEI::$UNIDADE_TESTE, $objServicoDTO->getNumIdUsuario(), null); + }else{ + SessaoSEI::getInstance()->simularLogin(null, null, $objServicoDTO->getNumIdUsuario(), $objUnidadeDTO->getNumIdUnidade()); + } + + $objDocumentoDTO = new DocumentoDTO(); + if($ProtocoloDocumento!='') { + $objDocumentoDTO->setStrProtocoloDocumentoFormatado($ProtocoloDocumento); + } + if($ProtocoloProcedimento!='') { + $objDocumentoDTO->setStrProtocoloProcedimentoFormatado($ProtocoloProcedimento); + } + if($NumeroDocumento!='') { + $objDocumentoDTO->setStrNumero($NumeroDocumento); + } + + $objDocumentoDTO->setNumIdSerie($Serie); + $objDocumentoDTO->setNumIdUnidadeGeradoraProtocolo($UnidadeElaboradora); + + $objWSEntradaListarDocumentoDTO = new WSEntradaListarDocumentoDTO(); + $objWSEntradaListarDocumentoDTO->setObjServicoDTO($objServicoDTO); + $objWSEntradaListarDocumentoDTO->setObjDocumentoDTO($objDocumentoDTO); + $objWSEntradaListarDocumentoDTO->setObjUnidadeDTO($objUnidadeDTO); + + if($DataInicial!='') { + $objWSEntradaListarDocumentoDTO->setDtaDataInicialGeracaoProtocolo($DataInicial); + } + else{ + $objWSEntradaListarDocumentoDTO->setDtaDataInicialGeracaoProtocolo(null); + } + + if($DataFinal!='') { + $objWSEntradaListarDocumentoDTO->setDtaDataFinalGeracaoProtocolo($DataFinal); + } + else{ + $objWSEntradaListarDocumentoDTO->setDtaDataFinalGeracaoProtocolo(null); + } + + if (trim($SinRetornarAndamentoGeracao)!=''){ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarAndamentoGeracao($SinRetornarAndamentoGeracao); + }else{ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarAndamentoGeracao('N'); + } + + if (trim($SinRetornarAssinaturas)!=''){ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarAssinaturas($SinRetornarAssinaturas); + }else{ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarAssinaturas('N'); + } + + if (trim($SinRetornarPublicacao)!=''){ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarPublicacao($SinRetornarPublicacao); + }else{ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarPublicacao('N'); + } + + if (trim($SinRetornarDestinatarios)!=''){ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarDestinatarios($SinRetornarDestinatarios); + }else{ + $objWSEntradaListarDocumentoDTO->setStrSinRetornarDestinatarios('N'); + } + + $objCguRN = new CguRN(); + $objWSRetornoListarDocumentoDTO = $objCguRN->listarDocumento($objWSEntradaListarDocumentoDTO); + + $i = 0; + $ret = array(); + foreach($objWSRetornoListarDocumentoDTO as $retObjWSRetornoListarDocumentoDTO) { + + $ret[$i]['IdProcedimento'] = $retObjWSRetornoListarDocumentoDTO->getDblIdProcedimento(); + $ret[$i]['ProcedimentoFormatado'] = $retObjWSRetornoListarDocumentoDTO->getStrProcedimentoFormatado(); + $ret[$i]['IdDocumento'] = $retObjWSRetornoListarDocumentoDTO->getDblIdDocumento(); + $ret[$i]['DocumentoFormatado'] = $retObjWSRetornoListarDocumentoDTO->getStrDocumentoFormatado(); + $ret[$i]['LinkAcesso'] = $retObjWSRetornoListarDocumentoDTO->getStrLinkAcesso(); + + $ret[$i]['Serie'] = (object)array('IdSerie' => $retObjWSRetornoListarDocumentoDTO->getNumIdSerie(), + 'Nome' => $retObjWSRetornoListarDocumentoDTO->getStrNomeSerie()); + + $ret[$i]['Numero'] = $retObjWSRetornoListarDocumentoDTO->getStrNumero(); + $ret[$i]['Data'] = $retObjWSRetornoListarDocumentoDTO->getDtaGeracaoProtocolo(); + + $ret[$i]['UnidadeElaboradora'] = (object)array('IdUnidade' => $retObjWSRetornoListarDocumentoDTO->getNumIdUnidadeGeradora(), + 'Sigla' => $retObjWSRetornoListarDocumentoDTO->getStrSiglaUnidadeGeradora(), + 'Descricao' => $retObjWSRetornoListarDocumentoDTO->getStrDescricaoUnidadeGeradora()); + + + $objAtividadeDTO = $retObjWSRetornoListarDocumentoDTO->getObjAtividadeDTOGeracao(); + if ($objAtividadeDTO != null) { + $ret[$i]['AndamentoGeracao'] = (object)array('Descricao' => $objAtividadeDTO->getStrNomeTarefa(), + 'DataHora' => $objAtividadeDTO->getDthAbertura(), + 'Unidade' => (object)array('IdUnidade' => $objAtividadeDTO->getNumIdUnidade(), + 'Sigla' => $objAtividadeDTO->getStrSiglaUnidade(), + 'Descricao' => $objAtividadeDTO->getStrDescricaoUnidade()), + 'Usuario' => (object)array('IdUsuario' => $objAtividadeDTO->getNumIdUsuarioOrigem(), + 'Sigla' => $objAtividadeDTO->getStrSiglaUsuarioOrigem(), + 'Nome' => $objAtividadeDTO->getStrNomeUsuarioOrigem())); + } else { + $ret[$i]['AndamentoGeracao'] = null; + } + + + $arrObjAssinaturaDTO = $retObjWSRetornoListarDocumentoDTO->getArrObjAssinaturaDTO(); + $arrAssinaturas = array(); + foreach ($arrObjAssinaturaDTO as $objAssinaturaDTO) { + $arrAssinaturas[] = (object)array('Nome' => $objAssinaturaDTO->getStrNome(), + 'CargoFuncao' => $objAssinaturaDTO->getStrTratamento(), + 'DataHora' => $objAssinaturaDTO->getDthAberturaAtividade()); + } + $ret[$i]['Assinaturas'] = $arrAssinaturas; + + $objPublicacaoDTO = $retObjWSRetornoListarDocumentoDTO->getObjPublicacaoDTO(); + if ($objPublicacaoDTO != null) { + $ret[$i]['Publicacao'] = (object)array('NomeVeiculo' => $objPublicacaoDTO->getStrNomeVeiculoPublicacao(), + 'Numero' => $objPublicacaoDTO->getNumNumero(), + 'DataDisponibilizacao' => $objPublicacaoDTO->getDtaDisponibilizacao(), + 'DataPublicacao' => $objPublicacaoDTO->getDtaPublicacao(), + 'Estado' => $objPublicacaoDTO->getStrStaEstado(), + 'ImprensaNacional' => null); + + if (!InfraString::isBolVazia($objPublicacaoDTO->getNumIdVeiculoIO())) { + $ret[$i]['Publicacao']->ImprensaNacional = (object)array('SiglaVeiculo' => $objPublicacaoDTO->getStrSiglaVeiculoImprensaNacional(), + 'DescricaoVeiculo' => $objPublicacaoDTO->getStrDescricaoVeiculoImprensaNacional(), + 'Pagina' => $objPublicacaoDTO->getStrPaginaIO(), + 'Secao' => $objPublicacaoDTO->getStrNomeSecaoImprensaNacional(), + 'Data' => $objPublicacaoDTO->getDtaPublicacaoIO()); + } + } else { + $ret[$i]['Publicacao'] = null; + } + + $arrObjDestinatarioDTO = $retObjWSRetornoListarDocumentoDTO->getArrObjParticipanteDTO(); + $arrDestinatarios = array(); + foreach ($arrObjDestinatarioDTO as $objDestinatarioDTO) { + $arrDestinatarios[] = (object)array('IdContato' => $objDestinatarioDTO->getNumIdContato(), + 'NomeContato' => $objDestinatarioDTO->getStrNomeContato(), + 'EmailContato' => $objDestinatarioDTO->getStrEmailContato(), + 'SiglaUnidade' => $objDestinatarioDTO->getStrSiglaUnidade()); + + } + $ret[$i]['Destinatarios'] = $arrDestinatarios; + + $i++; + } + + //LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); + + return $ret; + + }catch(Exception $e){ + $this->processarExcecao($e); + } + } + + /** + * @param $SiglaSistema + * @param $IdentificacaoServico + * @param $IdUnidade + * @param $ProtocoloProcedimento + * @param $Interessado + * @param $DescricaoAssunto + * @param $IdTipoProcedimento + * @param $NomeTipoProcedimento + * @param $ClassificacaoAssunto + * @param $DataInicialRegistroProcedimento + * @param $DataFinalRegistroProcedimento + * @param $UnidadeProcedimentoAberto + * @return array + * @throws InfraException + * @throws SoapFault + */ + public function listarProcedimentos($SiglaSistema, $IdentificacaoServico, $IdUnidade, $ProtocoloProcedimento, $Interessado, $DescricaoAssunto, $IdTipoProcedimento, $NomeTipoProcedimento, $ClassificacaoAssunto, $DataInicialRegistroProcedimento, $DataFinalRegistroProcedimento, $UnidadeProcedimentoAberto ){ + + try{ + + InfraDebug::getInstance()->setBolLigado(false); + InfraDebug::getInstance()->setBolDebugInfra(false); + InfraDebug::getInstance()->limpar(); + + InfraDebug::getInstance()->gravar(__METHOD__); + InfraDebug::getInstance()->gravar('SIGLA SISTEMA:'.$SiglaSistema); + InfraDebug::getInstance()->gravar('IDENTIFICACAO SERVICO:'.$IdentificacaoServico); + InfraDebug::getInstance()->gravar('ID UNIDADE:'.$IdUnidade); + InfraDebug::getInstance()->gravar('PROTOCOLO PROCEDIMENTO:'.$ProtocoloProcedimento); + InfraDebug::getInstance()->gravar('INTERESSADO:'.$Interessado); + InfraDebug::getInstance()->gravar('DESCRICAO ASSUNTO:'.$DescricaoAssunto); + InfraDebug::getInstance()->gravar('ID TIPO PROCEDIMENTO:'.$IdTipoProcedimento); + InfraDebug::getInstance()->gravar('NOME TIPO PROCEDIMENTO:'.$NomeTipoProcedimento); + InfraDebug::getInstance()->gravar('CLASSIFICACAO ASSUNTO:'.$ClassificacaoAssunto); + InfraDebug::getInstance()->gravar('DATA INICIAL REGISTRO PROCEDIMENTO:'.$DataInicialRegistroProcedimento); + InfraDebug::getInstance()->gravar('DATA FINAL REGISTRO PROCEDIMENTO:'.$DataFinalRegistroProcedimento); + InfraDebug::getInstance()->gravar('UNIDADE PROCEDIMENTO ABERTO:'.$UnidadeProcedimentoAberto); + + SessaoSEI::getInstance(false); + + $objServicoDTO = $this->obterServico($SiglaSistema, $IdentificacaoServico); + + if ($IdUnidade!=null){ + $objUnidadeDTO = $this->obterUnidade($IdUnidade, null); + }else{ + $objUnidadeDTO = null; + } + + $this->validarAcessoAutorizado(explode(',',str_replace(' ','',$objServicoDTO->getStrServidor()))); + + if ($objUnidadeDTO==null){ + SessaoSEI::getInstance()->simularLogin(null, SessaoSEI::$UNIDADE_TESTE, $objServicoDTO->getNumIdUsuario(), null); + }else{ + SessaoSEI::getInstance()->simularLogin(null, null, $objServicoDTO->getNumIdUsuario(), $objUnidadeDTO->getNumIdUnidade()); + } + + $objProcedimentoDTO = new ProcedimentoDTO(); + $objProcedimentoDTO->setStrProtocoloProcedimentoFormatado($ProtocoloProcedimento); + + $objProcedimentoDTO->setStrDescricaoProtocolo($DescricaoAssunto); + $objProcedimentoDTO->setNumIdTipoProcedimento($IdTipoProcedimento); + $objProcedimentoDTO->setStrNomeTipoProcedimento($NomeTipoProcedimento); + + $objWSEntradaListarProcedimentoDTO = new WSEntradaListarProcedimentoDTO(); + $objWSEntradaListarProcedimentoDTO->setObjServicoDTO($objServicoDTO); + $objWSEntradaListarProcedimentoDTO->setObjProcedimentoDTO($objProcedimentoDTO); + $objWSEntradaListarProcedimentoDTO->setObjUnidadeDTO($objUnidadeDTO); + + if($Interessado!='') { + $objWSEntradaListarProcedimentoDTO->setStrInteressado($Interessado); + } + else{ + $objWSEntradaListarProcedimentoDTO->setStrInteressado(null); + } + + if($ClassificacaoAssunto!='') { + $objWSEntradaListarProcedimentoDTO->setStrClassificacaoAssunto($ClassificacaoAssunto); + } + else{ + $objWSEntradaListarProcedimentoDTO->setStrClassificacaoAssunto(null); + } + + if($DataInicialRegistroProcedimento!='') { + $objWSEntradaListarProcedimentoDTO->setDtaDataInicialRegistroProcedimento($DataInicialRegistroProcedimento); + } + else{ + $objWSEntradaListarProcedimentoDTO->setDtaDataInicialRegistroProcedimento(null); + } + + if($DataFinalRegistroProcedimento!='') { + $objWSEntradaListarProcedimentoDTO->setDtaDataFinalRegistroProcedimento($DataFinalRegistroProcedimento); + } + else{ + $objWSEntradaListarProcedimentoDTO->setDtaDataFinalRegistroProcedimento(null); + } + + if($UnidadeProcedimentoAberto!='') { + $objUnidadeProcedimentoAberto = $this->obterUnidade(null,$UnidadeProcedimentoAberto); + $objWSEntradaListarProcedimentoDTO->setNumUnidadeProcedimentoAberto($objUnidadeProcedimentoAberto->getNumIdUnidade()); + } + else{ + $objWSEntradaListarProcedimentoDTO->setNumUnidadeProcedimentoAberto(null); + } + + $objCguRN = new CguRN(); + $objWSRetornoListarProcedimentoDTO = $objCguRN->listarProcedimento($objWSEntradaListarProcedimentoDTO); + + $ret = array(); + $i = 0; + + foreach($objWSRetornoListarProcedimentoDTO as $retObjWSRetornoListarProcedimentoDTO) { + + $ret[$i]['IdProcedimento'] = $retObjWSRetornoListarProcedimentoDTO->getDblIdProcedimento(); + $ret[$i]['ProcedimentoFormatado'] = $retObjWSRetornoListarProcedimentoDTO->getStrProcedimentoFormatado(); + + $ret[$i]['TipoProcedimento'] = (object)array('IdTipoProcedimento' => $retObjWSRetornoListarProcedimentoDTO->getNumIdTipoProcedimento(), + 'Nome' => $retObjWSRetornoListarProcedimentoDTO->getStrNomeTipoProcedimento()); + + //LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); + $i++; + } + return $ret; + + }catch(Exception $e){ + $this->processarExcecao($e); + } + } + + /** + * @param $SiglaSistema + * @param $IdentificacaoServico + * @param $IdUnidade + * @param $ProtocoloProcedimento + * @return array + * @throws InfraException + * @throws SoapFault + */ + public function listarAndamentos($SiglaSistema, $IdentificacaoServico, $IdUnidade, $ProtocoloProcedimento ) + { + + try { + + InfraDebug::getInstance()->setBolLigado(false); + InfraDebug::getInstance()->setBolDebugInfra(false); + InfraDebug::getInstance()->limpar(); + + InfraDebug::getInstance()->gravar(__METHOD__); + InfraDebug::getInstance()->gravar('SIGLA SISTEMA:' . $SiglaSistema); + InfraDebug::getInstance()->gravar('IDENTIFICACAO SERVICO:' . $IdentificacaoServico); + InfraDebug::getInstance()->gravar('ID UNIDADE:' . $IdUnidade); + InfraDebug::getInstance()->gravar('PROTOCOLO PROCEDIMENTO:' . $ProtocoloProcedimento); + + SessaoSEI::getInstance(false); + + $objServicoDTO = $this->obterServico($SiglaSistema, $IdentificacaoServico); + + if ($IdUnidade != null) { + $objUnidadeDTO = $this->obterUnidade($IdUnidade, null); + } else { + $objUnidadeDTO = null; + } + + $this->validarAcessoAutorizado(explode(',', str_replace(' ', '', $objServicoDTO->getStrServidor()))); + + if ($objUnidadeDTO == null) { + SessaoSEI::getInstance()->simularLogin(null, SessaoSEI::$UNIDADE_TESTE, $objServicoDTO->getNumIdUsuario(), null); + } else { + SessaoSEI::getInstance()->simularLogin(null, null, $objServicoDTO->getNumIdUsuario(), $objUnidadeDTO->getNumIdUnidade()); + } + + $objProcedimentoDTO = new ProcedimentoDTO(); + $objProcedimentoDTO->setStrProtocoloProcedimentoFormatado($ProtocoloProcedimento); + + $objWSEntradaListarAndamentosDTO = new WSEntradaListarAndamentosDTO(); + $objWSEntradaListarAndamentosDTO->setObjServicoDTO($objServicoDTO); + $objWSEntradaListarAndamentosDTO->setObjProcedimentoDTO($objProcedimentoDTO); + $objWSEntradaListarAndamentosDTO->setObjUnidadeDTO($objUnidadeDTO); + + $objCguRN = new CguRN(); + $objWSRetornoListarAndamentosDTO = $objCguRN->listarAndamentos($objWSEntradaListarAndamentosDTO); + + $ret = array(); + $i = 0; + + /*?>
  
getDblIdProcedimento(); + $ret['ProcedimentoFormatado'] = $objWSRetornoListarAndamentosDTO->getStrProcedimentoFormatado(); + + $ret['TipoProcedimento'] = (object) array('IdTipoProcedimento' => $objWSRetornoListarAndamentosDTO->getNumIdTipoProcedimento(), + 'Nome' => $objWSRetornoListarAndamentosDTO->getStrNomeTipoProcedimento()); + + $arrObjAtividadeDTO = $objWSRetornoListarAndamentosDTO->getArrObjAtividadeDTO(); + $arrAtividades = array(); + + foreach ($arrObjAtividadeDTO as $objAtividadeDTO) { + + $arrAtividades[] = (object)array('Descricao' => $objAtividadeDTO->getStrNomeTarefa(), + 'DataHora' => $objAtividadeDTO->getDthAbertura(), + 'Unidade' => (object)array('IdUnidade'=> $objAtividadeDTO->getNumIdUnidade(), + 'Sigla' => $objAtividadeDTO->getStrSiglaUnidade(), + 'Descricao' => $objAtividadeDTO->getStrDescricaoUnidade()), + 'Usuario' => (object)array('IdUsuario'=> $objAtividadeDTO->getNumIdUsuarioOrigem(), + 'Sigla' => $objAtividadeDTO->getStrSiglaUsuarioOrigem(), + 'Nome' => $objAtividadeDTO->getStrNomeUsuarioOrigem())); + + //LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); + $i++; + } + $ret['Andamentos'] = $arrAtividades; + + return $ret; + + + }catch(Exception $e){ + $this->processarExcecao($e); + } + } + + /** + * @param $SiglaSistema + * @param $IdentificacaoServico + * @param $IdUnidade + * @param $ProtocoloProcedimento + * @return array + * @throws InfraException + * @throws SoapFault + */ + public function listarProcedimentosTramitadosParaArea($SiglaSistema, $IdentificacaoServico, $IdUnidade, $arrRequisicaoConsultaTramite, $idUnidadePesquisa ) + { + + try { + + InfraDebug::getInstance()->setBolLigado(false); + InfraDebug::getInstance()->setBolDebugInfra(false); + InfraDebug::getInstance()->limpar(); + + InfraDebug::getInstance()->gravar(__METHOD__); + InfraDebug::getInstance()->gravar('SIGLA SISTEMA:' . $SiglaSistema); + InfraDebug::getInstance()->gravar('IDENTIFICACAO SERVICO:' . $IdentificacaoServico); + InfraDebug::getInstance()->gravar('ID UNIDADE:' . $IdUnidade); + + SessaoSEI::getInstance(false); + + $objServicoDTO = $this->obterServico($SiglaSistema, $IdentificacaoServico); + + if ($IdUnidade != null) { + $objUnidadeDTO = $this->obterUnidade($IdUnidade, null); + } else { + $objUnidadeDTO = null; + } + + $this->validarAcessoAutorizado(explode(',', str_replace(' ', '', $objServicoDTO->getStrServidor()))); + + if ($objUnidadeDTO == null) { + SessaoSEI::getInstance()->simularLogin(null, SessaoSEI::$UNIDADE_TESTE, $objServicoDTO->getNumIdUsuario(), null); + } else { + SessaoSEI::getInstance()->simularLogin(null, null, $objServicoDTO->getNumIdUsuario(), $objUnidadeDTO->getNumIdUnidade()); + } + + $arrProtocolos = array(); + $ret = array(); + + $i = 0; + + foreach($arrRequisicaoConsultaTramite as $requisicaoConsultaTramite){ + + $idProcedimento = $requisicaoConsultaTramite->IdProcedimento; + $dataAbertura = strtotime($requisicaoConsultaTramite->DataAbertura); + //$idProcedimento = $requisicaoConsultaTramite['IdProcedimento']; + //$dataAbertura = strtotime($requisicaoConsultaTramite['DataAbertura']); + + $objWSEntradaListarProcedimentosTramitadosDTO = new WSEntradaListarProcedimentosTramitadosDTO(); + $objWSEntradaListarProcedimentosTramitadosDTO->setDblIdProcedimento($idProcedimento); + $objWSEntradaListarProcedimentosTramitadosDTO->setDthDataReferencia($dataAbertura); + $objWSEntradaListarProcedimentosTramitadosDTO->setNumIdUnidadePesquisa($idUnidadePesquisa); + + $objCguRN = new CguRN(); + $objWSRetornoListarAndamentosDTO = $objCguRN->listarProcedimentosTramitadosParaArea($objWSEntradaListarProcedimentosTramitadosDTO); + + $arrObjAtividadeDTO = $objWSRetornoListarAndamentosDTO->getArrObjAtividadeDTO(); + + //echo "

Procedimento" . $idProcedimento . "
"; + //var_dump($arrObjAtividadeDTO); + + foreach ($arrObjAtividadeDTO as $objAtividadeDTO) { + if($objAtividadeDTO->getDthAbertura() >= $dataAbertura){ + if($objAtividadeDTO->getNumIdUnidade() == $idUnidadePesquisa){ + $ret[$i]['IdProtocolo'] = $idProcedimento; + //$arrProtocolos[] = (object)array('IdProtocolo'=>$requisicaoConsultaTramite->IdProcedimentoPesquisa); + } + } + } + $i++; + } + //$ret['IdProtocolo'] = $arrProtocolos; + + return $ret; + + }catch(Exception $e){ + $this->processarExcecao($e); + } + } + + private function obterServico($SiglaSistema, $IdentificacaoServico){ + + $objUsuarioDTO = new UsuarioDTO(); + $objUsuarioDTO->retNumIdUsuario(); + $objUsuarioDTO->setStrSigla($SiglaSistema); + $objUsuarioDTO->setStrStaTipo(UsuarioRN::$TU_SISTEMA); + + $objUsuarioRN = new UsuarioRN(); + $objUsuarioDTO = $objUsuarioRN->consultarRN0489($objUsuarioDTO); + + if ($objUsuarioDTO==null){ + throw new InfraException('Sistema ['.$SiglaSistema.'] não encontrado.'); + } + + $objServicoDTO = new ServicoDTO(); + $objServicoDTO->retNumIdServico(); + $objServicoDTO->retStrIdentificacao(); + $objServicoDTO->retStrSiglaUsuario(); + $objServicoDTO->retNumIdUsuario(); + $objServicoDTO->retStrServidor(); + $objServicoDTO->retStrSinLinkExterno(); + $objServicoDTO->retNumIdContatoUsuario(); + $objServicoDTO->setNumIdUsuario($objUsuarioDTO->getNumIdUsuario()); + $objServicoDTO->setStrIdentificacao($IdentificacaoServico); + + $objServicoRN = new ServicoRN(); + $objServicoDTO = $objServicoRN->consultar($objServicoDTO); + + if ($objServicoDTO==null){ + throw new InfraException('Serviço ['.$IdentificacaoServico.'] do sistema ['.$SiglaSistema.'] não encontrado.'); + } + + return $objServicoDTO; + } + + private function obterUnidade($IdUnidade, $SiglaUnidade){ + + $objUnidadeDTO = new UnidadeDTO(); + $objUnidadeDTO->retNumIdUnidade(); + $objUnidadeDTO->retStrSigla(); + $objUnidadeDTO->retStrDescricao(); + + if($IdUnidade!=null) { + $objUnidadeDTO->setNumIdUnidade($IdUnidade); + } + if($SiglaUnidade!=null){ + $objUnidadeDTO->setStrSigla($SiglaUnidade); + } + + $objUnidadeRN = new UnidadeRN(); + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); + + if ($objUnidadeDTO==null){ + throw new InfraException('Unidade ['.$IdUnidade.'] não encontrada.'); + } + + return $objUnidadeDTO; + } +} + +/* + $servidorSoap = new SoapServer("sei.wsdl",array('encoding'=>'ISO-8859-1')); + $servidorSoap->setClass("SeiWS"); + + //Só processa se acessado via POST + if ($_SERVER['REQUEST_METHOD']=='POST') { + $servidorSoap->handle(); + } +*/ + +$servidorSoap = new BeSimple\SoapServer\SoapServer( "cgu.wsdl", array ('encoding'=>'ISO-8859-1', + 'soap_version' => SOAP_1_1, + 'attachment_type'=>BeSimple\SoapCommon\Helper::ATTACHMENTS_TYPE_MTOM)); +$servidorSoap->setClass ( "CguWS" ); + +//Só processa se acessado via POST +if ($_SERVER['REQUEST_METHOD']=='POST') { + $servidorSoap->handle($HTTP_RAW_POST_DATA); +} +?> \ No newline at end of file diff --git a/ws/cgu.wsdl b/ws/cgu.wsdl new file mode 100644 index 0000000..8eb6a2e --- /dev/null +++ b/ws/cgu.wsdl @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Consulta de processos + + + + + + Consulta de documentos + + + + + + Consulta de andamentos + + + + + + Consulta de andamentos Tramitados para determinada Ãrea + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- libgit2 0.21.2