Commit 2fc5620fe59c036218b93e4a53a063b9b9475729
1 parent
d2ba572a
Exists in
master
and in
19 other branches
[Fixed #47] Correção de problema com mapeamento de espécies documentais
fixed #32
Showing
8 changed files
with
191 additions
and
30 deletions
Show diff stats
dto/ComponenteDigitalDTO.php
@@ -23,11 +23,13 @@ class ComponenteDigitalDTO extends InfraDTO { | @@ -23,11 +23,13 @@ class ComponenteDigitalDTO extends InfraDTO { | ||
23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'MimeType', 'mime_type'); | 23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'MimeType', 'mime_type'); |
24 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'DadosComplementares', 'dados_complementares'); | 24 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'DadosComplementares', 'dados_complementares'); |
25 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Tamanho', 'tamanho'); | 25 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Tamanho', 'tamanho'); |
26 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'CodigoEspecie', 'codigo_especie'); | ||
27 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'NomeEspecieProdutor', 'nome_especie_produtor'); | ||
26 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Ordem', 'ordem'); | 28 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Ordem', 'ordem'); |
27 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinEnviar', 'sin_enviar'); | 29 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinEnviar', 'sin_enviar'); |
28 | 30 | ||
29 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'TicketEnvioComponentes', 'ticket_envio_componentes', 'md_pen_tramite'); | 31 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'TicketEnvioComponentes', 'ticket_envio_componentes', 'md_pen_tramite'); |
30 | - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'ConteudoAssinaturaDocumento', 'conteudo_assinatura', 'documento_conteudo'); | 32 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'ConteudoAssinaturaDocumento', 'conteudo_assinatura', 'documento_conteudo'); |
31 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'ProtocoloDocumentoFormatado', 'protocolo_formatado', 'protocolo'); | 33 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'ProtocoloDocumentoFormatado', 'protocolo_formatado', 'protocolo'); |
32 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'StaEstadoProtocolo', 'sta_estado', 'protocolo'); | 34 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'StaEstadoProtocolo', 'sta_estado', 'protocolo'); |
33 | 35 | ||
@@ -35,9 +37,9 @@ class ComponenteDigitalDTO extends InfraDTO { | @@ -35,9 +37,9 @@ class ComponenteDigitalDTO extends InfraDTO { | ||
35 | $this->configurarPK('IdDocumento', InfraDTO::$TIPO_PK_INFORMADO); | 37 | $this->configurarPK('IdDocumento', InfraDTO::$TIPO_PK_INFORMADO); |
36 | 38 | ||
37 | $this->configurarFK('NumeroRegistro', 'md_pen_tramite', 'numero_registro', InfraDTO::$TIPO_FK_OBRIGATORIA); | 39 | $this->configurarFK('NumeroRegistro', 'md_pen_tramite', 'numero_registro', InfraDTO::$TIPO_FK_OBRIGATORIA); |
38 | - $this->configurarFK('IdTramite', 'md_pen_tramite', 'id_tramite', InfraDTO::$TIPO_FK_OBRIGATORIA); | 40 | + $this->configurarFK('IdTramite', 'md_pen_tramite', 'id_tramite', InfraDTO::$TIPO_FK_OBRIGATORIA); |
39 | $this->configurarFK('IdDocumento', 'documento', 'id_documento', InfraDTO::$TIPO_FK_OBRIGATORIA); | 41 | $this->configurarFK('IdDocumento', 'documento', 'id_documento', InfraDTO::$TIPO_FK_OBRIGATORIA); |
40 | $this->configurarFK('IdDocumento', 'protocolo', 'id_protocolo', InfraDTO::$TIPO_FK_OBRIGATORIA); | 42 | $this->configurarFK('IdDocumento', 'protocolo', 'id_protocolo', InfraDTO::$TIPO_FK_OBRIGATORIA); |
41 | $this->configurarFK('IdDocumento', 'documento_conteudo', 'id_documento', InfraDTO::$TIPO_FK_OBRIGATORIA); | 43 | $this->configurarFK('IdDocumento', 'documento_conteudo', 'id_documento', InfraDTO::$TIPO_FK_OBRIGATORIA); |
42 | } | 44 | } |
43 | -} | ||
44 | \ No newline at end of file | 45 | \ No newline at end of file |
46 | +} |
dto/TramiteDTO.php
@@ -30,7 +30,7 @@ class TramiteDTO extends InfraDTO { | @@ -30,7 +30,7 @@ class TramiteDTO extends InfraDTO { | ||
30 | $this->configurarPK('IdTramite', InfraDTO::$TIPO_PK_INFORMADO); | 30 | $this->configurarPK('IdTramite', InfraDTO::$TIPO_PK_INFORMADO); |
31 | 31 | ||
32 | $this->configurarFK('NumeroRegistro', 'md_pen_tramite', 'numero_registro', InfraDTO::$TIPO_FK_OBRIGATORIA); | 32 | $this->configurarFK('NumeroRegistro', 'md_pen_tramite', 'numero_registro', InfraDTO::$TIPO_FK_OBRIGATORIA); |
33 | - $this->configurarFK('NumeroRegistro', 'md_pen_processo_eletronico pe', 'pe.numero_registro'); | 33 | + $this->configurarFK('NumeroRegistro', 'md_pen_processo_eletronico', 'numero_registro'); |
34 | $this->configurarFK('IdUsuario', 'usuario u', 'u.id_usuario'); | 34 | $this->configurarFK('IdUsuario', 'usuario u', 'u.id_usuario'); |
35 | $this->configurarFK('IdUnidade', 'unidade u', 'u.id_unidade'); | 35 | $this->configurarFK('IdUnidade', 'unidade u', 'u.id_unidade'); |
36 | } | 36 | } |
rn/ExpedirProcedimentoRN.php
@@ -114,6 +114,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -114,6 +114,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
114 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_VALIDACAO); | 114 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_VALIDACAO); |
115 | $this->barraProgresso->setStrRotulo(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_VALIDACAO); | 115 | $this->barraProgresso->setStrRotulo(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_VALIDACAO); |
116 | 116 | ||
117 | + | ||
117 | //Valida regras de negócio | 118 | //Valida regras de negócio |
118 | $objInfraException = new InfraException(); | 119 | $objInfraException = new InfraException(); |
119 | //Carregamento dos dados de processo e documento para validação e envio externo | 120 | //Carregamento dos dados de processo e documento para validação e envio externo |
@@ -133,11 +134,14 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -133,11 +134,14 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
133 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_PROCEDIMENTO); | 134 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_PROCEDIMENTO); |
134 | $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_PROCEDIMENTO, $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); | 135 | $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_PROCEDIMENTO, $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); |
135 | 136 | ||
137 | + //Busca metadados do processo registrado em trâmite anterior | ||
138 | + $objMetadadosProcessoTramiteAnterior = $this->consultarMetadadosPEN($dblIdProcedimento); | ||
139 | + | ||
136 | //Construo dos cabecalho para envio do processo | 140 | //Construo dos cabecalho para envio do processo |
137 | $objCabecalho = $this->construirCabecalho($objExpedirProcedimentoDTO); | 141 | $objCabecalho = $this->construirCabecalho($objExpedirProcedimentoDTO); |
138 | 142 | ||
139 | //Construção do processo para envio | 143 | //Construção do processo para envio |
140 | - $objProcesso = $this->construirProcesso($dblIdProcedimento, $objExpedirProcedimentoDTO->getArrIdProcessoApensado()); | 144 | + $objProcesso = $this->construirProcesso($dblIdProcedimento, $objExpedirProcedimentoDTO->getArrIdProcessoApensado(), $objMetadadosProcessoTramiteAnterior); |
141 | 145 | ||
142 | $param = new stdClass(); | 146 | $param = new stdClass(); |
143 | $param->novoTramiteDeProcesso = new stdClass(); | 147 | $param->novoTramiteDeProcesso = new stdClass(); |
@@ -237,6 +241,43 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -237,6 +241,43 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
237 | } | 241 | } |
238 | } | 242 | } |
239 | 243 | ||
244 | + /** | ||
245 | + * Busca metadados do processo registrado no Barramento de Serviços do PEN em trâmites anteriores | ||
246 | + * @return stdClass Metadados do Processo | ||
247 | + */ | ||
248 | + private function consultarMetadadosPEN($parDblIdProcedimento) | ||
249 | + { | ||
250 | + $objMetadadosProtocolo = null; | ||
251 | + | ||
252 | + try{ | ||
253 | + $objTramiteDTO = new TramiteDTO(); | ||
254 | + $objTramiteDTO->setNumIdProcedimento($parDblIdProcedimento); | ||
255 | + $objTramiteDTO->setStrStaTipoTramite(ProcessoEletronicoRN::$STA_TIPO_TRAMITE_RECEBIMENTO); | ||
256 | + $objTramiteDTO->setOrd('IdTramite', InfraDTO::$TIPO_ORDENACAO_DESC); | ||
257 | + $objTramiteDTO->setNumMaxRegistrosRetorno(1); | ||
258 | + $objTramiteDTO->retNumIdTramite(); | ||
259 | + | ||
260 | + $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); | ||
261 | + $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | ||
262 | + if(isset($objTramiteDTO)) { | ||
263 | + $parNumIdentificacaoTramite = $objTramiteDTO->getNumIdTramite(); | ||
264 | + $objRetorno = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); | ||
265 | + | ||
266 | + if(isset($objRetorno)){ | ||
267 | + $objMetadadosProtocolo = $objRetorno->metadados; | ||
268 | + } | ||
269 | + } | ||
270 | + } | ||
271 | + catch(Exception $e){ | ||
272 | + //Em caso de falha na comunicação com o barramento neste ponto, o procedimento deve serguir em frente considerando | ||
273 | + //que os metadados do protocolo não pode ser obtida | ||
274 | + $objMetadadosProtocolo = null; | ||
275 | + LogSEI::getInstance()->gravar("Falha na obtenção dos metadados de trâmites anteriores do processo ($parDblIdProcedimento) durante trâmite externo."); | ||
276 | + throw $e; | ||
277 | + } | ||
278 | + | ||
279 | + return $objMetadadosProtocolo; | ||
280 | + } | ||
240 | 281 | ||
241 | public function listarRepositoriosDeEstruturas() | 282 | public function listarRepositoriosDeEstruturas() |
242 | { | 283 | { |
@@ -363,13 +404,12 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -363,13 +404,12 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
363 | ); | 404 | ); |
364 | } | 405 | } |
365 | 406 | ||
366 | - private function construirProcesso($dblIdProcedimento, $arrIdProcessoApensado = null) | 407 | + private function construirProcesso($dblIdProcedimento, $arrIdProcessoApensado=null, $parObjMetadadosTramiteAnterior=null) |
367 | { | 408 | { |
368 | if(!isset($dblIdProcedimento)){ | 409 | if(!isset($dblIdProcedimento)){ |
369 | throw new InfraException('Parâmetro $dblIdProcedimento não informado.'); | 410 | throw new InfraException('Parâmetro $dblIdProcedimento não informado.'); |
370 | } | 411 | } |
371 | 412 | ||
372 | - //TODO: Passar dados do ProcedimentoDTO via parâmetro j carregado anteriormente | ||
373 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); | 413 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); |
374 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | 414 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); |
375 | 415 | ||
@@ -386,7 +426,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -386,7 +426,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
386 | 426 | ||
387 | $this->atribuirProdutorProcesso($objProcesso, $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); | 427 | $this->atribuirProdutorProcesso($objProcesso, $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); |
388 | $this->atribuirDataHoraDeRegistro($objProcesso, $objProcedimentoDTO->getDblIdProcedimento()); | 428 | $this->atribuirDataHoraDeRegistro($objProcesso, $objProcedimentoDTO->getDblIdProcedimento()); |
389 | - $this->atribuirDocumentos($objProcesso, $dblIdProcedimento); | 429 | + $this->atribuirDocumentos($objProcesso, $dblIdProcedimento, $parObjMetadadosTramiteAnterior); |
390 | $this->atribuirDadosInteressados($objProcesso, $dblIdProcedimento); | 430 | $this->atribuirDadosInteressados($objProcesso, $dblIdProcedimento); |
391 | $this->adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado); | 431 | $this->adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado); |
392 | 432 | ||
@@ -754,7 +794,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -754,7 +794,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
754 | } | 794 | } |
755 | } | 795 | } |
756 | 796 | ||
757 | - private function atribuirDocumentos($objProcesso, $dblIdProcedimento) | 797 | + private function atribuirDocumentos($objProcesso, $dblIdProcedimento, $parObjMetadadosTramiteAnterior) |
758 | { | 798 | { |
759 | if(!isset($objProcesso)) { | 799 | if(!isset($objProcesso)) { |
760 | throw new InfraException('Parâmetro $objProcesso não informado.'); | 800 | throw new InfraException('Parâmetro $objProcesso não informado.'); |
@@ -827,10 +867,8 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -827,10 +867,8 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
827 | $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); //TODO: Avaliar se informação está correta | 867 | $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); //TODO: Avaliar se informação está correta |
828 | 868 | ||
829 | $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); | 869 | $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); |
830 | - //TODO: Implementar mapeamento de espécies documentais | ||
831 | - $documento->especie = new stdClass(); | ||
832 | - $documento->especie->codigo = $this->obterEspecieMapeada($documentoDTO->getNumIdSerie()); | ||
833 | - $documento->especie->nomeNoProdutor = utf8_encode($documentoDTO->getStrNomeSerie()); | 870 | + $this->atribuirEspecieDocumental($documento, $documentoDTO, $parObjMetadadosTramiteAnterior); |
871 | + | ||
834 | //TODO: Tratar campos adicionais do documento | 872 | //TODO: Tratar campos adicionais do documento |
835 | //Identificao do documento | 873 | //Identificao do documento |
836 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); | 874 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); |
@@ -888,6 +926,91 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -888,6 +926,91 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
888 | 926 | ||
889 | } | 927 | } |
890 | 928 | ||
929 | + /** | ||
930 | + * Obtém a espécie documental relacionada ao documento do processo. | ||
931 | + * A espécie documental, por padrão, é obtida do mapeamento de espécies realizado pelo administrador | ||
932 | + * nas configurações do módulo. | ||
933 | + * Caso o documento tenha sido produzido por outro órgão externamente, a espécie a ser considerada será | ||
934 | + * aquela definida originalmente pelo seu produtor | ||
935 | + * | ||
936 | + * @param int $parDblIdProcedimento Identificador do processo | ||
937 | + * @param int $parDblIdDocumento Identificador do documento | ||
938 | + * @return int Código da espécie documental | ||
939 | + * | ||
940 | + */ | ||
941 | + private function atribuirEspecieDocumental($parMetaDocumento, $parDocumentoDTO, $parObjMetadadosTramiteAnterior) | ||
942 | + { | ||
943 | + //Validação dos parâmetros da função | ||
944 | + if(!isset($parDocumentoDTO)){ | ||
945 | + throw new InfraException('Parâmetro $parDocumentoDTO não informado.'); | ||
946 | + } | ||
947 | + | ||
948 | + if(!isset($parMetaDocumento)){ | ||
949 | + throw new InfraException('Parâmetro $parMetaDocumento não informado.'); | ||
950 | + } | ||
951 | + | ||
952 | + $numCodigoEspecie = null; | ||
953 | + $strNomeEspecieProdutor = null; | ||
954 | + $dblIdProcedimento = $parDocumentoDTO->getDblIdProcedimento(); | ||
955 | + $dblIdDocumento = $parDocumentoDTO->getDblIdDocumento(); | ||
956 | + | ||
957 | + //Inicialmente, busca espécie documental atribuida pelo produtor em trâmite realizado anteriormente | ||
958 | + $objComponenteDigitalDTO = new ComponenteDigitalDTO(); | ||
959 | + $objComponenteDigitalDTO->retNumCodigoEspecie(); | ||
960 | + $objComponenteDigitalDTO->retStrNomeEspecieProdutor(); | ||
961 | + $objComponenteDigitalDTO->setDblIdProcedimento($dblIdProcedimento); | ||
962 | + $objComponenteDigitalDTO->setDblIdDocumento($dblIdDocumento); | ||
963 | + $objComponenteDigitalDTO->setNumMaxRegistrosRetorno(1); | ||
964 | + $objComponenteDigitalDTO->setOrd('IdTramite', InfraDTO::$TIPO_ORDENACAO_DESC); | ||
965 | + | ||
966 | + $objComponenteDigitalBD = new ComponenteDigitalBD(BancoSEI::getInstance()); | ||
967 | + $objComponenteDigitalDTO = $objComponenteDigitalBD->consultar($objComponenteDigitalDTO); | ||
968 | + | ||
969 | + if($objComponenteDigitalDTO != null){ | ||
970 | + $numCodigoEspecie = $objComponenteDigitalDTO->getNumCodigoEspecie(); | ||
971 | + $strNomeEspecieProdutor = $objComponenteDigitalDTO->getStrNomeEspecieProdutor(); | ||
972 | + } | ||
973 | + | ||
974 | + //Caso a informação sobre mapeamento esteja nulo, necessário buscar tal informação no Barramento | ||
975 | + //A lista de documentos recuperada do trâmite anterior será indexada pela sua ordem no protocolo e | ||
976 | + //a espécie documental e o nome no produtar serão obtidos para atribuição ao documento | ||
977 | + if($objComponenteDigitalDTO != null && $numCodigoEspecie == null) { | ||
978 | + if(isset($parObjMetadadosTramiteAnterior)){ | ||
979 | + $arrObjMetaDocumentosTramiteAnterior = []; | ||
980 | + | ||
981 | + //Obtenção de lista de documentos do processo | ||
982 | + $arrObjMetaDocumentosTramiteAnterior = $parObjMetadadosTramiteAnterior->processo->documento; | ||
983 | + if(isset($arrObjMetaDocumentosTramiteAnterior) && !is_array($arrObjMetaDocumentosTramiteAnterior)){ | ||
984 | + $arrObjMetaDocumentosTramiteAnterior = array($arrObjMetaDocumentosTramiteAnterior); | ||
985 | + } | ||
986 | + | ||
987 | + //Indexação dos documentos pela sua ordem | ||
988 | + $arrMetaDocumentosAnteriorIndexado = []; | ||
989 | + foreach ($arrObjMetaDocumentosTramiteAnterior as $objMetaDoc) { | ||
990 | + $arrMetaDocumentosAnteriorIndexado[$objMetaDoc->ordem] = $objMetaDoc; | ||
991 | + } | ||
992 | + | ||
993 | + //Atribui espécie documental definida pelo produtor do documento e registrado no PEN, caso exista | ||
994 | + if(count($arrMetaDocumentosAnteriorIndexado) > 0 && array_key_exists($parMetaDocumento->ordem, $arrMetaDocumentosAnteriorIndexado)){ | ||
995 | + $numCodigoEspecie = $arrMetaDocumentosAnteriorIndexado[$parMetaDocumento->ordem]->especie->codigo; | ||
996 | + $strNomeEspecieProdutor = utf8_encode($arrMetaDocumentosAnteriorIndexado[$parMetaDocumento->ordem]->especie->nomeNoProdutor); | ||
997 | + } | ||
998 | + } | ||
999 | + } | ||
1000 | + | ||
1001 | + //Aplica o mapeamento de espécies definida pelo administrador para os novos documentos | ||
1002 | + if($numCodigoEspecie == null) { | ||
1003 | + $numCodigoEspecie = $this->obterEspecieMapeada($parDocumentoDTO->getNumIdSerie()); | ||
1004 | + $strNomeEspecieProdutor = utf8_encode($parDocumentoDTO->getStrNomeSerie()); | ||
1005 | + } | ||
1006 | + | ||
1007 | + $parMetaDocumento->especie = new stdClass(); | ||
1008 | + $parMetaDocumento->especie->codigo = $numCodigoEspecie; | ||
1009 | + $parMetaDocumento->especie->nomeNoProdutor = $strNomeEspecieProdutor; | ||
1010 | + | ||
1011 | + return $parMetaDocumento; | ||
1012 | + } | ||
1013 | + | ||
891 | private function obterEspecieMapeada($parNumIdSerie) | 1014 | private function obterEspecieMapeada($parNumIdSerie) |
892 | { | 1015 | { |
893 | if(!isset($parNumIdSerie) || $parNumIdSerie == 0) { | 1016 | if(!isset($parNumIdSerie) || $parNumIdSerie == 0) { |
rn/PenAtualizarSeiRN.php
@@ -66,6 +66,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | @@ -66,6 +66,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | ||
66 | case '1.1.15': $this->instalarV1116(); | 66 | case '1.1.15': $this->instalarV1116(); |
67 | case '1.1.16': $this->instalarV1117(); | 67 | case '1.1.16': $this->instalarV1117(); |
68 | case '1.1.17': $this->instalarV1200(); | 68 | case '1.1.17': $this->instalarV1200(); |
69 | + case '1.2.0': $this->instalarV1201(); | ||
69 | 70 | ||
70 | break; | 71 | break; |
71 | default: | 72 | default: |
@@ -1533,4 +1534,22 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | @@ -1533,4 +1534,22 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | ||
1533 | $objInfraParametroDTO->setStrValor('1.2.0'); | 1534 | $objInfraParametroDTO->setStrValor('1.2.0'); |
1534 | $objInfraParametroBD->alterar($objInfraParametroDTO); | 1535 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
1535 | } | 1536 | } |
1537 | + | ||
1538 | + /* Contêm atualizações da versao 1.2.1 do módulo */ | ||
1539 | + protected function instalarV1201() | ||
1540 | + { | ||
1541 | + //Fix-47 - Corrigir erro com mapeamento de espécies documentais da origem | ||
1542 | + $objInfraMetaBD = new InfraMetaBD(BancoSEI::getInstance()); | ||
1543 | + $objInfraMetaBD->adicionarColuna('md_pen_componente_digital', 'codigo_especie', $objInfraMetaBD->tipoNumero(), 'null'); | ||
1544 | + $objInfraMetaBD->adicionarColuna('md_pen_componente_digital', 'nome_especie_produtor', $objInfraMetaBD->tipoTextoVariavel(255), 'null'); | ||
1545 | + | ||
1546 | + | ||
1547 | + //altera o parâmetro da versão de banco | ||
1548 | + $objInfraParametroBD = new InfraParametroBD(BancoSEI::getInstance()); | ||
1549 | + $objInfraParametroDTO = new InfraParametroDTO(); | ||
1550 | + $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO); | ||
1551 | + $objInfraParametroDTO->setStrValor('1.2.1'); | ||
1552 | + $objInfraParametroBD->alterar($objInfraParametroDTO); | ||
1553 | + } | ||
1554 | + | ||
1536 | } | 1555 | } |
rn/ProcessoEletronicoRN.php
@@ -60,7 +60,7 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -60,7 +60,7 @@ class ProcessoEletronicoRN extends InfraRN { | ||
60 | /** | 60 | /** |
61 | * Espécie documentoal não mapeada | 61 | * Espécie documentoal não mapeada |
62 | */ | 62 | */ |
63 | - const MTV_RCSR_TRAM_CD_ESPECIE_NAO_MAPEADA = '03'; | 63 | + const MTV_RCSR_TRAM_CD_ESPECIE_NAO_MAPEADA = '04'; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Motivo para recusar de tramite de componente digital | 66 | * Motivo para recusar de tramite de componente digital |
@@ -404,13 +404,18 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -404,13 +404,18 @@ class ProcessoEletronicoRN extends InfraRN { | ||
404 | { | 404 | { |
405 | try { | 405 | try { |
406 | return $this->getObjPenWs()->enviarProcesso($parametros); | 406 | return $this->getObjPenWs()->enviarProcesso($parametros); |
407 | - } catch (\Exception $e) { | ||
408 | - $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; | ||
409 | - $detalhes = InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); | 407 | + |
408 | + } catch (\SoapFault $e) { | ||
409 | + $mensagem = "Falha no envio externo do processo: "; | ||
410 | + $mensagem .= InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); | ||
410 | if ($e instanceof \SoapFault && !empty($e->detail->interoperabilidadeException->codigoErro) && $e->detail->interoperabilidadeException->codigoErro == '0005') { | 411 | if ($e instanceof \SoapFault && !empty($e->detail->interoperabilidadeException->codigoErro) && $e->detail->interoperabilidadeException->codigoErro == '0005') { |
411 | - $detalhes = 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; | 412 | + $mensagem .= 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; |
412 | } | 413 | } |
413 | 414 | ||
415 | + throw new InfraException($mensagem, $e); | ||
416 | + } catch (\Exception $e) { | ||
417 | + $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; | ||
418 | + $detalhes = InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); | ||
414 | throw new InfraException($mensagem, $e, $detalhes); | 419 | throw new InfraException($mensagem, $e, $detalhes); |
415 | } | 420 | } |
416 | } | 421 | } |
@@ -807,6 +812,11 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -807,6 +812,11 @@ class ProcessoEletronicoRN extends InfraRN { | ||
807 | $objComponenteDigital = $objDocumento->componenteDigital; | 812 | $objComponenteDigital = $objDocumento->componenteDigital; |
808 | $objComponenteDigitalDTO->setStrNome($objComponenteDigital->nome); | 813 | $objComponenteDigitalDTO->setStrNome($objComponenteDigital->nome); |
809 | 814 | ||
815 | + if(isset($objDocumento->especie)){ | ||
816 | + $objComponenteDigitalDTO->setNumCodigoEspecie(intval($objDocumento->especie->codigo)); | ||
817 | + $objComponenteDigitalDTO->setStrNomeEspecieProdutor($objDocumento->especie->nomeNoProdutor); | ||
818 | + } | ||
819 | + | ||
810 | $strHashConteudo = static::getHashFromMetaDados($objComponenteDigital->hash); | 820 | $strHashConteudo = static::getHashFromMetaDados($objComponenteDigital->hash); |
811 | 821 | ||
812 | $objComponenteDigitalDTO->setStrHashConteudo($strHashConteudo); | 822 | $objComponenteDigitalDTO->setStrHashConteudo($strHashConteudo); |
rn/ReceberComponenteDigitalRN.php
@@ -28,7 +28,7 @@ class ReceberComponenteDigitalRN extends InfraRN | @@ -28,7 +28,7 @@ class ReceberComponenteDigitalRN extends InfraRN | ||
28 | return BancoSEI::getInstance(); | 28 | return BancoSEI::getInstance(); |
29 | } | 29 | } |
30 | 30 | ||
31 | - protected function receberComponenteDigitalConectado(ComponenteDigitalDTO $parObjComponenteDigitalDTO) | 31 | + protected function receberComponenteDigitalControlado(ComponenteDigitalDTO $parObjComponenteDigitalDTO) |
32 | { | 32 | { |
33 | 33 | ||
34 | if(!isset($parObjComponenteDigitalDTO) || !isset($parObjComponenteDigitalDTO)) { | 34 | if(!isset($parObjComponenteDigitalDTO) || !isset($parObjComponenteDigitalDTO)) { |
@@ -120,7 +120,7 @@ class ReceberComponenteDigitalRN extends InfraRN | @@ -120,7 +120,7 @@ class ReceberComponenteDigitalRN extends InfraRN | ||
120 | $objDocumentoDTO = $objDocumentoRN->consultarRN0005($objDocumentoDTO); | 120 | $objDocumentoDTO = $objDocumentoRN->consultarRN0005($objDocumentoDTO); |
121 | 121 | ||
122 | if ($objDocumentoDTO==null){ | 122 | if ($objDocumentoDTO==null){ |
123 | - throw new InfraException("Registro não encontrado."); | 123 | + throw new InfraException("Documento não pode ser localizado (".$parObjComponenteDigitalDTO->getDblIdDocumento().")"); |
124 | } | 124 | } |
125 | 125 | ||
126 | $objProtocoloDTO = new ProtocoloDTO(); | 126 | $objProtocoloDTO = new ProtocoloDTO(); |
rn/ReceberProcedimentoRN.php
@@ -421,15 +421,6 @@ class ReceberProcedimentoRN extends InfraRN | @@ -421,15 +421,6 @@ class ReceberProcedimentoRN extends InfraRN | ||
421 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); | 421 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
422 | $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | 422 | $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); |
423 | $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); | 423 | $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); |
424 | - // $objComponenteDigitalDTO->retDblIdDocumento(); | ||
425 | - // $objComponenteDigitalDTO->retNumTicketEnvioComponentes(); | ||
426 | - // $objComponenteDigitalDTO->retStrProtocoloDocumentoFormatado(); | ||
427 | - // $objComponenteDigitalDTO->retStrHashConteudo(); | ||
428 | - // $objComponenteDigitalDTO->retStrProtocolo(); | ||
429 | - // $objComponenteDigitalDTO->retStrNumeroRegistro(); | ||
430 | - // $objComponenteDigitalDTO->retNumIdTramite(); | ||
431 | - // $objComponenteDigitalDTO->retStrNome(); | ||
432 | - // $objComponenteDigitalDTO->retStrStaEstadoProtocolo(); | ||
433 | 424 | ||
434 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | 425 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
435 | return $objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0; | 426 | return $objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0; |
sip_atualizar_versao_modulo_pen.php
@@ -101,6 +101,7 @@ class PenAtualizarSipRN extends InfraRN { | @@ -101,6 +101,7 @@ class PenAtualizarSipRN extends InfraRN { | ||
101 | case '1.1.15': $this->instalarV1116(); | 101 | case '1.1.15': $this->instalarV1116(); |
102 | case '1.1.16': $this->instalarV1117(); | 102 | case '1.1.16': $this->instalarV1117(); |
103 | case '1.1.17': $this->instalarV1200(); | 103 | case '1.1.17': $this->instalarV1200(); |
104 | + case '1.1.20': $this->instalarV1201(); | ||
104 | 105 | ||
105 | break; | 106 | break; |
106 | default: | 107 | default: |
@@ -1135,6 +1136,21 @@ class PenAtualizarSipRN extends InfraRN { | @@ -1135,6 +1136,21 @@ class PenAtualizarSipRN extends InfraRN { | ||
1135 | $objInfraParametroDTO->setStrValor('1.2.0'); | 1136 | $objInfraParametroDTO->setStrValor('1.2.0'); |
1136 | $objInfraParametroBD->alterar($objInfraParametroDTO); | 1137 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
1137 | } | 1138 | } |
1139 | + | ||
1140 | + /** | ||
1141 | + * Instala/Atualiza os módulo PEN para versão 1.2.1 | ||
1142 | + */ | ||
1143 | + protected function instalarV1201() | ||
1144 | + { | ||
1145 | + //Corrigir a versão do módulo no banco de dados | ||
1146 | + $objInfraParametroDTO = new InfraParametroDTO(); | ||
1147 | + $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO); | ||
1148 | + $objInfraParametroDTO->retTodos(); | ||
1149 | + $objInfraParametroBD = new InfraParametroBD(BancoSip::getInstance()); | ||
1150 | + $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); | ||
1151 | + $objInfraParametroDTO->setStrValor('1.2.1'); | ||
1152 | + $objInfraParametroBD->alterar($objInfraParametroDTO); | ||
1153 | + } | ||
1138 | } | 1154 | } |
1139 | 1155 | ||
1140 | try { | 1156 | try { |