82 lines
2.8 KiB
Java
82 lines
2.8 KiB
Java
/*
|
|
* 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.CompaniaBancariaDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria;
|
|
import com.rjconsultores.ventaboletos.entidad.MerchantBancario;
|
|
import com.rjconsultores.ventaboletos.entidad.UsuarioBancario;
|
|
import com.rjconsultores.ventaboletos.service.CompaniaBancariaService;
|
|
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;
|
|
|
|
/**
|
|
*
|
|
* @author Rafius
|
|
*/
|
|
@Service("companiaBancariaService")
|
|
public class CompaniaBancariaServiceImpl implements CompaniaBancariaService {
|
|
|
|
@Autowired
|
|
private CompaniaBancariaDAO companiaBancariaDAO;
|
|
|
|
public List<CompaniaBancaria> obtenerTodos() {
|
|
return companiaBancariaDAO.obtenerTodos();
|
|
}
|
|
|
|
public CompaniaBancaria obtenerID(Integer id) {
|
|
return companiaBancariaDAO.obtenerID(id);
|
|
}
|
|
|
|
@Transactional
|
|
public CompaniaBancaria suscribir(CompaniaBancaria entidad) {
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.TRUE);
|
|
|
|
return companiaBancariaDAO.suscribir(entidad);
|
|
}
|
|
|
|
@Transactional
|
|
public CompaniaBancaria actualizacion(CompaniaBancaria entidad) {
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.TRUE);
|
|
|
|
return companiaBancariaDAO.actualizacion(entidad);
|
|
}
|
|
|
|
@Transactional
|
|
public void borrar(CompaniaBancaria entidad) {
|
|
entidad = this.obtenerID(entidad.getCompaniabancariaId());
|
|
|
|
for (UsuarioBancario u : entidad.getUsuarioBancarioList()) {
|
|
u.setActivo(Boolean.FALSE);
|
|
u.setFecmodif(Calendar.getInstance().getTime());
|
|
u.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
}
|
|
|
|
for (MerchantBancario m : entidad.getMerchantBancarioList()) {
|
|
m.setActivo(Boolean.FALSE);
|
|
m.setFecmodif(Calendar.getInstance().getTime());
|
|
m.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
}
|
|
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.FALSE);
|
|
|
|
companiaBancariaDAO.actualizacion(entidad);
|
|
}
|
|
|
|
public List<CompaniaBancaria> buscar(CompaniaBancaria companiaBancaria) {
|
|
return companiaBancariaDAO.buscar(companiaBancaria);
|
|
}
|
|
}
|