Cambios de interfaz de contingencia contratos especificos

parent 296bb817
......@@ -123,7 +123,7 @@
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
p:concurrent="false"
p:targetObject-ref="exhibicion_DDA"
p:targetMethod="ejecutaProceso">
p:targetMethod="ejecuta">
</bean>
......
......@@ -4,6 +4,7 @@
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/mx/dda/msjb/service.java</file>
<file>file:/C:/Users/jfmj_/Documents/DDA/Githg/DDA_CRN_Exhibicion/src/mx/com/amx/mx/dda/crn/dao/IDDAExhibicionDAO.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/dao/DDAExhibicionDAO.java</file>
......
......@@ -123,7 +123,7 @@
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
p:concurrent="false"
p:targetObject-ref="exhibicion_DDA"
p:targetMethod="ejecutaProceso">
p:targetMethod="ejecuta">
</bean>
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.stream.Collectors;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
......@@ -35,19 +36,22 @@ public class DDAExhibicion implements ApplicationContextAware {
LOG.error(">Constructor[" + this.getClass().getSimpleName() + "] Ocurrio un error : " + e.getMessage());
}
}
public void ejecuta( List<String> contratosId) {
ejecutaProceso(null);
}
public String ejecutaProceso() {
public String ejecutaProceso(String contratosId) {
LOG.info(" ");
LOG.info("<< :::::::::::::::: Inicia Proceso Notifica Exhibicion DDA :::::::::::::::: >>");
String mensaje = "OK";
try {
//-- 1. Verifica que no se este ejecutando ya un proceso de Notificacion
LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion.");
boolean boEjecutandoseProceso = bo.existeProcesoNotificacionEjecutandose();
LOG.info(" [INI]. Paso 1.- Verifica bandera de ejecucion de proceso de Notificacion. Esta ejecutando?: _" + boEjecutandoseProceso + "_");
List<ContratoDTO> contratos = bo.contratosCandidatos();
List<ContratoDTO> contratos = bo.contratosCandidatos(contratosId);
if (!boEjecutandoseProceso) {
//-- 2. Verificar si se puede iniciar el proceso
......@@ -81,17 +85,17 @@ public class DDAExhibicion implements ApplicationContextAware {
//-- 8. Llamado a la interfaz 10. Creacion de orden de Compra en SAP.
LOG.info(" [INI]. Paso 6.- Creacion en SAP de Titulos Recien exhibidos. (Creacion de Orden de Compra)");
ResponseOrdenCompraDTO resCOrdenCompra = bo.creacionTitulosSAP(lstFechaReferencia);
ResponseOrdenCompraDTO resCOrdenCompra = bo.creacionTitulosSAP(lstFechaReferencia, contratosId);
LOG.info(" [FIN]. Paso 6.- Creacion en SAP de Titulos Recien exhibidos. Resultado: [" + resCOrdenCompra.getMensaje() + "]");
//-- 7. Obtener los titulos recien exhibidos para notificarlos a SAP
LOG.info(" [INI]. Paso 7.- Obtener Titulos recien exhibidos con base a fecha referencia.");
List<DatosCntTituloExhibicionDTO> lobTitulos = bo.obtenerTitulosRecienExhibidos(lstFechaReferencia);
List<DatosCntTituloExhibicionDTO> lobTitulosTC = bo.obtenerContratosRecienExhibidos(lstFechaReferencia);
List<DatosCntTituloExhibicionDTO> lobTitulos = bo.obtenerTitulosRecienExhibidos(lstFechaReferencia, contratosId);
List<DatosCntTituloExhibicionDTO> lobTitulosTC = bo.obtenerContratosRecienExhibidos(lstFechaReferencia, contratosId);
LOG.info(" [FIN]. Paso 7.- Obtener Titulos recien exhibidos con base a fecha referencia. Titulos:_" + lobTitulos.size() + "_");
LOG.info(" [INI]. Paso 8.- Envo de terminos comerciales de los contratos. (Creacion de Terminos Comerciales)");
Map<String,String> respuestaTC = bo.ejecutarTerminosComerciales(lobTitulosTC);
Map<String,String> respuestaTC = bo.ejecutarTerminosComerciales(lobTitulosTC, contratosId);
LOG.info(" [FIN]. Paso 8.- Envo de terminos comerciales de los contratos.");
if (Objects.nonNull(lobTitulos) && !lobTitulos.isEmpty()) {
//-- 8. LLamado a WS para notificar Activo Fijo (Titulos recien exhibidos)
......
......@@ -19,6 +19,8 @@ import com.americamovil.dda._1.f.enviacontenido.DTContenidoRes;
import com.americamovil.dda._1.f.enviaterminoscomerciales.DTTerminosComerciales;
import com.americamovil.dda._1.f.enviaterminoscomerciales.DTTerminosComercialesRes;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
......@@ -171,7 +173,7 @@ public class DDAExhibicionBO {
}
public ResponseOrdenCompraDTO creacionTitulosSAP(String pstFechaReferencia) throws Exception {
public ResponseOrdenCompraDTO creacionTitulosSAP(String pstFechaReferencia, String contratosId) throws Exception {
LOG.debug(" - [" + this.getClass().getSimpleName() + "::creacionTitulosSAP]");
ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO();
int lnuTotalRegOCSAP_OK = 0;
......@@ -182,8 +184,8 @@ public class DDAExhibicionBO {
try {
//-- 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.");
List<ItemActivoFijoDTO> lobTitulosCnt = dao.obtenerTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia);
List<ItemActivoFijoDTO> lobContratosCnt = dao.obtenerContratosConTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia);
List<ItemActivoFijoDTO> lobTitulosCnt = dao.obtenerTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia, contratosId);
List<ItemActivoFijoDTO> lobContratosCnt = dao.obtenerContratosConTitulosSinIdSAP_RecienExhibidos(pstFechaReferencia, contratosId);
LOG.info(" [FIN]. Consulta de Titulos sin ID SAP Recien Exhibidos. Titulos:_" + lobTitulosCnt.size() + "_");
if (Objects.nonNull(lobTitulosCnt) && !lobTitulosCnt.isEmpty()) {
......@@ -397,7 +399,7 @@ public class DDAExhibicionBO {
dao.actualizarEstatusSapTitulosByTitulo(faultDesc, idtituloCnt);
}
public Map<String,String> ejecutarTerminosComerciales( List<DatosCntTituloExhibicionDTO> titulos ){
public Map<String,String> ejecutarTerminosComerciales( List<DatosCntTituloExhibicionDTO> titulos, String contratosId ){
//--Llamado al WS de SAP. Interfaz 99. Terminos Comerciales
LOG.info(" Url Srv. Activo Fijo primer llamado: " + this.getUrlServicio(TERMINOS));
Map<String,String> validaciones = new HashMap<>();
......@@ -413,7 +415,7 @@ public class DDAExhibicionBO {
map.get(titulo.getNUMERO_CONTRATO()).setCOSTO(suma.toString());
}
}
List<ContratoDTO> contratos = dao.obtenerContratos();
List<ContratoDTO> contratos = dao.obtenerContratos(contratosId);
LOG.info(" Contratos encontrado: " + contratos.size() );
for(ContratoDTO contrato : contratos){
if (Objects.nonNull(map.get(contrato.getContratoDDA()))){
......@@ -479,14 +481,14 @@ public class DDAExhibicionBO {
return validaciones;
}
public List<DatosCntTituloExhibicionDTO> obtenerContratosRecienExhibidos(String pstFechaReferencia) throws Exception {
public List<DatosCntTituloExhibicionDTO> obtenerContratosRecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception {
LOG.debug(" - [" + this.getClass().getSimpleName() + "::obtenerContratosRecienExhibidos]");
LOG.debug(" - Parametros: _" + pstFechaReferencia + "_");
List<DatosCntTituloExhibicionDTO> lobResultado = new ArrayList<>();
try {
lobResultado = dao.obtenerTitulosRecienExhibidos(pstFechaReferencia);
lobResultado = dao.obtenerTitulosRecienExhibidos(pstFechaReferencia, contratosId);
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::obtenerFechaReferencia]: " + e.getMessage());
throw new Exception(e.getMessage());
......@@ -495,14 +497,20 @@ public class DDAExhibicionBO {
return lobResultado;
}
public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia) throws Exception {
public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception {
LOG.debug(" - [" + this.getClass().getSimpleName() + "::obtenerTitulosRecienExhibidos]");
LOG.debug(" - Parametros: _" + pstFechaReferencia + "_");
List<DatosCntTituloExhibicionDTO> lobResultado = new ArrayList<>();
try {
lobResultado = dao.obtenerTitulosRecienExhibidos(pstFechaReferencia);
lobResultado = dao.obtenerTitulosRecienExhibidos(pstFechaReferencia, contratosId);
Collections.sort(lobResultado, new Comparator<DatosCntTituloExhibicionDTO> (){
@Override
public int compare(DatosCntTituloExhibicionDTO d1, DatosCntTituloExhibicionDTO d2){
return d1.getID_SAP().compareTo(d2.getID_SAP());
}
});
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::obtenerFechaReferencia]: " + e.getMessage());
throw new Exception(e.getMessage());
......@@ -688,11 +696,11 @@ public class DDAExhibicionBO {
return resultado;
}
public List<ContratoDTO> contratosCandidatos(){
public List<ContratoDTO> contratosCandidatos(String contratosId){
LOG.debug(" - [" + this.getClass().getSimpleName() + "::contratosCandidatos]");
List<ContratoDTO> resultado = null;
try {
resultado = dao.obtenerContratosCandidatos();
resultado = dao.obtenerContratosCandidatos(contratosId);
} catch (Exception e) {
LOG.error("Exception[" + this.getClass().getSimpleName() + "::contratosCandidatos]: " + e.getMessage());
}
......
......@@ -16,16 +16,16 @@ public interface IDDAExhibicionDAO
public boolean puedeIniciarProcesoNotificacion() throws Exception;
public boolean verificaEjecutandoseProcesoNotificacion() throws Exception;
public boolean updateEjecutandoseProcesoNotificacion(String pstValor) throws Exception;
public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia) throws Exception;
public List<DatosCntTituloExhibicionDTO> obtenerContratosRecienExhibidos(String pstFechaReferencia) throws Exception;
public List<DatosCntTituloExhibicionDTO> obtenerTitulosRecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception;
//public List<DatosCntTituloExhibicionDTO> obtenerContratosRecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception;
public boolean actualizaFechaNotificacion(ContratoTituloDTO dto) throws Exception;
public boolean insertarRegistroSubnum(String pstIdTituloCnt) throws Exception;
public List<ItemActivoFijoDTO> obtenerTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception;
public List<ItemActivoFijoDTO> obtenerContratosConTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia) throws Exception;
public List<ItemActivoFijoDTO> obtenerTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception;
public List<ItemActivoFijoDTO> obtenerContratosConTitulosSinIdSAP_RecienExhibidos(String pstFechaReferencia, String contratosId) throws Exception;
public boolean actualizaIdSAPCntTitulo(RespSAPActivoFijoDTO dto) throws Exception;
public boolean ejecutarSPAmortizacionReal() throws Exception;
public List<ContratoDTO> obtenerContratos() throws Exception;
public List<ContratoDTO> obtenerContratosCandidatos() throws Exception;
public List<ContratoDTO> obtenerContratos(String contratosId) throws Exception;
public List<ContratoDTO> obtenerContratosCandidatos(String contratosId) throws Exception;
public boolean eliminarIdSAPCntTitulo(String idcontrato) throws Exception;
public List<ContratoPagoDTO> obtenerCondicionesComerciales(String idContrato) throws Exception;
public List<ContratoPagoDTO> obtenerAnticipo(String idContrato) throws Exception;
......
......@@ -10,40 +10,53 @@ package mx.com.mx.dda.msjb;
* @author albarranoi
*/
import java.io.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.List;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import mx.com.amx.mx.dda.crn.DDAExhibicion;
import mx.com.amx.mx.dda.crn.bo.DDAExhibicionBO;
import org.apache.log4j.Logger;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@WebServlet(name="service", urlPatterns={"/servicio"})
public class service extends HttpServlet {
private DDAExhibicion ex;
private DDAExhibicionBO bo;
private final Logger LOG = Logger.getLogger(this.getClass().getSimpleName());
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String jsonList = request.getParameter("lista");
ObjectMapper objMapper = new ObjectMapper();
List<String> contratos = objMapper.readValue(jsonList, new TypeReference<List<String>>() {});
response.setContentType("application/json");
PrintWriter out = response.getWriter();
String msg = ejec();
String msg = ejec(contratos,jsonList);
out.write("{\"rows\":\"" + msg + "\"}");
}
public String ejec() {
public String ejec( List<String> contratos, String jsonList) {
ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml");
setEx((DDAExhibicion) context.getBean("exhibicion_DDA"));
getEx().ejecutaProceso();
LOG.info(" Ejecutando proceso por solicitud para los contratos: " + jsonList);
String cntrts = "";
boolean primero = true;
for (String elemento : contratos) {
if (!primero) {
cntrts += ",";
}
cntrts += elemento;
primero = false;
}
getEx().ejecutaProceso(cntrts);
return "OK";
}
......
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