Skip to content

Commit

Permalink
CTI-datasync scheduler changes (#103)
Browse files Browse the repository at this point in the history
* Added limit condition while fetching Item stock entry details in eaushadha API

* Minor modifications in 1097 referral sms template

* Added institute name along with referral SMS

* Removed myapp propeties and minor change in interceptor.

* Change in Phone No comparison while fetching call audit details

* Corrected empty array response in JsonObject - editBenCommunity

* Reverted - update community education changes

* Added cti data sync scheduler execution time change and start date and end date change for last two days

* Added cti data sync scheduler execution time change and start date and end date change for last two days

* Added cti data sync scheduler execution time

* Removed commented code

---------

Co-authored-by: Devika <[email protected]>
  • Loading branch information
devikasuresh20 and Devika authored Apr 23, 2024
1 parent 888f239 commit 39f683b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
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,24 +88,29 @@ 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());


// 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()) {

// List<Long> benList = new ArrayList<>();

String callDuartion = null;
String filePath = null;
String URL = null;
Expand All @@ -119,22 +126,14 @@ public void ctiDataSync() {
JSONObject requestFile = new JSONObject();
requestFile.put("agent_id", call.getAgentID());
requestFile.put("session_id", call.getCallID());
// OutputResponse response1 = ctiService.getVoiceFile(requestFile.toString(), "extra parameter");
// if (response1.getStatusCode() == OutputResponse.SUCCESS) {
// CTIVoiceFile getVoiceFile = InputMapper.gson().fromJson(response1.getData(),
// CTIVoiceFile.class);
// String recordingFilePath = getVoiceFile.getPath() + "/" + getVoiceFile.getFilename();
//// beneficiaryCallRepository.updateVoiceFilePathNew(benificiaryCall.getAgentID(),
//// benificiaryCall.getCallID(), recordingFilePath, null);
// recordingPath = ctiLoggerURL + "/" + recordingFilePath;

OutputResponse response1 = ctiService.getVoiceFileNew(requestFile.toString(), "extra parameter");
if(response1 != null && response1.getStatusCode() == 200) {

CTIResponse ctiResponsePath = InputMapper.gson().fromJson(response1.getData(),
CTIResponse.class);
String recordingFilePath = ctiResponsePath.getResponse().toString();
// beneficiaryCallRepository.updateVoiceFilePathNew(call.getAgentID(),
// call.getCallID(), recordingFilePath.substring(20), null);

if(recordingFilePath.length() > 20)
recordingPath = recordingFilePath.substring(20);
logger.info("recordingPath: " + recordingPath);
Expand Down

0 comments on commit 39f683b

Please sign in to comment.