|
|
@ -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,16 +47,25 @@ 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
|
|
|
|
private ConferenciaComissaoDAO conferenciaComissaoDAO;
|
|
|
|
private ConferenciaComissaoDAO conferenciaComissaoDAO;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private EmpresaDAO empresaDAO;
|
|
|
|
private EmpresaDAO empresaDAO;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private PuntoVentaDAO puntoVentaDAO;
|
|
|
|
private PuntoVentaDAO puntoVentaDAO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
ConstanteService constanteService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Conferencia> obtenerTodos() {
|
|
|
|
public List<Conferencia> obtenerTodos() {
|
|
|
@ -146,17 +158,17 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException {
|
|
|
|
public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException {
|
|
|
|
if(boletoComissaos == null) {
|
|
|
|
if (boletoComissaos == null) {
|
|
|
|
boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia);
|
|
|
|
boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(boletoStatusComissao == null) {
|
|
|
|
if (boletoStatusComissao == null) {
|
|
|
|
return boletoComissaos;
|
|
|
|
return boletoComissaos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Empresa empresa = empresaDAO.obtenerID(conferencia.getEmpresa().getEmpresaId());
|
|
|
|
Empresa empresa = empresaDAO.obtenerID(conferencia.getEmpresa().getEmpresaId());
|
|
|
|
ComEmpConferencia comEmpConferencia = null;
|
|
|
|
ComEmpConferencia comEmpConferencia = null;
|
|
|
|
if(empresa.getComEmpConferencias() != null && !empresa.getComEmpConferencias().isEmpty()) {
|
|
|
|
if (empresa.getComEmpConferencias() != null && !empresa.getComEmpConferencias().isEmpty()) {
|
|
|
|
comEmpConferencia = empresa.getComEmpConferencias().iterator().next();
|
|
|
|
comEmpConferencia = empresa.getComEmpConferencias().iterator().next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -192,9 +204,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesManuais(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesManuais(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilhetesManualVendido()) {
|
|
|
|
if (boletoComissao.isBilhetesManualVendido()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetemanual());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetemanual());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -207,14 +219,14 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesVendidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesVendidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteNormalVendido() ||
|
|
|
|
if (boletoComissao.isBilheteNormalVendido() ||
|
|
|
|
boletoComissao.isBilheteEntregaGap() ||
|
|
|
|
boletoComissao.isBilheteEntregaGap() ||
|
|
|
|
boletoComissao.isBilheteNormalChekin() ||
|
|
|
|
boletoComissao.isBilheteNormalChekin() ||
|
|
|
|
boletoComissao.isBilheteAberto() ||
|
|
|
|
boletoComissao.isBilheteAberto() ||
|
|
|
|
boletoComissao.isBilheteConfirmaAbertoTroca() ||
|
|
|
|
boletoComissao.isBilheteConfirmaAbertoTroca() ||
|
|
|
|
boletoComissao.isBilheteEntregaAberto()) {
|
|
|
|
boletoComissao.isBilheteEntregaAberto()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -228,12 +240,12 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesCancelados(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesCancelados(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteNormalCancelado() ||
|
|
|
|
if (boletoComissao.isBilheteNormalCancelado() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocadoCancelado() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocadoCancelado() ||
|
|
|
|
boletoComissao.isBilheteConfirmadoAbertoCancelado() ||
|
|
|
|
boletoComissao.isBilheteConfirmadoAbertoCancelado() ||
|
|
|
|
boletoComissao.isBilheteEntregaGapCancelado()) {
|
|
|
|
boletoComissao.isBilheteEntregaGapCancelado()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetecancelado());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetecancelado());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -247,25 +259,25 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesDevolvidos(List<BoletoComissao> boletoComissaos, boolean pesquisa, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesDevolvidos(List<BoletoComissao> boletoComissaos, boolean pesquisa, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteNormalDevolvido() ||
|
|
|
|
if (boletoComissao.isBilheteNormalDevolvido() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocado() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocado() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocadoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteNormalTrocadoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteTrocadoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteTrocadoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteNormalTransferidoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteNormalTransferidoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteNormalTransferidoTrocado() ||
|
|
|
|
boletoComissao.isBilheteNormalTransferidoTrocado() ||
|
|
|
|
boletoComissao.isBilheteAbertoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteAbertoDevolvido() ||
|
|
|
|
boletoComissao.isBilheteAbertoDevolvidoTrocado() ||
|
|
|
|
boletoComissao.isBilheteAbertoDevolvidoTrocado() ||
|
|
|
|
boletoComissao.isBilheteEntregaGapDevolvido() ||
|
|
|
|
boletoComissao.isBilheteEntregaGapDevolvido() ||
|
|
|
|
boletoComissao.isBilheteEntregaGapTrocado()) {
|
|
|
|
boletoComissao.isBilheteEntregaGapTrocado()) {
|
|
|
|
|
|
|
|
|
|
|
|
boletoComissao.setExigeConferenciaDevolvido(boletoComissao.getIndcarboletosdevolvidosconf() != null && !boletoComissao.getIndcarboletosdevolvidosconf());
|
|
|
|
boletoComissao.setExigeConferenciaDevolvido(boletoComissao.getIndcarboletosdevolvidosconf() != null && !boletoComissao.getIndcarboletosdevolvidosconf());
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetedevolvido());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetedevolvido());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(pesquisa ||
|
|
|
|
if (pesquisa ||
|
|
|
|
((boletoComissao.getIndcarboletosdevolvidosconf() != null && boletoComissao.getIndcarboletosdevolvidosconf()) || boletoComissao.getLogconferenciaId() != null)) {
|
|
|
|
((boletoComissao.getIndcarboletosdevolvidosconf() != null && boletoComissao.getIndcarboletosdevolvidosconf()) || boletoComissao.getLogconferenciaId() != null)) {
|
|
|
|
boletos.add(boletoComissao);
|
|
|
|
boletos.add(boletoComissao);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -277,9 +289,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapsVendidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapsVendidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteGapVendido()) {
|
|
|
|
if (boletoComissao.isBilheteGapVendido()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapvendido());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapvendido());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -293,9 +305,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapCancelados(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapCancelados(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteGapCancelado()) {
|
|
|
|
if (boletoComissao.isBilheteGapCancelado()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapcancelado());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapcancelado());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -308,10 +320,10 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapDevolvidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
private Set<BoletoComissao> carregarBilhetesGapDevolvidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isBilheteGapDevolvido() ||
|
|
|
|
if (boletoComissao.isBilheteGapDevolvido() ||
|
|
|
|
boletoComissao.isBilheteGapTrocado()) {
|
|
|
|
boletoComissao.isBilheteGapTrocado()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(comEmpConferencia != null) {
|
|
|
|
if (comEmpConferencia != null) {
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapdevolvido());
|
|
|
|
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapdevolvido());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -342,8 +354,8 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean isBilhetesSemConferencia(List<BoletoComissao> lsBoletoComissao) throws BusinessException {
|
|
|
|
public boolean isBilhetesSemConferencia(List<BoletoComissao> lsBoletoComissao) throws BusinessException {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
if((boletoComissao.isExigeConferencia() || boletoComissao.isExigeConferenciaAba() || boletoComissao.isExigeConferenciaBoletoDevolvido()) &&
|
|
|
|
if ((boletoComissao.isExigeConferencia() || boletoComissao.isExigeConferenciaAba() || boletoComissao.isExigeConferenciaBoletoDevolvido()) &&
|
|
|
|
(!boletoComissao.isConferido() && boletoComissao.getLogconferenciaId() == null)) {
|
|
|
|
(!boletoComissao.isConferido() && boletoComissao.getLogconferenciaId() == null)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -353,8 +365,8 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean isEventosFinanceirosSemConferencia(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException {
|
|
|
|
public boolean isEventosFinanceirosSemConferencia(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException {
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
if((eventosFinanceiros.isExigeConferencia() || (eventosFinanceiros.getExigeConferenciaAba() != null && eventosFinanceiros.getExigeConferenciaAba())) &&
|
|
|
|
if ((eventosFinanceiros.isExigeConferencia() || (eventosFinanceiros.getExigeConferenciaAba() != null && eventosFinanceiros.getExigeConferenciaAba())) &&
|
|
|
|
(!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) {
|
|
|
|
(!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -364,14 +376,14 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException {
|
|
|
|
public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException {
|
|
|
|
List<IndStatusBoleto> lStatusBilhete = null;
|
|
|
|
List<IndStatusBoleto> lStatusBilhete = null;
|
|
|
|
if(statusBilhete != null && statusBilhete.length > 0) {
|
|
|
|
if (statusBilhete != null && statusBilhete.length > 0) {
|
|
|
|
lStatusBilhete = Arrays.asList(statusBilhete);
|
|
|
|
lStatusBilhete = Arrays.asList(statusBilhete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
|
if(lsBoletoComissao != null) {
|
|
|
|
if (lsBoletoComissao != null) {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
if(lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) {
|
|
|
|
if (lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) {
|
|
|
|
total = total.add(boletoComissao.getTotal());
|
|
|
|
total = total.add(boletoComissao.getTotal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -384,13 +396,13 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
BigDecimal totalDevolvidos = BigDecimal.ZERO;
|
|
|
|
BigDecimal totalDevolvidos = BigDecimal.ZERO;
|
|
|
|
BigDecimal totalTroca = BigDecimal.ZERO;
|
|
|
|
BigDecimal totalTroca = BigDecimal.ZERO;
|
|
|
|
BigDecimal totalOcd = BigDecimal.ZERO;
|
|
|
|
BigDecimal totalOcd = BigDecimal.ZERO;
|
|
|
|
if(lsBoletoComissao != null) {
|
|
|
|
if (lsBoletoComissao != null) {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
|
|
|
if(boletoComissao.isOcd()) {
|
|
|
|
if (boletoComissao.isOcd()) {
|
|
|
|
totalOcd = totalOcd.add(boletoComissao.getTotal());
|
|
|
|
totalOcd = totalOcd.add(boletoComissao.getTotal());
|
|
|
|
} else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionDevolvido()) {
|
|
|
|
} else if (boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionDevolvido()) {
|
|
|
|
totalDevolvidos = totalDevolvidos.add(boletoComissao.getTotal());
|
|
|
|
totalDevolvidos = totalDevolvidos.add(boletoComissao.getTotal());
|
|
|
|
} else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionTrocado()) {
|
|
|
|
} else if (boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionTrocado()) {
|
|
|
|
totalTroca = totalTroca.add(boletoComissao.getTotal());
|
|
|
|
totalTroca = totalTroca.add(boletoComissao.getTotal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -405,7 +417,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BigDecimal totalizarEventosFinanceiros(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException {
|
|
|
|
public BigDecimal totalizarEventosFinanceiros(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException {
|
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
|
if(lsEventosFinanceiros != null) {
|
|
|
|
if (lsEventosFinanceiros != null) {
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
total = total.add(eventosFinanceiros.getImpingreso());
|
|
|
|
total = total.add(eventosFinanceiros.getImpingreso());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -419,7 +431,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
total.setValorPagar(BigDecimal.ZERO);
|
|
|
|
total.setValorPagar(BigDecimal.ZERO);
|
|
|
|
total.setPenalizacion(BigDecimal.ZERO);
|
|
|
|
total.setPenalizacion(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
|
|
|
|
if(lsOcd != null) {
|
|
|
|
if (lsOcd != null) {
|
|
|
|
for (OcdVO ocd : lsOcd) {
|
|
|
|
for (OcdVO ocd : lsOcd) {
|
|
|
|
total.setValorPagar(total.getValorPagar().add(ocd.getValorPagar()));
|
|
|
|
total.setValorPagar(total.getValorPagar().add(ocd.getValorPagar()));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -429,8 +441,8 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ResumoComissao gerarResumo(Conferencia conferencia, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos,
|
|
|
|
public ResumoComissao gerarResumo(Conferencia conferencia, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos,
|
|
|
|
BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados,
|
|
|
|
BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados,
|
|
|
|
BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException {
|
|
|
|
BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException {
|
|
|
|
ResumoComissao resumoComissao = new ResumoComissao();
|
|
|
|
ResumoComissao resumoComissao = new ResumoComissao();
|
|
|
|
resumoComissao.setTotalDevolvidos(totalBilhetesDevolvidos.add(totalBilhetesGapDevolvidos));
|
|
|
|
resumoComissao.setTotalDevolvidos(totalBilhetesDevolvidos.add(totalBilhetesGapDevolvidos));
|
|
|
|
resumoComissao.setTotalCancelados(totalBilhetesCancelados.add(totalBilhetesGapCancelados));
|
|
|
|
resumoComissao.setTotalCancelados(totalBilhetesCancelados.add(totalBilhetesGapCancelados));
|
|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -449,21 +462,21 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
private void carregarTotalFormapago(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
|
|
|
|
private void carregarTotalFormapago(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
|
|
|
|
List<FormapagoVO> totalFormapagos = new ArrayList<FormapagoVO>();
|
|
|
|
List<FormapagoVO> totalFormapagos = new ArrayList<FormapagoVO>();
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
for (BoletoComissao boletoComissao : boletoComissaos) {
|
|
|
|
if(boletoComissao.isTotalizarFormapago()) {
|
|
|
|
if (boletoComissao.isTotalizarFormapago()) {
|
|
|
|
|
|
|
|
|
|
|
|
for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) {
|
|
|
|
for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) {
|
|
|
|
FormapagoVO formapago;
|
|
|
|
FormapagoVO formapago;
|
|
|
|
if(totalFormapagos.contains(formapagoBoleto)) {
|
|
|
|
if (totalFormapagos.contains(formapagoBoleto)) {
|
|
|
|
formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoBoleto));
|
|
|
|
formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoBoleto));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
formapago = new FormapagoVO(formapagoBoleto.getFormapagoId(), formapagoBoleto.getDescpago(), null, BigDecimal.ZERO);
|
|
|
|
formapago = new FormapagoVO(formapagoBoleto.getFormapagoId(), formapagoBoleto.getDescpago(), null, BigDecimal.ZERO);
|
|
|
|
totalFormapagos.add(formapagoBoleto);
|
|
|
|
totalFormapagos.add(formapagoBoleto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(boletoComissao.isStatusVendido() || boletoComissao.isStatusTroca()) {
|
|
|
|
if (boletoComissao.isStatusVendido() || boletoComissao.isStatusTroca()) {
|
|
|
|
formapago.add(formapagoBoleto.getImporte());
|
|
|
|
formapago.add(formapagoBoleto.getImporte());
|
|
|
|
} else if(boletoComissao.isStatusCancelado() &&
|
|
|
|
} else if (boletoComissao.isStatusCancelado() &&
|
|
|
|
(boletoComissao.isMotivocancelacionCancelado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionTrocado())) {
|
|
|
|
(boletoComissao.isMotivocancelacionCancelado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionTrocado())) {
|
|
|
|
formapago.subtract(formapagoBoleto.getImporte());
|
|
|
|
formapago.subtract(formapagoBoleto.getImporte());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -473,15 +486,15 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
|
|
|
|
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
|
|
|
|
FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, BigDecimal.ZERO);
|
|
|
|
FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, BigDecimal.ZERO);
|
|
|
|
if(totalFormapagos.contains(formapagoEventoFinanceiro)) {
|
|
|
|
if (totalFormapagos.contains(formapagoEventoFinanceiro)) {
|
|
|
|
formapagoEventoFinanceiro = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro));
|
|
|
|
formapagoEventoFinanceiro = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
totalFormapagos.add(formapagoEventoFinanceiro);
|
|
|
|
totalFormapagos.add(formapagoEventoFinanceiro);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(eventosFinanceiros.isCredito()) {
|
|
|
|
if (eventosFinanceiros.isCredito()) {
|
|
|
|
formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso());
|
|
|
|
formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso());
|
|
|
|
} else if(eventosFinanceiros.isDebito()) {
|
|
|
|
} else if (eventosFinanceiros.isDebito()) {
|
|
|
|
formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso());
|
|
|
|
formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -492,24 +505,24 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException {
|
|
|
|
public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
EtiquetaMalote etiquetaMalote = new EtiquetaMalote();
|
|
|
|
EtiquetaMalote etiquetaMalote = new EtiquetaMalote();
|
|
|
|
log.debug("Empresa: " + codigoBarras.substring(0,4));
|
|
|
|
log.debug("Empresa: " + codigoBarras.substring(0, 4));
|
|
|
|
etiquetaMalote.setEmpresaId(Integer.valueOf(codigoBarras.substring(0,4)));
|
|
|
|
etiquetaMalote.setEmpresaId(Integer.valueOf(codigoBarras.substring(0, 4)));
|
|
|
|
log.debug("Punto Venta: " + codigoBarras.substring(4,9));
|
|
|
|
log.debug("Punto Venta: " + codigoBarras.substring(4, 9));
|
|
|
|
etiquetaMalote.setPuntoventaId(Integer.valueOf(codigoBarras.substring(4,9)));
|
|
|
|
etiquetaMalote.setPuntoventaId(Integer.valueOf(codigoBarras.substring(4, 9)));
|
|
|
|
log.debug("Numero Malote: " + codigoBarras.substring(9,19));
|
|
|
|
log.debug("Numero Malote: " + codigoBarras.substring(9, 19));
|
|
|
|
etiquetaMalote.setNumeroMalote(codigoBarras.substring(9,19));
|
|
|
|
etiquetaMalote.setNumeroMalote(codigoBarras.substring(9, 19));
|
|
|
|
log.debug("Data inicial: " + codigoBarras.substring(19,27));
|
|
|
|
log.debug("Data inicial: " + codigoBarras.substring(19, 27));
|
|
|
|
etiquetaMalote.setDataInicial(DateUtil.getDateFromString(codigoBarras.substring(19,27), "ddMMyyyy"));
|
|
|
|
etiquetaMalote.setDataInicial(DateUtil.getDateFromString(codigoBarras.substring(19, 27), "ddMMyyyy"));
|
|
|
|
log.debug("Data final: " + codigoBarras.substring(27,35));
|
|
|
|
log.debug("Data final: " + codigoBarras.substring(27, 35));
|
|
|
|
etiquetaMalote.setDataFinal(DateUtil.getDateFromString(codigoBarras.substring(27,35), "ddMMyyyy"));
|
|
|
|
etiquetaMalote.setDataFinal(DateUtil.getDateFromString(codigoBarras.substring(27, 35), "ddMMyyyy"));
|
|
|
|
|
|
|
|
|
|
|
|
Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId());
|
|
|
|
Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId());
|
|
|
|
if(empresa == null) {
|
|
|
|
if (empresa == null) {
|
|
|
|
throw new BusinessException("recebimentoMaloteController.msg.erro.empresaNaoLocalizada");
|
|
|
|
throw new BusinessException("recebimentoMaloteController.msg.erro.empresaNaoLocalizada");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
etiquetaMalote.setNombempresa(empresa.getNombempresa());
|
|
|
|
etiquetaMalote.setNombempresa(empresa.getNombempresa());
|
|
|
|
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId());
|
|
|
|
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId());
|
|
|
|
if(puntoVenta == null) {
|
|
|
|
if (puntoVenta == null) {
|
|
|
|
throw new BusinessException("recebimentoMaloteController.msg.erro.puntoVentaNaoLocalizado");
|
|
|
|
throw new BusinessException("recebimentoMaloteController.msg.erro.puntoVentaNaoLocalizado");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
etiquetaMalote.setNombpuntoventa(puntoVenta.getNombpuntoventa());
|
|
|
|
etiquetaMalote.setNombpuntoventa(puntoVenta.getNombpuntoventa());
|
|
|
@ -539,7 +552,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
|
|
|
|
|
|
|
|
while (cDataInicial.compareTo(cDataFinal) <= 0) {
|
|
|
|
while (cDataInicial.compareTo(cDataFinal) <= 0) {
|
|
|
|
Conferencia conferencia = obtenerConferenciaDataMovimento(cDataInicial.getTime(), etiquetaMalote.getPuntoventaId(), etiquetaMalote.getEmpresaId());
|
|
|
|
Conferencia conferencia = obtenerConferenciaDataMovimento(cDataInicial.getTime(), etiquetaMalote.getPuntoventaId(), etiquetaMalote.getEmpresaId());
|
|
|
|
if(conferencia == null) {
|
|
|
|
if (conferencia == null) {
|
|
|
|
conferencia = new Conferencia();
|
|
|
|
conferencia = new Conferencia();
|
|
|
|
conferencia.setDatamovimento(cDataInicial.getTime());
|
|
|
|
conferencia.setDatamovimento(cDataInicial.getTime());
|
|
|
|
conferencia.setEmpresa(empresa);
|
|
|
|
conferencia.setEmpresa(empresa);
|
|
|
@ -549,7 +562,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cDataInicial.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
cDataInicial.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
|
|
|
|
|
|
|
if(conferencia != null && conferencia.getIndmaloterecebido()) {
|
|
|
|
if (conferencia != null && conferencia.getIndmaloterecebido()) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
confirmarChegadaMalote(conferencia);
|
|
|
|
confirmarChegadaMalote(conferencia);
|
|
|
@ -572,7 +585,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean isOcdSemConferencia(List<OcdVO> lsOcd) throws BusinessException {
|
|
|
|
public boolean isOcdSemConferencia(List<OcdVO> lsOcd) throws BusinessException {
|
|
|
|
for (OcdVO ocd : lsOcd) {
|
|
|
|
for (OcdVO ocd : lsOcd) {
|
|
|
|
if(ocd.isExigeConferenciaAba() && (!ocd.isConferido() && ocd.getLogconferenciaId() == null)) {
|
|
|
|
if (ocd.isExigeConferenciaAba() && (!ocd.isConferido() && ocd.getLogconferenciaId() == null)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -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"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|