Commit 5f45b878b2b74b87239865a95bd657ea5881c6a1
1 parent
5906cb93
Exists in
master
and in
21 other branches
[Fixed #30] Correção de erro Duplicate entry for PRIMARY
Showing
9 changed files
with
153 additions
and
39 deletions
Show diff stats
dto/PenHipoteseLegalDTO.php
... | ... | @@ -12,14 +12,19 @@ class PenHipoteseLegalDTO extends InfraDTO { |
12 | 12 | public function getStrNomeTabela() { |
13 | 13 | return 'md_pen_hipotese_legal'; |
14 | 14 | } |
15 | - | |
15 | + | |
16 | + public function getStrNomeSequenciaNativa() | |
17 | + { | |
18 | + return 'md_pen_seq_hipotese_legal'; | |
19 | + } | |
20 | + | |
16 | 21 | public function montar() { |
17 | 22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal', 'id_hipotese_legal'); |
18 | 23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Nome', 'nome'); |
19 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Identificacao', 'identificacao'); | |
20 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo'); | |
21 | - | |
22 | - $this->configurarPK('IdHipoteseLegal',InfraDTO::$TIPO_PK_SEQUENCIAL); | |
24 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Identificacao', 'identificacao'); | |
25 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo'); | |
26 | + | |
27 | + $this->configurarPK('IdHipoteseLegal',InfraDTO::$TIPO_PK_NATIVA); | |
23 | 28 | |
24 | 29 | //$this->configurarExclusaoLogica('Ativo', 'N'); |
25 | 30 | } | ... | ... |
dto/PenRelHipoteseLegalDTO.php
... | ... | @@ -10,17 +10,21 @@ class PenRelHipoteseLegalDTO extends InfraDTO { |
10 | 10 | public function getStrNomeTabela() { |
11 | 11 | return 'md_pen_rel_hipotese_legal'; |
12 | 12 | } |
13 | - | |
13 | + | |
14 | + public function getStrNomeSequenciaNativa() { | |
15 | + return 'md_pen_seq_rel_hipotese_legal'; | |
16 | + } | |
17 | + | |
14 | 18 | public function montar() { |
15 | 19 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento'); |
16 | 20 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdHipoteseLegal', 'id_hipotese_legal'); |
17 | 21 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Tipo', 'tipo'); |
18 | 22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Ativo', 'sin_ativo'); |
19 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdBarramento', 'id_hipotese_legal_pen'); | |
20 | - | |
21 | - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Identificacao', 'identificacao', 'md_pen_hipotese_legal'); | |
22 | - | |
23 | - $this->configurarPK('IdMap',InfraDTO::$TIPO_PK_SEQUENCIAL); | |
23 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdBarramento', 'id_hipotese_legal_pen'); | |
24 | + | |
25 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Identificacao', 'identificacao', 'md_pen_hipotese_legal'); | |
26 | + | |
27 | + $this->configurarPK('IdMap',InfraDTO::$TIPO_PK_NATIVA); | |
24 | 28 | $this->configurarFK('IdBarramento', 'md_pen_hipotese_legal', 'id_hipotese_legal'); |
25 | 29 | |
26 | 30 | //$this->configurarExclusaoLogica('Ativo', 'N'); | ... | ... |
dto/PenRelTipoDocMapEnviadoDTO.php
... | ... | @@ -8,18 +8,22 @@ class PenRelTipoDocMapEnviadoDTO extends InfraDTO { |
8 | 8 | return "md_pen_rel_doc_map_enviado"; |
9 | 9 | } |
10 | 10 | |
11 | + public function getStrNomeSequenciaNativa() { | |
12 | + return 'md_pen_seq_rel_doc_map_enviado'; | |
13 | + } | |
14 | + | |
11 | 15 | public function montar() { |
12 | - | |
16 | + | |
13 | 17 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento'); |
14 | 18 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'CodigoEspecie', 'codigo_especie'); |
15 | 19 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdSerie', 'id_serie'); |
16 | 20 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Padrao', 'sin_padrao'); |
17 | - | |
21 | + | |
18 | 22 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeSerie', 'nome', 'serie'); |
19 | 23 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeEspecie','nome_especie', 'md_pen_especie_documental'); |
20 | - | |
21 | - $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_SEQUENCIAL); | |
24 | + | |
25 | + $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_NATIVA); | |
22 | 26 | $this->configurarFK('IdSerie', 'serie', 'id_serie'); |
23 | 27 | $this->configurarFK('CodigoEspecie', 'md_pen_especie_documental', 'id_especie'); |
24 | 28 | } |
25 | -} | |
26 | 29 | \ No newline at end of file |
30 | +} | ... | ... |
dto/PenRelTipoDocMapRecebidoDTO.php
... | ... | @@ -8,17 +8,21 @@ class PenRelTipoDocMapRecebidoDTO extends InfraDTO { |
8 | 8 | return 'md_pen_rel_doc_map_recebido'; |
9 | 9 | } |
10 | 10 | |
11 | + public function getStrNomeSequenciaNativa() { | |
12 | + return 'md_pen_seq_rel_doc_map_recebid'; | |
13 | + } | |
14 | + | |
11 | 15 | public function montar() { |
12 | - | |
16 | + | |
13 | 17 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdMap', 'id_mapeamento'); |
14 | 18 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'CodigoEspecie', 'codigo_especie'); |
15 | 19 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdSerie', 'id_serie'); |
16 | 20 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Padrao', 'sin_padrao'); |
17 | - | |
21 | + | |
18 | 22 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeSerie', 'nome', 'serie'); |
19 | 23 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeEspecie','nome_especie', 'md_pen_especie_documental'); |
20 | - | |
21 | - $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_SEQUENCIAL); | |
24 | + | |
25 | + $this->configurarPK('IdMap', InfraDTO::$TIPO_PK_NATIVA); | |
22 | 26 | $this->configurarFK('IdSerie', 'serie', 'id_serie'); |
23 | 27 | $this->configurarFK('CodigoEspecie', 'md_pen_especie_documental', 'id_especie'); |
24 | 28 | } | ... | ... |
dto/ProcedimentoAndamentoDTO.php
... | ... | @@ -13,6 +13,10 @@ class ProcedimentoAndamentoDTO extends InfraDTO { |
13 | 13 | return 'md_pen_procedimento_andamento'; |
14 | 14 | } |
15 | 15 | |
16 | + public function getStrNomeSequenciaNativa() { | |
17 | + return 'md_pen_seq_procedimento_andam'; | |
18 | + } | |
19 | + | |
16 | 20 | public function montar() { |
17 | 21 | |
18 | 22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdAndamento', 'id_andamento'); |
... | ... | @@ -30,7 +34,7 @@ class ProcedimentoAndamentoDTO extends InfraDTO { |
30 | 34 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdRepositorioDestino', 'id_repositorio_destino', 'md_pen_tramite'); |
31 | 35 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdEstruturaDestino', 'id_estrutura_destino', 'md_pen_tramite'); |
32 | 36 | |
33 | - $this->configurarPK('IdAndamento', InfraDTO::$TIPO_PK_SEQUENCIAL); | |
37 | + $this->configurarPK('IdAndamento', InfraDTO::$TIPO_PK_NATIVA); | |
34 | 38 | $this->configurarFK('IdTramite', 'md_pen_tramite', 'id_tramite', InfraDTO::$TIPO_FK_OPCIONAL); |
35 | 39 | } |
36 | 40 | ... | ... |
dto/ReciboTramiteHashDTO.php
... | ... | @@ -8,6 +8,10 @@ class ReciboTramiteHashDTO extends InfraDTO { |
8 | 8 | return "md_pen_recibo_tramite_hash"; |
9 | 9 | } |
10 | 10 | |
11 | + public function getStrNomeSequenciaNativa() { | |
12 | + return 'md_pen_seq_recibo_tramite_hash'; | |
13 | + } | |
14 | + | |
11 | 15 | public function montar() { |
12 | 16 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdTramiteHash', 'id_tramite_hash'); |
13 | 17 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'NumeroRegistro', 'numero_registro'); |
... | ... | @@ -15,7 +19,7 @@ class ReciboTramiteHashDTO extends InfraDTO { |
15 | 19 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'HashComponenteDigital', 'hash_componente_digital'); |
16 | 20 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'TipoRecibo', 'tipo_recibo'); |
17 | 21 | |
18 | - $this->configurarPK('IdTramiteHash', InfraDTO::$TIPO_PK_SEQUENCIAL); | |
22 | + $this->configurarPK('IdTramiteHash', InfraDTO::$TIPO_PK_NATIVA); | |
19 | 23 | } |
20 | 24 | |
21 | 25 | } | ... | ... |
dto/TramitePendenteDTO.php
... | ... | @@ -4,17 +4,18 @@ require_once dirname(__FILE__).'/../../../SEI.php'; |
4 | 4 | |
5 | 5 | class TramitePendenteDTO extends InfraDTO { |
6 | 6 | |
7 | - public function getStrNomeTabela() { | |
8 | - return 'md_pen_tramite_pendente'; | |
7 | + public function getStrNomeTabela() { | |
8 | + return 'md_pen_tramite_pendente'; | |
9 | + } | |
9 | 10 | |
10 | - } | |
11 | + public function getStrNomeSequenciaNativa() { | |
12 | + return 'md_pen_seq_tramite_pendente'; | |
13 | + } | |
11 | 14 | |
12 | - public function montar() { | |
13 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdTabela', 'id'); | |
14 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdTramite', 'numero_tramite'); | |
15 | - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdAtividade', 'id_atividade_expedicao'); | |
16 | - | |
17 | - $this->configurarPK('IdTabela',InfraDTO::$TIPO_PK_SEQUENCIAL); | |
18 | - | |
19 | - } | |
15 | + public function montar() { | |
16 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdTabela', 'id'); | |
17 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdTramite', 'numero_tramite'); | |
18 | + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdAtividade', 'id_atividade_expedicao'); | |
19 | + $this->configurarPK('IdTabela',InfraDTO::$TIPO_PK_NATIVA); | |
20 | + } | |
20 | 21 | } | ... | ... |
rn/PenAtualizarSeiRN.php
... | ... | @@ -1205,7 +1205,6 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
1205 | 1205 | protected function instalarV1112() { |
1206 | 1206 | $objInfraMetaBD = new InfraMetaBD(BancoSEI::getInstance()); |
1207 | 1207 | |
1208 | - | |
1209 | 1208 | //[#22] Correção de erro de consistência no recebimento de processos com concorrência |
1210 | 1209 | $objInfraMetaBD->adicionarColuna('md_pen_tramite','sta_tipo_tramite', $objInfraMetaBD->tipoTextoFixo(1), 'null'); |
1211 | 1210 | $objInfraMetaBD->alterarColuna('md_pen_procedimento_andamento','id_procedimento',$objInfraMetaBD->tipoNumeroGrande(),'null'); |
... | ... | @@ -1246,19 +1245,109 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { |
1246 | 1245 | |
1247 | 1246 | |
1248 | 1247 | /* Contem atualizações da versao 1.1.13 do módulo */ |
1249 | - protected function instalarV1113() { | |
1248 | + protected function instalarV1113() | |
1249 | + { | |
1250 | + //30 - Correção de erros de chave duplicada devido a concorrência de transações | |
1251 | + $objInfraSequenciaRN = new InfraSequenciaRN(); | |
1252 | + $objInfraSequenciaDTO = new InfraSequenciaDTO(); | |
1253 | + | |
1254 | + //Sequência: md_pen_seq_procedimento_andam | |
1255 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_andamento) as total from md_pen_procedimento_andamento'); | |
1256 | + $numMaxId = $rs[0]['total']; | |
1257 | + if ($numMaxId==null){ | |
1258 | + $numMaxId = 0; | |
1259 | + } | |
1260 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_procedimento_andam', $numMaxId + 1); | |
1261 | + $objInfraSequenciaDTO->setStrNome('md_pen_procedimento_andamento'); | |
1262 | + $objInfraSequenciaDTO->retStrNome(); | |
1263 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1264 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1265 | + | |
1266 | + | |
1267 | + //Sequência: md_pen_seq_hipotese_legal | |
1268 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_hipotese_legal) as total from md_pen_hipotese_legal'); | |
1269 | + $numMaxId = $rs[0]['total']; | |
1270 | + if ($numMaxId==null){ | |
1271 | + $numMaxId = 0; | |
1272 | + } | |
1273 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_hipotese_legal', $numMaxId + 1); | |
1274 | + $objInfraSequenciaDTO->setStrNome('md_pen_hipotese_legal'); | |
1275 | + $objInfraSequenciaDTO->retStrNome(); | |
1276 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1277 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1278 | + | |
1279 | + | |
1280 | + //Sequência: md_pen_seq_rel_hipotese_legal | |
1281 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_mapeamento) as total from md_pen_rel_hipotese_legal'); | |
1282 | + $numMaxId = $rs[0]['total']; | |
1283 | + if ($numMaxId==null){ | |
1284 | + $numMaxId = 0; | |
1285 | + } | |
1286 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_rel_hipotese_legal', $numMaxId + 1); | |
1287 | + $objInfraSequenciaDTO->setStrNome('md_pen_rel_hipotese_legal'); | |
1288 | + $objInfraSequenciaDTO->retStrNome(); | |
1289 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1290 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1291 | + | |
1292 | + | |
1293 | + //Sequência: md_pen_seq_recibo_tramite_hash | |
1294 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_tramite_hash) as total from md_pen_recibo_tramite_hash'); | |
1295 | + $numMaxId = $rs[0]['total']; | |
1296 | + if ($numMaxId==null){ | |
1297 | + $numMaxId = 0; | |
1298 | + } | |
1299 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_recibo_tramite_hash', $numMaxId + 1); | |
1300 | + $objInfraSequenciaDTO->setStrNome('md_pen_recibo_tramite_hash'); | |
1301 | + $objInfraSequenciaDTO->retStrNome(); | |
1302 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1303 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1304 | + | |
1305 | + //Sequência: md_pen_seq_rel_doc_map_enviado | |
1306 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_mapeamento) as total from md_pen_rel_doc_map_enviado'); | |
1307 | + $numMaxId = $rs[0]['total']; | |
1308 | + if ($numMaxId==null){ | |
1309 | + $numMaxId = 0; | |
1310 | + } | |
1311 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_rel_doc_map_enviado', $numMaxId + 1); | |
1312 | + $objInfraSequenciaDTO->setStrNome('md_pen_rel_doc_map_enviado'); | |
1313 | + $objInfraSequenciaDTO->retStrNome(); | |
1314 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1315 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1316 | + | |
1317 | + //Sequência: md_pen_seq_rel_doc_map_recebid | |
1318 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id_mapeamento) as total from md_pen_rel_doc_map_recebido'); | |
1319 | + $numMaxId = $rs[0]['total']; | |
1320 | + if ($numMaxId==null){ | |
1321 | + $numMaxId = 0; | |
1322 | + } | |
1323 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_rel_doc_map_recebid', $numMaxId + 1); | |
1324 | + $objInfraSequenciaDTO->setStrNome('md_pen_rel_doc_map_recebido'); | |
1325 | + $objInfraSequenciaDTO->retStrNome(); | |
1326 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1327 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1328 | + | |
1329 | + | |
1330 | + //Sequência: md_pen_seq_tramite_pendente | |
1331 | + $rs = BancoSEI::getInstance()->consultarSql('select max(id) as total from md_pen_tramite_pendente'); | |
1332 | + $numMaxId = $rs[0]['total']; | |
1333 | + if ($numMaxId==null){ | |
1334 | + $numMaxId = 0; | |
1335 | + } | |
1336 | + BancoSEI::getInstance()->criarSequencialNativa('md_pen_seq_tramite_pendente', $numMaxId + 1); | |
1337 | + $objInfraSequenciaDTO->setStrNome('md_pen_tramite_pendente'); | |
1338 | + $objInfraSequenciaDTO->retStrNome(); | |
1339 | + $arrObjInfraSequenciaDTO = $objInfraSequenciaRN->listar($objInfraSequenciaDTO); | |
1340 | + $objInfraSequenciaRN->excluir($arrObjInfraSequenciaDTO); | |
1250 | 1341 | |
1251 | 1342 | //Fix-31 - Erro ao Configurar Campo 'numero_registro' como Not Null no Scritp de atualização |
1252 | 1343 | $objInfraMetaBD = new InfraMetaBD(BancoSEI::getInstance()); |
1253 | 1344 | $objInfraMetaBD->alterarColuna('md_pen_procedimento_andamento','numero_registro', $objInfraMetaBD->tipoTextoFixo(16), 'null'); |
1254 | 1345 | |
1255 | 1346 | //altera o parâmetro da versão de banco |
1256 | - $objInfraParametroBD = new InfraParametroBD(BancoSEI::getInstance()); | |
1347 | + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco()); | |
1257 | 1348 | $objInfraParametroDTO = new InfraParametroDTO(); |
1258 | 1349 | $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO); |
1259 | 1350 | $objInfraParametroDTO->setStrValor('1.1.13'); |
1260 | 1351 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
1261 | 1352 | } |
1262 | - | |
1263 | - | |
1264 | 1353 | } | ... | ... |
sip_atualizar_versao_modulo_pen.php
... | ... | @@ -1053,7 +1053,6 @@ class PenAtualizarSipRN extends InfraRN { |
1053 | 1053 | $objInfraParametroDTO->setStrValor('1.1.13'); |
1054 | 1054 | $objInfraParametroBD->alterar($objInfraParametroDTO); |
1055 | 1055 | } |
1056 | -} | |
1057 | 1056 | |
1058 | 1057 | try { |
1059 | 1058 | $objAtualizarRN = new PenAtualizarSipRN($arrArgs); | ... | ... |