Refatoração do método de salvar empresa.
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32415 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
3318c94796
commit
01c442d10f
|
@ -100,7 +100,7 @@
|
||||||
<classpathentry kind="lib" path="/LibreriasAdmVenta/zweb.jar"/>
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zweb.jar"/>
|
||||||
<classpathentry kind="lib" path="/LibreriasAdmVenta/jfreechart-1.0.12.jar"/>
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jfreechart-1.0.12.jar"/>
|
||||||
<classpathentry kind="lib" path="/LibreriasAdmVenta/poi-3.8-20120326.jar"/>
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/poi-3.8-20120326.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|
|
@ -8,12 +8,23 @@ import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
*/
|
*/
|
||||||
public interface EmpresaService extends GenericService<Empresa, Integer> {
|
public interface EmpresaService {
|
||||||
|
|
||||||
|
public List<Empresa> obtenerTodos();
|
||||||
|
|
||||||
|
public Empresa obtenerID(Integer id);
|
||||||
|
|
||||||
|
public Empresa suscribir(Empresa entidad);
|
||||||
|
|
||||||
|
public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException;
|
||||||
|
|
||||||
|
public void borrar(Empresa entidad);
|
||||||
|
|
||||||
public List<Empresa> buscar(String nombempresa, Boolean indExterna, Short indTipo);
|
public List<Empresa> buscar(String nombempresa, Boolean indExterna, Short indTipo);
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,13 @@ import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@ -45,12 +48,28 @@ public class EmpresaServiceImpl implements EmpresaService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Empresa actualizacion(Empresa entidad) {
|
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 (!lsEmpresa.isEmpty()) {
|
||||||
|
throw new BusinessException("MSG.Registro.Existe");
|
||||||
|
}
|
||||||
|
return empresaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lsEmpresa.get(0).getEmpresaId() != entidad.getEmpresaId()){
|
||||||
|
throw new BusinessException("MSG.Registro.Existe");
|
||||||
|
}
|
||||||
return empresaDAO.actualizacion(entidad);
|
return empresaDAO.actualizacion(entidad);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
Loading…
Reference in New Issue