fixes bug #7905
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@60763 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0654b60d2d
commit
88f07cf982
|
@ -31,4 +31,6 @@ public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
|
||||||
public List<PuntoVenta> buscarPuntosVentaMovimentacionBilhetes(List<Empresa> empresas);
|
public List<PuntoVenta> buscarPuntosVentaMovimentacionBilhetes(List<Empresa> empresas);
|
||||||
|
|
||||||
public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque);
|
public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque);
|
||||||
|
|
||||||
|
public Integer quantidadeECFPorPuntoVenta(Integer empresaID, Integer puntoVentaID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Order;
|
import org.hibernate.criterion.Order;
|
||||||
|
@ -15,6 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
|
@ -57,7 +58,6 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
||||||
return c.list();
|
return c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos) {
|
public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
|
||||||
|
@ -65,13 +65,11 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
||||||
|
|
||||||
Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE);
|
Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
|
||||||
if (sinTodos) {
|
if (sinTodos) {
|
||||||
Criterion crSinTodos = Restrictions.ne("puntoventaId", ID_PUNTO_VENTA_TODOS);
|
Criterion crSinTodos = Restrictions.ne("puntoventaId", ID_PUNTO_VENTA_TODOS);
|
||||||
c.add(crSinTodos);
|
c.add(crSinTodos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento();
|
PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento();
|
||||||
PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade();
|
PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade();
|
||||||
|
|
||||||
|
@ -193,4 +191,23 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
||||||
|
|
||||||
return puntosVenta;
|
return puntosVenta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer quantidadeECFPorPuntoVenta(Integer empresaID, Integer puntoVentaID) {
|
||||||
|
String query = "SELECT sum(NECF) numeroECF "
|
||||||
|
+ " FROM (SELECT count(e.ESTACION_ID) AS NECF "
|
||||||
|
+ " FROM ESTACION e "
|
||||||
|
+ " INNER JOIN ESTACION_IMPRESORA ei ON ei.ESTACION_ID = e.ESTACION_ID "
|
||||||
|
+ " WHERE ei.TIPOIMPRESSORA = 1 "
|
||||||
|
+ " AND ei.ACTIVO = 1 "
|
||||||
|
+ " AND e.PUNTOVENTA_ID = :punto_venta_id "
|
||||||
|
+ " AND ei.EMPRESA_ID = :empresa_id "
|
||||||
|
+ " GROUP BY e.ESTACION_ID)";
|
||||||
|
|
||||||
|
Query q = getSession().createSQLQuery(query);
|
||||||
|
q.setInteger("punto_venta_id", puntoVentaID);
|
||||||
|
q.setInteger("empresa_id", empresaID);
|
||||||
|
BigDecimal quantidadeEcf = (BigDecimal) q.uniqueResult();
|
||||||
|
return quantidadeEcf == null ? 0 : quantidadeEcf.intValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,4 +75,7 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
|
||||||
|
|
||||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
|
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
|
||||||
|
|
||||||
|
public Integer quantidadeECFPorPuntoVenta(Integer empresaID, Integer puntoVentaID);
|
||||||
|
|
||||||
|
public void enviarEmailIrregularidadeECF(String email, String msg,String assunto)throws Exception ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,6 @@ package com.rjconsultores.ventaboletos.service;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Administrador
|
|
||||||
*/
|
|
||||||
public interface ConstanteService extends GenericService<Constante, Integer> {
|
public interface ConstanteService extends GenericService<Constante, Integer> {
|
||||||
|
|
||||||
public Constante buscarPorNomeConstante(String nomeConstante);
|
public Constante buscarPorNomeConstante(String nomeConstante);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
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.zkoss.util.resource.Labels;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO;
|
import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||||
|
@ -28,8 +29,10 @@ import com.rjconsultores.ventaboletos.enums.IndStatusBoleto;
|
||||||
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
|
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
|
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
|
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.SendMail;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
||||||
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
|
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
|
||||||
|
@ -44,6 +47,12 @@ import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao;
|
||||||
@Service("conferenciaComissaoService")
|
@Service("conferenciaComissaoService")
|
||||||
public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService {
|
public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService {
|
||||||
|
|
||||||
|
private static final String SMTP_HOST = "SMTP_HOST";
|
||||||
|
private static final String SMTP_USER = "SMTP_USER";
|
||||||
|
private static final String SMTP_EMAIL = "SMTP_EMAIL";
|
||||||
|
private static final String SMTP_PORT = "SMTP_PORT";
|
||||||
|
private static final String SMTP_PASS = "SMTP_PASS";
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(ConferenciaComissaoService.class);
|
private static Logger log = Logger.getLogger(ConferenciaComissaoService.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -55,6 +64,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
@Autowired
|
@Autowired
|
||||||
private PuntoVentaDAO puntoVentaDAO;
|
private PuntoVentaDAO puntoVentaDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConstanteService constanteService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Conferencia> obtenerTodos() {
|
public List<Conferencia> obtenerTodos() {
|
||||||
return conferenciaComissaoDAO.obtenerTodos();
|
return conferenciaComissaoDAO.obtenerTodos();
|
||||||
|
@ -442,6 +454,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros);
|
carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros);
|
||||||
|
|
||||||
resumoComissao.setValorDeposito(conferenciaComissaoDAO.carregarValorDepositoContaCorrente(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento()));
|
resumoComissao.setValorDeposito(conferenciaComissaoDAO.carregarValorDepositoContaCorrente(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento()));
|
||||||
|
resumoComissao.setQuantidadeEcf(puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId()));
|
||||||
|
|
||||||
return resumoComissao;
|
return resumoComissao;
|
||||||
}
|
}
|
||||||
|
@ -584,4 +597,39 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta);
|
return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer quantidadeECFPorPuntoVenta(Integer empresaID, Integer puntoVentaID) {
|
||||||
|
return puntoVentaDAO.quantidadeECFPorPuntoVenta(empresaID, puntoVentaID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enviarEmailIrregularidadeECF(String email, String msg, String assunto) throws Exception {
|
||||||
|
SendMail sendMail = new SendMail();
|
||||||
|
String host = constanteService.buscarPorNomeConstante(SMTP_HOST).getValorconstante();
|
||||||
|
String user = constanteService.buscarPorNomeConstante(SMTP_USER).getValorconstante();
|
||||||
|
String emailFrom = constanteService.buscarPorNomeConstante(SMTP_EMAIL).getValorconstante();
|
||||||
|
String port = constanteService.buscarPorNomeConstante(SMTP_PORT).getValorconstante();
|
||||||
|
String password = constanteService.buscarPorNomeConstante(SMTP_PASS).getValorconstante();
|
||||||
|
|
||||||
|
verificarDadosEmail(Arrays.asList(host, user, emailFrom, port, password));
|
||||||
|
|
||||||
|
sendMail.setSmtpHost(host);
|
||||||
|
sendMail.setSmtpUser(user);
|
||||||
|
sendMail.setSmtpPassword(password);
|
||||||
|
sendMail.setSmtpPort(port);
|
||||||
|
sendMail.setEmailFrom(emailFrom);
|
||||||
|
sendMail.setEmailTo(email);
|
||||||
|
sendMail.setSubject(assunto);
|
||||||
|
sendMail.setText(msg);
|
||||||
|
sendMail.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verificarDadosEmail(List<String> asList) throws Exception {
|
||||||
|
for (String s : asList) {
|
||||||
|
if (s == null || s.isEmpty()) {
|
||||||
|
throw new Exception(Labels.getLabel("informeIrregularidadeController.mail.configuracoes"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class ResumoComissao {
|
||||||
private BigDecimal totalReceitas;
|
private BigDecimal totalReceitas;
|
||||||
private BigDecimal totalDespesas;
|
private BigDecimal totalDespesas;
|
||||||
private BigDecimal valorDeposito;
|
private BigDecimal valorDeposito;
|
||||||
|
private Integer quantidadeEcf;
|
||||||
private OcdVO totalOcd;
|
private OcdVO totalOcd;
|
||||||
|
|
||||||
private List<FormapagoVO> totalFormapago;
|
private List<FormapagoVO> totalFormapago;
|
||||||
|
@ -83,6 +84,14 @@ public class ResumoComissao {
|
||||||
this.totalFormapago = totalFormapago;
|
this.totalFormapago = totalFormapago;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getQuantidadeEcf() {
|
||||||
|
return quantidadeEcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantidadeEcf(Integer quantidadeEcf) {
|
||||||
|
this.quantidadeEcf = quantidadeEcf;
|
||||||
|
}
|
||||||
|
|
||||||
public OcdVO getTotalOcd() {
|
public OcdVO getTotalOcd() {
|
||||||
return totalOcd;
|
return totalOcd;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue