52 lines
2.0 KiB
Java
52 lines
2.0 KiB
Java
package com.rjconsultores.ventaboletos.service.impl;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import com.rjconsultores.ventaboletos.constantes.ConstantesVendaEmbarcada;
|
|
import com.rjconsultores.ventaboletos.dao.CajaDAO;
|
|
import com.rjconsultores.ventaboletos.dao.hibernate.CajaHibernateDAO;
|
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
|
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException;
|
|
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException;
|
|
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException;
|
|
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException;
|
|
import com.rjconsultores.ventaboletos.service.VendaEmbarcadaService;
|
|
import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO;
|
|
|
|
@Service("VendaEmbarcadaService")
|
|
public class VendaEmbarcadaServiceImpl implements VendaEmbarcadaService {
|
|
|
|
private static Logger log = org.slf4j.LoggerFactory.getLogger(CajaHibernateDAO.class);
|
|
|
|
@Autowired
|
|
CajaDAO cajaDao;
|
|
|
|
@Override
|
|
public int gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws BusinessException {
|
|
try {
|
|
cajaDao.gerarVendaEmbarcada(vendaEmbarcada);
|
|
|
|
return ConstantesVendaEmbarcada.VENDA_GERADA;
|
|
} catch (VendaEmbarcadaBoletoException e) {
|
|
log.error(e.getMessage(), e);
|
|
return ConstantesVendaEmbarcada.VENDA_BOLETO_ERROR;
|
|
} catch (VendaEmbarcadaBoletoFormapagoException e) {
|
|
log.error(e.getMessage(), e);
|
|
return ConstantesVendaEmbarcada.VENDA_BOLETO_FORMAPAGO_ERROR;
|
|
} catch (VendaEmbarcadaCajaException e) {
|
|
log.error(e.getMessage(), e);
|
|
return ConstantesVendaEmbarcada.VENDA_CAJA_ERROR;
|
|
} catch (VendaEmbarcadaCajaFormapagoException e) {
|
|
log.error(e.getMessage(), e);
|
|
return ConstantesVendaEmbarcada.VENDA_CAJA_FORMAPAGO_ERROR;
|
|
} catch (Exception e) {
|
|
log.error(e.getMessage(), e);
|
|
throw new BusinessException(e.getMessage(), e);
|
|
}
|
|
|
|
}
|
|
|
|
}
|