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.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<Empresa> 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<Empresa> obtenerIndTipo1(Usuario usuario) {
// return empresaDAO.obtenerIndTipo1(usuario);
// }
public List<Empresa> obtenerIndTipo2() {
return empresaDAO.obtenerIndTipo2();
}