Commit ae7f0dbc10964886008f05d08478da554504eace

Authored by Guilherme Andrade Del Cantoni
1 parent 3fe74e7a

[Fixed #30] Correção de erro Duplicate entry for PRIMARY

PENIntegracao.php
... ... @@ -11,7 +11,7 @@ class PENIntegracao extends SeiIntegracao {
11 11 }
12 12  
13 13 public function getVersao() {
14   - return '1.1.12';
  14 + return '1.1.13';
15 15 }
16 16  
17 17 public function getInstituicao() {
... ...
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
... ... @@ -54,6 +54,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
54 54 case '1.1.9': $this->instalarV1110();
55 55 case '1.1.10': $this->instalarV1111();
56 56 case '1.1.11': $this->instalarV1112();
  57 + case '1.1.12': $this->instalarV1113();
57 58  
58 59 break;
59 60 default:
... ... @@ -1204,7 +1205,6 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
1204 1205 protected function instalarV1112() {
1205 1206 $objInfraMetaBD = new InfraMetaBD($this->getObjInfraIBanco());
1206 1207  
1207   -
1208 1208 //[#22] Correção de erro de consistência no recebimento de processos com concorrência
1209 1209 $objInfraMetaBD->adicionarColuna('md_pen_tramite','sta_tipo_tramite', $objInfraMetaBD->tipoTextoFixo(1), 'null');
1210 1210 $objInfraMetaBD->alterarColuna('md_pen_procedimento_andamento','id_procedimento',$objInfraMetaBD->tipoNumeroGrande(),'null');
... ... @@ -1243,4 +1243,109 @@ class PenAtualizarSeiRN extends PenAtualizadorRN {
1243 1243 $objInfraParametroBD->alterar($objInfraParametroDTO);
1244 1244 }
1245 1245  
  1246 +
  1247 + /* Contem atualizações da versao 1.1.13 do módulo */
  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);
  1341 +
  1342 +
  1343 + //altera o parâmetro da versão de banco
  1344 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  1345 + $objInfraParametroDTO = new InfraParametroDTO();
  1346 + $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO);
  1347 + $objInfraParametroDTO->setStrValor('1.1.13');
  1348 + $objInfraParametroBD->alterar($objInfraParametroDTO);
  1349 + }
  1350 +
1246 1351 }
... ...
sip_atualizar_versao_modulo_pen.php
... ... @@ -94,6 +94,7 @@ class PenAtualizarSipRN extends InfraRN {
94 94 case '1.1.9': $this->instalarV1110();
95 95 case '1.1.10': $this->instalarV1111();
96 96 case '1.1.11': $this->instalarV1112();
  97 + case '1.1.12': $this->instalarV1113();
97 98  
98 99 break;
99 100 default:
... ... @@ -1039,6 +1040,21 @@ class PenAtualizarSipRN extends InfraRN {
1039 1040 }
1040 1041  
1041 1042  
  1043 + /**
  1044 + * Instala/Atualiza os módulo PEN para versão 1.1.13
  1045 + */
  1046 + protected function instalarV1113()
  1047 + {
  1048 + //Corrigir a versão do módulo no banco de dados
  1049 + $objInfraParametroDTO = new InfraParametroDTO();
  1050 + $objInfraParametroDTO->setStrNome(self::PARAMETRO_VERSAO_MODULO);
  1051 + $objInfraParametroDTO->retTodos();
  1052 + $objInfraParametroBD = new InfraParametroBD($this->inicializarObjInfraIBanco());
  1053 + $objInfraParametroDTO = $objInfraParametroBD->consultar($objInfraParametroDTO);
  1054 + $objInfraParametroDTO->setStrValor('1.1.13');
  1055 + $objInfraParametroBD->alterar($objInfraParametroDTO);
  1056 + }
  1057 +
1042 1058 }
1043 1059  
1044 1060 try {
... ...