From 482d8a577d9aad9774e1398c0a0dcefd3412ee5c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 7 Mar 2024 15:58:31 +0530 Subject: [PATCH] PFM-5810 added flag isSMSForUserCreationEnable at time of sending sms to users. --- .../java/org/egov/hrms/config/PropertiesManager.java | 3 +++ .../org/egov/hrms/service/NotificationService.java | 10 ++++++++-- .../src/main/resources/application.properties | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java index 720644512..3b04dd0f8 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java @@ -114,4 +114,7 @@ public class PropertiesManager { @Value("${state.level.tenant.id}") public String stateLevelTenantId; + + @Value("${sms.user.creation.enabled}") + public boolean isSMSForUserCreationEnable; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index 03757ab8f..9285e191b 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.config.PropertiesManager; import org.egov.hrms.model.Employee; import org.egov.hrms.model.SMSRequest; import org.egov.hrms.producer.HRMSProducer; @@ -35,6 +36,9 @@ public class NotificationService { @Autowired private RestTemplate restTemplate; + @Autowired + private PropertiesManager propertiesManager; + @Value("${kafka.topics.notification.sms}") private String smsTopic; @@ -57,7 +61,6 @@ public class NotificationService { private String envHost; - /** * Sends notification by putting the sms content onto the core-sms topic * @@ -73,7 +76,10 @@ public void sendNotification(EmployeeRequest request, Map pwdMap for(Employee employee: request.getEmployees()) { message = buildMessage(employee, message, pwdMap); SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).tenantId(employee.getTenantId()).build(); - producer.push(smsTopic, smsRequest); + if(propertiesManager.isSMSForUserCreationEnable()) + { + producer.push(smsTopic, smsRequest); + } } } diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 92fec5b97..bbeb4a68a 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -102,4 +102,5 @@ logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.S log4j.logger.org.springframework.jdbc.core = TRACE -state.level.tenant.id=pb \ No newline at end of file +state.level.tenant.id=pb +sms.user.creation.enabled=true \ No newline at end of file