Commit 781450d5efbb2388ac07baaf9c713a2bf4f1631f
1 parent
a2cfeb4b
Exists in
master
and in
1 other branch
Adicionando novo servico /processo/receber, versao em post
Showing
2 changed files
with
57 additions
and
1 deletions
Show diff stats
controlador_ws.php
@@ -1005,7 +1005,17 @@ $app->group('/api/v1',function(){ | @@ -1005,7 +1005,17 @@ $app->group('/api/v1',function(){ | ||
1005 | 1005 | ||
1006 | return $response->withJSON($rn->alterarProcedimento($dto)); | 1006 | return $response->withJSON($rn->alterarProcedimento($dto)); |
1007 | }); | 1007 | }); |
1008 | - | 1008 | + |
1009 | + //Serviço de recebimento do processo na unidade - adicionado por Adriano Cesar - MPOG | ||
1010 | + $this->post('/receber', function($request, $response, $args){ | ||
1011 | + | ||
1012 | + $rn = new MdWsSeiProcedimentoRN(); | ||
1013 | + $dto = new MdWsSeiProcedimentoDTO(); | ||
1014 | + if($request->getParam('procedimento')){ | ||
1015 | + $dto->setNumIdProcedimento($request->getParam('procedimento')); | ||
1016 | + } | ||
1017 | + return $response->withJSON($rn->receberProcedimento($dto)); | ||
1018 | + }); | ||
1009 | 1019 | ||
1010 | })->add( new TokenValidationMiddleware()); | 1020 | })->add( new TokenValidationMiddleware()); |
1011 | 1021 |
rn/MdWsSeiProcedimentoRN.php
@@ -1916,5 +1916,51 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -1916,5 +1916,51 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
1916 | } | 1916 | } |
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | + /** | ||
1920 | + * Metodo que recebe o procedimento na atual unidade | ||
1921 | + * Criado por Adriano Cesar - MPOG | ||
1922 | + * @param Objeto DTO contendo a informação do procedimento | ||
1923 | + * @return sucesso ou erro | ||
1924 | + */ | ||
1925 | + protected function receberProcedimentoControlado(MdWsSeiProcedimentoDTO $dto) | ||
1926 | + { | ||
1927 | + try { | ||
1928 | + // Se o id do procedimento não foi passado, gera exceção | ||
1929 | + if (!$dto->getNumIdProcedimento()) { | ||
1930 | + throw new InfraException('E obrigatório informar o número identificador do procedimento!'); | ||
1931 | + } | ||
1932 | + | ||
1933 | + $objPesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | ||
1934 | + $objPesquisaPendenciaDTO->setDblIdProtocolo($dto->getNumIdProcedimento()); | ||
1935 | + $objPesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
1936 | + $objPesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
1937 | + $objPesquisaPendenciaDTO->setStrSinMontandoArvore('S'); | ||
1938 | + $objPesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | ||
1939 | + | ||
1940 | + $objAtividadeRN = new AtividadeRN(); | ||
1941 | + $arrObjProcedimentoDTO = $objAtividadeRN->listarPendenciasRN0754($objPesquisaPendenciaDTO); | ||
1942 | + | ||
1943 | + $numRegistrosProcedimento = count($arrObjProcedimentoDTO); | ||
1944 | + | ||
1945 | + | ||
1946 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
1947 | + | ||
1948 | + if ($numRegistrosProcedimento == 1){ | ||
1949 | + | ||
1950 | + $objProcedimentoDTOPar = $arrObjProcedimentoDTO[0]; | ||
1951 | + | ||
1952 | + //Rotina do core do sistema, que recebe procedimento | ||
1953 | + $objProcedimentoRN->receber($objProcedimentoDTOPar); | ||
1954 | + | ||
1955 | + return MdWsSeiRest::formataRetornoSucessoREST('Processo recebido com sucesso!'); | ||
1956 | + } | ||
1957 | + | ||
1958 | + return MdWsSeiRest::formataRetornoSucessoREST('Processo não disponível para recebimento na unidade atual.'); | ||
1959 | + | ||
1960 | + | ||
1961 | + } catch (Exception $e) { | ||
1962 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
1963 | + } | ||
1964 | + } | ||
1919 | 1965 | ||
1920 | } | 1966 | } |
1921 | \ No newline at end of file | 1967 | \ No newline at end of file |