82 lines
2.9 KiB
Java
82 lines
2.9 KiB
Java
package com.rjconsultores.ventaboletos.service.impl;
|
|
|
|
import java.util.Calendar;
|
|
import java.util.List;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import com.rjconsultores.ventaboletos.dao.ConfRestricaoVendaWebDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb;
|
|
import com.rjconsultores.ventaboletos.service.ConfRestricaoVendaWebService;
|
|
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
|
|
|
|
|
@Service("confRestricaoVendaWebService")
|
|
public class ConfRestricaoVendaWebServiceImpl implements ConfRestricaoVendaWebService{
|
|
|
|
@Autowired
|
|
private ConfRestricaoVendaWebDAO confRestricaoVendaWebDAO;
|
|
private static Logger log = LoggerFactory.getLogger(ConfRestricaoVendaWebServiceImpl.class);
|
|
@Autowired
|
|
private LogAuditoriaService logAuditoriaService;
|
|
|
|
|
|
@Override
|
|
@Transactional
|
|
public ConfRestricaoVendaWeb suscribir(ConfRestricaoVendaWeb entidad) {
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.TRUE);
|
|
|
|
confRestricaoVendaWebDAO.suscribir(entidad);
|
|
logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
|
return entidad;
|
|
}
|
|
|
|
@Override
|
|
public ConfRestricaoVendaWeb obtenerID(Integer id) {
|
|
return confRestricaoVendaWebDAO.obtenerID(id);
|
|
}
|
|
|
|
@Override
|
|
public List<ConfRestricaoVendaWeb> obtenerTodos() {
|
|
return confRestricaoVendaWebDAO.obtenerTodos();
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public void borrar(ConfRestricaoVendaWeb entidad) {
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.FALSE);
|
|
confRestricaoVendaWebDAO.actualizacion(entidad);
|
|
logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
|
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public ConfRestricaoVendaWeb actualizacion(ConfRestricaoVendaWeb entidad) {
|
|
|
|
ConfRestricaoVendaWeb originalClone = null;
|
|
try {
|
|
originalClone = entidad.getCloneObject();
|
|
} catch (Exception e) {
|
|
log.error("Erro ao clonar TitularId",e);
|
|
}
|
|
|
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
entidad.setActivo(Boolean.TRUE);
|
|
confRestricaoVendaWebDAO.actualizacion(entidad);
|
|
logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
|
|
|
|
return entidad;
|
|
}
|
|
}
|