Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
68bb080
Added limit condition while fetching Item stock entry details in eaus…
Dec 20, 2023
f52bb5a
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Dec 21, 2023
1b34f6a
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Jan 25, 2024
d4b8ae2
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Jan 30, 2024
7afc342
Minor modifications in 1097 referral sms template
Jan 30, 2024
593728d
Added institute name along with referral SMS
Jan 31, 2024
98ddb98
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Feb 16, 2024
0ad1dd7
Removed myapp propeties and minor change in interceptor.
Feb 16, 2024
d7e4511
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Mar 12, 2024
6cfbb83
Change in Phone No comparison while fetching call audit details
Mar 21, 2024
acdb35f
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Apr 8, 2024
9a499da
Corrected empty array response in JsonObject - editBenCommunity
Apr 8, 2024
2dac92f
Reverted - update community education changes
Apr 9, 2024
7224a04
Added cti data sync scheduler execution time change and start date an…
Apr 15, 2024
c3f5ccc
Merge branch 'PSMRI:develop' into develop
devikasuresh20 Apr 15, 2024
436c8d2
Merge branch 'develop' of https://github.com/devikasuresh20/Common-AP…
Apr 15, 2024
b213107
Added cti data sync scheduler execution time change and start date an…
Apr 15, 2024
b1a34da
Added cti data sync scheduler execution time
Apr 16, 2024
32fcecc
Removed commented code
Apr 18, 2024
efb0c7a
Merge branch 'PSMRI:develop' into develop
devikasuresh20 May 29, 2024
9042df0
cti-datacheck changes - calltype Id updation if it's null
May 30, 2024
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
1 change: 1 addition & 0 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.driver-class-name=com.mysql.jdbc.Drive

encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

import org.apache.xml.security.stax.config.ConfigurationProperties;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -17,6 +21,7 @@

import com.iemr.common.data.callhandling.BeneficiaryCall;
import com.iemr.common.data.nhm_dashboard.DetailedCallReport;
import com.iemr.common.repository.callhandling.IEMRCalltypeRepositoryImplCustom;
import com.iemr.common.repository.nhm_dashboard.DetailedCallReportRepo;
import com.iemr.common.repository.report.CallReportRepo;
import com.iemr.common.utils.config.ConfigProperties;
Expand All @@ -31,12 +36,14 @@ public class NHMDetailCallReportScheduler {
@Autowired
private CallReportRepo callReportRepo;

@Autowired
private IEMRCalltypeRepositoryImplCustom iEMRCalltypeRepositoryImplCustom;

Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@Value("${start-ctidatacheck-scheduler}")
private boolean startCtiDataCheckFlag;


@Scheduled(cron = "${cron-scheduler-ctidatacheck}")
public void detailedCallReport() {
if (startCtiDataCheckFlag) {
Expand All @@ -48,7 +55,7 @@ public void detailedCallReport() {
String[] dateArr = date.toString().split("T");
endDate = dateArr[0].concat(" 23:59:59");
fromDate = dateArr[0].concat(" 00:00:01");

Timestamp fromTime = Timestamp.valueOf(fromDate);
Timestamp endTime = Timestamp.valueOf(endDate);
logger.info("Call detailed report check request - FromTime -" + fromTime + "Endtime - " + endTime);
Expand All @@ -57,19 +64,52 @@ public void detailedCallReport() {
for (DetailedCallReport detailedCallReport : findByCallStartTimeBetween) {
String phoneNo = detailedCallReport.getPHONE();
String sessionID = detailedCallReport.getSession_ID();
int existRecord = callReportRepo.getBenCallDetailsBySessionIDAndPhone(sessionID, phoneNo);
if (existRecord != 0) {
BeneficiaryCall existRecord = callReportRepo.getBenCallDetailsBySessionIDAndPhone(sessionID,phoneNo);
if (existRecord != null) {
logger.info("Record already present in t_bencall table with sessionID : " + sessionID
+ " phoneNo : " + phoneNo);
logger.info("Existing record from t_bencall: " + existRecord);
if (null != detailedCallReport.getOrientation_Type()
&& detailedCallReport.getOrientation_Type().equalsIgnoreCase("OUTBOUND")) {
callReportRepo.updateIsOutboundForCall(true, sessionID, phoneNo );

if(existRecord.getCallTypeID() == null) {
logger.info("Called Service Id: " + existRecord.getCalledServiceID());
// Fetching callTypeId
Integer callTypeId = getCallTypeId(true, existRecord.getCalledServiceID(),
detailedCallReport);

logger.info("CallTypeId after comparison: " + callTypeId);
if (callTypeId != null) {
callReportRepo.updateIsOutboundForCallWithCallType(true, sessionID, phoneNo,callTypeId);
} else {
callReportRepo.updateIsOutboundForCall(true, sessionID, phoneNo);
}
}
else {
callReportRepo.updateIsOutboundForCall(true, sessionID, phoneNo);
}
} else {
callReportRepo.updateIsOutboundForCall(false, sessionID, phoneNo );
if(existRecord.getCallTypeID() == null) {

logger.info("Called Service Id: " + existRecord.getCalledServiceID());
// Fetching callTypeId
Integer callTypeId = getCallTypeId(false, existRecord.getCalledServiceID(),
detailedCallReport);

logger.info("CallTypeId after comparison: " + callTypeId);
if (callTypeId != null) {
callReportRepo.updateIsOutboundForCallWithCallType(false, sessionID, phoneNo, callTypeId);
} else {
callReportRepo.updateIsOutboundForCall(false, sessionID, phoneNo);
}

}
else {
callReportRepo.updateIsOutboundForCall(false, sessionID, phoneNo);
}
}
} else {
logger.info("Record missed in t_bencall table with sessionID : " + sessionID + " phoneNo : "
+ phoneNo);
logger.info("Record missed in t_bencall table with sessionID : " + sessionID + " phoneNo : " + phoneNo);
BeneficiaryCall callDetail = getCallDetail(detailedCallReport);
callReportRepo.save(callDetail);
}
Expand All @@ -82,6 +122,36 @@ public void detailedCallReport() {

}

private Integer getCallTypeId(Boolean isOutbound, Integer calledServiceId, DetailedCallReport detailedCallReport) {
Set<Objects[]> callTypesArray = new HashSet<Objects[]>();

if (detailedCallReport.getAgent_Disposition_Category() != null
&& detailedCallReport.getAgent_Disposition() != null) {
if (isOutbound == true) {
callTypesArray = iEMRCalltypeRepositoryImplCustom.getOutboundCallTypes(calledServiceId, true);
} else {
callTypesArray = iEMRCalltypeRepositoryImplCustom.getInboundCallTypes(calledServiceId, true);
}

for (Object[] object : callTypesArray) {
String callGroupType = (String) object[3];
String callType = (String) object[0];
String detailedCallGroupType = detailedCallReport.getAgent_Disposition_Category().replace("_", " ");
String detailedCallType = detailedCallReport.getAgent_Disposition().replace("_", " ");
logger.info("Detailed Call - CallGroupType: " + detailedCallGroupType);
logger.info("Detailed Call - CallType: " + detailedCallType);

if (callGroupType.equalsIgnoreCase(detailedCallGroupType)
&& callType.equalsIgnoreCase(detailedCallType)) {
return (Integer) object[1];
}
}
}

return null;

}

private BeneficiaryCall getCallDetail(DetailedCallReport detailedCallReport) {
BeneficiaryCall beneficiaryCall = new BeneficiaryCall();
beneficiaryCall.setCallID(detailedCallReport.getSession_ID());
Expand All @@ -104,7 +174,8 @@ private BeneficiaryCall getCallDetail(DetailedCallReport detailedCallReport) {
beneficiaryCall.setCreatedBy("Admin");

beneficiaryCall.setCallDuration(String.valueOf(detailedCallReport.getCall_Duration()));



return beneficiaryCall;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ public interface CallReportRepo extends CrudRepository<BeneficiaryCall, Integer>
+ "and report.createdDate >= :startDate and report.createdDate <= :endDate ")
public List<BeneficiaryCall> getAllBenCallIDetails(@Param("startDate") Timestamp startDate, @Param("endDate") Timestamp endDate);//start date and end date as param for x days.

@Query("SELECT COUNT(*) FROM BeneficiaryCall call WHERE call.callID = :sessionID and call.phoneNo = :phoneNo")
public int getBenCallDetailsBySessionIDAndPhone(@Param("sessionID") String sessionID,@Param("phoneNo") String phoneNo);
@Query("SELECT call FROM BeneficiaryCall call WHERE call.callID = :sessionID and call.phoneNo = :phoneNo")
public BeneficiaryCall getBenCallDetailsBySessionIDAndPhone(@Param("sessionID") String sessionID,@Param("phoneNo") String phoneNo);

@Transactional
@Modifying
@Query("update BeneficiaryCall set isOutbound= :isOutbound where callID = :callID and phoneNo= :phoneNo")
public int updateIsOutboundForCall(@Param("isOutbound") boolean isOutbound, @Param("callID") String callID, @Param("phoneNo") String phoneNo );

@Transactional
@Modifying
@Query("update BeneficiaryCall set isOutbound= :isOutbound, callTypeID= :callTypeID where callID = :callID and phoneNo= :phoneNo")
public int updateIsOutboundForCallWithCallType(@Param("isOutbound") boolean isOutbound, @Param("callID") String callID, @Param("phoneNo") String phoneNo, @Param("callTypeID") Integer callTypeID );
}