cambios para sap contratos originales y adendums

parent 5b739a79
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/resources/general.properties</file>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/DDAExhibicion.java</file> <file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/DDAExhibicion.java</file>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/bo/DDAExhibicionBO.java</file> <file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/bo/DDAExhibicionBO.java</file>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/dao/DDAExhibicionDAO.java</file> <file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/dao/DDAExhibicionDAO.java</file>
......
...@@ -9,6 +9,7 @@ import org.springframework.context.ApplicationContext; ...@@ -9,6 +9,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import mx.com.amx.mx.dda.crn.bo.DDAExhibicionBO; import mx.com.amx.mx.dda.crn.bo.DDAExhibicionBO;
import mx.com.amx.mx.dda.crn.dto.ContratoDTO;
import mx.com.amx.mx.dda.crn.dto.ContratoTituloDTO; import mx.com.amx.mx.dda.crn.dto.ContratoTituloDTO;
import mx.com.amx.mx.dda.crn.dto.DatosCntTituloExhibicionDTO; import mx.com.amx.mx.dda.crn.dto.DatosCntTituloExhibicionDTO;
import mx.com.amx.mx.dda.crn.dto.RespSAPNotificaAFijoDTO; import mx.com.amx.mx.dda.crn.dto.RespSAPNotificaAFijoDTO;
...@@ -44,6 +45,7 @@ public class DDAExhibicion implements ApplicationContextAware { ...@@ -44,6 +45,7 @@ public class DDAExhibicion implements ApplicationContextAware {
LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion."); LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion.");
boolean boEjecutandoseProceso = bo.existeProcesoNotificacionEjecutandose(); boolean boEjecutandoseProceso = bo.existeProcesoNotificacionEjecutandose();
LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion. Esta ejecutando?: _" + boEjecutandoseProceso + "_"); LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion. Esta ejecutando?: _" + boEjecutandoseProceso + "_");
List<ContratoDTO> contratos = bo.contratosCandidatos();
if (!boEjecutandoseProceso) { if (!boEjecutandoseProceso) {
//-- 2. Verificar si se puede iniciar el proceso //-- 2. Verificar si se puede iniciar el proceso
...@@ -86,115 +88,123 @@ public class DDAExhibicion implements ApplicationContextAware { ...@@ -86,115 +88,123 @@ public class DDAExhibicion implements ApplicationContextAware {
LOG.info(" [FIN]. Paso 7.- Obtener Titulos recien exhibidos con base a fecha referencia. Titulos:_" + lobTitulos.size() + "_"); LOG.info(" [FIN]. Paso 7.- Obtener Titulos recien exhibidos con base a fecha referencia. Titulos:_" + lobTitulos.size() + "_");
LOG.info(" [INI]. Paso 8.- Envío de terminos comerciales de los contratos. (Creacion de Terminos Comerciales)"); LOG.info(" [INI]. Paso 8.- Envío de terminos comerciales de los contratos. (Creacion de Terminos Comerciales)");
bo.ejecutarTerminosComerciales(lobTitulos); String respuestaTC = bo.ejecutarTerminosComerciales(lobTitulos);
LOG.info(" [FIN]. Paso 8.- Envío de terminos comerciales de los contratos."); LOG.info(" [FIN]. Paso 8.- Envío de terminos comerciales de los contratos.");
if (respuestaTC.isEmpty()){
if (Objects.nonNull(lobTitulos) && !lobTitulos.isEmpty()) { if (Objects.nonNull(lobTitulos) && !lobTitulos.isEmpty()) {
//-- 8. LLamado a WS para notificar Activo Fijo (Titulos recien exhibidos) //-- 8. LLamado a WS para notificar Activo Fijo (Titulos recien exhibidos)
LOG.info(" [INI]. Paso 9.- Llamado a WS SAP. Interfaz 12."); LOG.info(" [INI]. Paso 9.- Llamado a WS SAP. Interfaz 12.");
ResultadoNotificacionDTO rWS_Notifica = bo.notificarAFijoWS(lobTitulos); ResultadoNotificacionDTO rWS_Notifica = bo.notificarAFijoWS(lobTitulos);
LOG.info(" [FIN]. Paso 9.- Llamado a WS SAP. Interfaz 12. Resultado: _" + rWS_Notifica.getResultado() + "_"); LOG.info(" [FIN]. Paso 9.- Llamado a WS SAP. Interfaz 12. Resultado: _" + rWS_Notifica.getResultado() + "_");
if (Objects.nonNull(rWS_Notifica.getNotificaciones()) && rWS_Notifica.getResultado()) { if (Objects.nonNull(rWS_Notifica.getNotificaciones()) && rWS_Notifica.getResultado()) {
//-- Verifica que los enviados sean igual a los procesados(notificados) por parte de SAP //-- Verifica que los enviados sean igual a los procesados(notificados) por parte de SAP
//-- Si se enviaron 3, mismos 3 que debería regresar //-- Si se enviaron 3, mismos 3 que debería regresar
if (rWS_Notifica.getNotificaciones().size() == lobTitulos.size()) { if (rWS_Notifica.getNotificaciones().size() == lobTitulos.size()) {
//-- Recorrer la respuesta en busqueda de los titulos notificados en SAP correctamente //-- Recorrer la respuesta en busqueda de los titulos notificados en SAP correctamente
int lnuTitulosNotificados = rWS_Notifica.getNotificaciones().size(); int lnuTitulosNotificados = rWS_Notifica.getNotificaciones().size();
int lnuNotificadosSAP_OK = 0; int lnuNotificadosSAP_OK = 0;
int lnuNotificadosSAP_NOOK = 0; int lnuNotificadosSAP_NOOK = 0;
int lnuUpdFechaNotifica_OK = 0; int lnuUpdFechaNotifica_OK = 0;
int lnuUpdFechaNotifica_NOOK = 0; int lnuUpdFechaNotifica_NOOK = 0;
int lnuInsSubNum_OK = 0; int lnuInsSubNum_OK = 0;
int lnuInsSubNum_NOOK = 0; int lnuInsSubNum_NOOK = 0;
//-- 9. Proceso de la respuesta de SAP y actualiza fecha de notificacion para aquellos que se notificaron correctamente en SAP //-- 9. Proceso de la respuesta de SAP y actualiza fecha de notificacion para aquellos que se notificaron correctamente en SAP
LOG.info(" [INI]. Paso 10.- Revision de la respuesta de SAP para actualizar fecha notificacion SAP a los titulos notificados correctamente."); LOG.info(" [INI]. Paso 10.- Revision de la respuesta de SAP para actualizar fecha notificacion SAP a los titulos notificados correctamente.");
for (RespSAPNotificaAFijoDTO notificacion : rWS_Notifica.getNotificaciones() ) { for (RespSAPNotificaAFijoDTO notificacion : rWS_Notifica.getNotificaciones() ) {
if (notificacion.getStatus().equalsIgnoreCase("OK")) { if (notificacion.getStatus().equalsIgnoreCase("OK")) {
lnuNotificadosSAP_OK++; lnuNotificadosSAP_OK++;
//-- Actualiza fecha de notificacion en los registros notificados correctamente en SAP //-- Actualiza fecha de notificacion en los registros notificados correctamente en SAP
ContratoTituloDTO cntTitulo = new ContratoTituloDTO(); ContratoTituloDTO cntTitulo = new ContratoTituloDTO();
cntTitulo.setID_TITULO_CNTORIG(notificacion.getCodigoDDA()); cntTitulo.setID_TITULO_CNTORIG(notificacion.getCodigoDDA());
boolean lboActFechaNotifica = bo.actualizaFechaNotificacion(cntTitulo); boolean lboActFechaNotifica = bo.actualizaFechaNotificacion(cntTitulo);
LOG.info(" Actualiza fecha notificacion SAP. Titulo CNT con ID [" + notificacion.getCodigoDDA() + "]. Resultado: _" + lboActFechaNotifica + "_"); LOG.info(" Actualiza fecha notificacion SAP. Titulo CNT con ID [" + notificacion.getCodigoDDA() + "]. Resultado: _" + lboActFechaNotifica + "_");
if (lboActFechaNotifica) { if (lboActFechaNotifica) {
lnuUpdFechaNotifica_OK++; lnuUpdFechaNotifica_OK++;
//--Insercion de registro en tabla de Aumentos/Disminucion y Subnumero //--Insercion de registro en tabla de Aumentos/Disminucion y Subnumero
boolean lboRegistroSubNum = bo.insertarRegistroSubNumero(notificacion.getCodigoDDA()); boolean lboRegistroSubNum = bo.insertarRegistroSubNumero(notificacion.getCodigoDDA());
if (lboRegistroSubNum) { if (lboRegistroSubNum) {
lnuInsSubNum_OK++; lnuInsSubNum_OK++;
} else { } else {
lnuInsSubNum_NOOK++; lnuInsSubNum_NOOK++;
}
}//Ends if(lboActFechaNotifica)
else {
lnuUpdFechaNotifica_NOOK++;
} }
} else {
}//Ends if(lboActFechaNotifica) lnuNotificadosSAP_NOOK++;
else {
lnuUpdFechaNotifica_NOOK++;
} }
} else {
lnuNotificadosSAP_NOOK++;
}
}
LOG.info(" [FIN]. Paso 10.- Revision de la respuesta de SAP para actualizar fecha notificacion SAP a los titulos notificados correctamente.");
LOG.info("------------------------------------------------------------------------- ");
LOG.info("- Resumen de proceso: ");
LOG.info("------------------------------------------------------------------------- ");
LOG.info("CREACION ORDEN DE COMPRA(i10) ");
LOG.info("============================= ");
LOG.info(" ");
LOG.info("Total de registros enviados para Orden de Compra:[" + resCOrdenCompra.getLnuTotalRegOCSAP_Envio() + "]");
LOG.info("Total de registros retornados por SAP de Orden de Compra:[" + resCOrdenCompra.getLnuTotalRegOCSAP_Regreso() + "]");
LOG.info(" ");
LOG.info("Total de registrados Orden de Compra correctamente:[" + resCOrdenCompra.getLnuTotalRegOCSAP_OK() + "]");
LOG.info("Total de registrados Orden de Compra incorrectamente:[" + resCOrdenCompra.getLnuTotalRegOCSAP_NOOK() + "]");
LOG.info(" ");
LOG.info("Total de registros actualizados Id SAP:[" + resCOrdenCompra.getLnuTotalUpdIdSAP_OK() + "]");
LOG.info("Total de registros no se pudo actualizar Id SAP :[" + resCOrdenCompra.getLnuTotalUpdIdSAP_NOOK() + "]");
LOG.info(" ");
LOG.info("NOTIFICACION TITULOS SAP(i12) ");
LOG.info("============================= ");
LOG.info("Total de registros enviados: [" + lobTitulos.size() + "]");
LOG.info("Total de registros retornados por SAP: [" + lnuTitulosNotificados + "]");
LOG.info(" ");
LOG.info("Total de registros notificados satisfactoriamente en SAP: [" + lnuNotificadosSAP_OK + "] *");
LOG.info("Total de registros notificados incorrectamente en SAP: [" + lnuNotificadosSAP_NOOK + "]");
LOG.info(" ");
LOG.info("* Total de registros actualizados en fecha notificacion: [" + lnuUpdFechaNotifica_OK + "]");
LOG.info("* Total de registros no se pudo actualizar fecha notificacion: [" + lnuUpdFechaNotifica_NOOK + "]");
LOG.info(" ");
LOG.info("* Total de registros subnumero insertados correctamente: [" + lnuInsSubNum_OK + "]");
LOG.info("* Total de registros subnumero no se pudo insertar: [" + lnuInsSubNum_NOOK + "]");
LOG.info("------------------------------------------------------------------------- ");
bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Caso Revision respuesta SAP y Actualizacion Fecha.]");
}//Ends if(rWS_Notifica.getNotificaciones().size() == lobTitulos.size())
else {
LOG.error("DDA-NOT-011: El numero de titulos procesados fueron distintos al numero de titulos enviado.");
bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Caso Enviados y procesados distinto total.]");
} }
LOG.info(" [FIN]. Paso 10.- Revision de la respuesta de SAP para actualizar fecha notificacion SAP a los titulos notificados correctamente."); }// Ends if(rWS_Notifica.getNotificaciones() != null && rWS_Notifica.getResultado())
else if (Objects.nonNull(rWS_Notifica.getTransFault()) && !rWS_Notifica.getResultado()) {
LOG.info("------------------------------------------------------------------------- "); //-- Tracking
LOG.info("- Resumen de proceso: "); LOG.error("Error al llamar el WS Notifica Activo Fijo: " + rWS_Notifica.getTransFault().toString());
LOG.info("------------------------------------------------------------------------- "); LOG.error("Datos recibidos de la interfaz 12: " + rWS_Notifica.getNotificaciones().size() + " Datos enviados a la interfaz 12 " + lobTitulos.size());
LOG.info("CREACION ORDEN DE COMPRA(i10) ");
LOG.info("============================= ");
LOG.info(" ");
LOG.info("Total de registros enviados para Orden de Compra:[" + resCOrdenCompra.getLnuTotalRegOCSAP_Envio() + "]");
LOG.info("Total de registros retornados por SAP de Orden de Compra:[" + resCOrdenCompra.getLnuTotalRegOCSAP_Regreso() + "]");
LOG.info(" ");
LOG.info("Total de registrados Orden de Compra correctamente:[" + resCOrdenCompra.getLnuTotalRegOCSAP_OK() + "]");
LOG.info("Total de registrados Orden de Compra incorrectamente:[" + resCOrdenCompra.getLnuTotalRegOCSAP_NOOK() + "]");
LOG.info(" ");
LOG.info("Total de registros actualizados Id SAP:[" + resCOrdenCompra.getLnuTotalUpdIdSAP_OK() + "]");
LOG.info("Total de registros no se pudo actualizar Id SAP :[" + resCOrdenCompra.getLnuTotalUpdIdSAP_NOOK() + "]");
LOG.info(" ");
LOG.info("NOTIFICACION TITULOS SAP(i12) ");
LOG.info("============================= ");
LOG.info("Total de registros enviados: [" + lobTitulos.size() + "]");
LOG.info("Total de registros retornados por SAP: [" + lnuTitulosNotificados + "]");
LOG.info(" ");
LOG.info("Total de registros notificados satisfactoriamente en SAP: [" + lnuNotificadosSAP_OK + "] *");
LOG.info("Total de registros notificados incorrectamente en SAP: [" + lnuNotificadosSAP_NOOK + "]");
LOG.info(" ");
LOG.info("* Total de registros actualizados en fecha notificacion: [" + lnuUpdFechaNotifica_OK + "]");
LOG.info("* Total de registros no se pudo actualizar fecha notificacion: [" + lnuUpdFechaNotifica_NOOK + "]");
LOG.info(" ");
LOG.info("* Total de registros subnumero insertados correctamente: [" + lnuInsSubNum_OK + "]");
LOG.info("* Total de registros subnumero no se pudo insertar: [" + lnuInsSubNum_NOOK + "]");
LOG.info("------------------------------------------------------------------------- ");
bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Caso Revision respuesta SAP y Actualizacion Fecha.]");
}//Ends if(rWS_Notifica.getNotificaciones().size() == lobTitulos.size())
else {
LOG.error("DDA-NOT-011: El numero de titulos procesados fueron distintos al numero de titulos enviado.");
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Caso Enviados y procesados distinto total.]"); LOG.info("Apaga bandera de proceso Notifica.[Caso TransFault]");
} }
}// Ends if(rWS_Notifica.getNotificaciones() != null && rWS_Notifica.getResultado()) }//Ends if(lobTitulos != null && lobTitulos.size() > 0)
else if (Objects.nonNull(rWS_Notifica.getTransFault()) && !rWS_Notifica.getResultado()) { else {
//-- Tracking LOG.error("DDA-NOT-006: No se encontraron registros de titulos recien exhibidos.");
LOG.error("Error al llamar el WS Notifica Activo Fijo: " + rWS_Notifica.getTransFault().toString());
LOG.error("Datos recibidos de la interfaz 12: " + rWS_Notifica.getNotificaciones().size() + " Datos enviados a la interfaz 12 " + lobTitulos.size());
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Caso TransFault]"); LOG.info("Apaga bandera de proceso Notifica.[Else_lobTitulos_null]");
} }
}//Ends if(lobTitulos != null && lobTitulos.size() > 0) }
else { else {
LOG.error("DDA-NOT-006: No se encontraron registros de titulos recien exhibidos."); LOG.error("DDA-NOT-012: Falla en terminos comerciales.");
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
updateTitulos(contratos, respuestaTC);
LOG.info("Apaga bandera de proceso Notifica.[Else_lobTitulos_null]"); LOG.info("Apaga bandera de proceso Notifica.[Else_lobTitulos_null]");
} }
...@@ -206,21 +216,21 @@ public class DDAExhibicion implements ApplicationContextAware { ...@@ -206,21 +216,21 @@ public class DDAExhibicion implements ApplicationContextAware {
}//Ends if(lstFechaReferencia.trim().length() > 0) }//Ends if(lstFechaReferencia.trim().length() > 0)
else { else {
LOG.error("DDA-NOT-005: No se pudo obtener la fecha de referencia"); LOG.error("DDA-NOT-005: No se pudo obtener la fecha de referencia");
updateTitulos(contratos, "NO SE LOGRO OBTENER LA FECHA DE REFERENCIA");
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Else_lstFechaReferencia_trim()_length()]"); LOG.info("Apaga bandera de proceso Notifica.[Else_lstFechaReferencia_trim()_length()]");
} }
}// Ends if(!lstValorDiaNotificacion.equals("-1")) }// Ends if(!lstValorDiaNotificacion.equals("-1"))
else { else {
LOG.error("DDA-NOT-004: No se pudo obtener el valor de referencia"); LOG.error("DDA-NOT-004: No se pudo obtener el valor de referencia");
updateTitulos(contratos, "NO SE LOGRO OBTENER VALOR DE REFERENCIA");
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Else_boActualizarBanderaIniciaProceso]"); LOG.info("Apaga bandera de proceso Notifica.[Else_boActualizarBanderaIniciaProceso]");
} }
}//Ends if(boActualizarBanderaIniciaProceso) }//Ends if(boActualizarBanderaIniciaProceso)
else { else {
LOG.error("DDA-NOT-003: No se pudo actualizar la bandera de inicio de proceso."); LOG.error("DDA-NOT-003: No se pudo actualizar la bandera de inicio de proceso.");
updateTitulos(contratos, "NO SE LOGRO ACTUALIZAR LA BANDERA DE INICIO");
bo.actualizarEjecutandoProcesoNotificacion("0"); bo.actualizarEjecutandoProcesoNotificacion("0");
LOG.info("Apaga bandera de proceso Notifica.[Else_boActualizarBanderaIniciaProceso]"); LOG.info("Apaga bandera de proceso Notifica.[Else_boActualizarBanderaIniciaProceso]");
...@@ -228,10 +238,14 @@ public class DDAExhibicion implements ApplicationContextAware { ...@@ -228,10 +238,14 @@ public class DDAExhibicion implements ApplicationContextAware {
}//Ends if(boIniciar) }//Ends if(boIniciar)
else { else {
LOG.error("DDA-NOT-002: No se han otorgado los permisos para poder iniciar el proceso."); LOG.error("DDA-NOT-002: No se han otorgado los permisos para poder iniciar el proceso.");
updateTitulos(contratos, "SIN PERMISOS PARA INICIAR PROCESOS A SAP");
bo.actualizarEjecutandoProcesoNotificacion("0");
} }
}//Ends if(!boEjecutandoseProceso) }//Ends if(!boEjecutandoseProceso)
else { else {
LOG.error("DDA-NOT-001: Es probable que se haya iniciado este proceso previamente."); LOG.error("DDA-NOT-001: Es probable que se haya iniciado este proceso previamente.");
updateTitulos(contratos, "PROCESO DE SAP INICIADO PREVIAMENTE");
bo.actualizarEjecutandoProcesoNotificacion("0");
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -241,6 +255,12 @@ public class DDAExhibicion implements ApplicationContextAware { ...@@ -241,6 +255,12 @@ public class DDAExhibicion implements ApplicationContextAware {
LOG.info("<< :::::::::::::::: Finaliza Proceso Notifica Exhibicion DDA :::::::::::::::: >>"); LOG.info("<< :::::::::::::::: Finaliza Proceso Notifica Exhibicion DDA :::::::::::::::: >>");
LOG.info(" "); LOG.info(" ");
} }
private void updateTitulos(List<ContratoDTO> contratos, String mensaje){
for (ContratoDTO contrato : contratos){
bo.actualizarEstatusSapTitulosContrato(mensaje, contrato.getIdcontratoDDA());
}
}
@Override @Override
public void setApplicationContext(ApplicationContext arg0) throws BeansException { public void setApplicationContext(ApplicationContext arg0) throws BeansException {
......
...@@ -183,11 +183,13 @@ public class DDAExhibicionBO { ...@@ -183,11 +183,13 @@ public class DDAExhibicionBO {
//-- Consulta de titulos sin ID de SAP que esten en estatus de Recien Exhibido (Fecha inicio <= hoy) //-- Consulta de titulos sin ID de SAP que esten en estatus de Recien Exhibido (Fecha inicio <= hoy)
LOG.info(" [INI]. Consulta de Titulos sin ID SAP Recien Exhibidos."); LOG.info(" [INI]. Consulta de Titulos sin ID SAP Recien Exhibidos.");
List<ItemActivoFijoDTO> lobTitulosCnt = dao.obtenerTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia); List<ItemActivoFijoDTO> lobTitulosCnt = dao.obtenerTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia);
List<ItemActivoFijoDTO> lobContratosCnt = dao.obtenerContratosConTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia);
LOG.info(" [FIN]. Consulta de Titulos sin ID SAP Recien Exhibidos. Titulos:_" + lobTitulosCnt.size() + "_"); LOG.info(" [FIN]. Consulta de Titulos sin ID SAP Recien Exhibidos. Titulos:_" + lobTitulosCnt.size() + "_");
if (Objects.nonNull(lobTitulosCnt) && !lobTitulosCnt.isEmpty()) { if (Objects.nonNull(lobTitulosCnt) && !lobTitulosCnt.isEmpty()) {
ParamActivoFijoDTO afDTO = new ParamActivoFijoDTO(); ParamActivoFijoDTO afDTO = new ParamActivoFijoDTO();
afDTO.setTitulos(lobTitulosCnt); afDTO.setTitulos(lobTitulosCnt);
afDTO.setContratos(lobContratosCnt);
//--Llamado al WS SAP para registrar los Activos Fijos (Titulos) //--Llamado al WS SAP para registrar los Activos Fijos (Titulos)
LOG.info(" [INI]. Llamado a WS SAP. Interfaz 10."); LOG.info(" [INI]. Llamado a WS SAP. Interfaz 10.");
...@@ -262,11 +264,12 @@ public class DDAExhibicionBO { ...@@ -262,11 +264,12 @@ public class DDAExhibicionBO {
ResultadoCrearActivoFijoDTO resultado = new ResultadoCrearActivoFijoDTO(); ResultadoCrearActivoFijoDTO resultado = new ResultadoCrearActivoFijoDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
List<RespSAPActivoFijoDTO> afs = resultado.getActivosFijos(); List<RespSAPActivoFijoDTO> afs = resultado.getActivosFijos();
String method = "crearActivoFijoWS";
try { try {
DTActivoFijo params = new DTActivoFijo(); DTActivoFijo params = new DTActivoFijo();
for (ItemActivoFijoDTO titulo : dto.getTitulos()) { for (ItemActivoFijoDTO titulo : dto.getContratos()) {
DTActivoFijo.Registro tituloAF = new DTActivoFijo.Registro(); DTActivoFijo.Registro tituloAF = new DTActivoFijo.Registro();
tituloAF.setCentroCoste((Objects.nonNull(titulo.getCentroCosto()) && !titulo.getCentroCosto().isEmpty()) ? titulo.getCentroCosto() : ""); tituloAF.setCentroCoste((Objects.nonNull(titulo.getCentroCosto()) && !titulo.getCentroCosto().isEmpty()) ? titulo.getCentroCosto() : "");
tituloAF.setCodigoDDA((Objects.nonNull(titulo.getCodigoDDA()) && !titulo.getCodigoDDA().isEmpty()) ? titulo.getCodigoDDA() : ""); tituloAF.setCodigoDDA((Objects.nonNull(titulo.getCodigoDDA()) && !titulo.getCodigoDDA().isEmpty()) ? titulo.getCodigoDDA() : "");
...@@ -298,14 +301,34 @@ public class DDAExhibicionBO { ...@@ -298,14 +301,34 @@ public class DDAExhibicionBO {
LOG.info("IDDDA devuelto por sap: " + respuesta.getIDDDA() + " codigo DDA en parametros: " + registro.getCodigoDDA()); LOG.info("IDDDA devuelto por sap: " + respuesta.getIDDDA() + " codigo DDA en parametros: " + registro.getCodigoDDA());
registro.setCodigoSAP((Objects.nonNull(respuesta.getIDSAP()) && !respuesta.getIDSAP().isEmpty()) ? respuesta.getIDSAP() : ""); registro.setCodigoSAP((Objects.nonNull(respuesta.getIDSAP()) && !respuesta.getIDSAP().isEmpty()) ? respuesta.getIDSAP() : "");
} }
actualizarEstatusSapTitulosContrato("PRIMER LLAMADO: " + respuesta.getExcepcion(), registro.getContratoDDA());
} }
} }
DTActivoFijo paramsSeg = new DTActivoFijo();
for (ItemActivoFijoDTO titulo : dto.getTitulos()) {
DTActivoFijo.Registro tituloAF = new DTActivoFijo.Registro();
tituloAF.setCentroCoste((Objects.nonNull(titulo.getCentroCosto()) && !titulo.getCentroCosto().isEmpty()) ? titulo.getCentroCosto() : "");
tituloAF.setCodigoDDA((Objects.nonNull(titulo.getCodigoDDA()) && !titulo.getCodigoDDA().isEmpty()) ? titulo.getCodigoDDA() : "");
tituloAF.setDescripcion(strManager.extraerPrimerosCaracteres(
(Objects.nonNull(titulo.getDescripcion())&& !titulo.getDescripcion().isEmpty()) ? titulo.getDescripcion() : "", 45));
tituloAF.setOrdenCompra((Objects.nonNull(titulo.getOrdenCompra()) && !titulo.getOrdenCompra().isEmpty()) ? titulo.getOrdenCompra() : "");
tituloAF.setProveedor((Objects.nonNull(titulo.getProveedor()) && !titulo.getProveedor().isEmpty()) ? titulo.getProveedor() : "");
tituloAF.setProgramID((Objects.nonNull(titulo.getProgramID()) && !titulo.getProgramID().isEmpty()) ? titulo.getProgramID() : "");
tituloAF.setContratoDDA((Objects.nonNull(titulo.getContratoDDA()) && !titulo.getContratoDDA().isEmpty()) ? titulo.getContratoDDA() : "" );
tituloAF.setInicioAmortizacion((Objects.nonNull(titulo.getInicioAmortizacion()) && !titulo.getInicioAmortizacion().isEmpty()) ? titulo.getInicioAmortizacion() : "" );
for (DTActivoFijo.Registro registro : params.getRegistro()){
if (tituloAF.getContratoDDA().equals(registro.getContratoDDA())){
tituloAF.setCodigoSAP((Objects.nonNull(registro.getCodigoSAP()) && !registro.getCodigoSAP().isEmpty()) ? registro.getCodigoSAP() : "");
}
}
paramsSeg.getRegistro().add(tituloAF);
}
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [CrearActivoFijo]primer llamado:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [CrearActivoFijo]primer llamado:");
LOG.info(" "); LOG.info(" ");
LOG.debug(" Url Srv. Activo Fijo primer llamado segundo llamado: " + this.getUrlServicio(TEN)); LOG.debug(" Url Srv. Activo Fijo primer llamado segundo llamado: " + this.getUrlServicio(TEN));
responseActivoFijo = (DTActivoFijoRes) wsNotificaAFijoSAP.marshalSendAndReceive(this.getUrlServicio(TEN), params); responseActivoFijo = (DTActivoFijoRes) wsNotificaAFijoSAP.marshalSendAndReceive(this.getUrlServicio(TEN), paramsSeg);
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [CrearActivoFijo] segundo llamado:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [CrearActivoFijo] segundo llamado:");
...@@ -318,52 +341,55 @@ public class DDAExhibicionBO { ...@@ -318,52 +341,55 @@ public class DDAExhibicionBO {
LOG.info(" <IDDDA:[" + respuesta.getIDDDA() + "], IDSAP:[" + respuesta.getIDSAP() + "], Excepcion:[" LOG.info(" <IDDDA:[" + respuesta.getIDDDA() + "], IDSAP:[" + respuesta.getIDSAP() + "], Excepcion:["
+ respuesta.getExcepcion() + "]>"); + respuesta.getExcepcion() + "]>");
afs.add(respActivoFijo); afs.add(respActivoFijo);
dao.actualizarEstatusSapTitulosByTitulo("SEGUNDO LLAMADO: " + respuesta.getExcepcion(), respuesta.getIDDDA());
} }
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [CrearActivoFijo] segundo llamado:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [CrearActivoFijo] segundo llamado:");
LOG.info(" "); LOG.info(" ");
resultado.setResultado(Boolean.TRUE); resultado.setResultado(Boolean.TRUE);
} else { } else {
tf.setInternalCode("DDA-AF-004"); for (ItemActivoFijoDTO titulo : dto.getContratos()) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-004", ERROR_COMUNICACION_SAP, "El servicio web se ejecuto, pero la respuesta es NULL", method, titulo.getContratoDDA());
tf.setFaultDescription(ERROR_COMUNICACION_SAP); }
tf.setFaultMessage("El servicio web se ejecuto, pero la respuesta es NULL");
tf.setMethod("crearActivoFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
} }
return resultado; return resultado;
} catch (WebServiceException c) { } catch (WebServiceException c) {
tf.setInternalCode("DDA-AF-001"); for (ItemActivoFijoDTO titulo : dto.getContratos()) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-001", ERROR_COMUNICACION_SAP, c.getMessage(), method, titulo.getContratoDDA());
tf.setFaultDescription(ERROR_COMUNICACION_SAP); }
tf.setFaultMessage(c.getMessage());
tf.setMethod("crearActivoFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} catch (SoapFaultClientException se) { } catch (SoapFaultClientException se) {
tf.setInternalCode("DDA-AF-002"); for (ItemActivoFijoDTO titulo : dto.getContratos()) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-002", ERROR_INTERNO_SAP, se.getMessage(), method, titulo.getContratoDDA());
tf.setFaultDescription(ERROR_INTERNO_SAP); }
tf.setFaultMessage(se.getMessage());
tf.setMethod("crearActivoFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} catch (Exception e) { } catch (Exception e) {
tf.setInternalCode("DDA-AF-003"); for (ItemActivoFijoDTO titulo : dto.getContratos()) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-002", ERROR_PROCESO, e.getMessage(), method, titulo.getContratoDDA());
tf.setFaultDescription(ERROR_PROCESO); }
tf.setFaultMessage(e.getMessage());
tf.setMethod("crearActivoFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} }
} }
public void ejecutarTerminosComerciales( List<DatosCntTituloExhibicionDTO> titulos ){ private void writeResponse(TransactionFaultDTO tf, String intCode, String faultDesc, String message, String method, String idtituloCnt){
tf.setInternalCode(intCode);
tf.setComponent(COMPONENTE);
tf.setFaultDescription(faultDesc);
tf.setFaultMessage(message);
tf.setMethod(method);
dao.actualizarEstatusSapTitulosByTitulo(faultDesc, idtituloCnt);
}
public String ejecutarTerminosComerciales( List<DatosCntTituloExhibicionDTO> titulos ){
//--Llamado al WS de SAP. Interfaz 99. Terminos Comerciales //--Llamado al WS de SAP. Interfaz 99. Terminos Comerciales
LOG.info(" Url Srv. Activo Fijo primer llamado: " + this.getUrlServicio(TERMINOS)); LOG.info(" Url Srv. Activo Fijo primer llamado: " + this.getUrlServicio(TERMINOS));
String respuesta = "";
try { try {
Map<String,DatosCntTituloExhibicionDTO> map = new HashMap<>(); Map<String,DatosCntTituloExhibicionDTO> map = new HashMap<>();
LOG.info(" Entrando try: " ); LOG.info(" Entrando try: " );
...@@ -424,8 +450,7 @@ public class DDAExhibicionBO { ...@@ -424,8 +450,7 @@ public class DDAExhibicionBO {
DTTerminosComercialesRes response = (DTTerminosComercialesRes) wsNotificaAFijoSAP.marshalSendAndReceive(this.getUrlServicio(TERMINOS), params); DTTerminosComercialesRes response = (DTTerminosComercialesRes) wsNotificaAFijoSAP.marshalSendAndReceive(this.getUrlServicio(TERMINOS), params);
if(!response.getESTPROC().equals("OK")){ if(!response.getESTPROC().equals("OK")){
LOG.info(" Fallo el contrato " + contrato.getContratoDDA() + " al enviarlo a " + this.getUrlServicio(TERMINOS) + " se daran de baja los titulos en la BD."); LOG.info(" Fallo el contrato " + contrato.getContratoDDA() + " al enviarlo a " + this.getUrlServicio(TERMINOS) + " se daran de baja los titulos en la BD.");
//dao.eliminarIdSAPCntTitulo(contrato.getIdcontratoDDA()); respuesta = response.getEstatus();
LOG.info(" Se quitaron todos los Id_SAP de los titulos con el id de contrato: " + contrato.getIdcontratoDDA());
} else { } else {
LOG.info(" Respuesta OK del servicio ESTPROC: " + response.getESTPROC() + " con Estatus: " + response.getEstatus()); LOG.info(" Respuesta OK del servicio ESTPROC: " + response.getESTPROC() + " con Estatus: " + response.getEstatus());
} }
...@@ -436,7 +461,9 @@ public class DDAExhibicionBO { ...@@ -436,7 +461,9 @@ public class DDAExhibicionBO {
LOG.info(ex); LOG.info(ex);
ex.printStackTrace(); ex.printStackTrace();
java.util.logging.Logger.getLogger(DDAExhibicionBO.class.getName()).log(Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(DDAExhibicionBO.class.getName()).log(Level.SEVERE, null, ex);
respuesta = "ERROR DE PROCESO";
} }
return respuesta;
} }
public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia) throws Exception { public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia) throws Exception {
...@@ -463,7 +490,7 @@ public class DDAExhibicionBO { ...@@ -463,7 +490,7 @@ public class DDAExhibicionBO {
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
List<RespSAPNotificaAFijoDTO> not = resultado.getNotificaciones(); List<RespSAPNotificaAFijoDTO> not = resultado.getNotificaciones();
Map<String, List<RespSAPNotificaAFijoDTO>> mapNot = new HashMap<>(); Map<String, List<RespSAPNotificaAFijoDTO>> mapNot = new HashMap<>();
String method = "notificarAFijoWS";
try { try {
DTContenido params = new DTContenido(); DTContenido params = new DTContenido();
int xNotifica = 1; int xNotifica = 1;
...@@ -526,44 +553,42 @@ public class DDAExhibicionBO { ...@@ -526,44 +553,42 @@ public class DDAExhibicionBO {
not.add(respNotificaAFijo); not.add(respNotificaAFijo);
mapNot.put(respuesta.getCodigoDDA(), new ArrayList()); mapNot.put(respuesta.getCodigoDDA(), new ArrayList());
} }
if(respuesta.getStatus().equals("OK")){
dao.actualizarEstatusSapTitulosByTitulo(respuesta.getStatus(), respuesta.getCodigoDDA());
}
else{
dao.actualizarEstatusSapTitulosByTitulo(respuesta.getMensaje(), respuesta.getCodigoDDA());
}
} }
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Notificados]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Notificados]:");
LOG.info(" "); LOG.info(" ");
resultado.setResultado(Boolean.TRUE); resultado.setResultado(Boolean.TRUE);
} else { } else {
tf.setInternalCode("DDA-NOT-010"); for (DatosCntTituloExhibicionDTO dtoEx : dto) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-010", ERROR_COMUNICACION_SAP, "El servicio web se ejecuto, pero la respuesta es NULL", method, dtoEx.getID_TITULO_CNTORIG());
tf.setFaultDescription(ERROR_COMUNICACION_SAP); }
tf.setFaultMessage("El servicio web se ejecuto, pero la respuesta es NULL");
tf.setMethod("notificarAFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
} }
return resultado; return resultado;
} catch (WebServiceException c) { } catch (WebServiceException c) {
tf.setInternalCode("DDA-NOT-007"); for (DatosCntTituloExhibicionDTO dtoEx : dto) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-007", ERROR_COMUNICACION_SAP, c.getMessage(), method, dtoEx.getID_TITULO_CNTORIG());
tf.setFaultDescription(ERROR_COMUNICACION_SAP); }
tf.setFaultMessage(c.getMessage());
tf.setMethod("notificarAFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} catch (SoapFaultClientException se) { } catch (SoapFaultClientException se) {
tf.setInternalCode("DDA-NOT-008"); for (DatosCntTituloExhibicionDTO dtoEx : dto) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-008", ERROR_INTERNO_SAP, se.getMessage(), method, dtoEx.getID_TITULO_CNTORIG());
tf.setFaultDescription(ERROR_INTERNO_SAP); }
tf.setFaultMessage(se.getMessage());
tf.setMethod("notificarAFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} catch (Exception e) { } catch (Exception e) {
tf.setInternalCode("DDA-NOT-009"); for (DatosCntTituloExhibicionDTO dtoEx : dto) {
tf.setComponent(COMPONENTE); writeResponse(tf, "DDA-AF-009", ERROR_PROCESO, e.getMessage(), method, dtoEx.getID_TITULO_CNTORIG());
tf.setFaultDescription(ERROR_PROCESO); }
tf.setFaultMessage(e.getMessage());
tf.setMethod("notificarAFijoWS");
resultado.setResultado(Boolean.FALSE); resultado.setResultado(Boolean.FALSE);
return resultado; return resultado;
} }
...@@ -623,5 +648,27 @@ public class DDAExhibicionBO { ...@@ -623,5 +648,27 @@ public class DDAExhibicionBO {
} }
return resultado; return resultado;
} }
public List<ContratoDTO> contratosCandidatos(){
LOG.debug(" - [" + this.getClass().getSimpleName() + "::contratosCandidatos]");
List<ContratoDTO> resultado = null;
try {
resultado = dao.obtenerContratosCandidatos();
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::contratosCandidatos]: " + e.getMessage());
}
return resultado;
}
public void actualizarEstatusSapTitulosContrato(String mensaje, String idContrato){
LOG.debug(" - ["+this.getClass().getSimpleName()+"::actualizarEstatusSapTitulo]");
try
{
dao.actualizarEstatusSapTitulosByContrato(mensaje,idContrato);
}
catch(Exception e)
{
LOG.error("Exception["+this.getClass().getSimpleName()+"::ejecutarSPAmortizacionAjustada]: "+e.getMessage() );
}
}
} }
...@@ -449,8 +449,6 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO { ...@@ -449,8 +449,6 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO {
try { try {
String lstFechaReferencia = (pstFechaReferencia != null && pstFechaReferencia.length() > 0) ? pstFechaReferencia : "";
//--Ejecucion //--Ejecucion
sb.append("SELECT ordenCompra,proveedor,descripcion,MIN(codigoDDA) as codigoDDA,centroCosto,"); sb.append("SELECT ordenCompra,proveedor,descripcion,MIN(codigoDDA) as codigoDDA,centroCosto,");
sb.append("MIN(programID) as programID, contratoDDA, inicioAmortizacion, temporada, SUM(costo) as costo FROM ("); sb.append("MIN(programID) as programID, contratoDDA, inicioAmortizacion, temporada, SUM(costo) as costo FROM (");
...@@ -500,6 +498,58 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO { ...@@ -500,6 +498,58 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO {
return lobResultado; return lobResultado;
} }
@Override
public List<ItemActivoFijoDTO> obtenerContratosConTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception {
List<ItemActivoFijoDTO> lobResultado = new ArrayList<>();
StringBuilder sb = new StringBuilder();
List<Object> qryParams = new ArrayList<>();
try {
//--Ejecucion
sb.append("select ");
sb.append("contrato.ID_SAP as ordenCompra, ");
sb.append("estudio.ID_SAP as proveedor, ");
sb.append("'ACTIVO PRINCIPAL' as descripcion, ");
sb.append("MIN(cnttit.ID_TITULO_CNTORIG) as codigoDDA, ");
sb.append("'");
sb.append(CENTRO_COSTO);
sb.append("' as centroCosto, ");
sb.append("MIN(cnttit.ID_BV) as programID, ");
sb.append("contrato.NUMERO_CONTRATO AS contratoDDA, ");
sb.append("REPLACE(to_char(MIN(cnttit.FECHA_INICIO),'yyyy-mm-dd') ,'-','') AS inicioAmortizacion, ");
sb.append("SUM(cnttit.COSTO) AS costo ");
sb.append("from ");
sb.append("DDA_T_CONTRATO_TITULO cnttit, ");
sb.append("DDA_T_CONTRATO contrato, ");
sb.append("DDA_C_ESTUDIO estudio ");
sb.append("where ");
sb.append("cnttit.ID_CONTRATO = contrato.ID_CONTRATO ");
sb.append("and contrato.ID_ESTUDIO = estudio.ID_ESTUDIO ");
sb.append("and cnttit.ID_SAP is null ");
sb.append("and contrato.ID_ESTATUS = ? ");
sb.append("and estudio.ID_SAP is not null ");
sb.append("and contrato.ID_SAP is not null ");
sb.append("and contrato.ID_TIPO_CONTRATO = 1 ");
sb.append("GROUP BY contrato.ID_SAP, estudio.ID_SAP, contrato.NUMERO_CONTRATO, contrato.ID_CONTRATO_BV, contrato.NUMERO_CONTRATO ");
sb.append("ORDER BY ordenCompra, inicioAmortizacion DESC ");
//--Debug
LOG.debug(">Sql_D [obtenerTitulosSinIdSAP_RecienExhibidos]:" + sb.toString());
final String lstSQL = sb.toString();
qryParams.add(ESTATUS_VIGENTE);
//qryParams.add(lstFechaReferencia);
lobResultado = getJdbcTemplate().query(lstSQL, qryParams.toArray(), new BeanPropertyRowMapper<>(ItemActivoFijoDTO.class));
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::obtenerTitulosRecienExhibidos]: " + e.getMessage());
throw new Exception(e.getMessage());
}
return lobResultado;
}
@Override @Override
public boolean actualizaIdSAPCntTitulo(RespSAPActivoFijoDTO dto) throws Exception { public boolean actualizaIdSAPCntTitulo(RespSAPActivoFijoDTO dto) throws Exception {
...@@ -636,6 +686,45 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO { ...@@ -636,6 +686,45 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO {
return lobResultado; return lobResultado;
} }
@Override
public List<ContratoDTO> obtenerContratosCandidatos() throws Exception {
List<ContratoDTO> lobResultado = new ArrayList<>();
StringBuilder sb = new StringBuilder();
List<Object> qryParams = new ArrayList<>();
try {
//--Ejecucion
sb.append("select ");
sb.append("cnt.ID_SAP AS ordenCompra, ");
sb.append("cnt.ID_CONTRATO AS idcontratoDDA, ");
sb.append("cnt.NUMERO_CONTRATO AS contratoDDA, ");
sb.append("ROUND(SUM(cnttit.COSTO),2) AS valorcondicion, ");
sb.append("REPLACE(to_char(MIN(cnt.FECHA_FIN),'yyyy-mm-dd') ,'-','') AS fechavencimiento ");
sb.append("from ");
sb.append("DDA_T_CONTRATO_TITULO cnttit, ");
sb.append("DDA_T_CONTRATO cnt ");
sb.append("where ");
sb.append("cnttit.ID_CONTRATO = cnt.ID_CONTRATO ");
sb.append("and cnt.ID_ESTATUS = ? ");
sb.append("and (cnttit.ID_SAP is null ");
sb.append("or cnttit.FECHA_NOTIFSAP is null )");
sb.append("GROUP BY cnt.ID_SAP, cnt.ID_CONTRATO, cnt.NUMERO_CONTRATO ");
//--Debug
LOG.debug(">Sql_D [obtenerContratos]:" + sb.toString());
final String lstSQL = sb.toString();
qryParams.add(ESTATUS_VIGENTE);
lobResultado = (ArrayList<ContratoDTO>) getJdbcTemplate().query(lstSQL, qryParams.toArray(), new BeanPropertyRowMapper<>(ContratoDTO.class));
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::obtenerTitulosRecienExhibidos]: " + e.getMessage());
throw new Exception(e.getMessage());
}
return lobResultado;
}
public List<ContratoPagoDTO> obtenerCondicionesComerciales(String idContrato) throws Exception{ public List<ContratoPagoDTO> obtenerCondicionesComerciales(String idContrato) throws Exception{
List<ContratoPagoDTO> lobResultado = new ArrayList<>(); List<ContratoPagoDTO> lobResultado = new ArrayList<>();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -719,5 +808,66 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO { ...@@ -719,5 +808,66 @@ public class DDAExhibicionDAO implements IDDAExhibicionDAO {
return resultado; return resultado;
} }
@Override
public void actualizarEstatusSapTitulosByContrato(String mensaje, String idContrato) {
StringBuffer sb = new StringBuffer();
StringBuffer sbD = new StringBuffer();
List<Object> qryParams = new ArrayList<Object>();
try {
//--Debug
sbD.append("UPDATE DDA_T_CONTRATO_TITULO SET ESTATUS_SAP =' ");
sbD.append(mensaje);
sbD.append("' WHERE ID_CONTRATO = ");
sbD.append(idContrato);
LOG.debug(">Sql_D [actualizarEstatusSapTitulosByContrato]:" + sbD.toString());
//--Ejecucion
sb.append("UPDATE DDA_T_CONTRATO_TITULO SET ESTATUS_SAP =' ");
sb.append(mensaje);
sb.append("' WHERE ID_CONTRATO = ");
sb.append(idContrato);
final String lstSQL = sb.toString();
jdbcTemplate.update(lstSQL, qryParams.toArray());
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::actualizarEstatusSapTitulosByContrato]: " + e.getMessage());
}
}
@Override
public void actualizarEstatusSapTitulosByTitulo(String mensaje, String idtitulo) {
StringBuffer sb = new StringBuffer();
StringBuffer sbD = new StringBuffer();
List<Object> qryParams = new ArrayList<Object>();
try {
//--Debug
sbD.append("UPDATE DDA_T_CONTRATO_TITULO SET ESTATUS_SAP =' ");
sbD.append(mensaje);
sbD.append("' WHERE ID_TITULO_CNT = ");
sbD.append(idtitulo);
LOG.debug(">Sql_D [actualizarEstatusSapTitulos]:" + sbD.toString());
//--Ejecucion
sb.append("UPDATE DDA_T_CONTRATO_TITULO SET ESTATUS_SAP = ? ");
sb.append(" WHERE ID_TITULO_CNT = ? ");
sb.append(idtitulo);
final String lstSQL = sb.toString();
qryParams.add(mensaje);
qryParams.add(idtitulo);
jdbcTemplate.update(lstSQL, qryParams.toArray());
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::ejecutarSPAmortizacionAjustada]: " + e.getMessage());
}
}
} }
...@@ -20,10 +20,14 @@ public interface IDDAExhibicionDAO ...@@ -20,10 +20,14 @@ public interface IDDAExhibicionDAO
public boolean actualizaFechaNotificacion(ContratoTituloDTO dto) throws Exception; public boolean actualizaFechaNotificacion(ContratoTituloDTO dto) throws Exception;
public boolean insertarRegistroSubnum(String pstIdTituloCnt) throws Exception; public boolean insertarRegistroSubnum(String pstIdTituloCnt) throws Exception;
public List<ItemActivoFijoDTO> obtenerTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception; public List<ItemActivoFijoDTO> obtenerTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception;
public List<ItemActivoFijoDTO> obtenerContratosConTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception;
public boolean actualizaIdSAPCntTitulo(RespSAPActivoFijoDTO dto) throws Exception; public boolean actualizaIdSAPCntTitulo(RespSAPActivoFijoDTO dto) throws Exception;
public boolean ejecutarSPAmortizacionReal() throws Exception; public boolean ejecutarSPAmortizacionReal() throws Exception;
public List<ContratoDTO> obtenerContratos() throws Exception; public List<ContratoDTO> obtenerContratos() throws Exception;
public List<ContratoDTO> obtenerContratosCandidatos() throws Exception;
public boolean eliminarIdSAPCntTitulo(String idcontrato) throws Exception; public boolean eliminarIdSAPCntTitulo(String idcontrato) throws Exception;
public List<ContratoPagoDTO> obtenerCondicionesComerciales(String idContrato) throws Exception; public List<ContratoPagoDTO> obtenerCondicionesComerciales(String idContrato) throws Exception;
public List<ContratoPagoDTO> obtenerAnticipo(String idContrato) throws Exception; public List<ContratoPagoDTO> obtenerAnticipo(String idContrato) throws Exception;
public void actualizarEstatusSapTitulosByContrato(String mensaje, String idContrato);
public void actualizarEstatusSapTitulosByTitulo(String mensaje, String idContrato);
} }
...@@ -9,27 +9,36 @@ import java.util.List; ...@@ -9,27 +9,36 @@ import java.util.List;
*/ */
public class ParamActivoFijoDTO implements Serializable public class ParamActivoFijoDTO implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<ItemActivoFijoDTO> titulos; private List<ItemActivoFijoDTO> titulos;
private List<ItemActivoFijoDTO> contratos;
public List<ItemActivoFijoDTO> getTitulos() {
return titulos;
}
public void setTitulos(List<ItemActivoFijoDTO> titulos) {
this.titulos = titulos;
}
public String toString() public List<ItemActivoFijoDTO> getTitulos() {
{ return titulos;
StringBuilder result = new StringBuilder(); }
String NEW_LINE = System.getProperty("line.separator"); public void setTitulos(List<ItemActivoFijoDTO> titulos) {
result.append(" [Begin of Class] " + NEW_LINE); this.titulos = titulos;
result.append(this.getClass().getSimpleName() + " Object {" + NEW_LINE); }
result.append(" items: _" + this.getTitulos().size() + "_" + NEW_LINE);
result.append(" [End of Class] " + NEW_LINE);
result.append("}");
NEW_LINE = null;
return result.toString(); public List<ItemActivoFijoDTO> getContratos() {
} return contratos;
}
public void setContratos(List<ItemActivoFijoDTO> contratos) {
this.contratos = contratos;
}
public String toString()
{
StringBuilder result = new StringBuilder();
String NEW_LINE = System.getProperty("line.separator");
result.append(" [Begin of Class] " + NEW_LINE);
result.append(this.getClass().getSimpleName() + " Object {" + NEW_LINE);
result.append(" items: _" + this.getTitulos().size() + "_" + NEW_LINE);
result.append(" [End of Class] " + NEW_LINE);
result.append("}");
NEW_LINE = null;
return result.toString();
}
} }
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