From 84457ed342db9defd66da4e5c4a2ae7022e09414 Mon Sep 17 00:00:00 2001 From: julio Date: Thu, 25 Sep 2014 17:46:03 +0000 Subject: [PATCH] Erro ao Editar empresa (fixed bug #5681) Tempo: 1 hora git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@38171 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../service/impl/EmpresaServiceImpl.java | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) 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(); }