fixes bug#20778
dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@104399 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6367442f3b
commit
114b73da6d
|
@ -40,7 +40,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "ESQUEMA_CORRIDA_SEQ", sequenceName = "ESQUEMA_CORRIDA_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "ESQUEMA_CORRIDA_SEQ", sequenceName = "ESQUEMA_CORRIDA_SEQ", allocationSize = 1)
|
||||||
@Table(name = "ESQUEMA_CORRIDA")
|
@Table(name = "ESQUEMA_CORRIDA")
|
||||||
@AuditarClasse(nome = "ESQUEMA_CORRIDA", campoEmpresa = "empresa", tela = "Configuração de Serviços")
|
@AuditarClasse(nome = "ESQUEMA_CORRIDA", tela = "Configuração de Serviços")
|
||||||
public class EsquemaCorrida implements Serializable, Auditavel<EsquemaCorrida> {
|
public class EsquemaCorrida implements Serializable, Auditavel<EsquemaCorrida> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -40,7 +40,7 @@ import br.com.rjconsultores.auditador.interfaces.AuditavelTelaAlternativa;
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "TARIFA_SEQ", sequenceName = "TARIFA_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "TARIFA_SEQ", sequenceName = "TARIFA_SEQ", allocationSize = 1)
|
||||||
@Table(name = "TARIFA")
|
@Table(name = "TARIFA")
|
||||||
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço", campoEmpresa = "empresaId")
|
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço")
|
||||||
public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlternativa {
|
public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlternativa {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -162,9 +162,6 @@ public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlt
|
||||||
@Transient
|
@Transient
|
||||||
private String telaAlternativa;
|
private String telaAlternativa;
|
||||||
|
|
||||||
@Transient
|
|
||||||
private Integer empresaId;
|
|
||||||
|
|
||||||
public Tarifa() {
|
public Tarifa() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +412,6 @@ public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlt
|
||||||
public void clonar() throws CloneNotSupportedException {
|
public void clonar() throws CloneNotSupportedException {
|
||||||
tarifaClone = new Tarifa();
|
tarifaClone = new Tarifa();
|
||||||
tarifaClone = (Tarifa) this.clone();
|
tarifaClone = (Tarifa) this.clone();
|
||||||
tarifaClone.setEmpresaId(this.getMarca() != null && this.getMarca().getEmpresa() != null ? this.getMarca().getEmpresa().getEmpresaId() : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -428,14 +424,6 @@ public class Tarifa implements Serializable, Auditavel<Tarifa>, AuditavelTelaAlt
|
||||||
return String.format("ID [%s]", getTarifaId());
|
return String.format("ID [%s]", getTarifaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getEmpresaId() {
|
|
||||||
return empresaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmpresaId(Integer empresaId) {
|
|
||||||
this.empresaId = empresaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTelaAlternativa(String telaAlternativa) {
|
public void setTelaAlternativa(String telaAlternativa) {
|
||||||
this.telaAlternativa = telaAlternativa;
|
this.telaAlternativa = telaAlternativa;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "TARIFA_OFICIAL_SEQ", sequenceName = "TARIFA_OFICIAL_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "TARIFA_OFICIAL_SEQ", sequenceName = "TARIFA_OFICIAL_SEQ", allocationSize = 1)
|
||||||
@Table(name = "TARIFA_OFICIAL")
|
@Table(name = "TARIFA_OFICIAL")
|
||||||
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço / Tarifa Oficial", campoEmpresa = "empresaId")
|
@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço / Tarifa Oficial")
|
||||||
public class TarifaOficial implements Serializable, Auditavel<TarifaOficial> {
|
public class TarifaOficial implements Serializable, Auditavel<TarifaOficial> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -8,12 +8,12 @@ import br.com.rjconsultores.auditador.model.AuditadorObjects;
|
||||||
|
|
||||||
public interface LogAuditoriaService extends GenericService<LogAuditoria, Long> {
|
public interface LogAuditoriaService extends GenericService<LogAuditoria, Long> {
|
||||||
|
|
||||||
public void auditar(Object objetoOriginal, Object objetoNovo);
|
public void auditar(Object objetoOriginal, Object objetoNovo, Integer empresaId);
|
||||||
|
|
||||||
public void auditarExclusao(Object objeto);
|
public void auditarExclusao(Object objeto, Integer empresaId);
|
||||||
|
|
||||||
public List<String> listarTodasAsTelas();
|
public List<String> listarTodasAsTelas();
|
||||||
|
|
||||||
public void suscribir(List<AuditadorObjects> lsObjects);
|
public void suscribir(List<AuditadorObjects> lsObjects, Integer empresaId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
||||||
|
|
||||||
entidad = esquemaCorridaDAO.actualizacion(entidad);
|
entidad = esquemaCorridaDAO.actualizacion(entidad);
|
||||||
|
|
||||||
logAuditoriaService.auditar(null, entidad);
|
logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
return entidad;
|
return entidad;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
||||||
novoClone.setEsquemaAsientoList(lsNovoAsientos);
|
novoClone.setEsquemaAsientoList(lsNovoAsientos);
|
||||||
}
|
}
|
||||||
|
|
||||||
logAuditoriaService.auditar(clone, entidad.getCloneObject());
|
logAuditoriaService.auditar(clone, entidad.getCloneObject(), entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
return entidad;
|
return entidad;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -162,7 +162,7 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.FALSE);
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
logAuditoriaService.auditarExclusao(entidad);
|
logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
esquemaCorridaDAO.actualizacion(entidad);
|
esquemaCorridaDAO.actualizacion(entidad);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ public class EsquemaCorridaServiceImpl implements EsquemaCorridaService {
|
||||||
}
|
}
|
||||||
novoClone.setEsquemaTramoList(lsTramosNovo);
|
novoClone.setEsquemaTramoList(lsTramosNovo);
|
||||||
|
|
||||||
logAuditoriaService.auditar(originalClone, novoClone);
|
logAuditoriaService.auditar(originalClone, novoClone, ec.getEmpresa() != null ? ec.getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
|
@ -65,22 +65,22 @@ public class LogAuditoriaServiceImpl implements LogAuditoriaService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void auditar(Object original, Object novo) {
|
public void auditar(Object original, Object novo, Integer empresaId) {
|
||||||
try {
|
try {
|
||||||
log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s", novo.getClass().toString()));
|
log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s", novo.getClass().getSimpleName()));
|
||||||
Integer totalRegistrosAuditados = 0;
|
Integer totalRegistrosAuditados = 0;
|
||||||
List<AuditadorObjects> lista = Auditador.getInstance().auditar(original, novo);
|
List<AuditadorObjects> lista = Auditador.getInstance().auditar(original, novo);
|
||||||
if(lista != null && !lista.isEmpty()) {
|
if(lista != null && !lista.isEmpty()) {
|
||||||
suscribir(lista);
|
suscribir(lista, empresaId);
|
||||||
totalRegistrosAuditados = lista.size();
|
totalRegistrosAuditados = lista.size();
|
||||||
}
|
}
|
||||||
log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s - Total Registros auditados: %d", novo.getClass().toString(), totalRegistrosAuditados));
|
log.info(String.format(":: Fim gravação registros de auditoria classe: %s - Total Registros auditados: %d", novo.getClass().getSimpleName(), totalRegistrosAuditados));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LogAuditoria convertToLogAuditoria(AuditadorObjects log) {
|
private LogAuditoria convertToLogAuditoria(AuditadorObjects log, Integer empresaId) {
|
||||||
LogAuditoria logAuditoria = new LogAuditoria();
|
LogAuditoria logAuditoria = new LogAuditoria();
|
||||||
logAuditoria.setUsuario(UsuarioLogado.getUsuarioLogado());
|
logAuditoria.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||||
logAuditoria.setFecmodif(Calendar.getInstance().getTime());
|
logAuditoria.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
@ -94,24 +94,24 @@ public class LogAuditoriaServiceImpl implements LogAuditoriaService {
|
||||||
logAuditoria.setValorNovo(log.getValorNovo() != null ? log.getValorNovo().toUpperCase() : null);
|
logAuditoria.setValorNovo(log.getValorNovo() != null ? log.getValorNovo().toUpperCase() : null);
|
||||||
logAuditoria.setIdAuditado(log.getIdAuditado());
|
logAuditoria.setIdAuditado(log.getIdAuditado());
|
||||||
|
|
||||||
if(log.getEmpresaId() != null) {
|
if(empresaId != null) {
|
||||||
logAuditoria.setEmpresa(new Empresa(log.getEmpresaId()));
|
logAuditoria.setEmpresa(new Empresa(empresaId));
|
||||||
}
|
}
|
||||||
return logAuditoria;
|
return logAuditoria;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void auditarExclusao(Object objeto) {
|
public void auditarExclusao(Object objeto, Integer empresaId) {
|
||||||
try {
|
try {
|
||||||
log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s", objeto.getClass().getSimpleName()));
|
log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s", objeto.getClass().getSimpleName()));
|
||||||
Integer totalRegistrosAuditados = 0;
|
Integer totalRegistrosAuditados = 0;
|
||||||
List<AuditadorObjects> lista = Auditador.getInstance().auditarExclusao(objeto);
|
List<AuditadorObjects> lista = Auditador.getInstance().auditarExclusao(objeto);
|
||||||
if(lista != null && !lista.isEmpty()) {
|
if(lista != null && !lista.isEmpty()) {
|
||||||
suscribir(lista);
|
suscribir(lista, empresaId);
|
||||||
totalRegistrosAuditados = lista.size();
|
totalRegistrosAuditados = lista.size();
|
||||||
}
|
}
|
||||||
log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s - Total Registros auditados: %d", objeto.getClass().getSimpleName(), totalRegistrosAuditados));
|
log.info(String.format(":: Fim gravação registros de auditoria de exclusao classe: %s - Total Registros auditados: %d", objeto.getClass().getSimpleName(), totalRegistrosAuditados));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,9 @@ public class LogAuditoriaServiceImpl implements LogAuditoriaService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void suscribir(List<AuditadorObjects> lsObjects) {
|
public void suscribir(List<AuditadorObjects> lsObjects, Integer empresaId) {
|
||||||
for (AuditadorObjects auditado : lsObjects) {
|
for (AuditadorObjects auditado : lsObjects) {
|
||||||
LogAuditoria logAuditoria = convertToLogAuditoria(auditado);
|
LogAuditoria logAuditoria = convertToLogAuditoria(auditado, empresaId);
|
||||||
suscribir(logAuditoria);
|
suscribir(logAuditoria);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,8 +252,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
try {
|
try {
|
||||||
TarifaOficial originalClone = tarifaOficial.getCloneObject();
|
TarifaOficial originalClone = tarifaOficial.getCloneObject();
|
||||||
tarifaOficialDAO.actualizacion(tarifaOficial);
|
tarifaOficialDAO.actualizacion(tarifaOficial);
|
||||||
tarifaOficial.setEmpresaId(tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditar(originalClone, tarifaOficial, tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
logAuditoriaService.auditar(originalClone, tarifaOficial);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
|
@ -275,8 +274,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public void borrar(TarifaOficial tarifaOficial) {
|
public void borrar(TarifaOficial tarifaOficial) {
|
||||||
tarifaOficialDAO.borrar(tarifaOficial);
|
tarifaOficialDAO.borrar(tarifaOficial);
|
||||||
tarifaOficial.setEmpresaId(tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditarExclusao(tarifaOficial, tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
logAuditoriaService.auditarExclusao(tarifaOficial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,9 +115,7 @@ public class TarifaServiceImpl implements TarifaService {
|
||||||
}
|
}
|
||||||
cadastrarTarifaHistorico(entidad);
|
cadastrarTarifaHistorico(entidad);
|
||||||
|
|
||||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditar(null, entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
logAuditoriaService.auditar(null, entidad);
|
|
||||||
|
|
||||||
return tarifaDAO.suscribir(entidad);
|
return tarifaDAO.suscribir(entidad);
|
||||||
|
|
||||||
|
@ -155,9 +153,7 @@ public class TarifaServiceImpl implements TarifaService {
|
||||||
|
|
||||||
tarifaDAO.updateTarifa(entidad);
|
tarifaDAO.updateTarifa(entidad);
|
||||||
|
|
||||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditar(originalClone, entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
logAuditoriaService.auditar(originalClone, entidad);
|
|
||||||
|
|
||||||
return entidad;
|
return entidad;
|
||||||
|
|
||||||
|
@ -187,9 +183,7 @@ public class TarifaServiceImpl implements TarifaService {
|
||||||
|
|
||||||
cadastrarTarifaHistorico(entidad);
|
cadastrarTarifaHistorico(entidad);
|
||||||
|
|
||||||
entidad.setEmpresaId(entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditarExclusao(entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
logAuditoriaService.auditarExclusao(entidad);
|
|
||||||
|
|
||||||
tarifaDAO.actualizacion(entidad);
|
tarifaDAO.actualizacion(entidad);
|
||||||
}
|
}
|
||||||
|
@ -290,9 +284,7 @@ public class TarifaServiceImpl implements TarifaService {
|
||||||
|
|
||||||
tarifa = tarifaDAO.suscribir(tarifa);
|
tarifa = tarifaDAO.suscribir(tarifa);
|
||||||
|
|
||||||
tarifa.setEmpresaId(tarifa.getMarca() != null && tarifa.getMarca().getEmpresa() != null ? tarifa.getMarca().getEmpresa().getEmpresaId() : null);
|
logAuditoriaService.auditar(null, tarifa, tarifa.getMarca() != null && tarifa.getMarca().getEmpresa() != null ? tarifa.getMarca().getEmpresa().getEmpresaId() : null);
|
||||||
|
|
||||||
logAuditoriaService.auditar(null, tarifa);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue