Consumo facturacion autorizacion task

parent 4a8f88a8
...@@ -38,13 +38,15 @@ public class Task_autorizacion implements Tasklet { ...@@ -38,13 +38,15 @@ public class Task_autorizacion implements Tasklet {
private static String ambiente= "PRODUCCION"; private static String ambiente= "PRODUCCION";
@Autowired /* @Autowired
ConsultasFacturacionController consultas; ConsultasFacturacionController consultas;*/
@Override @Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ConsultasFacturacionController consultas= new ConsultasFacturacionController();
List<FacturaDTO> listFactContingencia= new ArrayList<FacturaDTO>(); List<FacturaDTO> listFactContingencia= new ArrayList<FacturaDTO>();
/**OBTENER LA FECHA ACTUAL**/ /**OBTENER LA FECHA ACTUAL**/
......
...@@ -9,6 +9,7 @@ import ec.edu.epn.consumosriautorizacion.dto.PagosDTO; ...@@ -9,6 +9,7 @@ import ec.edu.epn.consumosriautorizacion.dto.PagosDTO;
import ec.edu.epn.consumosriautorizacion.dto.UserFactDTO; import ec.edu.epn.consumosriautorizacion.dto.UserFactDTO;
import ec.edu.epn.consumosriautorizacion.service.EmailService; import ec.edu.epn.consumosriautorizacion.service.EmailService;
import ec.edu.epn.consumosriautorizacion.service.FTPService; import ec.edu.epn.consumosriautorizacion.service.FTPService;
import ec.edu.epn.consumosriautorizacion.service.FileServiceImp;
import org.apache.commons.net.util.Base64; import org.apache.commons.net.util.Base64;
import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.scope.context.ChunkContext;
...@@ -33,12 +34,12 @@ import static java.nio.charset.StandardCharsets.UTF_8; ...@@ -33,12 +34,12 @@ import static java.nio.charset.StandardCharsets.UTF_8;
@Component @Component
public class Task_cargaDocumentacion implements Tasklet { public class Task_cargaDocumentacion implements Tasklet {
@Autowired /* @Autowired
ConsultasFacturacionController consultas; ConsultasFacturacionController consultas;
@Autowired @Autowired
FTPService ftpService; FTPService ftpService;*/
...@@ -53,6 +54,10 @@ public class Task_cargaDocumentacion implements Tasklet { ...@@ -53,6 +54,10 @@ public class Task_cargaDocumentacion implements Tasklet {
@Override @Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ConsultasFacturacionController consultas= new ConsultasFacturacionController();
FTPService ftpService= new FileServiceImp();
List<FacturaDTO> listFact= new ArrayList<FacturaDTO>(); List<FacturaDTO> listFact= new ArrayList<FacturaDTO>();
/**OBTENER LA FECHA ACTUAL**/ /**OBTENER LA FECHA ACTUAL**/
Date date = new Date(); Date date = new Date();
...@@ -198,6 +203,8 @@ public class Task_cargaDocumentacion implements Tasklet { ...@@ -198,6 +203,8 @@ public class Task_cargaDocumentacion implements Tasklet {
public UserFactDTO usuarioFact(String ciRucCli) { public UserFactDTO usuarioFact(String ciRucCli) {
ConsultasFacturacionController consultas= new ConsultasFacturacionController();
UserFactDTO usuario= new UserFactDTO(); UserFactDTO usuario= new UserFactDTO();
usuario = consultas.consumoUserFact(ciRucCli.trim()); usuario = consultas.consumoUserFact(ciRucCli.trim());
try { try {
......
...@@ -7,10 +7,7 @@ import org.springframework.scheduling.TaskScheduler; ...@@ -7,10 +7,7 @@ import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger; import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
@Service @Service
...@@ -25,7 +22,8 @@ public class TaskSchedulingService { ...@@ -25,7 +22,8 @@ public class TaskSchedulingService {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
String jobId = uuid.toString(); String jobId = uuid.toString();
System.out.println("Cron con job id: " + jobId + " y cron : " + cronExpression); System.out.println("Cron con job id: " + jobId + " y cron : " + cronExpression);
ScheduledFuture<?> scheduledTask = taskScheduler.schedule(tasklet, new CronTrigger(cronExpression, TimeZone.getTimeZone(TimeZone.getDefault().getID()))); //ScheduledFuture<?> scheduledTask = taskScheduler.schedule(tasklet, new CronTrigger(cronExpression, TimeZone.getTimeZone(TimeZone.getDefault().getID())));
ScheduledFuture<?> scheduledTask = taskScheduler.schedule(tasklet, new CronTrigger("0 0/5 8,9,10,11,12,13,14,15,16,17,18 * * ?"));
jobsMap.put(jobId, scheduledTask); jobsMap.put(jobId, scheduledTask);
return "CRON-JOB:{id: " + jobId + ", cron : " + cronExpression + "}"; return "CRON-JOB:{id: " + jobId + ", cron : " + cronExpression + "}";
} }
......
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