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
master
julio 2014-09-25 17:46:03 +00:00
parent 403274f269
commit 84457ed342
1 changed files with 10 additions and 29 deletions

View File

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