diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java index 51af4b426..53c4ca453 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -17,11 +17,8 @@ import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; -import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.EmpresaService; -import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; -import com.rjconsultores.ventaboletos.service.RutaEmpresaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -49,30 +46,18 @@ public class EmpresaServiceImpl implements EmpresaService { return empresaDAO.obtenerID(id); } - @Transactional - public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); - - List lsEmpresa = - buscar(entidad.getNombempresa(), entidad.getIndExterna(), - entidad.getIndTipo()); + @Transactional + public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - if (entidad.getEmpresaId() == null) { - - if (!lsEmpresa.isEmpty()) { - throw new BusinessException("MSG.Registro.Existe"); - } + if (entidad.getEmpresaId() == null) { return empresaDAO.suscribir(entidad); - } - - if (lsEmpresa.get(0).getEmpresaId() != entidad.getEmpresaId()){ - throw new BusinessException("MSG.Registro.Existe"); - } - return empresaDAO.actualizacion(entidad); - - } + } else { + return empresaDAO.actualizacion(entidad); + } + } @Transactional public void borrar(Empresa entidad) throws RegistroConDependenciaException { @@ -101,10 +86,6 @@ public class EmpresaServiceImpl implements EmpresaService { return empresaDAO.obtenerIndExternoFalse(); } -// public List obtenerIndTipo1(Usuario usuario) { -// return empresaDAO.obtenerIndTipo1(usuario); -// } - public List obtenerIndTipo2() { return empresaDAO.obtenerIndTipo2(); }