Alteração na classe ModificaionMasivaTarifasController e ModificaionMasivaTarifasUploadController, correção do upload
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@23320 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
bd134882a0
commit
e76d3353b0
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao;
|
||||
|
||||
public interface CategoriaOrgaoDAO extends GenericDAO<CategoriaOrgao, Integer> {
|
||||
|
||||
public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SessionFactory;
|
||||
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.CategoriaOrgaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao;
|
||||
|
||||
@Repository("categoriaOrgaoDAO")
|
||||
|
||||
public class CategoriaOrgaoHibernateDAO extends GenericHibernateDAO<CategoriaOrgao, Integer>
|
||||
implements CategoriaOrgaoDAO {
|
||||
|
||||
@Autowired
|
||||
public CategoriaOrgaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl));
|
||||
|
||||
return (CategoriaOrgao) c.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CategoriaOrgao> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.ProjectionList;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -60,8 +60,12 @@ public class CategoriaCtrl implements Serializable {
|
|||
private List<CategoriaCorrida> categoriaCorridaList;
|
||||
@OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL)
|
||||
private List<CategoriaMercado> categoriaMercadoList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl")
|
||||
private List<CategoriaOrgao> categoriaOrgaoList;
|
||||
|
||||
|
||||
public CategoriaCtrl() {
|
||||
|
||||
}
|
||||
|
||||
public CategoriaCtrl(Integer categoriactrlId) {
|
||||
|
@ -177,6 +181,24 @@ public class CategoriaCtrl implements Serializable {
|
|||
this.categoriaClaseList = categoriaClaseList;
|
||||
}
|
||||
|
||||
public List<CategoriaOrgao> getCategoriaOrgaoList() {
|
||||
//return categoriaMarcaList;
|
||||
List<CategoriaOrgao> tmp = new ArrayList<CategoriaOrgao>();
|
||||
if (categoriaMercadoList != null) {
|
||||
for (CategoriaOrgao cm : this.categoriaOrgaoList) {
|
||||
if (cm.getActivo()) {
|
||||
tmp.add(cm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public void setCategoriaorgaoList(List<CategoriaOrgao> categoriaOrgaoList) {
|
||||
this.categoriaOrgaoList = categoriaOrgaoList;
|
||||
}
|
||||
|
||||
public List<CategoriaMarca> getCategoriaMarcaList() {
|
||||
//return categoriaMarcaList;
|
||||
List<CategoriaMarca> tmp = new ArrayList<CategoriaMarca>();
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
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;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1)
|
||||
@Table(name = "CATEGORIA_ORGAO")
|
||||
public class CategoriaOrgao implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_ORGAO_SEQ")
|
||||
@Column(name = "CATEGORIAORGAO_ID")
|
||||
private Integer categoriaorgaoId;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
|
||||
@ManyToOne
|
||||
private OrgaoConcedente orgao;
|
||||
@JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID")
|
||||
@ManyToOne
|
||||
private CategoriaCtrl categoriaCtrl;
|
||||
|
||||
public CategoriaOrgao() {
|
||||
}
|
||||
|
||||
public CategoriaOrgao(Integer categoriaorgaoId) {
|
||||
this.categoriaorgaoId = categoriaorgaoId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getCategoriaorgaoId() {
|
||||
return categoriaorgaoId;
|
||||
}
|
||||
|
||||
public void setCategoriaorgaoId(Integer categoriaorgaoId) {
|
||||
this.categoriaorgaoId = categoriaorgaoId;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OrgaoConcedente getOrgao() {
|
||||
return orgao;
|
||||
}
|
||||
|
||||
public void setOrgao(OrgaoConcedente orgao) {
|
||||
this.orgao = orgao;
|
||||
}
|
||||
|
||||
public CategoriaCtrl getCategoriaCtrl() {
|
||||
return categoriaCtrl;
|
||||
}
|
||||
|
||||
public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) {
|
||||
this.categoriaCtrl = categoriaCtrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final CategoriaOrgao other = (CategoriaOrgao) obj;
|
||||
if (this.orgao != other.orgao && (this.orgao == null || !this.orgao.equals(other.orgao))) {
|
||||
return false;
|
||||
}
|
||||
if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 97 * hash + (this.orgao != null ? this.orgao.hashCode() : 0);
|
||||
hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]";
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
|
@ -9,6 +10,7 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -38,6 +40,8 @@ public class OrgaoConcedente implements Serializable {
|
|||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@OneToMany(mappedBy = "orgao")
|
||||
private List<CategoriaOrgao> categoriaOrgaoList;
|
||||
|
||||
public Integer getOrgaoConcedenteId() {
|
||||
return orgaoConcedenteId;
|
||||
|
@ -95,6 +99,16 @@ public class OrgaoConcedente implements Serializable {
|
|||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<CategoriaOrgao> getCategoriaOrgaoList() {
|
||||
return categoriaOrgaoList;
|
||||
}
|
||||
|
||||
public void setCategoriaOrgaoList(List<CategoriaOrgao> categoriaOrgaoList) {
|
||||
this.categoriaOrgaoList = categoriaOrgaoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return descOrgao;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao;
|
||||
|
||||
public interface CategoriaOrgaoService extends GenericService<CategoriaOrgao, Integer> {
|
||||
|
||||
public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.CategoriaOrgaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaOrgaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
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;
|
||||
|
||||
|
||||
@Service("categoriaOrgaoService")
|
||||
public class CategoriaOrgaoServiceImpl implements CategoriaOrgaoService {
|
||||
|
||||
@Autowired
|
||||
private CategoriaOrgaoDAO categoriaOrgaoDAO;
|
||||
|
||||
public List<CategoriaOrgao> obtenerTodos() {
|
||||
return categoriaOrgaoDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public CategoriaOrgao obtenerID(Integer id) {
|
||||
return categoriaOrgaoDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CategoriaOrgao suscribir(CategoriaOrgao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return categoriaOrgaoDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CategoriaOrgao actualizacion(CategoriaOrgao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return categoriaOrgaoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(CategoriaOrgao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
categoriaOrgaoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) {
|
||||
return categoriaOrgaoDAO.busquedaPorCategoriaCtrl(categoriaCtrl);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue