Ajustes de excepciones, codigo muerto e imports sin usar

parent 67504272
...@@ -3,6 +3,9 @@ package com.mx.dla.admin.dtos; ...@@ -3,6 +3,9 @@ package com.mx.dla.admin.dtos;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import lombok.Data;
@Data
public class MenuDTO implements Serializable { public class MenuDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -25,118 +28,6 @@ public class MenuDTO implements Serializable { ...@@ -25,118 +28,6 @@ public class MenuDTO implements Serializable {
private List<MenuDTO> hijos = null; private List<MenuDTO> hijos = null;
public String getIdMenu() {
return this.idMenu;
}
public void setIdMenu(String valor) {
this.idMenu = valor;
}
public String getNombre() {
return this.nombre;
}
public void setNombre(String valor) {
this.nombre = valor;
}
public String getDescripcion() {
return this.descripcion;
}
public void setDescripcion(String valor) {
this.descripcion = valor;
}
public String getOrden() {
return this.orden;
}
public void setOrden(String valor) {
this.orden = valor;
}
public String getTipoMenu() {
return this.tipoMenu;
}
public void setTipoMenu(String valor) {
this.tipoMenu = valor;
}
public String getEstatus() {
return this.estatus;
}
public void setEstatus(String valor) {
this.estatus = valor;
}
public String getScript() {
return this.script;
}
public void setScript(String valor) {
this.script = valor;
}
public String getParametros() {
return this.parametros;
}
public void setParametros(String valor) {
this.parametros = valor;
}
public String getIconClass() {
return iconClass;
}
public void setIconClass(String iconClass) {
this.iconClass = iconClass;
}
public String getIdMenuPadre() {
return this.idMenuPadre;
}
public void setIdMenuPadre(String valor) {
this.idMenuPadre = valor;
}
public String getEnMtto() {
return this.enMtto;
}
public void setEnMtto(String valor) {
this.enMtto = valor;
}
public String getRuta() {
return ruta;
}
public void setRuta(String ruta) {
this.ruta = ruta;
}
public String getNivel() {
return nivel;
}
public void setNivel(String nivel) {
this.nivel = nivel;
}
public List<MenuDTO> getHijos() {
return hijos;
}
public void setHijos(List<MenuDTO> hijos) {
this.hijos = hijos;
}
public MenuDTO obtenerMenu(String idMenu) { public MenuDTO obtenerMenu(String idMenu) {
if (idMenu == null) if (idMenu == null)
......
...@@ -4,6 +4,9 @@ import java.util.List; ...@@ -4,6 +4,9 @@ import java.util.List;
import com.mx.dla.global.dtos.BaseDTO; import com.mx.dla.global.dtos.BaseDTO;
import lombok.Data;
@Data
public class PerfilDTO extends BaseDTO { public class PerfilDTO extends BaseDTO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -13,36 +16,4 @@ public class PerfilDTO extends BaseDTO { ...@@ -13,36 +16,4 @@ public class PerfilDTO extends BaseDTO {
private List<MenuDTO> menus = null; private List<MenuDTO> menus = null;
public String getIdPerfil() {
return this.idPerfil;
}
public void setIdPerfil(String valor) {
this.idPerfil = valor;
}
public String getDescPerfil() {
return this.descPerfil;
}
public void setDescPerfil(String valor) {
this.descPerfil = valor;
}
public String getEstatusPerfil() {
return this.estatusPerfil;
}
public void setEstatusPerfil(String valor) {
this.estatusPerfil = valor;
}
public List<MenuDTO> getMenus() {
return menus;
}
public void setMenus(List<MenuDTO> menus) {
this.menus = menus;
}
} }
...@@ -2,35 +2,13 @@ package com.mx.dla.dda.admin.catalogos.addons.dtos; ...@@ -2,35 +2,13 @@ package com.mx.dla.dda.admin.catalogos.addons.dtos;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
@Data
public class AddOnMenuDTO implements Serializable{ public class AddOnMenuDTO implements Serializable{
private static final long serialVersionUID = 7273988497345132540L; private static final long serialVersionUID = 7273988497345132540L;
private Integer idAddOn; private Integer idAddOn;
private String descripcionAddOn; private String descripcionAddOn;
/**
* @return the idAddOn
*/
public Integer getIdAddOn() {
return idAddOn;
}
/**
* @param idAddOn the idAddOn to set
*/
public void setIdAddOn(Integer idAddOn) {
this.idAddOn = idAddOn;
}
/**
* @return the descripcionAddOn
*/
public String getDescripcionAddOn() {
return descripcionAddOn;
}
/**
* @param descripcionAddOn the descripcionAddOn to set
*/
public void setDescripcionAddOn(String descripcionAddOn) {
this.descripcionAddOn = descripcionAddOn;
}
} }
package com.mx.dla.dda.admin.catalogos.addons.dtos; package com.mx.dla.dda.admin.catalogos.addons.dtos;
import lombok.Data;
@Data
public class RelacionAddOnDTO{ public class RelacionAddOnDTO{
private Long idRelacion; private Long idRelacion;
private Long idEstudio; private Long idEstudio;
private Long idPaisAddOn; private Long idPaisAddOn;
private Long estatus; private Long estatus;
public Long getIdRelacion() {
return idRelacion;
}
public void setIdRelacion(Long idRelacion) {
this.idRelacion = idRelacion;
}
public Long getIdEstudio() {
return idEstudio;
}
public void setIdEstudio(Long idEstudio) {
this.idEstudio = idEstudio;
}
public Long getIdPaisAddOn() {
return idPaisAddOn;
}
public void setIdPaisAddOn(Long idPaisAddOn) {
this.idPaisAddOn = idPaisAddOn;
}
public Long getEstatus() {
return estatus;
}
public void setEstatus(Long estatus) {
this.estatus = estatus;
}
} }
package com.mx.dla.dda.carga.transaccion.ws.procesarCargaTitulosPN; package com.mx.dla.dda.carga.transaccion.ws.procesarCargaTitulosPN;
import java.io.Serializable; import java.io.Serializable;
import com.mx.dla.dda.carga.transaccion.ws.procesarCargaTitulosPN.*;
/** /**
* Representa la respuesta que sera enviada al Front-End por parte de este componente al ejecutar el proceso de Carga de Titulos Transaccional * Representa la respuesta que sera enviada al Front-End por parte de este componente al ejecutar el proceso de Carga de Titulos Transaccional
......
...@@ -2,4 +2,6 @@ package com.mx.dla.dda.catalogos.dtos; ...@@ -2,4 +2,6 @@ package com.mx.dla.dda.catalogos.dtos;
public class MedioEntregaDTO extends RegistroCatalogoDTO { public class MedioEntregaDTO extends RegistroCatalogoDTO {
private static final long serialVersionUID = 1L;
} }
...@@ -2,4 +2,6 @@ package com.mx.dla.dda.catalogos.dtos; ...@@ -2,4 +2,6 @@ package com.mx.dla.dda.catalogos.dtos;
public class ServicioDTO extends RegistroCatalogoDTO { public class ServicioDTO extends RegistroCatalogoDTO {
private static final long serialVersionUID = 1L;
} }
package com.mx.dla.dda.reporte.cpview.dtos; package com.mx.dla.dda.reporte.cpview.dtos;
import java.awt.List;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays; import org.apache.log4j.Logger;
import java.util.Iterator;
public class CostPerViewEstudioMensualDatosDTO implements Serializable { public class CostPerViewEstudioMensualDatosDTO implements Serializable {
private static final long serialVersionUID = 1L;
private static Logger log = Logger.getLogger(CostPerViewEstudioMensualDatosDTO.class);
private String estudio; private String estudio;
private Double amortizacionEnero; private Double amortizacionEnero;
private Double visualizacionesEnero; private Double visualizacionesEnero;
...@@ -381,16 +383,15 @@ public class CostPerViewEstudioMensualDatosDTO implements Serializable { ...@@ -381,16 +383,15 @@ public class CostPerViewEstudioMensualDatosDTO implements Serializable {
} }
public void print() { public void print() {
System.out.println("BEGIN"); log.info("BEGIN CostPerViewEstudioMensualDatosDTO.print()");
for (Field field : this.getClass().getDeclaredFields()) for (Field field : this.getClass().getDeclaredFields())
try { try {
System.out.println(field.get(this)); log.info(field.get(this));
} }
catch (IllegalArgumentException | IllegalAccessException e) { catch (IllegalArgumentException | IllegalAccessException e) {
// TODO Auto-generated catch block log.error("Error: " + e.getMessage(), e.fillInStackTrace());
e.printStackTrace();
} }
System.out.println("END"); log.info("END CostPerViewEstudioMensualDatosDTO.print()");
} }
......
package com.mx.dla.dda.reporte.datosContrato.dtos; package com.mx.dla.dda.reporte.datosContrato.dtos;
import java.awt.List;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays; import org.apache.log4j.Logger;
import java.util.Iterator;
public class DatosContratoDTO implements Serializable { public class DatosContratoDTO implements Serializable {
// datos generales // datos generales
private static final long serialVersionUID = 1L;
private static Logger log = Logger.getLogger(DatosContratoDTO.class);
private String estudio; private String estudio;
private String noContraroDDA; private String noContraroDDA;
private String noContratoBV; private String noContratoBV;
...@@ -389,16 +390,15 @@ public class DatosContratoDTO implements Serializable { ...@@ -389,16 +390,15 @@ public class DatosContratoDTO implements Serializable {
public void print() { public void print() {
System.out.println("BEGIN"); log.info("BEGIN DatosContratoDTO.print()");
for (Field field : this.getClass().getDeclaredFields()) for (Field field : this.getClass().getDeclaredFields())
try { try {
System.out.println(field.get(this)); log.info(field.get(this));
} }
catch (IllegalArgumentException | IllegalAccessException e) { catch (IllegalArgumentException | IllegalAccessException e) {
// TODO Auto-generated catch block log.error("Error: " + e.getMessage(), e.fillInStackTrace());
e.printStackTrace();
} }
System.out.println("END"); log.info("END DatosContratoDTO.print()");
} }
......
...@@ -43,8 +43,6 @@ public class InicioAction extends BaseContratoAction { ...@@ -43,8 +43,6 @@ public class InicioAction extends BaseContratoAction {
ActionContext.getContext().getSession().remove("pmn"); ActionContext.getContext().getSession().remove("pmn");
ActionContext.getContext().getSession().remove("pmnReturn"); ActionContext.getContext().getSession().remove("pmnReturn");
getSession().put("permisos", menuBO.obtenPermisosPerfil(usuario.getPerfil().getIdPerfil()));
String retorno = SUCCESS; String retorno = SUCCESS;
if( !this.getPmn().equals("0") ) if( !this.getPmn().equals("0") )
...@@ -52,6 +50,7 @@ public class InicioAction extends BaseContratoAction { ...@@ -52,6 +50,7 @@ public class InicioAction extends BaseContratoAction {
if( usuario != null ) if( usuario != null )
{ {
getSession().put("permisos", menuBO.obtenPermisosPerfil(usuario.getPerfil().getIdPerfil()));
String idPerfil = usuario.getPerfil().getIdPerfil(); String idPerfil = usuario.getPerfil().getIdPerfil();
if( idPerfil != null ) if( idPerfil != null )
...@@ -71,19 +70,15 @@ public class InicioAction extends BaseContratoAction { ...@@ -71,19 +70,15 @@ public class InicioAction extends BaseContratoAction {
menusUsuario = menuBO.armarArbolMenus( menusPerfil, idPerfil ); menusUsuario = menuBO.armarArbolMenus( menusPerfil, idPerfil );
getSession().put("menus", perfil.getMenus() ); getSession().put("menus", perfil.getMenus() );
} }
} } else
else
{ {
retorno = "error_002"; retorno = "error_002";
} }
} } else
else
{ {
retorno = "error_002"; retorno = "error_002";
} }
} } else {
else
{
retorno = "error_001"; retorno = "error_001";
} }
......
package com.mx.dla.admin.usuarios.perfil.actions; package com.mx.dla.admin.usuarios.perfil.actions;
import java.sql.SQLException;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.admin.dtos.UsuarioDTO; import com.mx.dla.admin.dtos.UsuarioDTO;
import com.mx.dla.admin.usuarios.perfil.bos.UsuarioPerfilBO; import com.mx.dla.admin.usuarios.perfil.bos.UsuarioPerfilBO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class UsuarioPerfilAction extends BaseContratoAction{ public class UsuarioPerfilAction extends BaseContratoAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -22,20 +27,27 @@ public class UsuarioPerfilAction extends BaseContratoAction{ ...@@ -22,20 +27,27 @@ public class UsuarioPerfilAction extends BaseContratoAction{
@Override @Override
public String execute() { public String execute() {
setUsuario((UsuarioDTO) this.getSession().get("usuario")); setUsuario((UsuarioDTO) this.getSession().get("usuario"));
//logger.debug("keys : [{}]", this.getSession().keySet());
//logger.debug("menus : [{}]", this.getSession().get("menus"));
//logger.debug("idContrato : [{}]", this.getSession().get("idContrato"));
this.getSession().put("pmn", null); this.getSession().put("pmn", null);
this.getSession().put("pmnReturn", null); this.getSession().put("pmnReturn", null);
//logger.debug("usuario : [{}]", usuario);
//logger.debug("pmn : [{}] --- pmnReturn : [{}]", this.getPmn(), this.getPmnReturn());
return SUCCESS; return SUCCESS;
} }
public String actulizaPropiedadesUsuario(){ public String actulizaPropiedadesUsuario() {
setUsuario((UsuarioDTO) this.getSession().get("usuario")); setUsuario((UsuarioDTO) this.getSession().get("usuario"));
setExito(usuarioPerfilBO.actulizaPropiedadUsuario(usuario.getExpediente(), correoElectronico, contrasena, operacion));
try {
setExito(usuarioPerfilBO.actulizaPropiedadUsuario(usuario.getExpediente(), correoElectronico, contrasena,
operacion));
setUsuario(usuarioPerfilBO.obtenerUsuario(usuario.getExpediente())); setUsuario(usuarioPerfilBO.obtenerUsuario(usuario.getExpediente()));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException e) {
logger.error("Error. {}", e);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
this.getSession().put("usuario", usuario); this.getSession().put("usuario", usuario);
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.admin.bloqueo.actions; package com.mx.dla.dda.admin.bloqueo.actions;
import java.util.ArrayList; import java.sql.SQLException;
import java.util.List; import java.time.LocalDate;
import java.util.Locale;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.executor.result.ResultMapException;
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 java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO; import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO;
import com.mx.dla.dda.carga.transaccion.dtos.FechaBloqueoDTO; import com.mx.dla.dda.carga.transaccion.dtos.FechaBloqueoDTO;
import com.mx.dla.dda.catalogos.dtos.RegionVentaDTO; import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.dda.catalogos.dtos.TerritorioDTO;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class BloqueoSAPAction extends BaseAction { public class BloqueoSAPAction extends BaseAction {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
private static Logger log = Logger.getLogger(BloqueoSAPAction.class); private static Logger log = Logger.getLogger(BloqueoSAPAction.class);
private boolean regresoAction;
private String anio; private String anio;
private String mes; private String mes;
private String dia; private String dia;
...@@ -53,11 +48,15 @@ public class BloqueoSAPAction extends BaseAction { ...@@ -53,11 +48,15 @@ public class BloqueoSAPAction extends BaseAction {
try { try {
bdsp.ejecutaSP(fecha); bdsp.ejecutaSP(fecha);
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
} catch (Exception e) { log.error("Ha ocurrido el siguiente error durante la consulta: " + e.getMessage(), e);
addActionError("Ha ocurrido el siguiente error durante la consulta: " } catch (TransaccionException e) {
+ e.getMessage()); addActionError("Ha ocurrido un error.");
log.error("Ha ocurrido el siguiente error durante la consulta: " + e.getMessage(), e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
log.error("Ha ocurrido el siguiente error durante la consulta: " + e.getMessage(), e);
} }
return Action.SUCCESS; return Action.SUCCESS;
......
package com.mx.dla.dda.admin.catalogos.addons.actions; package com.mx.dla.dda.admin.catalogos.addons.actions;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO;
import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
public class AgregarAddOnAction extends BaseContratoAction{ public class AgregarAddOnAction extends BaseContratoAction{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// public List<GrupoEstudioDTO> grupos;
// @Autowired
// private GrupoEstudioBO grupoEstudioBO;
@Override @Override
public String execute() { public String execute() {
logger.debug("In AgregarAddOnAction."); logger.debug("In AgregarAddOnAction.");
// setGrupos(grupoEstudioBO.obtenerGrupoEstudio(null));
this.getSession().put("pmn", this.getPmn()); this.getSession().put("pmn", this.getPmn());
this.getSession().put("pmnReturn", this.getPmnReturn()); this.getSession().put("pmnReturn", this.getPmnReturn());
return SUCCESS; return SUCCESS;
} }
/*
public void setGrupos(List<GrupoEstudioDTO> grupos) {
this.grupos = grupos;
}
public List<GrupoEstudioDTO> getGrupos() {
return grupos;
}
*/
} }
...@@ -2,9 +2,11 @@ package com.mx.dla.dda.admin.catalogos.addons.actions; ...@@ -2,9 +2,11 @@ package com.mx.dla.dda.admin.catalogos.addons.actions;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
...@@ -14,12 +16,15 @@ import com.mx.dla.dda.admin.catalogos.addons.dtos.CatalogoAddOnDTO; ...@@ -14,12 +16,15 @@ import com.mx.dla.dda.admin.catalogos.addons.dtos.CatalogoAddOnDTO;
import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO; import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO;
import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO; import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO;
import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.dtos.PaisAddOnsVDTO; import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.dtos.PaisAddOnsVDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class CatalogoAddOnsAction extends BaseAction { public class CatalogoAddOnsAction extends BaseAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -69,9 +74,14 @@ public class CatalogoAddOnsAction extends BaseAction { ...@@ -69,9 +74,14 @@ public class CatalogoAddOnsAction extends BaseAction {
public String listadoAddOns() { public String listadoAddOns() {
try { try {
catalogoAddOns = addOnBO.catalogoAddOns(); catalogoAddOns = addOnBO.catalogoAddOns();
} catch (PersistenceException ibe) { } catch (ResultMapException e) {
logger.error("Error. {}", ibe); addActionError("Ha ocurrido un error.");
} catch (Exception e) { logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e); logger.error("Error. {}", e);
} }
...@@ -103,11 +113,19 @@ public class CatalogoAddOnsAction extends BaseAction { ...@@ -103,11 +113,19 @@ public class CatalogoAddOnsAction extends BaseAction {
this.addOn = new CatalogoAddOnDTO(); this.addOn = new CatalogoAddOnDTO();
this.addOnActualizado = false; this.addOnActualizado = false;
this.seRepitePais = true; this.seRepitePais = true;
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) { } catch (PersistenceException ibe) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
return ""; return "";
} catch (Exception e) { } catch (TransaccionException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
return ""; return "";
...@@ -128,12 +146,22 @@ public class CatalogoAddOnsAction extends BaseAction { ...@@ -128,12 +146,22 @@ public class CatalogoAddOnsAction extends BaseAction {
this.addOnActualizado = true; this.addOnActualizado = true;
setIdAddOn(addOn.getIdAddOn()); setIdAddOn(addOn.getIdAddOn());
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) { } catch (PersistenceException ibe) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
} catch (Exception e) { return "";
} catch (TransaccionException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
return "";
} }
setPmns(); setPmns();
...@@ -143,27 +171,74 @@ public class CatalogoAddOnsAction extends BaseAction { ...@@ -143,27 +171,74 @@ public class CatalogoAddOnsAction extends BaseAction {
public String buscaAddOn() { public String buscaAddOn() {
try { try {
setAddOn(addOnBO.catalogoAddOnsPorId(idAddOn)); setAddOn(addOnBO.catalogoAddOnsPorId(idAddOn));
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) { } catch (PersistenceException ibe) {
this.addOnActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
} catch (Exception e) { return "";
} catch (TransaccionException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} }
return "addOnConsultado"; return "addOnConsultado";
} }
public String obtnerAddOn() { public String obtnerAddOn() {
try {
setAddOn(addOnBO.catalogoAddOnsPorId(idAddOn)); setAddOn(addOnBO.catalogoAddOnsPorId(idAddOn));
setEstudios(estudioBO.catalogoEstudiosAddOn()); setEstudios(estudioBO.catalogoEstudiosAddOn());
setPaises(addOnBO.obtenerPaisesAddOn()); setPaises(addOnBO.obtenerPaisesAddOn());
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) {
this.addOnActualizado = false;
logger.error("Error. {}", ibe);
return "";
} catch (TransaccionException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
}
return SUCCESS; return SUCCESS;
} }
public String actualizaAddOnMod() { public String actualizaAddOnMod() {
try {
addOnBO.actulizaCatalogoAddOn(idAddOn, idEstudio, pais, revenueShare, precio, vat, precioNeto, vatFijo, precioNetoFijo, addOnBO.actulizaCatalogoAddOn(idAddOn, idEstudio, pais, revenueShare, precio, vat, precioNeto, vatFijo, precioNetoFijo,
tipoDeCambio, calculoMontoXPais, calculoRevenueShare, tarifaMinima, preferido); tipoDeCambio, calculoMontoXPais, calculoRevenueShare, tarifaMinima, preferido);
this.addOn = addOnBO.catalogoAddOnsPorId(idAddOn); this.addOn = addOnBO.catalogoAddOnsPorId(idAddOn);
this.addOnActualizado = true; this.addOnActualizado = true;
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) {
this.addOnActualizado = false;
logger.error("Error. {}", ibe);
return "";
} catch (TransaccionException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
}
return SUCCESS; return SUCCESS;
} }
...@@ -172,12 +247,22 @@ public class CatalogoAddOnsAction extends BaseAction { ...@@ -172,12 +247,22 @@ public class CatalogoAddOnsAction extends BaseAction {
try { try {
addOnBO.eliminaprecioAddOn(idAddOn,preferido,idRelacion); addOnBO.eliminaprecioAddOn(idAddOn,preferido,idRelacion);
this.addOnActualizado = true; this.addOnActualizado = true;
} catch (ResultMapException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} catch (PersistenceException ibe) { } catch (PersistenceException ibe) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
} catch (Exception e) { return "";
} catch (TransaccionException e) {
this.addOnActualizado = false; this.addOnActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
return "";
} catch (SQLException e) {
this.addOnActualizado = false;
logger.error("Error. {}", e);
return "";
} }
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.admin.catalogos.addons.actions; package com.mx.dla.dda.admin.catalogos.addons.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.addons.bos.EstudioAddonBO; import com.mx.dla.dda.admin.catalogos.addons.bos.EstudioAddonBO;
...@@ -10,6 +12,7 @@ import com.mx.dla.dda.admin.catalogos.addons.bos.ReporteAddOnsBO; ...@@ -10,6 +12,7 @@ import com.mx.dla.dda.admin.catalogos.addons.bos.ReporteAddOnsBO;
import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO; import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO;
import com.mx.dla.dda.admin.catalogos.addons.dtos.ReporteAddonDTO; import com.mx.dla.dda.admin.catalogos.addons.dtos.ReporteAddonDTO;
import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO; import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import lombok.Getter; import lombok.Getter;
...@@ -17,7 +20,7 @@ import lombok.Setter; ...@@ -17,7 +20,7 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class EstudiosAddOnAction extends BaseAction{ public class EstudiosAddOnAction extends BaseAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<EstudioAddonDTO> estudios; private List<EstudioAddonDTO> estudios;
...@@ -48,12 +51,34 @@ public class EstudiosAddOnAction extends BaseAction{ ...@@ -48,12 +51,34 @@ public class EstudiosAddOnAction extends BaseAction{
} }
public String listadoEstudiosAddons() { public String listadoEstudiosAddons() {
try {
setEstudios(estudioAddonBO.getEstudios()); setEstudios(estudioAddonBO.getEstudios());
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public String dirigirAgregarEstudio() throws Exception { public String dirigirAgregarEstudio() throws Exception {
try {
setReportes(reporteAddOnsBO.getTiposReporte(StringUtils.EMPTY)); setReportes(reporteAddOnsBO.getTiposReporte(StringUtils.EMPTY));
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -65,21 +90,43 @@ public class EstudiosAddOnAction extends BaseAction{ ...@@ -65,21 +90,43 @@ public class EstudiosAddOnAction extends BaseAction{
addon.setReduClientes(redClientes); addon.setReduClientes(redClientes);
addon.setAddon(adon); addon.setAddon(adon);
addon.setDecimales("2"); addon.setDecimales("2");
addon.setAgrupado(agrupado == null ? "0":agrupado); addon.setAgrupado(agrupado == null ? "0" : agrupado);
try {
estudioAddonBO.guardarAddon(addon); estudioAddonBO.guardarAddon(addon);
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String obtnenAddon() { public String obtnenAddon() {
try {
setEstudio(estudioAddonBO.getEstudioById(idEstudio)); setEstudio(estudioAddonBO.getEstudioById(idEstudio));
setReportes(reporteAddOnsBO.getTiposReporte(StringUtils.EMPTY)); setReportes(reporteAddOnsBO.getTiposReporte(StringUtils.EMPTY));
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String actualizaAddonMod() { public String actualizaAddonMod() {
System.out.println("*************Agrupado*********" + agrupado); logger.info("*************Agrupado*********" + agrupado);
EstudioAddonDTO addon = new EstudioAddonDTO(); EstudioAddonDTO addon = new EstudioAddonDTO();
addon.setIdEstudio(idEstudio.intValue()); addon.setIdEstudio(idEstudio.intValue());
addon.setNombre(nombreEstudio); addon.setNombre(nombreEstudio);
...@@ -87,12 +134,23 @@ public class EstudiosAddOnAction extends BaseAction{ ...@@ -87,12 +134,23 @@ public class EstudiosAddOnAction extends BaseAction{
addon.setReduClientes(redClientes); addon.setReduClientes(redClientes);
addon.setAddon(adon); addon.setAddon(adon);
addon.setDecimales("2"); addon.setDecimales("2");
addon.setAgrupado(agrupado == null ? "0":agrupado); addon.setAgrupado(agrupado == null ? "0" : agrupado);
try {
ok = estudioAddonBO.modificaAddon(addon); ok = estudioAddonBO.modificaAddon(addon);
} catch (ResultMapException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public void setPmns(){ public void setPmns() {
logger.debug("pmn : " + this.getPmn() + "pmnReturn : " + this.getPmnReturn()); logger.debug("pmn : " + this.getPmn() + "pmnReturn : " + this.getPmnReturn());
this.getSession().put("pmn", 210); this.getSession().put("pmn", 210);
this.getSession().put("pmnReturn", 210); this.getSession().put("pmnReturn", 210);
......
package com.mx.dla.dda.admin.catalogos.apartados.actions; package com.mx.dla.dda.admin.catalogos.apartados.actions;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.apartados.bos.ApartadosBO; import com.mx.dla.dda.admin.catalogos.apartados.bos.ApartadosBO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.excepcion.SuscriptorException; import com.mx.dla.dda.contrato.excepcion.SuscriptorException;
import com.mx.dla.dda.contrato.generales.dtos.ApartadoDTO; import com.mx.dla.dda.contrato.generales.dtos.ApartadoDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class ApartadosAction extends BaseContratoAction{ public class ApartadosAction extends BaseContratoAction {
private static final long serialVersionUID = 6539076129813362003L; private static final long serialVersionUID = 6539076129813362003L;
...@@ -23,61 +28,93 @@ public class ApartadosAction extends BaseContratoAction{ ...@@ -23,61 +28,93 @@ public class ApartadosAction extends BaseContratoAction{
@Autowired @Autowired
private ApartadosBO apartadosBO; private ApartadosBO apartadosBO;
public String CatalogoApartados(){ public String CatalogoApartados() {
try { try {
this.apartados = apartadosBO.selectBusquedaApartados(amortizable); this.apartados = apartadosBO.selectBusquedaApartados(amortizable);
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.mensaje = "Ocurri un error al obtener los datos."; this.mensaje = "Ocurri un error.";
logger.error("Error.", ibe); logger.error("Ocurri un error al obtener los datos.", e);
}catch(Exception e){ } catch (PersistenceException ibe) {
this.mensaje = "Ocurri un error al obtener los datos."; this.mensaje = "Ocurri un error.";
logger.error("Error.", e); logger.error("Ocurri un error al obtener los datos.", ibe);
} catch (TransaccionException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SQLException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} }
return "listado"; return "listado";
} }
public String generarApartado(){ public String generarApartado() {
try { try {
logger.debug(""+this.descripcion+":"+ this.idApartado +":"+this.amortizable); logger.debug("" + this.descripcion + ":" + this.idApartado + ":" + this.amortizable);
this.mensaje = apartadosBO.generarApartado(this.descripcion, this.idApartado, this.amortizable); this.mensaje = apartadosBO.generarApartado(this.descripcion, this.idApartado, this.amortizable);
if(this.mensaje != null) if (this.mensaje != null)
this.idApartado = this.mensaje; this.idApartado = this.mensaje;
}catch(SuscriptorException se){ } catch (SuscriptorException se) {
this.mensaje = se.getMessage(); this.mensaje = se.getMessage();
this.idApartado = null; this.idApartado = null;
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.mensaje = "Ocurri un error al obtener los datos."; this.mensaje = "Ocurri un error.";
this.idApartado = null; logger.error("Ocurri un error al obtener los datos.", e);
logger.error("Error.", ibe); } catch (PersistenceException ibe) {
}catch(Exception e){ this.mensaje = "Ocurri un error.";
this.mensaje = "Ocurri un error al obtener los datos."; logger.error("Ocurri un error al obtener los datos.", ibe);
this.idApartado = null; } catch (TransaccionException e) {
logger.error("Error.", e); this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SQLException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SocketTimeoutException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (IOException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} }
return "listado"; return "listado";
} }
public String notificarSAP(){ public String notificarSAP() {
try { try {
logger.debug(""+this.descripcion+":"+ this.idApartado +":"+this.amortizable); logger.debug("" + this.descripcion + ":" + this.idApartado + ":" + this.amortizable);
ApartadoDTO apartado = new ApartadoDTO(Long.parseLong(this.idApartado), this.descripcion); ApartadoDTO apartado = new ApartadoDTO(Long.parseLong(this.idApartado), this.descripcion);
logger.debug(apartado.toString()); logger.debug(apartado.toString());
apartadosBO.notificarApartadoNoAmortizablesSAP(apartado); apartadosBO.notificarApartadoNoAmortizablesSAP(apartado);
this.idApartado = apartado.getIdSap() != null || apartado.getIdSap().compareTo("") != 0 ? apartado.getIdSap() : null; this.idApartado = apartado.getIdSap() != null || apartado.getIdSap().compareTo("") != 0
? apartado.getIdSap()
: null;
this.mensaje = "OK"; this.mensaje = "OK";
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error.", ibe); this.mensaje = "Ocurri un error.";
}catch(Exception e){ logger.error("Ocurri un error al obtener los datos.", e);
logger.error("Error.", e); } catch (PersistenceException ibe) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", ibe);
} catch (TransaccionException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SQLException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SocketTimeoutException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} catch (IOException e) {
this.mensaje = "Ocurri un error.";
logger.error("Ocurri un error al obtener los datos.", e);
} }
return "listado"; return "listado";
} }
...@@ -85,18 +122,23 @@ public class ApartadosAction extends BaseContratoAction{ ...@@ -85,18 +122,23 @@ public class ApartadosAction extends BaseContratoAction{
public List<ApartadoDTO> getApartados() { public List<ApartadoDTO> getApartados() {
return apartados; return apartados;
} }
public String getMensaje() { public String getMensaje() {
return mensaje; return mensaje;
} }
public void setDescripcion(String descripcion) { public void setDescripcion(String descripcion) {
this.descripcion = descripcion; this.descripcion = descripcion;
} }
public void setIdApartado(String idApartado) { public void setIdApartado(String idApartado) {
this.idApartado = idApartado; this.idApartado = idApartado;
} }
public String getIdApartado() { public String getIdApartado() {
return idApartado; return idApartado;
} }
public void setAmortizable(String amortizable) { public void setAmortizable(String amortizable) {
this.amortizable = amortizable; this.amortizable = amortizable;
} }
......
package com.mx.dla.dda.admin.catalogos.estudios.actions; package com.mx.dla.dda.admin.catalogos.estudios.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO; import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO;
import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO; import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class AgregarEstudioAction extends BaseContratoAction{ public class AgregarEstudioAction extends BaseContratoAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -20,7 +24,17 @@ public class AgregarEstudioAction extends BaseContratoAction{ ...@@ -20,7 +24,17 @@ public class AgregarEstudioAction extends BaseContratoAction{
@Override @Override
public String execute() { public String execute() {
logger.debug("In AgregarEstudioAction."); logger.debug("In AgregarEstudioAction.");
try {
setGrupos(grupoEstudioBO.obtenerGrupoEstudio(null)); setGrupos(grupoEstudioBO.obtenerGrupoEstudio(null));
} catch (ResultMapException e) {
logger.error("Ocurri un error al obtener los datos.", e);
} catch (PersistenceException ibe) {
logger.error("Ocurri un error al obtener los datos.", ibe);
} catch (TransaccionException e) {
logger.error("Ocurri un error al obtener los datos.", e);
} catch (SQLException e) {
logger.error("Ocurri un error al obtener los datos.", e);
}
this.getSession().put("pmn", this.getPmn()); this.getSession().put("pmn", this.getPmn());
this.getSession().put("pmnReturn", this.getPmnReturn()); this.getSession().put("pmnReturn", this.getPmnReturn());
return SUCCESS; return SUCCESS;
......
package com.mx.dla.dda.admin.catalogos.estudios.actions; package com.mx.dla.dda.admin.catalogos.estudios.actions;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO; import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO;
import com.mx.dla.dda.admin.catalogos.estudios.dtos.CatalogoEstudioDTO; import com.mx.dla.dda.admin.catalogos.estudios.dtos.CatalogoEstudioDTO;
import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO; import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO;
import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO; import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
...@@ -43,21 +46,24 @@ public class CatalogoEstudiosAction extends BaseAction { ...@@ -43,21 +46,24 @@ public class CatalogoEstudiosAction extends BaseAction {
return SUCCESS; return SUCCESS;
} }
public String listadoEstudios(){ public String listadoEstudios() {
try try {
{
catalogoEstudios = new ArrayList<CatalogoEstudioDTO>(); catalogoEstudios = new ArrayList<CatalogoEstudioDTO>();
catalogoEstudios = estudioBO.catalogoEstudios(); catalogoEstudios = estudioBO.catalogoEstudios();
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
}catch(Exception e){ } catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
public void setPmns(){ public void setPmns() {
logger.debug("pmn : " + this.getPmn() + "pmnReturn : " + this.getPmnReturn()); logger.debug("pmn : " + this.getPmn() + "pmnReturn : " + this.getPmnReturn());
this.getSession().put("pmn", 42); this.getSession().put("pmn", 42);
this.getSession().put("pmnReturn", 42); this.getSession().put("pmnReturn", 42);
...@@ -70,43 +76,53 @@ public class CatalogoEstudiosAction extends BaseAction { ...@@ -70,43 +76,53 @@ public class CatalogoEstudiosAction extends BaseAction {
return SUCCESS; return SUCCESS;
} }
public String guardaEstudio(){ public String guardaEstudio() {
try{ try {
this.estudio = estudioBO.guardarEstudio(nombreEstudio); this.estudio = estudioBO.guardarEstudio(nombreEstudio);
this.estudioActualizado=true; this.estudioActualizado = true;
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.estudioActualizado=false; this.estudioActualizado = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
this.estudioActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
}catch(Exception e){ this.estudioActualizado = false;
this.estudioActualizado=false; logger.error("Error. {}", e);
} catch (SQLException e) {
this.estudioActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
} }
setPmns(); setPmns();
return Action.SUCCESS; return Action.SUCCESS;
} }
public String actualizaEstudio() {
public String actualizaEstudio(){ try {
try{
estudio.setIdGrupo(campoGrupo); estudio.setIdGrupo(campoGrupo);
logger.debug("[{}]", estudio); logger.debug("[{}]", estudio);
estudioBO.updateEstudio(estudio); estudioBO.updateEstudio(estudio);
int idEstudio = this.estudio.getIdEstudio(); int idEstudio = this.estudio.getIdEstudio();
this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio); this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio);
this.estudioActualizado=true; this.estudioActualizado = true;
setIdEstudio(estudio.getIdEstudio().longValue()); setIdEstudio(estudio.getIdEstudio().longValue());
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.estudioActualizado=false; this.estudioActualizado = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
this.estudioActualizado = false;
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
}catch(Exception e){ } catch (TransaccionException e) {
this.estudioActualizado=false; this.estudioActualizado = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
this.estudioActualizado = false;
logger.error("Error. {}", e); logger.error("Error. {}", e);
} }
setPmns(); setPmns();
...@@ -114,50 +130,64 @@ public class CatalogoEstudiosAction extends BaseAction { ...@@ -114,50 +130,64 @@ public class CatalogoEstudiosAction extends BaseAction {
return "estudioActualizado"; return "estudioActualizado";
} }
public String buscaEstudio( ){ public String buscaEstudio() {
try{ try {
setGrupos(GrupoEstudioBO.obtenerGrupoEstudio(null)); setGrupos(GrupoEstudioBO.obtenerGrupoEstudio(null));
this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio.intValue()); this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio.intValue());
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe); logger.error("Error. {}", ibe);
}catch(Exception e){ } catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
} }
return "estudioConsultado"; return "estudioConsultado";
} }
public String obtneEstudio() { public String obtneEstudio() {
try {
setEstudio(estudioBO.catalogoEstudiosPorId(idEstudio.intValue())); setEstudio(estudioBO.catalogoEstudiosPorId(idEstudio.intValue()));
setGrupos(GrupoEstudioBO.obtenerGrupoEstudio(idEstudio)); setGrupos(GrupoEstudioBO.obtenerGrupoEstudio(idEstudio));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public String actualizaEstudioMod() { public String actualizaEstudioMod() {
setSeRepiteSigla(estudioBO.seRepiteSigla(idEstudio, sigla)); setSeRepiteSigla(estudioBO.seRepiteSigla(idEstudio, sigla));
try {
if(!getSeRepiteSigla()) { if (!getSeRepiteSigla()) {
estudioBO.actulizaCatalogoEstudio(idEstudio, sigla, campoGrupo, Integer.valueOf(esAddOn),nombreAddOn); estudioBO.actulizaCatalogoEstudio(idEstudio, sigla, campoGrupo, Integer.valueOf(esAddOn), nombreAddOn);
this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio.intValue()); this.estudio = estudioBO.catalogoEstudiosPorId(idEstudio.intValue());
this.estudioActualizado = true; this.estudioActualizado = true;
} }
} catch (ResultMapException e) {
this.estudioActualizado = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
this.estudioActualizado = false;
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
this.estudioActualizado = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
this.estudioActualizado = false;
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public List<CatalogoEstudioDTO> getCatalogoEstudios() { public List<CatalogoEstudioDTO> getCatalogoEstudios() {
return catalogoEstudios; return catalogoEstudios;
} }
......
package com.mx.dla.dda.admin.catalogos.grupoestudio.actions; package com.mx.dla.dda.admin.catalogos.grupoestudio.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO; import com.mx.dla.dda.admin.catalogos.grupoestudio.bos.GrupoEstudioBO;
import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO; import com.mx.dla.dda.admin.catalogos.grupoestudio.dtos.GrupoEstudioDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class GrupoEstudioAction extends BaseContratoAction{ public class GrupoEstudioAction extends BaseContratoAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired @Autowired
...@@ -29,17 +33,47 @@ public class GrupoEstudioAction extends BaseContratoAction{ ...@@ -29,17 +33,47 @@ public class GrupoEstudioAction extends BaseContratoAction{
} }
public String obtnerGrupos() { public String obtnerGrupos() {
try {
setGrupos(grupoEstudioBO.obtenerGrupoEstudio(null)); setGrupos(grupoEstudioBO.obtenerGrupoEstudio(null));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return "regresaInformacion"; return "regresaInformacion";
} }
public String obtneGrupo() { public String obtneGrupo() {
try {
setGrupo(grupoEstudioBO.obtenerGrupo(idGrupo)); setGrupo(grupoEstudioBO.obtenerGrupo(idGrupo));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public String registraActualiza(){ public String registraActualiza() {
try {
grupoEstudioBO.registraActualizaGrupo(operacion, idGrupo, descripcion, estatus, orden, colapsa); grupoEstudioBO.registraActualizaGrupo(operacion, idGrupo, descripcion, estatus, orden, colapsa);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
......
...@@ -3,6 +3,8 @@ package com.mx.dla.dda.admin.catalogos.materiales.actions; ...@@ -3,6 +3,8 @@ package com.mx.dla.dda.admin.catalogos.materiales.actions;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -32,30 +34,10 @@ public class CatalogoMaterialesAction extends BaseAction { ...@@ -32,30 +34,10 @@ public class CatalogoMaterialesAction extends BaseAction {
catalogoMateriales = new ArrayList<CatalogoMaterialDTO>(); catalogoMateriales = new ArrayList<CatalogoMaterialDTO>();
catalogoMateriales = catalogoMaterialesDAO.catalogoMateriales(); catalogoMateriales = catalogoMaterialesDAO.catalogoMateriales();
} catch (ResultMapException e) {
/** logger.error("Error. {}", e);
* Temporal } catch (PersistenceException ibe) {
*/ logger.error("Error. {}", ibe);
// EstudioDTO estudioDTO1 = new EstudioDTO();
// estudioDTO1.setIdEstudio(1);
// estudioDTO1.setIdApartado(1);
// estudioDTO1.setClavePais("US");
// estudioDTO1.setClaveMoneda("USD");
// estudioDTO1.setDescripcionEstudio("FOX ENTERTAINMENT INC");
// estudioDTO1.setCodigoSap("0030800000");
// estudioDTO1.setSiglaDda(null);
// estudioDTO1.setOrden(1);
// catalogoEstudios.add(estudioDTO1);
/**
* Fin Temporal
*/
// catalogoEmpresaFilial = catalogoEmpresaFilialDAO.catalogoEmpresaFilial();
}catch(Exception exc){
log.error(exc.getMessage());
} }
log.info("Catalogo de materiales"); log.info("Catalogo de materiales");
......
package com.mx.dla.dda.admin.catalogos.pais.actions; package com.mx.dla.dda.admin.catalogos.pais.actions;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,6 +14,7 @@ import com.mx.dla.dda.admin.catalogos.pais.dtos.CatalogoPaisDTO; ...@@ -12,6 +14,7 @@ import com.mx.dla.dda.admin.catalogos.pais.dtos.CatalogoPaisDTO;
import com.mx.dla.dda.catalogos.bos.CatalogosBO; import com.mx.dla.dda.catalogos.bos.CatalogosBO;
import com.mx.dla.dda.catalogos.dtos.RegionVentaDTO; import com.mx.dla.dda.catalogos.dtos.RegionVentaDTO;
import com.mx.dla.dda.catalogos.dtos.TerritorioDTO; import com.mx.dla.dda.catalogos.dtos.TerritorioDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
public class CatalogoPaisAction extends BaseAction { public class CatalogoPaisAction extends BaseAction {
...@@ -38,54 +41,56 @@ public class CatalogoPaisAction extends BaseAction { ...@@ -38,54 +41,56 @@ public class CatalogoPaisAction extends BaseAction {
return SUCCESS; return SUCCESS;
} }
public String listadoPais(){ public String listadoPais() {
try{ try {
catalogoPais = new ArrayList<CatalogoPaisDTO>(); catalogoPais = new ArrayList<CatalogoPaisDTO>();
catalogoPais = catalogoPaisBO.getCatalogoPais(); catalogoPais = catalogoPaisBO.getCatalogoPais();
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
log.error("Error en [" + this.getClass() +"]", ibe); logger.error("Error. {}", e);
}catch(Exception e){ } catch (PersistenceException ibe) {
log.error("Error en [" + this.getClass() +"]", e); logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
} }
return "catalogoPaisLista"; return "catalogoPaisLista";
} }
public String guardaPais(){ public String guardaPais() {
try{ try {
regresoAction = true; regresoAction = true;
CatalogoPaisDTO paisNuevo = new CatalogoPaisDTO(this.pais); CatalogoPaisDTO paisNuevo = new CatalogoPaisDTO(this.pais);
catalogoPaisBO.guardarPais(paisNuevo); catalogoPaisBO.guardarPais(paisNuevo);
paisActualizado=true; paisActualizado = true;
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.paisActualizado=false; this.paisActualizado = false;
log.error("Error en [" + this.getClass() +"]", ibe); logger.error("Error. {}", e);
}catch(Exception e){ } catch (PersistenceException ibe) {
this.paisActualizado=false; this.paisActualizado = false;
log.error("Error en [" + this.getClass() +"]", e); logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} }
getListados(); getListados();
return "irCrearPais"; return "irCrearPais";
} }
public String irCrearPais(){ public String irCrearPais() {
try{
getListados(); getListados();
}catch(PersistenceException ibe){
this.paisActualizado=false;
log.error("Error en [" + this.getClass() +"]", ibe);
}catch(Exception e){
this.paisActualizado=false;
log.error("Error en [" + this.getClass() +"]", e);
}
return "irCrearPais"; return "irCrearPais";
} }
public String buscaPais( ){ public String buscaPais() {
try{ try {
log.info("*************Busca pais: " + this.pais.getNombre()); log.info("*************Busca pais: " + this.pais.getNombre());
int idPais = this.pais.getId(); int idPais = this.pais.getId();
...@@ -93,55 +98,72 @@ public class CatalogoPaisAction extends BaseAction { ...@@ -93,55 +98,72 @@ public class CatalogoPaisAction extends BaseAction {
getListados(); getListados();
log.info("****"+catalogoTerritorio.toString()); log.info("****" + catalogoTerritorio.toString());
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
log.error("Error en [" + this.getClass() +"]", ibe); logger.error("Error. {}", e);
}catch(Exception e){ } catch (PersistenceException ibe) {
log.error("Error en [" + this.getClass() +"]", e); logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
} }
return "paisConsultado"; return "paisConsultado";
} }
public String actualizaPais(){ public String actualizaPais() {
try{ try {
catalogoPaisBO.updatePais(pais); catalogoPaisBO.updatePais(pais);
int idPais = this.pais.getId(); int idPais = this.pais.getId();
this.pais = catalogoPaisBO.getPaisPorId(idPais); this.pais = catalogoPaisBO.getPaisPorId(idPais);
this.paisActualizado=true; this.paisActualizado = true;
this.regresoAction=true; this.regresoAction = true;
getListados(); getListados();
log.info("****"+catalogoTerritorio.toString()); log.info("****" + catalogoTerritorio.toString());
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
this.paisActualizado=false; this.paisActualizado = false;
log.error("Error en [" + this.getClass() +"]", ibe); logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
}catch(Exception e){ this.paisActualizado = false;
this.paisActualizado=false; logger.error("Error. {}", ibe);
log.error("Error en [" + this.getClass() +"]", e); } catch (TransaccionException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} }
return "paisConsultado"; return "paisConsultado";
} }
public void getListados(){ public void getListados() {
try{ try {
catalogoTerritorio = new ArrayList<TerritorioDTO>(); catalogoTerritorio = new ArrayList<TerritorioDTO>();
catalogoTerritorio = catalogosBO.obtenListaTerritorios(); catalogoTerritorio = catalogosBO.obtenListaTerritorios();
catalogoRegion = new ArrayList<RegionVentaDTO>(); catalogoRegion = new ArrayList<RegionVentaDTO>();
catalogoRegion = catalogosBO.getRegiones(); catalogoRegion = catalogosBO.getRegiones();
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
log.error("Error en [" + this.getClass() +"]", ibe); this.paisActualizado = false;
}catch(Exception e){ logger.error("Error. {}", e);
log.error("Error en [" + this.getClass() +"]", e); } catch (PersistenceException ibe) {
this.paisActualizado = false;
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
this.paisActualizado = false;
logger.error("Error. {}", e);
} }
} }
//Setter y getters // Setter y getters
public CatalogoPaisDTO getPais() { public CatalogoPaisDTO getPais() {
return pais; return pais;
} }
......
package com.mx.dla.dda.admin.catalogos.tipoCambio.actions; package com.mx.dla.dda.admin.catalogos.tipoCambio.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.tipoCambio.bos.TipoCambioBO; import com.mx.dla.dda.admin.catalogos.tipoCambio.bos.TipoCambioBO;
...@@ -39,11 +42,20 @@ public class TipoCambioAction extends BaseContratoAction { ...@@ -39,11 +42,20 @@ public class TipoCambioAction extends BaseContratoAction {
annios = tipoCambioBO.obtenerAnnios(); annios = tipoCambioBO.obtenerAnnios();
try { try {
paises = tipoCambioBO.obtenerPaises(); paises = tipoCambioBO.obtenerPaises();
}catch (TransaccionException e) { } catch (ResultMapException e) {
error = e.getMessage(); error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
} }
...@@ -52,22 +64,44 @@ public class TipoCambioAction extends BaseContratoAction { ...@@ -52,22 +64,44 @@ public class TipoCambioAction extends BaseContratoAction {
try { try {
nombreTipos = tipoCambioBO.obtenerNombreTipos(); nombreTipos = tipoCambioBO.obtenerNombreTipos();
mesesTipos = tipoCambioBO.obtenerMesTipo(annio, pais, nombreTipos); mesesTipos = tipoCambioBO.obtenerMesTipo(annio, pais, nombreTipos);
}catch (TransaccionException e) { } catch (ResultMapException e) {
error = e.getMessage(); error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
} }
public String guardarCambio() { public String guardarCambio() {
try{ try {
exito = tipoCambioBO.guardarCambios(mesesTipos); exito = tipoCambioBO.guardarCambios(mesesTipos);
mensaje = "Se actualizaron los cambios."; mensaje = "Se actualizaron los cambios.";
}catch (TransaccionException e) { } catch (ResultMapException e) {
error = e.getMessage(); error = "Ocurrio un error.";
mensaje = error; // revisar el uso
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
mensaje = error; // revisar el uso
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
mensaje = error; // revisar el uso
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
mensaje = error; // revisar el uso mensaje = error; // revisar el uso
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
......
...@@ -3,19 +3,23 @@ package com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.actions; ...@@ -3,19 +3,23 @@ package com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.actions;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO; import com.mx.dla.dda.admin.catalogos.addons.dtos.EstudioAddonDTO;
import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO; import com.mx.dla.dda.admin.catalogos.estudios.bos.EstudioBO;
import com.mx.dla.dda.admin.catalogos.estudios.dtos.CatalogoEstudioDTO;
import com.mx.dla.dda.admin.catalogos.tipoCambio.dtos.TipoCambioDTO; import com.mx.dla.dda.admin.catalogos.tipoCambio.dtos.TipoCambioDTO;
import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.bos.TipoCambioAddOnsBO; import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.bos.TipoCambioAddOnsBO;
import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.dtos.MesTiposAddOnsCTDTO; import com.mx.dla.dda.admin.catalogos.tipoCambioAddOns.dtos.MesTiposAddOnsCTDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException; import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.dda.excelMapper.exceptions.ExcelMapperException; import com.mx.dla.dda.excelMapper.exceptions.ExcelMapperException;
import com.mx.dla.dda.reporte.cpview.exception.ReportCostPerViewException;
public class TipoCambioAddOnsAction extends BaseContratoAction { public class TipoCambioAddOnsAction extends BaseContratoAction {
...@@ -44,14 +48,24 @@ public class TipoCambioAddOnsAction extends BaseContratoAction { ...@@ -44,14 +48,24 @@ public class TipoCambioAddOnsAction extends BaseContratoAction {
private TipoCambioAddOnsBO tipoCambioAddOnsBO; private TipoCambioAddOnsBO tipoCambioAddOnsBO;
@Override @Override
public String execute() throws Exception { public String execute() {
return SUCCESS; return SUCCESS;
} }
public String obtenerLista() { public String obtenerLista() {
try {
annios = tipoCambioAddOnsBO.obtenerAnnios(); annios = tipoCambioAddOnsBO.obtenerAnnios();
estudios = estudioBO.catalogoEstudiosAddOn(); estudios = estudioBO.catalogoEstudiosAddOn();
}catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -60,9 +74,18 @@ public class TipoCambioAddOnsAction extends BaseContratoAction { ...@@ -60,9 +74,18 @@ public class TipoCambioAddOnsAction extends BaseContratoAction {
try{ try{
nombreTipos = tipoCambioAddOnsBO.obtenerNombreMeses(); nombreTipos = tipoCambioAddOnsBO.obtenerNombreMeses();
tipoCambioAddOnsBO.cargaMasivaTipoCambioAddOn(Long.valueOf(annio), Long.parseLong(estudio), file, fileFileName, nombreTipos); tipoCambioAddOnsBO.cargaMasivaTipoCambioAddOn(Long.valueOf(annio), Long.parseLong(estudio), file, fileFileName, nombreTipos);
}catch(Exception e){ }catch (ResultMapException e) {
logger.error("Error ",e); error = "Ocurrio un error.";
e.printStackTrace(); logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
...@@ -73,9 +96,23 @@ public class TipoCambioAddOnsAction extends BaseContratoAction { ...@@ -73,9 +96,23 @@ public class TipoCambioAddOnsAction extends BaseContratoAction {
try { try {
fileInputStream = tipoCambioAddOnsBO.obtenerStreamReporte(Long.parseLong(estudio),annio); fileInputStream = tipoCambioAddOnsBO.obtenerStreamReporte(Long.parseLong(estudio),annio);
System.out.println("ao para descarga"+annio); logger.info("ao para descarga" + annio);
} catch (Exception e) { } catch (ResultMapException e) {
System.out.println(e.getMessage()); logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (IllegalArgumentException e) {
logger.error("Error. {}", e);
} catch (IllegalAccessException e) {
logger.error("Error. {}", e);
} catch (ParseException e) {
logger.error("Error. {}", e);
} catch (ExcelMapperException e) {
logger.error("Error. {}", e);
} catch (IOException e) {
logger.error("Error. {}", e);
} catch (ReportCostPerViewException e) {
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
} }
...@@ -85,8 +122,18 @@ public class TipoCambioAddOnsAction extends BaseContratoAction { ...@@ -85,8 +122,18 @@ public class TipoCambioAddOnsAction extends BaseContratoAction {
try { try {
nombreTipos = tipoCambioAddOnsBO.obtenerNombreMeses(); nombreTipos = tipoCambioAddOnsBO.obtenerNombreMeses();
mesesTipos = tipoCambioAddOnsBO.obtenerMesTipo(Long.valueOf(estudio), annio, nombreTipos); mesesTipos = tipoCambioAddOnsBO.obtenerMesTipo(Long.valueOf(estudio), annio, nombreTipos);
}catch (TransaccionException e) { }catch (ResultMapException e) {
error = e.getMessage(); error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
...@@ -97,9 +144,22 @@ public class TipoCambioAddOnsAction extends BaseContratoAction { ...@@ -97,9 +144,22 @@ public class TipoCambioAddOnsAction extends BaseContratoAction {
try{ try{
exito = tipoCambioAddOnsBO.guardarCambios(mesesTipos); exito = tipoCambioAddOnsBO.guardarCambios(mesesTipos);
mensaje = "Se actualizaron los cambios."; mensaje = "Se actualizaron los cambios.";
}catch (TransaccionException e) { }catch (ResultMapException e) {
error = e.getMessage(); error = "Ocurrio un error.";
mensaje = error; // revisar el uso mensaje = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
error = "Ocurrio un error.";
mensaje = "Ocurrio un error.";
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
error = "Ocurrio un error.";
mensaje = "Ocurrio un error.";
logger.error("Error. {}", e);
} catch (SQLException e) {
error = "Ocurrio un error.";
mensaje = "Ocurrio un error.";
logger.error("Error. {}", e);
} }
return SUCCESS; return SUCCESS;
......
package com.mx.dla.dda.admin.catalogos.transacciones.actions; package com.mx.dla.dda.admin.catalogos.transacciones.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO; import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.CategoriasDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.CategoriasDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class CategoriasAction extends BaseAction { public class CategoriasAction extends BaseAction {
private static final long serialVersionUID = 1L;
private List<CategoriasDTO> categorias; private List<CategoriasDTO> categorias;
private CategoriasDTO categoria; private CategoriasDTO categoria;
private String nombreCategoria; private String nombreCategoria;
...@@ -28,7 +35,18 @@ public class CategoriasAction extends BaseAction { ...@@ -28,7 +35,18 @@ public class CategoriasAction extends BaseAction {
} }
public String listadoCategorias() { public String listadoCategorias() {
try {
setCategorias(transacciones.getCategorias()); setCategorias(transacciones.getCategorias());
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -48,7 +66,18 @@ public class CategoriasAction extends BaseAction { ...@@ -48,7 +66,18 @@ public class CategoriasAction extends BaseAction {
public String guardaCategoria() { public String guardaCategoria() {
CategoriasDTO categoria = new CategoriasDTO(); CategoriasDTO categoria = new CategoriasDTO();
categoria.setNombre(nombreCategoria.toUpperCase()); categoria.setNombre(nombreCategoria.toUpperCase());
try {
transacciones.agregarCategoria(categoria); transacciones.agregarCategoria(categoria);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -57,13 +86,35 @@ public class CategoriasAction extends BaseAction { ...@@ -57,13 +86,35 @@ public class CategoriasAction extends BaseAction {
CategoriasDTO categoria = new CategoriasDTO(); CategoriasDTO categoria = new CategoriasDTO();
categoria.setIdCategoria(idCategoria); categoria.setIdCategoria(idCategoria);
categoria.setBorrado("0"); categoria.setBorrado("0");
try {
transacciones.eliminarCategoria(categoria); transacciones.eliminarCategoria(categoria);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String llamaObtenCategorias() throws Exception { public String llamaObtenCategorias() throws Exception {
try {
setCategoria(transacciones.getCategoriaById(idCategoria)); setCategoria(transacciones.getCategoriaById(idCategoria));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -72,7 +123,18 @@ public class CategoriasAction extends BaseAction { ...@@ -72,7 +123,18 @@ public class CategoriasAction extends BaseAction {
CategoriasDTO categoria = new CategoriasDTO(); CategoriasDTO categoria = new CategoriasDTO();
categoria.setIdCategoria(idCategoria); categoria.setIdCategoria(idCategoria);
categoria.setNombre(nombreCategoria.toUpperCase()); categoria.setNombre(nombreCategoria.toUpperCase());
try {
transacciones.updateCategoria(categoria); transacciones.updateCategoria(categoria);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.admin.catalogos.transacciones.actions; package com.mx.dla.dda.admin.catalogos.transacciones.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO; import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class EstudiosTransAction extends BaseAction { public class EstudiosTransAction extends BaseAction {
private static final long serialVersionUID = 1L;
private List<EstudiosTransDTO> estudiosTrans; private List<EstudiosTransDTO> estudiosTrans;
private EstudiosTransDTO estudio; private EstudiosTransDTO estudio;
private String nombreEstudio; private String nombreEstudio;
...@@ -30,7 +37,18 @@ public class EstudiosTransAction extends BaseAction { ...@@ -30,7 +37,18 @@ public class EstudiosTransAction extends BaseAction {
} }
public String listadoEstudiosTrans() { public String listadoEstudiosTrans() {
try {
setEstudiosTrans(transacciones.getEstudiosTrans()); setEstudiosTrans(transacciones.getEstudiosTrans());
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -51,7 +69,18 @@ public class EstudiosTransAction extends BaseAction { ...@@ -51,7 +69,18 @@ public class EstudiosTransAction extends BaseAction {
EstudiosTransDTO estudio = new EstudiosTransDTO(); EstudiosTransDTO estudio = new EstudiosTransDTO();
estudio.setNombre(nombreEstudio); estudio.setNombre(nombreEstudio);
estudio.setRevenueShare(revenueShare); estudio.setRevenueShare(revenueShare);
try {
transacciones.agregarEstudioTrans(estudio); transacciones.agregarEstudioTrans(estudio);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -60,13 +89,35 @@ public class EstudiosTransAction extends BaseAction { ...@@ -60,13 +89,35 @@ public class EstudiosTransAction extends BaseAction {
EstudiosTransDTO estudio = new EstudiosTransDTO(); EstudiosTransDTO estudio = new EstudiosTransDTO();
estudio.setIdEstudio(idEstudio); estudio.setIdEstudio(idEstudio);
estudio.setBorrado("0"); estudio.setBorrado("0");
try {
transacciones.eliminarEstudio(estudio); transacciones.eliminarEstudio(estudio);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String llamaObtenEstudio() throws Exception { public String llamaObtenEstudio() throws Exception {
try {
setEstudio(transacciones.getEstudioTransById(idEstudio)); setEstudio(transacciones.getEstudioTransById(idEstudio));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -77,7 +128,18 @@ public class EstudiosTransAction extends BaseAction { ...@@ -77,7 +128,18 @@ public class EstudiosTransAction extends BaseAction {
estudio.setNombre(nombreEstudio); estudio.setNombre(nombreEstudio);
estudio.setRevenueShare(revenueShare); estudio.setRevenueShare(revenueShare);
estudio.setBorrado("0"); estudio.setBorrado("0");
try {
transacciones.updateEstudioTrans(estudio); transacciones.updateEstudioTrans(estudio);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.admin.catalogos.transacciones.actions; package com.mx.dla.dda.admin.catalogos.transacciones.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO; import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.ExcepcionesTransDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.ExcepcionesTransDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class ExcepcionesTransAction extends BaseAction { public class ExcepcionesTransAction extends BaseAction {
private static final long serialVersionUID = 1L;
private List<ExcepcionesTransDTO> excepciones; private List<ExcepcionesTransDTO> excepciones;
private List<EstudiosTransDTO> estudiosTrans; private List<EstudiosTransDTO> estudiosTrans;
private ExcepcionesTransDTO excepcion; private ExcepcionesTransDTO excepcion;
...@@ -37,7 +44,18 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -37,7 +44,18 @@ public class ExcepcionesTransAction extends BaseAction {
} }
public String listadoExcepciones() { public String listadoExcepciones() {
try {
setExcepciones(transacciones.getExcepciones()); setExcepciones(transacciones.getExcepciones());
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -50,8 +68,23 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -50,8 +68,23 @@ public class ExcepcionesTransAction extends BaseAction {
} }
public String dirigirAgregar() throws Exception { public String dirigirAgregar() throws Exception {
try {
setEstudiosTrans(transacciones.getEstudiosTrans()); setEstudiosTrans(transacciones.getEstudiosTrans());
excepcionActualizada = true; excepcionActualizada = true;
} catch (ResultMapException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
excepcionActualizada = false;
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -63,7 +96,10 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -63,7 +96,10 @@ public class ExcepcionesTransAction extends BaseAction {
excepcion.setRevenueShare(revenueShare); excepcion.setRevenueShare(revenueShare);
excepcion.setFechaInicio(fechaInicio); excepcion.setFechaInicio(fechaInicio);
excepcion.setFechaFin(fechaFin); excepcion.setFechaFin(fechaFin);
if(transacciones.validaExcepcionExistente(excepcion) == null && transacciones.validaMescerrado(excepcion) == null) {
try {
if (transacciones.validaExcepcionExistente(excepcion) == null
&& transacciones.validaMescerrado(excepcion) == null) {
setExcepcion(excepcion); setExcepcion(excepcion);
transacciones.agregarExcepcion(excepcion); transacciones.agregarExcepcion(excepcion);
excepcionActualizada = true; excepcionActualizada = true;
...@@ -71,6 +107,19 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -71,6 +107,19 @@ public class ExcepcionesTransAction extends BaseAction {
setExcepcion(null); setExcepcion(null);
excepcionActualizada = false; excepcionActualizada = false;
} }
} catch (ResultMapException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
excepcionActualizada = false;
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -79,14 +128,36 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -79,14 +128,36 @@ public class ExcepcionesTransAction extends BaseAction {
ExcepcionesTransDTO excepcion = new ExcepcionesTransDTO(); ExcepcionesTransDTO excepcion = new ExcepcionesTransDTO();
excepcion.setIdExcepcion(idExcepcion); excepcion.setIdExcepcion(idExcepcion);
excepcion.setBorrado("0"); excepcion.setBorrado("0");
try {
transacciones.eliminarExcepcion(excepcion); transacciones.eliminarExcepcion(excepcion);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String llamaObtenExcepcion() throws Exception { public String llamaObtenExcepcion() throws Exception {
try {
setEstudiosTrans(transacciones.getEstudiosTrans()); setEstudiosTrans(transacciones.getEstudiosTrans());
setExcepcion(transacciones.getExcepcionesById(idExcepcion)); setExcepcion(transacciones.getExcepcionesById(idExcepcion));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
...@@ -99,7 +170,9 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -99,7 +170,9 @@ public class ExcepcionesTransAction extends BaseAction {
excepcion.setRevenueShare(revenueShare); excepcion.setRevenueShare(revenueShare);
excepcion.setFechaInicio(fechaInicio); excepcion.setFechaInicio(fechaInicio);
excepcion.setFechaFin(fechaFin); excepcion.setFechaFin(fechaFin);
if(transacciones.validaMescerrado(excepcion) == null) {
try {
if (transacciones.validaMescerrado(excepcion) == null) {
setExcepcion(excepcion); setExcepcion(excepcion);
transacciones.updateExcepcion(excepcion); transacciones.updateExcepcion(excepcion);
excepcionActualizada = true; excepcionActualizada = true;
...@@ -107,6 +180,19 @@ public class ExcepcionesTransAction extends BaseAction { ...@@ -107,6 +180,19 @@ public class ExcepcionesTransAction extends BaseAction {
setExcepcion(null); setExcepcion(null);
excepcionActualizada = false; excepcionActualizada = false;
} }
} catch (ResultMapException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
excepcionActualizada = false;
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
} catch (SQLException e) {
excepcionActualizada = false;
logger.error("Error. {}", e);
}
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.admin.catalogos.transacciones.actions; package com.mx.dla.dda.admin.catalogos.transacciones.actions;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat; import java.sql.SQLException;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO; import com.mx.dla.dda.admin.catalogos.transacciones.bos.TransaccionesBO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.EstudiosTransDTO;
import com.mx.dla.dda.admin.catalogos.transacciones.dtos.ReporteGeneralDTO; import com.mx.dla.dda.admin.catalogos.transacciones.dtos.ReporteGeneralDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class ReporteGeneralAction extends BaseAction { public class ReporteGeneralAction extends BaseAction {
private static final long serialVersionUID = 1L;
private List<EstudiosTransDTO> estudiosTrans; private List<EstudiosTransDTO> estudiosTrans;
private List<ReporteGeneralDTO> reporteGeneral; private List<ReporteGeneralDTO> reporteGeneral;
private String estudio; private String estudio;
...@@ -34,7 +39,18 @@ public class ReporteGeneralAction extends BaseAction { ...@@ -34,7 +39,18 @@ public class ReporteGeneralAction extends BaseAction {
@Override @Override
public String execute() throws Exception { public String execute() throws Exception {
setPmns(); setPmns();
try {
setEstudiosTrans(transacciones.getEstudiosTrans()); setEstudiosTrans(transacciones.getEstudiosTrans());
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -47,38 +63,82 @@ public class ReporteGeneralAction extends BaseAction { ...@@ -47,38 +63,82 @@ public class ReporteGeneralAction extends BaseAction {
} }
public String generarReporte() throws Exception { public String generarReporte() throws Exception {
System.out.println("Datos para reporte Fecha: " + fecha + " Estudio: " + estudio); logger.info("Datos para reporte Fecha: " + fecha + " Estudio: " + estudio);
String [] date = fecha.split("/"); String[] date = fecha.split("/");
setReporteGeneral(transacciones.reporteGeneral(date[0],date[1],estudio));
try {
setReporteGeneral(transacciones.reporteGeneral(date[0], date[1], estudio));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setPmns(); setPmns();
System.out.println("Recuperando reporte: " + getReporteGeneral().size()); logger.info("Recuperando reporte: " + getReporteGeneral().size());
return SUCCESS; return SUCCESS;
} }
public String generarExcel() throws Exception { public String generarExcel() throws Exception {
System.out.println("Datos para reporte Fecha: " + fecha + " Estudio: " + estudio); logger.info("Datos para reporte Fecha: " + fecha + " Estudio: " + estudio);
String [] date = fecha.split("/"); String[] date = fecha.split("/");
setFileInputStream(transacciones.obtenerReporteEnExcel(date[0],date[1],estudio));
try {
setFileInputStream(transacciones.obtenerReporteEnExcel(date[0], date[1], estudio));
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
setFileName(date[0] + "-" + date[1] + "-01"); setFileName(date[0] + "-" + date[1] + "-01");
setPmns(); setPmns();
return SUCCESS; return SUCCESS;
} }
public String cerrarReporte(){ public String cerrarReporte() {
try {
transacciones.cerrarRporte(getfecha()); transacciones.cerrarRporte(getfecha());
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public String reabrirReporte(){ public String reabrirReporte() {
try {
transacciones.reabrirReporte(mes, anio); transacciones.reabrirReporte(mes, anio);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (PersistenceException ibe) {
logger.error("Error. {}", ibe);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
public String getfecha() { public String getfecha() {
Integer year = Calendar.getInstance().get(Calendar.YEAR); Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer month = Calendar.getInstance().get(Calendar.MONTH); Integer month = Calendar.getInstance().get(Calendar.MONTH);
if(month == 0) { if (month == 0) {
year = year -1; year = year - 1;
month = 12; month = 12;
} }
setMes(StringUtils.leftPad(month.toString(), 2)); setMes(StringUtils.leftPad(month.toString(), 2));
......
package com.mx.dla.dda.admin.catalogos.usuario.actions;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.admin.catalogos.usuario.bos.CatalogoUsuarioBO;
import com.mx.dla.dda.admin.catalogos.usuario.dtos.CatalogoUsuarioDTO;
import com.mx.dla.dda.catalogos.dtos.CatalogoDTO;
import com.mx.dla.global.actions.BaseAction;
public class CatalogoUsuarioAction extends BaseAction {
private static final long serialVersionUID = -7755051578399274173L;
private List<CatalogoUsuarioDTO> usuarios;
private List<CatalogoDTO> empresas;
private List<CatalogoDTO> areas;
private List<CatalogoDTO> perfiles;
private List<CatalogoDTO> estudios;
private CatalogoUsuarioDTO usuario;
private String errorMensaje;
@Autowired
private CatalogoUsuarioBO catalogoUsuarioBO;
@Override
public String execute() throws Exception {
return SUCCESS;
}
public String obtenerListaUsuarios() {
try {
logger.info("obtenerListaUsuarios");
usuarios = catalogoUsuarioBO.obtenListadoUsuarios();
logger.info("usuarios: {}", usuarios);
} catch (Exception e) {
errorMensaje = e.getMessage();
}
return SUCCESS;
}
public String obtenerCatalogos() {
try {
logger.info("obtenerCatalogos");
empresas = catalogoUsuarioBO.obtenCatalogoEmpresas();
areas = catalogoUsuarioBO.obtenCatalogoAreas();
perfiles = catalogoUsuarioBO.obtenCatalogoPerfiles();
// estudios = catalogoUsuarioBO.obtenCatalogoEstudios();
logger.info("empresas: {}", empresas);
logger.info("areas: {}", areas);
logger.info("perfiles: {}", perfiles);
// logger.info("estudios: {}", estudios);
} catch (Exception e) {
errorMensaje = e.getMessage();
}
return SUCCESS;
}
public String obtenerEstudiosDisponibles() {
try {
logger.info("obtenerEstudiosDisponibles");
logger.info("usuario: {}", usuario);
estudios = catalogoUsuarioBO.obtenEstudiosPorUsuario(usuario, false);
logger.info("estudios: {}", estudios);
} catch (Exception e) {
errorMensaje = e.getMessage();
}
return SUCCESS;
}
public String obtenerEstudiosElegidos() {
try {
logger.info("obtenerEstudiosElegidos");
logger.info("usuario: {}", usuario);
estudios = catalogoUsuarioBO.obtenEstudiosPorUsuario(usuario, true);
logger.info("estudios: {}", estudios);
} catch (Exception e) {
errorMensaje = e.getMessage();
}
return SUCCESS;
}
public String guardarUsuario() {
try {
logger.info("guardaUsuario");
logger.info("usuario: {}", usuario);
logger.info("estudios: {}", estudios);
catalogoUsuarioBO.guardaUsuario(usuario, estudios);
logger.info("Done!");
} catch (Exception e) {
errorMensaje = e.getMessage();
}
return SUCCESS;
}
public List<CatalogoUsuarioDTO> getUsuarios() {
return usuarios;
}
public void setUsuarios(List<CatalogoUsuarioDTO> usuarios) {
this.usuarios = usuarios;
}
public List<CatalogoDTO> getEmpresas() {
return empresas;
}
public void setEmpresas(List<CatalogoDTO> empresas) {
this.empresas = empresas;
}
public List<CatalogoDTO> getAreas() {
return areas;
}
public void setAreas(List<CatalogoDTO> areas) {
this.areas = areas;
}
public List<CatalogoDTO> getPerfiles() {
return perfiles;
}
public void setPerfiles(List<CatalogoDTO> perfiles) {
this.perfiles = perfiles;
}
public List<CatalogoDTO> getEstudios() {
return estudios;
}
public void setEstudios(List<CatalogoDTO> estudios) {
this.estudios = estudios;
}
public String getErrorMensaje() {
return errorMensaje;
}
public void setErrorMensaje(String errorMensaje) {
this.errorMensaje = errorMensaje;
}
public CatalogoUsuarioDTO getUsuario() {
return usuario;
}
public void setUsuario(CatalogoUsuarioDTO usuario) {
this.usuario = usuario;
}
}
\ No newline at end of file
package com.mx.dla.dda.admin.presupuestos.actions; package com.mx.dla.dda.admin.presupuestos.actions;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.JsonMappingException;
...@@ -15,9 +17,10 @@ import com.mx.dla.dda.admin.presupuestos.bos.PresupuestoBO; ...@@ -15,9 +17,10 @@ import com.mx.dla.dda.admin.presupuestos.bos.PresupuestoBO;
import com.mx.dla.dda.admin.presupuestos.dtos.PresupuestoApartadoDTO; import com.mx.dla.dda.admin.presupuestos.dtos.PresupuestoApartadoDTO;
import com.mx.dla.dda.admin.presupuestos.dtos.PresupuestoDTO; import com.mx.dla.dda.admin.presupuestos.dtos.PresupuestoDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class PresupuestosAction extends BaseContratoAction{ public class PresupuestosAction extends BaseContratoAction {
private static final long serialVersionUID = 5280088693174941192L; private static final long serialVersionUID = 5280088693174941192L;
...@@ -31,17 +34,26 @@ public class PresupuestosAction extends BaseContratoAction{ ...@@ -31,17 +34,26 @@ public class PresupuestosAction extends BaseContratoAction{
@Autowired @Autowired
private PresupuestoBO presupuestoBO; private PresupuestoBO presupuestoBO;
public String index(){ public String index() {
return Action.SUCCESS; return Action.SUCCESS;
} }
public String guardaMonto(){ public String guardaMonto() {
System.out.println("Almacenando presupuesto"); System.out.println("Almacenando presupuesto");
try { try {
mensaje = presupuestoBO.almacenaMonto(anio,monto); mensaje = presupuestoBO.almacenaMonto(anio, monto);
}catch(Exception e){ } catch (ResultMapException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
...@@ -49,39 +61,39 @@ public class PresupuestosAction extends BaseContratoAction{ ...@@ -49,39 +61,39 @@ public class PresupuestosAction extends BaseContratoAction{
return "SUCCESS"; return "SUCCESS";
} }
public String cargarPresupuestos() {
public String cargarPresupuestos(){ try {
try
{
logger.debug("Obteniendo presupuestos"); logger.debug("Obteniendo presupuestos");
presupuestos = presupuestoBO.obtenerPresptoXTipo(tipo); presupuestos = presupuestoBO.obtenerPresptoXTipo(tipo);
logger.debug("Obtenido presupuestos"); logger.debug("Obtenido presupuestos");
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){ } catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
return "json"; return "json";
} }
public String redirectEditPresupuesto(){ public String redirectEditPresupuesto() {
try try {
{
this.getServletRequest().setAttribute("tipo", this.tipo); this.getServletRequest().setAttribute("tipo", this.tipo);
this.getSession().put("pmn", this.getPmn()); this.getSession().put("pmn", this.getPmn());
}catch(PersistenceException ibe){ } catch (PersistenceException ibe) {
logger.error("Error.", ibe); logger.error("Error.", ibe);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){
logger.error("Error.", e);
mensaje = "Ocurrio un error en la operacion.";
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
public String guardarPresupuesto(){ public String guardarPresupuesto() {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
logger.debug("Se inicia guarda presupuestos."); logger.debug("Se inicia guarda presupuestos.");
...@@ -96,38 +108,51 @@ public class PresupuestosAction extends BaseContratoAction{ ...@@ -96,38 +108,51 @@ public class PresupuestosAction extends BaseContratoAction{
} catch (IOException ioe) { } catch (IOException ioe) {
logger.error("Error. {}", ioe); logger.error("Error. {}", ioe);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){ } catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
return "json"; return "json";
} }
public String cargarApartadosAnio(){ public String cargarApartadosAnio() {
try try {
{
logger.info("Se obtiene apartado x anio"); logger.info("Se obtiene apartado x anio");
presupuesto = presupuestoBO.obtenerApartadosPresptoXAnio(this.tipo, this.anio.intValue()); presupuesto = presupuestoBO.obtenerApartadosPresptoXAnio(this.tipo, this.anio.intValue());
logger.info("Se termina obtener apartado x anio"); logger.info("Se termina obtener apartado x anio");
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){ } catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
return "json"; return "json";
} }
public String redistribuirPresupuesto(){ public String redistribuirPresupuesto() {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
logger.debug("Se inicia redistribucion"); logger.debug("Se inicia redistribucion");
List<PresupuestoApartadoDTO> apartados = mapper.readValue(mensaje, new TypeReference<List<PresupuestoApartadoDTO>>(){}); List<PresupuestoApartadoDTO> apartados = mapper.readValue(mensaje,
new TypeReference<List<PresupuestoApartadoDTO>>() {
});
mensaje = null; mensaje = null;
mensaje = presupuestoBO.redistribuirApartados(apartados, Integer.parseInt(tipo)); mensaje = presupuestoBO.redistribuirApartados(apartados, Integer.parseInt(tipo));
...@@ -138,22 +163,30 @@ public class PresupuestosAction extends BaseContratoAction{ ...@@ -138,22 +163,30 @@ public class PresupuestosAction extends BaseContratoAction{
} catch (IOException ioe) { } catch (IOException ioe) {
logger.error("Error. {}", ioe); logger.error("Error. {}", ioe);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){ } catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
return "json"; return "json";
} }
public String redistribuirPresupuestoMontoDisp(){ public String redistribuirPresupuestoMontoDisp() {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
logger.debug("Se inicia redistribucion con monto disponible"); logger.debug("Se inicia redistribucion con monto disponible");
List<PresupuestoApartadoDTO> apartados = mapper.readValue(mensaje, new TypeReference<List<PresupuestoApartadoDTO>>(){}); List<PresupuestoApartadoDTO> apartados = mapper.readValue(mensaje,
new TypeReference<List<PresupuestoApartadoDTO>>() {
});
mensaje = null; mensaje = null;
mensaje = presupuestoBO.redistribuirApartadosMontoDispo(apartados, Integer.parseInt(tipo)); mensaje = presupuestoBO.redistribuirApartadosMontoDispo(apartados, Integer.parseInt(tipo));
...@@ -164,25 +197,53 @@ public class PresupuestosAction extends BaseContratoAction{ ...@@ -164,25 +197,53 @@ public class PresupuestosAction extends BaseContratoAction{
} catch (IOException ioe) { } catch (IOException ioe) {
logger.error("Error. {}", ioe); logger.error("Error. {}", ioe);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(PersistenceException ibe){ } catch (ResultMapException e) {
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
}catch(Exception e){ } catch (PersistenceException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (TransaccionException e) {
logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion.";
} catch (SQLException e) {
logger.error("Error. {}", e); logger.error("Error. {}", e);
mensaje = "Ocurrio un error en la operacion."; mensaje = "Ocurrio un error en la operacion.";
} }
return "json"; return "json";
} }
public PresupuestoDTO getPresupuesto() {
return presupuesto;
}
public PresupuestoDTO getPresupuesto() { return presupuesto; } public String getTipo() {
public String getTipo() { return tipo; } return tipo;
public String getMensaje() { return mensaje; } }
public List<PresupuestoDTO> getPresupuestos() {return presupuestos; }
public void setPresupuesto(PresupuestoDTO presupuesto) { this.presupuesto = presupuesto; } public String getMensaje() {
public void setTipo(String tipo) { this.tipo = tipo; } return mensaje;
public void setMensaje(String mensaje) { this.mensaje = mensaje; } }
public void setAnio(Integer anio) { this.anio = anio; }
public List<PresupuestoDTO> getPresupuestos() {
return presupuestos;
}
public void setPresupuesto(PresupuestoDTO presupuesto) {
this.presupuesto = presupuesto;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public void setMensaje(String mensaje) {
this.mensaje = mensaje;
}
public void setAnio(Integer anio) {
this.anio = anio;
}
public double getMonto() { public double getMonto() {
return monto; return monto;
......
package com.mx.dla.dda.admin.revenue.actions; package com.mx.dla.dda.admin.revenue.actions;
import java.util.ArrayList; import java.sql.SQLException;
import java.util.List;
import java.util.Locale;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
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 java.text.DateFormat;
import java.text.SimpleDateFormat;
import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO; import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO;
import com.mx.dla.dda.catalogos.dtos.RegionVentaDTO; import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.dda.catalogos.dtos.TerritorioDTO;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class RevenuePorcAction extends BaseAction { public class RevenuePorcAction extends BaseAction {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
private static Logger log = Logger.getLogger(RevenuePorcAction.class); private static Logger log = Logger.getLogger(RevenuePorcAction.class);
private boolean regresoAction;
@Autowired @Autowired
private CargaTransaccionesBO bdsp; private CargaTransaccionesBO bdsp;
//private BloqueoSAPBO BloqueoSAPBO;
private String fecha; private String fecha;
...@@ -38,16 +32,17 @@ public class RevenuePorcAction extends BaseAction { ...@@ -38,16 +32,17 @@ public class RevenuePorcAction extends BaseAction {
public String ejecutaSP() { public String ejecutaSP() {
try { try {
bdsp.ejecutaSP_porcR(fecha); bdsp.ejecutaSP_porcR(fecha);
} catch (ResultMapException e) {
log.error("Error. {}", e);
} catch (Exception e) { } catch (PersistenceException e) {
addActionError("Ha ocurrido el siguiente error durante la consulta: " log.error("Error. {}", e);
+ e.getMessage()); } catch (TransaccionException e) {
log.error("Error. {}", e);
} catch (SQLException e) {
log.error("Error. {}", e);
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
......
...@@ -2,11 +2,13 @@ package com.mx.dla.dda.carga.suscriptor.actions; ...@@ -2,11 +2,13 @@ package com.mx.dla.dda.carga.suscriptor.actions;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.JsonMappingException;
...@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.carga.suscriptor.bos.CargaSuscriptorBO; import com.mx.dla.dda.carga.suscriptor.bos.CargaSuscriptorBO;
import com.mx.dla.dda.carga.suscriptor.dtos.CargaSuscripcionDTO; import com.mx.dla.dda.carga.suscriptor.dtos.CargaSuscripcionDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class CargaSuscriptoresAction extends BaseContratoAction { public class CargaSuscriptoresAction extends BaseContratoAction {
...@@ -39,18 +42,20 @@ public class CargaSuscriptoresAction extends BaseContratoAction { ...@@ -39,18 +42,20 @@ public class CargaSuscriptoresAction extends BaseContratoAction {
private CargaSuscriptorBO cargaSuscriptorBO; private CargaSuscriptorBO cargaSuscriptorBO;
public String execute() { public String execute() {
try {
try{
listado = cargaSuscriptorBO.getDatosSuscripcion(mes, annio); listado = cargaSuscriptorBO.getDatosSuscripcion(mes, annio);
} catch (ResultMapException e) {
}catch(PersistenceException ibe){
this.msgError = "Ocurrió un error al obtener los datos."; this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" +this.getClass() +"]", ibe); logger.error("Error en [" + this.getClass() + "]", e);
} catch (PersistenceException e) {
}catch(Exception e){
this.msgError = "Ocurrió un error al obtener los datos."; this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" +this.getClass() +"]", e); logger.error("Error en [" + this.getClass() + "]", e);
} catch (TransaccionException e) {
this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" + this.getClass() + "]", e);
} catch (SQLException e) {
this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" + this.getClass() + "]", e);
} }
return Action.SUCCESS; return Action.SUCCESS;
...@@ -64,7 +69,8 @@ public class CargaSuscriptoresAction extends BaseContratoAction { ...@@ -64,7 +69,8 @@ public class CargaSuscriptoresAction extends BaseContratoAction {
logger.debug("Actualizacion Carga:" + request); logger.debug("Actualizacion Carga:" + request);
listado = mapper.readValue(request, new TypeReference<List<CargaSuscripcionDTO>>(){}); listado = mapper.readValue(request, new TypeReference<List<CargaSuscripcionDTO>>() {
});
cargaSuscriptorBO.actualizarSuscriptores(listado); cargaSuscriptorBO.actualizarSuscriptores(listado);
logger.debug("Se actulizaron valores carga"); logger.debug("Se actulizaron valores carga");
...@@ -73,20 +79,22 @@ public class CargaSuscriptoresAction extends BaseContratoAction { ...@@ -73,20 +79,22 @@ public class CargaSuscriptoresAction extends BaseContratoAction {
} catch (JsonParseException | JsonGenerationException | JsonMappingException je) { } catch (JsonParseException | JsonGenerationException | JsonMappingException je) {
this.msgError = "Ocurrió un error al guardar los datos."; this.msgError = "Ocurrió un error al guardar los datos.";
logger.error("Error en [" +this.getClass() +"]", je); logger.error("Error en [" + this.getClass() + "]", je);
} catch (IOException ioe) { } catch (IOException ioe) {
this.msgError = "Ocurrió un error al guardar los datos."; this.msgError = "Ocurrió un error al guardar los datos.";
logger.error("Error en [" +this.getClass() +"]", ioe); logger.error("Error en [" + this.getClass() + "]", ioe);
} catch (ResultMapException e) {
}catch(PersistenceException ibe){ this.msgError = "Ocurrió un error al obtener los datos.";
this.msgError = "Ocurrió un error al guardar los datos."; logger.error("Error en [" + this.getClass() + "]", e);
logger.error("Error en [" +this.getClass() +"]", ibe); } catch (PersistenceException e) {
return Action.ERROR; this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" + this.getClass() + "]", e);
}catch(Exception e){ } catch (TransaccionException e) {
this.msgError = "Ocurrió un error al guardar los datos."; this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" +this.getClass() +"]", e); logger.error("Error en [" + this.getClass() + "]", e);
} catch (SQLException e) {
this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" + this.getClass() + "]", e);
} }
return Action.SUCCESS; return Action.SUCCESS;
...@@ -94,15 +102,14 @@ public class CargaSuscriptoresAction extends BaseContratoAction { ...@@ -94,15 +102,14 @@ public class CargaSuscriptoresAction extends BaseContratoAction {
public String cargaExcel() { public String cargaExcel() {
try{ try {
setInformacionExcel(cargaSuscriptorBO.obtenInformacionExcel(fileUpload, fileUploadFileName)); setInformacionExcel(cargaSuscriptorBO.obtenInformacionExcel(fileUpload, fileUploadFileName));
logger.debug("Se leyo la informacion."); logger.debug("Se leyo la informacion.");
}catch(Exception ex) { } catch (TransaccionException e) {
setErrores("Fallo la carga de excel."); this.msgError = "Ocurrió un error al obtener los datos.";
logger.error("Error en [" + this.getClass() + "]", e);
} }
logger.debug("Se termino el action"); logger.debug("Se termino el action");
return Action.SUCCESS; return Action.SUCCESS;
} }
......
...@@ -22,24 +22,17 @@ public class DescargaPlantillaAction extends BaseContratoAction{ ...@@ -22,24 +22,17 @@ public class DescargaPlantillaAction extends BaseContratoAction{
private CargaSuscriptorBO cargaSuscriptorBO; private CargaSuscriptorBO cargaSuscriptorBO;
public String execute() throws Exception { public String execute() throws Exception {
String[] empresasSplited = {"Clarovideo Brazil", "Net Servicios", "Clarovideo Argentina", "Clarovideo Chile", String[] empresasSplited = {"Clarovideo Brazil", "Net Servicios", "Clarovideo Argentina", "Clarovideo Chile",
"Clarovideo Colombia", "Clarovideo Costa Rica", "Clarovideo Dominicana", "Clarovideo Ecuador", "Clarovideo Colombia", "Clarovideo Costa Rica", "Clarovideo Dominicana", "Clarovideo Ecuador",
"Clarovideo El Salvador", "Clarovideo Guatemala", "Clarovideo Honduras", "Clarovideo Mxico", "Clarovideo El Salvador", "Clarovideo Guatemala", "Clarovideo Honduras", "Clarovideo Mxico",
"Clarovideo Nicaragua", "Clarovideo Per", "Clarovideo Uruguay"}; "Clarovideo Nicaragua", "Clarovideo Per", "Clarovideo Uruguay"};
logger.debug(empresas); logger.debug(empresas);
if(empresas != null && !empresas.equals("")){ if(empresas != null && !empresas.equals("")){
empresasSplited = empresas.split(","); empresasSplited = empresas.split(",");
} }
logger.debug("[{}]", empresasSplited); logger.debug("[{}]", empresasSplited);
fileInputStream = new ByteArrayInputStream(cargaSuscriptorBO.obtenPlantilla(empresasSplited)); fileInputStream = new ByteArrayInputStream(cargaSuscriptorBO.obtenPlantilla(empresasSplited));
fileName = "nombre"; fileName = "nombre";
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.carga.transaccion.actions; package com.mx.dla.dda.carga.transaccion.actions;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.sql.SQLException;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.admin.dtos.UsuarioDTO; import com.mx.dla.admin.dtos.UsuarioDTO;
...@@ -54,9 +59,29 @@ public class CargaArchivoTransaccionesAction extends BaseContratoAction { ...@@ -54,9 +59,29 @@ public class CargaArchivoTransaccionesAction extends BaseContratoAction {
return SUCCESS; return SUCCESS;
} catch (ResultMapException e) {
error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error;
} catch (PersistenceException e) {
error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error;
} catch (TransaccionException e) { } catch (TransaccionException e) {
error = e.getMessage(); error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error); logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error;
} catch (SQLException e) {
error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error;
} catch (SocketTimeoutException e) {
error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error;
} catch (IOException e) {
error = e.getMessage();
logger.error("Error al invocar cargaTransaccionesBO : " + error);
return error; return error;
} }
......
package com.mx.dla.dda.carga.transaccion.actions; package com.mx.dla.dda.carga.transaccion.actions;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.struts2.ServletActionContext; import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,6 +16,7 @@ import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO; ...@@ -12,6 +16,7 @@ import com.mx.dla.dda.carga.transaccion.bos.CargaTransaccionesBO;
import com.mx.dla.dda.carga.transaccion.dtos.RowReporteCargaDTO; import com.mx.dla.dda.carga.transaccion.dtos.RowReporteCargaDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.listado.dtos.ContentType; import com.mx.dla.dda.contrato.listado.dtos.ContentType;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class DescargaArchivoVistaPreviaAction extends BaseContratoAction { public class DescargaArchivoVistaPreviaAction extends BaseContratoAction {
...@@ -29,14 +34,8 @@ public class DescargaArchivoVistaPreviaAction extends BaseContratoAction { ...@@ -29,14 +34,8 @@ public class DescargaArchivoVistaPreviaAction extends BaseContratoAction {
logger.info(algo); logger.info(algo);
String nombre; String nombre;
byte[] vistaPreviac; byte[] vistaPreviac;
try { try {
vistaPreviac = cargaTransaccionesBO.descargaArchivoVistaPrevia(vistaPrevia); vistaPreviac = cargaTransaccionesBO.descargaArchivoVistaPrevia(vistaPrevia);
System.out.println("algo..."+vistaPrevia);
nombre = "reporteVistaPreviaCargaTransacciones"; nombre = "reporteVistaPreviaCargaTransacciones";
HttpServletResponse response = ServletActionContext.getResponse(); HttpServletResponse response = ServletActionContext.getResponse();
...@@ -48,16 +47,19 @@ public class DescargaArchivoVistaPreviaAction extends BaseContratoAction { ...@@ -48,16 +47,19 @@ public class DescargaArchivoVistaPreviaAction extends BaseContratoAction {
out.write(vistaPreviac); out.write(vistaPreviac);
out.flush(); out.flush();
out.close(); out.close();
} catch (ResultMapException e) {
logger.error("Error al invocar descargaArchivoVistaPrevia : " + error);
} catch (Exception e) { } catch (PersistenceException e) {
logger.error("Error al invocar descargaArchivoVistaPrevia : " + error);
error = e.getMessage(); } catch (TransaccionException e) {
logger.error("Error al invocar descargaArchivoVistaPrevia : " + error);
} catch (SQLException e) {
logger.error("Error al invocar descargaArchivoVistaPrevia : " + error);
} catch (IOException e) {
logger.error("Error al invocar descargaArchivoVistaPrevia : " + error);
} }
return SUCCESS; return SUCCESS;
} }
public void setError(String error) { public void setError(String error) {
......
package com.mx.dla.dda.carga.transaccion.actions; package com.mx.dla.dda.carga.transaccion.actions;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.IOException;
import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStreamWriter; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.struts2.ServletActionContext; import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,8 +21,9 @@ import com.mx.dla.dda.carga.transaccion.dtos.RowRepErrResumenCargaDTO; ...@@ -22,8 +21,9 @@ import com.mx.dla.dda.carga.transaccion.dtos.RowRepErrResumenCargaDTO;
import com.mx.dla.dda.carga.transaccion.dtos.RowReporteCargaDTO; import com.mx.dla.dda.carga.transaccion.dtos.RowReporteCargaDTO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.listado.dtos.ContentType; import com.mx.dla.dda.contrato.listado.dtos.ContentType;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class DescargaArchivosTransaccionesAction extends BaseContratoAction{ public class DescargaArchivosTransaccionesAction extends BaseContratoAction {
private static final long serialVersionUID = 281552368437405368L; private static final long serialVersionUID = 281552368437405368L;
private String error; private String error;
...@@ -37,9 +37,6 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{ ...@@ -37,9 +37,6 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{
private InputStream fileInputStream; private InputStream fileInputStream;
private String fileFileName; private String fileFileName;
@Autowired @Autowired
private CargaTransaccionesBO cargaTransaccionesBO; private CargaTransaccionesBO cargaTransaccionesBO;
...@@ -50,9 +47,7 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{ ...@@ -50,9 +47,7 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{
byte[] vistaPrevia; byte[] vistaPrevia;
try { try {
System.out.println("si sirve..."+cargaTransacciones); System.out.println("si sirve..." + cargaTransacciones);
//HttpServletRequest request = ServletActionContext.getRequest();
//logger.debug("request : [{}], [{}]", request.getCharacterEncoding(), request.getContentType());
vistaPrevia = cargaTransaccionesBO.descargarArchivoTransacciones(cargaTransacciones); vistaPrevia = cargaTransaccionesBO.descargarArchivoTransacciones(cargaTransacciones);
nombre = "reporteCargaTransacciones"; nombre = "reporteCargaTransacciones";
...@@ -60,138 +55,137 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{ ...@@ -60,138 +55,137 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{
HttpServletResponse response = ServletActionContext.getResponse(); HttpServletResponse response = ServletActionContext.getResponse();
response.setContentLength(vistaPrevia.length); response.setContentLength(vistaPrevia.length);
response.setContentType(ContentType.EXCELX.name()); response.setContentType(ContentType.EXCELX.name());
response.setHeader("Content-Disposition","attachment;filename="+nombre+".xlsx"); response.setHeader("Content-Disposition", "attachment;filename=" + nombre + ".xlsx");
ServletOutputStream out = response.getOutputStream(); ServletOutputStream out = response.getOutputStream();
out.write(vistaPrevia); out.write(vistaPrevia);
out.flush(); out.flush();
out.close(); out.close();
} catch (ResultMapException e) {
} catch (Exception e) { error = e.getMessage();
} catch (PersistenceException e) {
error = e.getMessage();
} catch (TransaccionException e) {
error = e.getMessage();
} catch (SQLException e) {
error = e.getMessage();
} catch (IOException e) {
error = e.getMessage(); error = e.getMessage();
} }
return SUCCESS; return SUCCESS;
} }
//funcion para descarga excel en vista previa // funcion para descarga excel en vista previa
public String descargaArchivoVistaPrevia(){ public String descargaArchivoVistaPrevia() {
logger.info("se vista previa : [{}]", error); logger.info("se vista previa : [{}]", error);
String nombre; String nombre;
byte[] vistaPreviac; byte[] vistaPreviac;
try { try {
vistaPreviac = cargaTransaccionesBO.descargaArchivoVistaPrevia(vistaPrevia); vistaPreviac = cargaTransaccionesBO.descargaArchivoVistaPrevia(vistaPrevia);
//System.out.println("vistaprevia..."+vistaPrevia);
nombre = "reporteVistaPreviaCargaTransacciones"; nombre = "reporteVistaPreviaCargaTransacciones";
HttpServletResponse response = ServletActionContext.getResponse(); HttpServletResponse response = ServletActionContext.getResponse();
response.setContentLength(vistaPreviac.length); response.setContentLength(vistaPreviac.length);
response.setContentType(ContentType.EXCELX.name()); response.setContentType(ContentType.EXCELX.name());
response.setHeader("Content-Disposition","attachment;filename="+nombre+".xlsx"); response.setHeader("Content-Disposition", "attachment;filename=" + nombre + ".xlsx");
ServletOutputStream out = response.getOutputStream(); ServletOutputStream out = response.getOutputStream();
out.write(vistaPreviac); out.write(vistaPreviac);
out.flush(); out.flush();
out.close(); out.close();
} catch (ResultMapException e) {
error = e.getMessage();
} catch (Exception e) { } catch (PersistenceException e) {
error = e.getMessage();
} catch (TransaccionException e) {
error = e.getMessage();
} catch (SQLException e) {
error = e.getMessage();
} catch (IOException e) {
error = e.getMessage(); error = e.getMessage();
} }
return SUCCESS; return SUCCESS;
} }
//may-17 action para descarga resumen error carga transacciones // may-17 action para descarga resumen error carga transacciones
/*public String descargaReporteErrorResumenCarga(){ /*
String nombre; * public String descargaReporteErrorResumenCarga(){ String nombre; try { byte
try * [] repDetalleError =
{ * cargaTransaccionesBO.descargaArchivoResumenErroresCarga(detalleErroresCarga);
byte [] repDetalleError = cargaTransaccionesBO.descargaArchivoResumenErroresCarga(detalleErroresCarga); *
* fileInputStream = new ByteArrayInputStream(repDetalleError); nombre =
fileInputStream = new ByteArrayInputStream(repDetalleError); * "reporteDetalleErrorCargaTransacciones"; fileFileName = nombre;
nombre = "reporteDetalleErrorCargaTransacciones"; *
fileFileName = nombre; * return SUCCESS; } catch(Exception e) { logger.error("Error ",e);
* error="Ocurrio un error al descargar el documento"; return ERROR; } }
return SUCCESS; */
} public String descargaReporteErrorResumenCarga() {
catch(Exception e)
{
logger.error("Error ",e);
error="Ocurrio un error al descargar el documento";
return ERROR;
}
}*/
public String descargaReporteErrorResumenCarga(){
logger.info("se resumen carga : [{}]", error); logger.info("se resumen carga : [{}]", error);
String nombre; String nombre;
byte[] repDetalleError; byte[] repDetalleError;
try { try {
nombre = "reporteDetalleErrorCargaTransacciones.xlsx"; nombre = "reporteDetalleErrorCargaTransacciones.xlsx";
//repDetalleError = cargaTransaccionesBO.descargaArchivoResumenErroresCarga(detalleErroresCarga);
repDetalleError = cargaTransaccionesBO.obtenerDetalleErroresCarga(mes); repDetalleError = cargaTransaccionesBO.obtenerDetalleErroresCarga(mes);
System.out.println("mes: "+mes);
fileInputStream = new ByteArrayInputStream(repDetalleError); fileInputStream = new ByteArrayInputStream(repDetalleError);
fileFileName = nombre; fileFileName = nombre;
} catch (ResultMapException e) {
//return SUCCESS; error = e.getMessage();
logger.error("DescargaExcelDetalleErrorCargaT: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (Exception e) { } catch (PersistenceException e) {
error = e.getMessage();
logger.error("DescargaExcelDetalleErrorCargaT: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (TransaccionException e) {
error = e.getMessage();
logger.error("DescargaExcelDetalleErrorCargaT: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (SQLException e) {
error = e.getMessage(); error = e.getMessage();
System.out.println("DescargaExcelDetalleErrorCargaT: Error al procesar el archivo Excel..."+e+" ___ "+error); logger.error("DescargaExcelDetalleErrorCargaT: Error al procesar el archivo Excel..." + e + " ___ " + error);
} }
return SUCCESS; return SUCCESS;
} }
//action para descarga de archivo excel dentro de asociacion de titulos // action para descarga de archivo excel dentro de asociacion de titulos
public String descargaReporteErrAsocTitulos(){ public String descargaReporteErrAsocTitulos() {
logger.info("error en resumen carga : [{}]", error); logger.info("error en resumen carga : [{}]", error);
String nombre; String nombre;
byte[] repAsocTitulos; byte[] repAsocTitulos;
try { try {
//repAsocTitulos = cargaTransaccionesBO.descargaArchivoErrAsocTitulos(listadoErrAsociaTitulos);
repAsocTitulos = cargaTransaccionesBO.obtenerListaErrAsocTitulos(idCarga); repAsocTitulos = cargaTransaccionesBO.obtenerListaErrAsocTitulos(idCarga);
logger.info("descargaArchivoErrAsocTitulos..." + repAsocTitulos);
System.out.println("descargaArchivoErrAsocTitulos..."+repAsocTitulos); logger.info("idCarga..." + idCarga);
System.out.println("idCarga..."+idCarga);
nombre = "reporteErroresAsociacionTitulos.xlsx"; nombre = "reporteErroresAsociacionTitulos.xlsx";
fileInputStream = new ByteArrayInputStream(repAsocTitulos); fileInputStream = new ByteArrayInputStream(repAsocTitulos);
fileFileName = nombre; fileFileName = nombre;
} catch (ResultMapException e) {
} catch (Exception e) { error = e.getMessage();
logger.error("descargaArchivoErrAsocTitulos: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (PersistenceException e) {
error = e.getMessage(); error = e.getMessage();
System.out.println("descargaArchivoErrAsocTitulos: Error al procesar el archivo Excel..."+e+" ___ "+error); logger.error("descargaArchivoErrAsocTitulos: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (TransaccionException e) {
error = e.getMessage();
logger.error("descargaArchivoErrAsocTitulos: Error al procesar el archivo Excel..." + e + " ___ " + error);
} catch (SQLException e) {
error = e.getMessage();
logger.error("descargaArchivoErrAsocTitulos: Error al procesar el archivo Excel..." + e + " ___ " + error);
} }
return SUCCESS; return SUCCESS;
} }
public void setError(String error) { public void setError(String error) {
this.error = error; this.error = error;
} }
public String getError() { public String getError() {
return error; return error;
} }
...@@ -228,12 +222,21 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{ ...@@ -228,12 +222,21 @@ public class DescargaArchivosTransaccionesAction extends BaseContratoAction{
this.listadoErrAsociaTitulos = listadoErrAsociaTitulos; this.listadoErrAsociaTitulos = listadoErrAsociaTitulos;
} }
public void setFileInputStream(InputStream fileInputStream) { this.fileInputStream = fileInputStream; } public void setFileInputStream(InputStream fileInputStream) {
this.fileInputStream = fileInputStream;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public void setFileFileName(String fileFileName) { this.fileFileName = fileFileName; } public String getFileFileName() {
return fileFileName;
}
public String getFileFileName() { return fileFileName; } public InputStream getFileInputStream() {
public InputStream getFileInputStream() { return fileInputStream; } return fileInputStream;
}
public Long getIdCarga() { public Long getIdCarga() {
return idCarga; return idCarga;
......
package com.mx.dla.dda.catalogos.actions; package com.mx.dla.dda.catalogos.actions;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -12,6 +14,7 @@ import com.mx.dla.dda.catalogos.dtos.EstudioDTO; ...@@ -12,6 +14,7 @@ import com.mx.dla.dda.catalogos.dtos.EstudioDTO;
import com.mx.dla.dda.catalogos.dtos.MedioEntregaDTO; import com.mx.dla.dda.catalogos.dtos.MedioEntregaDTO;
import com.mx.dla.dda.catalogos.dtos.ServicioDTO; import com.mx.dla.dda.catalogos.dtos.ServicioDTO;
import com.mx.dla.dda.catalogos.dtos.TerritorioDTO; import com.mx.dla.dda.catalogos.dtos.TerritorioDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.global.actions.BaseAction; import com.mx.dla.global.actions.BaseAction;
@Controller @Controller
...@@ -39,12 +42,20 @@ public class CatalogosAction extends BaseAction { ...@@ -39,12 +42,20 @@ public class CatalogosAction extends BaseAction {
} }
public String metodo() { public String metodo() {
try {
setIdContrato(catalogosBO.obtenSqIdContrato(tipoOperacion, idContrato)); setIdContrato(catalogosBO.obtenSqIdContrato(tipoOperacion, idContrato));
setEstudios(catalogosBO.obtenListaEstudios()); setEstudios(catalogosBO.obtenListaEstudios());
setCategorias(catalogosBO.obtenListaCategorias()); setCategorias(catalogosBO.obtenListaCategorias());
setServicios(catalogosBO.obtenListaServicios()); setServicios(catalogosBO.obtenListaServicios());
setTerritorios(catalogosBO.obtenListaTerritorios()); setTerritorios(catalogosBO.obtenListaTerritorios());
setMediosEntrega(catalogosBO.obtenListaMediosEntrega()); setMediosEntrega(catalogosBO.obtenListaMediosEntrega());
} catch (ResultMapException e) {
logger.error("Error al invocar CatalogosAction.metodo : ", e);
} catch (SQLException e) {
logger.error("Error al invocar CatalogosAction.metodo : ", e);
} catch (TransaccionException e) {
logger.error("Error al invocar CatalogosAction.metodo : ", e);
}
return "OK"; return "OK";
} }
......
package com.mx.dla.dda.contrato.amortizacion.actions; package com.mx.dla.dda.contrato.amortizacion.actions;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.contrato.amortizacion.bos.AmortizacionBO; import com.mx.dla.dda.contrato.amortizacion.bos.AmortizacionBO;
...@@ -12,12 +16,10 @@ import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; ...@@ -12,12 +16,10 @@ import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
import com.mx.dla.dda.contrato.titulo.dtos.Lista; import com.mx.dla.dda.contrato.titulo.dtos.Lista;
import com.mx.dla.dda.contrato.titulo.dtos.Titulo; import com.mx.dla.dda.contrato.titulo.dtos.Titulo;
import com.mx.dla.dda.contrato.titulo.exception.TituloException; import com.mx.dla.dda.contrato.titulo.exception.TituloException;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class AmortizacionAction extends BaseContratoAction { public class AmortizacionAction extends BaseContratoAction {
/**
*
*/
private static final long serialVersionUID = -1880333104009351799L; private static final long serialVersionUID = -1880333104009351799L;
@Autowired @Autowired
...@@ -35,13 +37,22 @@ public class AmortizacionAction extends BaseContratoAction { ...@@ -35,13 +37,22 @@ public class AmortizacionAction extends BaseContratoAction {
private String error; private String error;
@Override @Override
public String execute() throws Exception { public String execute() {
Long idC = (Long) getSession().get(ContratoConstats.ID_CONTRATO_SESSION); Long idC = (Long) getSession().get(ContratoConstats.ID_CONTRATO_SESSION);
ContratoDTO ct = generalesBO.obtenContrato(idC); ContratoDTO ct;
try {
ct = generalesBO.obtenContrato(idC);
getSession().put(ContratoConstats.CONTRATO_SESSION, ct); getSession().put(ContratoConstats.CONTRATO_SESSION, ct);
lista = amortizacionBO.buscarListaActual(ct); lista = amortizacionBO.buscarListaActual(ct);
getSession().put(ContratoConstats.LISTA_SESSION, lista); getSession().put(ContratoConstats.LISTA_SESSION, lista);
logger.debug("sube objetos a la sesion"); logger.debug("sube objetos a la sesion");
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
}
return SUCCESS; return SUCCESS;
} }
...@@ -54,10 +65,12 @@ public class AmortizacionAction extends BaseContratoAction { ...@@ -54,10 +65,12 @@ public class AmortizacionAction extends BaseContratoAction {
titulos = amortizacionBO.busqueda(ct, li, titulo); titulos = amortizacionBO.busqueda(ct, li, titulo);
} catch (TituloException e) { } catch (TituloException e) {
setError(e.getMessage()); setError(e.getMessage());
}catch (Exception e) } catch (SocketTimeoutException e) {
{ setError(e.getMessage());
logger.error("Error :",e); } catch (IOException e) {
setError("Ocurrio un error"); setError(e.getMessage());
} catch (TransaccionException e) {
setError(e.getMessage());
} }
return SUCCESS; return SUCCESS;
} }
...@@ -68,10 +81,6 @@ public class AmortizacionAction extends BaseContratoAction { ...@@ -68,10 +81,6 @@ public class AmortizacionAction extends BaseContratoAction {
titulos = amortizacionBO.busquedaDetalle( titulo); titulos = amortizacionBO.busquedaDetalle( titulo);
} catch (TituloException e) { } catch (TituloException e) {
setError(e.getMessage()); setError(e.getMessage());
}catch (Exception e)
{
logger.error("Error :",e);
setError("Ocurrio un error");
} }
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.contrato.bdeal.actions; package com.mx.dla.dda.contrato.bdeal.actions;
import java.sql.SQLException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.generales.bos.GeneralesBO; import com.mx.dla.dda.contrato.generales.bos.GeneralesBO;
import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class BdealAction extends BaseContratoAction{ public class BdealAction extends BaseContratoAction{
...@@ -15,10 +19,18 @@ public class BdealAction extends BaseContratoAction{ ...@@ -15,10 +19,18 @@ public class BdealAction extends BaseContratoAction{
private Long idContrato; private Long idContrato;
private Long estatus; private Long estatus;
public String execute() throws Exception { public String execute() {
ContratoDTO contrato = null; ContratoDTO contrato = null;
setIdContrato((Long)this.getSession().get("idContrato")); setIdContrato((Long)this.getSession().get("idContrato"));
try {
contrato = generalesBO.obtenContrato(idContrato); contrato = generalesBO.obtenContrato(idContrato);
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
}
setEstatus(contrato.getIdEstatus()); setEstatus(contrato.getIdEstatus());
return SUCCESS; return SUCCESS;
......
...@@ -19,7 +19,7 @@ public class ExportarTitulosBdealAction extends BaseContratoAction { ...@@ -19,7 +19,7 @@ public class ExportarTitulosBdealAction extends BaseContratoAction {
@Autowired @Autowired
private BdealBO bdealBO; private BdealBO bdealBO;
public String execute() throws Exception { public String execute() {
Long idContrato = (Long) this.getSession().get("idContrato"); Long idContrato = (Long) this.getSession().get("idContrato");
fileInputStream = bdealBO.seleccionaTipoDescarga(tipo, id); fileInputStream = bdealBO.seleccionaTipoDescarga(tipo, id);
......
...@@ -8,7 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,7 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.admin.dtos.UsuarioDTO; import com.mx.dla.admin.dtos.UsuarioDTO;
import com.mx.dla.dda.contrato.bdeal.bos.BdealBO; import com.mx.dla.dda.contrato.bdeal.bos.BdealBO;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.mx.dla.dda.contrato.ws.actualizaridbroadview.ResponseActualizaIdBVDTO; import com.mx.dla.dda.contrato.ws.actualizaridbroadview.ResponseActualizaIdBVDTO;
import com.mx.dla.dda.excelMapper.exceptions.ExcelMapperException;
public class SubirDocumentoBdealAction extends BaseContratoAction { public class SubirDocumentoBdealAction extends BaseContratoAction {
...@@ -30,7 +32,7 @@ public class SubirDocumentoBdealAction extends BaseContratoAction { ...@@ -30,7 +32,7 @@ public class SubirDocumentoBdealAction extends BaseContratoAction {
private BdealBO bdealBO; private BdealBO bdealBO;
@Override @Override
public String execute() throws Exception { public String execute() {
UsuarioDTO usuario = null; UsuarioDTO usuario = null;
ResponseActualizaIdBVDTO response = null; ResponseActualizaIdBVDTO response = null;
...@@ -50,8 +52,14 @@ public class SubirDocumentoBdealAction extends BaseContratoAction { ...@@ -50,8 +52,14 @@ public class SubirDocumentoBdealAction extends BaseContratoAction {
setIdCarga(Long.parseLong(response.getDatosCarga().getID_CARGA())); setIdCarga(Long.parseLong(response.getDatosCarga().getID_CARGA()));
} }
}catch(IOException ex) { }catch(IOException e) {
logger.error("Error al subir documento [{}]", ex); logger.error("Error al subir documento [{}]", e);
error = "Error al subir documento.";
} catch (TransaccionException e) {
logger.error("Error al subir documento [{}]", e);
error = "Error al subir documento.";
} catch (ExcelMapperException e) {
logger.error("Error al subir documento [{}]", e);
error = "Error al subir documento."; error = "Error al subir documento.";
} }
......
...@@ -13,9 +13,6 @@ import com.opensymphony.xwork2.Action; ...@@ -13,9 +13,6 @@ import com.opensymphony.xwork2.Action;
public class ContratoBroadviewAction extends BaseContratoAction { public class ContratoBroadviewAction extends BaseContratoAction {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private ContratoConsultaDTO contratoConsulta; private ContratoConsultaDTO contratoConsulta;
...@@ -35,7 +32,6 @@ public class ContratoBroadviewAction extends BaseContratoAction { ...@@ -35,7 +32,6 @@ public class ContratoBroadviewAction extends BaseContratoAction {
public String load() { public String load() {
Long idCto = (Long) this.getSession().get("idContrato"); Long idCto = (Long) this.getSession().get("idContrato");
//idCto = 1L;
this.setIdContrato(idCto); this.setIdContrato(idCto);
...@@ -45,7 +41,6 @@ public class ContratoBroadviewAction extends BaseContratoAction { ...@@ -45,7 +41,6 @@ public class ContratoBroadviewAction extends BaseContratoAction {
public String consultaBroadviewContrato() { public String consultaBroadviewContrato() {
Long idCto = (Long) this.getSession().get("idContrato"); Long idCto = (Long) this.getSession().get("idContrato");
//idCto = 1L;
this.setIdContrato(idCto); this.setIdContrato(idCto);
...@@ -58,7 +53,6 @@ public class ContratoBroadviewAction extends BaseContratoAction { ...@@ -58,7 +53,6 @@ public class ContratoBroadviewAction extends BaseContratoAction {
public String cargaInfoListas() { public String cargaInfoListas() {
Long idCto = (Long) this.getSession().get("idContrato"); Long idCto = (Long) this.getSession().get("idContrato");
//idCto = 1L;
this.setIdContrato(idCto); this.setIdContrato(idCto);
...@@ -103,7 +97,6 @@ public class ContratoBroadviewAction extends BaseContratoAction { ...@@ -103,7 +97,6 @@ public class ContratoBroadviewAction extends BaseContratoAction {
public String actualizaBroadviewContrato() { public String actualizaBroadviewContrato() {
Long idCto = (Long) this.getSession().get("idContrato"); Long idCto = (Long) this.getSession().get("idContrato");
//idCto = 1L;
this.setIdContrato(idCto); this.setIdContrato(idCto);
...@@ -116,7 +109,6 @@ public class ContratoBroadviewAction extends BaseContratoAction { ...@@ -116,7 +109,6 @@ public class ContratoBroadviewAction extends BaseContratoAction {
public String actualizaTitulosDDA() { public String actualizaTitulosDDA() {
Long idCto = (Long) this.getSession().get("idContrato"); Long idCto = (Long) this.getSession().get("idContrato");
//idCto = 1L;
this.setIdContrato(idCto); this.setIdContrato(idCto);
......
...@@ -12,9 +12,6 @@ import com.mx.dla.global.actions.BaseAction; ...@@ -12,9 +12,6 @@ import com.mx.dla.global.actions.BaseAction;
public class BaseContratoAction extends BaseAction { public class BaseContratoAction extends BaseAction {
/**
*
*/
private static final long serialVersionUID = -1880333104009351799L; private static final long serialVersionUID = -1880333104009351799L;
@Autowired @Autowired
...@@ -26,7 +23,6 @@ public class BaseContratoAction extends BaseAction { ...@@ -26,7 +23,6 @@ public class BaseContratoAction extends BaseAction {
private Long estatusContrato; private Long estatusContrato;
protected String buscarJustificaciones() { protected String buscarJustificaciones() {
logger.debug("Se buscan justificaciones.");
Long idC = (Long) getSession().get(ContratoConstats.ID_CONTRATO_SESSION); Long idC = (Long) getSession().get(ContratoConstats.ID_CONTRATO_SESSION);
setJustificaciones(justificacionBO.buscarJustificaciones(idC)); setJustificaciones(justificacionBO.buscarJustificaciones(idC));
return SUCCESS; return SUCCESS;
......
package com.mx.dla.dda.contrato.common.actions; package com.mx.dla.dda.contrato.common.actions;
import java.io.File; import java.io.File;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -10,9 +11,6 @@ import com.mx.dla.global.actions.BaseAction; ...@@ -10,9 +11,6 @@ import com.mx.dla.global.actions.BaseAction;
public class SubirDocumentoAction extends BaseAction { public class SubirDocumentoAction extends BaseAction {
/**
*
*/
private static final long serialVersionUID = -1880333104009351799L; private static final long serialVersionUID = -1880333104009351799L;
@Autowired @Autowired
...@@ -26,18 +24,19 @@ public class SubirDocumentoAction extends BaseAction { ...@@ -26,18 +24,19 @@ public class SubirDocumentoAction extends BaseAction {
private String error; private String error;
@Override @Override
public String execute() throws Exception { public String execute() {
try{ try {
UsuarioDTO usuario = (UsuarioDTO) getSession().get("usuario"); UsuarioDTO usuario = (UsuarioDTO) getSession().get("usuario");
logger.debug("Remplzar {}", idDoc); logger.debug("Remplzar {}", idDoc);
if(this.getIdDoc() != null) if (this.getIdDoc() != null)
documentoBO.remplazarDocumento(fileUpload, fileUploadFileName, usuario.getExpediente(), (Long)this.getSession().get("idContrato"), this.getIdDoc()); documentoBO.remplazarDocumento(fileUpload, fileUploadFileName, usuario.getExpediente(),
(Long) this.getSession().get("idContrato"), this.getIdDoc());
else else
documentoBO.insertarDocumento(fileUpload, fileUploadFileName, usuario.getExpediente(), (Long)this.getSession().get("idContrato")); documentoBO.insertarDocumento(fileUpload, fileUploadFileName, usuario.getExpediente(),
}catch(Exception e) (Long) this.getSession().get("idContrato"));
{ } catch (IOException e) {
logger.error("Error al subir documento ",e); logger.error("Error al subir documento ", e);
error = "Error al subir documento"; error = "Error al subir documento";
} }
return SUCCESS; return SUCCESS;
......
...@@ -20,9 +20,6 @@ import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; ...@@ -20,9 +20,6 @@ import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
public class CondicionesLicenseAction extends BaseContratoAction { public class CondicionesLicenseAction extends BaseContratoAction {
/**
*
*/
private static final long serialVersionUID = 7590885545520161328L; private static final long serialVersionUID = 7590885545520161328L;
@Autowired @Autowired
...@@ -47,34 +44,33 @@ public class CondicionesLicenseAction extends BaseContratoAction { ...@@ -47,34 +44,33 @@ public class CondicionesLicenseAction extends BaseContratoAction {
return super.execute(); return super.execute();
} }
public String save() throws ParseException { public String save() {
logger.debug("entro al save {} - {}",getCondiciones(),""); logger.debug("entro al save {} - {}", getCondiciones(), "");
ContratoDTO ct = (ContratoDTO) getSession().get( ContratoConstats.CONTRATO_SESSION); ContratoDTO ct = (ContratoDTO) getSession().get(ContratoConstats.CONTRATO_SESSION);
try { try {
condiciones.setIdContrato(ct.getIdContrato()); condiciones.setIdContrato(ct.getIdContrato());
condiciones.setFechaInicio(ct.getFechaFin()); condiciones.setFechaInicio(ct.getFechaFin());
condiciones.setFechaFin(ct.getFechaFin()); condiciones.setFechaFin(ct.getFechaFin());
if(getEstatusContrato()!= 1) if (getEstatusContrato() != 1) {
{
throw new CondicionesLicenseException("Estatus incorrecto"); throw new CondicionesLicenseException("Estatus incorrecto");
} }
condicionesLicenseBO.guardarCondiciones(getCondiciones()); condicionesLicenseBO.guardarCondiciones(getCondiciones());
if(getJustificacion() != null && !"".equals(getJustificacion())){ if (getJustificacion() != null && !"".equals(getJustificacion())) {
guardarJustificacion(); guardarJustificacion();
setJustificacion(""); setJustificacion("");
} }
addActionMessage("Los datos fueron guardados con éxito"); addActionMessage("Los datos fueron guardados con éxito");
buscarCondiciones(ct);
buscarJustificaciones();
} catch (CondicionesLicenseException e) { } catch (CondicionesLicenseException e) {
addActionError("Ocurrió un error al guardar los datos"); addActionError("Ocurrió un error al guardar los datos");
//addActionError(e.getMessage()); } catch (ParseException e) {
addActionError("Ocurrió un error al guardar los datos");
} }
buscarCondiciones(ct);
buscarJustificaciones();
return SUCCESS; return SUCCESS;
} }
public String buscarSuscriptores() throws ParseException public String buscarSuscriptores() throws ParseException {
{
List<PlfRangoDTO> susc = condicionesLicenseBO.buscarSuscriptores(getIdContrato()); List<PlfRangoDTO> susc = condicionesLicenseBO.buscarSuscriptores(getIdContrato());
condiciones = new PlicenseDTO(); condiciones = new PlicenseDTO();
condiciones.setRango(susc); condiciones.setRango(susc);
...@@ -82,8 +78,7 @@ public class CondicionesLicenseAction extends BaseContratoAction { ...@@ -82,8 +78,7 @@ public class CondicionesLicenseAction extends BaseContratoAction {
} }
private void buscarCondiciones(ContratoDTO ct) throws ParseException { private void buscarCondiciones(ContratoDTO ct) throws ParseException {
if(condiciones== null ) if (condiciones == null) {
{
condiciones = new PlicenseDTO(); condiciones = new PlicenseDTO();
} }
condiciones.setIdContrato(ct.getIdContrato()); condiciones.setIdContrato(ct.getIdContrato());
...@@ -100,18 +95,15 @@ public class CondicionesLicenseAction extends BaseContratoAction { ...@@ -100,18 +95,15 @@ public class CondicionesLicenseAction extends BaseContratoAction {
this.condiciones = condiciones; this.condiciones = condiciones;
} }
public List<TipoAnio> getTiposAnio() public List<TipoAnio> getTiposAnio() {
{
return Arrays.asList(TipoAnio.values()); return Arrays.asList(TipoAnio.values());
} }
public List<CatalogoDTO> getTiposPeriodoPago() public List<CatalogoDTO> getTiposPeriodoPago() {
{
return condicionesLicenseBO.buscarPeriodos(); return condicionesLicenseBO.buscarPeriodos();
} }
public List<TipoCondicion> getTiposCondicion() public List<TipoCondicion> getTiposCondicion() {
{
return Arrays.asList(TipoCondicion.values()); return Arrays.asList(TipoCondicion.values());
} }
} }
package com.mx.dla.dda.contrato.condicionesTransaccion.actions; package com.mx.dla.dda.contrato.condicionesTransaccion.actions;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware; import org.apache.struts2.interceptor.ServletResponseAware;
...@@ -27,22 +30,21 @@ import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ContratoPtrsPrecioDTO ...@@ -27,22 +30,21 @@ import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ContratoPtrsPrecioDTO
import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ContratoPtrsRdDTO; import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ContratoPtrsRdDTO;
import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.DataInicialTransaccionDTO; import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.DataInicialTransaccionDTO;
import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ReleaseDateDTO; import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.ReleaseDateDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class CatalogosTransaccionAction extends BaseContratoAction public class CatalogosTransaccionAction extends BaseContratoAction
implements ServletRequestAware, ServletResponseAware{ implements ServletRequestAware, ServletResponseAware {
private static final long serialVersionUID = 1L;
private Logger log = Logger.getLogger(this.getClass()); private Logger log = Logger.getLogger(this.getClass());
//private static final long serialVersionUID = 1L;
private DataInicialTransaccionDTO catalogos = new DataInicialTransaccionDTO(); private DataInicialTransaccionDTO catalogos = new DataInicialTransaccionDTO();
//private String request = "";
private HttpServletRequest request; private HttpServletRequest request;
private HttpServletResponse response; private HttpServletResponse response;
@Autowired @Autowired
private CondicionesTransaccionBO transaccionBO; private CondicionesTransaccionBO transaccionBO;
public String execute() { public String execute() {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
...@@ -57,23 +59,22 @@ implements ServletRequestAware, ServletResponseAware{ ...@@ -57,23 +59,22 @@ implements ServletRequestAware, ServletResponseAware{
List<CategoriaMgDTO> categoriaMgLista = transaccionBO.obtenerCategoriaMG(); List<CategoriaMgDTO> categoriaMgLista = transaccionBO.obtenerCategoriaMG();
List<ReleaseDateDTO> releaseDateLista = transaccionBO.obtenerReleaseDate(); List<ReleaseDateDTO> releaseDateLista = transaccionBO.obtenerReleaseDate();
try { log.info("CONTRATO " + getIdContrato());
log.info("CONTRATO INT " + getIdContrato().intValue());
log.debug("CONTRATO "+getIdContrato());
log.debug("CONTRATO INT "+getIdContrato().intValue());
} catch (Exception e) {
log.error("ERROR: ",e);
log.error("CAUSA: "+e.getCause());
}
List<ContratoPtransDTO> ptrsLista = transaccionBO.verificaTransaccion(getIdContrato()); List<ContratoPtransDTO> ptrsLista = transaccionBO.verificaTransaccion(getIdContrato());
catalogos.setPtrsLista(ptrsLista); catalogos.setPtrsLista(ptrsLista);
if(!ptrsLista.isEmpty()){ if (!ptrsLista.isEmpty()) {
for(int kPtrs=0;kPtrs<ptrsLista.size();kPtrs++){ for (int kPtrs = 0; kPtrs < ptrsLista.size(); kPtrs++) {
ptrsAnnio.add(transaccionBO.cargaContratoPagoAnnio(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans()+""))); ptrsAnnio.add(transaccionBO
ptrsCmg.add(transaccionBO.cargaContratoPagoCmg(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans()+""))); .cargaContratoPagoAnnio(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans() + "")));
ptrsCategorias.add(transaccionBO.cargaContratoPagoCategorias(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans()+""))); ptrsCmg.add(transaccionBO
ptrsRd.add(transaccionBO.cargaContratoPagoRD(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans()+""))); .cargaContratoPagoCmg(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans() + "")));
ptrsPrecio.add(transaccionBO.cargaContratoPagoPrecio(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans()+""))); ptrsCategorias.add(transaccionBO.cargaContratoPagoCategorias(
Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans() + "")));
ptrsRd.add(transaccionBO
.cargaContratoPagoRD(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans() + "")));
ptrsPrecio.add(transaccionBO
.cargaContratoPagoPrecio(Long.parseLong(ptrsLista.get(kPtrs).getIdContratoPtrans() + "")));
catalogos.setPtrsAnnio(ptrsAnnio); catalogos.setPtrsAnnio(ptrsAnnio);
catalogos.setPtrsCmg(ptrsCmg); catalogos.setPtrsCmg(ptrsCmg);
...@@ -87,7 +88,6 @@ implements ServletRequestAware, ServletResponseAware{ ...@@ -87,7 +88,6 @@ implements ServletRequestAware, ServletResponseAware{
catalogos.setCategoriaMGLista(categoriaMgLista); catalogos.setCategoriaMGLista(categoriaMgLista);
catalogos.setReleaseDateLista(releaseDateLista); catalogos.setReleaseDateLista(releaseDateLista);
mapper.writeValueAsString(ptrsAnnio); mapper.writeValueAsString(ptrsAnnio);
mapper.writeValueAsString(ptrsCmg); mapper.writeValueAsString(ptrsCmg);
mapper.writeValueAsString(ptrsCategorias); mapper.writeValueAsString(ptrsCategorias);
...@@ -98,55 +98,35 @@ implements ServletRequestAware, ServletResponseAware{ ...@@ -98,55 +98,35 @@ implements ServletRequestAware, ServletResponseAware{
mapper.writeValueAsString(categoriaMgLista); mapper.writeValueAsString(categoriaMgLista);
mapper.writeValueAsString(releaseDateLista); mapper.writeValueAsString(releaseDateLista);
log.debug(catalogos.toString());
log.debug("ya cargo catalogos");
} catch (JsonParseException e) { } catch (JsonParseException e) {
// TODO Auto-generated catch block
log.error("Error CatalogosListadoAction.", e); log.error("Error CatalogosListadoAction.", e);
} catch (JsonGenerationException e) { } catch (JsonGenerationException e) {
// TODO Auto-generated catch block
log.error("Error CatalogosListadoAction.", e); log.error("Error CatalogosListadoAction.", e);
} catch (JsonMappingException e) { } catch (JsonMappingException e) {
// TODO Auto-generated catch block
log.error("Error CatalogosListadoAction.", e); log.error("Error CatalogosListadoAction.", e);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block
log.error("Error CatalogosListadoAction.", e); log.error("Error CatalogosListadoAction.", e);
} catch (Exception e) { } catch (ResultMapException e) {
// TODO Auto-generated catch block log.error("Error CatalogosListadoAction.", e);
} catch (PersistenceException e) {
log.error("Error CatalogosListadoAction.", e);
} catch (TransaccionException e) {
log.error("Error CatalogosListadoAction.", e);
} catch (SQLException e) {
log.error("Error CatalogosListadoAction.", e); log.error("Error CatalogosListadoAction.", e);
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
public DataInicialTransaccionDTO getCatalogos() { public DataInicialTransaccionDTO getCatalogos() {
return catalogos; return catalogos;
} }
public void setCatalogos(DataInicialTransaccionDTO catalogos) { public void setCatalogos(DataInicialTransaccionDTO catalogos) {
this.catalogos = catalogos; this.catalogos = catalogos;
} }
public CondicionesTransaccionBO getTransaccionBO() { public CondicionesTransaccionBO getTransaccionBO() {
return transaccionBO; return transaccionBO;
} }
...@@ -155,41 +135,26 @@ implements ServletRequestAware, ServletResponseAware{ ...@@ -155,41 +135,26 @@ implements ServletRequestAware, ServletResponseAware{
this.transaccionBO = transaccionBO; this.transaccionBO = transaccionBO;
} }
public HttpServletRequest getRequest() { public HttpServletRequest getRequest() {
return request; return request;
} }
public void setRequest(HttpServletRequest request) { public void setRequest(HttpServletRequest request) {
this.request = request; this.request = request;
} }
public HttpServletResponse getResponse() { public HttpServletResponse getResponse() {
return response; return response;
} }
public void setResponse(HttpServletResponse response) { public void setResponse(HttpServletResponse response) {
this.response = response; this.response = response;
} }
@Override @Override
public void setServletResponse(HttpServletResponse arg0) { public void setServletResponse(HttpServletResponse arg0) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }
package com.mx.dla.dda.contrato.condicionesTransaccion.actions; package com.mx.dla.dda.contrato.condicionesTransaccion.actions;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.generales.bos.GeneralesBO; import com.mx.dla.dda.contrato.generales.bos.GeneralesBO;
import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
public class CondicionesTransaccionAction extends BaseContratoAction{ public class CondicionesTransaccionAction extends BaseContratoAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Logger log = Logger.getLogger(this.getClass());
ContratoDTO contrato = new ContratoDTO(); ContratoDTO contrato = new ContratoDTO();
...@@ -21,10 +18,9 @@ public class CondicionesTransaccionAction extends BaseContratoAction{ ...@@ -21,10 +18,9 @@ public class CondicionesTransaccionAction extends BaseContratoAction{
@Override @Override
public String execute() throws Exception { public String execute() throws Exception {
this.setIdContrato((Long) this.getSession().get("idContrato"));
this.setIdContrato((Long)this.getSession().get("idContrato"));
buscarJustificaciones(); buscarJustificaciones();
contrato=generales.obtenContrato(getIdContrato()); contrato = generales.obtenContrato(getIdContrato());
getSession().put("contrato", contrato); getSession().put("contrato", contrato);
return SUCCESS; return SUCCESS;
......
package com.mx.dla.dda.contrato.condicionesTransaccion.actions; package com.mx.dla.dda.contrato.condicionesTransaccion.actions;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware; import org.apache.struts2.interceptor.ServletResponseAware;
...@@ -12,48 +16,49 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,48 +16,49 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
import com.mx.dla.dda.contrato.condicionesTransaccion.bos.CondicionesTransaccionBO; import com.mx.dla.dda.contrato.condicionesTransaccion.bos.CondicionesTransaccionBO;
import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.CondicionesTransaccionDTO; import com.mx.dla.dda.contrato.condicionesTransaccion.dtos.CondicionesTransaccionDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
public class GuardarTransaccionAction extends BaseContratoAction public class GuardarTransaccionAction extends BaseContratoAction implements ServletRequestAware, ServletResponseAware {
implements ServletRequestAware, ServletResponseAware{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Logger log = Logger.getLogger(this.getClass()); private Logger log = Logger.getLogger(this.getClass());
private String data; private String data;
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
@Autowired @Autowired
private CondicionesTransaccionBO transaccionBO; private CondicionesTransaccionBO transaccionBO;
private CondicionesTransaccionDTO transaccionDTO=new CondicionesTransaccionDTO(); private CondicionesTransaccionDTO transaccionDTO = new CondicionesTransaccionDTO();
private HttpServletRequest request; private HttpServletRequest request;
@Override @Override
public String execute() throws Exception { public String execute() throws Exception {
log.debug("ESTOY ENTRANDO AL ACTION GUARDAR TRANSACCION");
//Long idContrato= null;
try { try {
log.debug("data "+data);
transaccionDTO = mapper.readValue(data, CondicionesTransaccionDTO.class); transaccionDTO = mapper.readValue(data, CondicionesTransaccionDTO.class);
log.debug("TRANSACCION:"+transaccionDTO.toString());
transaccionBO.guardar(transaccionDTO); transaccionBO.guardar(transaccionDTO);
setJustificacion(transaccionDTO.getJustificacion()); setJustificacion(transaccionDTO.getJustificacion());
//idContrato=Long.valueOf(transaccionDTO.getIdContrato()); setIdContrato(transaccionDTO.getIdContrato());
setIdContrato( transaccionDTO.getIdContrato()); if (getJustificacion() != null && !"".equals(getJustificacion())) {
if(getJustificacion() != null && !"".equals(getJustificacion())){
guardarJustificacion(); guardarJustificacion();
setJustificacion(""); setJustificacion("");
} }
} catch (Exception e) { } catch (ResultMapException e) {
log.error("ERROR:",e); log.error("ERROR:", e);
log.error("Causa: "+e.getCause()); log.error("Causa: " + e.getCause());
} catch (PersistenceException e) {
log.error("ERROR:", e);
log.error("Causa: " + e.getCause());
} catch (TransaccionException e) {
log.error("ERROR:", e);
log.error("Causa: " + e.getCause());
} catch (SQLException e) {
log.error("ERROR:", e);
log.error("Causa: " + e.getCause());
} }
return SUCCESS; return SUCCESS;
} }
@Override @Override
...@@ -86,6 +91,4 @@ implements ServletRequestAware, ServletResponseAware{ ...@@ -86,6 +91,4 @@ implements ServletRequestAware, ServletResponseAware{
this.request = request; this.request = request;
} }
} }
package com.mx.dla.dda.contrato.deal.actions; package com.mx.dla.dda.contrato.deal.actions;
import java.sql.SQLException;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.mx.dla.dda.contrato.common.actions.BaseContratoAction; import com.mx.dla.dda.contrato.common.actions.BaseContratoAction;
...@@ -7,13 +11,11 @@ import com.mx.dla.dda.contrato.deal.bos.DealBO; ...@@ -7,13 +11,11 @@ import com.mx.dla.dda.contrato.deal.bos.DealBO;
import com.mx.dla.dda.contrato.deal.dtos.DealDTO; import com.mx.dla.dda.contrato.deal.dtos.DealDTO;
import com.mx.dla.dda.contrato.generales.bos.GeneralesBO; import com.mx.dla.dda.contrato.generales.bos.GeneralesBO;
import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
public class ContratoDealAction extends BaseContratoAction { public class ContratoDealAction extends BaseContratoAction {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private DealDTO deal = new DealDTO(); private DealDTO deal = new DealDTO();
...@@ -25,11 +27,6 @@ public class ContratoDealAction extends BaseContratoAction { ...@@ -25,11 +27,6 @@ public class ContratoDealAction extends BaseContratoAction {
@Autowired @Autowired
private GeneralesBO generalesBO; private GeneralesBO generalesBO;
public ContratoDealAction() {
}
public String load() { public String load() {
try { try {
Long idContrato = (Long)this.getSession().get("idContrato"); Long idContrato = (Long)this.getSession().get("idContrato");
...@@ -47,9 +44,17 @@ public class ContratoDealAction extends BaseContratoAction { ...@@ -47,9 +44,17 @@ public class ContratoDealAction extends BaseContratoAction {
ContratoDTO cto = generalesBO.obtenContrato(this.getIdContrato()); ContratoDTO cto = generalesBO.obtenContrato(this.getIdContrato());
this.estadoCto = cto.getIdEstatus(); this.estadoCto = cto.getIdEstatus();
} catch (Exception e) { } catch (ResultMapException e) {
addActionError("Ha ocurrido el siguiente error durante la consulta: " addActionError("Ha ocurrido un error.");
+ e.getMessage()); logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (PersistenceException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e); logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} }
...@@ -80,9 +85,17 @@ public class ContratoDealAction extends BaseContratoAction { ...@@ -80,9 +85,17 @@ public class ContratoDealAction extends BaseContratoAction {
addActionMessage("La informacion se ha guardado con exito"); addActionMessage("La informacion se ha guardado con exito");
} catch (Exception e) { } catch (ResultMapException e) {
addActionError("Ha ocurrido el siguiente error durante el guardado: " addActionError("Ha ocurrido un error.");
+ e.getMessage()); logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (PersistenceException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (TransaccionException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} catch (SQLException e) {
addActionError("Ha ocurrido un error.");
logger.error("Error en ["+this.getClass()+"]. Error:"+e); logger.error("Error en ["+this.getClass()+"]. Error:"+e);
} }
......
...@@ -16,21 +16,14 @@ public class FacturasAction extends BaseContratoAction { ...@@ -16,21 +16,14 @@ public class FacturasAction extends BaseContratoAction {
private List<FacturaViewDTO> facturas; private List<FacturaViewDTO> facturas;
private Double costoTotal; private Double costoTotal;
/**
*
*/
private static final long serialVersionUID = 3027003012196187865L; private static final long serialVersionUID = 3027003012196187865L;
@Override @Override
public String execute() throws Exception { public String execute() throws Exception {
logger.debug("entro al init materiales");
this.setIdContrato((Long)this.getSession().get("idContrato")); this.setIdContrato((Long)this.getSession().get("idContrato"));
logger.debug("{}",getIdContrato());
setFacturas(facturasBO.buscarFacturas(getIdContrato())); setFacturas(facturasBO.buscarFacturas(getIdContrato()));
//setCostoTotal(facturasBO.buscarCostoTotal(getIdContrato()));
return SUCCESS; return SUCCESS;
} }
......
package com.mx.dla.dda.contrato.fees.actions; package com.mx.dla.dda.contrato.fees.actions;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -9,6 +11,7 @@ import java.util.List; ...@@ -9,6 +11,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.result.ResultMapException;
import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.JsonMappingException;
...@@ -26,13 +29,15 @@ import com.mx.dla.dda.contrato.fees.dtos.FeesContratoPagoDTO; ...@@ -26,13 +29,15 @@ import com.mx.dla.dda.contrato.fees.dtos.FeesContratoPagoDTO;
import com.mx.dla.dda.contrato.fees.dtos.FeesPagoBonoDTO; import com.mx.dla.dda.contrato.fees.dtos.FeesPagoBonoDTO;
import com.mx.dla.dda.contrato.fees.dtos.TipoSuscriptorDTO; import com.mx.dla.dda.contrato.fees.dtos.TipoSuscriptorDTO;
import com.mx.dla.dda.contrato.generales.bos.GeneralesBO; import com.mx.dla.dda.contrato.generales.bos.GeneralesBO;
import com.mx.dla.dda.contrato.generales.bos.PoblarGeneralesBO;
import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO; import com.mx.dla.dda.contrato.generales.dtos.ContratoDTO;
import com.mx.dla.dda.contrato.transaccion.exceptions.dtos.TransaccionException;
import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.Action;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class FeesAction extends BaseContratoAction { public class FeesAction extends BaseContratoAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -44,7 +49,7 @@ public class FeesAction extends BaseContratoAction { ...@@ -44,7 +49,7 @@ public class FeesAction extends BaseContratoAction {
private List<FeesContratoPagoDTO> datos; private List<FeesContratoPagoDTO> datos;
private FeesPagoBonoDTO bonoSuscriptor; private FeesPagoBonoDTO bonoSuscriptor;
private List<TipoSuscriptorDTO> tipoSuscriptorLista; private List<TipoSuscriptorDTO> tipoSuscriptorLista;
private List<CatalogoDTO> anioTipo;// tiempoVidaLista; private List<CatalogoDTO> anioTipo;
private String requestEliminar; private String requestEliminar;
private String requestBono; private String requestBono;
private String periodosEliminar; private String periodosEliminar;
...@@ -94,14 +99,23 @@ public class FeesAction extends BaseContratoAction { ...@@ -94,14 +99,23 @@ public class FeesAction extends BaseContratoAction {
ContratoDTO contrato = generalesBO.obtenContrato(this.getIdContrato()); ContratoDTO contrato = generalesBO.obtenContrato(this.getIdContrato());
estatus = contrato.getIdEstatus(); estatus = contrato.getIdEstatus();
this.getCatalogos(); this.getCatalogos();
} catch (PersistenceException ibe) { } catch (ResultMapException e) {
this.msgError = "Ocurri un error al obtener los datos."; this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
} catch (Exception e) { } catch (PersistenceException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (TransaccionException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (SQLException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (ParseException e) {
this.msgError = "Ocurri un error al obtener los datos."; this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e); logger.error("Error. {}", e);
logger.error("Error." + e);
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
...@@ -114,12 +128,7 @@ public class FeesAction extends BaseContratoAction { ...@@ -114,12 +128,7 @@ public class FeesAction extends BaseContratoAction {
feesContratoBO.guardarProcesoFees(request, requestBono, inflacion, getIdContrato(), operacion, feesContratoBO.guardarProcesoFees(request, requestBono, inflacion, getIdContrato(), operacion,
periodosEliminar, requestEliminar); periodosEliminar, requestEliminar);
logger.info("fecha inicio cto." + fechaCtoInicio); // Se manda a logger.info("fecha inicio cto." + fechaCtoInicio);
// traer el rest
// para
// actualizar
// los costos de
// titulos
commonRestBO.llamadaCostoTitulo(formatter.parse(fechaCtoInicio), this.getIdContrato(), commonRestBO.llamadaCostoTitulo(formatter.parse(fechaCtoInicio), this.getIdContrato(),
OrigenCodes.REAL.name()); OrigenCodes.REAL.name());
...@@ -139,13 +148,21 @@ public class FeesAction extends BaseContratoAction { ...@@ -139,13 +148,21 @@ public class FeesAction extends BaseContratoAction {
} catch (IOException ioe) { } catch (IOException ioe) {
this.msgError = "Ocurri un error al obtener los datos."; this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", ioe); logger.error("Error. {}", ioe);
} catch (PersistenceException ibe) { } catch (ResultMapException e) {
this.msgError = "Ocurri un error al obtener los datos."; this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", ibe); logger.error("Error. {}", e);
} catch (Exception e) { } catch (PersistenceException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (TransaccionException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (SQLException e) {
this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e);
} catch (ParseException e) {
this.msgError = "Ocurri un error al obtener los datos."; this.msgError = "Ocurri un error al obtener los datos.";
logger.error("Error. {}", e); logger.error("Error. {}", e);
logger.error("Error." + e);
} }
return Action.SUCCESS; return Action.SUCCESS;
} }
...@@ -171,19 +188,27 @@ public class FeesAction extends BaseContratoAction { ...@@ -171,19 +188,27 @@ public class FeesAction extends BaseContratoAction {
public String actualizarCostosTitulos() { public String actualizarCostosTitulos() {
Long idContrato = (Long) this.getSession().get("idContrato"); Long idContrato = (Long) this.getSession().get("idContrato");
Double costoTotal = Double.parseDouble(request); Double costoTotal = Double.parseDouble(request);
System.out.println("CostoTotal: " + costoTotal); logger.info("CostoTotal: " + costoTotal);
Map<String, Object> paramNumeroContrato = new HashMap<String, Object>(); Map<String, Object> paramNumeroContrato = new HashMap<String, Object>();
paramNumeroContrato.put("idContrato", idContrato); paramNumeroContrato.put("idContrato", idContrato);
paramNumeroContrato.put("costoTotal", costoTotal); paramNumeroContrato.put("costoTotal", costoTotal);
paramNumeroContrato.put("response",""); paramNumeroContrato.put("response", "");
feesContratoBO.actualizarCostoTitulos(paramNumeroContrato); feesContratoBO.actualizarCostoTitulos(paramNumeroContrato);
msgExito = (String)paramNumeroContrato.get("response"); msgExito = (String) paramNumeroContrato.get("response");
System.out.println("msgExito: " + msgExito); logger.info("msgExito: " + msgExito);
return Action.SUCCESS; return Action.SUCCESS;
} }
private void getCatalogos() { private void getCatalogos() {
try {
tipoSuscriptorLista = catalogosBO.obtenerTipoSuscriptor(); tipoSuscriptorLista = catalogosBO.obtenerTipoSuscriptor();
} catch (ResultMapException e) {
logger.error("Error. {}", e);
} catch (SQLException e) {
logger.error("Error. {}", e);
} catch (TransaccionException e) {
logger.error("Error. {}", e);
}
anioTipo = new ArrayList<CatalogoDTO>(); anioTipo = new ArrayList<CatalogoDTO>();
CatalogoDTO cat1 = new CatalogoDTO("Contractual", "Contractual"); CatalogoDTO cat1 = new CatalogoDTO("Contractual", "Contractual");
CatalogoDTO cat2 = new CatalogoDTO("Calendario", "Calendario"); CatalogoDTO cat2 = new CatalogoDTO("Calendario", "Calendario");
......
...@@ -2,12 +2,14 @@ package com.mx.dla.dda.contrato.fees.actions; ...@@ -2,12 +2,14 @@ package com.mx.dla.dda.contrato.fees.actions;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.struts2.ServletActionContext; import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -39,40 +41,35 @@ public class FeesArchivoAction extends BaseContratoAction { ...@@ -39,40 +41,35 @@ public class FeesArchivoAction extends BaseContratoAction {
private CustomResourceLoader customResourceLoader; private CustomResourceLoader customResourceLoader;
public String cargaArchivo() { public String cargaArchivo() {
try try {
{ logger.debug("Type [{}] name [{}]", fileContentType, fileFileName);
logger.debug("Type [{}] name [{}]",fileContentType,fileFileName);
UsuarioDTO usuario = (UsuarioDTO) getSession().get("usuario"); UsuarioDTO usuario = (UsuarioDTO) getSession().get("usuario");
datosExcel = feesArchivoBO.obtenerDatosExcel(file, fileFileName, usuario.getExpediente(), (Long)this.getSession().get("idContrato")); datosExcel = feesArchivoBO.obtenerDatosExcel(file, fileFileName, usuario.getExpediente(),
(Long) this.getSession().get("idContrato"));
logger.debug("Se termina de cargar los datos de excel."); logger.debug("Se termina de cargar los datos de excel.");
}catch(ExcelMapperException e) } catch (ExcelMapperException e) {
{ logger.error("Error Al procesar Excel. {}", e);
logger.error("Error Al procesar Excel. {}",e);
this.msgError = "Ocurri un error al cargar los datos."; this.msgError = "Ocurri un error al cargar los datos.";
}catch(Exception e) } catch (IOException e) {
{ logger.error("Error {}", e);
logger.error("Error {}",e);
this.msgError = "Ocurri un error al cargar los datos."; this.msgError = "Ocurri un error al cargar los datos.";
} }
return SUCCESS; return SUCCESS;
} }
public String descargarTemplate() public String descargarTemplate() {
{ try {
try
{
logger.debug("llega descarga."); logger.debug("llega descarga.");
if(request != null) if (request != null) {
{
String name = request.compareTo("s") == 0 ? "dda_plantillaFeesSuscrip" : "dda_plantillaFeesFlat"; String name = request.compareTo("s") == 0 ? "dda_plantillaFeesSuscrip" : "dda_plantillaFeesFlat";
byte[] result = customResourceLoader.getFile2ByteArray("classpath:templateFees/"+name+".xlsx"); byte[] result = customResourceLoader.getFile2ByteArray("classpath:templateFees/" + name + ".xlsx");
fileInputStream = new ByteArrayInputStream(result); fileInputStream = new ByteArrayInputStream(result);
HttpServletResponse response = ServletActionContext.getResponse(); HttpServletResponse response = ServletActionContext.getResponse();
response.setContentLength(result.length); response.setContentLength(result.length);
response.setContentType(ContentType.EXCEL.name()); response.setContentType(ContentType.EXCEL.name());
response.setHeader("Content-Disposition","attachment;filename="+name+".xlsx"); response.setHeader("Content-Disposition", "attachment;filename=" + name + ".xlsx");
ServletOutputStream out = response.getOutputStream(); ServletOutputStream out = response.getOutputStream();
...@@ -80,11 +77,13 @@ public class FeesArchivoAction extends BaseContratoAction { ...@@ -80,11 +77,13 @@ public class FeesArchivoAction extends BaseContratoAction {
out.flush(); out.flush();
out.close(); out.close();
} } else
else
this.msgError = "Error al descargar template."; this.msgError = "Error al descargar template.";
}catch (Exception ex){ } catch (IOException ex) {
this.msgError = "Error al descargar template.";
logger.error("Error {}.", ex);
} catch (InvalidFormatException ex) {
this.msgError = "Error al descargar template."; this.msgError = "Error al descargar template.";
logger.error("Error {}.", ex); logger.error("Error {}.", ex);
} }
...@@ -92,22 +91,68 @@ public class FeesArchivoAction extends BaseContratoAction { ...@@ -92,22 +91,68 @@ public class FeesArchivoAction extends BaseContratoAction {
return null; return null;
} }
public String getFileContentType() { return fileContentType; } public String getFileContentType() {
public String getFileFileName() { return fileFileName; } return fileContentType;
public File getFile() { return file; } }
public String getRequest() { return request; }
public String getMsgError() { return msgError; } public String getFileFileName() {
public List<FilaExcelDTO> getDatosExcel() { return datosExcel; } return fileFileName;
public String getMsgExito() { return msgExito; } }
public InputStream getFileInputStream() { return fileInputStream; }
public File getFile() {
public void setFileContentType(String fileContentType) { this.fileContentType = fileContentType; } return file;
public void setFileFileName(String fileFileName) { this.fileFileName = fileFileName; } }
public void setRequest(String request) { this.request = request; }
public void setMsgError(String msgError) { this.msgError = msgError; } public String getRequest() {
public void setMsgExito(String msgExito) { this.msgExito = msgExito; } return request;
public void setFile(File file) { this.file = file; } }
public void setDatosExcel(List<FilaExcelDTO> datosExcel) { this.datosExcel = datosExcel; }
public void setFileInputStream(InputStream fileInputStream) { this.fileInputStream = fileInputStream; } public String getMsgError() {
return msgError;
}
public List<FilaExcelDTO> getDatosExcel() {
return datosExcel;
}
public String getMsgExito() {
return msgExito;
}
public InputStream getFileInputStream() {
return fileInputStream;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public void setRequest(String request) {
this.request = request;
}
public void setMsgError(String msgError) {
this.msgError = msgError;
}
public void setMsgExito(String msgExito) {
this.msgExito = msgExito;
}
public void setFile(File file) {
this.file = file;
}
public void setDatosExcel(List<FilaExcelDTO> datosExcel) {
this.datosExcel = datosExcel;
}
public void setFileInputStream(InputStream fileInputStream) {
this.fileInputStream = fileInputStream;
}
} }
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment