From 816ea80908f57ac5cbeb51b9c9c21443cfa3fb04 Mon Sep 17 00:00:00 2001 From: julio Date: Thu, 9 Apr 2015 14:23:42 +0000 Subject: [PATCH] WS Receber/Pagar - Novos campos (bug #6181) Tempo: 1 horas git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42931 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/entidad/TipoEventoExtra.java | 53 ++++++--- .../service/TipoEventoExtraService.java | 5 +- .../impl/TipoEventoExtraServiceImpl.java | 109 +++++++++++------- 3 files changed, 104 insertions(+), 63 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java index cce2496a2..770b227ad 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java @@ -33,19 +33,18 @@ public class TipoEventoExtra implements Serializable { public static short OPERACION_NORMAL = 1; public static short OPERACION_AJUSTE = 2; public static short OPERACION_CAMBIO_CHEQUE = 3; - - + public static String TIPO_CREDITO = "1"; public static String TIPO_DEBITO = "0"; - + private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_SEQ") @Column(name = "TIPOEVENTOEXTRA_ID") private Integer tipoeventoextraId; - //@Column(name = "DESCINGRESO") - //private String descingreso; + // @Column(name = "DESCINGRESO") + // private String descingreso; @Column(name = "INDTIPO") private String indtipo; @Column(name = "IMPMAX") @@ -58,8 +57,8 @@ public class TipoEventoExtra implements Serializable { private Boolean indcontrapartida; @Column(name = "INDBOLETO") private Boolean indboleto; -// @Column(name = "INDAJUSTE") -// private Boolean indajuste; + // @Column(name = "INDAJUSTE") + // private Boolean indajuste; @Column(name = "INDORDENSERVICIO") private Boolean indordenservicio; @Column(name = "INDOPERACION") @@ -76,12 +75,16 @@ public class TipoEventoExtra implements Serializable { private Date fecmodif; @Column(name = "ACTIVO") private Boolean activo; -// @Column(name = "DESCINGRESO2") -// private String descingreso2; + // @Column(name = "DESCINGRESO2") + // private String descingreso2; @Column(name = "INDTIPO2") private String indtipo2; @Column(name = "DESCTIPOEVENTO") private String descTipoEvento; + @Column(name = "NATUREZA") + private String natureza; + @Column(name = "CONTACONTABIL") + private String contaContabil; // @Column(name = "FORMAPAGO_ID") // private Integer formapagoId; @@ -130,13 +133,13 @@ public class TipoEventoExtra implements Serializable { this.tipoeventoextraId = tipoeventoextraId; } -// public String getDescingreso() { -// return descingreso; -// } -// -// public void setDescingreso(String descingreso) { -// this.descingreso = descingreso; -// } + // public String getDescingreso() { + // return descingreso; + // } + // + // public void setDescingreso(String descingreso) { + // this.descingreso = descingreso; + // } public String getIndtipo() { return indtipo; @@ -186,8 +189,6 @@ public class TipoEventoExtra implements Serializable { this.indboleto = indboleto; } - - public Boolean getIndordenservicio() { return indordenservicio; } @@ -312,4 +313,20 @@ public class TipoEventoExtra implements Serializable { return "com.rjconsultores.ventaboletos.entidad.TipoEventoExtra[tipoeventoextraId=" + tipoeventoextraId + "]"; } + + public String getNatureza() { + return natureza; + } + + public void setNatureza(String natureza) { + this.natureza = natureza; + } + + public String getContaContabil() { + return contaContabil; + } + + public void setContaContabil(String contaContabil) { + this.contaContabil = contaContabil; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java index cb161f0f2..5328d56fe 100644 --- a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java +++ b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java @@ -4,6 +4,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; public interface TipoEventoExtraService { @@ -13,9 +14,9 @@ public interface TipoEventoExtraService { public TipoEventoExtra obtenerID(Integer id); - public TipoEventoExtra suscribir(TipoEventoExtra entidad); + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException; - public TipoEventoExtra actualizacion(TipoEventoExtra entidad); + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException; public void borrar(TipoEventoExtra entidad) throws BusinessException; } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java index 019b5217f..e1b12c65a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java @@ -4,72 +4,95 @@ */ package com.rjconsultores.ventaboletos.service.impl; -import com.rjconsultores.ventaboletos.dao.TipoEventoExtraDAO; -import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; -import com.rjconsultores.ventaboletos.exception.BusinessException; -import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; -import com.rjconsultores.ventaboletos.service.EventoExtraService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; 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.TipoEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; +import com.rjconsultores.ventaboletos.service.EventoExtraService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + /** - * + * * @author Administrador */ @Service("tipoEventoExtraService") public class TipoEventoExtraServiceImpl implements TipoEventoExtraService { - @Autowired - private TipoEventoExtraDAO tipoEventoExtraDAO; - @Autowired - private EventoExtraService eventoExtraService; + @Autowired + private TipoEventoExtraDAO tipoEventoExtraDAO; + @Autowired + private EventoExtraService eventoExtraService; - public List obtenerTodos() { - return tipoEventoExtraDAO.obtenerTodos(); - } + public List obtenerTodos() { + return tipoEventoExtraDAO.obtenerTodos(); + } - public TipoEventoExtra obtenerID(Integer id) { - return tipoEventoExtraDAO.obtenerID(id); - } - @Transactional - public TipoEventoExtra suscribir(TipoEventoExtra entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + public TipoEventoExtra obtenerID(Integer id) { + return tipoEventoExtraDAO.obtenerID(id); + } - return tipoEventoExtraDAO.suscribir(entidad); - } + @Transactional + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - @Transactional - public TipoEventoExtra actualizacion(TipoEventoExtra entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + if (ApplicationProperties.getInstance().integracionTotvs()) { + validaCampos(entidad); + } - return tipoEventoExtraDAO.actualizacion(entidad); - } + return tipoEventoExtraDAO.suscribir(entidad); + } - @Transactional(rollbackFor=BusinessException.class) - public void borrar(TipoEventoExtra entidad) throws BusinessException { - - if (!eventoExtraService.obtenerPorTipo(entidad).isEmpty()) { - throw new BusinessException("editarTipoEventoExtraController.MSG.evento"); - } - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.FALSE); + @Transactional + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - tipoEventoExtraDAO.actualizacion(entidad); - } + if (ApplicationProperties.getInstance().integracionTotvs()) { + validaCampos(entidad); + } + + return tipoEventoExtraDAO.actualizacion(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public void borrar(TipoEventoExtra entidad) throws BusinessException { + + if (!eventoExtraService.obtenerPorTipo(entidad).isEmpty()) { + throw new BusinessException("editarTipoEventoExtraController.MSG.evento"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoEventoExtraDAO.actualizacion(entidad); + } @Override public List buscar(String descingreso) { return tipoEventoExtraDAO.buscar(descingreso); } - + private void validaCampos(TipoEventoExtra entidad) throws ValidacionCampoException { + + if (entidad.getNatureza() == null) { + throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.natureza"); + } + + if (entidad.getContaContabil() == null) { + throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.contaContabil"); + } + } + }