Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTI-datasync scheduler changes #103

Merged
merged 19 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/environment/common_dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ start-email-scheduler=false
cron-scheduler-email=0 0/1 * * * ? *

###cti data sync Scheduler configurations
#Runs at every alternative days at 2AM
start-ctidatasync-scheduler=false
cron-scheduler-ctidatasync=0 00 01 * * ? *
cron-scheduler-ctidatasync=0 0 2 */2 * ?

###cti data check with call detail report Scheduler
#Runs at everyday 12:10AM
Expand Down
4 changes: 3 additions & 1 deletion src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ start-email-scheduler=false
cron-scheduler-email=0 0/1 * * * ? *
##-------------------------------###cti data sync Scheduler configurations------------------------------------------------------

#Runs at every alternative days at 2AM
start-ctidatasync-scheduler=false
cron-scheduler-ctidatasync=0 00 01 * * ? *
cron-scheduler-ctidatasync=0 0 2 */2 * ?


##-------------------------------###cti data check with call detail report Scheduler------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
package com.iemr.common.service.ctiCall;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
Expand Down Expand Up @@ -86,20 +88,34 @@ public String callUrl(String urlRequest) {
@Override
public void ctiDataSync() {
List<Objects[]> resultSet = null;
Date date = new Date();
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
String text = sqlDate.toString();
Timestamp endDate = new Timestamp(sqlDate.getTime());
Calendar calendar = Calendar.getInstance();
calendar.setTime(sqlDate);
logger.info("CZduration: " + CZduration);
calendar.add(Calendar.DATE, -(Integer.parseInt(CZduration)));
Date beforeDate = calendar.getTime();
Timestamp startDate = new Timestamp(beforeDate.getTime());
// Date date = new Date();
// java.sql.Date sqlDate = new java.sql.Date(date.getTime());
// String text = sqlDate.toString();
// Timestamp endDate = new Timestamp(sqlDate.getTime());
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(sqlDate);
// logger.info("CZduration: " + CZduration);
// calendar.add(Calendar.DATE, -(Integer.parseInt(CZduration)));
// Date beforeDate = calendar.getTime();
// Timestamp startDate = new Timestamp(beforeDate.getTime());

// Get the current date
LocalDate currentDate = LocalDate.now();
// Calculate three days before the current date
LocalDate startDate = currentDate.minusDays(3);
// Calculate two days before the current date
LocalDate endDate = currentDate.minusDays(2);
// Convert LocalDate to LocalDateTime to set time as 00:00:00
LocalDateTime startDateTime = startDate.atTime(0, 0, 0);
LocalDateTime endDateTime = endDate.atTime(23, 59, 59);
// Convert LocalDateTime to Timestamp
Timestamp startTimeStamp = Timestamp.valueOf(startDateTime);
Timestamp endTimeStamp = Timestamp.valueOf(endDateTime);

// application properties will have a config date variable.
logger.info("startDate: " + startDate);
logger.info("endDate: " + endDate);
List<BeneficiaryCall> list = callReportRepo.getAllBenCallIDetails(startDate, endDate);
logger.info("startDate: " + startTimeStamp);
logger.info("endDate: " + endTimeStamp);
List<BeneficiaryCall> list = callReportRepo.getAllBenCallIDetails(startTimeStamp, endTimeStamp);

if (!list.isEmpty()) {

Expand Down
Loading