Commit 53890ed8c4409153a3066344b1e84d491cbe65ff
1 parent
8996ce8c
Exists in
master
and in
1 other branch
ajuste
Showing
6 changed files
with
150 additions
and
17 deletions
Show diff stats
controlador_ws.php
... | ... | @@ -296,8 +296,17 @@ $app->group('/api/v1',function(){ |
296 | 296 | $dados["grauSigilo"] = $request->getParam('grauSigilo'); |
297 | 297 | $dados["observacao"] = $request->getParam('observacao'); |
298 | 298 | |
299 | - | |
299 | + $dados["nomeArquivo"] = $request->getParam('nomeArquivo'); | |
300 | + $dados["tipoConferencia"] = $request->getParam('tipoConferencia'); | |
300 | 301 | |
302 | + if (array_key_exists("conteudoDocumento",$request->getParams())){ | |
303 | + $dados["conteudoDocumento"] = false; | |
304 | + if($request->getParam('conteudoDocumento')) $dados["conteudoDocumento"] = $request->getParam('conteudoDocumento'); | |
305 | + }else{ | |
306 | + $dados["conteudoDocumento"] = null; | |
307 | + } | |
308 | + | |
309 | + | |
301 | 310 | $rn = new MdWsSeiDocumentoRN(); |
302 | 311 | return $response->withJSON( |
303 | 312 | $rn->alterarDocumentoExterno($dados) |
... | ... | @@ -407,6 +416,7 @@ $app->group('/api/v1',function(){ |
407 | 416 | $rn = new MdWsSeiDocumentoRN(); |
408 | 417 | $dto = new MdWsSeiDocumentoDTO(); |
409 | 418 | $dto->setNumIdTipoDocumento($request->getParam('id')); |
419 | + $dto->setNumIdTipoProcedimento($request->getParam('idTipoProcedimento')); | |
410 | 420 | |
411 | 421 | return $response->withJSON($rn->pesquisarTemplateDocumento($dto)); |
412 | 422 | }); |
... | ... | @@ -464,6 +474,9 @@ $app->group('/api/v1',function(){ |
464 | 474 | $dto->setArrRemetentes(json_decode($request->getParam('remetentes'), TRUE)); |
465 | 475 | $dto->setStrConteudoDocumento($request->getParam('conteudoDocumento')); |
466 | 476 | $dto->setStrObservacao($request->getParam('observacao')); |
477 | + $dto->setNumTipoConferencia($request->getParam('tipoConferencia')); | |
478 | + | |
479 | + $dto->setStrObservacao($request->getParam('observacao')); | |
467 | 480 | |
468 | 481 | |
469 | 482 | $rn = new MdWsSeiDocumentoRN(); | ... | ... |
dto/MdWsSeiDocumentoDTO.php
... | ... | @@ -21,6 +21,7 @@ class MdWsSeiDocumentoDTO extends InfraDTO{ |
21 | 21 | $this->adicionarAtributo(InfraDTO::$PREFIXO_DTA, 'DataGeracaoDocumento'); |
22 | 22 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Numero'); |
23 | 23 | $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoDocumento'); |
24 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'IdTipoProcedimento'); | |
24 | 25 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Descricao'); |
25 | 26 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeArquivo'); |
26 | 27 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NivelAcesso'); |
... | ... | @@ -32,6 +33,7 @@ class MdWsSeiDocumentoDTO extends InfraDTO{ |
32 | 33 | $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'Remetentes'); |
33 | 34 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'ConteudoDocumento'); |
34 | 35 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Observacao'); |
36 | + $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'TipoConferencia'); | |
35 | 37 | |
36 | 38 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'NomeTipoDocumento'); |
37 | 39 | $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Favoritos'); | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?php | |
2 | + | |
3 | +$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/teste.pdf"); | |
4 | +//$file = file_get_contents("/opt/sei/web/modulos/mod-wssei/c.pdf"); | |
5 | + | |
6 | +$ch = curl_init("http://192.168.99.100/sei/modulos/mod-wssei/controlador_ws.php/api/v1/documento/externo/alterar"); | |
7 | + | |
8 | +//distribuindo a informação a ser enviada | |
9 | +$post = array( | |
10 | + 'documento' => '241', | |
11 | + 'data' => '31/01/2017', | |
12 | + 'idTipoDocumento' => '106', | |
13 | + 'numero' => '12321313', | |
14 | + 'nomeArquivo' => 'teste.pdf', | |
15 | + 'nivelAcesso' => '1', | |
16 | + 'hipoteseLegal' => '1', | |
17 | + 'grauSigilo' => '', | |
18 | + 'assuntos' => '[{"id": 79}]', | |
19 | + 'interessados' => '[{"id": 100000012 },{"id":100000044}]', | |
20 | + 'destinatarios' => '[{"id":100000044}]', | |
21 | + 'remetentes' => '[{"id":100000044}]', | |
22 | + 'conteudoDocumento' => $file, | |
23 | +// 'conteudoDocumento' => "", | |
24 | + 'observacao' => 'paçoca', | |
25 | + 'tipoConferencia' => '3', | |
26 | +); | |
27 | + | |
28 | +$headers = array(); | |
29 | + | |
30 | +curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
31 | +curl_setopt($ch, CURLOPT_HTTPHEADER, array('token: YTRhZDBmOTEyYjUxY2MzYTgzNjc3NDMwNWNjM2JiMzFmY2U4ZTkxYmFUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9')); | |
32 | + | |
33 | +$data = curl_exec($ch); | |
34 | + | |
35 | +//Fecha a conexão para economizar recursos do servidor | |
36 | +curl_close($ch); | |
37 | + | |
38 | +var_dump($data); | |
39 | +die(); | |
40 | + | |
41 | +?> | |
0 | 42 | \ No newline at end of file | ... | ... |
rn/MdWsSeiDocumentoRN.php
... | ... | @@ -184,9 +184,8 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
184 | 184 | */ |
185 | 185 | protected function pesquisarTemplateDocumentoConectado(MdWsSeiDocumentoDTO $dto){ |
186 | 186 | try{ |
187 | -// $id_tipo_documento = 46; | |
188 | - $id_tipo_documento = $dto->getNumIdTipoDocumento(); | |
189 | - | |
187 | + $id_tipo_documento = $dto->getNumIdTipoDocumento(); | |
188 | + $idTipoProcedimento = $dto->getNumIdTipoProcedimento(); | |
190 | 189 | //Consulta os assuntos sugeridos para um tipo de documento |
191 | 190 | $relSerieAssuntoDTO = new RelSerieAssuntoDTO(); |
192 | 191 | $relSerieAssuntoDTO->setNumIdSerie($id_tipo_documento); // FILTRO PELO TIPO DE DOCUMENTO |
... | ... | @@ -201,8 +200,8 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
201 | 200 | if($arrRelSerieAssuntoDTO){ |
202 | 201 | foreach ($arrRelSerieAssuntoDTO as $obj) { |
203 | 202 | $assuntos[] = array( |
204 | - "id" => $obj->getNumIdAssuntoProxy(), | |
205 | - "codigo" => $obj->getStrCodigoEstruturadoAssunto(), | |
203 | + "id" => $obj->getNumIdAssuntoProxy(), | |
204 | + "codigo" => $obj->getStrCodigoEstruturadoAssunto(), | |
206 | 205 | "descricao" => $obj->getStrDescricaoAssunto() |
207 | 206 | ); |
208 | 207 | } |
... | ... | @@ -232,6 +231,42 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
232 | 231 | "permiteDestinatarios" => $permiteDestinatarios |
233 | 232 | ); |
234 | 233 | |
234 | + | |
235 | + //CONSULTA QUE LISTA TODOS OS NÍVES DE ACESSOS PERMITIDOS PARA OS TIPO DE PROCESSO | |
236 | + $nivelAcessoPermitidoDTO = new NivelAcessoPermitidoDTO(); | |
237 | + $nivelAcessoPermitidoDTO->setNumIdTipoProcedimento($idTipoProcedimento); // FILTRO PELO TIPO DE PROCESSO | |
238 | + $nivelAcessoPermitidoDTO->retStrStaNivelAcesso(); // ID DO NÍVEL DE ACESSO - ProtocoloRN::$NA_PUBLICO, ProtocoloRN::$NA_RESTRITO ou ProtocoloRN::$NA_SIGILOSO | |
239 | + | |
240 | + // A CONSULTA RETORNARÁ OS NÍVEL DE ACESSO PERMITIDOS PARA O TIPO DE PROCESSO ESPECIFICADO NO DTO. AQUELES QUE NÃO FOREM RETORNADOS NESSA | |
241 | + $nivelAcessoPermitidoRN = new NivelAcessoPermitidoRN(); | |
242 | + $arrNivelAcessoPermitido = $nivelAcessoPermitidoRN->listar($nivelAcessoPermitidoDTO); | |
243 | + if($arrNivelAcessoPermitido){ | |
244 | + foreach ($arrNivelAcessoPermitido as $nivel) { | |
245 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_PUBLICO) $publico = true; | |
246 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_RESTRITO) $restrito = true; | |
247 | + if($nivel->getStrStaNivelAcesso() == ProtocoloRN::$NA_SIGILOSO) $sigiloso = true; | |
248 | + } | |
249 | + } | |
250 | + $arrayRetorno["nivelAcessoPermitido"] = array( | |
251 | + "publico" =>$publico ? $publico : false, | |
252 | + "restrito" =>$restrito ? $restrito : false, | |
253 | + "sigiloso" =>$sigiloso ? $sigiloso : false, | |
254 | + ); | |
255 | + | |
256 | + | |
257 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE A HIPÓTESE LEGAL É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | |
258 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | |
259 | + $obrigatoriedadeHipoteseLegal = $objInfraParametro->getValor('SEI_HABILITAR_HIPOTESE_LEGAL'); | |
260 | + | |
261 | + //CONSULTA NO PARÂMETRO QUE INFORMA SE UM GRAU DE SIGILO É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | |
262 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | |
263 | + $obrigatoriedadeGrauSigilo = $objInfraParametro->getValor('SEI_HABILITAR_GRAU_SIGILO'); | |
264 | + | |
265 | + $arrayRetorno["obrigatoriedadeHipoteseLegal"] = $obrigatoriedadeHipoteseLegal; | |
266 | + $arrayRetorno["obrigatoriedadeGrauSigilo"] = $obrigatoriedadeGrauSigilo; | |
267 | + | |
268 | + | |
269 | + | |
235 | 270 | return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno); |
236 | 271 | }catch (Exception $e){ |
237 | 272 | return MdWsSeiRest::formataRetornoErroREST($e); |
... | ... | @@ -262,6 +297,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
262 | 297 | $hipoteseLegal = $dados['hipoteseLegal']; |
263 | 298 | $grauSigilo = $dados['grauSigilo']; |
264 | 299 | $observacao = $dados['observacao']; |
300 | + $conteudoDocumento = $dados['conteudoDocumento']; | |
301 | + $nomeArquivo = $dados['nomeArquivo']; | |
302 | + $tipoConferencia = $dados['tipoConferencia']; | |
265 | 303 | |
266 | 304 | |
267 | 305 | //Altera os dados do documento |
... | ... | @@ -334,23 +372,60 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
334 | 372 | } |
335 | 373 | } |
336 | 374 | |
337 | -// var_dump($arrRelProtocoloAssuntoDTO); | |
338 | -// die(); | |
339 | - | |
340 | 375 | $protocoloDTO->setArrObjRelProtocoloAssuntoDTO($arrRelProtocoloAssuntoDTO); |
341 | 376 | |
342 | 377 | //Edita a observação |
343 | 378 | $observacaoDTO = new ObservacaoDTO(); |
344 | 379 | $observacaoDTO->setStrDescricao($observacao); |
345 | 380 | $protocoloDTO->setArrObjObservacaoDTO(array($observacaoDTO)); |
346 | - | |
381 | + | |
347 | 382 | //Edita o tipo de documento e número |
348 | 383 | $documentoDTO = new DocumentoDTO(); |
349 | 384 | $documentoDTO->setDblIdDocumento($documento); |
350 | 385 | $documentoDTO->setNumIdSerie($idTipoDocumento); |
351 | 386 | $documentoDTO->setStrNumero($numero); |
352 | 387 | $documentoDTO->setObjProtocoloDTO($protocoloDTO); |
353 | - | |
388 | + $documentoDTO->setNumIdTipoConferencia($tipoConferencia); | |
389 | + | |
390 | + if($conteudoDocumento === false){ | |
391 | + $objAnexoDTO = new AnexoDTO(); | |
392 | + $objAnexoDTO->retNumIdAnexo(); | |
393 | + $objAnexoDTO->setDblIdProtocolo($documento); | |
394 | + | |
395 | + $objAnexoRN = new AnexoRN(); | |
396 | + $arrObjAnexoDTO = $objAnexoRN->listarRN0218($objAnexoDTO); | |
397 | + $objAnexoRN->excluirRN0226($arrObjAnexoDTO); | |
398 | + } | |
399 | + if($conteudoDocumento){ | |
400 | + $objAnexoDTO = new AnexoDTO(); | |
401 | + $objAnexoDTO->setStrNome($nomeArquivo); | |
402 | + $protocoloDTO->setArrObjAnexoDTO(array($objAnexoDTO)); | |
403 | + | |
404 | + $documentoDTO->setStrConteudo(null); | |
405 | + $documentoDTO->setStrStaDocumento(DocumentoRN::$TD_EXTERNO); | |
406 | + | |
407 | + $arrObjAnexoDTO = $documentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); | |
408 | + | |
409 | + //Adiciona o anexo | |
410 | + if (count($arrObjAnexoDTO) == 1) { | |
411 | + | |
412 | + if (!$arrObjAnexoDTO[0]->isSetNumIdAnexoOrigem()) { | |
413 | + $objAnexoRN = new AnexoRN(); | |
414 | + $strNomeArquivoUpload = $objAnexoRN->gerarNomeArquivoTemporario(); | |
415 | + | |
416 | + $fp = fopen(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload, 'w'); | |
417 | + fwrite($fp, $conteudoDocumento); | |
418 | + fclose($fp); | |
419 | + | |
420 | + $arrObjAnexoDTO[0]->setNumIdAnexo($strNomeArquivoUpload); | |
421 | + $arrObjAnexoDTO[0]->setDthInclusao(InfraData::getStrDataHoraAtual()); | |
422 | + $arrObjAnexoDTO[0]->setNumTamanho(filesize(DIR_SEI_TEMP . '/' . $strNomeArquivoUpload)); | |
423 | + $arrObjAnexoDTO[0]->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
424 | + } | |
425 | + } | |
426 | + } | |
427 | + | |
428 | + | |
354 | 429 | $documentoRN = new DocumentoRN(); |
355 | 430 | $documentoRN->alterarRN0004($documentoDTO); |
356 | 431 | |
... | ... | @@ -603,6 +678,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
603 | 678 | $arrRemetentes = $dto->getArrRemetentes(); |
604 | 679 | $conteudoDocumento = $dto->getStrConteudoDocumento(); |
605 | 680 | $observacao = $dto->getStrObservacao(); |
681 | + $tipoConferencia = $dto->getNumTipoConferencia(); | |
606 | 682 | |
607 | 683 | |
608 | 684 | //Parâmetros de entrada |
... | ... | @@ -621,7 +697,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
621 | 697 | // $arrRemetentes = array(array('id' => 100000008)); |
622 | 698 | // $conteudoDocumento = file_get_contents('/opt/sei/web/modulos/mod-wssei/codigo-fonte/mod-wssei/rn/c.pdf'); // DEVE CONTER O BINÁRIO DO ARQUIVO. ESSE FILE_GET_CONTENTS É UM EXEMPLO APENAS |
623 | 699 | // $observacao = 'ewefwe'; |
624 | - | |
700 | + | |
625 | 701 | //Popula os dados do documento para salvamento |
626 | 702 | $objDocumentoDTO = new DocumentoDTO(); |
627 | 703 | $objDocumentoDTO->setDblIdDocumento(null); |
... | ... | @@ -630,7 +706,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
630 | 706 | $objDocumentoDTO->setDblIdDocumentoEdoc(null); |
631 | 707 | $objDocumentoDTO->setDblIdDocumentoEdocBase(null); |
632 | 708 | $objDocumentoDTO->setNumIdUnidadeResponsavel(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
633 | - $objDocumentoDTO->setNumIdTipoConferencia(null); | |
709 | + $objDocumentoDTO->setNumIdTipoConferencia($tipoConferencia); | |
634 | 710 | $objDocumentoDTO->setStrNumero($numero); |
635 | 711 | |
636 | 712 | //Popula os dados do protocolo do documento | ... | ... |
rn/MdWsSeiProcedimentoRN.php
... | ... | @@ -205,9 +205,9 @@ class MdWsSeiProcedimentoRN extends InfraRN |
205 | 205 | $tipoProcedimentoRN = new TipoProcedimentoRN(); |
206 | 206 | $tipoProcedimentoDTO = $tipoProcedimentoRN->consultarRN0267($tipoProcedimentoDTO); |
207 | 207 | |
208 | - $arrayRetorno["nivelAcessoSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaNivelAcessoSugestao() : false; | |
209 | - $arrayRetorno["hipoteseLegalSugerida"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getNumIdHipoteseLegalSugestao() : false; | |
210 | - $arrayRetorno["grauSigiloSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaGrauSigiloSugestao() : false; | |
208 | +// $arrayRetorno["nivelAcessoSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaNivelAcessoSugestao() : false; | |
209 | +// $arrayRetorno["hipoteseLegalSugerida"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getNumIdHipoteseLegalSugestao() : false; | |
210 | +// $arrayRetorno["grauSigiloSugerido"] = $tipoProcedimentoDTO ? $tipoProcedimentoDTO->getStrStaGrauSigiloSugestao() : false; | |
211 | 211 | |
212 | 212 | |
213 | 213 | //CONSULTA NO PARÂMETRO QUE INFORMA SE A HIPÓTESE LEGAL É OBRIGATÓRIO PARA UM TIPO DE PROCESSO | ... | ... |
teste_requisicao.php
... | ... | @@ -22,12 +22,13 @@ $post = array( |
22 | 22 | 'remetentes' => '[{"id":100000044}]', |
23 | 23 | 'conteudoDocumento' => $file, |
24 | 24 | 'observacao' => 'documento Externo', |
25 | + 'tipoConferencia' => '2', | |
25 | 26 | ); |
26 | 27 | |
27 | 28 | $headers = array(); |
28 | 29 | |
29 | 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, $post); |
30 | -curl_setopt($ch, CURLOPT_HTTPHEADER, array('token: MTdkYjg4NjI2Y2UxMGQ2MzMyYWM3MzI1ZDBiY2U2OGU5MWQzYzViNmFUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9')); | |
31 | +curl_setopt($ch, CURLOPT_HTTPHEADER, array('token: YTRhZDBmOTEyYjUxY2MzYTgzNjc3NDMwNWNjM2JiMzFmY2U4ZTkxYmFUVnhUV2sxYnoxOGZHazFjVTFwTlc4OWZId3dmSHc9')); | |
31 | 32 | |
32 | 33 | $data = curl_exec($ch); |
33 | 34 | ... | ... |