From 444eaee351b78277cce6615a6b38d6c5f042bc16 Mon Sep 17 00:00:00 2001 From: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:56:41 +0530 Subject: [PATCH 1/3] Cherry-pick health and version API enhancements to release-3.6.1 (#124) * feat(health,version): add health and version endponts * fix(health): add constant and remove duplicates * fix(health): avoid permanent DEGRADED from historical deadlocks * fix(health): Removed the unnecessary boolean literal * fix(health): Fixed the broken lock-wait detection * fix(health): avoid blocking DB I/O under write lock and restore interrupt flag * fix(health): add cancelFutures in healthservice * fix(health): close basic DB connection before advanced checks and remove shared-map race --- .../iemr/admin/controller/version/VersionController.java | 6 ++++++ .../com/iemr/admin/utils/JwtUserIdValidationFilter.java | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/iemr/admin/controller/version/VersionController.java b/src/main/java/com/iemr/admin/controller/version/VersionController.java index 67f7c74..353fc77 100644 --- a/src/main/java/com/iemr/admin/controller/version/VersionController.java +++ b/src/main/java/com/iemr/admin/controller/version/VersionController.java @@ -19,6 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ + package com.iemr.admin.controller.version; import java.util.Map; @@ -33,6 +34,11 @@ import com.iemr.admin.service.version.VersionService; import io.swagger.v3.oas.annotations.Operation; +import java.io.IOException; +import java.io.InputStream; +import java.util.LinkedHashMap; +import java.util.Properties; +import org.springframework.http.MediaType; @RestController public class VersionController { diff --git a/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java b/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java index 14a295d..f82b98b 100644 --- a/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java +++ b/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java @@ -19,6 +19,9 @@ public class JwtUserIdValidationFilter implements Filter { + private static final String HEALTH_ENDPOINT = "/health"; + private static final String VERSION_ENDPOINT = "/version"; + private final JwtAuthenticationUtil jwtAuthenticationUtil; private final Logger logger = LoggerFactory.getLogger(this.getClass().getName()); private final String allowedOrigins; @@ -98,7 +101,9 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo || path.startsWith(contextPath + "/swagger-ui") || path.startsWith(contextPath + "/v3/api-docs") || path.startsWith(contextPath + "/user/refreshToken") - || path.startsWith(contextPath + "/public")) { + || path.startsWith(contextPath + "/public") + || path.equals(contextPath + HEALTH_ENDPOINT) + || path.equals(contextPath + VERSION_ENDPOINT)) { logger.info("Skipping filter for path: " + path); filterChain.doFilter(servletRequest, servletResponse); return; From 95cfb5cf124d108de61063cc43024bdf24b24243 Mon Sep 17 00:00:00 2001 From: Varun Deep Saini Date: Wed, 15 Apr 2026 18:37:42 +0530 Subject: [PATCH 2/3] feat: expose account lock state in SearchEmployee4 (#129) Co-authored-by: Varun Deep Saini --- .../admin/data/employeemaster/M_User1.java | 11 ++++++ .../admin/data/employeemaster/V_Showuser.java | 36 +++++++++++++++++++ .../employeemaster/EmployeeMasterRepoo.java | 3 ++ .../EmployeeMasterServiceImpl.java | 31 +++++++++++++++- 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/iemr/admin/data/employeemaster/M_User1.java b/src/main/java/com/iemr/admin/data/employeemaster/M_User1.java index 1c319a8..164e2d6 100644 --- a/src/main/java/com/iemr/admin/data/employeemaster/M_User1.java +++ b/src/main/java/com/iemr/admin/data/employeemaster/M_User1.java @@ -231,6 +231,9 @@ public void setSignatureStatus(String signatureStatus) { @Expose @Column(name = "failed_attempt", insertable = false) private Integer failedAttempt; + @Expose + @Column(name = "lock_timestamp", insertable = false) + private Timestamp lockTimestamp; public M_User1() { // TODO Auto-generated constructor stub } @@ -251,6 +254,14 @@ public void setFailedAttempt(Integer failedAttempt) { this.failedAttempt = failedAttempt; } + public Timestamp getLockTimestamp() { + return lockTimestamp; + } + + public void setLockTimestamp(Timestamp lockTimestamp) { + this.lockTimestamp = lockTimestamp; + } + public Integer getUserID() { return userID; } diff --git a/src/main/java/com/iemr/admin/data/employeemaster/V_Showuser.java b/src/main/java/com/iemr/admin/data/employeemaster/V_Showuser.java index 6efd2e5..bafbf8c 100644 --- a/src/main/java/com/iemr/admin/data/employeemaster/V_Showuser.java +++ b/src/main/java/com/iemr/admin/data/employeemaster/V_Showuser.java @@ -246,6 +246,18 @@ public class V_Showuser { @Column(name="DistrictID") private Integer districtID; + @Expose + @Transient + private Integer failedAttempt; + + @Expose + @Transient + private Timestamp lockTimestamp; + + @Expose + @Transient + private Boolean lockedDueToFailedAttempts; + @@ -922,6 +934,30 @@ public void setDistrictID(Integer districtID) { this.districtID = districtID; } + public Integer getFailedAttempt() { + return failedAttempt; + } + + public void setFailedAttempt(Integer failedAttempt) { + this.failedAttempt = failedAttempt; + } + + public Timestamp getLockTimestamp() { + return lockTimestamp; + } + + public void setLockTimestamp(Timestamp lockTimestamp) { + this.lockTimestamp = lockTimestamp; + } + + public Boolean getLockedDueToFailedAttempts() { + return lockedDueToFailedAttempts; + } + + public void setLockedDueToFailedAttempts(Boolean lockedDueToFailedAttempts) { + this.lockedDueToFailedAttempts = lockedDueToFailedAttempts; + } + diff --git a/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepoo.java b/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepoo.java index 3c90c81..e2b017a 100644 --- a/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepoo.java +++ b/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepoo.java @@ -22,6 +22,7 @@ package com.iemr.admin.repo.employeemaster; import java.util.ArrayList; +import java.util.List; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; @@ -87,4 +88,6 @@ M_User1 checkingEmpDetails(@Param("userName") String userName, @Param("aadhaarNo ArrayList getempByDesiganation(@Param("designationID") Integer designationID,@Param("serviceProviderID") Integer serviceProviderID); M_User1 findByUserID(Integer userID); + + List findByUserIDIn(List userIDs); } diff --git a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java index ecf1106..02b6633 100644 --- a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java @@ -25,6 +25,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -1307,8 +1308,36 @@ public ArrayList getAllCommunity() { @Override public ArrayList getEmployeeDetails4(Integer serviceProviderID) { + ArrayList users = v_ShowuserRepo.EmployeeDetails4(serviceProviderID); + if (users.isEmpty()) { + return users; + } + + ArrayList userIDs = new ArrayList(users.size()); + for (V_Showuser user : users) { + userIDs.add(user.getUserID()); + } + + Map userRecords = new HashMap(); + for (M_User1 userRecord : employeeMasterRepoo.findByUserIDIn(userIDs)) { + userRecords.put(userRecord.getUserID(), userRecord); + } + + for (V_Showuser user : users) { + enrichAccountLockState(user, userRecords.get(user.getUserID())); + } + return users; + } + + private void enrichAccountLockState(V_Showuser user, M_User1 userRecord) { + if (userRecord == null) { + return; + } - return v_ShowuserRepo.EmployeeDetails4(serviceProviderID); + Timestamp lockTimestamp = userRecord.getLockTimestamp(); + user.setFailedAttempt(userRecord.getFailedAttempt() != null ? userRecord.getFailedAttempt() : 0); + user.setLockTimestamp(lockTimestamp); + user.setLockedDueToFailedAttempts(Boolean.TRUE.equals(userRecord.getDeleted()) && lockTimestamp != null); } @Override From 15206a5b4b9fe9409437e674fe1de28a9c968677 Mon Sep 17 00:00:00 2001 From: Vanitha S <116701245+vanitha1822@users.noreply.github.com> Date: Tue, 5 May 2026 12:23:14 +0530 Subject: [PATCH 3/3] Fix the reset password issue (#131) * fix: reset password * fix: build issue * fix: update the url * fix: update config properties * fix: initialize constructor --- .../EmployeeMasterServiceImpl.java | 14 +++++++--- .../EncryptUserPassword123.java | 23 +++++++++++++--- .../service/user/EncryptUserPassword.java | 26 ++++++++++++++++--- .../admin/utils/config/ConfigProperties.java | 24 ++++++++++++++--- 4 files changed, 73 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java index 02b6633..f4c07f3 100644 --- a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java @@ -45,6 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; @@ -118,7 +119,10 @@ public class EmployeeMasterServiceImpl implements EmployeeMasterInter { private static HttpUtils httpUtils = new HttpUtils(); - private String common_url = ConfigProperties.getPropertyByName("common-url"); + @Value("${common-url}") + private String common_url; + + // private String common_url = ConfigProperties.getPropertyByName("common-url"); private final String COMMON_BASE_URL = "common-url"; @@ -539,7 +543,7 @@ private Set getCTICampaignRoles(String campaignName, String authToken) t ObjectMapper objectMapper = new ObjectMapper(); Set resultSet = new HashSet(); HttpEntity request = RestTemplateUtil.createRequestEntity(campaignName, authToken); - String url = configProperties.getPropertyByName("common-url") + configProperties.getPropertyByName("create-feedback"); + String url = common_url +"/" + configProperties.getPropertyByName("create-feedback"); ResponseEntity responseStr = restTemplate.exchange(url, HttpMethod.POST, request, String.class); OutputResponse response = objectMapper.readValue(responseStr.getBody(), OutputResponse.class); @@ -782,7 +786,8 @@ public void createUserInCallCentre(M_User1 user, String authToken) { logger.info("EmployeeMasterServiceImpl.createUserInCallCentre - start"); if (ENABLE_CTI_USER_CREATION) { String UserCreateAPIURL = ""; - String ctiServer = configProperties.getPropertyByName("common-url"); + // String ctiServer = configProperties.getPropertyByName("common-url"); + String ctiServer=common_url; UserCreateAPIURL = ctiServer + configProperties.getPropertyByName("create-update-users-url"); HashMap headers = new HashMap(); JSONObject request = new JSONObject(); @@ -816,7 +821,8 @@ public void updateUserInCallCentre(String userName, String ctiRole, String authT if (ENABLE_CTI_USER_CREATION) { String UserCreateAPIURL = ""; - String ctiServer = configProperties.getPropertyByName("common-url"); + // String ctiServer = configProperties.getPropertyByName("common-url"); + String ctiServer=common_url; UserCreateAPIURL = ctiServer + configProperties.getPropertyByName("create-update-users-url"); HashMap headers = new HashMap(); JSONObject request = new JSONObject(); diff --git a/src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java b/src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java index 009842c..19ef749 100644 --- a/src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java +++ b/src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java @@ -24,6 +24,7 @@ import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -34,15 +35,31 @@ import com.iemr.admin.utils.mapper.InputMapper; import com.iemr.admin.utils.response.OutputResponse; +import jakarta.annotation.PostConstruct; + @Service public class EncryptUserPassword123 { private static HttpUtils utils = new HttpUtils(); - private static String commonBaseURL = ConfigProperties.getPropertyByName("common-url"); - private static String encryptPasswordURL = commonBaseURL - + ConfigProperties.getPropertyByName("encrypt-password-url"); + // private static String commonBaseURL = + // ConfigProperties.getPropertyByName("common-url"); + + @Value("${common-url}") + private String commonBaseURL; + + // private String encryptPasswordURL = commonBaseURL + "/" + // + ConfigProperties.getPropertyByName("encrypt-password-url"); private Logger logger = LoggerFactory.getLogger(this.getClass().getName()); + private String encryptPasswordURL; + + @PostConstruct + public void init() { + encryptPasswordURL = commonBaseURL + "/" + + ConfigProperties.getPropertyByName("encrypt-password-url"); + logger.info("commonBaseURL=" + encryptPasswordURL); + } + @Async public OutputResponse encryptUserCredentials(M_User data) { JSONObject request = new JSONObject(); diff --git a/src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java b/src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java index 14ff8cb..165120e 100644 --- a/src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java +++ b/src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java @@ -24,6 +24,7 @@ import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -33,15 +34,34 @@ import com.iemr.admin.utils.mapper.InputMapper; import com.iemr.admin.utils.response.OutputResponse; +import jakarta.annotation.PostConstruct; + @Service public class EncryptUserPassword { private static HttpUtils utils = new HttpUtils(); - private static String commonBaseURL = ConfigProperties.getPropertyByName("common-url"); - private static String encryptPasswordURL = commonBaseURL - + ConfigProperties.getPropertyByName("encrypt-password-url"); + + @Value("${common-url}") + private String commonBaseURL; + + // @Value("${encrypt-password-url}") + // private String encryptPasswordEndpoint; + + // private static String commonBaseURL = + // ConfigProperties.getPropertyByName("common-url"); + // private String encryptPasswordURL = commonBaseURL + "/" + + // ConfigProperties.getPropertyByName("encrypt-password-url"); private Logger logger = LoggerFactory.getLogger(this.getClass().getName()); + private String encryptPasswordURL; + + @PostConstruct + public void init() { + encryptPasswordURL = commonBaseURL + "/" + + ConfigProperties.getPropertyByName("encrypt-password-url"); + logger.info("commonBaseURL" + encryptPasswordURL); + } + @Async public OutputResponse encryptUserCredentials(M_User1 data) { JSONObject request = new JSONObject(); diff --git a/src/main/java/com/iemr/admin/utils/config/ConfigProperties.java b/src/main/java/com/iemr/admin/utils/config/ConfigProperties.java index 2aacef9..9fdb90f 100644 --- a/src/main/java/com/iemr/admin/utils/config/ConfigProperties.java +++ b/src/main/java/com/iemr/admin/utils/config/ConfigProperties.java @@ -118,11 +118,27 @@ public static int getSessionExpiryTime() { public static String getPropertyByName(String propertyName) { String result = null; try { - if (properties == null) { - initalizeProperties(); + // if (properties == null) { + // initalizeProperties(); + // } + // // result = environment.getProperty(propertyName); + // result = properties.getProperty(propertyName); + + if (environment != null) + { + result = environment.getProperty(propertyName); + } + if (result == null) + { + if (properties == null) + { + initalizeProperties(); + } + result = properties.getProperty(propertyName).trim(); + } else + { + result = result.trim(); } - // result = environment.getProperty(propertyName); - result = properties.getProperty(propertyName); } catch (Exception e) { logger.error(propertyName + " retrival failed.", e); }