Commit 644f8b863df778c333e0eb11b0307caea62985a8
Exists in
master
and in
19 other branches
Correção de problema com o recebimento de processo por duas unidades do mesmo sistema
Showing
15 changed files
with
736 additions
and
741 deletions
Show diff stats
PENIntegracao.php
| ... | ... | @@ -11,10 +11,9 @@ class PENIntegracao extends SeiIntegracao { |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | public function getVersao() { |
| 14 | - return '1.1.6'; | |
| 14 | + return '1.1.7'; | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - | |
| 18 | 17 | public function getInstituicao() { |
| 19 | 18 | return 'Ministério do Planejamento - MPDG (Projeto Colaborativo no Portal do SPB)'; |
| 20 | 19 | } | ... | ... |
README.md
| ... | ... | @@ -460,4 +460,12 @@ Caso o ambiente do ConectaGov PEN utilizado nesta configuração esteja utilizan |
| 460 | 460 | |
| 461 | 461 | ### 2. Trâmites não realizados ou recibos não obtidos |
| 462 | 462 | |
| 463 | -Verificar se os serviços *gearman* e *supervisord* estão em execução, conforme orientado no manual de instalação, itens 3 e 4. | |
| 464 | 463 | \ No newline at end of file |
| 464 | +Verificar se os serviços *gearman* e *supervisord* estão em execução, conforme orientado no manual de instalação, itens 3 e 4. | |
| 465 | + | |
| 466 | +### 3. Erro na inicialização do Gearmand "(Address family not supported by protocol) -> libgearman-server/gearmand.cc:442" | |
| 467 | + | |
| 468 | +Este problema ocorre quando o servidor não possui suporte ao protocolo IPv6. Por padrão, o Gearman inicia sua comunicação utilizando a porta 4730 e utilizando IPv4 e IPv6. Caso um destes não estejam disponíveis, o serviço não será ativado e um log de erro será gerado com a mensagem "(Address family not supported by protocol) -> libgearman-server/gearmand.cc:442". | |
| 469 | + | |
| 470 | +Para solucionar o problema, duas ações podem ser feitas: | |
| 471 | +- habilitar o suporte à IPv6 no servidor de aplicação onde o Gearman foi instalado | |
| 472 | +- configurar o serviço gearmand para utilizar somente IPv4. Para fazer esta configuração, será necessário editar o arquivo de inicialização do Gearmand, normalmente localizado em /etc/sysconfig/gearmand, e adicionar o seguinte parâmetro de inicialização: OPTIONS="--listen=127.0.0.1" | ... | ... |
bd/PenMetaBD.php
| ... | ... | @@ -8,71 +8,70 @@ require_once dirname(__FILE__) . '/../../../SEI.php'; |
| 8 | 8 | * @author Join Tecnologia |
| 9 | 9 | */ |
| 10 | 10 | class PenMetaBD extends InfraMetaBD { |
| 11 | - | |
| 11 | + | |
| 12 | 12 | const NNULLO = 'NOT NULL'; |
| 13 | 13 | const SNULLO = 'NULL'; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * | |
| 16 | + * | |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | 19 | public function adicionarValorPadraoParaColuna($strNomeTabela, $strNomeColuna, $strValorPadrao, $bolRetornarQuery = false){ |
| 20 | - | |
| 20 | + | |
| 21 | 21 | $objInfraBanco = $this->getObjInfraIBanco(); |
| 22 | - | |
| 23 | 22 | $strTableDrive = get_parent_class($objInfraBanco); |
| 24 | 23 | $strQuery = ''; |
| 25 | - | |
| 24 | + | |
| 26 | 25 | switch($strTableDrive) { |
| 27 | 26 | |
| 28 | 27 | case 'InfraMySqli': |
| 29 | 28 | $strQuery = sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` SET DEFAULT '%s'", $strNomeTabela, $strNomeColuna, $strValorPadrao); |
| 30 | 29 | break; |
| 31 | - | |
| 30 | + | |
| 32 | 31 | case 'InfraSqlServer': |
| 33 | - $strQuery = sprintf("ALTER TABLE [%s] ADD DEFAULT('%s') FOR [%s]", $strNomeTabela, $strValorPadrao, $strNomeColuna); | |
| 34 | - | |
| 32 | + $strQuery = sprintf("ALTER TABLE [%s] ADD DEFAULT('%s') FOR [%s]", $strNomeTabela, $strValorPadrao, $strNomeColuna); | |
| 33 | + break; | |
| 34 | + | |
| 35 | 35 | case 'InfraOracle': |
| 36 | + $strQuery = sprintf("ALTER TABLE %s MODIFY %s DEFAULT '%s'", $strNomeTabela, $strNomeColuna, $strValorPadrao); | |
| 36 | 37 | break; |
| 37 | 38 | } |
| 38 | - | |
| 39 | + | |
| 39 | 40 | if($bolRetornarQuery === false) { |
| 40 | - | |
| 41 | 41 | $objInfraBanco->executarSql($strQuery); |
| 42 | 42 | } |
| 43 | 43 | else { |
| 44 | - | |
| 45 | 44 | return $strQuery; |
| 46 | 45 | } |
| 47 | 46 | } |
| 48 | - | |
| 47 | + | |
| 49 | 48 | /** |
| 50 | 49 | * Verifica se o usuário do drive de conexão possui permissão para criar/ remover |
| 51 | 50 | * estruturas |
| 52 | - * | |
| 51 | + * | |
| 53 | 52 | * @return PenMetaBD |
| 54 | 53 | */ |
| 55 | 54 | public function isDriverPermissao(){ |
| 56 | - | |
| 55 | + | |
| 57 | 56 | $objInfraBanco = $this->getObjInfraIBanco(); |
| 58 | 57 | |
| 59 | 58 | if(count($this->obterTabelas('sei_teste'))==0){ |
| 60 | 59 | $objInfraBanco->executarSql('CREATE TABLE sei_teste (id '.$this->tipoNumero().' NULL)'); |
| 61 | 60 | } |
| 62 | - | |
| 61 | + | |
| 63 | 62 | $objInfraBanco->executarSql('DROP TABLE sei_teste'); |
| 64 | - | |
| 63 | + | |
| 65 | 64 | return $this; |
| 66 | 65 | } |
| 67 | - | |
| 66 | + | |
| 68 | 67 | /** |
| 69 | 68 | * Verifica se o banco do SEI é suportador pelo atualizador |
| 70 | - * | |
| 69 | + * | |
| 71 | 70 | * @throws InfraException |
| 72 | 71 | * @return PenMetaBD |
| 73 | 72 | */ |
| 74 | 73 | public function isDriverSuportado(){ |
| 75 | - | |
| 74 | + | |
| 76 | 75 | $strTableDrive = get_parent_class($this->getObjInfraIBanco()); |
| 77 | 76 | |
| 78 | 77 | switch($strTableDrive) { |
| ... | ... | @@ -84,7 +83,7 @@ class PenMetaBD extends InfraMetaBD { |
| 84 | 83 | $version = $version[0]['versao']; |
| 85 | 84 | $arrVersion = explode('.', $version); |
| 86 | 85 | if($arrVersion[0].$arrVersion[1] < 56){ |
| 87 | - $this->getObjInfraIBanco()->executarSql('@SET STORAGE_ENGINE=InnoDB'); | |
| 86 | + $this->getObjInfraIBanco()->executarSql('@SET STORAGE_ENGINE=InnoDB'); | |
| 88 | 87 | } |
| 89 | 88 | case 'InfraSqlServer': |
| 90 | 89 | case 'InfraOracle': |
| ... | ... | @@ -94,38 +93,38 @@ class PenMetaBD extends InfraMetaBD { |
| 94 | 93 | throw new InfraException('BANCO DE DADOS NAO SUPORTADO: ' . $strTableDrive); |
| 95 | 94 | |
| 96 | 95 | } |
| 97 | - | |
| 96 | + | |
| 98 | 97 | return $this; |
| 99 | 98 | } |
| 100 | - | |
| 99 | + | |
| 101 | 100 | /** |
| 102 | 101 | * Verifica se a versão sistema é compativel com a versão do módulo PEN |
| 103 | - * | |
| 102 | + * | |
| 104 | 103 | * @throws InfraException |
| 105 | 104 | * @return PenMetaBD |
| 106 | 105 | */ |
| 107 | 106 | public function isVersaoSuportada($strRegexVersaoSistema, $strVerMinRequirida){ |
| 108 | - | |
| 107 | + | |
| 109 | 108 | $numVersaoRequerida = intval(preg_replace('/\D+/', '', $strVerMinRequirida)); |
| 110 | 109 | $numVersaoSistema = intval(preg_replace('/\D+/', '', $strRegexVersaoSistema)); |
| 111 | - | |
| 110 | + | |
| 112 | 111 | if($numVersaoRequerida > $numVersaoSistema){ |
| 113 | 112 | throw new InfraException('VERSAO DO FRAMEWORK PHP INCOMPATIVEL (VERSAO ATUAL '.$strRegexVersaoSistema.', VERSAO REQUERIDA '.$strVerMinRequirida.')'); |
| 114 | 113 | } |
| 115 | - | |
| 114 | + | |
| 116 | 115 | return $this; |
| 117 | 116 | } |
| 118 | - | |
| 117 | + | |
| 119 | 118 | /** |
| 120 | 119 | * Apaga a chave primária da tabela |
| 121 | - * | |
| 120 | + * | |
| 122 | 121 | * @throws InfraException |
| 123 | 122 | * @return PenMetaBD |
| 124 | 123 | */ |
| 125 | 124 | public function removerChavePrimaria($strNomeTabela, $strNomeChave){ |
| 126 | - | |
| 125 | + | |
| 127 | 126 | if($this->isChaveExiste($strNomeTabela, $strNomeChave)) { |
| 128 | - | |
| 127 | + | |
| 129 | 128 | $strTableDrive = get_parent_class($this->getObjInfraIBanco()); |
| 130 | 129 | |
| 131 | 130 | switch($strTableDrive) { |
| ... | ... | @@ -139,64 +138,28 @@ class PenMetaBD extends InfraMetaBD { |
| 139 | 138 | break; |
| 140 | 139 | |
| 141 | 140 | case 'InfraOracle': |
| 141 | + $this->getObjInfraIBanco()->executarSql('ALTER TABLE '.$strNomeTabela.' DROP CONSTRAINT '.$strNomeChave); | |
| 142 | 142 | break; |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | return $this; |
| 146 | 146 | } |
| 147 | - | |
| 148 | - public function isChaveExiste($strNomeTabela = '', $strNomeChave = ''){ | |
| 149 | - | |
| 150 | - $objInfraBanco = $this->getObjInfraIBanco(); | |
| 151 | - $strTableDrive = get_parent_class($objInfraBanco); | |
| 152 | - | |
| 153 | - switch($strTableDrive) { | |
| 154 | - | |
| 155 | - case 'InfraMySqli': | |
| 156 | - $strSql = " SELECT COUNT(CONSTRAINT_NAME) AS EXISTE | |
| 157 | - FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
| 158 | - WHERE CONSTRAINT_SCHEMA = '".$objInfraBanco->getBanco()."' | |
| 159 | - AND TABLE_NAME = '".$strNomeTabela."' | |
| 160 | - AND CONSTRAINT_NAME = '".$strNomeChave."'"; | |
| 161 | - break; | |
| 162 | - | |
| 163 | - case 'InfraSqlServer': | |
| 164 | - | |
| 165 | - $strSql = " SELECT COUNT(CONSTRAINT_NAME) AS EXISTE | |
| 166 | - FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
| 167 | - WHERE CONSTRAINT_CATALOG = '".$objInfraBanco->getBanco()."' | |
| 168 | - AND TABLE_NAME = '".$strNomeTabela."' | |
| 169 | - AND CONSTRAINT_NAME = '".$strNomeChave."'"; | |
| 170 | - break; | |
| 171 | - | |
| 172 | - case 'InfraOracle': | |
| 173 | - $strSql = "SELECT 0 AS EXISTE"; | |
| 174 | - break; | |
| 175 | - } | |
| 176 | - | |
| 177 | - $strSql = preg_replace('/\s+/', ' ', $strSql); | |
| 178 | - $arrDados = $objInfraBanco->consultarSql($strSql); | |
| 179 | 147 | |
| 180 | - return (intval($arrDados[0]['EXISTE']) > 0) ? true : false; | |
| 181 | - } | |
| 182 | - | |
| 183 | 148 | public function adicionarChaveUnica($strNomeTabela = '', $arrNomeChave = array()){ |
| 184 | - | |
| 149 | + | |
| 185 | 150 | $this->getObjInfraIBanco() |
| 186 | 151 | ->executarSql('ALTER TABLE '.$strNomeTabela.' ADD CONSTRAINT UK_'.$strNomeTabela.' UNIQUE('.implode(', ', $arrNomeChave).')'); |
| 187 | 152 | } |
| 188 | - | |
| 153 | + | |
| 189 | 154 | public function renomearTabela($strNomeTabelaAtual, $strNomeTabelaNovo){ |
| 190 | - | |
| 155 | + | |
| 191 | 156 | if($this->isTabelaExiste($strNomeTabelaAtual)) { |
| 192 | - | |
| 157 | + | |
| 193 | 158 | $objInfraBanco = $this->getObjInfraIBanco(); |
| 194 | - | |
| 195 | 159 | $strTableDrive = get_parent_class($objInfraBanco); |
| 196 | 160 | $strQuery = ''; |
| 197 | 161 | |
| 198 | 162 | switch ($strTableDrive) { |
| 199 | - | |
| 200 | 163 | case 'InfraMySqli': |
| 201 | 164 | $strQuery = sprintf("ALTER TABLE `%s` RENAME TO `%s`", $strNomeTabelaAtual, $strNomeTabelaNovo); |
| 202 | 165 | break; |
| ... | ... | @@ -208,210 +171,192 @@ class PenMetaBD extends InfraMetaBD { |
| 208 | 171 | $strQuery = sprintf("RENAME TABLE %s TO %s", $strNomeTabelaAtual, $strNomeTabelaNovo); |
| 209 | 172 | break; |
| 210 | 173 | } |
| 211 | - | |
| 174 | + | |
| 175 | + $objInfraBanco->executarSql($strQuery); | |
| 176 | + } | |
| 177 | + } | |
| 178 | + | |
| 179 | + public function renomearColuna($strNomeTabela, $strNomeColunaAtual, $strNomeColunaNova, $strTipo){ | |
| 180 | + | |
| 181 | + if($this->isColunaExiste($strNomeTabela, $strNomeColunaAtual)) { | |
| 182 | + | |
| 183 | + $objInfraBanco = $this->getObjInfraIBanco(); | |
| 184 | + $strTableDrive = get_parent_class($objInfraBanco); | |
| 185 | + $strQuery = ''; | |
| 186 | + | |
| 187 | + switch ($strTableDrive) { | |
| 188 | + | |
| 189 | + case 'InfraMySqli': | |
| 190 | + $strQuery = sprintf("ALTER TABLE `%s` CHANGE `%s` `%s` `%s`", $strNomeTabela, $strNomeColunaAtual, $strNomeColunaNova, $strTipo); | |
| 191 | + break; | |
| 192 | + | |
| 193 | + case 'InfraSqlServer': | |
| 194 | + $strQuery = sprintf("SP_RENAME '%s'.'%s', '%s', 'COLUMN'", $strNomeTabela, $strNomeColunaAtual, $strNomeColunaNova); | |
| 195 | + | |
| 196 | + case 'InfraOracle': | |
| 197 | + $strQuery = sprintf("ALTER TABLE %s RENAME COLUMN %s TO %s", $strNomeTabela, $strNomeColunaAtual, $strNomeColunaNova); | |
| 198 | + break; | |
| 199 | + } | |
| 200 | + | |
| 212 | 201 | $objInfraBanco->executarSql($strQuery); |
| 213 | 202 | } |
| 214 | 203 | } |
| 215 | - | |
| 216 | - | |
| 204 | + | |
| 217 | 205 | /** |
| 218 | 206 | * Verifica se uma tabela existe no banco |
| 219 | - * | |
| 207 | + * | |
| 220 | 208 | * @throws InfraException |
| 221 | 209 | * @return bool |
| 222 | 210 | */ |
| 223 | 211 | public function isTabelaExiste($strNomeTabela = ''){ |
| 224 | - | |
| 225 | - $objInfraBanco = $this->getObjInfraIBanco(); | |
| 226 | - $strTableDrive = get_parent_class($objInfraBanco); | |
| 227 | - | |
| 228 | - switch($strTableDrive) { | |
| 229 | 212 | |
| 230 | - case 'InfraMySqli': | |
| 231 | - $strSql = "SELECT COUNT(TABLE_NAME) AS EXISTE | |
| 232 | - FROM INFORMATION_SCHEMA.TABLES | |
| 233 | - WHERE TABLE_SCHEMA = '".$objInfraBanco->getBanco()."' | |
| 234 | - AND TABLE_NAME = '".$strNomeTabela."'"; | |
| 235 | - break; | |
| 236 | - | |
| 237 | - case 'InfraSqlServer': | |
| 238 | - | |
| 239 | - $strSql = "SELECT COUNT(TABLE_NAME) AS EXISTE | |
| 240 | - FROM INFORMATION_SCHEMA.TABLES | |
| 241 | - WHERE TABLE_CATALOG = '".$objInfraBanco->getBanco()."' | |
| 242 | - AND TABLE_NAME = '".$strNomeTabela."'"; | |
| 243 | - break; | |
| 244 | - | |
| 245 | - case 'InfraOracle': | |
| 246 | - $strSql = "SELECT 0 AS EXISTE"; | |
| 247 | - break; | |
| 213 | + return count($this->obterTabelas($strNomeTabela)) != 0; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public function isColunaExiste($strNomeTabela = '', $strNomeColuna = ''){ | |
| 217 | + | |
| 218 | + $arrColunas = $this->obterColunasTabela($strNomeTabela); | |
| 219 | + foreach ($arrColunas as $objColuna) { | |
| 220 | + if($objColuna['column_name'] == $strNomeColuna){ | |
| 221 | + return true; | |
| 222 | + } | |
| 248 | 223 | } |
| 249 | - | |
| 250 | - $strSql = preg_replace('/\s+/', ' ', $strSql); | |
| 251 | - $arrDados = $objInfraBanco->consultarSql($strSql); | |
| 252 | 224 | |
| 253 | - return (intval($arrDados[0]['EXISTE']) > 0) ? true : false; | |
| 225 | + return false; | |
| 254 | 226 | } |
| 255 | - | |
| 256 | - public function isColuna($strNomeTabela = '', $strNomeColuna = ''){ | |
| 257 | - | |
| 258 | - $objInfraBanco = $this->getObjInfraIBanco(); | |
| 259 | - $strTableDrive = get_parent_class($objInfraBanco); | |
| 260 | - | |
| 261 | - switch($strTableDrive) { | |
| 262 | 227 | |
| 263 | - case 'InfraMySqli': | |
| 264 | - $strSql = "SELECT COUNT(TABLE_NAME) AS EXISTE | |
| 265 | - FROM INFORMATION_SCHEMA.COLUMNS | |
| 266 | - WHERE TABLE_SCHEMA = '".$objInfraBanco->getBanco()."' | |
| 267 | - AND TABLE_NAME = '".$strNomeTabela."' | |
| 268 | - AND COLUMN_NAME = '".$strNomeColuna."'"; | |
| 269 | - break; | |
| 270 | - | |
| 271 | - case 'InfraSqlServer': | |
| 272 | - | |
| 273 | - $strSql = "SELECT COUNT(COLUMN_NAME) AS EXISTE | |
| 274 | - FROM INFORMATION_SCHEMA.COLUMNS | |
| 275 | - WHERE TABLE_CATALOG = '".$objInfraBanco->getBanco()."' | |
| 276 | - AND TABLE_NAME = '".$strNomeTabela."' | |
| 277 | - AND COLUMN_NAME = '".$strNomeColuna."'"; | |
| 278 | - break; | |
| 279 | - | |
| 280 | - case 'InfraOracle': | |
| 281 | - $strSql = "SELECT 0 AS EXISTE"; | |
| 282 | - break; | |
| 228 | + public function isChaveExiste($strNomeTabela = '', $strNomeChave = ''){ | |
| 229 | + | |
| 230 | + $arrConstraints = $this->obterConstraints($strNomeTabela); | |
| 231 | + foreach ($arrConstraints as $objConstraint) { | |
| 232 | + if($objConstraint['constraint_name'] == $strNomeChave){ | |
| 233 | + return true; | |
| 234 | + } | |
| 283 | 235 | } |
| 284 | - | |
| 285 | - $strSql = preg_replace('/\s+/', ' ', $strSql); | |
| 286 | - $arrDados = $objInfraBanco->consultarSql($strSql); | |
| 287 | 236 | |
| 288 | - return (intval($arrDados[0]['EXISTE']) > 0) ? true : false; | |
| 289 | - | |
| 290 | - | |
| 237 | + return false; | |
| 291 | 238 | } |
| 292 | - | |
| 239 | + | |
| 293 | 240 | /** |
| 294 | 241 | * Cria a estrutura da tabela no padrão ANSI |
| 295 | - * | |
| 242 | + * | |
| 296 | 243 | * @throws InfraException |
| 297 | 244 | * @return PenMetaBD |
| 298 | 245 | */ |
| 299 | 246 | public function criarTabela($arrSchema = array()){ |
| 300 | - | |
| 247 | + | |
| 301 | 248 | $strNomeTabela = $arrSchema['tabela']; |
| 302 | - | |
| 303 | - | |
| 249 | + | |
| 304 | 250 | if($this->isTabelaExiste($strNomeTabela)) { |
| 305 | 251 | return $this; |
| 306 | 252 | } |
| 307 | - | |
| 253 | + | |
| 308 | 254 | $objInfraBanco = $this->getObjInfraIBanco(); |
| 309 | 255 | $arrColunas = array(); |
| 310 | 256 | $arrStrQuery = array(); |
| 311 | 257 | |
| 312 | 258 | foreach($arrSchema['cols'] as $strNomeColuna => $arrColunaConfig) { |
| 313 | - | |
| 259 | + | |
| 314 | 260 | list($strTipoDado, $strValorPadrao) = $arrColunaConfig; |
| 315 | - | |
| 261 | + | |
| 316 | 262 | if($strValorPadrao != self::SNULLO && $strValorPadrao != self::NNULLO) { |
| 317 | - | |
| 263 | + | |
| 318 | 264 | $arrStrQuery[] = $this->adicionarValorPadraoParaColuna($strNomeTabela, $strNomeColuna, $strValorPadrao, true); |
| 319 | 265 | $strValorPadrao = self::NNULLO; |
| 320 | 266 | } |
| 321 | 267 | |
| 322 | 268 | $arrColunas[] = $strNomeColuna.' '.$strTipoDado.' '.$strValorPadrao; |
| 323 | 269 | } |
| 324 | - | |
| 270 | + | |
| 325 | 271 | $objInfraBanco->executarSql('CREATE TABLE '.$strNomeTabela.' ('.implode(', ', $arrColunas).')'); |
| 326 | - | |
| 272 | + | |
| 327 | 273 | if(!empty($arrSchema['pk'])) { |
| 328 | - | |
| 329 | - $this->adicionarChavePrimaria($strNomeTabela, 'pk_'.$strNomeTabela, $arrSchema['pk']); | |
| 330 | - | |
| 331 | - if(count($arrSchema['pk']) > 1) { | |
| 332 | - | |
| 333 | - foreach($arrSchema['pk'] as $strPk) { | |
| 334 | - | |
| 335 | - $objInfraBanco->executarSql('CREATE INDEX idx_'.$strNomeTabela.'_'.$strPk.' ON '.$strNomeTabela.'('.$strPk.')'); | |
| 336 | - } | |
| 274 | + $strNomePK = array_key_exists('nome', $arrSchema['pk']) ? $arrSchema['pk']['nome'] : 'pk_' . $strNomeTabela; | |
| 275 | + $arrColunas = array_key_exists('cols', $arrSchema['pk']) ? $arrSchema['pk']['cols'] : $arrSchema['pk']; | |
| 276 | + $this->adicionarChavePrimaria($strNomeTabela, $strNomePK, $arrColunas); | |
| 277 | + if(count($arrColunas) > 1) { | |
| 278 | + for ($i=0; $i < count($arrColunas); $i++) { | |
| 279 | + $strPk = $arrColunas[$i]; | |
| 280 | + $strNomeIndex = substr("i" . str_pad($i + 1, 2, "0", STR_PAD_LEFT) . '_' . $strNomeTabela, 0, 30); | |
| 281 | + $objInfraBanco->executarSql('CREATE INDEX '.$strNomeIndex.' ON '.$strNomeTabela.'('.$strPk.')'); | |
| 282 | + } | |
| 337 | 283 | } |
| 338 | 284 | } |
| 339 | - | |
| 285 | + | |
| 340 | 286 | if(array_key_exists('uk', $arrSchema) && !empty($arrSchema['uk'])) { |
| 341 | - | |
| 342 | 287 | $this->adicionarChaveUnica($strNomeTabela, $arrSchema['uk']); |
| 343 | 288 | } |
| 344 | - | |
| 289 | + | |
| 345 | 290 | if(!empty($arrSchema['fks'])) { |
| 346 | - | |
| 291 | + | |
| 347 | 292 | foreach($arrSchema['fks'] as $strTabelaOrigem => $array) { |
| 348 | - | |
| 349 | - $strNomeFK = 'fk_'.$strNomeTabela.'_'.$strTabelaOrigem; | |
| 350 | - $arrCamposOrigem = (array)array_shift($array); | |
| 293 | + $strNomeFK = array_key_exists('nome', $array) ? $array['nome'] : 'fk_'.$strNomeTabela.'_'.$strTabelaOrigem; | |
| 294 | + $arrayColumns = array_key_exists('cols', $array) ? $array['cols'] : $array; | |
| 295 | + $arrCamposOrigem = (array)array_shift($arrayColumns); | |
| 351 | 296 | $arrCampos = $arrCamposOrigem; |
| 352 | 297 | |
| 353 | - if(!empty($array)) { | |
| 354 | - $arrCampos = (array)array_shift($array); | |
| 298 | + if(!empty($arrayColumns)) { | |
| 299 | + $arrCampos = (array)array_shift($arrayColumns); | |
| 355 | 300 | } |
| 356 | 301 | |
| 357 | - $this->adicionarChaveEstrangeira($strNomeFK, $strNomeTabela, $arrCampos, $strTabelaOrigem, $arrCamposOrigem); | |
| 302 | + $this->adicionarChaveEstrangeira($strNomeFK, $strNomeTabela, $arrCampos, $strTabelaOrigem, $arrCamposOrigem); | |
| 358 | 303 | } |
| 359 | 304 | } |
| 360 | - | |
| 305 | + | |
| 361 | 306 | if(!empty($arrStrQuery)) { |
| 362 | - | |
| 363 | - foreach($arrStrQuery as $strQuery) { | |
| 307 | + | |
| 308 | + foreach($arrStrQuery as $strQuery) { | |
| 364 | 309 | $objInfraBanco->executarSql($strQuery); |
| 365 | 310 | } |
| 366 | 311 | } |
| 367 | - | |
| 312 | + | |
| 368 | 313 | return $this; |
| 369 | 314 | } |
| 370 | - | |
| 315 | + | |
| 371 | 316 | /** |
| 372 | 317 | * Apagar a estrutura da tabela no banco de dados |
| 373 | - * | |
| 318 | + * | |
| 374 | 319 | * @throws InfraException |
| 375 | 320 | * @return PenMetaBD |
| 376 | 321 | */ |
| 377 | 322 | public function removerTabela($strNomeTabela = ''){ |
| 378 | - | |
| 323 | + | |
| 379 | 324 | $this->getObjInfraIBanco()->executarSql('DROP TABLE '.$strNomeTabela); |
| 380 | 325 | return $this; |
| 381 | 326 | } |
| 382 | - | |
| 327 | + | |
| 383 | 328 | public function adicionarChaveEstrangeira($strNomeFK, $strTabela, $arrCampos, $strTabelaOrigem, $arrCamposOrigem) { |
| 384 | - | |
| 329 | + | |
| 385 | 330 | if(!$this->isChaveExiste($strTabela, $strNomeFK)) { |
| 386 | 331 | parent::adicionarChaveEstrangeira($strNomeFK, $strTabela, $arrCampos, $strTabelaOrigem, $arrCamposOrigem); |
| 387 | 332 | } |
| 388 | 333 | return $this; |
| 389 | 334 | } |
| 390 | - | |
| 335 | + | |
| 391 | 336 | public function adicionarChavePrimaria($strTabela, $strNomePK, $arrCampos) { |
| 392 | - | |
| 337 | + | |
| 393 | 338 | if(!$this->isChaveExiste($strTabela, $strNomePK)) { |
| 394 | 339 | parent::adicionarChavePrimaria($strTabela, $strNomePK, $arrCampos); |
| 395 | 340 | } |
| 396 | 341 | return $this; |
| 397 | 342 | } |
| 398 | - | |
| 343 | + | |
| 399 | 344 | public function alterarColuna($strTabela, $strColuna, $strTipo, $strNull = '') { |
| 400 | 345 | parent::alterarColuna($strTabela, $strColuna, $strTipo, $strNull); |
| 401 | 346 | return $this; |
| 402 | 347 | } |
| 403 | - | |
| 348 | + | |
| 404 | 349 | public function excluirIndice($strTabela, $strIndex) { |
| 405 | 350 | if($this->isChaveExiste($strTabela, $strFk)) { |
| 406 | 351 | parent::excluirIndice($strTabela, $strIndex); |
| 407 | 352 | } |
| 408 | 353 | return $this; |
| 409 | 354 | } |
| 410 | - | |
| 355 | + | |
| 411 | 356 | public function excluirChaveEstrangeira($strTabela, $strFk) { |
| 412 | 357 | if($this->isChaveExiste($strTabela, $strFk)) { |
| 413 | 358 | parent::excluirChaveEstrangeira($strTabela, $strFk); |
| 414 | 359 | } |
| 415 | 360 | return $this; |
| 416 | 361 | } |
| 417 | -} | |
| 418 | 362 | \ No newline at end of file |
| 363 | +} | ... | ... |
dto/PenTramiteProcessadoDTO.php
| ... | ... | @@ -3,23 +3,24 @@ |
| 3 | 3 | require_once dirname(__FILE__) . '/../../../SEI.php'; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * | |
| 6 | + * | |
| 7 | 7 | * @author Join Tecnologia |
| 8 | 8 | */ |
| 9 | 9 | class PenTramiteProcessadoDTO extends InfraDTO { |
| 10 | - | |
| 10 | + | |
| 11 | 11 | public function getStrNomeTabela() { |
| 12 | - return 'md_pen_tramite_processado'; | |
| 12 | + return 'md_pen_tramite_processado'; | |
| 13 | 13 | } |
| 14 | - | |
| 14 | + | |
| 15 | 15 | public function montar() { |
| 16 | - | |
| 16 | + | |
| 17 | 17 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdTramite', 'id_tramite'); |
| 18 | 18 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DTH, 'Ultimo', 'dth_ultimo_processamento'); |
| 19 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Tentativas', 'numero_tentativas'); | |
| 19 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Tentativas', 'numero_tentativas'); | |
| 20 | 20 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Recebido', 'sin_recebimento_concluido'); |
| 21 | 21 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Tipo', 'tipo_tramite_processo'); |
| 22 | 22 | |
| 23 | 23 | $this->configurarPK('IdTramite', InfraDTO::$TIPO_PK_INFORMADO); |
| 24 | + $this->configurarPK('Tipo', InfraDTO::$TIPO_PK_INFORMADO); | |
| 24 | 25 | } |
| 25 | 26 | } | ... | ... |
pen_parametros_configuracao.php
| ... | ... | @@ -57,7 +57,7 @@ try { |
| 57 | 57 | $objPenParametroDTO->retStrNome(); |
| 58 | 58 | |
| 59 | 59 | if($objPenParametroRN->contar($objPenParametroDTO) > 0) { |
| 60 | - $objPenParametroDTO->setStrValor($valor); | |
| 60 | + $objPenParametroDTO->setStrValor(trim($valor)); | |
| 61 | 61 | $objPenParametroRN->alterar($objPenParametroDTO); |
| 62 | 62 | } |
| 63 | 63 | } | ... | ... |
pen_procedimento_expedir.php
| ... | ... | @@ -573,10 +573,6 @@ $objPaginaSEI->montarBarraComandosSuperior($arrComandos); |
| 573 | 573 | <img id="imgExcluirProcedimentosApensados" onclick="objLupaProcedimentosApensados.remover();" src="/infra_css/imagens/remover.gif" alt="Remover Processo Apensado" title="Remover Processo Apensado" class="infraImg" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> |
| 574 | 574 | </div> |
| 575 | 575 | |
| 576 | - <div id="divSinUrgente" class="infraDivCheckbox"> | |
| 577 | - <input type="checkbox" id="chkSinUrgente" name="chkSinUrgente" class="infraCheckbox" onclick="selecionarUrgencia();" <?= $objPaginaSEI->setCheckbox($boolSinUrgente, true, false) ?> tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
| 578 | - <label id="lblSinUrgente" for="chkSinUrgente" accesskey="" class="infraLabelCheckbox">Urgente</label> | |
| 579 | - </div> | |
| 580 | 576 | |
| 581 | 577 | <div id="divMotivosUrgencia" class="infraAreaDados" style="height: 4.5em; display:none"> |
| 582 | 578 | <label id="lblMotivosUrgencia" for="selMotivosUrgencia" accesskey="" class="infraLabel">Motivo da Urgência:</label> | ... | ... |
rn/EnviarReciboTramiteRN.php
| 1 | -<?php | |
| 1 | +<?php | |
| 2 | + | |
| 2 | 3 | require_once dirname(__FILE__) . '/../../../SEI.php'; |
| 3 | 4 | |
| 4 | 5 | class EnviarReciboTramiteRN extends InfraRN |
| ... | ... | @@ -18,60 +19,60 @@ class EnviarReciboTramiteRN extends InfraRN |
| 18 | 19 | { |
| 19 | 20 | return BancoSEI::getInstance(); |
| 20 | 21 | } |
| 21 | - | |
| 22 | + | |
| 22 | 23 | /** |
| 23 | - * Gera o recibo do tramite para o destinário informando o recebimento | |
| 24 | + * Gera o recibo do tramite para o destinário informando o recebimento | |
| 24 | 25 | * do procedimento. |
| 25 | - * | |
| 26 | + * | |
| 26 | 27 | * @param int $numIdTramite |
| 27 | 28 | * @return array |
| 28 | 29 | */ |
| 29 | 30 | protected function gerarReciboTramite($numIdTramite){ |
| 30 | - | |
| 31 | + | |
| 31 | 32 | $arrStrHashConteudo = array(); |
| 32 | - | |
| 33 | + | |
| 33 | 34 | $objMetaRetorno = $this->objProcessoEletronicoRN->solicitarMetadados($numIdTramite); |
| 34 | - | |
| 35 | + | |
| 35 | 36 | $objMetaProcesso = $objMetaRetorno->metadados->processo; |
| 36 | 37 | |
| 37 | 38 | $arrObjMetaDocumento = is_array($objMetaProcesso->documento) ? $objMetaProcesso->documento : array($objMetaProcesso->documento); |
| 38 | - | |
| 39 | + | |
| 39 | 40 | $objDTO = new ComponenteDigitalDTO(); |
| 40 | 41 | $objBD = new ComponenteDigitalBD($this->inicializarObjInfraIBanco()); |
| 41 | - | |
| 42 | + | |
| 42 | 43 | foreach($arrObjMetaDocumento as $objMetaDocumento) { |
| 43 | - | |
| 44 | + | |
| 44 | 45 | $strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objMetaDocumento->componenteDigital->hash); |
| 45 | - | |
| 46 | + | |
| 46 | 47 | $objDTO->setStrHashConteudo($strHashConteudo); |
| 47 | - | |
| 48 | + | |
| 48 | 49 | if($objBD->contar($objDTO) > 0) { |
| 49 | - | |
| 50 | + | |
| 50 | 51 | $arrStrHashConteudo[] = $strHashConteudo; |
| 51 | 52 | } |
| 52 | 53 | } |
| 53 | - | |
| 54 | + | |
| 54 | 55 | return $arrStrHashConteudo; |
| 55 | 56 | } |
| 56 | - | |
| 57 | + | |
| 57 | 58 | protected function cadastrarReciboTramiteRecebimento($strNumeroRegistro = '', $parNumIdTramite = 0, $strHashConteudo = '', $parArrayHash = array()){ |
| 58 | - | |
| 59 | + | |
| 59 | 60 | $objBD = new ReciboTramiteRecebidoBD($this->inicializarObjInfraIBanco()); |
| 60 | - | |
| 61 | + | |
| 61 | 62 | $objDTO = new ReciboTramiteRecebidoDTO(); |
| 62 | 63 | $objDTO->setStrNumeroRegistro($strNumeroRegistro); |
| 63 | 64 | $objDTO->setNumIdTramite($parNumIdTramite); |
| 64 | - | |
| 65 | - if(!empty($strHashConteudo)) $objDTO->setStrHashAssinatura($strHashConteudo); | |
| 65 | + | |
| 66 | + if(!empty($strHashConteudo)) $objDTO->setStrHashAssinatura($strHashConteudo); | |
| 66 | 67 | |
| 67 | 68 | if(intval($objBD->contar($objDTO)) == 0) { |
| 68 | - | |
| 69 | + | |
| 69 | 70 | $objDTO->setDthRecebimento(date('d/m/Y H:i:s')); |
| 70 | 71 | $objBD->cadastrar($objDTO); |
| 71 | 72 | } |
| 72 | - | |
| 73 | + | |
| 73 | 74 | foreach($parArrayHash as $strHashComponenteDigital){ |
| 74 | - | |
| 75 | + | |
| 75 | 76 | $objReciboTramiteHashDTO = new ReciboTramiteHashDTO(); |
| 76 | 77 | $objReciboTramiteHashDTO->setStrNumeroRegistro($strNumeroRegistro); |
| 77 | 78 | $objReciboTramiteHashDTO->setNumIdTramite($parNumIdTramite); |
| ... | ... | @@ -80,33 +81,33 @@ class EnviarReciboTramiteRN extends InfraRN |
| 80 | 81 | |
| 81 | 82 | $objBD->cadastrar($objReciboTramiteHashDTO); |
| 82 | 83 | } |
| 83 | - | |
| 84 | - | |
| 84 | + | |
| 85 | + | |
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | public function enviarReciboTramiteProcesso($parNumIdTramite, $parArrayHash = null, $parDthRecebimento = null) |
| 88 | - { | |
| 89 | + { | |
| 89 | 90 | |
| 90 | 91 | date_default_timezone_set('America/Sao_Paulo'); |
| 91 | 92 | |
| 92 | 93 | if(!isset($parNumIdTramite) || $parNumIdTramite == 0) { |
| 93 | - throw new InfraException('Parâmetro $parNumIdTramite não informado.'); | |
| 94 | - } | |
| 94 | + throw new InfraException('Parâmetro $parNumIdTramite não informado.'); | |
| 95 | + } | |
| 95 | 96 | |
| 96 | - //Verifica se todos os componentes digitais já foram devidamente recebido | |
| 97 | + //Verifica se todos os componentes digitais já foram devidamente recebido | |
| 97 | 98 | $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdTramite); |
| 98 | 99 | if(!isset($arrObjTramite) || count($arrObjTramite) != 1) { |
| 99 | - throw new InfraException("Trâmite não pode ser localizado pelo identificador $parNumIdTramite."); | |
| 100 | + throw new InfraException("Trâmite não pode ser localizado pelo identificador $parNumIdTramite."); | |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | $objTramite = $arrObjTramite[0]; |
| 103 | 104 | $strNumeroRegistro = $objTramite->NRE; |
| 104 | 105 | |
| 105 | 106 | if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { |
| 106 | - throw new InfraException('Situação do Trâmite diferente da permitida para o envio do recibo de conclusão de trâmite.'); | |
| 107 | + throw new InfraException('Situação do Trâmite diferente da permitida para o envio do recibo de conclusão de trâmite.'); | |
| 107 | 108 | } |
| 108 | 109 | |
| 109 | - $dthRecebimentoComponentesDigitais = $this->obterDataRecebimentoComponentesDigitais($objTramite); | |
| 110 | + $dthRecebimentoComponentesDigitais = $this->obterDataRecebimentoComponentesDigitais($objTramite); | |
| 110 | 111 | $dthRecebimentoComponentesDigitais = $dthRecebimentoComponentesDigitais ?: date(); |
| 111 | 112 | $dthRecebimento = gmdate("Y-m-d\TH:i:s.000\Z", InfraData::getTimestamp($dthRecebimentoComponentesDigitais)); |
| 112 | 113 | |
| ... | ... | @@ -115,23 +116,23 @@ class EnviarReciboTramiteRN extends InfraRN |
| 115 | 116 | $strReciboTramite .= "<NRE>$strNumeroRegistro</NRE>"; |
| 116 | 117 | $strReciboTramite .= "<dataDeRecebimento>$dthRecebimento</dataDeRecebimento>"; |
| 117 | 118 | sort($parArrayHash); |
| 118 | - | |
| 119 | + | |
| 119 | 120 | foreach ($parArrayHash as $strHashConteudo) { |
| 120 | 121 | if(!empty($strHashConteudo)){ |
| 121 | 122 | $strReciboTramite .= "<hashDoComponenteDigital>$strHashConteudo</hashDoComponenteDigital>"; |
| 122 | 123 | } |
| 123 | - } | |
| 124 | + } | |
| 124 | 125 | $strReciboTramite .= "</recibo>"; |
| 125 | - | |
| 126 | + | |
| 126 | 127 | //Envia o Recibo de salva no banco |
| 127 | 128 | $hashAssinatura = $this->objProcessoEletronicoRN->enviarReciboDeTramite($parNumIdTramite, $dthRecebimento, $strReciboTramite); |
| 128 | 129 | $this->cadastrarReciboTramiteRecebimento($strNumeroRegistro, $parNumIdTramite, $hashAssinatura, $parArrayHash); |
| 129 | - } | |
| 130 | + } | |
| 130 | 131 | |
| 131 | 132 | private function obterDataRecebimentoComponentesDigitais($parObjTramite){ |
| 132 | - | |
| 133 | + | |
| 133 | 134 | if(!isset($parObjTramite)) { |
| 134 | - throw new InfraException('Parâmetro $parObjTramite não informado.'); | |
| 135 | + throw new InfraException('Parâmetro $parObjTramite não informado.'); | |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | if(!is_array($parObjTramite->historico->operacao)) { |
| ... | ... | @@ -140,7 +141,7 @@ class EnviarReciboTramiteRN extends InfraRN |
| 140 | 141 | |
| 141 | 142 | foreach ($parObjTramite->historico->operacao as $operacao) { |
| 142 | 143 | if($operacao->situacao == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { |
| 143 | - return ProcessoEletronicoRN::converterDataSEI($operacao->dataHora); | |
| 144 | + return ProcessoEletronicoRN::converterDataSEI($operacao->dataHora); | |
| 144 | 145 | } |
| 145 | 146 | } |
| 146 | 147 | |
| ... | ... | @@ -148,17 +149,17 @@ class EnviarReciboTramiteRN extends InfraRN |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | /** |
| 151 | - * Consulta o componente digital no barramento. Utilizado para casos de retrasmissão, | |
| 152 | - * onde esta unidade esta recebendo um componente digital que pertence à ela | |
| 153 | - * própria, então o id_tramite de envio, que foi gravado, é diferente do de recebimento | |
| 154 | - * | |
| 152 | + * Consulta o componente digital no barramento. Utilizado para casos de retrasmissão, | |
| 153 | + * onde esta unidade esta recebendo um componente digital que pertence à ela | |
| 154 | + * própria, então o id_tramite de envio, que foi gravado, é diferente do de recebimento | |
| 155 | + * | |
| 155 | 156 | * @param int $numIdTramite |
| 156 | 157 | * @return array[ComponenteDigitalDTO] |
| 157 | 158 | */ |
| 158 | 159 | private function recarregarComponenteDigitalDTO($numIdTramite){ |
| 159 | - | |
| 160 | + | |
| 160 | 161 | $arrObjComponenteDigitalDTO = array(); |
| 161 | - | |
| 162 | + | |
| 162 | 163 | $objMetaRetorno = $this->objProcessoEletronicoRN->solicitarMetadados($numIdTramite); |
| 163 | 164 | |
| 164 | 165 | if(!empty($objMetaRetorno)) { |
| ... | ... | @@ -166,43 +167,44 @@ class EnviarReciboTramiteRN extends InfraRN |
| 166 | 167 | $objMetaProcesso = $objMetaRetorno->metadados->processo; |
| 167 | 168 | |
| 168 | 169 | $arrObjMetaDocumento = is_array($objMetaProcesso->documento) ? $objMetaProcesso->documento : array($objMetaProcesso->documento); |
| 169 | - | |
| 170 | + | |
| 170 | 171 | foreach($arrObjMetaDocumento as $objMetaDocumento) { |
| 171 | 172 | |
| 172 | 173 | $dblIdProcedimento = null; |
| 173 | 174 | $dblIdDocumento = null; |
| 174 | - | |
| 175 | + | |
| 175 | 176 | $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); |
| 176 | 177 | $objProcessoEletronicoDTO->setStrNumeroRegistro($objMetaRetorno->metadados->NRE); |
| 177 | 178 | $objProcessoEletronicoDTO->retDblIdProcedimento(); |
| 178 | - | |
| 179 | + | |
| 179 | 180 | $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); |
| 180 | 181 | $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); |
| 181 | - | |
| 182 | + | |
| 182 | 183 | if(empty($objProcessoEletronicoDTO)) { |
| 183 | - | |
| 184 | + | |
| 184 | 185 | $dblIdProcedimento = $objProcessoEletronicoDTO->getDblIdProcedimento(); |
| 185 | - | |
| 186 | + | |
| 186 | 187 | $objDocumentoDTO = new DocumentoDTO(); |
| 187 | 188 | $objDocumentoDTO->setDblIdProcedimento($dblIdProcedimento); |
| 188 | 189 | $objDocumentoDTO->retDblIdDocumento(); |
| 189 | - | |
| 190 | + | |
| 190 | 191 | $objDocumentoBD = new DocumentoBD(); |
| 191 | 192 | $objDocumentoDTO = $objDocumentoBD->consultar($objDocumentoDTO); |
| 192 | - | |
| 193 | + | |
| 193 | 194 | if(empty($objDocumentoDTO)) { |
| 194 | - | |
| 195 | + | |
| 195 | 196 | $dblIdDocumento = $objDocumentoDTO->getDblIdDocumento(); |
| 196 | - } | |
| 197 | + } | |
| 197 | 198 | } |
| 198 | 199 | |
| 199 | 200 | $objMetaComponenteDigital = $objMetaDocumento->componenteDigital; |
| 200 | - | |
| 201 | + | |
| 201 | 202 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
| 202 | 203 | $objComponenteDigitalDTO->setStrNumeroRegistro($objMetaRetorno->metadados->NRE); |
| 203 | 204 | $objComponenteDigitalDTO->setDblIdProcedimento($dblIdProcedimento); |
| 204 | 205 | $objComponenteDigitalDTO->setDblIdDocumento($dblIdDocumento); |
| 205 | 206 | $objComponenteDigitalDTO->setNumIdTramite($numIdTramite); |
| 207 | + | |
| 206 | 208 | $objComponenteDigitalDTO->setNumIdAnexo($objMetaComponenteDigital->idAnexo); |
| 207 | 209 | $objComponenteDigitalDTO->setStrNome($objMetaComponenteDigital->nome); |
| 208 | 210 | $objComponenteDigitalDTO->setStrHashConteudo(ProcessoEletronicoRN::getHashFromMetaDados($objMetaComponenteDigital->hash)); |
| ... | ... | @@ -214,30 +216,30 @@ class EnviarReciboTramiteRN extends InfraRN |
| 214 | 216 | $objComponenteDigitalDTO->setNumTamanho($objMetaComponenteDigital->tamanhoEmBytes); |
| 215 | 217 | $objComponenteDigitalDTO->setNumOrdem($objMetaDocumento->ordem); |
| 216 | 218 | $objComponenteDigitalDTO->setStrSinEnviar('S'); |
| 217 | - | |
| 219 | + | |
| 218 | 220 | $arrObjComponenteDigitalDTO[] = $objComponenteDigitalDTO; |
| 219 | - } | |
| 220 | - } | |
| 221 | - | |
| 221 | + } | |
| 222 | + } | |
| 223 | + | |
| 222 | 224 | return $arrObjComponenteDigitalDTO; |
| 223 | 225 | } |
| 224 | - | |
| 226 | + | |
| 225 | 227 | /** |
| 226 | 228 | */ |
| 227 | 229 | private function listarComponenteDigitalDTO($parNumIdTramite) { |
| 228 | - | |
| 230 | + | |
| 229 | 231 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
| 230 | 232 | $objComponenteDigitalDTO->retTodos(); |
| 231 | 233 | $objComponenteDigitalDTO->setNumIdTramite($parNumIdTramite); |
| 232 | - | |
| 234 | + | |
| 233 | 235 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
| 234 | 236 | $arrObjComponenteDigitalDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO); |
| 235 | 237 | |
| 236 | 238 | if (empty($arrObjComponenteDigitalDTO)) { |
| 237 | - | |
| 238 | - //$arrObjComponenteDigitalDTO = $this->recarregarComponenteDigitalDTO($parNumIdTramite); | |
| 239 | + | |
| 240 | + //$arrObjComponenteDigitalDTO = $this->recarregarComponenteDigitalDTO($parNumIdTramite); | |
| 239 | 241 | } |
| 240 | 242 | |
| 241 | 243 | return $arrObjComponenteDigitalDTO; |
| 242 | 244 | } |
| 243 | -} | |
| 244 | 245 | \ No newline at end of file |
| 246 | +} | ... | ... |
rn/PenAtualizarSeiRN.php
| ... | ... | @@ -12,8 +12,8 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 12 | 12 | public function __construct() { |
| 13 | 13 | parent::__construct(); |
| 14 | 14 | } |
| 15 | - | |
| 16 | - public function atualizarVersao() { | |
| 15 | + | |
| 16 | + protected function atualizarVersaoConectado() { | |
| 17 | 17 | try { |
| 18 | 18 | $this->inicializar('INICIANDO ATUALIZACAO DO MODULO PEN NO SEI VERSAO ' . SEI_VERSAO); |
| 19 | 19 | |
| ... | ... | @@ -24,25 +24,31 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 24 | 24 | |
| 25 | 25 | $this->finalizar('BANCO DE DADOS NAO SUPORTADO: ' . get_parent_class(BancoSEI::getInstance()), true); |
| 26 | 26 | } |
| 27 | - | |
| 27 | + | |
| 28 | 28 | //testando permissoes de criações de tabelas |
| 29 | 29 | $objInfraMetaBD = new InfraMetaBD($this->objInfraBanco); |
| 30 | - | |
| 30 | + | |
| 31 | 31 | if (count($objInfraMetaBD->obterTabelas('pen_sei_teste')) == 0) { |
| 32 | 32 | BancoSEI::getInstance()->executarSql('CREATE TABLE pen_sei_teste (id ' . $objInfraMetaBD->tipoNumero() . ' null)'); |
| 33 | 33 | } |
| 34 | 34 | BancoSEI::getInstance()->executarSql('DROP TABLE pen_sei_teste'); |
| 35 | 35 | |
| 36 | - $objInfraParametro = new InfraParametro($this->objInfraBanco); | |
| 37 | - | |
| 36 | + $objInfraParametro = new InfraParametro($this->objInfraBanco); | |
| 37 | + | |
| 38 | 38 | // Aplicação de scripts de atualização de forma incremental |
| 39 | 39 | // Ausência de [break;] proposital para realizar a atualização incremental de versões |
| 40 | 40 | $strVersaoModuloPen = $objInfraParametro->getValor(self::PARAMETRO_VERSAO_MODULO, false) ?: $objInfraParametro->getValor(self::PARAMETRO_VERSAO_MODULO_ANTIGO, false); |
| 41 | - switch ($strVersaoModuloPen) { | |
| 41 | + switch ($strVersaoModuloPen) { | |
| 42 | 42 | case '': $this->instalarV100(); // Nenhuma versão instalada |
| 43 | 43 | case '1.0.0': $this->instalarV101(); |
| 44 | 44 | case '1.0.1': $this->instalarV110(); |
| 45 | 45 | case '1.1.0': $this->instalarV111(); |
| 46 | + case '1.1.1': //Não houve atualização no banco de dados | |
| 47 | + case '1.1.2': //Não houve atualização no banco de dados | |
| 48 | + case '1.1.3': //Não houve atualização no banco de dados | |
| 49 | + case '1.1.4': //Não houve atualização no banco de dados | |
| 50 | + case '1.1.5': //Não houve atualização no banco de dados | |
| 51 | + case '1.1.6': $this->instalarV117(); | |
| 46 | 52 | |
| 47 | 53 | break; |
| 48 | 54 | default: |
| ... | ... | @@ -76,7 +82,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 76 | 82 | |
| 77 | 83 | return $objDTOCadastrado->getStrNome(); |
| 78 | 84 | } |
| 79 | - | |
| 85 | + | |
| 80 | 86 | /** |
| 81 | 87 | * Remove um parâmetro do infra_parametros |
| 82 | 88 | * @return string Nome do parâmetro |
| ... | ... | @@ -88,10 +94,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 88 | 94 | $objBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); |
| 89 | 95 | return $objBD->excluir($objDTO); |
| 90 | 96 | } |
| 91 | - | |
| 97 | + | |
| 92 | 98 | /* Contem atualizações da versao 1.0.0 do modulo */ |
| 93 | 99 | protected function instalarV100() { |
| 94 | - | |
| 100 | + | |
| 95 | 101 | $objInfraBanco = $this->objInfraBanco; |
| 96 | 102 | $objMetaBD = $this->objMeta; |
| 97 | 103 | |
| ... | ... | @@ -101,13 +107,15 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 101 | 107 | 'numero_registro' => array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO), |
| 102 | 108 | 'id_procedimento' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO) |
| 103 | 109 | ), |
| 104 | - 'pk' => array('numero_registro'), | |
| 110 | + 'pk' => array('cols'=>array('numero_registro')), | |
| 105 | 111 | 'uk' => array('numero_registro', 'id_procedimento'), |
| 106 | 112 | 'fks' => array( |
| 107 | - 'procedimento' => array('id_procedimento', 'id_procedimento') | |
| 113 | + 'procedimento' => array('nome' => 'fk_md_pen_proc_eletr_procedim', | |
| 114 | + 'cols' => array('id_procedimento', 'id_procedimento')), | |
| 108 | 115 | ) |
| 109 | 116 | )); |
| 110 | 117 | |
| 118 | + | |
| 111 | 119 | $objMetaBD->criarTabela(array( |
| 112 | 120 | 'tabela' => 'md_pen_tramite', |
| 113 | 121 | 'cols' => array( |
| ... | ... | @@ -119,15 +127,17 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 119 | 127 | 'id_usuario' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO), |
| 120 | 128 | 'id_unidade' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO) |
| 121 | 129 | ), |
| 122 | - 'pk' => array('id_tramite'), | |
| 130 | + 'pk' => array('cols'=>array('id_tramite')), | |
| 123 | 131 | 'uk' => array('numero_registro', 'id_tramite'), |
| 124 | 132 | 'fks' => array( |
| 125 | - 'md_pen_processo_eletronico' => array('numero_registro', 'numero_registro'), | |
| 133 | + 'md_pen_processo_eletronico' => array('nome'=>'fk_md_pen_tramite_proc_eletr', | |
| 134 | + 'cols' => array('numero_registro', 'numero_registro')), | |
| 126 | 135 | 'usuario' => array('id_usuario', 'id_usuario'), |
| 127 | - 'unidade' => array('id_unidade', 'id_unidade') | |
| 136 | + 'unidade' => array('id_unidade', 'id_unidade'), | |
| 128 | 137 | ) |
| 129 | 138 | )); |
| 130 | 139 | |
| 140 | + | |
| 131 | 141 | $objMetaBD->criarTabela(array( |
| 132 | 142 | 'tabela' => 'md_pen_especie_documental', |
| 133 | 143 | 'cols' => array( |
| ... | ... | @@ -135,9 +145,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 135 | 145 | 'nome_especie' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO), |
| 136 | 146 | 'descricao' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO) |
| 137 | 147 | ), |
| 138 | - 'pk' => array('id_especie') | |
| 148 | + 'pk' => array('cols'=>array('id_especie')), | |
| 139 | 149 | )); |
| 140 | 150 | |
| 151 | + | |
| 141 | 152 | $objMetaBD->criarTabela(array( |
| 142 | 153 | 'tabela' => 'md_pen_tramite_pendente', |
| 143 | 154 | 'cols' => array( |
| ... | ... | @@ -145,7 +156,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 145 | 156 | 'numero_tramite' => array($objMetaBD->tipoTextoVariavel(255)), |
| 146 | 157 | 'id_atividade_expedicao' => array($objMetaBD->tipoNumero(), PenMetaBD::SNULLO) |
| 147 | 158 | ), |
| 148 | - 'pk' => array('id') | |
| 159 | + 'pk' => array('cols'=>array('id')), | |
| 149 | 160 | )); |
| 150 | 161 | |
| 151 | 162 | $objMetaBD->criarTabela(array( |
| ... | ... | @@ -156,7 +167,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 156 | 167 | 'dth_recebimento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO), |
| 157 | 168 | 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO) |
| 158 | 169 | ), |
| 159 | - 'pk' => array('numero_registro', 'id_tramite') | |
| 170 | + 'pk' => array('cols'=>array('numero_registro', 'id_tramite')), | |
| 160 | 171 | )); |
| 161 | 172 | |
| 162 | 173 | |
| ... | ... | @@ -172,7 +183,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 172 | 183 | 'hash' => array($objMetaBD->tipoTextoFixo(32), PenMetaBD::NNULLO), |
| 173 | 184 | 'id_tarefa' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO) |
| 174 | 185 | ), |
| 175 | - 'pk' => array('id_andamento') | |
| 186 | + 'pk' => array('nome' => 'pk_md_pen_procedim_andamen', 'cols'=>array('id_andamento')), | |
| 176 | 187 | )); |
| 177 | 188 | |
| 178 | 189 | $objMetaBD->criarTabela(array( |
| ... | ... | @@ -181,20 +192,12 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 181 | 192 | 'id_protocolo' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO), |
| 182 | 193 | 'sin_obteve_recusa' => array($objMetaBD->tipoTextoFixo(1), 'N') |
| 183 | 194 | ), |
| 184 | - 'pk' => array('id_protocolo'), | |
| 195 | + 'pk' => array('cols'=>array('id_protocolo')), | |
| 185 | 196 | 'fks' => array( |
| 186 | 197 | 'protocolo' => array('id_protocolo', 'id_protocolo') |
| 187 | 198 | ) |
| 188 | 199 | )); |
| 189 | 200 | |
| 190 | - /* $objMetaBD->criarTabela(array( | |
| 191 | - 'tabela' => 'md_pen_tramite_recusado', | |
| 192 | - 'cols' => array( | |
| 193 | - 'numero_registro'=> array($objMetaBD->tipoTextoFixo(16), PenMetaBD::NNULLO), | |
| 194 | - 'id_tramite' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO) | |
| 195 | - ), | |
| 196 | - 'pk' => array('id_tramite') | |
| 197 | - )); */ | |
| 198 | 201 | |
| 199 | 202 | $objMetaBD->criarTabela(array( |
| 200 | 203 | 'tabela' => 'md_pen_recibo_tramite', |
| ... | ... | @@ -205,9 +208,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 205 | 208 | 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO), |
| 206 | 209 | 'cadeia_certificado' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO) |
| 207 | 210 | ), |
| 208 | - 'pk' => array('numero_registro', 'id_tramite'), | |
| 211 | + 'pk' => array('cols'=>array('numero_registro', 'id_tramite')), | |
| 209 | 212 | 'fks' => array( |
| 210 | - 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite')) | |
| 213 | + 'md_pen_tramite' => array('nome' => 'fk_md_pen_rec_tramite_tramite', | |
| 214 | + 'cols' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))) | |
| 211 | 215 | ) |
| 212 | 216 | )); |
| 213 | 217 | |
| ... | ... | @@ -220,12 +224,14 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 220 | 224 | 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO), |
| 221 | 225 | 'cadeia_certificado ' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO) |
| 222 | 226 | ), |
| 223 | - 'pk' => array('numero_registro', 'id_tramite'), | |
| 227 | + 'pk' => array('nome' => 'pk_md_pen_recibo_tram_envia', 'cols'=>array('numero_registro', 'id_tramite')), | |
| 224 | 228 | 'fks' => array( |
| 225 | - 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite')) | |
| 229 | + 'md_pen_tramite' => array('nome' => 'fk_md_pen_rec_tram_env_tram', | |
| 230 | + 'cols' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))) | |
| 226 | 231 | ) |
| 227 | 232 | )); |
| 228 | 233 | |
| 234 | + | |
| 229 | 235 | $objMetaBD->criarTabela(array( |
| 230 | 236 | 'tabela' => 'md_pen_recibo_tramite_recebido', |
| 231 | 237 | 'cols' => array( |
| ... | ... | @@ -234,12 +240,14 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 234 | 240 | 'dth_recebimento' => array($objMetaBD->tipoDataHora(), PenMetaBD::NNULLO), |
| 235 | 241 | 'hash_assinatura' => array($objMetaBD->tipoTextoVariavel(345), PenMetaBD::NNULLO) |
| 236 | 242 | ), |
| 237 | - 'pk' => array('numero_registro', 'id_tramite', 'hash_assinatura'), | |
| 243 | + 'pk' => array('nome' => 'pk_md_pen_recibo_tramite_receb', 'cols'=>array('numero_registro', 'id_tramite', 'hash_assinatura')), | |
| 238 | 244 | 'fks' => array( |
| 239 | - 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite')) | |
| 245 | + 'md_pen_tramite' => array('nome' => 'fk_md_pen_recibo_receb_tram', | |
| 246 | + 'cols' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))) | |
| 240 | 247 | ) |
| 241 | 248 | )); |
| 242 | 249 | |
| 250 | + | |
| 243 | 251 | $objMetaBD->criarTabela(array( |
| 244 | 252 | 'tabela' => 'md_pen_rel_processo_apensado', |
| 245 | 253 | 'cols' => array( |
| ... | ... | @@ -247,9 +255,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 247 | 255 | 'id_procedimento_apensado' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO), |
| 248 | 256 | 'protocolo' => array($objMetaBD->tipoTextoVariavel(50), PenMetaBD::NNULLO) |
| 249 | 257 | ), |
| 250 | - 'pk' => array('numero_registro', 'id_procedimento_apensado'), | |
| 258 | + 'pk' => array('nome' => 'pk_md_pen_rel_processo_apensad', 'cols'=>array('numero_registro', 'id_procedimento_apensado')), | |
| 251 | 259 | 'fks' => array( |
| 252 | - 'md_pen_processo_eletronico' => array('numero_registro', 'numero_registro') | |
| 260 | + 'md_pen_processo_eletronico' => array('nome' => 'fk_md_pen_proc_eletr_apensado', | |
| 261 | + 'cols' => array('numero_registro', 'numero_registro')) | |
| 253 | 262 | ) |
| 254 | 263 | )); |
| 255 | 264 | |
| ... | ... | @@ -260,10 +269,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 260 | 269 | 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 261 | 270 | 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'N') |
| 262 | 271 | ), |
| 263 | - 'pk' => array('id_serie'), | |
| 272 | + 'pk' => array('cols'=>array('id_serie')), | |
| 264 | 273 | 'uk' => array('codigo_especie', 'id_serie'), |
| 265 | 274 | 'fks' => array( |
| 266 | - 'serie' => array('id_serie', 'id_serie') | |
| 275 | + 'serie' => array('nome' => ' fk_md_pen_rel_serie_especie', 'cols' => array('id_serie', 'id_serie')) | |
| 267 | 276 | ) |
| 268 | 277 | )); |
| 269 | 278 | |
| ... | ... | @@ -273,22 +282,23 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 273 | 282 | 'id_tarefa' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 274 | 283 | 'codigo_operacao' => array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO) |
| 275 | 284 | ), |
| 276 | - 'pk' => array('id_tarefa', 'codigo_operacao'), | |
| 285 | + 'pk' => array('cols'=>array('id_tarefa', 'codigo_operacao')), | |
| 277 | 286 | 'fks' => array( |
| 278 | - 'tarefa' => array('id_tarefa', 'id_tarefa') | |
| 287 | + 'tarefa' => array('nome' => 'fk_md_pen_rel_operacao_tarefa', 'cols' => array('id_tarefa', 'id_tarefa')) | |
| 279 | 288 | ) |
| 280 | 289 | )); |
| 281 | 290 | |
| 291 | + | |
| 282 | 292 | $objMetaBD->criarTabela(array( |
| 283 | - 'tabela' => 'md_pen_rel_tipo_documento_mapeamento_recebido', | |
| 293 | + 'tabela' => 'md_pen_rel_tipo_doc_map_rec', | |
| 284 | 294 | 'cols' => array( |
| 285 | 295 | 'codigo_especie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 286 | 296 | 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 287 | 297 | 'sin_padrao' => array($objMetaBD->tipoTextoFixo(2), PenMetaBD::NNULLO) |
| 288 | 298 | ), |
| 289 | - 'pk' => array('codigo_especie', 'id_serie'), | |
| 299 | + 'pk' => array('cols'=>array('codigo_especie', 'id_serie')), | |
| 290 | 300 | 'fks' => array( |
| 291 | - 'serie' => array('id_serie', 'id_serie') | |
| 301 | + 'serie' => array('nome' =>'fk_md_pen_rel_tipo_doc_serie', 'cols' => array('id_serie', 'id_serie')) | |
| 292 | 302 | ) |
| 293 | 303 | )); |
| 294 | 304 | |
| ... | ... | @@ -311,13 +321,13 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 311 | 321 | 'ordem' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 312 | 322 | 'sin_enviar' => array($objMetaBD->tipoTextoFixo(1), 'N') |
| 313 | 323 | ), |
| 314 | - 'pk' => array('numero_registro', 'id_procedimento', 'id_documento', 'id_tramite'), | |
| 324 | + 'pk' => array('cols'=>array('numero_registro', 'id_procedimento', 'id_documento', 'id_tramite')), | |
| 315 | 325 | 'fks' => array( |
| 316 | - 'anexo' => array('id_anexo', 'id_anexo'), | |
| 317 | - 'documento' => array('id_documento', 'id_documento'), | |
| 318 | - 'procedimento' => array('id_procedimento', 'id_procedimento'), | |
| 319 | - 'md_pen_processo_eletronico' => array('numero_registro', 'numero_registro'), | |
| 320 | - 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite')) | |
| 326 | + 'anexo' => array('nome' => 'fk_md_pen_comp_dig_anexo', 'cols' => array('id_anexo', 'id_anexo')), | |
| 327 | + 'documento' => array('nome' => 'fk_md_pen_comp_dig_documento', 'cols' => array('id_documento', 'id_documento')), | |
| 328 | + 'procedimento' => array('nome' => 'fk_md_pen_comp_dig_procediment', 'cols' => array('id_procedimento', 'id_procedimento')), | |
| 329 | + 'md_pen_processo_eletronico' => array('nome' => 'fk_md_pen_comp_dig_proc_eletr', 'cols' => array('numero_registro', 'numero_registro')), | |
| 330 | + 'md_pen_tramite' => array('nome' => 'fk_md_pen_comp_dig_tramite', 'cols' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))) | |
| 321 | 331 | ) |
| 322 | 332 | )); |
| 323 | 333 | |
| ... | ... | @@ -327,12 +337,13 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 327 | 337 | 'id_unidade' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 328 | 338 | 'id_unidade_rh' => array($objMetaBD->tipoNumeroGrande(), PenMetaBD::NNULLO) |
| 329 | 339 | ), |
| 330 | - 'pk' => array('id_unidade'), | |
| 340 | + 'pk' => array('cols'=>array('id_unidade')), | |
| 331 | 341 | 'fks' => array( |
| 332 | 342 | 'unidade' => array('id_unidade', 'id_unidade') |
| 333 | 343 | ) |
| 334 | 344 | )); |
| 335 | 345 | |
| 346 | + | |
| 336 | 347 | //---------------------------------------------------------------------- |
| 337 | 348 | // Novas sequências |
| 338 | 349 | //---------------------------------------------------------------------- |
| ... | ... | @@ -653,7 +664,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 653 | 664 | |
| 654 | 665 | $fnCadastrar('PENAgendamentoRN::seiVerificarServicosBarramento', 'Verificação dos serviços de fila de processamento estão em execução'); |
| 655 | 666 | |
| 656 | - | |
| 667 | + | |
| 657 | 668 | /* ---------- antigo método (instalarV002R003S000US024) ---------- */ |
| 658 | 669 | |
| 659 | 670 | $objMetaBD->criarTabela(array( |
| ... | ... | @@ -664,14 +675,14 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 664 | 675 | 'numero_tentativas' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 665 | 676 | 'sin_recebimento_concluido' => array($objMetaBD->tipoTextoFixo(1), PenMetaBD::NNULLO) |
| 666 | 677 | ), |
| 667 | - 'pk' => array('id_tramite') | |
| 678 | + 'pk' => array('cols'=>array('id_tramite')), | |
| 668 | 679 | )); |
| 669 | 680 | |
| 670 | 681 | $objInfraParametro = new InfraParametro($objInfraBanco); |
| 671 | 682 | $objInfraParametro->setValor('PEN_NUMERO_TENTATIVAS_TRAMITE_RECEBIMENTO', '3'); |
| 672 | - | |
| 673 | - | |
| 674 | - /* ---------- antigo método (instalarV002R003S000IW001) ---------- */ | |
| 683 | + | |
| 684 | + | |
| 685 | + /* ---------- antigo método (instalarV002R003S000IW001) ---------- */ | |
| 675 | 686 | |
| 676 | 687 | $objDTO = new TarefaDTO(); |
| 677 | 688 | $objBD = new TarefaBD($objInfraBanco); |
| ... | ... | @@ -698,11 +709,11 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 698 | 709 | }; |
| 699 | 710 | |
| 700 | 711 | $fnAlterar('PEN_PROCESSO_RECEBIDO', 'Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@'); |
| 701 | - | |
| 712 | + | |
| 702 | 713 | /* ---------- antigo método (instalarV002R003S001US035) ---------- */ |
| 703 | 714 | $objMetaBanco = $this->inicializarObjMetaBanco(); |
| 704 | 715 | |
| 705 | - if (!$objMetaBanco->isColuna('md_pen_tramite_processado', 'tipo_tramite_processo')) { | |
| 716 | + if (!$objMetaBanco->isColunaExiste('md_pen_tramite_processado', 'tipo_tramite_processo')) { | |
| 706 | 717 | $objMetaBanco->adicionarColuna('md_pen_tramite_processado', 'tipo_tramite_processo', 'CHAR(2)', PenMetaBD::NNULLO); |
| 707 | 718 | $objMetaBanco->adicionarValorPadraoParaColuna('md_pen_tramite_processado', 'tipo_tramite_processo', 'RP'); |
| 708 | 719 | } |
| ... | ... | @@ -712,7 +723,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 712 | 723 | $objMetaBanco->removerChavePrimaria('md_pen_tramite_processado', 'pk_md_pen_tramite_processado'); |
| 713 | 724 | $objMetaBanco->adicionarChavePrimaria('md_pen_tramite_processado', 'pk_md_pen_tramite_processado', array('id_tramite', 'tipo_tramite_processo')); |
| 714 | 725 | } |
| 715 | - | |
| 726 | + | |
| 716 | 727 | /* ---------- antigo método (instalarV003R003S003IW001) ---------- */ |
| 717 | 728 | |
| 718 | 729 | //---------------------------------------------------------------------- |
| ... | ... | @@ -736,11 +747,10 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 736 | 747 | 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 737 | 748 | 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'S') |
| 738 | 749 | ), |
| 739 | - 'pk' => array('id_mapeamento'), | |
| 740 | - //'uk' => array('codigo_especie', 'id_serie'), | |
| 750 | + 'pk' => array('cols'=>array('id_mapeamento')), | |
| 741 | 751 | 'fks' => array( |
| 742 | - 'serie' => array('id_serie', 'id_serie'), | |
| 743 | - 'md_pen_especie_documental' => array('id_especie', 'codigo_especie'), | |
| 752 | + 'serie' => array('nome' => 'fk_md_pen_rel_doc_map_env_seri', 'cols' => array('id_serie', 'id_serie')), | |
| 753 | + 'md_pen_especie_documental' => array('nome' => 'fk_md_pen_rel_doc_map_env_espe', 'cols' => array('id_especie', 'codigo_especie')), | |
| 744 | 754 | ) |
| 745 | 755 | )); |
| 746 | 756 | |
| ... | ... | @@ -752,22 +762,17 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 752 | 762 | 'id_serie' => array($objMetaBD->tipoNumero(), PenMetaBD::NNULLO), |
| 753 | 763 | 'sin_padrao' => array($objMetaBD->tipoTextoFixo(1), 'S') |
| 754 | 764 | ), |
| 755 | - 'pk' => array('id_mapeamento'), | |
| 756 | - //'uk' => array('codigo_especie', 'id_serie'), | |
| 765 | + 'pk' => array('cols'=>array('id_mapeamento')), | |
| 757 | 766 | 'fks' => array( |
| 758 | - 'serie' => array('id_serie', 'id_serie'), | |
| 759 | - 'md_pen_especie_documental' => array('id_especie', 'codigo_especie'), | |
| 767 | + 'serie' => array('nome' => 'fk_md_pen_rel_doc_map_rec_seri', 'cols' => array('id_serie', 'id_serie')), | |
| 768 | + 'md_pen_especie_documental' => array('nome' => 'fk_md_pen_rel_doc_map_rec_espe', 'cols' => array('id_especie', 'codigo_especie')), | |
| 760 | 769 | ) |
| 761 | 770 | )); |
| 762 | 771 | |
| 763 | 772 | $objBD = new GenericoBD($objInfraBanco); |
| 764 | - | |
| 765 | 773 | if ($objMetaBD->isTabelaExiste('md_pen_rel_tipo_documento_mapeamento_recebido')) { |
| 766 | - | |
| 767 | 774 | $objDTO = new PenRelTipoDocMapRecebidoDTO(); |
| 768 | - | |
| 769 | 775 | $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD) { |
| 770 | - | |
| 771 | 776 | $objDTO->unSetTodos(); |
| 772 | 777 | $objDTO->setNumCodigoEspecie($numCodigoEspecie); |
| 773 | 778 | $objDTO->setNumIdSerie($numIdSerie); |
| ... | ... | @@ -782,7 +787,6 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 782 | 787 | $arrDados = $objInfraBanco->consultarSql('SELECT DISTINCT codigo_especie, id_serie FROM md_pen_rel_tipo_documento_mapeamento_recebido'); |
| 783 | 788 | if (!empty($arrDados)) { |
| 784 | 789 | foreach ($arrDados as $arrDocMapRecebido) { |
| 785 | - | |
| 786 | 790 | $fnCadastrar($arrDocMapRecebido['codigo_especie'], $arrDocMapRecebido['id_serie']); |
| 787 | 791 | } |
| 788 | 792 | } |
| ... | ... | @@ -790,11 +794,8 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 790 | 794 | $objMetaBD->removerTabela('md_pen_rel_tipo_documento_mapeamento_recebido'); |
| 791 | 795 | } |
| 792 | 796 | |
| 793 | - | |
| 794 | 797 | if ($objMetaBD->isTabelaExiste('md_pen_rel_serie_especie')) { |
| 795 | - | |
| 796 | 798 | $objDTO = new PenRelTipoDocMapEnviadoDTO(); |
| 797 | - | |
| 798 | 799 | $fnCadastrar = function($numCodigoEspecie, $numIdSerie) use($objDTO, $objBD) { |
| 799 | 800 | |
| 800 | 801 | $objDTO->unSetTodos(); |
| ... | ... | @@ -802,7 +803,6 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 802 | 803 | $objDTO->setNumIdSerie($numIdSerie); |
| 803 | 804 | |
| 804 | 805 | if ($objBD->contar($objDTO) == 0) { |
| 805 | - | |
| 806 | 806 | $objDTO->setStrPadrao('S'); |
| 807 | 807 | $objBD->cadastrar($objDTO); |
| 808 | 808 | } |
| ... | ... | @@ -811,22 +811,26 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 811 | 811 | $arrDados = $objInfraBanco->consultarSql('SELECT DISTINCT codigo_especie, id_serie FROM md_pen_rel_serie_especie'); |
| 812 | 812 | if (!empty($arrDados)) { |
| 813 | 813 | foreach ($arrDados as $arrDocMapEnviado) { |
| 814 | - | |
| 815 | 814 | $fnCadastrar($arrDocMapEnviado['codigo_especie'], $arrDocMapEnviado['id_serie']); |
| 816 | 815 | } |
| 817 | 816 | } |
| 818 | 817 | |
| 819 | 818 | $objMetaBD->removerTabela('md_pen_rel_serie_especie'); |
| 820 | 819 | } |
| 821 | - | |
| 822 | - | |
| 820 | + | |
| 821 | + | |
| 823 | 822 | /* ---------- antigo método (instalarV004R003S003IW002) ---------- */ |
| 824 | 823 | $strTipo = $this->inicializarObjMetaBanco()->tipoTextoGrande(); |
| 824 | + $objMetaBanco->adicionarColuna('md_pen_recibo_tramite', 'cadeia_certificado_temp', $strTipo, PenMetaBD::SNULLO); | |
| 825 | + BancoSEI::getInstance()->executarSql("update md_pen_recibo_tramite set cadeia_certificado_temp = cadeia_certificado"); | |
| 826 | + $objMetaBanco->excluirColuna('md_pen_recibo_tramite', 'cadeia_certificado'); | |
| 827 | + $objMetaBanco->renomearColuna('md_pen_recibo_tramite', 'cadeia_certificado_temp', 'cadeia_certificado', $strTipo); | |
| 828 | + | |
| 829 | + $objMetaBanco->adicionarColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado_temp', $strTipo, PenMetaBD::SNULLO); | |
| 830 | + BancoSEI::getInstance()->executarSql("update md_pen_recibo_tramite_enviado set cadeia_certificado_temp = cadeia_certificado"); | |
| 831 | + $objMetaBanco->excluirColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado'); | |
| 832 | + $objMetaBanco->renomearColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado_temp', 'cadeia_certificado', $strTipo); | |
| 825 | 833 | |
| 826 | - $this->inicializarObjMetaBanco() | |
| 827 | - ->alterarColuna('md_pen_recibo_tramite', 'cadeia_certificado', $strTipo) | |
| 828 | - ->alterarColuna('md_pen_recibo_tramite_enviado', 'cadeia_certificado', $strTipo); | |
| 829 | - | |
| 830 | 834 | /* ---------- antigo método (instalarV005R003S005IW018) ---------- */ |
| 831 | 835 | $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
| 832 | 836 | $objDTO = new TarefaDTO(); |
| ... | ... | @@ -857,7 +861,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 857 | 861 | }; |
| 858 | 862 | |
| 859 | 863 | $fnCadastrar('O trâmite externo do processo foi abortado manualmente devido a falha no trâmite', 'S', 'S', 'N', 'N', 'S', 'PEN_EXPEDICAO_PROCESSO_ABORTADA'); |
| 860 | - | |
| 864 | + | |
| 861 | 865 | /* ---------- antigo método (instalarV005R003S005IW023) ---------- */ |
| 862 | 866 | $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
| 863 | 867 | |
| ... | ... | @@ -883,11 +887,11 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 883 | 887 | $fnAtualizar('PEN_PROCESSO_EXPEDIDO', 'Processo em tramitação externa para @UNIDADE_DESTINO@ - @UNIDADE_DESTINO_HIRARQUIA@ - @REPOSITORIO_DESTINO@'); |
| 884 | 888 | $fnAtualizar('PEN_PROCESSO_RECEBIDO', 'Processo recebido da unidade externa @ENTIDADE_ORIGEM@ - @ENTIDADE_ORIGEM_HIRARQUIA@ - @REPOSITORIO_ORIGEM@'); |
| 885 | 889 | $fnAtualizar('PEN_OPERACAO_EXTERNA', 'Tramitação externa do processo @PROTOCOLO_FORMATADO@ concluída com sucesso. Recebido em @UNIDADE_DESTINO@ - @UNIDADE_DESTINO_HIRARQUIA@ - @REPOSITORIO_DESTINO@'); |
| 886 | - | |
| 890 | + | |
| 887 | 891 | /* ---------- antigo método (instalarV006R004S004WI001) ---------- */ |
| 888 | 892 | $objInfraParametro = new InfraParametro($this->getObjInfraIBanco()); |
| 889 | 893 | $objInfraParametro->setValor('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO', 50); |
| 890 | - | |
| 894 | + | |
| 891 | 895 | /* ---------- antigo método (instalarV007R004S005WI002) ---------- */ |
| 892 | 896 | |
| 893 | 897 | $objMetaBD->criarTabela(array( |
| ... | ... | @@ -899,31 +903,29 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 899 | 903 | 'tipo_recibo' => array($objMetaBD->tipoTextoFixo(1), PenMetaBD::NNULLO), |
| 900 | 904 | 'hash_componente_digital ' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO) |
| 901 | 905 | ), |
| 902 | - 'pk' => array('id_tramite_hash'), | |
| 906 | + 'pk' => array('cols'=>array('id_tramite_hash')), | |
| 903 | 907 | 'fks' => array( |
| 904 | - 'md_pen_tramite' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite')) | |
| 908 | + 'md_pen_tramite' => array('nome' => 'fk_md_pen_rec_tram_hash_tram', 'cols' => array(array('numero_registro', 'id_tramite'), array('numero_registro', 'id_tramite'))) | |
| 905 | 909 | ) |
| 906 | 910 | )); |
| 907 | 911 | |
| 908 | 912 | $objMetaBD->adicionarColuna('md_pen_recibo_tramite_recebido', 'cadeia_certificado', $this->inicializarObjMetaBanco()->tipoTextoGrande(), PenMetaBD::SNULLO); |
| 909 | 913 | |
| 910 | 914 | $objInfraSequencia = new InfraSequencia($this->getObjInfraIBanco()); |
| 911 | - | |
| 912 | 915 | if (!$objInfraSequencia->verificarSequencia('md_pen_recibo_tramite_hash')) { |
| 913 | - | |
| 914 | 916 | $objInfraSequencia->criarSequencia('md_pen_recibo_tramite_hash', '1', '1', '9999999999'); |
| 915 | 917 | } |
| 916 | - | |
| 918 | + | |
| 917 | 919 | $objInfraParametroDTO = new InfraParametroDTO(); |
| 918 | 920 | $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO_ANTIGO); |
| 919 | 921 | $objInfraParametroDTO->setStrValor('1.0.0'); |
| 920 | - | |
| 922 | + | |
| 921 | 923 | $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); |
| 922 | 924 | $objInfraParametroBD->cadastrar($objInfraParametroDTO); |
| 923 | - | |
| 925 | + | |
| 924 | 926 | $this->logar(' EXECUTADA A INSTALACAO DA VERSAO 0.0.1 DO MODULO PEN NO SEI COM SUCESSO'); |
| 925 | 927 | } |
| 926 | - | |
| 928 | + | |
| 927 | 929 | /* Contem atualizações da versao 1.0.1 do modulo */ |
| 928 | 930 | protected function instalarV101() { |
| 929 | 931 | /* ---------- antigo método (instalarV008R004S006IW003) ---------- */ |
| ... | ... | @@ -939,7 +941,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 939 | 941 | $objTarefaDTO->setStrSinPermiteProcessoFechado('S'); |
| 940 | 942 | |
| 941 | 943 | $objBD->alterar($objTarefaDTO); |
| 942 | - | |
| 944 | + | |
| 943 | 945 | /* ---------- antigo método (instalarV006R004S001US039) ---------- */ |
| 944 | 946 | $objMetaBD = $this->inicializarObjMetaBanco(); |
| 945 | 947 | $objInfraBanco = $this->inicializarObjInfraIBanco(); |
| ... | ... | @@ -951,9 +953,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 951 | 953 | 'nome' => array($objMetaBD->tipoTextoVariavel(255), PenMetaBD::NNULLO), |
| 952 | 954 | 'sin_ativo' => array($objMetaBD->tipoTextoFixo(1), 'S'), |
| 953 | 955 | ), |
| 954 | - 'pk' => array('id_hipotese_legal') | |
| 956 | + 'pk' => array('cols'=>array('id_hipotese_legal')), | |
| 955 | 957 | )); |
| 956 | - | |
| 958 | + | |
| 957 | 959 | $objMetaBD->criarTabela(array( |
| 958 | 960 | 'tabela' => 'md_pen_rel_hipotese_legal', |
| 959 | 961 | 'cols' => array( |
| ... | ... | @@ -963,30 +965,30 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 963 | 965 | 'tipo' => array($objMetaBD->tipoTextoFixo(1), 'E'), |
| 964 | 966 | 'sin_ativo' => array($objMetaBD->tipoTextoFixo(1), 'S'), |
| 965 | 967 | ), |
| 966 | - 'pk' => array('id_mapeamento'), | |
| 968 | + 'pk' => array('cols'=>array('id_mapeamento')), | |
| 967 | 969 | 'fks' => array( |
| 968 | - 'hipotese_legal' => array('id_hipotese_legal', 'id_hipotese_legal'), | |
| 969 | - 'md_pen_hipotese_legal' => array('id_hipotese_legal', 'id_hipotese_legal_pen') | |
| 970 | + 'hipotese_legal' => array('nome' => 'fk_md_pen_rel_hipotese_legal', 'cols' => array('id_hipotese_legal', 'id_hipotese_legal')), | |
| 971 | + 'md_pen_hipotese_legal' => array('nome' => 'fk_md_pen_rel_hipotese_pen', 'cols' => array('id_hipotese_legal', 'id_hipotese_legal_pen')) | |
| 970 | 972 | ) |
| 971 | 973 | )); |
| 972 | - | |
| 974 | + | |
| 973 | 975 | $objInfraSequencia = new InfraSequencia($objInfraBanco); |
| 974 | - | |
| 975 | - if(!$objInfraSequencia->verificarSequencia('md_pen_hipotese_legal')){ | |
| 976 | + | |
| 977 | + if(!$objInfraSequencia->verificarSequencia('md_pen_hipotese_legal')){ | |
| 976 | 978 | $objInfraSequencia->criarSequencia('md_pen_hipotese_legal', '1', '1', '9999999999'); |
| 977 | 979 | } |
| 978 | 980 | |
| 979 | - if(!$objInfraSequencia->verificarSequencia('md_pen_rel_hipotese_legal')){ | |
| 981 | + if(!$objInfraSequencia->verificarSequencia('md_pen_rel_hipotese_legal')){ | |
| 980 | 982 | $objInfraSequencia->criarSequencia('md_pen_rel_hipotese_legal', '1', '1', '9999999999'); |
| 981 | 983 | } |
| 982 | - | |
| 984 | + | |
| 983 | 985 | $objHipoteseLegalDTO = new HipoteseLegalDTO(); |
| 984 | 986 | $objHipoteseLegalDTO->setDistinct(true); |
| 985 | 987 | $objHipoteseLegalDTO->setStrStaNivelAcesso(1); |
| 986 | 988 | $objHipoteseLegalDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC); |
| 987 | 989 | $objHipoteseLegalDTO->retNumIdHipoteseLegal(); |
| 988 | 990 | $objHipoteseLegalDTO->retStrNome(); |
| 989 | - | |
| 991 | + | |
| 990 | 992 | $objMetaBD = $this->inicializarObjMetaBanco(); |
| 991 | 993 | |
| 992 | 994 | $objMetaBD->criarTabela(array( |
| ... | ... | @@ -995,9 +997,9 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 995 | 997 | 'nome'=> array($objMetaBD->tipoTextoVariavel(100), PenMetaBD::NNULLO), |
| 996 | 998 | 'valor' => array($objMetaBD->tipoTextoGrande(), PenMetaBD::NNULLO) |
| 997 | 999 | ), |
| 998 | - 'pk' => array('nome') | |
| 1000 | + 'pk' => array('cols'=>array('nome')), | |
| 999 | 1001 | )); |
| 1000 | - | |
| 1002 | + | |
| 1001 | 1003 | //Agendamento |
| 1002 | 1004 | $objDTO = new InfraAgendamentoTarefaDTO(); |
| 1003 | 1005 | |
| ... | ... | @@ -1019,29 +1021,25 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 1019 | 1021 | }; |
| 1020 | 1022 | |
| 1021 | 1023 | $fnCadastrar('PENAgendamentoRN::atualizarHipotesesLegais', 'Verificação se há novas hipóteses legais do barramento.'); |
| 1022 | - | |
| 1024 | + | |
| 1023 | 1025 | /* altera o parâmetro da versão de banco */ |
| 1026 | + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1024 | 1027 | $objInfraParametroDTO = new InfraParametroDTO(); |
| 1025 | 1028 | $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO_ANTIGO); |
| 1026 | - $objInfraParametroDTO->setStrValor('1.0.0'); | |
| 1027 | - $objInfraParametroDTO->retTodos(); | |
| 1028 | - | |
| 1029 | - $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1030 | - $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); | |
| 1031 | 1029 | $objInfraParametroDTO->setStrValor('1.0.1'); |
| 1032 | 1030 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
| 1033 | 1031 | } |
| 1034 | - | |
| 1032 | + | |
| 1035 | 1033 | /* Contem atualizações da versao 1.1.0 do modulo */ |
| 1036 | 1034 | protected function instalarV110() { |
| 1037 | 1035 | $objMetaBD = $this->objMeta; |
| 1038 | - | |
| 1036 | + | |
| 1039 | 1037 | //Adiciona a coluna de indentificação nas hipóteses que vem do barramento |
| 1040 | 1038 | $objMetaBD->adicionarColuna('md_pen_hipotese_legal', 'identificacao', $this->inicializarObjMetaBanco()->tipoNumero(), PenMetaBD::SNULLO); |
| 1041 | - | |
| 1039 | + | |
| 1042 | 1040 | //Adiciona a coluna de descricao nos parâmetros |
| 1043 | 1041 | $objMetaBD->adicionarColuna('md_pen_parametro', 'descricao', $this->inicializarObjMetaBanco()->tipoTextoVariavel(255), PenMetaBD::SNULLO); |
| 1044 | - | |
| 1042 | + | |
| 1045 | 1043 | //Cria os parâmetros do módulo PEN barramento (md_pen_parametro [ nome, valor ]) |
| 1046 | 1044 | $this->criarParametro('PEN_ENDERECO_WEBSERVICE', 'https://pen-api.trafficmanager.net/interoperabilidade/soap/v2/', 'Endereço do Web Service'); |
| 1047 | 1045 | $this->criarParametro('PEN_ENDERECO_WEBSERVICE_PENDENCIAS', 'https://pen-pendencias.trafficmanager.net/', 'Endereço do Web Service de Pendências'); |
| ... | ... | @@ -1053,7 +1051,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 1053 | 1051 | $this->criarParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO', '50', 'Tamanho Máximo de Documento Expedido'); |
| 1054 | 1052 | $this->criarParametro('PEN_TIPO_PROCESSO_EXTERNO', '100000320', 'Tipo de Processo Externo'); |
| 1055 | 1053 | $this->criarParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO', '110000001', 'Unidade Geradora de Processo e Documento Recebido'); |
| 1056 | - | |
| 1054 | + | |
| 1057 | 1055 | //Deleta os parâmetros do infra_parametros |
| 1058 | 1056 | $this->deletaParametroInfra('PEN_ENDERECO_WEBSERVICE'); |
| 1059 | 1057 | $this->deletaParametroInfra('PEN_ENDERECO_WEBSERVICE_PENDENCIAS'); |
| ... | ... | @@ -1065,7 +1063,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 1065 | 1063 | $this->deletaParametroInfra('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO'); |
| 1066 | 1064 | $this->deletaParametroInfra('PEN_TIPO_PROCESSO_EXTERNO', '100000320'); |
| 1067 | 1065 | $this->deletaParametroInfra('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO'); |
| 1068 | - | |
| 1066 | + | |
| 1069 | 1067 | //Alterar nomeclatura do recurso |
| 1070 | 1068 | $objDTO = new PenParametroDTO(); |
| 1071 | 1069 | $objDTO->setStrNome('HIPOTESE_LEGAL_PADRAO'); |
| ... | ... | @@ -1082,32 +1080,71 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
| 1082 | 1080 | $objDTO->setStrDescricao('Hipótese Legal Padrão'); |
| 1083 | 1081 | $objBD->cadastrar($objDTO); |
| 1084 | 1082 | } |
| 1085 | - | |
| 1083 | + | |
| 1086 | 1084 | /* altera o parâmetro da versão de banco */ |
| 1085 | + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1087 | 1086 | $objInfraParametroDTO = new InfraParametroDTO(); |
| 1088 | 1087 | $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO_ANTIGO); |
| 1089 | - $objInfraParametroDTO->setStrValor('1.0.1'); | |
| 1090 | - $objInfraParametroDTO->retTodos(); | |
| 1091 | - $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1092 | - $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); | |
| 1093 | 1088 | $objInfraParametroDTO->setStrValor('1.1.0'); |
| 1094 | 1089 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
| 1090 | + | |
| 1095 | 1091 | } |
| 1096 | 1092 | |
| 1097 | - /* Contem atualizações da versao 1.1.1 do módulo */ | |
| 1093 | + /* Contem atualizações da versao 1.1.1 do módulo */ | |
| 1098 | 1094 | protected function instalarV111() { |
| 1099 | 1095 | |
| 1100 | 1096 | //Ajuste em nome da variável de versão do módulo VERSAO_MODULO_PEN |
| 1101 | 1097 | BancoSEI::getInstance()->executarSql("update infra_parametro set nome = '" . self::PARAMETRO_VERSAO_MODULO . "' where nome = '" . self::PARAMETRO_VERSAO_MODULO_ANTIGO . "'"); |
| 1102 | 1098 | |
| 1103 | 1099 | /* altera o parâmetro da versão de banco */ |
| 1100 | + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1104 | 1101 | $objInfraParametroDTO = new InfraParametroDTO(); |
| 1105 | 1102 | $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO); |
| 1106 | - $objInfraParametroDTO->retTodos(); | |
| 1107 | - $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1108 | - $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO); | |
| 1109 | 1103 | $objInfraParametroDTO->setStrValor('1.1.1'); |
| 1110 | 1104 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
| 1111 | 1105 | } |
| 1112 | 1106 | |
| 1107 | + /* Contem atualizações da versao 1.1.7 do módulo */ | |
| 1108 | + protected function instalarV117() { | |
| 1109 | + | |
| 1110 | + /* Cadastramento de novas espécies documentais */ | |
| 1111 | + $objEspecieDocumentalBD = new GenericoBD($this->inicializarObjInfraIBanco()); | |
| 1112 | + $objEspecieDocumentalDTO = new EspecieDocumentalDTO(); | |
| 1113 | + | |
| 1114 | + $fnCadastrar = function($dblIdEspecie, $strNomeEspecie, $strDescricao) use($objEspecieDocumentalDTO, $objEspecieDocumentalBD) { | |
| 1115 | + $objEspecieDocumentalDTO->unSetTodos(); | |
| 1116 | + $objEspecieDocumentalDTO->setDblIdEspecie($dblIdEspecie); | |
| 1117 | + if ($objEspecieDocumentalBD->contar($objEspecieDocumentalDTO) == 0) { | |
| 1118 | + $objEspecieDocumentalDTO->setStrNomeEspecie($strNomeEspecie); | |
| 1119 | + $objEspecieDocumentalDTO->setStrDescricao($strDescricao); | |
| 1120 | + $objEspecieDocumentalBD->cadastrar($objEspecieDocumentalDTO); | |
| 1121 | + } | |
| 1122 | + }; | |
| 1123 | + | |
| 1124 | + $fnCadastrar(178, 'Alegações', 'Muito comum no Judiciário, tendo previsão no CPC. Podendo ser complementado "Finais", o que representaria o documento "Alegações Finais".'); | |
| 1125 | + $fnCadastrar(179, 'Anexo', 'Documento ou processo juntado em caráter definitivo a outro processo, para dar continuidade a uma ação administrativa.'); | |
| 1126 | + $fnCadastrar(180, 'Documento', 'Informação registrada, qualquer que seja o suporte ou formato, que não está reunida e ordenada em processo.'); | |
| 1127 | + $fnCadastrar(181, 'Apartado', 'Apartado por si só, autos apartados ou partado sigiloso.'); | |
| 1128 | + $fnCadastrar(182, 'Apresentação', 'Documentos que são apresentações propriamente ditas.'); | |
| 1129 | + $fnCadastrar(183, 'Diagnóstico', 'Diagnóstico médico, auditoria, etc.'); | |
| 1130 | + $fnCadastrar(184, 'Exame', 'Exame laboratorial, médico, etc.'); | |
| 1131 | + $fnCadastrar(185, 'Página', 'Página do Diário Oficial da União.'); | |
| 1132 | + $fnCadastrar(186, 'Estudo', 'Podendo ser complementado com "Técnico Preliminar da Contratação"; "Técnico".'); | |
| 1133 | + $fnCadastrar(999, 'Outra', 'Outras espécies documentais não identificadas.'); | |
| 1134 | + | |
| 1135 | + // if($this->isTabelaExiste('md_pen_rel_tipo_documento_mapeamento_recebido')) { | |
| 1136 | + // if (BancoSEI::getInstance() instanceof InfraSqlServer) { | |
| 1137 | + // BancoSEI::getInstance()->executarSql("sp_rename 'md_pen_rel_tipo_documento_mapeamento_recebido', 'md_pen_rel_tipo_doc_map_rec'"); | |
| 1138 | + // } else { | |
| 1139 | + // BancoSEI::getInstance()->executarSql("ALTER TABLE 'md_pen_rel_tipo_documento_mapeamento_recebido' RENAME TO 'md_pen_rel_tipo_doc_map_rec'"); | |
| 1140 | + // } | |
| 1141 | + // } | |
| 1142 | + | |
| 1143 | + //altera o parâmetro da versão de banco | |
| 1144 | + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
| 1145 | + $objInfraParametroDTO = new InfraParametroDTO(); | |
| 1146 | + $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO); | |
| 1147 | + $objInfraParametroDTO->setStrValor('1.1.7'); | |
| 1148 | + $objInfraParametroBD->alterar($objInfraParametroDTO); | |
| 1149 | + } | |
| 1113 | 1150 | } | ... | ... |
rn/PenTramiteProcessadoRN.php
| ... | ... | @@ -4,12 +4,12 @@ |
| 4 | 4 | * @author Join Tecnologia |
| 5 | 5 | */ |
| 6 | 6 | class PenTramiteProcessadoRN extends InfraRN { |
| 7 | - | |
| 7 | + | |
| 8 | 8 | const STR_TIPO_PROCESSO = 'RP'; |
| 9 | 9 | const STR_TIPO_RECIBO = 'RR'; |
| 10 | - | |
| 10 | + | |
| 11 | 11 | const PARAM_NUMERO_TENTATIVAS = 'PEN_NUMERO_TENTATIVAS_TRAMITE_RECEBIMENTO'; |
| 12 | - | |
| 12 | + | |
| 13 | 13 | protected $objInfraBanco; |
| 14 | 14 | private $strTipo; |
| 15 | 15 | |
| ... | ... | @@ -17,64 +17,63 @@ class PenTramiteProcessadoRN extends InfraRN { |
| 17 | 17 | parent::__construct(); |
| 18 | 18 | $this->strTipo = $strTipo; |
| 19 | 19 | } |
| 20 | - | |
| 20 | + | |
| 21 | 21 | /** |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * @return BancoSEI |
| 24 | 24 | */ |
| 25 | 25 | protected function inicializarObjInfraIBanco() { |
| 26 | - | |
| 26 | + | |
| 27 | 27 | if(empty($this->objInfraBanco)) { |
| 28 | - | |
| 28 | + | |
| 29 | 29 | $this->objInfraBanco = BancoSEI::getInstance(); |
| 30 | 30 | } |
| 31 | - | |
| 31 | + | |
| 32 | 32 | return $this->objInfraBanco; |
| 33 | 33 | } |
| 34 | - | |
| 34 | + | |
| 35 | 35 | /** |
| 36 | - * | |
| 36 | + * | |
| 37 | 37 | * @return bool |
| 38 | 38 | */ |
| 39 | 39 | protected function isProcedimentoRecebidoControlado($dblIdTramite = 0){ |
| 40 | - | |
| 40 | + | |
| 41 | 41 | //Verifica se o trâmite não foi cancelado ou recusado |
| 42 | 42 | if($this->isTramiteRecusadoCancelado($dblIdTramite)){ |
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | - | |
| 45 | + | |
| 46 | 46 | $objFilDTO = new PenTramiteProcessadoDTO(); |
| 47 | 47 | $objFilDTO->setDblIdTramite($dblIdTramite); |
| 48 | 48 | $objFilDTO->setStrTipo($this->strTipo); |
| 49 | 49 | $objFilDTO->setNumMaxRegistrosRetorno(1); |
| 50 | 50 | $objFilDTO->retTodos(); |
| 51 | - | |
| 52 | - $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); | |
| 51 | + | |
| 52 | + $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); | |
| 53 | 53 | $objDTO = $objBD->consultar($objFilDTO); |
| 54 | 54 | |
| 55 | 55 | if(empty($objDTO)) { |
| 56 | - | |
| 57 | 56 | $objFilDTO->setDthUltimo(InfraData::getStrDataHoraAtual()); |
| 58 | 57 | $objFilDTO->setNumTentativas(0); |
| 59 | 58 | $objFilDTO->setStrRecebido('N'); |
| 60 | 59 | $objFilDTO->setStrTipo($this->strTipo); |
| 61 | - | |
| 62 | 60 | $objDTO = $objBD->cadastrar($objFilDTO); |
| 61 | + return false; | |
| 63 | 62 | } |
| 64 | - | |
| 65 | - if($objDTO->getStrRecebido() == 'S') { | |
| 66 | 63 | |
| 64 | + | |
| 65 | + | |
| 66 | + if($objDTO->getStrRecebido() == 'S') { | |
| 67 | 67 | return true; |
| 68 | + | |
| 68 | 69 | } |
| 69 | 70 | else { |
| 70 | - | |
| 71 | 71 | $objPenParametroRN = new PenParametroRN(); |
| 72 | 72 | $numTentativas = $objPenParametroRN->getParametro(self::PARAM_NUMERO_TENTATIVAS); |
| 73 | - | |
| 73 | + | |
| 74 | 74 | // Verifica o número de tentativas já realizadas é igual ao configurado |
| 75 | 75 | // no parâmetro |
| 76 | 76 | if($objDTO->getNumTentativas() >= $numTentativas) { |
| 77 | - | |
| 78 | 77 | // Somente faz a recusa se estiver recebendo o procedimento, pois |
| 79 | 78 | // ao receber o recibo não pode mais recursar |
| 80 | 79 | if($objDTO->getStrTipo() == self::STR_TIPO_PROCESSO) { |
| ... | ... | @@ -85,59 +84,55 @@ class PenTramiteProcessadoRN extends InfraRN { |
| 85 | 84 | return true;// Mente que já foi recebido para não executar novamente |
| 86 | 85 | } |
| 87 | 86 | else { |
| 88 | - | |
| 89 | 87 | // Incrementa o contador pois após sair desse método com false |
| 90 | 88 | // ira executar o recebimento novamente |
| 91 | 89 | $objDTO->setDthUltimo(InfraData::getStrDataHoraAtual()); |
| 92 | 90 | $objDTO->setNumTentativas($objDTO->getNumTentativas() + 1); |
| 91 | + $objDTO->setStrTipo($this->strTipo); | |
| 93 | 92 | $objBD->alterar($objDTO); |
| 94 | 93 | return false; |
| 95 | - } | |
| 94 | + } | |
| 96 | 95 | } |
| 97 | 96 | } |
| 98 | - | |
| 97 | + | |
| 99 | 98 | public function setRecebido($dblIdTramite = 0){ |
| 100 | - | |
| 99 | + | |
| 101 | 100 | $objDTO = new PenTramiteProcessadoDTO(); |
| 102 | 101 | $objDTO->setDblIdTramite($dblIdTramite); |
| 103 | 102 | $objDTO->setStrTipo($this->strTipo); |
| 104 | 103 | $objDTO->setNumMaxRegistrosRetorno(1); |
| 105 | 104 | $objDTO->retTodos(); |
| 106 | - | |
| 107 | 105 | $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
| 108 | 106 | $objDTO = $objBD->consultar($objDTO); |
| 109 | - | |
| 110 | 107 | if(empty($objDTO)) { |
| 111 | 108 | throw new InfraException(sprintf('ID do tramite %s não foi localizado', $dblIdTramite)); |
| 112 | 109 | } |
| 113 | - | |
| 114 | 110 | $objDTO->setDthUltimo(InfraData::getStrDataHoraAtual()); |
| 115 | 111 | $objDTO->setStrRecebido('S'); |
| 116 | - | |
| 117 | - $objBD->alterar($objDTO); | |
| 112 | + $objBD->alterar($objDTO); | |
| 118 | 113 | } |
| 119 | - | |
| 114 | + | |
| 120 | 115 | /** |
| 121 | 116 | * Método que verifica se o trâmite em questão foi cancelado ou recusado |
| 122 | - * | |
| 117 | + * | |
| 123 | 118 | * @param integer $parNumIdTramite |
| 124 | 119 | * @return boolean |
| 125 | 120 | */ |
| 126 | 121 | public function isTramiteRecusadoCancelado($parNumIdTramite){ |
| 127 | - | |
| 122 | + | |
| 128 | 123 | //Instancia a classe processo eletrônico |
| 129 | 124 | $processoEletronicoRN = new ProcessoEletronicoRN(); |
| 130 | - | |
| 125 | + | |
| 131 | 126 | //Busca os dados do trâmite |
| 132 | 127 | $arrObjTramite = $processoEletronicoRN->consultarTramites($parNumIdTramite); |
| 133 | 128 | $objTramite = $arrObjTramite[0]; |
| 134 | - | |
| 129 | + | |
| 135 | 130 | //Verifica se o trâmite em questão. foi recusado o cancelado |
| 136 | 131 | if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO || $objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO){ |
| 137 | 132 | return true; |
| 138 | 133 | }else{ |
| 139 | 134 | return false; |
| 140 | 135 | } |
| 141 | - | |
| 136 | + | |
| 142 | 137 | } |
| 143 | 138 | } | ... | ... |
rn/ProcessarPendenciasRN.php
| ... | ... | @@ -86,8 +86,10 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 86 | 86 | $objReceberReciboTramiteRN = new ReceberReciboTramiteRN(); |
| 87 | 87 | $objReceberReciboTramiteRN->receberReciboDeTramite($numIdentificacaoTramite); |
| 88 | 88 | } |
| 89 | + | |
| 89 | 90 | } |
| 90 | 91 | catch(Exception $e){ |
| 92 | + $this->gravarLogDebug(InfraException::inspecionar($e), 0, true); | |
| 91 | 93 | LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); |
| 92 | 94 | } |
| 93 | 95 | }); |
| ... | ... | @@ -105,6 +107,7 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 105 | 107 | } |
| 106 | 108 | } |
| 107 | 109 | catch(Exception $e){ |
| 110 | + $this->gravarLogDebug(InfraException::inspecionar($e), 0, true); | |
| 108 | 111 | LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); |
| 109 | 112 | $objProcessoEletronicoRN = new ProcessoEletronicoRN(); |
| 110 | 113 | $strMensagem = ($e instanceof InfraException) ? $e->__toString() : $e->getMessage(); |
| ... | ... | @@ -120,9 +123,9 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 120 | 123 | $objReceberProcedimentoRN = new ReceberProcedimentoRN(); |
| 121 | 124 | $objReceberProcedimentoRN->receberTramitesRecusados($numIdentificacaoTramite); |
| 122 | 125 | } catch (Exception $e) { |
| 126 | + $this->gravarLogDebug(InfraException::inspecionar($e), 0, true); | |
| 123 | 127 | LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); |
| 124 | 128 | } |
| 125 | - | |
| 126 | 129 | }); |
| 127 | 130 | |
| 128 | 131 | //Processamento de pendências de recebimento dos componentes digitais do processo |
| ... | ... | @@ -139,6 +142,7 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 139 | 142 | $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); |
| 140 | 143 | $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($numIdentificacaoTramite); |
| 141 | 144 | } catch (Exception $e) { |
| 145 | + $this->gravarLogDebug(InfraException::inspecionar($e), 0, true); | |
| 142 | 146 | LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); |
| 143 | 147 | } |
| 144 | 148 | }); |
| ... | ... | @@ -147,7 +151,7 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa |
| 147 | 151 | private function gravarLogDebug($strMensagem, $numIdentacao=0, $bolEcho=false) |
| 148 | 152 | { |
| 149 | 153 | $strDataLog = date("d/m/Y H:i:s"); |
| 150 | - $strLog = sprintf("[%s] [PROCESSAMENTO] %s %s", $strDataLog, str_repeat("\t", $numIdentacao), $strMensagem); | |
| 154 | + $strLog = sprintf("[%s] [PROCESSAMENTO] %s %s", $strDataLog, str_repeat(" ", $numIdentacao * 4), $strMensagem); | |
| 151 | 155 | InfraDebug::getInstance()->gravar($strLog); |
| 152 | 156 | if(!InfraDebug::getInstance()->isBolEcho() && $bolEcho) echo sprintf("\n[%s] [PROCESSAMENTO] %s", $strDataLog, $strMensagem); |
| 153 | 157 | } | ... | ... |
rn/ProcessoEletronicoRN.php
| ... | ... | @@ -163,13 +163,10 @@ class ProcessoEletronicoRN extends InfraRN { |
| 163 | 163 | try { |
| 164 | 164 | |
| 165 | 165 | $objConfig = ConfiguracaoSEI::getInstance(); |
| 166 | - | |
| 167 | 166 | if($objConfig->isSetValor('SEI', 'LogPenWs')){ |
| 168 | - | |
| 169 | 167 | $this->objPenWs = new LogPenWs($objConfig->getValor('SEI', 'LogPenWs'), $this->strWSDL, $this->options); |
| 170 | 168 | } |
| 171 | 169 | else { |
| 172 | - | |
| 173 | 170 | $this->objPenWs = new BeSimple\SoapClient\SoapClient($this->strWSDL, $this->options); |
| 174 | 171 | } |
| 175 | 172 | } catch (Exception $e) { |
| ... | ... | @@ -821,8 +818,8 @@ class ProcessoEletronicoRN extends InfraRN { |
| 821 | 818 | |
| 822 | 819 | //TODO: Avaliar dados do tamanho do documento em bytes salvo na base de dados |
| 823 | 820 | $objComponenteDigitalDTO->setNumTamanho($objComponenteDigital->tamanhoEmBytes); |
| 824 | - $objComponenteDigitalDTO->setNumIdAnexo($objComponenteDigital->idAnexo); | |
| 825 | 821 | |
| 822 | + $objComponenteDigitalDTO->setNumIdAnexo($objComponenteDigital->idAnexo); | |
| 826 | 823 | $arrObjComponenteDigitalDTO[] = $objComponenteDigitalDTO; |
| 827 | 824 | } |
| 828 | 825 | ... | ... |
rn/ProcessoExpedidoRN.php
| ... | ... | @@ -15,9 +15,11 @@ class ProcessoExpedidoRN extends InfraRN { |
| 15 | 15 | public function listarProcessoExpedido(ProtocoloDTO &$objProtocoloDTO) { |
| 16 | 16 | |
| 17 | 17 | $bolSqlServer = $this->getObjInfraIBanco() instanceof InfraSqlServer; |
| 18 | + $bolOracle = $this->getObjInfraIBanco() instanceof InfraOracle; | |
| 18 | 19 | $numLimit = $objProtocoloDTO->getNumMaxRegistrosRetorno(); |
| 19 | 20 | $numOffset = $objProtocoloDTO->getNumPaginaAtual() * $objProtocoloDTO->getNumMaxRegistrosRetorno(); |
| 20 | 21 | $strInstrucaoPaginacao = (!$bolSqlServer) ? "LIMIT ".$numOffset.",".$numLimit : "OFFSET $numOffset ROWS FETCH NEXT $numLimit ROWS ONLY"; |
| 22 | + $strInstrucaoPaginacao = ($bolOracle) ? "" : $strInstrucaoPaginacao; | |
| 21 | 23 | |
| 22 | 24 | $sql = "SELECT |
| 23 | 25 | p.id_protocolo, |
| ... | ... | @@ -41,14 +43,20 @@ class ProcessoExpedidoRN extends InfraRN { |
| 41 | 43 | ptra.dth_registro = (SELECT MAX(pt.dth_registro) dth_registro FROM md_pen_tramite pt WHERE pt.numero_registro = pe.numero_registro) |
| 42 | 44 | AND |
| 43 | 45 | NOT EXISTS ( |
| 44 | - SELECT at2.* FROM atividade as at2 | |
| 46 | + SELECT at2.* FROM atividade at2 | |
| 45 | 47 | WHERE at2.id_protocolo = p.id_protocolo |
| 46 | 48 | AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." |
| 47 | 49 | AND at2.dth_abertura > a.dth_abertura ) |
| 48 | 50 | GROUP BY |
| 49 | 51 | p.id_protocolo, p.protocolo_formatado, a.id_unidade , atd.valor , us.id_usuario, us.nome, a.dth_abertura ORDER BY a.dth_abertura DESC ".$strInstrucaoPaginacao; |
| 50 | 52 | |
| 51 | - $sqlCount = "SELECT | |
| 53 | + | |
| 54 | + if ($this->getObjInfraIBanco() instanceof InfraOracle){ | |
| 55 | + $qtd = $numLimit + $numLimit; | |
| 56 | + $sql = "select a.* from ($sql) a where rownum >= $numOffset and rownum <= $qtd"; | |
| 57 | + } | |
| 58 | + | |
| 59 | + $sqlCount = "SELECT | |
| 52 | 60 | count(*) total |
| 53 | 61 | FROM protocolo p |
| 54 | 62 | INNER JOIN atividade a ON a.id_protocolo = p.id_protocolo |
| ... | ... | @@ -64,13 +72,12 @@ class ProcessoExpedidoRN extends InfraRN { |
| 64 | 72 | ptra.dth_registro = (SELECT MAX(pt.dth_registro) dth_registro FROM md_pen_tramite pt WHERE pt.numero_registro = pe.numero_registro) |
| 65 | 73 | AND |
| 66 | 74 | NOT EXISTS ( |
| 67 | - SELECT at2.* FROM atividade as at2 | |
| 75 | + SELECT at2.* FROM atividade at2 | |
| 68 | 76 | WHERE at2.id_protocolo = p.id_protocolo |
| 69 | 77 | AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." |
| 70 | 78 | AND at2.dth_abertura > a.dth_abertura ) "; |
| 71 | 79 | |
| 72 | - | |
| 73 | - | |
| 80 | + //die($sql); | |
| 74 | 81 | $pag = $this->getObjInfraIBanco()->consultarSql($sql); |
| 75 | 82 | $count = $this->getObjInfraIBanco()->consultarSql($sqlCount); |
| 76 | 83 | $total = $count ? $count[0]['total'] : 0; |
| ... | ... | @@ -81,12 +88,12 @@ class ProcessoExpedidoRN extends InfraRN { |
| 81 | 88 | $objProtocoloDTO->setNumRegistrosPaginaAtual(count($pag)); |
| 82 | 89 | |
| 83 | 90 | foreach ($pag as $res) { |
| 84 | - $data = new \DateTime($res['dth_abertura']); | |
| 91 | + $data = BancoSEI::getInstance()->formatarLeituraDth($res['dth_abertura']); | |
| 85 | 92 | $objProcessoExpedidoDTO = new ProcessoExpedidoDTO(); |
| 86 | 93 | $objProcessoExpedidoDTO->setDblIdProtocolo($res['id_protocolo']); |
| 87 | 94 | $objProcessoExpedidoDTO->setStrProtocoloFormatado($res['protocolo_formatado']); |
| 88 | 95 | $objProcessoExpedidoDTO->setStrNomeUsuario($res['nome_usuario']); |
| 89 | - $objProcessoExpedidoDTO->setDthExpedido($data->format('d/m/Y H:i:s')); | |
| 96 | + $objProcessoExpedidoDTO->setDthExpedido($data); | |
| 90 | 97 | $objProcessoExpedidoDTO->setStrDestino($res['unidade_destino']); |
| 91 | 98 | |
| 92 | 99 | $arrProcessosExpedidos[] = $objProcessoExpedidoDTO; | ... | ... |
rn/ReceberComponenteDigitalRN.php
| ... | ... | @@ -6,7 +6,7 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 6 | 6 | private $objProcessoEletronicoRN; |
| 7 | 7 | private $objInfraParametro; |
| 8 | 8 | private $arrAnexos = array(); |
| 9 | - | |
| 9 | + | |
| 10 | 10 | public function __construct() |
| 11 | 11 | { |
| 12 | 12 | parent::__construct(); |
| ... | ... | @@ -18,40 +18,24 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 18 | 18 | public function setArrAnexos($arrAnexos){ |
| 19 | 19 | $this->arrAnexos = $arrAnexos; |
| 20 | 20 | } |
| 21 | - | |
| 21 | + | |
| 22 | 22 | public function getArrAnexos(){ |
| 23 | 23 | return $this->arrAnexos; |
| 24 | 24 | } |
| 25 | - | |
| 25 | + | |
| 26 | 26 | protected function inicializarObjInfraIBanco() |
| 27 | 27 | { |
| 28 | 28 | return BancoSEI::getInstance(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - //TODO: Implementar o recebimento fracionado dos componentes digitais | |
| 32 | 31 | protected function receberComponenteDigitalConectado(ComponenteDigitalDTO $parObjComponenteDigitalDTO) |
| 33 | 32 | { |
| 33 | + | |
| 34 | 34 | if(!isset($parObjComponenteDigitalDTO) || !isset($parObjComponenteDigitalDTO)) { |
| 35 | 35 | throw new InfraException('Parâmetro $parObjComponenteDigitalDTO não informado.'); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - //Obter os dados do componente digital | |
| 39 | -// $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital( | |
| 40 | -// $parObjComponenteDigitalDTO->getNumIdTramite(), | |
| 41 | -// $parObjComponenteDigitalDTO->getStrHashConteudo(), | |
| 42 | -// $parObjComponenteDigitalDTO->getStrProtocolo()); | |
| 43 | - | |
| 44 | -// if(!isset($objComponenteDigital) || InfraString::isBolVazia($objComponenteDigital->conteudoDoComponenteDigital)) { | |
| 45 | -// throw new InfraException("Não foi possível obter informações do componente digital identificado (".$parObjComponenteDigitalDTO->getStrHashConteudo().")"); | |
| 46 | -// } | |
| 47 | - | |
| 48 | - //Copiar dados dos componentes digitais para o diretório de upload | |
| 49 | -// $objAnexoDTO = $this->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); | |
| 50 | - | |
| 51 | - | |
| 52 | - | |
| 53 | 38 | $objAnexoDTO = null; |
| 54 | - | |
| 55 | 39 | foreach($this->arrAnexos as $key => $objAnexo){ |
| 56 | 40 | if(array_key_exists($parObjComponenteDigitalDTO->getStrHashConteudo(), $objAnexo) && $objAnexo['recebido'] == false){ |
| 57 | 41 | $objAnexoDTO = $objAnexo[$parObjComponenteDigitalDTO->getStrHashConteudo()]; |
| ... | ... | @@ -59,15 +43,15 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 59 | 43 | break; |
| 60 | 44 | } |
| 61 | 45 | } |
| 62 | - | |
| 46 | + | |
| 63 | 47 | if(is_null($objAnexoDTO)){ |
| 64 | - throw new InfraException('Anexo '.$parObjComponenteDigitalDTO->getStrHashConteudo().' não encontrado'.var_export($this->arrAnexos, true)); | |
| 48 | + throw new InfraException('Anexo '.$parObjComponenteDigitalDTO->getStrHashConteudo().' não encontrado '.var_export($this->arrAnexos, true)); | |
| 65 | 49 | } |
| 66 | - | |
| 50 | + | |
| 67 | 51 | //Validar o hash do documento recebido com os dados informados pelo remetente |
| 68 | 52 | //$this->validarIntegridadeDoComponenteDigital($objAnexoDTO, $parObjComponenteDigitalDTO); |
| 69 | 53 | |
| 70 | - //Transaferir documentos validados para o repositório final de arquivos | |
| 54 | + //Transferir documentos validados para o repositório final de arquivos | |
| 71 | 55 | $this->cadastrarComponenteDigital($parObjComponenteDigitalDTO, $objAnexoDTO); |
| 72 | 56 | |
| 73 | 57 | //Registrar anexo relacionado com o componente digital |
| ... | ... | @@ -80,9 +64,7 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 80 | 64 | $objComponenteDigitalDTO->setNumIdTramite($parObjComponenteDigitalDTO->getNumIdTramite()); |
| 81 | 65 | $objComponenteDigitalDTO->setStrNumeroRegistro($parObjComponenteDigitalDTO->getStrNumeroRegistro()); |
| 82 | 66 | $objComponenteDigitalDTO->setDblIdDocumento($parObjComponenteDigitalDTO->getDblIdDocumento()); |
| 83 | - | |
| 84 | 67 | $objComponenteDigitalDTO->setNumIdAnexo($parObjAnexoDTO->getNumIdAnexo()); |
| 85 | - | |
| 86 | 68 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
| 87 | 69 | $objComponenteDigitalDTO = $objComponenteDigitalBD->alterar($objComponenteDigitalDTO); |
| 88 | 70 | } |
| ... | ... | @@ -93,12 +75,11 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 93 | 75 | $strNomeArquivoUpload = $objAnexoRN->gerarNomeArquivoTemporario(); |
| 94 | 76 | $strConteudoCodificado = $objComponenteDigital->conteudoDoComponenteDigital; |
| 95 | 77 | $strNome = $objComponenteDigital->nome; |
| 96 | - | |
| 97 | - | |
| 78 | + | |
| 98 | 79 | $fp = fopen(DIR_SEI_TEMP.'/'.$strNomeArquivoUpload,'w'); |
| 99 | 80 | fwrite($fp,$strConteudoCodificado); |
| 100 | 81 | fclose($fp); |
| 101 | - | |
| 82 | + | |
| 102 | 83 | //Atribui informações do arquivo anexo |
| 103 | 84 | $objAnexoDTO = new AnexoDTO(); |
| 104 | 85 | $objAnexoDTO->setNumIdAnexo($strNomeArquivoUpload); |
| ... | ... | @@ -119,11 +100,11 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 119 | 100 | $strHashDoArquivo = hash_file("sha256", $strCaminhoAnexo, true); |
| 120 | 101 | |
| 121 | 102 | if(strcmp($strHashInformado, $strHashDoArquivo) != 0) { |
| 122 | - | |
| 103 | + | |
| 123 | 104 | $this->objProcessoEletronicoRN->recusarTramite($parNumIdentificacaoTramite, "Hash do componente digital não confere com o valor informado pelo remetente.", ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_CORROMPIDO); |
| 124 | 105 | |
| 125 | 106 | // Adiciono nos detalhes o nome do método para poder manipular o cache |
| 126 | - throw new InfraException("Hash do componente digital não confere com o valor informado pelo remetente.", null, __METHOD__); | |
| 107 | + throw new InfraException("Hash do componente digital não confere com o valor informado pelo remetente.", null, __METHOD__); | |
| 127 | 108 | } |
| 128 | 109 | } |
| 129 | 110 | |
| ... | ... | @@ -134,10 +115,10 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 134 | 115 | $objDocumentoDTO->retDblIdDocumento(); |
| 135 | 116 | $objDocumentoDTO->retDblIdProcedimento(); |
| 136 | 117 | $objDocumentoDTO->setDblIdDocumento($parObjComponenteDigitalDTO->getDblIdDocumento()); |
| 137 | - | |
| 118 | + | |
| 138 | 119 | $objDocumentoRN = new DocumentoRN(); |
| 139 | 120 | $objDocumentoDTO = $objDocumentoRN->consultarRN0005($objDocumentoDTO); |
| 140 | - | |
| 121 | + | |
| 141 | 122 | if ($objDocumentoDTO==null){ |
| 142 | 123 | throw new InfraException("Registro não encontrado."); |
| 143 | 124 | } |
| ... | ... | @@ -149,24 +130,24 @@ class ReceberComponenteDigitalRN extends InfraRN |
| 149 | 130 | |
| 150 | 131 | $objProtocoloRN = new ProtocoloRN(); |
| 151 | 132 | $objProtocoloDTO = $objProtocoloRN->consultarRN0186($objProtocoloDTO); |
| 152 | - | |
| 133 | + | |
| 153 | 134 | //Complementa informações do componente digital |
| 154 | 135 | $parObjAnexoDTO->setStrNome($parObjComponenteDigitalDTO->getStrNome()); |
| 155 | - | |
| 136 | + | |
| 156 | 137 | $arrStrNome = explode('.',$parObjComponenteDigitalDTO->getStrNome()); |
| 157 | 138 | $strProtocoloFormatado = current($arrStrNome); |
| 158 | - | |
| 139 | + | |
| 159 | 140 | $objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); |
| 160 | 141 | $objProtocoloDTO->setArrObjAnexoDTO(array($parObjAnexoDTO)); |
| 161 | 142 | $objDocumentoDTO = $objDocumentoRN->alterarRN0004($objDocumentoDTO); |
| 162 | - | |
| 143 | + | |
| 163 | 144 | // @join_tec US029 (#3790) |
| 164 | 145 | /*$objObservacaoDTO = new ObservacaoDTO(); |
| 165 | 146 | $objObservacaoDTO->setDblIdProtocolo($objProtocoloDTO->getDblIdProtocolo()); |
| 166 | 147 | $objObservacaoDTO->setStrDescricao(sprintf('Número SEI do Documento na Origem: %s', $strProtocoloFormatado)); |
| 167 | 148 | $objObservacaoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| 168 | - | |
| 149 | + | |
| 169 | 150 | $objObservacaoBD = new ObservacaoRN(); |
| 170 | 151 | $objObservacaoBD->cadastrarRN0222($objObservacaoDTO);*/ |
| 171 | 152 | } |
| 172 | -} | |
| 173 | 153 | \ No newline at end of file |
| 154 | +} | ... | ... |
rn/ReceberProcedimentoRN.php
| ... | ... | @@ -80,206 +80,193 @@ class ReceberProcedimentoRN extends InfraRN |
| 80 | 80 | $objInfraSessao->trocarUnidadeAtual(); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - // TODO: Adicionar comandos de debug. Vide SeiWs.php gerarProcedimento | |
| 84 | - protected function receberProcedimentoControlado($parNumIdentificacaoTramite) | |
| 85 | - { | |
| 86 | - | |
| 87 | - $objPenParametroRN = new PenParametroRN(); | |
| 88 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
| 89 | - | |
| 90 | - $objSeiRN = new SeiRN(); | |
| 91 | - | |
| 92 | - if (!isset($parNumIdentificacaoTramite)) { | |
| 93 | - throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 94 | - } | |
| 95 | - | |
| 96 | - //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados | |
| 97 | - $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); | |
| 98 | - | |
| 99 | - //!Substituir a unidade destinatária para a receptora (!1!) | |
| 100 | - if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { | |
| 101 | - $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario; | |
| 102 | - $objMetadadosProcedimento->metadados->destinatario = $objMetadadosProcedimento->metadados->unidadeReceptora; | |
| 103 | - } | |
| 104 | - | |
| 105 | - if (isset($objMetadadosProcedimento)) { | |
| 106 | - | |
| 107 | - $strNumeroRegistro = $objMetadadosProcedimento->metadados->NRE; | |
| 108 | - $objProcesso = $objMetadadosProcedimento->metadados->processo; | |
| 109 | - | |
| 110 | - //Verifica se processo já foi registrado para esse trâmite | |
| 111 | - //TODO: Avaliar também processos apensados | |
| 112 | - if($this->tramiteRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { | |
| 113 | - return ; | |
| 114 | - } | |
| 115 | - // Validação dos dados do processo recebido | |
| 116 | - $objInfraException = new InfraException(); | |
| 117 | - $this->validarDadosDestinatario($objInfraException, $objMetadadosProcedimento); | |
| 118 | - $objInfraException->lancarValidacoes(); | |
| 119 | - | |
| 120 | - #############################INICIA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ | |
| 121 | - $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 122 | - $objTramite = $arrObjTramite[0]; | |
| 123 | - | |
| 124 | - //Obtém lista de componentes digitais que precisam ser obtidos | |
| 125 | - if(!is_array($objTramite->componenteDigitalPendenteDeRecebimento)){ | |
| 126 | - $objTramite->componenteDigitalPendenteDeRecebimento = array($objTramite->componenteDigitalPendenteDeRecebimento); | |
| 127 | - } | |
| 128 | - | |
| 129 | - //Faz a validação do tamanho e espécie dos componentes digitais | |
| 130 | - $this->validarComponentesDigitais($objProcesso, $parNumIdentificacaoTramite); | |
| 131 | 83 | |
| 132 | - //Faz a validação da extensão dos componentes digitais a serem recebidos | |
| 133 | - $this->validarExtensaoComponentesDigitais($parNumIdentificacaoTramite, $objProcesso); | |
| 134 | - //Faz a validação das permissões de leitura e escrita | |
| 135 | - $this->verificarPermissoesDiretorios($parNumIdentificacaoTramite); | |
| 136 | - | |
| 137 | - $arrStrNomeDocumento = $this->listarMetaDadosComponentesDigitais($objProcesso); | |
| 138 | - | |
| 139 | - //Instancia a RN que faz o recebimento dos componentes digitais | |
| 140 | - $receberComponenteDigitalRN = new ReceberComponenteDigitalRN(); | |
| 141 | - | |
| 142 | - //Cria o array que receberá os anexos após os arquivos físicos serem salvos | |
| 143 | - $arrAnexosComponentes = array(); | |
| 144 | - | |
| 145 | - //Cria o array com a lista de hash | |
| 146 | - $arrayHash = array(); | |
| 147 | - | |
| 148 | - //Percorre os componentes que precisam ser recebidos | |
| 149 | - foreach($objTramite->componenteDigitalPendenteDeRecebimento as $key => $componentePendente){ | |
| 150 | - | |
| 151 | - if(!is_null($componentePendente)){ | |
| 152 | - | |
| 153 | - //Adiciona o hash do componente digital ao array | |
| 154 | - $arrayHash[] = $componentePendente; | |
| 155 | - | |
| 156 | - //Obter os dados do componente digital | |
| 157 | - $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); | |
| 158 | - //Copia o componente para a pasta temporária | |
| 159 | - $arrAnexosComponentes[$key][$componentePendente] = $receberComponenteDigitalRN->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); | |
| 160 | - $arrAnexosComponentes[$key]['recebido'] = false; | |
| 161 | - | |
| 162 | - //Valida a integridade do hash | |
| 163 | - $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); | |
| 164 | - } | |
| 165 | - } | |
| 166 | - if(count($arrAnexosComponentes) > 0){ | |
| 167 | - | |
| 168 | - $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); | |
| 169 | - } | |
| 170 | - #############################TERMINA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ | |
| 84 | + protected function receberProcedimentoControlado($parNumIdentificacaoTramite) | |
| 85 | + { | |
| 86 | + try { | |
| 87 | + $objPenParametroRN = new PenParametroRN(); | |
| 88 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
| 171 | 89 | |
| 172 | - $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 173 | - $objTramite = $arrObjTramite[0]; | |
| 90 | + $objSeiRN = new SeiRN(); | |
| 174 | 91 | |
| 175 | - //Verifica se o trâmite está recusado | |
| 176 | - if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO) { | |
| 177 | - return; | |
| 178 | - } | |
| 92 | + if (!isset($parNumIdentificacaoTramite)) { | |
| 93 | + throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 94 | + } | |
| 179 | 95 | |
| 180 | - $objProcedimentoDTO = $this->registrarProcesso($strNumeroRegistro, $parNumIdentificacaoTramite, $objProcesso, $objMetadadosProcedimento); | |
| 96 | + //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados | |
| 97 | + $this->gravarLogDebug("Solicitando metadados do trâmite " . $parNumIdentificacaoTramite, 4); | |
| 98 | + $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); | |
| 181 | 99 | |
| 100 | + //Substituir a unidade destinatária para a receptora (!1!) | |
| 101 | + if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { | |
| 102 | + $numUnidadeReceptora = $objMetadadosProcedimento->metadados->unidadeReceptora; | |
| 103 | + $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario; | |
| 104 | + $objMetadadosProcedimento->metadados->destinatario = $numUnidadeReceptora; | |
| 105 | + $this->gravarLogDebug("Atribuindo unidade receptora $numUnidadeReceptora para o trâmite $parNumIdentificacaoTramite", 4); | |
| 106 | + } | |
| 182 | 107 | |
| 108 | + if (isset($objMetadadosProcedimento)) { | |
| 109 | + $strNumeroRegistro = $objMetadadosProcedimento->metadados->NRE; | |
| 110 | + $objProcesso = $objMetadadosProcedimento->metadados->processo; | |
| 183 | 111 | |
| 112 | + //Verifica se processo já foi registrado para esse trâmite | |
| 113 | + //TODO: Ajuste para receber corretamente processo em outra unidade do mesmo sistema passando pelo Barramento | |
| 114 | + //Comentando o trecho abaixo funciona, mas o processo fica aberto na unidade de destino | |
| 115 | + if($this->tramiteRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { | |
| 116 | + $this->gravarLogDebug("Trâmite $parNumIdentificacaoTramite já para o processo " . $objProcesso->protocolo, 4); | |
| 117 | + // return ; | |
| 118 | + } | |
| 184 | 119 | |
| 185 | - // @join_tec US008.08 (#23092) | |
| 186 | - $this->objProcedimentoAndamentoRN->setOpts($objProcedimentoDTO->getDblIdProcedimento(), $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); | |
| 187 | - $this->objProcedimentoAndamentoRN->cadastrar('Obtendo metadados do processo', 'S'); | |
| 120 | + // Validação dos dados do processo recebido | |
| 121 | + $objInfraException = new InfraException(); | |
| 122 | + $this->validarDadosDestinatario($objInfraException, $objMetadadosProcedimento); | |
| 123 | + $objInfraException->lancarValidacoes(); | |
| 188 | 124 | |
| 189 | - //Verificar se procedimento já existia na base de dados do sistema | |
| 190 | - //$dblIdProcedimento = $this->consultarProcedimentoExistente($strNumeroRegistro, $strProtocolo); | |
| 125 | + #############################INICIA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ | |
| 126 | + $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 127 | + $objTramite = $arrObjTramite[0]; | |
| 191 | 128 | |
| 192 | - //if(isset($dblIdProcedimento)){ | |
| 193 | - //TODO: Tratar situação em que o processo (NUP) já existia na base do sistema mas não havia nenhum NRE registrado para ele | |
| 194 | - // $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $objMetadadosProcedimento, $objProcesso); | |
| 195 | - //} | |
| 196 | - //else { | |
| 197 | - //TODO: Gerar Procedimento com status BLOQUEADO, aguardando o recebimento dos componentes digitais | |
| 198 | - // $objProcedimentoDTO = $this->gerarProcedimento($objMetadadosProcedimento, $objProcesso); | |
| 199 | - //} | |
| 129 | + //Obtém lista de componentes digitais que precisam ser obtidos | |
| 130 | + $this->gravarLogDebug("Obtém lista de componentes digitais que precisam ser obtidos", 4); | |
| 131 | + if(!is_array($objTramite->componenteDigitalPendenteDeRecebimento)){ | |
| 132 | + $objTramite->componenteDigitalPendenteDeRecebimento = array($objTramite->componenteDigitalPendenteDeRecebimento); | |
| 133 | + } | |
| 200 | 134 | |
| 201 | - //TODO: Fazer o envio de cada um dos procedimentos apensados (Processo principal e seus apensados, caso exista) | |
| 202 | - //... | |
| 203 | - //TODO: Parei aqui!!! Recebimento de processos apensados | |
| 135 | + $this->validarComponentesDigitais($objProcesso, $parNumIdentificacaoTramite); | |
| 136 | + $this->validarExtensaoComponentesDigitais($parNumIdentificacaoTramite, $objProcesso); | |
| 137 | + $this->verificarPermissoesDiretorios($parNumIdentificacaoTramite); | |
| 204 | 138 | |
| 205 | - $objProcessoEletronicoDTO = $this->objProcessoEletronicoRN->cadastrarTramiteDeProcesso($objProcedimentoDTO->getDblIdProcedimento(), | |
| 206 | - $strNumeroRegistro, $parNumIdentificacaoTramite, null, $objProcesso); | |
| 139 | + $this->gravarLogDebug("Obtendo metadados dos componentes digitais do processo", 4); | |
| 140 | + $arrStrNomeDocumento = $this->listarMetaDadosComponentesDigitais($objProcesso); | |
| 141 | + $receberComponenteDigitalRN = new ReceberComponenteDigitalRN(); | |
| 142 | + $arrAnexosComponentes = array(); | |
| 143 | + $arrayHash = array(); | |
| 144 | + $arrayHashPendentes = array(); | |
| 207 | 145 | |
| 146 | + //Percorre os componentes que precisam ser recebidos | |
| 147 | + foreach($objTramite->componenteDigitalPendenteDeRecebimento as $key => $componentePendente){ | |
| 208 | 148 | |
| 149 | + if(!is_null($componentePendente)){ | |
| 209 | 150 | |
| 210 | - //TODO: Passar implementação para outra classe de negócio | |
| 211 | - //Verifica se o tramite se encontra na situação correta | |
| 212 | - $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 213 | - if(!isset($arrObjTramite) || count($arrObjTramite) != 1) { | |
| 214 | - throw new InfraException("Trâmite não pode ser localizado pelo identificado $parNumIdentificacaoTramite."); | |
| 215 | - } | |
| 151 | + if(!$this->documentoJaRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite, $componentePendente)){ | |
| 152 | + $arrayHashPendentes[] = $componentePendente; | |
| 153 | + } | |
| 216 | 154 | |
| 155 | + //TODO: Download do componente digital é realizado, mesmo já existindo na base de dados, devido a comportamento obrigatório do Barramento para mudança de status | |
| 156 | + //Ajuste deverá ser feito em versões futuas | |
| 157 | + $arrayHash[] = $componentePendente; | |
| 217 | 158 | |
| 218 | - $objTramite = $arrObjTramite[0]; | |
| 159 | + //Obter os dados do componente digital | |
| 160 | + $this->gravarLogDebug("Baixando componente digital $key", 6); | |
| 161 | + $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); | |
| 162 | + $arrAnexosComponentes[$key][$componentePendente] = $receberComponenteDigitalRN->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); | |
| 163 | + $arrAnexosComponentes[$key]['recebido'] = false; | |
| 219 | 164 | |
| 165 | + //Valida a integridade do hash | |
| 166 | + $this->gravarLogDebug("Validando integridade de componente digital $key", 6); | |
| 167 | + $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); | |
| 168 | + } | |
| 169 | + } | |
| 220 | 170 | |
| 221 | - if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { | |
| 222 | - return; | |
| 223 | - } | |
| 171 | + if(count($arrAnexosComponentes) > 0){ | |
| 172 | + $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); | |
| 173 | + } | |
| 174 | + #############################TERMINA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ | |
| 224 | 175 | |
| 176 | + $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 177 | + $objTramite = $arrObjTramite[0]; | |
| 225 | 178 | |
| 226 | - // throw new InfraException("COMPONENTES DIGITAIS A SEREM ANEXADOS: ".var_export($arrayHash, true)); | |
| 227 | - if(count($arrayHash) > 0){ | |
| 179 | + //Verifica se o trâmite está recusado | |
| 180 | + if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO) { | |
| 181 | + $this->gravarLogDebug("Trâmite $parNumIdentificacaoTramite já se encontra recusado. Cancelando o recebimento do processo", 4); | |
| 182 | + return; | |
| 183 | + } | |
| 228 | 184 | |
| 229 | - //Obter dados dos componetes digitais | |
| 230 | - $objComponenteDigitalDTO = new ComponenteDigitalDTO(); | |
| 231 | - $objComponenteDigitalDTO->setStrNumeroRegistro($strNumeroRegistro); | |
| 232 | - $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 233 | - $objComponenteDigitalDTO->setStrHashConteudo($arrayHash, InfraDTO::$OPER_IN); | |
| 234 | - $objComponenteDigitalDTO->setOrdNumOrdem(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 235 | - $objComponenteDigitalDTO->retDblIdDocumento(); | |
| 236 | - $objComponenteDigitalDTO->retNumTicketEnvioComponentes(); | |
| 237 | - // $objComponenteDigitalDTO->retStrConteudoAssinaturaDocumento(); | |
| 238 | - $objComponenteDigitalDTO->retStrProtocoloDocumentoFormatado(); | |
| 239 | - $objComponenteDigitalDTO->retStrHashConteudo(); | |
| 240 | - $objComponenteDigitalDTO->retStrProtocolo(); | |
| 241 | - $objComponenteDigitalDTO->retStrNumeroRegistro(); | |
| 242 | - $objComponenteDigitalDTO->retNumIdTramite(); | |
| 243 | - $objComponenteDigitalDTO->retStrNome(); | |
| 244 | - $objComponenteDigitalDTO->retStrStaEstadoProtocolo(); | |
| 185 | + $this->gravarLogDebug("Persistindo/atualizando dados do processo com NRE " . $strNumeroRegistro, 4); | |
| 186 | + $objProcedimentoDTO = $this->registrarProcesso($strNumeroRegistro, $parNumIdentificacaoTramite, $objProcesso, $objMetadadosProcedimento); | |
| 245 | 187 | |
| 246 | - $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | |
| 247 | - $arrObjComponentesDigitaisDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO); | |
| 248 | 188 | |
| 249 | - // throw new InfraException('Componentes encontrados: '.var_export($arrObjComponentesDigitaisDTO, true)); | |
| 189 | + // @join_tec US008.08 (#23092) | |
| 190 | + $this->objProcedimentoAndamentoRN->setOpts($objProcedimentoDTO->getDblIdProcedimento(), $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); | |
| 191 | + $this->objProcedimentoAndamentoRN->cadastrar('Obtendo metadados do processo', 'S'); | |
| 250 | 192 | |
| 251 | - if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { | |
| 252 | 193 | |
| 253 | - $objReceberComponenteDigitalRN = $receberComponenteDigitalRN; | |
| 194 | + $this->gravarLogDebug("Registrando trâmite externo do processo", 4); | |
| 195 | + $objProcessoEletronicoDTO = $this->objProcessoEletronicoRN->cadastrarTramiteDeProcesso($objProcedimentoDTO->getDblIdProcedimento(), | |
| 196 | + $strNumeroRegistro, $parNumIdentificacaoTramite, null, $objProcesso); | |
| 254 | 197 | |
| 255 | - foreach($arrObjComponentesDigitaisDTO as $objComponenteDigitalDTOEnviado) { | |
| 256 | - if($objComponenteDigitalDTOEnviado->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 257 | - $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | |
| 258 | - $strNomeDocumento = (array_key_exists($strHash, $arrStrNomeDocumento)) ? $arrStrNomeDocumento[$strHash]['especieNome'] : '[Desconhecido]'; | |
| 198 | + //Verifica se o tramite se encontra na situação correta | |
| 199 | + $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 200 | + if(!isset($arrObjTramite) || count($arrObjTramite) != 1) { | |
| 201 | + throw new InfraException("Trâmite não pode ser localizado pelo identificado $parNumIdentificacaoTramite."); | |
| 202 | + } | |
| 259 | 203 | |
| 260 | - $objReceberComponenteDigitalRN->receberComponenteDigital($objComponenteDigitalDTOEnviado); | |
| 261 | 204 | |
| 262 | - // @join_tec US008.09 (#23092) | |
| 263 | - $this->objProcedimentoAndamentoRN->cadastrar(sprintf('Recebendo %s %s', $strNomeDocumento, $objComponenteDigitalDTOEnviado->getStrProtocoloDocumentoFormatado()), 'S'); | |
| 264 | - } | |
| 205 | + $objTramite = $arrObjTramite[0]; | |
| 206 | + if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { | |
| 207 | + $this->gravarLogDebug("Desconsiderando recebimento do processo devido a situação de trâmite inconsistente: " . $objTramite->situacaoAtual, 4); | |
| 208 | + return; | |
| 209 | + } | |
| 265 | 210 | |
| 211 | + if(count($arrayHashPendentes) > 0){ | |
| 212 | + //Obter dados dos componetes digitais | |
| 213 | + $this->gravarLogDebug("Iniciando o recebimento dos componentes digitais pendentes", 4); | |
| 214 | + $objComponenteDigitalDTO = new ComponenteDigitalDTO(); | |
| 215 | + $objComponenteDigitalDTO->setStrNumeroRegistro($strNumeroRegistro); | |
| 216 | + $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 217 | + $objComponenteDigitalDTO->setStrHashConteudo($arrayHash, InfraDTO::$OPER_IN); | |
| 218 | + $objComponenteDigitalDTO->setOrdNumOrdem(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 219 | + $objComponenteDigitalDTO->retDblIdDocumento(); | |
| 220 | + $objComponenteDigitalDTO->retNumTicketEnvioComponentes(); | |
| 221 | + $objComponenteDigitalDTO->retStrProtocoloDocumentoFormatado(); | |
| 222 | + $objComponenteDigitalDTO->retStrHashConteudo(); | |
| 223 | + $objComponenteDigitalDTO->retStrProtocolo(); | |
| 224 | + $objComponenteDigitalDTO->retStrNumeroRegistro(); | |
| 225 | + $objComponenteDigitalDTO->retNumIdTramite(); | |
| 226 | + $objComponenteDigitalDTO->retStrNome(); | |
| 227 | + $objComponenteDigitalDTO->retStrStaEstadoProtocolo(); | |
| 228 | + | |
| 229 | + $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | |
| 230 | + $arrObjComponentesDigitaisDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO); | |
| 231 | + | |
| 232 | + if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { | |
| 233 | + $objReceberComponenteDigitalRN = $receberComponenteDigitalRN; | |
| 234 | + foreach($arrObjComponentesDigitaisDTO as $objComponenteDigitalDTOEnviado) { | |
| 235 | + if($objComponenteDigitalDTOEnviado->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 236 | + $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | |
| 237 | + $strNomeDocumento = (array_key_exists($strHash, $arrStrNomeDocumento)) ? $arrStrNomeDocumento[$strHash]['especieNome'] : '[Desconhecido]'; | |
| 238 | + $objReceberComponenteDigitalRN->receberComponenteDigital($objComponenteDigitalDTOEnviado); | |
| 239 | + | |
| 240 | + // @join_tec US008.09 (#23092) | |
| 241 | + $strMensagemRecebimento = sprintf('Recebendo %s %s', $strNomeDocumento, $objComponenteDigitalDTOEnviado->getStrProtocoloDocumentoFormatado()); | |
| 242 | + $this->objProcedimentoAndamentoRN->cadastrar($strMensagemRecebimento, 'S'); | |
| 243 | + $this->gravarLogDebug($strMensagemRecebimento, 6); | |
| 244 | + } | |
| 245 | + } | |
| 246 | + // @join_tec US008.10 (#23092) | |
| 247 | + $this->objProcedimentoAndamentoRN->cadastrar('Todos os componentes digitais foram recebidos', 'S'); | |
| 248 | + | |
| 249 | + }else{ | |
| 250 | + $this->objProcedimentoAndamentoRN->cadastrar('Nenhum componente digital para receber', 'S'); | |
| 251 | + } | |
| 266 | 252 | } |
| 267 | - // @join_tec US008.10 (#23092) | |
| 268 | - $this->objProcedimentoAndamentoRN->cadastrar('Todos os componentes digitais foram recebidos', 'S'); | |
| 269 | - | |
| 270 | - }else{ | |
| 271 | - $this->objProcedimentoAndamentoRN->cadastrar('Nenhum componente digital para receber', 'S'); | |
| 272 | 253 | } |
| 273 | - } | |
| 254 | + //$this->fecharProcedimentoEmOutraUnidades($objProcedimentoDTO, $objMetadadosProcedimento); | |
| 255 | + $this->gravarLogDebug("Enviando recibo de conclusão do trâmite $parNumIdentificacaoTramite", 6); | |
| 256 | + $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | |
| 257 | + $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($parNumIdentificacaoTramite, $arrayHash); | |
| 258 | + | |
| 259 | + $this->gravarLogDebug("Registrando a conclusão do recebimento do trâmite $parNumIdentificacaoTramite", 6); | |
| 260 | + $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_PROCESSO); | |
| 261 | + $objPenTramiteProcessadoRN->setRecebido($parNumIdentificacaoTramite); | |
| 262 | + | |
| 263 | + } catch (Exception $e) { | |
| 264 | + $mensagemErro = InfraException::inspecionar($e); | |
| 265 | + $this->gravarLogDebug($mensagemErro); | |
| 266 | + LogSEI::getInstance()->gravar($mensagemErro); | |
| 267 | + throw $e; | |
| 268 | + } | |
| 274 | 269 | } |
| 275 | - //$this->fecharProcedimentoEmOutraUnidades($objProcedimentoDTO, $objMetadadosProcedimento); | |
| 276 | - | |
| 277 | - $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | |
| 278 | - $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($parNumIdentificacaoTramite, $arrayHash); | |
| 279 | - | |
| 280 | - $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_PROCESSO); | |
| 281 | - $objPenTramiteProcessadoRN->setRecebido($parNumIdentificacaoTramite); | |
| 282 | - } | |
| 283 | 270 | |
| 284 | 271 | /** |
| 285 | 272 | * Retorna um array com alguns metadados, onde o indice de é o hash do arquivo |
| ... | ... | @@ -373,8 +360,6 @@ class ReceberProcedimentoRN extends InfraRN |
| 373 | 360 | |
| 374 | 361 | private function registrarProcesso($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parObjProcesso, $parObjMetadadosProcedimento) |
| 375 | 362 | { |
| 376 | - | |
| 377 | - | |
| 378 | 363 | // Validação dos dados do processo recebido |
| 379 | 364 | $objInfraException = new InfraException(); |
| 380 | 365 | $this->validarDadosProcesso($objInfraException, $parObjProcesso); |
| ... | ... | @@ -389,13 +374,9 @@ class ReceberProcedimentoRN extends InfraRN |
| 389 | 374 | $dblIdProcedimento = $this->consultarProcedimentoExistente($parStrNumeroRegistro, $parObjProcesso->protocolo); |
| 390 | 375 | |
| 391 | 376 | if(isset($dblIdProcedimento)){ |
| 392 | - | |
| 393 | - //TODO: Tratar situação em que o processo (NUP) já existia na base do sistema mas não havia nenhum NRE registrado para ele | |
| 394 | 377 | $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $parObjMetadadosProcedimento, $parObjProcesso); |
| 395 | 378 | } |
| 396 | 379 | else { |
| 397 | - | |
| 398 | - //TODO: Gerar Procedimento com status BLOQUEADO, aguardando o recebimento dos componentes digitais | |
| 399 | 380 | $objProcedimentoDTO = $this->gerarProcedimento($parObjMetadadosProcedimento, $parObjProcesso); |
| 400 | 381 | } |
| 401 | 382 | |
| ... | ... | @@ -416,7 +397,8 @@ class ReceberProcedimentoRN extends InfraRN |
| 416 | 397 | return $objProcedimentoDTO; |
| 417 | 398 | } |
| 418 | 399 | |
| 419 | - private function tramiteRegistrado($parStrNumeroRegistro, $parNumIdentificacaoTramite) { | |
| 400 | + private function tramiteRegistrado($parStrNumeroRegistro, $parNumIdentificacaoTramite) | |
| 401 | + { | |
| 420 | 402 | |
| 421 | 403 | $objTramiteDTO = new TramiteDTO(); |
| 422 | 404 | $objTramiteDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
| ... | ... | @@ -426,6 +408,29 @@ class ReceberProcedimentoRN extends InfraRN |
| 426 | 408 | return $objTramiteBD->contar($objTramiteDTO) > 0; |
| 427 | 409 | } |
| 428 | 410 | |
| 411 | + | |
| 412 | + private function documentoJaRegistrado($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parStrHashComponenteDigital) | |
| 413 | + { | |
| 414 | + //Verifica se componente digital já está registrado para o documento | |
| 415 | + $objComponenteDigitalDTO = new ComponenteDigitalDTO(); | |
| 416 | + $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); | |
| 417 | + $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 418 | + $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); | |
| 419 | + // $objComponenteDigitalDTO->retDblIdDocumento(); | |
| 420 | + // $objComponenteDigitalDTO->retNumTicketEnvioComponentes(); | |
| 421 | + // $objComponenteDigitalDTO->retStrProtocoloDocumentoFormatado(); | |
| 422 | + // $objComponenteDigitalDTO->retStrHashConteudo(); | |
| 423 | + // $objComponenteDigitalDTO->retStrProtocolo(); | |
| 424 | + // $objComponenteDigitalDTO->retStrNumeroRegistro(); | |
| 425 | + // $objComponenteDigitalDTO->retNumIdTramite(); | |
| 426 | + // $objComponenteDigitalDTO->retStrNome(); | |
| 427 | + // $objComponenteDigitalDTO->retStrStaEstadoProtocolo(); | |
| 428 | + | |
| 429 | + $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | |
| 430 | + return $objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0; | |
| 431 | + } | |
| 432 | + | |
| 433 | + | |
| 429 | 434 | private function consultarProcedimentoExistente($parStrNumeroRegistro, $parStrProtocolo = null) { |
| 430 | 435 | |
| 431 | 436 | $dblIdProcedimento = null; |
| ... | ... | @@ -445,8 +450,8 @@ class ReceberProcedimentoRN extends InfraRN |
| 445 | 450 | return $dblIdProcedimento; |
| 446 | 451 | } |
| 447 | 452 | |
| 448 | - private function atualizarProcedimento($parDblIdProcedimento, $objMetadadosProcedimento, $objProcesso){ | |
| 449 | - | |
| 453 | + private function atualizarProcedimento($parDblIdProcedimento, $objMetadadosProcedimento, $objProcesso) | |
| 454 | + { | |
| 450 | 455 | |
| 451 | 456 | if(!isset($parDblIdProcedimento)){ |
| 452 | 457 | throw new InfraException('Parâmetro $parDblIdProcedimento não informado.'); |
| ... | ... | @@ -1680,105 +1685,117 @@ class ReceberProcedimentoRN extends InfraRN |
| 1680 | 1685 | } |
| 1681 | 1686 | |
| 1682 | 1687 | |
| 1683 | - public function receberTramitesRecusados($parNumIdentificacaoTramite) { | |
| 1684 | - | |
| 1685 | - if (empty($parNumIdentificacaoTramite)) { | |
| 1686 | - throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 1687 | - } | |
| 1688 | - | |
| 1689 | - //Busca os dados do trâmite no barramento | |
| 1690 | - $tramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 1691 | - | |
| 1692 | - if(!isset($tramite[0])){ | |
| 1693 | - throw new InfraException("Não foi encontrado no PEN o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1694 | - } | |
| 1695 | - | |
| 1696 | - $tramite = $tramite[0]; | |
| 1697 | - | |
| 1698 | - $objTramiteDTO = new TramiteDTO(); | |
| 1699 | - $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1700 | - $objTramiteDTO->retNumIdUnidade(); | |
| 1701 | - | |
| 1702 | - $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); | |
| 1703 | - $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | |
| 1704 | - | |
| 1705 | - if(!isset($objTramiteDTO)){ | |
| 1706 | - throw new InfraException("Não foi encontrado no sistema o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1707 | - } | |
| 1708 | - | |
| 1709 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); | |
| 1710 | - | |
| 1711 | - //Busca os dados do procedimento | |
| 1712 | - $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); | |
| 1713 | - $objProcessoEletronicoDTO->setStrNumeroRegistro($tramite->NRE); | |
| 1714 | - $objProcessoEletronicoDTO->retDblIdProcedimento(); | |
| 1688 | + public function receberTramitesRecusados($parNumIdentificacaoTramite) | |
| 1689 | + { | |
| 1690 | + try { | |
| 1691 | + if (empty($parNumIdentificacaoTramite)) { | |
| 1692 | + throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); | |
| 1693 | + } | |
| 1715 | 1694 | |
| 1716 | - $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); | |
| 1717 | - $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); | |
| 1695 | + //Busca os dados do trâmite no barramento | |
| 1696 | + $tramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); | |
| 1718 | 1697 | |
| 1719 | - //Busca a última atividade de trâmite externo | |
| 1720 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1721 | - $objAtividadeDTO->setDblIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1722 | - $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); | |
| 1723 | - $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | |
| 1724 | - $objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 1725 | - $objAtividadeDTO->retNumIdAtividade(); | |
| 1698 | + if(!isset($tramite[0])){ | |
| 1699 | + throw new InfraException("Não foi encontrado no PEN o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1700 | + } | |
| 1726 | 1701 | |
| 1727 | - //TODO: Necessário refatoração para chamada da casse AtividadeRN, e não a classe AtividadeBD com risco de quebra de regas internas do sistema | |
| 1728 | - $objAtividadeBD = new AtividadeBD($this->getObjInfraIBanco()); | |
| 1729 | - $objAtividadeDTO = $objAtividadeBD->consultar($objAtividadeDTO); | |
| 1702 | + $tramite = $tramite[0]; | |
| 1730 | 1703 | |
| 1731 | - //Busca a unidade de destino | |
| 1732 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1733 | - $objAtributoAndamentoDTO->setNumIdAtividade($objAtividadeDTO->getNumIdAtividade()); | |
| 1734 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1735 | - $objAtributoAndamentoDTO->retStrValor(); | |
| 1704 | + $objTramiteDTO = new TramiteDTO(); | |
| 1705 | + $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1706 | + $objTramiteDTO->retNumIdUnidade(); | |
| 1736 | 1707 | |
| 1737 | - $objAtributoAndamentoBD = new AtributoAndamentoBD($this->getObjInfraIBanco()); | |
| 1738 | - $objAtributoAndamentoDTO = $objAtributoAndamentoBD->consultar($objAtributoAndamentoDTO); | |
| 1708 | + $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); | |
| 1709 | + $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | |
| 1739 | 1710 | |
| 1740 | - //Monta o DTO de receber tramite recusado | |
| 1741 | - $objReceberTramiteRecusadoDTO = new ReceberTramiteRecusadoDTO(); | |
| 1742 | - $objReceberTramiteRecusadoDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1743 | - $objReceberTramiteRecusadoDTO->setNumIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1744 | - $objReceberTramiteRecusadoDTO->setNumIdUnidadeOrigem(null); | |
| 1745 | - $objReceberTramiteRecusadoDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO)); | |
| 1746 | - $objReceberTramiteRecusadoDTO->setStrMotivoRecusa(utf8_decode($tramite->justificativaDaRecusa)); | |
| 1747 | - $objReceberTramiteRecusadoDTO->setStrNomeUnidadeDestino($objAtributoAndamentoDTO->getStrValor()); | |
| 1711 | + if(!isset($objTramiteDTO)){ | |
| 1712 | + throw new InfraException("Não foi encontrado no sistema o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); | |
| 1713 | + } | |
| 1748 | 1714 | |
| 1749 | - //Faz o tratamento do processo e do trâmite recusado | |
| 1750 | - $this->receberTramiteRecusadoInterno($objReceberTramiteRecusadoDTO); | |
| 1715 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); | |
| 1751 | 1716 | |
| 1717 | + //Busca os dados do procedimento | |
| 1718 | + $this->gravarLogDebug("Buscando os dados de procedimento com NRE " . $tramite->NRE, 2); | |
| 1719 | + $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); | |
| 1720 | + $objProcessoEletronicoDTO->setStrNumeroRegistro($tramite->NRE); | |
| 1721 | + $objProcessoEletronicoDTO->retDblIdProcedimento(); | |
| 1722 | + $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); | |
| 1723 | + $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); | |
| 1752 | 1724 | |
| 1725 | + //Busca a última atividade de trâmite externo | |
| 1726 | + $this->gravarLogDebug("Buscando última atividade de trâmite externo do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento(), 2); | |
| 1727 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1728 | + $objAtividadeDTO->setDblIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1729 | + $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); | |
| 1730 | + $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | |
| 1731 | + $objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); | |
| 1732 | + $objAtividadeDTO->retNumIdAtividade(); | |
| 1733 | + $objAtividadeBD = new AtividadeBD($this->getObjInfraIBanco()); | |
| 1734 | + $objAtividadeDTO = $objAtividadeBD->consultar($objAtividadeDTO); | |
| 1735 | + | |
| 1736 | + //Busca a unidade de destino | |
| 1737 | + $this->gravarLogDebug("Buscando informações sobre a unidade de destino", 2); | |
| 1738 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 1739 | + $objAtributoAndamentoDTO->setNumIdAtividade($objAtividadeDTO->getNumIdAtividade()); | |
| 1740 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 1741 | + $objAtributoAndamentoDTO->retStrValor(); | |
| 1742 | + $objAtributoAndamentoBD = new AtributoAndamentoBD($this->getObjInfraIBanco()); | |
| 1743 | + $objAtributoAndamentoDTO = $objAtributoAndamentoBD->consultar($objAtributoAndamentoDTO); | |
| 1744 | + | |
| 1745 | + //Monta o DTO de receber tramite recusado | |
| 1746 | + $this->gravarLogDebug("Preparando recebimento de trâmite " . $parNumIdentificacaoTramite . " recusado", 2); | |
| 1747 | + $objReceberTramiteRecusadoDTO = new ReceberTramiteRecusadoDTO(); | |
| 1748 | + $objReceberTramiteRecusadoDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
| 1749 | + $objReceberTramiteRecusadoDTO->setNumIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); | |
| 1750 | + $objReceberTramiteRecusadoDTO->setNumIdUnidadeOrigem(null); | |
| 1751 | + $objReceberTramiteRecusadoDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO)); | |
| 1752 | + $objReceberTramiteRecusadoDTO->setStrMotivoRecusa(utf8_decode($tramite->justificativaDaRecusa)); | |
| 1753 | + $objReceberTramiteRecusadoDTO->setStrNomeUnidadeDestino($objAtributoAndamentoDTO->getStrValor()); | |
| 1754 | + | |
| 1755 | + //Faz o tratamento do processo e do trâmite recusado | |
| 1756 | + $this->gravarLogDebug("Atualizando dados do processo " . $objProcessoEletronicoDTO->getDblIdProcedimento() ." e do trâmite recusado " . $parNumIdentificacaoTramite, 2); | |
| 1757 | + $this->receberTramiteRecusadoInterno($objReceberTramiteRecusadoDTO); | |
| 1758 | + | |
| 1759 | + } catch (Exception $e) { | |
| 1760 | + $mensagemErro = InfraException::inspecionar($e); | |
| 1761 | + $this->gravarLogDebug($mensagemErro); | |
| 1762 | + LogSEI::getInstance()->gravar($mensagemErro); | |
| 1763 | + throw $e; | |
| 1764 | + } | |
| 1753 | 1765 | } |
| 1754 | 1766 | |
| 1755 | - protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusadoDTO $objReceberTramiteRecusadoDTO){ | |
| 1756 | - | |
| 1757 | - | |
| 1767 | + protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusadoDTO $objReceberTramiteRecusadoDTO) | |
| 1768 | + { | |
| 1758 | 1769 | //Realiza o desbloqueio do processo |
| 1759 | - $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 1760 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1761 | - | |
| 1762 | - $objSeiRN = new SeiRN(); | |
| 1763 | - $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 1770 | + $this->gravarLogDebug("Realizando o desbloqueio do processo", 4); | |
| 1771 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 1772 | + $objProtocoloDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1773 | + $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO); | |
| 1774 | + $objProtocoloRN = new ProtocoloRN(); | |
| 1775 | + if($objProtocoloRN->contarRN0667($objProtocoloDTO) != 0) { | |
| 1776 | + $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | |
| 1777 | + $objEntradaDesbloquearProcessoAPI->setIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); | |
| 1778 | + $objSeiRN = new SeiRN(); | |
| 1779 | + $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); | |
| 1780 | + } else { | |
| 1781 | + $this->gravarLogDebug("Processo " . $objReceberTramiteRecusadoDTO->getNumIdProtocolo() . " já se encontra desbloqueado!", 6); | |
| 1782 | + } | |
| 1764 | 1783 | |
| 1765 | 1784 | //Adiciona um andamento para o trâmite recusado |
| 1785 | + $this->gravarLogDebug("Adicionando andamento para registro da recusa do trâmite", 4); | |
| 1766 | 1786 | $arrObjAtributoAndamentoDTO = array(); |
| 1767 | - | |
| 1768 | 1787 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
| 1769 | 1788 | $objAtributoAndamentoDTO->setStrNome('MOTIVO'); |
| 1770 | 1789 | $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrMotivoRecusa()); |
| 1771 | 1790 | $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); |
| 1772 | 1791 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
| 1773 | 1792 | |
| 1774 | - | |
| 1775 | 1793 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
| 1776 | 1794 | $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); |
| 1777 | 1795 | $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrNomeUnidadeDestino()); |
| 1778 | 1796 | $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); |
| 1779 | 1797 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
| 1780 | 1798 | |
| 1781 | - | |
| 1782 | 1799 | $objAtividadeDTO = new AtividadeDTO(); |
| 1783 | 1800 | $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); |
| 1784 | 1801 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
| ... | ... | @@ -1789,21 +1806,18 @@ class ReceberProcedimentoRN extends InfraRN |
| 1789 | 1806 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
| 1790 | 1807 | |
| 1791 | 1808 | //Sinaliza na PenProtocolo que o processo obteve recusa |
| 1809 | + $this->gravarLogDebug("Atualizando protocolo sobre obtenção da ciência de recusa", 4); | |
| 1792 | 1810 | $objProtocolo = new PenProtocoloDTO(); |
| 1793 | 1811 | $objProtocolo->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); |
| 1794 | 1812 | $objProtocolo->setStrSinObteveRecusa('S'); |
| 1795 | - | |
| 1796 | 1813 | $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); |
| 1797 | 1814 | $objProtocoloBD->alterar($objProtocolo); |
| 1798 | 1815 | |
| 1799 | - | |
| 1816 | + $this->gravarLogDebug("Notificando serviços do PEN sobre ciência da recusa do trâmite " . $objReceberTramiteRecusadoDTO->getNumIdTramite(), 4); | |
| 1800 | 1817 | $this->objProcessoEletronicoRN->cienciaRecusa($objReceberTramiteRecusadoDTO->getNumIdTramite()); |
| 1801 | - | |
| 1802 | - | |
| 1803 | 1818 | } |
| 1804 | 1819 | |
| 1805 | 1820 | |
| 1806 | - | |
| 1807 | 1821 | /** |
| 1808 | 1822 | * Método que realiza a validação da extensão dos componentes digitais a serem recebidos |
| 1809 | 1823 | * |
| ... | ... | @@ -1867,7 +1881,13 @@ class ReceberProcedimentoRN extends InfraRN |
| 1867 | 1881 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.'); |
| 1868 | 1882 | |
| 1869 | 1883 | } |
| 1884 | + } | |
| 1870 | 1885 | |
| 1871 | - | |
| 1886 | + private function gravarLogDebug($strMensagem, $numIdentacao=0) | |
| 1887 | + { | |
| 1888 | + $strDataLog = date("d/m/Y H:i:s"); | |
| 1889 | + $strLog = sprintf("[%s] [PROCESSAMENTO] %s %s", $strDataLog, str_repeat(" ", $numIdentacao * 4), $strMensagem); | |
| 1890 | + InfraDebug::getInstance()->gravar($strLog); | |
| 1872 | 1891 | } |
| 1892 | + | |
| 1873 | 1893 | } | ... | ... |
rn/ReceberReciboTramiteRN.php
| ... | ... | @@ -20,14 +20,21 @@ class ReceberReciboTramiteRN extends InfraRN |
| 20 | 20 | return BancoSEI::getInstance(); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - protected function registrarRecebimentoRecibo($numIdProcedimento, $strProtocoloFormatado, $numIdTramite) { | |
| 24 | - | |
| 23 | + protected function registrarRecebimentoRecibo($numIdProcedimento, $strProtocoloFormatado, $numIdTramite) | |
| 24 | + { | |
| 25 | 25 | //REALIZA A CONCLUSÃO DO PROCESSO |
| 26 | 26 | $objEntradaConcluirProcessoAPI = new EntradaConcluirProcessoAPI(); |
| 27 | 27 | $objEntradaConcluirProcessoAPI->setIdProcedimento($numIdProcedimento); |
| 28 | 28 | |
| 29 | 29 | $objSeiRN = new SeiRN(); |
| 30 | - $objSeiRN->concluirProcesso($objEntradaConcluirProcessoAPI); | |
| 30 | + try { | |
| 31 | + $objSeiRN->concluirProcesso($objEntradaConcluirProcessoAPI); | |
| 32 | + } catch (Exception $e) { | |
| 33 | + //Registra falha em log de debug mas não gera rollback na transação. | |
| 34 | + //O rollback da transação poderia deixar a situação do processo inconsistênte já que o Barramento registrou anteriormente que o | |
| 35 | + //recibo já havia sido obtido. O erro no fechamento não provoca impacto no andamento do processo | |
| 36 | + InfraDebug::getInstance()->gravar("Processo $strProtocoloFormatado não está aberto na unidade."); | |
| 37 | + } | |
| 31 | 38 | |
| 32 | 39 | $arrObjAtributoAndamentoDTO = array(); |
| 33 | 40 | |
| ... | ... | @@ -90,6 +97,7 @@ class ReceberReciboTramiteRN extends InfraRN |
| 90 | 97 | } |
| 91 | 98 | |
| 92 | 99 | $objRepositorioDTO = $this->objProcessoEletronicoRN->consultarRepositoriosDeEstruturas($objTramite->destinatario->identificacaoDoRepositorioDeEstruturas); |
| 100 | + | |
| 93 | 101 | if(!empty($objRepositorioDTO)) { |
| 94 | 102 | |
| 95 | 103 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
| ... | ... | @@ -108,11 +116,11 @@ class ReceberReciboTramiteRN extends InfraRN |
| 108 | 116 | |
| 109 | 117 | $objAtividadeRN = new AtividadeRN(); |
| 110 | 118 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
| 111 | - } | |
| 112 | - | |
| 113 | - protected function receberReciboDeTramiteConectado($parNumIdTramite) { | |
| 114 | 119 | |
| 120 | + } | |
| 115 | 121 | |
| 122 | + protected function receberReciboDeTramiteControlado($parNumIdTramite) | |
| 123 | + { | |
| 116 | 124 | if (!isset($parNumIdTramite)) { |
| 117 | 125 | throw new InfraException('Parâmetro $parNumIdTramite não informado.'); |
| 118 | 126 | } |
| ... | ... | @@ -142,6 +150,7 @@ class ReceberReciboTramiteRN extends InfraRN |
| 142 | 150 | |
| 143 | 151 | if ($objTramiteBD->contar($objTramiteDTO) > 0) { |
| 144 | 152 | |
| 153 | + | |
| 145 | 154 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); |
| 146 | 155 | SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); |
| 147 | 156 | |
| ... | ... | @@ -151,13 +160,10 @@ class ReceberReciboTramiteRN extends InfraRN |
| 151 | 160 | |
| 152 | 161 | $objReciboTramiteBD = new ReciboTramiteBD(BancoSEI::getInstance()); |
| 153 | 162 | if ($objReciboTramiteBD->contar($objReciboTramiteDTOExistente) == 0) { |
| 154 | - | |
| 155 | 163 | //Armazenar dados do recibo de conclusão do trãmite |
| 156 | 164 | $objReciboTramiteBD->cadastrar($objReciboTramiteDTO); |
| 157 | - | |
| 158 | 165 | if ($objReciboTramite->recibo->hashDoComponenteDigital && is_array($objReciboTramite->recibo->hashDoComponenteDigital)) { |
| 159 | 166 | foreach ($objReciboTramite->recibo->hashDoComponenteDigital as $strHashComponenteDigital) { |
| 160 | - | |
| 161 | 167 | $objReciboTramiteHashDTO = new ReciboTramiteHashDTO(); |
| 162 | 168 | $objReciboTramiteHashDTO->setStrNumeroRegistro($objReciboTramite->recibo->NRE); |
| 163 | 169 | $objReciboTramiteHashDTO->setNumIdTramite($objReciboTramite->recibo->IDT); |
| ... | ... | @@ -168,7 +174,6 @@ class ReceberReciboTramiteRN extends InfraRN |
| 168 | 174 | $objGenericoBD->cadastrar($objReciboTramiteHashDTO); |
| 169 | 175 | } |
| 170 | 176 | } |
| 171 | - | |
| 172 | 177 | //ALTERA O ESTADO DO PROCEDIMENTO |
| 173 | 178 | try { |
| 174 | 179 | |
| ... | ... | @@ -198,10 +203,8 @@ class ReceberReciboTramiteRN extends InfraRN |
| 198 | 203 | |
| 199 | 204 | $this->objProcedimentoAndamentoRN->setOpts($objProcessoEletronicoDTO->getDblIdProcedimento(), $parNumIdTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); |
| 200 | 205 | $this->objProcedimentoAndamentoRN->cadastrar(sprintf('Trâmite do processo %s foi concluído', $objProtocoloDTO->getStrProtocoloFormatado()), 'S'); |
| 201 | - | |
| 202 | 206 | //Registra o recbimento do recibo no histórico e realiza a conclusão do processo |
| 203 | 207 | $this->registrarRecebimentoRecibo($objProtocoloDTO->getDblIdProtocolo(), $objProtocoloDTO->getStrProtocoloFormatado(), $parNumIdTramite); |
| 204 | - | |
| 205 | 208 | $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_RECIBO); |
| 206 | 209 | $objPenTramiteProcessadoRN->setRecebido($parNumIdTramite); |
| 207 | 210 | ... | ... |