fixes bug#AL-1425

qua:junia
dev:

Criado a função 'ADM > CATALOGO > PUNTO VENTA > PERMITE INSERIR MOTIVO DA INSERCAO/EXCLUSAO DA FORMA DE PAGAMENTO' para ser configurar por perfil
Somente com a função no perfil, será permitido inserir o motivo, na hora de realizar a inserção de forma de pagamento no ponto de venda

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@115540 d1611594-4594-4d17-8e1d-87c2c4800839
master
wallace.novo 2022-11-18 19:59:16 +00:00
parent e03e61f479
commit 69f2602b2e
7 changed files with 387 additions and 25 deletions

View File

@ -0,0 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
/**
*
* @author Wallace
*/
public interface HistoricoFormaPagoPuntoVentaDAO extends GenericDAO<HistoricoFormaPagoPuntoVenta, Integer> {
List<HistoricoFormaPagoPuntoVenta> obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta);
}

View File

@ -0,0 +1,49 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.HistoricoFormaPagoPuntoVentaDAO;
import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
/**
*
* @author Administrador
*/
@Repository("historicoFormaPagoPuntoVentaDAO")
public class HistoricoFormaPagoPuntoVentaHibernateDAO extends GenericHibernateDAO<HistoricoFormaPagoPuntoVenta, Integer> implements HistoricoFormaPagoPuntoVentaDAO {
@Autowired
public HistoricoFormaPagoPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<HistoricoFormaPagoPuntoVenta> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
@Override
public List<HistoricoFormaPagoPuntoVenta> obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("puntoVenta", puntoVenta));
return c.list();
}
}

View File

@ -0,0 +1,183 @@
package com.rjconsultores.ventaboletos.entidad;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.Hibernate;
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
import br.com.rjconsultores.auditador.interfaces.Auditavel;
@AuditarClasse(nome = "HistoricoFormaPagoPuntoVenta", tela = "Alteracao Forma Pago Ponto de Venda/Historico")
@Entity
@SequenceGenerator(name = "HIST_FORMAPAGOPUNTOVENTA_SEQ", sequenceName = "HIST_FORMAPAGOPUNTOVENTA_SEQ", allocationSize = 1)
@Table(name = "HIST_FORMAPAGO_PUNTOVENTA")
public class HistoricoFormaPagoPuntoVenta implements Serializable, Auditavel<HistoricoFormaPagoPuntoVenta> {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "HIST_FORMAPAGOPUNTOVENTA_SEQ")
@Column(name = "HIST_FORMAPAGO_PUNTOVENTA_ID")
private Integer historicoFormaPagoPuntoVentaId;
@Column(name = "IND_INCLUSAO")
private Boolean indInclusao;
@Column(name = "MOTIVO")
private String motivo;
@Column(name = "FEC_ALTERACAO")
@Temporal(TemporalType.TIMESTAMP)
private Date fecAlteracao;
@NaoAuditar
@ManyToOne
@JoinColumn(name = "PUNTOVENTA_ID")
private PuntoVenta puntoVenta;
@Column(name = "FORMAPAGO_ID")
private Integer formaPagoId;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@Column(name = "EMPRESA_ID")
private Integer empresaId;
@Transient
@NaoAuditar
private HistoricoFormaPagoPuntoVenta historicoPuntoVentaClone;
public Integer getHistoricoFormaPagoPuntoVentaId() {
return historicoFormaPagoPuntoVentaId;
}
public void setHistoricoFormaPagoPuntoVentaId(Integer historicoFormaPagoPuntoVentaId) {
this.historicoFormaPagoPuntoVentaId = historicoFormaPagoPuntoVentaId;
}
public Boolean getIndInclusao() {
return indInclusao;
}
public void setIndInclusao(Boolean indInclusao) {
this.indInclusao = indInclusao;
}
public Date getFecAlteracao() {
return fecAlteracao;
}
public void setFecAlteracao(Date fecAlteracao) {
this.fecAlteracao = fecAlteracao;
}
public HistoricoFormaPagoPuntoVenta getHistoricoPuntoVentaClone() {
return historicoPuntoVentaClone;
}
public void setHistoricoPuntoVentaClone(HistoricoFormaPagoPuntoVenta historicoPuntoVentaClone) {
this.historicoPuntoVentaClone = historicoPuntoVentaClone;
}
public PuntoVenta getPuntoVenta() {
return puntoVenta;
}
public void setPuntoVenta(PuntoVenta puntoVenta) {
this.puntoVenta = puntoVenta;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
public Integer getEmpresaId() {
return empresaId;
}
public void setEmpresaId(Integer empresaId) {
this.empresaId = empresaId;
}
public String getMotivo() {
return motivo;
}
public void setMotivo(String motivo) {
this.motivo = motivo;
}
public Integer getFormaPagoId() {
return formaPagoId;
}
public void setFormaPagoId(Integer formaPagoId) {
this.formaPagoId = formaPagoId;
}
@Override
public void clonar() throws CloneNotSupportedException {
historicoPuntoVentaClone = new HistoricoFormaPagoPuntoVenta();
historicoPuntoVentaClone = (HistoricoFormaPagoPuntoVenta) this.clone();
Hibernate.initialize(historicoPuntoVentaClone.getPuntoVenta());
}
@Override
public HistoricoFormaPagoPuntoVenta getCloneObject() throws CloneNotSupportedException {
return historicoPuntoVentaClone;
}
@Override
public String getTextoInclusaoExclusao() {
return String.format("ID [%s]", getHistoricoFormaPagoPuntoVentaId());
}
}

View File

@ -52,7 +52,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
*/
@Entity
@SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1)
@AuditarClasse(nome = "PuntoVenta", tela = "Alteração de Ponto de Venda")
@AuditarClasse(nome = "PuntoVenta", tela = "Altera<EFBFBD><EFBFBD>o de Ponto de Venda")
@Table(name = "PUNTO_VENTA")
public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
@ -259,6 +259,11 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
@LazyCollection(LazyCollectionOption.FALSE)
private List<HistoricoPuntoVenta> historicoPuntoVentaList;
@NaoAuditar
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta")
@LazyCollection(LazyCollectionOption.FALSE)
private List<HistoricoFormaPagoPuntoVenta> historicoFormaPagoPuntoVentaList;
@AuditarLista(auditarEntidades = true, nome = "CategoriaBloqueioImpPosterior")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa")
@LazyCollection(LazyCollectionOption.FALSE)
@ -430,6 +435,7 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
this.ptovtaCatIndList = new ArrayList<PtovtaCatInd>();
this.ptovtaEmpresaBloqueadaList = new ArrayList<PtovtaEmpresaBloqueada>();
this.historicoPuntoVentaList = new ArrayList<HistoricoPuntoVenta>();
this.historicoFormaPagoPuntoVentaList = new ArrayList<HistoricoFormaPagoPuntoVenta>();
}
public PuntoVenta(Integer puntoventaId) {
@ -1099,6 +1105,14 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
this.historicoPuntoVentaList = historicoPuntoVentaList;
}
public List<HistoricoFormaPagoPuntoVenta> getHistoricoFormaPagoPuntoVentaList() {
return historicoFormaPagoPuntoVentaList;
}
public void setHistoricoFormaPagoPuntoVentaList(List<HistoricoFormaPagoPuntoVenta> historicoFormaPagoPuntoVentaList) {
this.historicoFormaPagoPuntoVentaList = historicoFormaPagoPuntoVentaList;
}
public List<CategoriaBloqueioImpPosterior> getCategoriaBloqImpPosteriorList() {
return categoriaBloqImpPosteriorList;
}

View File

@ -0,0 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.service;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
/**
*
* @author Wallace
*/
public interface HistoricoFormaPagoPuntoVentaService extends GenericService<HistoricoFormaPagoPuntoVenta, Integer> {
List<HistoricoFormaPagoPuntoVenta> obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta);
}

View File

@ -0,0 +1,75 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.service.impl;
import java.util.Calendar;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.HistoricoFormaPagoPuntoVentaDAO;
import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.service.HistoricoFormaPagoPuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
/**
*
* @author Wallace
*/
@Service("historicoFormaPagoPuntoVentaService")
public class HistoricoFormaPagoPuntoVentaServiceImpl implements HistoricoFormaPagoPuntoVentaService {
@Autowired
private HistoricoFormaPagoPuntoVentaDAO historicoFormaPagoPuntoVentaDAO;
public List<HistoricoFormaPagoPuntoVenta> obtenerTodos() {
return historicoFormaPagoPuntoVentaDAO.obtenerTodos();
}
public HistoricoFormaPagoPuntoVenta obtenerID(Integer id) {
return historicoFormaPagoPuntoVentaDAO.obtenerID(id);
}
@Transactional
public HistoricoFormaPagoPuntoVenta suscribir(HistoricoFormaPagoPuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
entidad.setIndInclusao(Boolean.TRUE);
entidad.setFecAlteracao(Calendar.getInstance().getTime());
return historicoFormaPagoPuntoVentaDAO.suscribir(entidad);
}
@Transactional
public HistoricoFormaPagoPuntoVenta actualizacion(HistoricoFormaPagoPuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return historicoFormaPagoPuntoVentaDAO.actualizacion(entidad);
}
@Transactional
public void borrar(HistoricoFormaPagoPuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
entidad.setIndInclusao(Boolean.FALSE);
entidad.setFecAlteracao(Calendar.getInstance().getTime());
historicoFormaPagoPuntoVentaDAO.actualizacion(entidad);
}
@Override
public List<HistoricoFormaPagoPuntoVenta> obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta) {
return historicoFormaPagoPuntoVentaDAO.obtenerTodosPorPuntoVenta(puntoVenta);
}
}

View File

@ -86,7 +86,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
@Autowired
private LogAuditoriaService logAuditoriaService;
// FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados
// FIXME : Remover esse m<EFBFBD>todo de quem est<73> usando. Esse m<>todo carrega muitos dados
@Deprecated
public List<PuntoVenta> obtenerTodos() {
return puntoVentaDAO.obtenerTodos();
@ -114,13 +114,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO");
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
// Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso.
// Integração AG
// Mantis 15739 - A integra<EFBFBD><EFBFBD>o AG deve ser acionada ap<61>s a persist<73>ncia dos dados com sucesso.
// Integra<EFBFBD><EFBFBD>o AG
/*
* Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); }
* Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integra<EFBFBD><EFBFBD>o com AG"); integraAG(entidad); log.debug("fim da integra<EFBFBD><EFBFBD>o com AG"); }
*/
// Integração Totvs
// Integra<EFBFBD><EFBFBD>o Totvs
if (!desativaTotvs){
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
try {
@ -176,13 +176,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null);
// Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso.
// Integração AG
// Mantis 15739 - A integra<EFBFBD><EFBFBD>o AG deve ser acionada ap<61>s a persist<73>ncia dos dados com sucesso.
// Integra<EFBFBD><EFBFBD>o AG
Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG");
if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) {
log.debug("iniciando integração com AG");
log.debug("iniciando integra<EFBFBD><EFBFBD>o com AG");
integraAG(entidad);
log.debug("fim da integração com AG");
log.debug("fim da integra<EFBFBD><EFBFBD>o com AG");
}
return entidad;
@ -214,7 +214,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
connection.close();
}
} catch (SQLException e) {
log.error("error fechar conexão", e);
log.error("error fechar conex<EFBFBD>o", e);
throw new RuntimeException(e);
}
}
@ -236,9 +236,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return;
}
if (!strFornecedor.contains("ERRO")){
// retornar msg a informação de registro já cadastrado
// retornar msg a informa<EFBFBD><EFBFBD>o de registro j<> cadastrado
entidad.setIndIntegradoAG(false);
entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado");
entidad.setMotivoNaoIntegradoAG("Fornecedor j<EFBFBD> cadastrado");
} else {
fornecedor = new TFornecedor();
fornecedor.setNome(entidad.getRazonSocial());
@ -307,9 +307,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return;
}
if (!cliStr.contains("ERRO")) {
// retornar msg a informação de registro já cadastrado
// retornar msg a informa<EFBFBD><EFBFBD>o de registro j<> cadastrado
entidad.setIndIntegradoAG(false);
entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado");
entidad.setMotivoNaoIntegradoAG("Cliente j<EFBFBD> cadastrado");
} else {
cli = new TCliente();
cli.setCodigo("");
@ -435,7 +435,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
PuntoVenta originalClone = null;
try {
originalClone = entidad.getCloneObject();
if(entidad.getTitularId()!=null) {
if(entidad.getTitularId()!=null && originalClone != null) {
originalClone.setTitularId(entidad.getTitularId().getCloneObject());
}
} catch (Exception e) {
@ -449,13 +449,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO");
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
// Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso.
// Integração AG
// Mantis 15739 - A integra<EFBFBD><EFBFBD>o AG deve ser acionada ap<61>s a persist<73>ncia dos dados com sucesso.
// Integra<EFBFBD><EFBFBD>o AG
/*
* Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if ( entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); }
* Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if ( entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integra<EFBFBD><EFBFBD>o com AG"); integraAG(entidad); log.debug("fim da integra<EFBFBD><EFBFBD>o com AG"); }
*/
// Integração Totvs
// Integra<EFBFBD><EFBFBD>o Totvs
if (!desativaTotvs){
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
@ -510,13 +510,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
}
}
// Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso.
// Integração AG
// Mantis 15739 - A integra<EFBFBD><EFBFBD>o AG deve ser acionada ap<61>s a persist<73>ncia dos dados com sucesso.
// Integra<EFBFBD><EFBFBD>o AG
Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG");
if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) {
log.debug("iniciando integração com AG");
log.debug("iniciando integra<EFBFBD><EFBFBD>o com AG");
integraAG(entidad);
log.debug("fim da integração com AG");
log.debug("fim da integra<EFBFBD><EFBFBD>o com AG");
}
return entidad;
@ -765,7 +765,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String contrib = ContribuinteICMS.NAO.getValor();
String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor();
String pais = "";// segundo orientação da TOTVS, passar em branco
String pais = "";// segundo orienta<EFBFBD><EFBFBD>o da TOTVS, passar em branco
try {
resp = TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, contaCliente, contrib, ddd, email, cnpjEmpresaProtheus,