fixes bug#AL-1296

master
wallace.henrique 2023-01-27 18:07:36 -03:00
parent 0d9a4d5c47
commit dd0938d151
6 changed files with 16 additions and 50 deletions

View File

@ -26,7 +26,6 @@ import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.BooleanUtils;
import org.hibernate.Hibernate;
import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.NotFoundAction;

View File

@ -20,10 +20,9 @@ import br.com.rjconsultores.auditador.annotations.AuditarClasse;
import br.com.rjconsultores.auditador.annotations.NaoAuditar; import br.com.rjconsultores.auditador.annotations.NaoAuditar;
import br.com.rjconsultores.auditador.interfaces.Auditavel; import br.com.rjconsultores.auditador.interfaces.Auditavel;
@AuditarClasse(nome = "FechamentoParamptovta", tela = "Alteração de Ponto de Venda/Fechamento Conta Corrente")
@Entity @Entity
@Table(name = "FECHAMENTO_PARAMPTOVTA") @Table(name = "FECHAMENTO_PARAMPTOVTA")
public class FechamentoParamptovta implements Serializable, Auditavel<FechamentoParamptovta> { public class FechamentoParamptovta implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -36,9 +35,7 @@ public class FechamentoParamptovta implements Serializable, Auditavel<Fechamento
private Boolean activo; private Boolean activo;
private Integer diasemtransito; private Integer diasemtransito;
private String tipopagamento; private String tipopagamento;
@Transient
@NaoAuditar
private FechamentoParamptovta fechamentoParamptovtaClone;
public FechamentoParamptovta() { public FechamentoParamptovta() {
} }
@ -154,21 +151,5 @@ public class FechamentoParamptovta implements Serializable, Auditavel<Fechamento
public void setTipopagamento(String tipopagamento) { public void setTipopagamento(String tipopagamento) {
this.tipopagamento = tipopagamento; this.tipopagamento = tipopagamento;
} }
public void clonar() throws CloneNotSupportedException {
fechamentoParamptovtaClone = new FechamentoParamptovta();
fechamentoParamptovtaClone = (FechamentoParamptovta) this.clone();
}
@Transient
public FechamentoParamptovta getCloneObject() throws CloneNotSupportedException {
return fechamentoParamptovtaClone;
}
@Transient
public String getTextoInclusaoExclusao() {
return String.format("ID [%s]", getFechamentoparamptovtaId());
}
} }

View File

@ -160,7 +160,9 @@ public class PtovtaCatInd implements Serializable, Auditavel<PtovtaCatInd> {
@Override @Override
public String getTextoInclusaoExclusao() { public String getTextoInclusaoExclusao() {
return String.format("ID [%s]", getCategoria().getDesccategoria()); String totalbus = Boolean.TRUE.equals(getIndTotalBus()) ? "Totalbus : Sim" : "Totalbus : Não";
String embarcada = Boolean.TRUE.equals(getIndEmbarcada()) ? "Embarcada : Sim" : "Embarcada : Não";
return String.format("ID [%s]", getCategoria().getDesccategoria()+ "-"+totalbus+ "-"+embarcada);
} }

View File

@ -52,7 +52,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
*/ */
@Entity @Entity
@SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) @SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1)
@AuditarClasse(nome = "PuntoVenta", tela = "Altera<EFBFBD><EFBFBD>o de Ponto de Venda") @AuditarClasse(nome = "PuntoVenta", tela = "Alteracao de Ponto de Venda")
@Table(name = "PUNTO_VENTA") @Table(name = "PUNTO_VENTA")
public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> { public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
@ -101,7 +101,7 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
@JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID")
@ManyToOne @ManyToOne
private TipoPuntoVenta tipoPuntoVenta; private TipoPuntoVenta tipoPuntoVenta;
@AuditarLista(auditarEntidades = true, nome = "ReservacionPuntoVenta") @NaoAuditar
@OneToMany(mappedBy = "puntoVenta") @OneToMany(mappedBy = "puntoVenta")
private List<ReservacionPuntoVenta> reservacionPuntoventaList; private List<ReservacionPuntoVenta> reservacionPuntoventaList;
@OneToOne @OneToOne
@ -228,7 +228,7 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
@LazyCollection(LazyCollectionOption.FALSE) @LazyCollection(LazyCollectionOption.FALSE)
private List<PtoVtaSeguro> ptovtaSeguroList; private List<PtoVtaSeguro> ptovtaSeguroList;
@AuditarLista(auditarEntidades = true, nome = "PtovtaCatInd") @AuditarLista(auditarEntidades = true, nome = "ptovtaCatIndList")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta")
@LazyCollection(LazyCollectionOption.FALSE) @LazyCollection(LazyCollectionOption.FALSE)
private List<PtovtaCatInd> ptovtaCatIndList; private List<PtovtaCatInd> ptovtaCatIndList;
@ -1322,15 +1322,15 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
puntoVentaClone = new PuntoVenta(); puntoVentaClone = new PuntoVenta();
puntoVentaClone = (PuntoVenta) this.clone(); puntoVentaClone = (PuntoVenta) this.clone();
if(this.getReservacionPuntoventaList() != null) { if(this.getPtovtaCatIndList() != null) {
List<ReservacionPuntoVenta> lsClones = new ArrayList<ReservacionPuntoVenta>(); List<PtovtaCatInd> lsClones = new ArrayList<PtovtaCatInd>();
for (ReservacionPuntoVenta reservacionPuntoVenta : this.getReservacionPuntoventaList()) { for (PtovtaCatInd ptovtaCatInd : this.getPtovtaCatIndList()) {
if(BooleanUtils.isTrue(reservacionPuntoVenta.getActivo())) { if(BooleanUtils.isTrue(ptovtaCatInd.getActivo())) {
reservacionPuntoVenta.clonar(); ptovtaCatInd.clonar();
lsClones.add(reservacionPuntoVenta.getCloneObject()); lsClones.add(ptovtaCatInd.getCloneObject());
} }
} }
puntoVentaClone.setReservacionPuntoventaList(lsClones); puntoVentaClone.setPtovtaCatIndList(lsClones);
} }
} }

View File

@ -33,13 +33,7 @@ public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaSe
@Override @Override
public FechamentoParamptovta obtenerID(Long id) { public FechamentoParamptovta obtenerID(Long id) {
FechamentoParamptovta fechamentoParamptovta = fechamentoParamptovtaDAO.obtenerID(id); return fechamentoParamptovtaDAO.obtenerID(id);
try {
fechamentoParamptovta.clonar();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return fechamentoParamptovta;
} }
@ -57,11 +51,6 @@ public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaSe
public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) {
entidad.setFecmodif(new Date()); entidad.setFecmodif(new Date());
FechamentoParamptovta originalClone = null; FechamentoParamptovta originalClone = null;
try {
originalClone = entidad.getCloneObject();
} catch (Exception e) {
log.error("",e);
}
fechamentoParamptovtaDAO.actualizacion(entidad); fechamentoParamptovtaDAO.actualizacion(entidad);
logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
return entidad; return entidad;

View File

@ -9,7 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO; import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO;
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
import com.rjconsultores.ventaboletos.service.PtovtaCatIndService; import com.rjconsultores.ventaboletos.service.PtovtaCatIndService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -18,8 +17,6 @@ public class PtovtaCatIndServiceImpl implements PtovtaCatIndService {
@Autowired @Autowired
private PtovtaCatIndDAO ptovtaCatIndDAO; private PtovtaCatIndDAO ptovtaCatIndDAO;
@Autowired
private LogAuditoriaService logAuditoriaService;
@Override @Override
public List<PtovtaCatInd> obtenerTodos() { public List<PtovtaCatInd> obtenerTodos() {
@ -56,8 +53,6 @@ public class PtovtaCatIndServiceImpl implements PtovtaCatIndService {
entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE); entidad.setActivo(Boolean.FALSE);
ptovtaCatIndDAO.actualizacion(entidad); ptovtaCatIndDAO.actualizacion(entidad);
logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
} }