You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
package com.gcc.erppostdata.common;
|
|
|
|
import com.gcc.erppostdata.communityhall.CmhQueryBank;
|
|
import com.gcc.erppostdata.petregistration.PetQueryBank;
|
|
import com.gcc.erppostdata.repo.CommunityHallLogRepo;
|
|
import com.gcc.erppostdata.repo.PetLogRepo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Configuration
|
|
@EnableScheduling
|
|
public class MySchduler {
|
|
|
|
@Autowired
|
|
CmhQueryBank queryBank;
|
|
|
|
@Autowired
|
|
CommunityHallLogRepo communityHallLogRepo;
|
|
|
|
@Autowired
|
|
PetQueryBank petQueryBank;
|
|
|
|
@Autowired
|
|
PetLogRepo petLogRepo;
|
|
|
|
@Scheduled(fixedRate = 3600000) // Runs every 1 hour (3600000 milliseconds)
|
|
public void hourlyScheduled() {
|
|
oneHourCmhSch();
|
|
oneHourPetSch();
|
|
}
|
|
|
|
@Scheduled(fixedRate = 10800000)
|
|
public void threeHoursScheduled() {
|
|
threeHourCmhSch();
|
|
threeHourPetSch();
|
|
}
|
|
|
|
|
|
public void oneHourCmhSch() {
|
|
System.out.println("community Hourly Post data"+new Date());
|
|
int lastBookingIdInserted = communityHallLogRepo.getLastBookingIdInserted();
|
|
System.out.println("community Hall lastBookingIdInserted:---->"+lastBookingIdInserted);
|
|
queryBank.hourlyPushData( lastBookingIdInserted);
|
|
|
|
}
|
|
public void threeHourCmhSch() {
|
|
System.out.println("CommunityHall Three Hour Post data"+new Date()); List<Map<String, Object>> dataByStatus = communityHallLogRepo.getDataByStatus(String.valueOf(0));
|
|
for (Map<String, Object> data : dataByStatus) {
|
|
queryBank.resendPushData(data.get("transactionId").toString(),
|
|
data.get("id").toString()
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
public void oneHourPetSch() {
|
|
System.out.println("Pet Hourly Post data"+new Date());
|
|
int lastUniqueIdInserted = petLogRepo.getLastUniqueIdInserted();
|
|
System.out.println("Pet License lastUniqueIdInserted:--->"+lastUniqueIdInserted);
|
|
petQueryBank.hourlyPushData(lastUniqueIdInserted);
|
|
}
|
|
public void threeHourPetSch() {
|
|
System.out.println("Pet Three Hour Post data"+new Date());
|
|
List<Map<String, Object>> dataByStatus = petLogRepo.getDataByStatus(String.valueOf(0));
|
|
for (Map<String, Object> data : dataByStatus) {
|
|
petQueryBank.resendPushData(data.get("uniqueId").toString(),
|
|
data.get("id").toString()
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|