7 changed files with 193 additions and 112 deletions
-
80src/main/java/com/gcc/erppostdata/common/MySchduler.java
-
2src/main/java/com/gcc/erppostdata/communityhall/CHPostData.java
-
102src/main/java/com/gcc/erppostdata/communityhall/CmhScheduler.java
-
2src/main/java/com/gcc/erppostdata/config/DatabaseConfig.java
-
2src/main/java/com/gcc/erppostdata/petregistration/PRPostData.java
-
102src/main/java/com/gcc/erppostdata/petregistration/PetScheduler.java
-
15src/main/resources/application.properties
@ -0,0 +1,80 @@ |
|||
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() |
|||
); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
@ -1,51 +1,51 @@ |
|||
package com.gcc.erppostdata.communityhall; |
|||
|
|||
|
|||
import com.gcc.erppostdata.repo.CommunityHallLogRepo; |
|||
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.List; |
|||
import java.util.Map; |
|||
|
|||
@Configuration |
|||
@EnableScheduling // Enable scheduling |
|||
public class CmhScheduler { |
|||
|
|||
@Autowired |
|||
CmhQueryBank queryBank; |
|||
|
|||
@Autowired |
|||
CommunityHallLogRepo communityHallLogRepo; |
|||
|
|||
@Scheduled(fixedRate = 3600000) // Runs every 1 hour (3600000 milliseconds) |
|||
public void oneHouseScheduledMethod() { |
|||
int lastBookingIdInserted = communityHallLogRepo.getLastBookingIdInserted(); |
|||
System.out.println("community Hall lastBookingIdInserted:---->"+lastBookingIdInserted); |
|||
queryBank.hourlyPushData( lastBookingIdInserted); |
|||
|
|||
} |
|||
@Scheduled(fixedRate = 10800000) |
|||
public void threeHouseScheduledMethod() { |
|||
System.out.println("im for ERP post data"); |
|||
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() |
|||
); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
@Scheduled(fixedRate = 10000) |
|||
public void tensecScheduledMethod(){ |
|||
|
|||
// System.out.print("hello"); |
|||
} |
|||
|
|||
|
|||
} |
|||
//package com.gcc.erppostdata.communityhall; |
|||
// |
|||
// |
|||
//import com.gcc.erppostdata.repo.CommunityHallLogRepo; |
|||
//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.List; |
|||
//import java.util.Map; |
|||
// |
|||
//@Configuration |
|||
//@EnableScheduling // Enable scheduling |
|||
//public class CmhScheduler { |
|||
// |
|||
// @Autowired |
|||
// CmhQueryBank queryBank; |
|||
// |
|||
// @Autowired |
|||
// CommunityHallLogRepo communityHallLogRepo; |
|||
// |
|||
// @Scheduled(fixedRate = 3600000) // Runs every 1 hour (3600000 milliseconds) |
|||
// public void oneHouseScheduledMethod() { |
|||
// int lastBookingIdInserted = communityHallLogRepo.getLastBookingIdInserted(); |
|||
// System.out.println("community Hall lastBookingIdInserted:---->"+lastBookingIdInserted); |
|||
// queryBank.hourlyPushData( lastBookingIdInserted); |
|||
// |
|||
// } |
|||
// @Scheduled(fixedRate = 10800000) |
|||
// public void threeHouseScheduledMethod() { |
|||
// System.out.println("im for ERP post data"); |
|||
// 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() |
|||
// ); |
|||
// } |
|||
// |
|||
// |
|||
// } |
|||
// |
|||
// |
|||
// @Scheduled(fixedRate = 10000) |
|||
// public void tensecScheduledMethod(){ |
|||
// |
|||
//// System.out.print("hello"); |
|||
// } |
|||
// |
|||
// |
|||
//} |
|||
@ -1,51 +1,51 @@ |
|||
package com.gcc.erppostdata.petregistration; |
|||
|
|||
|
|||
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 org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
//@Configuration |
|||
//@EnableScheduling |
|||
@Service |
|||
public class PetScheduler { |
|||
|
|||
@Autowired |
|||
PetQueryBank petQueryBank; |
|||
|
|||
@Autowired |
|||
PetLogRepo petLogRepo; |
|||
|
|||
@Scheduled(fixedRate = 3600000) // Runs every 1 hour (3600000 milliseconds) |
|||
public void oneHouseScheduledMethod() { |
|||
int lastUniqueIdInserted = petLogRepo.getLastUniqueIdInserted(); |
|||
System.out.println("Pet License lastUniqueIdInserted:--->"+lastUniqueIdInserted); |
|||
petQueryBank.hourlyPushData(lastUniqueIdInserted); |
|||
} |
|||
@Scheduled(fixedRate = 10800000) |
|||
public void threeHouseScheduledMethod() { |
|||
System.out.println("im for ERP pet post data test"); |
|||
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() |
|||
); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
@Scheduled(fixedRate = 10000) |
|||
public void tensecScheduledMethod(){ |
|||
|
|||
// System.out.print("hello"); |
|||
} |
|||
|
|||
} |
|||
//package com.gcc.erppostdata.petregistration; |
|||
// |
|||
// |
|||
//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 org.springframework.stereotype.Service; |
|||
// |
|||
//import java.util.List; |
|||
//import java.util.Map; |
|||
// |
|||
////@Configuration |
|||
////@EnableScheduling |
|||
//@Service |
|||
//public class PetScheduler { |
|||
// |
|||
// @Autowired |
|||
// PetQueryBank petQueryBank; |
|||
// |
|||
// @Autowired |
|||
// PetLogRepo petLogRepo; |
|||
// |
|||
// @Scheduled(fixedRate = 3600000) // Runs every 1 hour (3600000 milliseconds) |
|||
// public void oneHouseScheduledMethod() { |
|||
// int lastUniqueIdInserted = petLogRepo.getLastUniqueIdInserted(); |
|||
// System.out.println("Pet License lastUniqueIdInserted:--->"+lastUniqueIdInserted); |
|||
// petQueryBank.hourlyPushData(lastUniqueIdInserted); |
|||
// } |
|||
// @Scheduled(fixedRate = 10800000) |
|||
// public void threeHouseScheduledMethod() { |
|||
// System.out.println("im for ERP pet post data test"); |
|||
// 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() |
|||
// ); |
|||
// } |
|||
// |
|||
// |
|||
// } |
|||
// |
|||
// |
|||
// @Scheduled(fixedRate = 10000) |
|||
// public void tensecScheduledMethod(){ |
|||
// |
|||
//// System.out.print("hello"); |
|||
// } |
|||
// |
|||
//} |
|||
@ -1,11 +1,12 @@ |
|||
spring.application.name=erppostdata |
|||
|
|||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/erppostdata |
|||
spring.datasource.username=root |
|||
spring.datasource.password=root |
|||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
|||
|
|||
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect |
|||
spring.jpa.hibernate.ddl-auto=update |
|||
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/erppostdata |
|||
#spring.datasource.username=root |
|||
#spring.datasource.password=gccroot |
|||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
|||
# |
|||
#spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect |
|||
#spring.jpa.hibernate.ddl-auto=update |
|||
|
|||
spring.profiles.active=prod |
|||
server.port=8067 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue