From 185161747aa1588d400257ce87aebf74d4d7a333 Mon Sep 17 00:00:00 2001 From: Mandar-Beehyv Date: Tue, 10 Dec 2024 18:39:11 +0530 Subject: [PATCH 1/2] adding fields for telemarketerId and messagetype. --- .../beehyv/nmsreporting/business/SmsService.java | 2 +- .../business/impl/CertificateServiceImpl.java | 6 +++--- .../nmsreporting/business/impl/SmsServiceImpl.java | 14 +++++++++----- .../java/com/beehyv/nmsreporting/utils/Global.java | 8 ++++++++ .../src/main/resources/sms.properties | 3 +++ .../src/main/resources/smsTemplate.json | 6 +++++- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/SmsService.java b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/SmsService.java index b690326c..c21cd534 100644 --- a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/SmsService.java +++ b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/SmsService.java @@ -9,5 +9,5 @@ public interface SmsService { String buildCertificateSMS(CourseCompletionDTO courseCompletionDTO, String message_content); - String buildOTPSMS(MACourseFirstCompletion maCourseFirstCompletion, String message_content); + String buildOTPSMS(MACourseFirstCompletion maCourseFirstCompletion, String message_content, long languageId); } diff --git a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/CertificateServiceImpl.java b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/CertificateServiceImpl.java index 89e0a69a..9e2d930a 100644 --- a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/CertificateServiceImpl.java +++ b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/CertificateServiceImpl.java @@ -425,7 +425,7 @@ public String generateOTPForAshaCertificate(Long mobileNo) throws Exception { String messageContent = buildOTPMessage(languageId, otp); MACourseCompletion maCourseCompletion = maCourseCompletionDao.getAshaByFLWId(maCourseFirstCompletion.getFlwId()); - return sendOTPMessage(maCourseCompletion, maCourseFirstCompletion, messageContent); + return sendOTPMessage(maCourseCompletion, maCourseFirstCompletion, messageContent, languageId); } private int generateRandomSixDigitOTP() { @@ -450,8 +450,8 @@ private String buildOTPMessage(long languageId, int otp) { return messageTemplate.replace("", String.valueOf(otp)); } - private String sendOTPMessage(MACourseCompletion maCourseCompletion, MACourseFirstCompletion maCourseFirstCompletion, String messageContent) { - String template = smsService.buildOTPSMS(maCourseFirstCompletion, messageContent); + private String sendOTPMessage(MACourseCompletion maCourseCompletion, MACourseFirstCompletion maCourseFirstCompletion, String messageContent, long languageId) { + String template = smsService.buildOTPSMS(maCourseFirstCompletion, messageContent, languageId); logger.info("SMS Template: {}", template); return smsService.sendSms(maCourseCompletion, template); } diff --git a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/SmsServiceImpl.java b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/SmsServiceImpl.java index 6f612ea8..76d20e2a 100644 --- a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/SmsServiceImpl.java +++ b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/business/impl/SmsServiceImpl.java @@ -19,8 +19,8 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Service; -import java.io.File; -import java.io.IOException; +import java.io.*; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -149,6 +149,7 @@ public String buildCertificateSMS(CourseCompletionDTO courseCompletionDTO, Strin // Replace placeholders in the template try { + String messageType = retrieveAshaCourseCompletionMessageType(courseCompletionDTO.getLanguageId()); template = template .replace("", String.valueOf(phoneNo)) .replace("", senderId) @@ -156,7 +157,8 @@ public String buildCertificateSMS(CourseCompletionDTO courseCompletionDTO, Strin .replace("", callbackEndpoint) .replace("", sms_template_id) .replace("", sms_entity_id) - .replace("", sms_telemarketer_id); + .replace("", sms_telemarketer_id) + .replace("", messageType); } catch (Exception e) { LOGGER.error("Error replacing placeholders in SMS template", e); return null; @@ -165,7 +167,7 @@ public String buildCertificateSMS(CourseCompletionDTO courseCompletionDTO, Strin return template; } - public String buildOTPSMS(MACourseFirstCompletion maCourseFirstCompletion, String messageContent) { + public String buildOTPSMS(MACourseFirstCompletion maCourseFirstCompletion, String messageContent, long languageId) { long phoneNumber; String template = null; @@ -196,13 +198,15 @@ public String buildOTPSMS(MACourseFirstCompletion maCourseFirstCompletion, Strin // Populate SMS template try { String callbackEndpoint = retrieveAshaSMSCallBackEndPoint("OTP"); + String messageType = retrieveAshaCourseCompletionMessageType(languageId); template = template.replace("", String.valueOf(phoneNumber)) .replace("", senderId) .replace("", messageContent) .replace("", callbackEndpoint) .replace("", sms_template_id) .replace("", sms_entity_id) - .replace("", sms_telemarketer_id); + .replace("", sms_telemarketer_id) + .replace("", messageType); } catch (Exception e) { LOGGER.error("Error populating SMS template.", e); return null; diff --git a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/utils/Global.java b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/utils/Global.java index e6e6409c..9086015b 100644 --- a/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/utils/Global.java +++ b/NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/utils/Global.java @@ -212,6 +212,14 @@ public static String retrieveAshaCourseCompletionOTPMessage(long languageId) { return message; } + public static String retrieveAshaCourseCompletionMessageType(long languageId) { + String message = getProperty("sms.asha.default.message.type." + languageId); + if (message == null) { + message = getProperty("sms.asha.default.message.type"); + } + return message; + } + public static String retrieveAshaCertificateDownloadPageUrl() { return getProperty("sms.asha.certificate.download.url"); } diff --git a/NMSReportingSuite/src/main/resources/sms.properties b/NMSReportingSuite/src/main/resources/sms.properties index 0ab896c5..34931b1d 100644 --- a/NMSReportingSuite/src/main/resources/sms.properties +++ b/NMSReportingSuite/src/main/resources/sms.properties @@ -21,6 +21,9 @@ sms.asha.default.message.10=Avinandan didi, aapana Mobile Akademy korse sampurna sms.asha.default.message.12=Abhinandan Baideu, apuni Mobile Academy r coursetu sampurna korile. Etia certificate paboloi ei SMS to aponalokar subcentreor meetingot dekhaok. No. \nMoHFW-KMA sms.asha.default.message.5=Obhinandan Didi! Apni safolyer songe mobile academir training course ti sompurno korechen. Ekhon certificate pawar jonno apnake ei SMS ti sub centre meeting e dyakhate hobe. ( SMS system Dara toiri kora reference sonkhya) \nMoHFW-KMA +sms.asha.default.message.type=0 +sms.asha.default.message.type.14=4 + ## OTP lifespan in seconds to download the certificate otplifespan=172800 diff --git a/NMSReportingSuite/src/main/resources/smsTemplate.json b/NMSReportingSuite/src/main/resources/smsTemplate.json index 5dd82ead..e0e347f6 100644 --- a/NMSReportingSuite/src/main/resources/smsTemplate.json +++ b/NMSReportingSuite/src/main/resources/smsTemplate.json @@ -8,11 +8,15 @@ "message": "" }, "clientCorrelator": "", + "messageType": "", "receiptRequest": { "notifyURL": "", "callbackData": "" }, "senderName": "", - "category": "" + "category": "", + "templateId": "", + "entityId": "", + "telemarketerId": "" } } \ No newline at end of file From 4e6571c587b7a0b459e047540772c95e9eb26ba4 Mon Sep 17 00:00:00 2001 From: "dinesh.c" Date: Fri, 20 Dec 2024 15:58:39 +0530 Subject: [PATCH 2/2] Added condition to disable rejection reports for atate all --- app/scripts/controllers/reports.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/controllers/reports.js b/app/scripts/controllers/reports.js index 233c5de4..80f65331 100644 --- a/app/scripts/controllers/reports.js +++ b/app/scripts/controllers/reports.js @@ -1232,7 +1232,7 @@ if(!$scope.isCircleReport() ){ - if(!$scope.isAggregateReport()) + if(!$scope.isAggregateReport() || ( $scope.report && $scope.report.name.toLowerCase().indexOf(("rejected").toLowerCase()) > -1 ) ) { if($scope.state != null){ reportRequest.stateId = $scope.state.stateId;