Commit 6e1e5140 authored by Roberto Loayza's avatar Roberto Loayza

Update SchedulerService, CountryRepository

parent 31fd50ae
package com.bytesw.bytebot.etl.batch.listener; package com.bytesw.bytebot.etl.batch.listener;
import lombok.extern.log4j.Log4j2;
import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport; import org.springframework.batch.core.listener.JobExecutionListenerSupport;
@Log4j2
public class JobCompletionListener extends JobExecutionListenerSupport { public class JobCompletionListener extends JobExecutionListenerSupport {
@Override @Override
public void afterJob(JobExecution jobExecution) { public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) { if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
System.out.println("BATCH JOB COMPLETED SUCCESSFULLY"); log.debug("BATCH JOB COMPLETED SUCCESSFULLY");
} }
} }
......
...@@ -321,7 +321,7 @@ public class ScheduleService implements SchedulingConfigurer { ...@@ -321,7 +321,7 @@ public class ScheduleService implements SchedulingConfigurer {
result = false; result = false;
} }
} else if (exception.getFrequencyType().equals(FrequencyType.UNIQUE.getName())) { } else if (exception.getFrequencyType().equals(FrequencyType.UNIQUE.getName())) {
if (now.toLocalDate() == exception.getDate()) { if (now.toLocalDate().equals(exception.getDate())) {
result = false; result = false;
} }
} else if (exception.getFrequencyType().equals(FrequencyType.UniqueWeekly.getName())) { } else if (exception.getFrequencyType().equals(FrequencyType.UniqueWeekly.getName())) {
...@@ -389,7 +389,7 @@ public class ScheduleService implements SchedulingConfigurer { ...@@ -389,7 +389,7 @@ public class ScheduleService implements SchedulingConfigurer {
/* Métodos ETL de data sensible */ /* Métodos ETL de data sensible */
private Job createJobDataSens(DeleteDataSensBean data) { private Job createJobDataSens(DeleteDataSensBean data) {
System.out.println("ETL de eliminacion"); log.info("ETL de eliminacion");
ThreadLocalStorage.setTenantName(tenant); ThreadLocalStorage.setTenantName(tenant);
return jobBuilderFactory.get( String.format("processDataSensible-%d",data.getAgenId())) return jobBuilderFactory.get( String.format("processDataSensible-%d",data.getAgenId()))
.incrementer(new RunIdIncrementer()).listener(listener) .incrementer(new RunIdIncrementer()).listener(listener)
......
package com.bytesw.bytebot.repository; package com.bytesw.bytebot.repository;
import com.bytesw.bytebot.model.Country; import com.bytesw.bytebot.model.Country;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import java.util.List;
/** /**
* @author Sebastián Chicoma Sandmann. * @author Sebastián Chicoma Sandmann.
* @version 9-sep-2020 * @version 9-sep-2020
...@@ -15,4 +18,7 @@ import org.springframework.data.repository.CrudRepository; ...@@ -15,4 +18,7 @@ import org.springframework.data.repository.CrudRepository;
* licencia de uso que firmó con Byte. * licencia de uso que firmó con Byte.
*/ */
public interface CountryRepository extends CrudRepository<Country, Long> { public interface CountryRepository extends CrudRepository<Country, Long> {
@Query("select c from Country c order by c.name")
List<Country> findAllOrder();
} }
...@@ -451,7 +451,7 @@ public class AgentService extends CustomPaginationService<Agent> { ...@@ -451,7 +451,7 @@ public class AgentService extends CustomPaginationService<Agent> {
public List<CountryBean> getCountries() { public List<CountryBean> getCountries() {
List<CountryBean> countriesBean = new ArrayList<>(); List<CountryBean> countriesBean = new ArrayList<>();
List<Country> countries = (List<Country>) countryRepository.findAll(); List<Country> countries = countryRepository.findAllOrder();
for (Country country : countries) { for (Country country : countries) {
countriesBean.add(CountryBean.clone(country)); countriesBean.add(CountryBean.clone(country));
......
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