fixed bug #8662 - Alteração em código para permitir a restrição do tipo de OCD por ponto de venda.
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@66279 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
07865102ee
commit
8b5887dbe5
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Thiago
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface OCDPtoVtaParamDAO extends GenericDAO<OCDPtoVtaParam, Long> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Order;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OCDPtoVtaParamDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Thiago
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Repository("ocdPtoVtaParamDAO")
|
||||||
|
public class OCDPtoVtaParamHibernateDAO extends GenericHibernateDAO<OCDPtoVtaParam, Long>
|
||||||
|
implements OCDPtoVtaParamDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public OCDPtoVtaParamHibernateDAO(
|
||||||
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OCDPtoVtaParam> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.addOrder(Order.asc("ptoVtaCheckinId"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PtoVtaCheckin> buscar(int id) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("ptoVtaCheckinId", id));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -10,11 +13,17 @@ import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.LazyCollection;
|
||||||
|
import org.hibernate.annotations.LazyCollectionOption;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "OCD_PARAM")
|
@Table(name = "OCD_PARAM")
|
||||||
public class OCDParam implements java.io.Serializable {
|
public class OCDParam implements java.io.Serializable {
|
||||||
|
@ -40,6 +49,7 @@ public class OCDParam implements java.io.Serializable {
|
||||||
private Boolean indOcdDinheiro;
|
private Boolean indOcdDinheiro;
|
||||||
private Boolean indtotalbilhete;
|
private Boolean indtotalbilhete;
|
||||||
private BigDecimal tiempoLimitePenalizacion;
|
private BigDecimal tiempoLimitePenalizacion;
|
||||||
|
private List<OCDPtoVtaParam> listOCDPtoVtaParam;
|
||||||
|
|
||||||
public OCDParam(Long ocdparamId, BigDecimal penalizacion,
|
public OCDParam(Long ocdparamId, BigDecimal penalizacion,
|
||||||
Integer diasPagar, PuntoVenta puntoventa, Empresa empresa,
|
Integer diasPagar, PuntoVenta puntoventa, Empresa empresa,
|
||||||
|
@ -213,4 +223,36 @@ public class OCDParam implements java.io.Serializable {
|
||||||
this.tiempoLimitePenalizacion = tiempoLimitePenalizacion;
|
this.tiempoLimitePenalizacion = tiempoLimitePenalizacion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OCDPtoVtaParam addOCDPtoVtaParam(OCDPtoVtaParam ocdPtoVtaParam) {
|
||||||
|
OCDPtoVtaParam ocd = new OCDPtoVtaParam();
|
||||||
|
ocd.setPuntoventa(ocdPtoVtaParam.getPuntoventa());
|
||||||
|
ocd.setOcdParam(ocdPtoVtaParam.getOcdParam());
|
||||||
|
ocd.setActivo(Boolean.TRUE);
|
||||||
|
ocd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
ocd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
this.listOCDPtoVtaParam.add(ocd);
|
||||||
|
return ocd;
|
||||||
|
}
|
||||||
|
public void removePtovtaOCDParam(OCDPtoVtaParam ocdPtoVtaParam) {
|
||||||
|
this.listOCDPtoVtaParam.remove(ocdPtoVtaParam);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the listOCDPtoVtaParam
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "ocdParam")
|
||||||
|
@LazyCollection(LazyCollectionOption.FALSE)
|
||||||
|
public List<OCDPtoVtaParam> getListOCDPtoVtaParam() {
|
||||||
|
return listOCDPtoVtaParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listOCDPtoVtaParam the listOCDPtoVtaParam to set
|
||||||
|
*/
|
||||||
|
public void setListOCDPtoVtaParam(List<OCDPtoVtaParam> listOCDPtoVtaParam) {
|
||||||
|
this.listOCDPtoVtaParam = listOCDPtoVtaParam;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Thiago
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "OCD_PTOVTA_PARAM")
|
||||||
|
public class OCDPtoVtaParam {
|
||||||
|
|
||||||
|
private Long ocdPtoVtaParamId;
|
||||||
|
private OCDParam ocdParam;
|
||||||
|
private Boolean activo;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
private PuntoVenta puntoventa;
|
||||||
|
|
||||||
|
@SequenceGenerator(name = "OCD_PTOVTA_PARAM_SEQ", sequenceName = "OCD_PTOVTA_PARAM_SEQ", allocationSize = 1)
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_PTOVTA_PARAM_SEQ")
|
||||||
|
@Column(name = "OCDPTOVTAPARAM_ID", unique = true, nullable = false, precision = 15, scale = 0)
|
||||||
|
public Long getOcdPtoVtaParamId() {
|
||||||
|
return ocdPtoVtaParamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOcdPtoVtaParamId(Long ocdPtoVtaParamId) {
|
||||||
|
this.ocdPtoVtaParamId = ocdPtoVtaParamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "OCDPARAM_ID", referencedColumnName="OCDPARAM_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public OCDParam getOcdParam() {
|
||||||
|
return ocdParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOcdParam(OCDParam ocdParam) {
|
||||||
|
this.ocdParam = ocdParam;
|
||||||
|
}
|
||||||
|
@Column(name = "ACTIVO", precision = 1, scale = 0)
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Temporal(TemporalType.DATE)
|
||||||
|
@Column(name = "FECMODIF", length = 7)
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID", precision = 7, scale = 0)
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "PUNTOVENTA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public PuntoVenta getPuntoventa() {
|
||||||
|
return puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoventa(PuntoVenta puntoventa) {
|
||||||
|
this.puntoventa = puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Thiago
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface OCDPtoVtaParamService extends GenericService<OCDPtoVtaParam, Long> {
|
||||||
|
|
||||||
|
public List<OCDPtoVtaParam> obtenerTodos();
|
||||||
|
|
||||||
|
public OCDPtoVtaParam obtenerID(Long id);
|
||||||
|
|
||||||
|
public void borrar(OCDPtoVtaParam entidad);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OCDPtoVtaParamDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam;
|
||||||
|
import com.rjconsultores.ventaboletos.service.OCDPtoVtaParamService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("ocdPtoVtaParamService")
|
||||||
|
public class OCDPtoVtaParamServiceImpl implements OCDPtoVtaParamService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OCDPtoVtaParamDAO ocdPtoVtaParamDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OCDPtoVtaParam> obtenerTodos() {
|
||||||
|
return ocdPtoVtaParamDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OCDPtoVtaParam obtenerID(Long id) {
|
||||||
|
return ocdPtoVtaParamDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public OCDPtoVtaParam suscribir(OCDPtoVtaParam entidad) {
|
||||||
|
return ocdPtoVtaParamDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public OCDPtoVtaParam actualizacion(OCDPtoVtaParam entidad) {
|
||||||
|
return ocdPtoVtaParamDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public void borrar(OCDPtoVtaParam entidad) {
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
ocdPtoVtaParamDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue