diff --git a/.gitignore b/.gitignore index 39d476c4..c9a2255a 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,7 @@ mvnw.cmd # Properties src/main/environment/admin_local.properties -node_modules \ No newline at end of file +node_modules + +# Logs +logs/ \ No newline at end of file diff --git a/logs/admin-api.log.json b/logs/admin-api.log.json deleted file mode 100644 index fbb9ba97..00000000 --- a/logs/admin-api.log.json +++ /dev/null @@ -1,163 +0,0 @@ -{"@timestamp":"2025-06-17T03:30:48.217Z", "log.level": "INFO", "message":"Starting RoleMasterApplication using Java 17.0.15 with PID 46435 (/home/navadhiti/Documents/Amrit_Repo_original/final/Admin-API/target/classes started by navadhiti in /home/navadhiti/Documents/Amrit_Repo_original/final/Admin-API)", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.iemr.admin.RoleMasterApplication"} -{"@timestamp":"2025-06-17T03:30:48.218Z", "log.level":"DEBUG", "message":"Running with Spring Boot v3.2.2, Spring v6.1.3", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.iemr.admin.RoleMasterApplication"} -{"@timestamp":"2025-06-17T03:30:48.219Z", "log.level": "INFO", "message":"The following 1 profile is active: \"test\"", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.iemr.admin.RoleMasterApplication"} -{"@timestamp":"2025-06-17T03:30:48.261Z", "log.level": "INFO", "message":"Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor"} -{"@timestamp":"2025-06-17T03:30:48.262Z", "log.level": "INFO", "message":"For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor"} -{"@timestamp":"2025-06-17T03:30:49.095Z", "log.level": "INFO", "message":"Multiple Spring Data modules found, entering strict repository configuration mode", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:49.096Z", "log.level": "INFO", "message":"Bootstrapping Spring Data JPA repositories in DEFAULT mode.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:49.491Z", "log.level": "INFO", "message":"Finished Spring Data repository scanning in 388 ms. Found 119 JPA repository interfaces.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:49.518Z", "log.level": "INFO", "message":"Multiple Spring Data modules found, entering strict repository configuration mode", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:49.519Z", "log.level": "INFO", "message":"Bootstrapping Spring Data Redis repositories in DEFAULT mode.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:49.542Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.VanSpokeMappingRepo.VanSpokeMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.542Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.DrugStrangthRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.542Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.MProviderservicemappingBlockingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.MServiceproviderBlockingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.MStatusRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.M_ServicemasterForBlockingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.T_ProviderservicemappingdetailRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.T_ServiceproviderdetailRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.543Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.T_UserDetailRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.544Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.UserBlockingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.544Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.blocking.V_ShowproviderservicemappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.544Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.calibration.CalibrationAPIRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.544Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.calibration.CalibrationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.545Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.drugtype.DrugtypeRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.545Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.EmployeeMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.545Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.EmployeeMasterRepoo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.545Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.EmployeeSignatureRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.545Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_CommunityRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.546Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_DesignationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.546Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_GenderRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.546Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_LanguageRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.546Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_ProviderServiceMap1Repo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.546Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_QualificationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.547Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_ReligionRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.547Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_TitleRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.547Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_UserDemographicsRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.547Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.M_UserLangMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.RoleRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.Showofficedetails1Repo1; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.ShowuserdetailsfromuserservicerolemappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.USRAgentMappingRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.V_ShowuserRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.548Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.employeemaster.V_UserservicerolemappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.foetalmonitormaster.FoetalMonitorDeviceIDRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.foetalmonitormaster.FoetalMonitorRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.labmodule.ComponentMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.labmodule.ComponentResultMapRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.labmodule.IOTRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.549Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.labmodule.ProcedureComponentMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.labmodule.ProcedureMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.DistrictBlockRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.DistrictBranchMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.LocationMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.M_ProviderServiceAddMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.MdistrictRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.550Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.locationmaster.ShowofficedetailsRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.manufacturer.ManufacturerRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.pharmacologicalcategory.PharmacologicalcategoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.questionnaire.QuestionnaireRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.questionnaire.QuestionnaireValuesRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.stockEntry.ItemStockEntryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.stockEntry.PhysicalStockEntryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.551Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.stockExit.ItemStockExitRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.552Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.stockExit.PatientIssueRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.552Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.supplier.SupplierRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.552Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.telemedicine.SpecializationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.552Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.telemedicine.UserRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.552Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.telemedicine.UserSpecializationMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.553Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.telemedicine.UserVideoConsultationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.553Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.telemedicine.VideoConsultationDomainRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.553Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repo.uom.UomRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.553Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.emailconfig.InstituteEmailRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.553Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.facilitytype.M_facilitytypeRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.554Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.item.ItemCategoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.554Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.item.ItemFormRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.554Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.item.ItemRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.554Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.item.RouteRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.554Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.itemfacilitymapping.M_itemfacilitymappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.itemfacilitymapping.V_fetchItemFacilityMapRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.parkingPlace.ParkingPlaceRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.parkingPlace.ParkingPlaceTalukMappingRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.CalltypeRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.CategoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.555Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.DrugGroupRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.DrugMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.DrugMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.IemrServiceRepository1; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.InstuteDirectoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_FeedbacknatureRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_FeedbacktypeRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.556Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_InstitutedirectorymappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_InstitutesubdirectoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_InstitutionRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_InstitutiontypeRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_ProviderServiceMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_ServiceMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.557Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_SeverityRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.558Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_SubservicemasterPArepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.558Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.M_UserservicerolemappingForRoleRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.558Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.SubCategoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.558Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.SubserviceMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.558Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.V_ShowprovideradminRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.provideronboard.V_ShowsubcategoryRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.M_RoleRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.M_ScreenRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.M_UserservicerolemappingForRoleProviderAdminRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.RoleMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.RoleScreenMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.rolemaster.StateMasterRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.559Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.servicePoint.ServicePointRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.servicePoint.ServicePointVillageMapRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.snomedRepo.SnomedImmunizationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.snomedRepo.SnomedMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.snomedRepo.SnomedVaccinationRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.store.MainStoreRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.store.V_FetchFacilityRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.uptsu.CDSSMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.560Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.uptsu.FacilityRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.user.IemrUserRepositoryImplCustom; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.user.M_UserMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.user.UserLoginRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.userParkingPlaceMap.UserParkingPlaceMapRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.userParkingPlaceMap.UserVanMappingRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.vanMaster.VanMasterRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.561Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.vanServicePointMapping.VanServicePointMappingRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.562Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.vanType.VanTypeRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.562Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.villageMaster.VillageMasterRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.562Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.zonemaster.ZoneDistrictMappingRepo; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.562Z", "log.level": "INFO", "message":"Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.iemr.admin.repository.zonemaster.ZoneMasterRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"} -{"@timestamp":"2025-06-17T03:30:49.562Z", "log.level": "INFO", "message":"Finished Spring Data repository scanning in 35 ms. Found 0 Redis repository interfaces.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.repository.config.RepositoryConfigurationDelegate"} -{"@timestamp":"2025-06-17T03:30:50.339Z", "log.level": "INFO", "message":"Tomcat initialized with port 8082 (http)", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.web.embedded.tomcat.TomcatWebServer"} -{"@timestamp":"2025-06-17T03:30:50.350Z", "log.level": "INFO", "message":"Starting service [Tomcat]", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.apache.catalina.core.StandardService"} -{"@timestamp":"2025-06-17T03:30:50.351Z", "log.level": "INFO", "message":"Starting Servlet engine: [Apache Tomcat/10.1.18]", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.apache.catalina.core.StandardEngine"} -{"@timestamp":"2025-06-17T03:30:50.402Z", "log.level": "INFO", "message":"Initializing Spring embedded WebApplicationContext", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]"} -{"@timestamp":"2025-06-17T03:30:50.403Z", "log.level": "INFO", "message":"Root WebApplicationContext: initialization completed in 2140 ms", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext"} -{"@timestamp":"2025-06-17T03:30:50.769Z", "log.level": "INFO", "message":"HHH000204: Processing PersistenceUnitInfo [name: default]", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.hibernate.jpa.internal.util.LogHelper"} -{"@timestamp":"2025-06-17T03:30:50.811Z", "log.level": "INFO", "message":"HHH000412: Hibernate ORM core version 6.4.1.Final", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.hibernate.Version"} -{"@timestamp":"2025-06-17T03:30:50.840Z", "log.level": "INFO", "message":"HHH000026: Second-level cache disabled", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.hibernate.cache.internal.RegionFactoryInitiator"} -{"@timestamp":"2025-06-17T03:30:51.015Z", "log.level": "INFO", "message":"No LoadTimeWeaver setup: ignoring JPA class transformer", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo"} -{"@timestamp":"2025-06-17T03:30:51.034Z", "log.level": "INFO", "message":"HikariPool-1 - Starting...", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.zaxxer.hikari.HikariDataSource"} -{"@timestamp":"2025-06-17T03:30:51.242Z", "log.level": "INFO", "message":"HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@23feca34", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.zaxxer.hikari.pool.HikariPool"} -{"@timestamp":"2025-06-17T03:30:51.242Z", "log.level": "INFO", "message":"HikariPool-1 - Start completed.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.zaxxer.hikari.HikariDataSource"} -{"@timestamp":"2025-06-17T03:30:51.284Z", "log.level": "WARN", "message":"HHH90000025: MySQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.hibernate.orm.deprecation"} -{"@timestamp":"2025-06-17T03:30:53.490Z", "log.level": "INFO", "message":"HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator"} -{"@timestamp":"2025-06-17T03:30:53.492Z", "log.level": "INFO", "message":"Initialized JPA EntityManagerFactory for persistence unit 'default'", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"} -{"@timestamp":"2025-06-17T03:30:53.663Z", "log.level": "INFO", "message":"Hibernate is in classpath; If applicable, HQL parser will be used.", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.data.jpa.repository.query.QueryEnhancerFactory"} -{"@timestamp":"2025-06-17T03:30:54.761Z", "log.level": "INFO", "message":"Autowired annotation is not supported on static fields: private static java.lang.Boolean com.iemr.admin.utils.config.ConfigProperties.extendExpiryTime", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"} -{"@timestamp":"2025-06-17T03:30:54.762Z", "log.level": "INFO", "message":"Autowired annotation is not supported on static fields: private static java.lang.Integer com.iemr.admin.utils.config.ConfigProperties.sessionExpiryTime", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"} -{"@timestamp":"2025-06-17T03:30:54.762Z", "log.level": "INFO", "message":"Autowired annotation is not supported on static fields: private static java.lang.String com.iemr.admin.utils.config.ConfigProperties.redisurl", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"} -{"@timestamp":"2025-06-17T03:30:54.762Z", "log.level": "INFO", "message":"Autowired annotation is not supported on static fields: private static java.lang.Integer com.iemr.admin.utils.config.ConfigProperties.redisport", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"} -{"@timestamp":"2025-06-17T03:30:56.178Z", "log.level": "WARN", "message":"spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration"} -{"@timestamp":"2025-06-17T03:30:56.680Z", "log.level": "INFO", "message":"LiveReload server is running on port 35729", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.devtools.autoconfigure.OptionalLiveReloadServer"} -{"@timestamp":"2025-06-17T03:30:56.712Z", "log.level": "INFO", "message":"Tomcat started on port 8082 (http) with context path ''", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.web.embedded.tomcat.TomcatWebServer"} -{"@timestamp":"2025-06-17T03:30:56.722Z", "log.level": "INFO", "message":"Started RoleMasterApplication in 9.035 seconds (process running for 9.391)", "ecs.version": "1.2.0","process.thread.name":"restartedMain","log.logger":"com.iemr.admin.RoleMasterApplication"} -{"@timestamp":"2025-06-17T03:33:01.594Z", "log.level": "INFO", "message":"Initializing Spring DispatcherServlet 'dispatcherServlet'", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-1","log.logger":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]"} -{"@timestamp":"2025-06-17T03:33:01.594Z", "log.level": "INFO", "message":"Initializing Servlet 'dispatcherServlet'", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-1","log.logger":"org.springframework.web.servlet.DispatcherServlet"} -{"@timestamp":"2025-06-17T03:33:01.596Z", "log.level": "INFO", "message":"Completed initialization in 1 ms", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-1","log.logger":"org.springframework.web.servlet.DispatcherServlet"} -{"@timestamp":"2025-06-17T03:33:01.598Z", "log.level": "INFO", "message":"OPTIONS request - skipping JWT validation", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-1","log.logger":"com.iemr.admin.utils.JwtUserIdValidationFilter"} -{"@timestamp":"2025-06-17T03:33:14.017Z", "log.level": "WARN", "message":"Origin [http://localhost:4208] is NOT allowed. CORS headers NOT added.", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-2","log.logger":"com.iemr.admin.utils.JwtUserIdValidationFilter"} -{"@timestamp":"2025-06-17T03:33:14.018Z", "log.level": "INFO", "message":"OPTIONS request - skipping JWT validation", "ecs.version": "1.2.0","process.thread.name":"http-nio-8082-exec-2","log.logger":"com.iemr.admin.utils.JwtUserIdValidationFilter"} -{"@timestamp":"2025-06-17T03:33:18.540Z", "log.level": "INFO", "message":"Closing JPA EntityManagerFactory for persistence unit 'default'", "ecs.version": "1.2.0","process.thread.name":"SpringApplicationShutdownHook","log.logger":"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"} -{"@timestamp":"2025-06-17T03:33:18.542Z", "log.level": "INFO", "message":"HikariPool-1 - Shutdown initiated...", "ecs.version": "1.2.0","process.thread.name":"SpringApplicationShutdownHook","log.logger":"com.zaxxer.hikari.HikariDataSource"} -{"@timestamp":"2025-06-17T03:33:18.545Z", "log.level": "INFO", "message":"HikariPool-1 - Shutdown completed.", "ecs.version": "1.2.0","process.thread.name":"SpringApplicationShutdownHook","log.logger":"com.zaxxer.hikari.HikariDataSource"} diff --git a/logs/admin-api.log.json.2025-06-13.gz b/logs/admin-api.log.json.2025-06-13.gz deleted file mode 100644 index db2d7d84..00000000 Binary files a/logs/admin-api.log.json.2025-06-13.gz and /dev/null differ diff --git a/logs/admin-api.log.json.2026-02-26.gz b/logs/admin-api.log.json.2026-02-26.gz new file mode 100644 index 00000000..510c59d3 Binary files /dev/null and b/logs/admin-api.log.json.2026-02-26.gz differ diff --git a/pom.xml b/pom.xml index c039aed9..4f180beb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.iemr.admin admin-api - 3.6.1 + 3.8.1 war Admin-API Admin Page diff --git a/src/main/java/com/iemr/admin/controller/bulkRegistration/BulkRegistrationController.java b/src/main/java/com/iemr/admin/controller/bulkRegistration/BulkRegistrationController.java index 4832b531..2ca91342 100644 --- a/src/main/java/com/iemr/admin/controller/bulkRegistration/BulkRegistrationController.java +++ b/src/main/java/com/iemr/admin/controller/bulkRegistration/BulkRegistrationController.java @@ -44,25 +44,7 @@ public class BulkRegistrationController { public ResponseEntity> registerBulkUser(@RequestBody String m_user, @RequestHeader String authorization, @RequestParam String userName, HttpServletRequest request, @RequestParam Integer serviceProviderID ) { - String jwtToken = null; - - Cookie[] cookies = request.getCookies(); - if (cookies != null) { - for (Cookie cookie : cookies) { - if ("jwt".equalsIgnoreCase(cookie.getName())) { // Cookie name == jwt - jwtToken = cookie.getValue(); - break; - } - } - } - - logger.info("JWT Token From Cookie: " + jwtToken); - logger.info("M_user Request: " + m_user); - - String authHeader = request.getHeader("Authorization"); - logger.info("Authorization Token: " + authHeader); - logger.info("M_user Request: " + m_user); bulkRegistrationServiceimpl.bulkRegistrationErrors.clear(); logger.info("Bulk registration request received. Request payload is omitted from logs."); try { diff --git a/src/main/java/com/iemr/admin/controller/employeemaster/AshaSupervisorMappingController.java b/src/main/java/com/iemr/admin/controller/employeemaster/AshaSupervisorMappingController.java new file mode 100644 index 00000000..0b7539a1 --- /dev/null +++ b/src/main/java/com/iemr/admin/controller/employeemaster/AshaSupervisorMappingController.java @@ -0,0 +1,234 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.employeemaster; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.iemr.admin.data.employeemaster.AshaSupervisorMapping; +import com.iemr.admin.data.employeemaster.M_UserServiceRoleMapping2; +import com.iemr.admin.data.store.M_Facility; +import com.iemr.admin.repo.employeemaster.EmployeeMasterRepo; +import com.iemr.admin.repository.store.MainStoreRepo; +import com.iemr.admin.service.employeemaster.AshaSupervisorMappingService; +import com.iemr.admin.utils.mapper.InputMapper; +import com.iemr.admin.utils.response.OutputResponse; + +import io.swagger.v3.oas.annotations.Operation; + +@RestController +public class AshaSupervisorMappingController { + + private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); + + @Autowired + private AshaSupervisorMappingService ashaSupervisorMappingService; + + @Autowired + private EmployeeMasterRepo employeeMasterRepo; + + @Autowired + private MainStoreRepo mainStoreRepo; + + @Operation(summary = "Get ASHA users by facility IDs") + @RequestMapping(value = "/userFacilityMapping/getAshasByFacility", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getAshasByFacility(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + AshaSupervisorMapping reqObj = InputMapper.gson().fromJson(request, AshaSupervisorMapping.class); + List facilityIDs = reqObj.getFacilityIDs(); + if (facilityIDs == null || facilityIDs.isEmpty()) { + if (reqObj.getFacilityID() != null) { + facilityIDs = Arrays.asList(reqObj.getFacilityID()); + } + } + ArrayList ashaUsers = ashaSupervisorMappingService + .getAshasByFacility(facilityIDs); + response.setResponse(ashaUsers.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Save ASHA supervisor mappings") + @RequestMapping(value = "/userFacilityMapping/ashaSupervisorMapping/save", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String saveAshaSupervisorMapping(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + AshaSupervisorMapping[] reqArray = InputMapper.gson().fromJson(request, AshaSupervisorMapping[].class); + List mappings = Arrays.asList(reqArray); + ArrayList savedMappings = ashaSupervisorMappingService + .saveAshaSupervisorMappings(mappings); + response.setResponse(savedMappings.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get supervisor mappings by facility ID") + @RequestMapping(value = "/userFacilityMapping/ashaSupervisorMapping/getByFacility", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getSupervisorMappingByFacility(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + AshaSupervisorMapping reqObj = InputMapper.gson().fromJson(request, AshaSupervisorMapping.class); + ArrayList mappings = ashaSupervisorMappingService + .getSupervisorMappingByFacility(reqObj.getFacilityID()); + response.setResponse(mappings.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Delete ASHA supervisor mappings by supervisor and facility IDs") + @RequestMapping(value = "/userFacilityMapping/ashaSupervisorMapping/delete", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String deleteAshaSupervisorMapping(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + AshaSupervisorMapping reqObj = InputMapper.gson().fromJson(request, AshaSupervisorMapping.class); + Integer supervisorUserID = reqObj.getSupervisorUserID(); + List facilityIDs = reqObj.getFacilityIDs(); + if (supervisorUserID != null && facilityIDs != null && !facilityIDs.isEmpty()) { + ashaSupervisorMappingService.deleteBySupervisorAndFacilities(supervisorUserID, facilityIDs, "Admin"); + response.setResponse("Deleted successfully"); + } else { + response.setError(5000, "supervisorUserID and facilityIDs are required"); + } + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Atomically delete old and save new ASHA supervisor mappings (Fix 7)") + @RequestMapping(value = "/userFacilityMapping/ashaSupervisorMapping/updateAtomically", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String updateAshaSupervisorMappingAtomically(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + com.google.gson.JsonObject reqObj = InputMapper.gson().fromJson(request, com.google.gson.JsonObject.class); + Integer supervisorUserID = reqObj.get("supervisorUserID").getAsInt(); + String modifiedBy = reqObj.has("modifiedBy") ? reqObj.get("modifiedBy").getAsString() : "Admin"; + List facilityIDs = new ArrayList<>(); + if (reqObj.has("facilityIDs")) { + for (com.google.gson.JsonElement el : reqObj.getAsJsonArray("facilityIDs")) { + facilityIDs.add(el.getAsInt()); + } + } + List newMappings = new ArrayList<>(); + if (reqObj.has("newMappings")) { + AshaSupervisorMapping[] arr = InputMapper.gson().fromJson( + reqObj.getAsJsonArray("newMappings").toString(), AshaSupervisorMapping[].class); + newMappings = Arrays.asList(arr); + } + ArrayList saved = ashaSupervisorMappingService + .updateAshaMappingsAtomically(supervisorUserID, facilityIDs, newMappings, modifiedBy); + response.setResponse(saved.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Restore soft-deleted ASHA supervisor mappings by IDs") + @RequestMapping(value = "/userFacilityMapping/ashaSupervisorMapping/restore", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String restoreAshaSupervisorMapping(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + AshaSupervisorMapping reqObj = InputMapper.gson().fromJson(request, AshaSupervisorMapping.class); + List ids = reqObj.getIds(); + if (ids != null && !ids.isEmpty()) { + ashaSupervisorMappingService.restoreMappings(ids, "Admin"); + response.setResponse("Restored successfully"); + } else { + response.setError(5000, "ids are required"); + } + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get facility details by USR mapping ID") + @RequestMapping(value = "/userFacilityMapping/getFacilityByMappingID", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getFacilityByMappingID(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + M_UserServiceRoleMapping2 reqObj = InputMapper.gson().fromJson(request, M_UserServiceRoleMapping2.class); + Integer mappingID = reqObj.getuSRMappingID(); + if (mappingID != null) { + M_UserServiceRoleMapping2 mapping = employeeMasterRepo.findById(mappingID).orElse(null); + // Skip if mapping is soft-deleted or has no facility + if (mapping != null && Boolean.TRUE.equals(mapping.getDeleted())) { + mapping = null; + } + if (mapping != null && mapping.getFacilityID() != null) { + // Use deleted filter to exclude soft-deleted facilities + M_Facility facility = mainStoreRepo.findByFacilityIDAndDeleted(mapping.getFacilityID(), false); + StringBuilder json = new StringBuilder("{"); + json.append("\"facilityID\": ").append(mapping.getFacilityID()); + if (facility != null) { + json.append(", \"facilityName\": \"").append(facility.getFacilityName() != null ? facility.getFacilityName() : "").append("\""); + json.append(", \"facilityTypeID\": ").append(facility.getFacilityTypeID()); + json.append(", \"ruralUrban\": \"").append(facility.getRuralUrban() != null ? facility.getRuralUrban() : "").append("\""); + } else { + // Facility was deleted — return null so frontend knows + json = new StringBuilder("{\"facilityID\": null, \"facilityDeleted\": true"); + } + json.append("}"); + response.setResponse(json.toString()); + } else { + response.setResponse("{\"facilityID\": null}"); + } + } else { + response.setResponse("{\"facilityID\": null}"); + } + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } +} diff --git a/src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java b/src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java index 227baf25..35b6ed67 100644 --- a/src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java +++ b/src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java @@ -1804,12 +1804,15 @@ public String UserRoleMappings(@RequestBody String userRoleMapping, HttpServletR resDataMap1.setUserID(employeeMaster.get(x).getUserID()); resDataMap1.setProviderServiceMapID(previl.getProviderServiceMapID()); resDataMap1.setWorkingLocationID(previl.getWorkingLocationID()); + resDataMap1.setStateID(previl.getStateID()); + resDataMap1.setDistrictID(previl.getDistrictID()); resDataMap1.setCreatedBy(employeeMaster.get(x).getCreatedBy()); resDataMap1.setServiceProviderID(employeeMaster.get(x).getServiceProviderID()); resDataMap1.setBlockID(previl.getBlockID()); resDataMap1.setBlockName(previl.getBlockName()); resDataMap1.setVillageID(previl.getVillageID()); resDataMap1.setVillageName(previl.getVillageName()); + resDataMap1.setFacilityID(previl.getFacilityID()); resList1.add(resDataMap1); } @@ -1845,16 +1848,32 @@ public String updateUserRoleMapping(@RequestBody String updateUserRoleMapping, H M_UserServiceRoleMapping2 usrRole = employeeMasterInter.getDataUsrId(pre.getuSRMappingID()); + // Fix 1/3: cascade asha_supervisor_mapping BEFORE modifying entity to avoid JPA L1 cache issue + if (usrRole != null && usrRole.getUserID() != null) { + boolean roleChanged = pre.getRoleID() != null && usrRole.getRoleID() != null + && !usrRole.getRoleID().equals(pre.getRoleID()); + boolean facilityChanged = usrRole.getFacilityID() != null && pre.getFacilityID() != null + && !usrRole.getFacilityID().equals(pre.getFacilityID()); + if (roleChanged || facilityChanged) { + logger.info("Fix1/3: cascading asha_supervisor_mapping for userID={}, roleChanged={}, facilityChanged={}", + usrRole.getUserID(), roleChanged, facilityChanged); + employeeMasterInter.cascadeDeleteAshaMappingsForUser(usrRole.getUserID()); + } + } + usrRole.setUserID(pre.getUserID()); usrRole.setRoleID(pre.getRoleID()); usrRole.setAgentPassword(pre.getAgentPassword()); usrRole.setProviderServiceMapID(pre.getProviderServiceMapID()); usrRole.setWorkingLocationID(pre.getWorkingLocationID()); + usrRole.setStateID(pre.getStateID()); + usrRole.setDistrictID(pre.getDistrictID()); usrRole.setModifiedBy(pre.getModifiedBy()); usrRole.setBlockID(pre.getBlockID()); usrRole.setBlockName(pre.getBlockName()); usrRole.setVillageID(pre.getVillageID()); usrRole.setVillageName(pre.getVillageName()); + usrRole.setFacilityID(pre.getFacilityID()); if (pre.getTeleConsultation() != null) { usrRole.setTeleConsultation(pre.getTeleConsultation()); @@ -1897,6 +1916,17 @@ public String deleteUserRoleMapping(@RequestBody String deletedUserRoleMapping, M_UserServiceRoleMapping2 usrRole = employeeMasterInter.getDataUsrId(pre.getuSRMappingID()); + // Fix 2: cascade asha_supervisor_mapping BEFORE setDeleted() to avoid JPA L1 cache issue. + // After setDeleted(true), findById() in saveRoleMappingeditedData hits the L1 cache + // returning the already-modified entity, so the "old vs new deleted" check always fails. + // For ASHA Supervisor with multiple facilities: only delete mappings for this facilityID + if (Boolean.TRUE.equals(pre.getDeleted()) && !Boolean.TRUE.equals(usrRole.getDeleted()) + && usrRole.getUserID() != null) { + logger.info("Fix2: cascading asha_supervisor_mapping soft-delete for userID={}, uSRMappingID={}", + usrRole.getUserID(), pre.getuSRMappingID()); + employeeMasterInter.cascadeDeleteAshaMappingsForDeactivation(usrRole); + } + usrRole.setDeleted(pre.getDeleted()); M_UserServiceRoleMapping2 savedata = employeeMasterInter.saveRoleMappingeditedData(usrRole, diff --git a/src/main/java/com/iemr/admin/controller/facilitytype/FacilitytypeController.java b/src/main/java/com/iemr/admin/controller/facilitytype/FacilitytypeController.java index bf55ebe5..4c49f8ce 100644 --- a/src/main/java/com/iemr/admin/controller/facilitytype/FacilitytypeController.java +++ b/src/main/java/com/iemr/admin/controller/facilitytype/FacilitytypeController.java @@ -28,20 +28,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; - +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.iemr.admin.data.facilitytype.M_facilitytype; +import com.iemr.admin.data.store.M_Facility; +import com.iemr.admin.data.store.M_FacilityLevel; +import com.iemr.admin.repository.store.MainStoreRepo; import com.iemr.admin.service.facilitytype.M_facilitytypeInter; import com.iemr.admin.utils.mapper.InputMapper; import com.iemr.admin.utils.response.OutputResponse; import io.swagger.v3.oas.annotations.Operation; - @RestController public class FacilitytypeController { private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); @@ -49,6 +51,9 @@ public class FacilitytypeController { @Autowired private M_facilitytypeInter m_facilitytypeInter; + @Autowired + private MainStoreRepo mainStoreRepo; + @Operation(summary = "Get facility") @RequestMapping(value = "/getFacility", headers = "Authorization", method = { RequestMethod.POST }, produces = { "application/json" }) @@ -115,7 +120,15 @@ public String editFacility(@RequestBody String editFacility) { M_facilitytype allFacilityData = m_facilitytypeInter .editAllFicilityData(facilityDetails.getFacilityTypeID()); - allFacilityData.setFacilityTypeDesc(facilityDetails.getFacilityTypeDesc()); + if (facilityDetails.getFacilityTypeName() != null) { + allFacilityData.setFacilityTypeName(facilityDetails.getFacilityTypeName()); + } + if (facilityDetails.getRuralUrban() != null) { + allFacilityData.setRuralUrban(facilityDetails.getRuralUrban()); + } + if (facilityDetails.getFacilityTypeDesc() != null) { + allFacilityData.setFacilityTypeDesc(facilityDetails.getFacilityTypeDesc()); + } allFacilityData.setModifiedBy(facilityDetails.getModifiedBy()); M_facilitytype saveFacilityData = m_facilitytypeInter.updateFacilityData(allFacilityData); @@ -145,6 +158,16 @@ public String deleteFacility(@RequestBody String deleteFacility) { M_facilitytype allFacilityData = m_facilitytypeInter .editAllFicilityData(facilityDetails.getFacilityTypeID()); + + // Block deactivation if facility type is in use by active facilities + if (Boolean.TRUE.equals(facilityDetails.getDeleted())) { + List activeFacilities = mainStoreRepo + .findByFacilityTypeIDAndDeletedFalse(facilityDetails.getFacilityTypeID()); + if (activeFacilities != null && !activeFacilities.isEmpty()) { + throw new Exception("Cannot deactivate: facility type is in use by " + activeFacilities.size() + " active facilities"); + } + } + allFacilityData.setDeleted(facilityDetails.getDeleted()); M_facilitytype saveFacilityData = m_facilitytypeInter.updateFacilityData(allFacilityData); @@ -186,4 +209,100 @@ public String checkFacilityTypeCode(@RequestBody String deleteManufacturer) { return response.toString(); } + + @Operation(summary = "Get facility types by rural/urban") + @RequestMapping(value = "/getFacilityTypesByRuralUrban", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getFacilityTypesByRuralUrban(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + + try { + + M_facilitytype facilityDetails = InputMapper.gson().fromJson(request, M_facilitytype.class); + + ArrayList facilityData = m_facilitytypeInter + .getFacilityTypesByRuralUrban(facilityDetails.getProviderServiceMapID(), + facilityDetails.getRuralUrban()); + + response.setResponse(facilityData.toString()); + + } catch (Exception e) { + + logger.error("Unexpected error:", e); + response.setError(e); + + } + + return response.toString(); + } + + @Operation(summary = "Get all facility levels") + @RequestMapping(value = "/getFacilityLevels", headers = "Authorization", method = { + RequestMethod.GET }, produces = { "application/json" }) + public String getFacilityLevels() { + + OutputResponse response = new OutputResponse(); + try { + ArrayList data = m_facilitytypeInter.getFacilityLevels(); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get facility types by block") + @RequestMapping(value = "/getFacilityTypesByBlock", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getFacilityTypesByBlock(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_facilitytype facilityDetails = InputMapper.gson().fromJson(request, M_facilitytype.class); + ArrayList data = m_facilitytypeInter.getFacilityTypesByBlock(facilityDetails.getBlockID()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get facility types by state") + @RequestMapping(value = "/getFacilityTypesByState", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getFacilityTypesByState(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_facilitytype facilityDetails = InputMapper.gson().fromJson(request, M_facilitytype.class); + ArrayList data = m_facilitytypeInter.getFacilityTypesByState(facilityDetails.getStateID()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Check if facility type name exists in state") + @RequestMapping(value = "/checkFacilityTypeName", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String checkFacilityTypeName(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_facilitytype facilityDetails = InputMapper.gson().fromJson(request, M_facilitytype.class); + boolean exists = m_facilitytypeInter.checkFacilityTypeNameExists( + facilityDetails.getFacilityTypeName(), facilityDetails.getStateID()); + response.setResponse(String.valueOf(exists)); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + } diff --git a/src/main/java/com/iemr/admin/controller/itemfacilitymapping/MItemFacilityMappingController.java b/src/main/java/com/iemr/admin/controller/itemfacilitymapping/MItemFacilityMappingController.java index a827f188..0bf5bd57 100644 --- a/src/main/java/com/iemr/admin/controller/itemfacilitymapping/MItemFacilityMappingController.java +++ b/src/main/java/com/iemr/admin/controller/itemfacilitymapping/MItemFacilityMappingController.java @@ -228,6 +228,23 @@ public String getAllFacilityMappedData(@RequestBody String getAllFacilityMappedD } + @RequestMapping(value = "/getItemMappingsByFacility", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getItemMappingsByFacility(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + V_fetchItemFacilityMap reqObj = InputMapper.gson().fromJson(request, + V_fetchItemFacilityMap.class); + ArrayList data = M_itemfacilitymappingInter + .getItemMappingsByFacilityID(reqObj.getFacilityID()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + @Operation(summary = "Get item from store id") @RequestMapping(value = "/getItemFromStoreID/{storeID}", headers = "Authorization", method = { RequestMethod.POST }, produces = { "application/json" }) diff --git a/src/main/java/com/iemr/admin/controller/store/StoreController.java b/src/main/java/com/iemr/admin/controller/store/StoreController.java index afd4be41..29cddf1d 100644 --- a/src/main/java/com/iemr/admin/controller/store/StoreController.java +++ b/src/main/java/com/iemr/admin/controller/store/StoreController.java @@ -35,6 +35,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.iemr.admin.data.store.FacilityHierarchyRequest; +import com.iemr.admin.data.store.FacilityVillageMapping; import com.iemr.admin.data.store.M_Facility; import com.iemr.admin.data.store.M_facilityMap; import com.iemr.admin.data.store.V_FetchFacility; @@ -286,6 +288,39 @@ public String getMapStore(@RequestBody V_FetchFacility facilitymap) { } + @Operation(summary = "Get facilities by block/taluk") + @RequestMapping(value = "/getFacilitiesByBlock", headers = "Authorization", method = { RequestMethod.POST }, produces = { + "application/json" }) + public String getFacilitiesByBlock(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_Facility facility = InputMapper.gson().fromJson(request, M_Facility.class); + ArrayList data = storeService.getFacilitiesByBlock(facility.getBlockID()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get all facilities by block (including deleted)") + @RequestMapping(value = "/getAllFacilitiesByBlock", headers = "Authorization", method = { RequestMethod.POST }, produces = { + "application/json" }) + public String getAllFacilitiesByBlock(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + M_Facility facility = InputMapper.gson().fromJson(request, M_Facility.class); + ArrayList data = storeService.getAllFacilitiesByBlock(facility.getBlockID()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + @Operation(summary = "Check store code") @RequestMapping(value = "/checkStoreCode", headers = "Authorization", method = { RequestMethod.POST }, produces = { "application/json" }) @@ -311,4 +346,127 @@ public String checkStoreCode(@RequestBody String deleteManufacturer) { return response.toString(); } + + @Operation(summary = "Get facilities by block and facility level") + @RequestMapping(value = "/getFacilitiesByBlockAndLevel", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getFacilitiesByBlockAndLevel(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + com.iemr.admin.data.facilitytype.M_facilitytype reqObj = InputMapper.gson().fromJson(request, + com.iemr.admin.data.facilitytype.M_facilitytype.class); + ArrayList data = storeService.getFacilitiesByBlockAndLevel(reqObj.getBlockID(), + reqObj.getLevelValue(), reqObj.getRuralUrban()); + response.setResponse(data.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Create facility with hierarchy mapping") + @RequestMapping(value = "/createFacilityWithHierarchy", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String createFacilityWithHierarchy(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + FacilityHierarchyRequest reqObj = InputMapper.gson().fromJson(request, FacilityHierarchyRequest.class); + M_Facility savedFacility = storeService.createFacilityWithHierarchy(reqObj.getFacility(), + reqObj.getVillageIDs(), reqObj.getMainVillageID(), reqObj.getChildFacilityIDs()); + response.setResponse(savedFacility.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get village IDs already mapped to facilities in a block") + @RequestMapping(value = "/getMappedVillageIDs", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getMappedVillageIDs(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_Facility facility = InputMapper.gson().fromJson(request, M_Facility.class); + List mappedIDs = storeService.getMappedVillageIDs(facility.getBlockID()); + response.setResponse(mappedIDs.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get village mappings for a facility") + @RequestMapping(value = "/getVillageMappingsByFacility", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getVillageMappingsByFacility(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_Facility facility = InputMapper.gson().fromJson(request, M_Facility.class); + ArrayList mappings = storeService.getVillageMappingsByFacility(facility.getFacilityID()); + response.setResponse(mappings.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Get child facilities by parent facility ID") + @RequestMapping(value = "/getChildFacilitiesByParent", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String getChildFacilitiesByParent(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + M_Facility facility = InputMapper.gson().fromJson(request, M_Facility.class); + ArrayList children = storeService.getChildFacilitiesByParent(facility.getFacilityID()); + response.setResponse(children.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Update facility with hierarchy mapping") + @RequestMapping(value = "/updateFacilityWithHierarchy", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String updateFacilityWithHierarchy(@RequestBody String request) { + + OutputResponse response = new OutputResponse(); + try { + FacilityHierarchyRequest reqObj = InputMapper.gson().fromJson(request, FacilityHierarchyRequest.class); + M_Facility updatedFacility = storeService.updateFacilityWithHierarchy(reqObj.getFacility(), + reqObj.getVillageIDs(), reqObj.getMainVillageID(), reqObj.getChildFacilityIDs()); + response.setResponse(updatedFacility.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } + + @Operation(summary = "Deactivate facility with hierarchy cascade (Fix 8 + Fix 19)") + @RequestMapping(value = "/deleteFacilityWithHierarchy", headers = "Authorization", method = { + RequestMethod.POST }, produces = { "application/json" }) + public String deleteFacilityWithHierarchy(@RequestBody String request) { + OutputResponse response = new OutputResponse(); + try { + M_Facility reqObj = InputMapper.gson().fromJson(request, M_Facility.class); + M_Facility result = storeService.deleteFacilityWithHierarchy( + reqObj.getFacilityID(), reqObj.getModifiedBy()); + response.setResponse(result.toString()); + } catch (Exception e) { + logger.error("Unexpected error:", e); + response.setError(e); + } + return response.toString(); + } } 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 dd46670f..15d14bb2 100644 --- a/src/main/java/com/iemr/admin/controller/version/VersionController.java +++ b/src/main/java/com/iemr/admin/controller/version/VersionController.java @@ -20,7 +20,6 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ - package com.iemr.admin.controller.version; import java.util.Map; @@ -36,7 +35,6 @@ import java.util.Properties; import org.springframework.http.MediaType; - @RestController public class VersionController { diff --git a/src/main/java/com/iemr/admin/data/employeemaster/AshaSupervisorMapping.java b/src/main/java/com/iemr/admin/data/employeemaster/AshaSupervisorMapping.java new file mode 100644 index 00000000..26600e9f --- /dev/null +++ b/src/main/java/com/iemr/admin/data/employeemaster/AshaSupervisorMapping.java @@ -0,0 +1,107 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.data.employeemaster; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; +import java.sql.Timestamp; +import java.util.List; + +import org.hibernate.annotations.Formula; + +import com.google.gson.annotations.Expose; +import com.iemr.admin.utils.mapper.OutputMapper; + +import lombok.Data; + +@Entity +@Table(name = "asha_supervisor_mapping") +@Data +public class AshaSupervisorMapping { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Expose + @Column(name = "id") + private Long id; + + @Expose + @Column(name = "supervisorUserID") + private Integer supervisorUserID; + + @Expose + @Column(name = "ashaUserID") + private Integer ashaUserID; + + @Expose + @Column(name = "facilityID") + private Integer facilityID; + + @Expose + @Formula("(SELECT u.FirstName FROM m_User u WHERE u.UserID = ashaUserID)") + private String ashaFirstName; + + @Expose + @Formula("(SELECT u.LastName FROM m_User u WHERE u.UserID = ashaUserID)") + private String ashaLastName; + + @Expose + @Column(name = "deleted", insertable = false, updatable = true) + private Boolean deleted; + + @Expose + @Column(name = "createdBy") + private String createdBy; + + @Expose + @Column(name = "createdDate", insertable = false, updatable = false) + private Timestamp createdDate; + + @Expose + @Column(name = "modifiedBy") + private String modifiedBy; + + @Expose + @Column(name = "lastModDate", insertable = false, updatable = false) + private Timestamp lastModDate; + + @Transient + @Expose + private List facilityIDs; + + @Transient + @Expose + private List ids; + + @Transient + private OutputMapper outputMapper = new OutputMapper(); + + @Override + public String toString() { + return outputMapper.gson().toJson(this); + } +} diff --git a/src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java b/src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java index 23c115e4..ad6575a6 100644 --- a/src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java +++ b/src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java @@ -87,6 +87,12 @@ public class M_UserServiceRoleMapping2 { @Column(name = "WorkingLocationID") private Integer workingLocationID; @Expose + @Column(name = "StateID") + private Integer stateID; + @Expose + @Column(name = "DistrictID") + private Integer districtID; + @Expose @Column(name = "Blockid") private Integer blockID; @Expose @@ -98,6 +104,9 @@ public class M_UserServiceRoleMapping2 { @Expose @Column(name = "VillageName") private String villageNameDb; + @Expose + @Column(name = "FacilityID") + private Integer facilityID; @Transient private String[] villageID; @Transient diff --git a/src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java b/src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java index 7b4b2662..6a61d1a0 100644 --- a/src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java +++ b/src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java @@ -145,8 +145,20 @@ public class V_Userservicerolemapping { @Transient private String[] villageID; @Transient - private String[] villageName; - + private String[] villageName; + @Transient + @Expose + private Integer facilityID; + @Transient + @Expose + private String facilityName; + @Transient + @Expose + private Integer facilityTypeID; + @Transient + @Expose + private String ruralUrban; + @Expose @Column(name="teleConsultation") private String teleConsultation; @@ -385,5 +397,5 @@ public void setOutbound(Boolean outbound) { public String toString() { return outputMapper.gson().toJson(this); } - + } diff --git a/src/main/java/com/iemr/admin/data/facilitytype/M_facilitytype.java b/src/main/java/com/iemr/admin/data/facilitytype/M_facilitytype.java index 2a145960..373efb10 100644 --- a/src/main/java/com/iemr/admin/data/facilitytype/M_facilitytype.java +++ b/src/main/java/com/iemr/admin/data/facilitytype/M_facilitytype.java @@ -35,7 +35,7 @@ import jakarta.persistence.Transient; @Entity -@Table(name="m_facilitytype") +@Table(name = "m_facilitytype") public class M_facilitytype { @Id @@ -43,65 +43,73 @@ public class M_facilitytype { @Column(name = "FacilityTypeID") @Expose private Integer facilityTypeID; - + @Column(name = "FacilityTypeName") @Expose private String facilityTypeName; - + @Column(name = "FacilityTypeDesc") @Expose private String facilityTypeDesc; - + @Column(name = "FacilityTypeCode") @Expose private String facilityTypeCode; - + @Column(name = "Status") @Expose private String status; - + @Column(name = "ProviderServiceMapID") @Expose private Integer providerServiceMapID; - + @Column(name = "Deleted", insertable = false, updatable = true) @Expose private Boolean deleted; - + @Column(name = "CreatedBy") @Expose private String createdBy; - + @Column(name = "CreatedDate", insertable = false, updatable = false) @Expose private Timestamp createdDate; - + @Column(name = "ModifiedBy") @Expose private String modifiedBy; - + @Column(name = "LastModDate", insertable = false, updatable = false) @Expose private Timestamp lastModDate; - - - + + @Expose + @Column(name = "RuralUrban") + private String ruralUrban; + + @Expose + @Column(name = "LevelValue") + private Integer levelValue; + + @Expose + @Column(name = "StateID") + private Integer stateID; + + @Transient + @Expose + private Integer blockID; + public M_facilitytype() { // TODO Auto-generated constructor stub } - - - - - - - + public Integer getFacilityTypeID() { return facilityTypeID; } public void setFacilityTypeID(Integer facilityTypeID) { - facilityTypeID = facilityTypeID; + this.facilityTypeID = facilityTypeID; } public String getFacilityTypeName() { @@ -160,8 +168,6 @@ public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } - - public String getModifiedBy() { return modifiedBy; } @@ -170,50 +176,60 @@ public void setModifiedBy(String modifiedBy) { this.modifiedBy = modifiedBy; } - - public Timestamp getCreatedDate() { return createdDate; } - - - - - - public void setCreatedDate(Timestamp createdDate) { this.createdDate = createdDate; } - - - - - - public Timestamp getLastModDate() { return lastModDate; } + public void setLastModDate(Timestamp lastModDate) { + this.lastModDate = lastModDate; + } + @Transient + private OutputMapper outputMapper = new OutputMapper(); + @Override + public String toString() { + return outputMapper.gson().toJson(this); + } + public String getRuralUrban() { + return ruralUrban; + } + public void setRuralUrban(String ruralUrban) { + this.ruralUrban = ruralUrban; + } + public Integer getStateID() { + return stateID; + } - public void setLastModDate(Timestamp lastModDate) { - this.lastModDate = lastModDate; + public void setStateID(Integer stateID) { + this.stateID = stateID; } + public Integer getLevelValue() { + return levelValue; + } + public void setLevelValue(Integer levelValue) { + this.levelValue = levelValue; + } - @Transient - private OutputMapper outputMapper = new OutputMapper(); + public Integer getBlockID() { + return blockID; + } - @Override - public String toString() { - return outputMapper.gson().toJson(this); + public void setBlockID(Integer blockID) { + this.blockID = blockID; } } diff --git a/src/main/java/com/iemr/admin/data/store/FacilityHierarchyRequest.java b/src/main/java/com/iemr/admin/data/store/FacilityHierarchyRequest.java new file mode 100644 index 00000000..c28a364f --- /dev/null +++ b/src/main/java/com/iemr/admin/data/store/FacilityHierarchyRequest.java @@ -0,0 +1,24 @@ +package com.iemr.admin.data.store; + +import java.util.List; + +import com.google.gson.annotations.Expose; + +import lombok.Data; + +@Data +public class FacilityHierarchyRequest { + + @Expose + private M_Facility facility; + + @Expose + private List villageIDs; + + @Expose + private List childFacilityIDs; + + @Expose + private Integer mainVillageID; + +} diff --git a/src/main/java/com/iemr/admin/data/store/FacilityVillageMapping.java b/src/main/java/com/iemr/admin/data/store/FacilityVillageMapping.java new file mode 100644 index 00000000..aaa84dbf --- /dev/null +++ b/src/main/java/com/iemr/admin/data/store/FacilityVillageMapping.java @@ -0,0 +1,68 @@ +package com.iemr.admin.data.store; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; +import java.sql.Timestamp; + +import org.hibernate.annotations.Formula; + +import com.google.gson.annotations.Expose; +import com.iemr.admin.utils.mapper.OutputMapper; + +import lombok.Data; + +@Entity +@Table(name = "facility_village_mapping") +@Data +public class FacilityVillageMapping { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Expose + @Column(name = "FacilityVillageMappingID") + private Long facilityVillageMappingID; + + @Expose + @Column(name = "FacilityID") + private Integer facilityID; + + @Expose + @Column(name = "DistrictBranchID") + private Integer districtBranchID; + + @Expose + @Formula("(SELECT dbm.VillageName FROM m_DistrictBranchMapping dbm WHERE dbm.DistrictBranchID = {alias}.DistrictBranchID)") + private String villageName; + + @Expose + @Column(name = "Deleted", insertable = true, updatable = true) + private Boolean deleted = false; + + @Expose + @Column(name = "CreatedBy") + private String createdBy; + + @Expose + @Column(name = "CreatedDate", insertable = false, updatable = false) + private Timestamp createdDate; + + @Expose + @Column(name = "ModifiedBy") + private String modifiedBy; + + @Expose + @Column(name = "LastModDate", insertable = false, updatable = false) + private Timestamp lastModDate; + + @Transient + private OutputMapper outputMapper = new OutputMapper(); + + @Override + public String toString() { + return outputMapper.gson().toJson(this); + } +} diff --git a/src/main/java/com/iemr/admin/data/store/M_Facility.java b/src/main/java/com/iemr/admin/data/store/M_Facility.java index fdb575dc..bc09d055 100644 --- a/src/main/java/com/iemr/admin/data/store/M_Facility.java +++ b/src/main/java/com/iemr/admin/data/store/M_Facility.java @@ -78,6 +78,26 @@ public class M_Facility { @Expose @Column(name="ProviderServiceMapID") private Integer providerServiceMapID; + @Expose + @Column(name="StateID") + private Integer stateID; + @Expose + @Column(name="DistrictID") + private Integer districtID; + @Expose + @Column(name="BlockID") + private Integer blockID; + @Expose + @Column(name="ParentFacilityID") + private Integer parentFacilityID; + + @Expose + @Column(name="MainVillageID") + private Integer mainVillageID; + + @Expose + @Column(name="RuralUrban") + private String ruralUrban; @Expose @Column(name="Deleted",insertable = false, updatable = true) @@ -204,6 +224,54 @@ public void setProviderServiceMapID(Integer providerServiceMapID) { this.providerServiceMapID = providerServiceMapID; } + public Integer getStateID() { + return stateID; + } + + public void setStateID(Integer stateID) { + this.stateID = stateID; + } + + public Integer getDistrictID() { + return districtID; + } + + public void setDistrictID(Integer districtID) { + this.districtID = districtID; + } + + public Integer getBlockID() { + return blockID; + } + + public void setBlockID(Integer blockID) { + this.blockID = blockID; + } + + public Integer getParentFacilityID() { + return parentFacilityID; + } + + public void setParentFacilityID(Integer parentFacilityID) { + this.parentFacilityID = parentFacilityID; + } + + public Integer getMainVillageID() { + return mainVillageID; + } + + public void setMainVillageID(Integer mainVillageID) { + this.mainVillageID = mainVillageID; + } + + public String getRuralUrban() { + return ruralUrban; + } + + public void setRuralUrban(String ruralUrban) { + this.ruralUrban = ruralUrban; + } + public Boolean getDeleted() { return deleted; } diff --git a/src/main/java/com/iemr/admin/data/store/M_FacilityLevel.java b/src/main/java/com/iemr/admin/data/store/M_FacilityLevel.java new file mode 100644 index 00000000..ef8de67e --- /dev/null +++ b/src/main/java/com/iemr/admin/data/store/M_FacilityLevel.java @@ -0,0 +1,88 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.data.store; + +import java.sql.Date; + +import com.google.gson.annotations.Expose; +import com.iemr.admin.utils.mapper.OutputMapper; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; +import lombok.Data; + +@Entity +@Table(name = "m_facility_level") +@Data +public class M_FacilityLevel { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Expose + @Column(name = "FacilityLevelID") + private Integer facilityLevelID; + + @Expose + @Column(name = "LevelName") + private String levelName; + + @Expose + @Column(name = "LevelDescription") + private String levelDescription; + + @Expose + @Column(name = "LevelValue") + private Integer levelValue; + + @Expose + @Column(name = "Deleted", insertable = false, updatable = true) + private Boolean deleted; + + @Expose + @Column(name = "CreatedBy") + private String createdBy; + + @Expose + @Column(name = "CreatedDate", insertable = false, updatable = false) + private Date createdDate; + + @Expose + @Column(name = "ModifiedBy") + private String modifiedBy; + + @Expose + @Column(name = "LastModDate", insertable = false, updatable = false) + private Date lastModDate; + + @Transient + private OutputMapper outputMapper = new OutputMapper(); + + @Override + public String toString() { + return outputMapper.gson().toJson(this); + } +} diff --git a/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepo.java b/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepo.java index 53fb06b8..401b0c1c 100644 --- a/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepo.java +++ b/src/main/java/com/iemr/admin/repo/employeemaster/EmployeeMasterRepo.java @@ -126,4 +126,33 @@ List getAllEmpByProviderServiceMapIDAndDesignationNotInUserID(@Param(" @Query("SELECT u FROM M_UserServiceRoleMapping2 u WHERE u.uSRMappingID=:uSRMappingID") M_UserServiceRoleMapping2 findByUSRMappingID(@Param("uSRMappingID") Integer uSRMappingID); + @Query("SELECT u FROM M_UserServiceRoleMapping2 u JOIN u.mRole rm WHERE u.facilityID IN :facilityIDs AND LOWER(rm.roleName) = 'asha' AND u.deleted = false") + ArrayList findAshaUsersByFacilityIDs(@Param("facilityIDs") List facilityIDs); + + @Query(value = "SELECT usrm.USRMappingID, usrm.StateID, s.StateName, usrm.DistrictID, d.DistrictName, " + + "usrm.Blockid, usrm.BlockName " + + "FROM m_userservicerolemapping usrm " + + "LEFT JOIN m_state s ON usrm.StateID = s.StateID " + + "LEFT JOIN m_district d ON usrm.DistrictID = d.DistrictID " + + "WHERE usrm.USRMappingID IN :mappingIDs", nativeQuery = true) + List getDirectStateDistrictByMappingIDs(@Param("mappingIDs") List mappingIDs); + + @Query(value = "SELECT usrm.USRMappingID, usrm.FacilityID, f.FacilityName, f.FacilityTypeID, ft.RuralUrban " + + "FROM m_userservicerolemapping usrm " + + "LEFT JOIN m_facility f ON usrm.FacilityID = f.FacilityID AND f.Deleted = false " + + "LEFT JOIN m_facilitytype ft ON f.FacilityTypeID = ft.FacilityTypeID " + + "WHERE usrm.USRMappingID IN :mappingIDs AND usrm.FacilityID IS NOT NULL", nativeQuery = true) + List getFacilityInfoByMappingIDs(@Param("mappingIDs") List mappingIDs); + + // Fix 18: detect duplicate USR row before create + boolean existsByUserIDAndRoleIDAndProviderServiceMapIDAndDeletedFalse( + Integer userID, Integer roleID, Integer providerServiceMapID); + + // Fix 18: ASHA Supervisor duplicate check includes facilityID + boolean existsByUserIDAndRoleIDAndProviderServiceMapIDAndFacilityIDAndDeletedFalse( + Integer userID, Integer roleID, Integer providerServiceMapID, Integer facilityID); + + // Fix 2: count active USR rows for supervisor (check if other facilities remain) + long countByUserIDAndRoleIDAndDeletedFalse(Integer userID, Integer roleID); + } diff --git a/src/main/java/com/iemr/admin/repository/facilitytype/M_FacilityLevelRepo.java b/src/main/java/com/iemr/admin/repository/facilitytype/M_FacilityLevelRepo.java new file mode 100644 index 00000000..0dd5d933 --- /dev/null +++ b/src/main/java/com/iemr/admin/repository/facilitytype/M_FacilityLevelRepo.java @@ -0,0 +1,36 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.repository.facilitytype; + +import java.util.ArrayList; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import com.iemr.admin.data.store.M_FacilityLevel; + +@Repository +public interface M_FacilityLevelRepo extends CrudRepository { + + ArrayList findByDeletedFalseOrderByLevelName(); + +} diff --git a/src/main/java/com/iemr/admin/repository/facilitytype/M_facilitytypeRepo.java b/src/main/java/com/iemr/admin/repository/facilitytype/M_facilitytypeRepo.java index f4a2155e..c1e35735 100644 --- a/src/main/java/com/iemr/admin/repository/facilitytype/M_facilitytypeRepo.java +++ b/src/main/java/com/iemr/admin/repository/facilitytype/M_facilitytypeRepo.java @@ -32,16 +32,33 @@ import com.iemr.admin.data.facilitytype.M_facilitytype; @Repository -public interface M_facilitytypeRepo extends CrudRepository{ +public interface M_facilitytypeRepo extends CrudRepository { - - @Query("SELECT u FROM M_facilitytype u WHERE u.providerServiceMapID=:providerServiceMapID order by u.facilityTypeName") ArrayList getAllFicilityData(@Param("providerServiceMapID") Integer providerServiceMapID); List findByFacilityTypeCodeAndProviderServiceMapID(String facilityTypeCode, Integer providerServiceMapID); - + M_facilitytype findByFacilityTypeID(Integer facilityTypeID); + @Query("SELECT f FROM M_facilitytype f WHERE f.providerServiceMapID=:psm AND f.ruralUrban=:ruralUrban AND f.deleted=false ORDER BY f.facilityTypeName") + List findByProviderServiceMapIDAndRuralUrban(@Param("psm") Integer psm, + @Param("ruralUrban") String ruralUrban); + + @Query("SELECT DISTINCT ft FROM M_facilitytype ft WHERE ft.facilityTypeID IN " + + "(SELECT DISTINCT f.facilityTypeID FROM com.iemr.admin.data.store.M_Facility f " + + "WHERE f.blockID = :blockID AND f.deleted = false) " + + "AND ft.deleted = false ORDER BY ft.facilityTypeName") + List findFacilityTypesByBlock(@Param("blockID") Integer blockID); + + @Query("SELECT f FROM M_facilitytype f WHERE f.stateID = :stateID AND f.deleted = false ORDER BY f.facilityTypeName") + List findByStateID(@Param("stateID") Integer stateID); + + boolean existsByFacilityTypeNameAndStateIDAndDeletedFalse(String facilityTypeName, Integer stateID); + + // Fix 17: get the highest levelValue (= SC level) for a given service line + @Query("SELECT MAX(f.levelValue) FROM M_facilitytype f WHERE f.providerServiceMapID = :psm AND f.deleted = false") + Integer findMaxLevelValueByProviderServiceMapID(@Param("psm") Integer psm); + } diff --git a/src/main/java/com/iemr/admin/repository/itemfacilitymapping/V_fetchItemFacilityMapRepo.java b/src/main/java/com/iemr/admin/repository/itemfacilitymapping/V_fetchItemFacilityMapRepo.java index e94dba51..07b52bd8 100644 --- a/src/main/java/com/iemr/admin/repository/itemfacilitymapping/V_fetchItemFacilityMapRepo.java +++ b/src/main/java/com/iemr/admin/repository/itemfacilitymapping/V_fetchItemFacilityMapRepo.java @@ -36,4 +36,12 @@ public interface V_fetchItemFacilityMapRepo extends CrudRepository getAllFacilityMappedData(@Param("providerServiceMapID") Integer providerServiceMapID); + @Query("SELECT u FROM V_fetchItemFacilityMap u where u.facilityID = :facilityID") + ArrayList getItemMappingsByFacilityID(@Param("facilityID") Integer facilityID); + + @Query(value = "SELECT u.* FROM v_fetchItemFacilityMap u WHERE u.FacilityID = :facilityID " + + "OR u.FacilityID IN (SELECT f.FacilityID FROM m_facility f WHERE f.MainFacilityID = :facilityID AND f.Deleted = false)", + nativeQuery = true) + ArrayList getItemMappingsByFacilityAndSubStores(@Param("facilityID") Integer facilityID); + } diff --git a/src/main/java/com/iemr/admin/repository/store/FacilityVillageMappingRepo.java b/src/main/java/com/iemr/admin/repository/store/FacilityVillageMappingRepo.java new file mode 100644 index 00000000..3ae0635b --- /dev/null +++ b/src/main/java/com/iemr/admin/repository/store/FacilityVillageMappingRepo.java @@ -0,0 +1,25 @@ +package com.iemr.admin.repository.store; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.iemr.admin.data.store.FacilityVillageMapping; + +@Repository +public interface FacilityVillageMappingRepo extends CrudRepository { + + ArrayList findByFacilityIDAndDeletedFalse(Integer facilityID); + + FacilityVillageMapping findByFacilityIDAndDistrictBranchIDAndDeletedTrue(Integer facilityID, Integer districtBranchID); + + @Query("SELECT DISTINCT fvm.districtBranchID FROM FacilityVillageMapping fvm WHERE fvm.facilityID IN " + + "(SELECT f.facilityID FROM M_Facility f WHERE f.blockID = :blockID AND f.deleted = false) " + + "AND fvm.deleted = false") + List findMappedVillageIDsByBlockID(@Param("blockID") Integer blockID); + +} diff --git a/src/main/java/com/iemr/admin/repository/store/MainStoreRepo.java b/src/main/java/com/iemr/admin/repository/store/MainStoreRepo.java index 644a7954..45b1015b 100644 --- a/src/main/java/com/iemr/admin/repository/store/MainStoreRepo.java +++ b/src/main/java/com/iemr/admin/repository/store/MainStoreRepo.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -32,29 +33,71 @@ import com.iemr.admin.data.store.M_Facility; @Repository -public interface MainStoreRepo extends CrudRepository{ - +public interface MainStoreRepo extends CrudRepository { + List findByProviderServiceMapIDOrderByFacilityName(Integer providerServiceMapID); - + + @Query("SELECT f FROM M_Facility f WHERE (f.providerServiceMapID = :providerServiceMapID OR f.providerServiceMapID IS NULL) ORDER BY f.facilityName") + List findByProviderServiceMapIDOrNullOrderByFacilityName(@Param("providerServiceMapID") Integer providerServiceMapID); + @Query("SELECT u FROM M_Facility u WHERE u.providerServiceMapID=:providerServiceMapID AND u.isMainFacility=:isMainFacility AND deleted=false order by u.facilityName") - ArrayList getAllMainFacility(@Param("providerServiceMapID")Integer providerServiceMapID,@Param("isMainFacility") Boolean isMainFacility); - - + ArrayList getAllMainFacility(@Param("providerServiceMapID") Integer providerServiceMapID, + @Param("isMainFacility") Boolean isMainFacility); + @Query("SELECT u FROM M_Facility u WHERE u.providerServiceMapID=:providerServiceMapID AND u.isMainFacility=:isMainFacility AND u.mainFacilityID=:mainFacilityID AND deleted=false order by u.facilityName") - ArrayList getAllMainFacility(@Param("providerServiceMapID")Integer providerServiceMapID,@Param("isMainFacility") Boolean isMainFacility, + ArrayList getAllMainFacility(@Param("providerServiceMapID") Integer providerServiceMapID, + @Param("isMainFacility") Boolean isMainFacility, @Param("mainFacilityID") Integer mainFacilityID); @Query("SELECT u FROM M_Facility u WHERE u.providerServiceMapID=:providerServiceMapID AND u.mainFacilityID=:mainFacilityID AND deleted=false order by u.facilityName") - ArrayList getChildFacility(@Param("providerServiceMapID")Integer providerServiceMapID,@Param("mainFacilityID") Integer mainFacilityID); - - - ArrayList findByMainFacilityIDAndDeletedOrderByFacilityName(Integer mainfacID,Boolean deleted); - - M_Facility findByFacilityIDAndDeleted(Integer mainfacID,Boolean deleted); + ArrayList getChildFacility(@Param("providerServiceMapID") Integer providerServiceMapID, + @Param("mainFacilityID") Integer mainFacilityID); + + ArrayList findByMainFacilityIDAndDeletedOrderByFacilityName(Integer mainfacID, Boolean deleted); + + M_Facility findByFacilityIDAndDeleted(Integer mainfacID, Boolean deleted); List findByFacilityCodeAndProviderServiceMapID(String facilityCode, Integer providerServiceMapID); - + M_Facility findByFacilityID(Integer facilityID); - + + ArrayList findByBlockIDAndDeletedFalseOrderByFacilityName(Integer blockID); + + ArrayList findByBlockIDOrderByFacilityName(Integer blockID); + + @Query("SELECT f FROM M_Facility f WHERE f.blockID = :blockID AND f.ruralUrban = :ruralUrban AND f.facilityTypeID IN " + + "(SELECT ft.facilityTypeID FROM M_facilitytype ft WHERE ft.levelValue = :levelValue " + + "AND ft.deleted = false) AND f.deleted = false ORDER BY f.facilityName") + ArrayList findByBlockIDAndFacilityLevel(@Param("blockID") Integer blockID, + @Param("levelValue") Integer levelValue, + @Param("ruralUrban") String ruralUrban); + + // All SCs in block regardless of rural/urban (for main village selection) + @Query("SELECT f FROM M_Facility f WHERE f.blockID = :blockID AND f.facilityTypeID IN " + + "(SELECT ft.facilityTypeID FROM M_facilitytype ft WHERE ft.levelValue = :levelValue " + + "AND ft.deleted = false) AND f.deleted = false ORDER BY f.facilityName") + ArrayList findByBlockIDAndLevelValue(@Param("blockID") Integer blockID, + @Param("levelValue") Integer levelValue); + + ArrayList findByParentFacilityIDAndDeletedFalseOrderByFacilityName(Integer parentFacilityID); + + List findByFacilityTypeIDAndDeletedFalse(Integer facilityTypeID); + + boolean existsByFacilityNameAndBlockIDAndDeletedFalse(String facilityName, Integer blockID); + + @Query("SELECT CASE WHEN COUNT(f) > 0 THEN true ELSE false END FROM M_Facility f WHERE f.facilityName = :facilityName AND f.blockID = :blockID AND f.facilityID != :facilityID AND f.deleted = false") + boolean existsByFacilityNameAndBlockIDAndNotFacilityID(@Param("facilityName") String facilityName, @Param("blockID") Integer blockID, @Param("facilityID") Integer facilityID); + + @Modifying + @Query("UPDATE M_Facility f SET f.parentFacilityID = NULL, f.modifiedBy = :modifiedBy WHERE f.parentFacilityID = :parentFacilityID") + int clearParentFacilityID(@Param("parentFacilityID") Integer parentFacilityID, + @Param("modifiedBy") String modifiedBy); + + @Modifying + @Query(value = "UPDATE m_facility SET IsMainFacility = :isMainFacility, MainFacilityID = :mainFacilityID, StoreType = :storeType WHERE FacilityID = :facilityID", nativeQuery = true) + int updateStoreFields(@Param("facilityID") Integer facilityID, + @Param("isMainFacility") Boolean isMainFacility, + @Param("mainFacilityID") Integer mainFacilityID, + @Param("storeType") String storeType); } diff --git a/src/main/java/com/iemr/admin/repository/user/AshaSupervisorMappingRepo.java b/src/main/java/com/iemr/admin/repository/user/AshaSupervisorMappingRepo.java new file mode 100644 index 00000000..f39acbd1 --- /dev/null +++ b/src/main/java/com/iemr/admin/repository/user/AshaSupervisorMappingRepo.java @@ -0,0 +1,73 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.repository.user; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.iemr.admin.data.employeemaster.AshaSupervisorMapping; + +@Repository +public interface AshaSupervisorMappingRepo extends CrudRepository { + + ArrayList findBySupervisorUserIDAndDeletedFalse(Integer supervisorUserID); + + ArrayList findByFacilityIDAndDeletedFalse(Integer facilityID); + + ArrayList findBySupervisorUserIDAndFacilityIDAndDeletedFalse(Integer supervisorUserID, Integer facilityID); + + ArrayList findBySupervisorUserIDAndFacilityIDInAndDeletedFalse(Integer supervisorUserID, List facilityIDs); + + AshaSupervisorMapping findBySupervisorUserIDAndAshaUserIDAndFacilityIDAndDeletedTrue(Integer supervisorUserID, Integer ashaUserID, Integer facilityID); + + ArrayList findByAshaUserIDAndDeletedFalse(Integer ashaUserID); + + ArrayList findByAshaUserIDAndFacilityIDAndDeletedFalse(Integer ashaUserID, Integer facilityID); + + // Fix 5: find active row for this ASHA at this facility under a DIFFERENT supervisor + ArrayList findByAshaUserIDAndFacilityIDAndDeletedFalseAndSupervisorUserIDNot( + Integer ashaUserID, Integer facilityID, Integer supervisorUserID); + + // Fix 6: find existing active row for exact (supervisor, ASHA, facility) — for idempotent save + AshaSupervisorMapping findBySupervisorUserIDAndAshaUserIDAndFacilityIDAndDeletedFalse( + Integer supervisorUserID, Integer ashaUserID, Integer facilityID); + + /** + * Get active supervisor mappings at a facility, excluding mappings where + * the supervisor user has been soft-deleted in m_User. + * Prevents deleted supervisors from blocking ASHA reassignment. + */ + @Query(value = "SELECT asm.*, " + + "(SELECT u.FirstName FROM m_User u WHERE u.UserID = asm.ashaUserID) AS ashaFirstName, " + + "(SELECT u.LastName FROM m_User u WHERE u.UserID = asm.ashaUserID) AS ashaLastName " + + "FROM asha_supervisor_mapping asm " + + "JOIN m_User su ON su.UserID = asm.supervisorUserID " + + "WHERE asm.facilityID = :facilityID " + + "AND asm.deleted = false " + + "AND su.Deleted = false", nativeQuery = true) + ArrayList findActiveMappingsByFacilityID(@Param("facilityID") Integer facilityID); +} diff --git a/src/main/java/com/iemr/admin/service/bulkRegistration/BulkRegistrationServiceImpl.java b/src/main/java/com/iemr/admin/service/bulkRegistration/BulkRegistrationServiceImpl.java index 0f2debf5..d1b5a9f1 100644 --- a/src/main/java/com/iemr/admin/service/bulkRegistration/BulkRegistrationServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/bulkRegistration/BulkRegistrationServiceImpl.java @@ -346,9 +346,7 @@ private void saveUserUser(Employee employee, Integer row, String authorization, mUser.setEmployeeID(employee.getUserName()); mUser.setServiceProviderID(serviceProviderID); mUser.setPassword(generateStrongPassword(employee.getPassword())); - logger.info("Register_user:" + mUser); M_User1 bulkUserID = employeeMasterInter.saveBulkUserEmployee(mUser); - logger.info("BulkUser:" + bulkUserID); // m_userServiceRoleMapping.setUserID(bulkUserID.getUserID()); // m_userServiceRoleMapping.setServiceProviderID(bulkUserID.getServiceProviderID()); // m_userServiceRoleMapping.setCreatedBy(createdBy); @@ -785,7 +783,6 @@ public byte[] insertErrorLog() { } catch (IOException e) { logger.error("IOException" + e.getMessage()); - e.printStackTrace(); } return baos.toByteArray(); diff --git a/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingService.java b/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingService.java new file mode 100644 index 00000000..077c4349 --- /dev/null +++ b/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingService.java @@ -0,0 +1,57 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.service.employeemaster; + +import java.util.ArrayList; +import java.util.List; + +import com.iemr.admin.data.employeemaster.AshaSupervisorMapping; +import com.iemr.admin.data.employeemaster.M_UserServiceRoleMapping2; + +public interface AshaSupervisorMappingService { + + ArrayList saveAshaSupervisorMappings(List mappings); + + ArrayList getSupervisorMappingByFacility(Integer facilityID); + + ArrayList getAshasByFacility(List facilityIDs); + + void deleteMappings(List ids, String modifiedBy); + + void deleteBySupervisorAndFacilities(Integer supervisorUserID, List facilityIDs, String modifiedBy); + + void restoreMappings(List ids, String modifiedBy); + + // Cascade: soft-delete all asha_supervisor_mapping rows for a user (as supervisor or ASHA) + void cascadeDeleteByUserID(Integer userID, String modifiedBy); + + // Cascade: soft-delete rows for a user at a specific old facility (role or facility change) + void cascadeDeleteByUserIDAndFacilityID(Integer userID, Integer facilityID, String modifiedBy); + + // Cascade: soft-delete all asha_supervisor_mapping rows for a facility (facility soft-deleted) + void cascadeDeleteByFacilityID(Integer facilityID, String modifiedBy); + + // Fix 7: atomic delete-old + save-new in one transaction + ArrayList updateAshaMappingsAtomically( + Integer supervisorUserID, List facilityIDs, + List newMappings, String modifiedBy); +} diff --git a/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingServiceImpl.java b/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingServiceImpl.java new file mode 100644 index 00000000..c287c188 --- /dev/null +++ b/src/main/java/com/iemr/admin/service/employeemaster/AshaSupervisorMappingServiceImpl.java @@ -0,0 +1,206 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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.service.employeemaster; + +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.iemr.admin.data.employeemaster.AshaSupervisorMapping; +import com.iemr.admin.data.employeemaster.M_UserServiceRoleMapping2; +import com.iemr.admin.data.store.M_Facility; +import com.iemr.admin.repo.employeemaster.EmployeeMasterRepo; +import com.iemr.admin.repository.store.MainStoreRepo; +import com.iemr.admin.repository.user.AshaSupervisorMappingRepo; + +@Service +public class AshaSupervisorMappingServiceImpl implements AshaSupervisorMappingService { + + private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); + + @Autowired + private AshaSupervisorMappingRepo ashaSupervisorMappingRepo; + + @Autowired + private EmployeeMasterRepo employeeMasterRepo; + + @Autowired + private MainStoreRepo mainStoreRepo; + + @Transactional + @Override + public ArrayList saveAshaSupervisorMappings(List mappings) { + ArrayList savedMappings = new ArrayList<>(); + for (AshaSupervisorMapping mapping : mappings) { + // Fix 12: reject if facilityID points to a soft-deleted or missing facility + M_Facility facility = mainStoreRepo.findByFacilityIDAndDeleted(mapping.getFacilityID(), false); + if (facility == null) { + throw new RuntimeException("Facility ID " + mapping.getFacilityID() + + " is no longer active. Cannot save ASHA supervisor mapping."); + } + // Fix 6: skip if identical active row already exists (network retry / duplicate save) + AshaSupervisorMapping existingActive = ashaSupervisorMappingRepo + .findBySupervisorUserIDAndAshaUserIDAndFacilityIDAndDeletedFalse( + mapping.getSupervisorUserID(), mapping.getAshaUserID(), mapping.getFacilityID()); + if (existingActive != null) { + savedMappings.add(existingActive); + continue; + } + // Fix 5: if ASHA already has an active row under a DIFFERENT supervisor → soft-delete it + ArrayList otherSupervisorMappings = ashaSupervisorMappingRepo + .findByAshaUserIDAndFacilityIDAndDeletedFalseAndSupervisorUserIDNot( + mapping.getAshaUserID(), mapping.getFacilityID(), mapping.getSupervisorUserID()); + for (AshaSupervisorMapping old : otherSupervisorMappings) { + old.setDeleted(true); + old.setModifiedBy(mapping.getCreatedBy()); + ashaSupervisorMappingRepo.save(old); + } + // Always create new row for clean audit trail (old soft-deleted rows stay as history) + savedMappings.add(ashaSupervisorMappingRepo.save(mapping)); + } + return savedMappings; + } + + @Override + public ArrayList getSupervisorMappingByFacility(Integer facilityID) { + // Use native query that also filters out mappings where supervisor user is deleted + return ashaSupervisorMappingRepo.findActiveMappingsByFacilityID(facilityID); + } + + @Override + public ArrayList getAshasByFacility(List facilityIDs) { + return employeeMasterRepo.findAshaUsersByFacilityIDs(facilityIDs); + } + + @Transactional + @Override + public void deleteMappings(List ids, String modifiedBy) { + for (Long id : ids) { + AshaSupervisorMapping mapping = ashaSupervisorMappingRepo.findById(id).orElse(null); + if (mapping != null) { + mapping.setDeleted(true); + mapping.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(mapping); + } + } + } + + @Transactional + @Override + public void deleteBySupervisorAndFacilities(Integer supervisorUserID, List facilityIDs, String modifiedBy) { + ArrayList mappings = ashaSupervisorMappingRepo + .findBySupervisorUserIDAndFacilityIDInAndDeletedFalse(supervisorUserID, facilityIDs); + for (AshaSupervisorMapping mapping : mappings) { + mapping.setDeleted(true); + mapping.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(mapping); + } + } + + @Transactional + @Override + public void restoreMappings(List ids, String modifiedBy) { + for (Long id : ids) { + AshaSupervisorMapping mapping = ashaSupervisorMappingRepo.findById(id).orElse(null); + if (mapping != null) { + mapping.setDeleted(false); + mapping.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(mapping); + } + } + } + + @Transactional + @Override + public void cascadeDeleteByUserID(Integer userID, String modifiedBy) { + // Soft-delete all rows where this user is supervisor + ArrayList asSupervisor = ashaSupervisorMappingRepo + .findBySupervisorUserIDAndDeletedFalse(userID); + logger.info("cascadeDeleteByUserID: userID={}, found {} supervisor rows to soft-delete", userID, asSupervisor.size()); + for (AshaSupervisorMapping m : asSupervisor) { + m.setDeleted(true); + m.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(m); + } + // Soft-delete all rows where this user is ASHA + ArrayList asAsha = ashaSupervisorMappingRepo + .findByAshaUserIDAndDeletedFalse(userID); + logger.info("cascadeDeleteByUserID: userID={}, found {} ASHA rows to soft-delete", userID, asAsha.size()); + for (AshaSupervisorMapping m : asAsha) { + m.setDeleted(true); + m.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(m); + } + } + + @Transactional + @Override + public void cascadeDeleteByFacilityID(Integer facilityID, String modifiedBy) { + // Fix 8: soft-delete all asha_supervisor_mapping rows for a deleted facility + ArrayList mappings = ashaSupervisorMappingRepo.findByFacilityIDAndDeletedFalse(facilityID); + for (AshaSupervisorMapping m : mappings) { + m.setDeleted(true); + m.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(m); + } + } + + @Transactional + @Override + public void cascadeDeleteByUserIDAndFacilityID(Integer userID, Integer facilityID, String modifiedBy) { + // Soft-delete rows where this user is supervisor at this facility + ArrayList asSupervisor = ashaSupervisorMappingRepo + .findBySupervisorUserIDAndFacilityIDAndDeletedFalse(userID, facilityID); + for (AshaSupervisorMapping m : asSupervisor) { + m.setDeleted(true); + m.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(m); + } + // Soft-delete rows where this user is ASHA at this facility + ArrayList asAsha = ashaSupervisorMappingRepo + .findByAshaUserIDAndFacilityIDAndDeletedFalse(userID, facilityID); + for (AshaSupervisorMapping m : asAsha) { + m.setDeleted(true); + m.setModifiedBy(modifiedBy); + ashaSupervisorMappingRepo.save(m); + } + } + + @Transactional + @Override + public ArrayList updateAshaMappingsAtomically( + Integer supervisorUserID, List facilityIDs, + List newMappings, String modifiedBy) { + // Fix 7: delete old + save new in a SINGLE transaction + // If anything fails, the entire operation rolls back — no partial wipe + deleteBySupervisorAndFacilities(supervisorUserID, facilityIDs, modifiedBy); + if (newMappings != null && !newMappings.isEmpty()) { + return saveAshaSupervisorMappings(newMappings); + } + return new ArrayList<>(); + } +} diff --git a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterInter.java b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterInter.java index ff284cbe..81b5f454 100644 --- a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterInter.java +++ b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterInter.java @@ -163,6 +163,12 @@ Boolean checkingEmpDetails(String userName, String aadhaarNo, String getpAN, Str // M_UserServiceRoleMapping2 saveRoleMappingeditedData(M_UserServiceRoleMapping2 usrRole, String string); public M_UserServiceRoleMapping2 saveRoleMappingeditedData(M_UserServiceRoleMapping2 usrRole, String authToken) throws JsonMappingException, JsonProcessingException; + // Fix 2: cascade soft-delete asha_supervisor_mapping rows when a user is deactivated + void cascadeDeleteAshaMappingsForUser(Integer userID); + + // Fix 2: smart cascade — for supervisor with multiple facilities, only delete mappings for this facility + void cascadeDeleteAshaMappingsForDeactivation(M_UserServiceRoleMapping2 usrRole); + // ArrayList getMappedLanguge(); ArrayList getMappedRole(Integer serviceProviderID); 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 e3ae01ad..f4c07f36 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; @@ -96,8 +97,13 @@ import com.iemr.admin.repo.employeemaster.ShowuserdetailsfromuserservicerolemappingRepo; import com.iemr.admin.repo.employeemaster.V_ShowuserRepo; import com.iemr.admin.repo.employeemaster.V_UserservicerolemappingRepo; +import com.iemr.admin.data.facilitytype.M_facilitytype; +import com.iemr.admin.data.store.M_Facility; +import com.iemr.admin.repository.facilitytype.M_facilitytypeRepo; import com.iemr.admin.repository.provideronboard.M_ServiceMasterRepo; import com.iemr.admin.repository.rolemaster.M_UserservicerolemappingForRoleProviderAdminRepo; +import com.iemr.admin.repository.store.MainStoreRepo; +import com.iemr.admin.service.employeemaster.AshaSupervisorMappingService; import com.iemr.admin.service.user.EncryptUserPassword; import com.iemr.admin.utils.CookieUtil; import com.iemr.admin.utils.RestTemplateUtil; @@ -113,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"; @@ -139,6 +148,9 @@ public class EmployeeMasterServiceImpl implements EmployeeMasterInter { @Autowired private MProviderservicemappingBlockingRepo mProviderservicemappingBlockingRepo; + @Autowired + private AshaSupervisorMappingService ashaSupervisorMappingService; + @Autowired private EncryptUserPassword encryptUserPassword; @Autowired @@ -192,6 +204,12 @@ public void setConfigProperties(ConfigProperties configProperties) { @Autowired M_ServiceMasterRepo serviceMasterRepo; + + @Autowired + private MainStoreRepo mainStoreRepo; + + @Autowired + private M_facilitytypeRepo facilityTypeRepo; @Autowired private EmployeeSignatureRepo employeeSignatureRepo; @@ -328,6 +346,61 @@ public ArrayList mapLanguage(List resList) @Override public ArrayList mapRole(List resList1, String authToken) throws JsonMappingException, JsonProcessingException { + // Fix 4 + Fix 16 + Fix 17: validate each mapping before any save + for (M_UserServiceRoleMapping2 mapping : resList1) { + M_Role role = null; + if (mapping.getRoleID() != null) { + role = roleRepo.findByRoleID(mapping.getRoleID()); + // Fix 4: ASHA must have a facilityID + if (role != null && "asha".equalsIgnoreCase(role.getRoleName()) + && mapping.getFacilityID() == null) { + throw new RuntimeException( + "Facility (SC) is mandatory for ASHA role. Please select a facility before saving."); + } + } + if (mapping.getFacilityID() != null) { + M_Facility facility = mainStoreRepo.findByFacilityIDAndDeleted(mapping.getFacilityID(), false); + // Fix 16: facility must not be soft-deleted + if (facility == null) { + throw new RuntimeException("Facility ID " + mapping.getFacilityID() + + " is no longer active. Please select a valid facility."); + } + // Fix 17: ASHA must be at SC level (max levelValue for this service line) + if (role != null && "asha".equalsIgnoreCase(role.getRoleName()) + && facility.getFacilityTypeID() != null + && mapping.getProviderServiceMapID() != null) { + M_facilitytype ft = facilityTypeRepo.findByFacilityTypeID(facility.getFacilityTypeID()); + Integer maxLevel = facilityTypeRepo + .findMaxLevelValueByProviderServiceMapID(mapping.getProviderServiceMapID()); + if (ft != null && maxLevel != null && ft.getLevelValue() != null + && !ft.getLevelValue().equals(maxLevel)) { + throw new RuntimeException( + "ASHA role must be mapped to a Sub-Centre (SC) level facility. Please select a facility at the lowest hierarchy level."); + } + } + } + // Fix 18: prevent duplicate active USR row (same user + role + service line) + // ASHA Supervisor can have multiple USR rows (one per facility) — check user+role+PSMID+facilityID + boolean isAshaSupervisor = role != null && "asha supervisor".equalsIgnoreCase(role.getRoleName()); + if (mapping.getUserID() != null && mapping.getRoleID() != null + && mapping.getProviderServiceMapID() != null) { + if (isAshaSupervisor) { + if (mapping.getFacilityID() != null && employeeMasterRepo + .existsByUserIDAndRoleIDAndProviderServiceMapIDAndFacilityIDAndDeletedFalse( + mapping.getUserID(), mapping.getRoleID(), + mapping.getProviderServiceMapID(), mapping.getFacilityID())) { + throw new RuntimeException( + "User already has an active work location mapping for this facility. Duplicate mapping is not allowed."); + } + } else { + if (employeeMasterRepo.existsByUserIDAndRoleIDAndProviderServiceMapIDAndDeletedFalse( + mapping.getUserID(), mapping.getRoleID(), mapping.getProviderServiceMapID())) { + throw new RuntimeException( + "User already has an active work location mapping with this role and service line. Duplicate mapping is not allowed."); + } + } + } + } ArrayList reslist = (ArrayList) employeeMasterRepo .saveAll(resList1); if (ENABLE_CTI_USER_CREATION) { @@ -470,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); @@ -713,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(); @@ -747,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(); @@ -943,9 +1018,108 @@ public M_UserServiceRoleMapping2 getDataUsrId(Integer uSRMappingID) { return data; } + @Override + public void cascadeDeleteAshaMappingsForUser(Integer userID) { + // Fix 2: called from controller BEFORE setDeleted() to avoid JPA L1 cache issue + ashaSupervisorMappingService.cascadeDeleteByUserID(userID, "Admin"); + } + + @Override + public void cascadeDeleteAshaMappingsForDeactivation(M_UserServiceRoleMapping2 usrRole) { + Integer userID = usrRole.getUserID(); + M_Role role = usrRole.getRoleID() != null ? roleRepo.findByRoleID(usrRole.getRoleID()) : null; + boolean isSupervisor = role != null && "asha supervisor".equalsIgnoreCase(role.getRoleName()); + if (isSupervisor && usrRole.getFacilityID() != null) { + // Count active USR rows for this user+role (exclude current row being deleted) + long activeCount = employeeMasterRepo.countByUserIDAndRoleIDAndDeletedFalse(userID, usrRole.getRoleID()) - 1; + if (activeCount > 0) { + // Other facilities still active — only delete this supervisor's mappings at this facility + ashaSupervisorMappingService.cascadeDeleteByUserIDAndFacilityID(userID, usrRole.getFacilityID(), "Admin"); + return; + } + } + // Last facility or non-supervisor — delete all + ashaSupervisorMappingService.cascadeDeleteByUserID(userID, "Admin"); + } + @Override public M_UserServiceRoleMapping2 saveRoleMappingeditedData(M_UserServiceRoleMapping2 usrRole, String authToken) throws JsonMappingException, JsonProcessingException { + // Fix 4 + Fix 16 + Fix 17 + Fix 14: validate only on create/update, skip for deactivation + M_Role role = null; + if (!Boolean.TRUE.equals(usrRole.getDeleted())) { + if (usrRole.getRoleID() != null) { + role = roleRepo.findByRoleID(usrRole.getRoleID()); + // Fix 4: ASHA must have a facilityID + if (role != null && "asha".equalsIgnoreCase(role.getRoleName()) + && usrRole.getFacilityID() == null) { + throw new RuntimeException( + "Facility (SC) is mandatory for ASHA role. Please select a facility before saving."); + } + } + if (usrRole.getFacilityID() != null) { + M_Facility facility = mainStoreRepo.findByFacilityIDAndDeleted(usrRole.getFacilityID(), false); + // Fix 16: facility must not be soft-deleted + if (facility == null) { + throw new RuntimeException("Facility ID " + usrRole.getFacilityID() + + " is no longer active. Please select a valid facility."); + } + if (facility.getFacilityTypeID() != null && usrRole.getProviderServiceMapID() != null) { + M_facilitytype ft = facilityTypeRepo.findByFacilityTypeID(facility.getFacilityTypeID()); + Integer maxLevel = facilityTypeRepo + .findMaxLevelValueByProviderServiceMapID(usrRole.getProviderServiceMapID()); + // Fix 17: ASHA must be at SC level + if (role != null && "asha".equalsIgnoreCase(role.getRoleName()) + && ft != null && maxLevel != null && ft.getLevelValue() != null + && !ft.getLevelValue().equals(maxLevel)) { + throw new RuntimeException( + "ASHA role must be mapped to a Sub-Centre (SC) level facility. Please select a facility at the lowest hierarchy level."); + } + // Fix 14: non-SC facility → clear saved village mappings + if (ft != null && maxLevel != null && ft.getLevelValue() != null + && !ft.getLevelValue().equals(maxLevel)) { + usrRole.setVillageidDb(null); + usrRole.setVillageNameDb(null); + } + } + } + } + + // CASCADE: fetch old USR row and soft-delete stale asha_supervisor_mapping rows + if (usrRole.getuSRMappingID() != null) { + M_UserServiceRoleMapping2 oldUSR = employeeMasterRepo.findById(usrRole.getuSRMappingID()).orElse(null); + if (oldUSR != null) { + Integer userID = oldUSR.getUserID(); + // Fix 1 & 11: Role changed → cascade soft-delete all mappings for this user + if (oldUSR.getRoleID() != null && !oldUSR.getRoleID().equals(usrRole.getRoleID())) { + ashaSupervisorMappingService.cascadeDeleteByUserID(userID, "Admin"); + } + // Fix 2: User deleted/deactivated → cascade soft-delete mappings + // For ASHA Supervisor with multiple facilities: only delete mappings for this facilityID + // For other roles or single facility: delete all mappings for this user + if (Boolean.TRUE.equals(usrRole.getDeleted()) && !Boolean.TRUE.equals(oldUSR.getDeleted())) { + M_Role oldRole = oldUSR.getRoleID() != null ? roleRepo.findByRoleID(oldUSR.getRoleID()) : null; + boolean isSupervisor = oldRole != null && "asha supervisor".equalsIgnoreCase(oldRole.getRoleName()); + // Check if supervisor still has other active USR rows + // Count excludes current row being deleted (subtract 1 since it's still active in DB) + long activeCount = isSupervisor ? employeeMasterRepo.countByUserIDAndRoleIDAndDeletedFalse(userID, oldUSR.getRoleID()) - 1 : 0; + if (isSupervisor && activeCount > 0 && oldUSR.getFacilityID() != null) { + // Other facilities still active — only delete mappings for this facility + ashaSupervisorMappingService.cascadeDeleteByFacilityID(oldUSR.getFacilityID(), "Admin"); + } else { + // Last facility or non-supervisor — delete all + ashaSupervisorMappingService.cascadeDeleteByUserID(userID, "Admin"); + } + } + // Fix 3, 9, 10: Facility changed → cascade delete ALL asha_supervisor_mapping rows for this user + // Supervisor may have multiple facilityIDs in asha_supervisor_mapping (SC1, SC2, SC3) + // but USR stores only one facilityID — so delete all, not just the old facilityID + if (oldUSR.getFacilityID() != null && !oldUSR.getFacilityID().equals(usrRole.getFacilityID())) { + ashaSupervisorMappingService.cascadeDeleteByUserID(userID, "Admin"); + } + } + } + M_UserServiceRoleMapping2 data = employeeMasterRepo.save(usrRole); if (ENABLE_CTI_USER_CREATION) { List list = new ArrayList(); @@ -1004,7 +1178,61 @@ public ArrayList getMappedRole(Integer serviceProvider ArrayList mappedRoles = new ArrayList<>(); if (getData != null) { + // Collect mapping IDs where stateID OR workingDistrictID is null + // (view derives these from WorkingLocationID JOIN — null when workLocationID was nullified for HWC/FLW) + List patchMappingIDs = new ArrayList<>(); + for (V_Userservicerolemapping mapping : getData) { + if (mapping.getuSRMappingID() != null + && (mapping.getStateID() == null || mapping.getWorkingDistrictID() == null)) { + patchMappingIDs.add(mapping.getuSRMappingID()); + } + } + + // Batch lookup: get stateID/districtID directly from m_userservicerolemapping table + Map stateDistrictMap = new HashMap<>(); + if (!patchMappingIDs.isEmpty()) { + List results = employeeMasterRepo.getDirectStateDistrictByMappingIDs(patchMappingIDs); + for (Object[] row : results) { + stateDistrictMap.put((Integer) row[0], row); + } + } + + // Batch lookup: get facilityID/Name/TypeID/ruralUrban from m_userservicerolemapping + m_facility + List allMappingIDs = new ArrayList<>(); for (V_Userservicerolemapping mapping : getData) { + if (mapping.getuSRMappingID() != null) { + allMappingIDs.add(mapping.getuSRMappingID()); + } + } + Map facilityMap = new HashMap<>(); + if (!allMappingIDs.isEmpty()) { + List facilityResults = employeeMasterRepo.getFacilityInfoByMappingIDs(allMappingIDs); + for (Object[] row : facilityResults) { + facilityMap.put((Integer) row[0], row); + } + } + + for (V_Userservicerolemapping mapping : getData) { + // Patch null stateID/districtID/blockID from direct columns in m_userservicerolemapping + if (stateDistrictMap.containsKey(mapping.getuSRMappingID())) { + Object[] row = stateDistrictMap.get(mapping.getuSRMappingID()); + if (mapping.getStateID() == null && row[1] != null) mapping.setStateID((Integer) row[1]); + if (mapping.getStateName() == null && row[2] != null) mapping.setStateName((String) row[2]); + if (mapping.getWorkingDistrictID() == null && row[3] != null) mapping.setWorkingDistrictID(String.valueOf(row[3])); + if (mapping.getWorkingDistrictName() == null && row[4] != null) mapping.setWorkingDistrictName((String) row[4]); + if (mapping.getBlockID() == null && row[5] != null) mapping.setBlockID((Integer) row[5]); + if (mapping.getBlockName() == null && row[6] != null) mapping.setBlockName((String) row[6]); + } + + // Set facility info from batch lookup + if (facilityMap.containsKey(mapping.getuSRMappingID())) { + Object[] fRow = facilityMap.get(mapping.getuSRMappingID()); + if (fRow[1] != null) mapping.setFacilityID((Integer) fRow[1]); + if (fRow[2] != null) mapping.setFacilityName((String) fRow[2]); + if (fRow[3] != null) mapping.setFacilityTypeID((Integer) fRow[3]); + if (fRow[4] != null) mapping.setRuralUrban((String) fRow[4]); + } + if (mapping.getVillageidDb() != null) { mapping.setVillageID(mapping.getVillageidDb().split(",")); } else { diff --git a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeSignatureServiceImpl.java b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeSignatureServiceImpl.java index fd4a0470..b22175c2 100644 --- a/src/main/java/com/iemr/admin/service/employeemaster/EmployeeSignatureServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/employeemaster/EmployeeSignatureServiceImpl.java @@ -72,6 +72,8 @@ public Boolean isSignatureActive(Long userID) { return employeeSignatureRepo.countByUserIDAndSignatureNotNullAndDeletedFalse(userID) > 0; } + + @Override public EmployeeSignature updateUserSignatureStatus(String activateUser) { JSONObject obj = new JSONObject(activateUser); diff --git a/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeInter.java b/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeInter.java index bcb14d1f..a3c8d3fa 100644 --- a/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeInter.java +++ b/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeInter.java @@ -38,4 +38,14 @@ public interface M_facilitytypeInter { Boolean checkFacilityTypeCode(M_facilitytype manufacturer); + ArrayList getFacilityTypesByRuralUrban(Integer providerServiceMapID, String ruralUrban); + + ArrayList getFacilityLevels(); + + ArrayList getFacilityTypesByBlock(Integer blockID); + + ArrayList getFacilityTypesByState(Integer stateID); + + boolean checkFacilityTypeNameExists(String facilityTypeName, Integer stateID); + } diff --git a/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeServiceImpl.java b/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeServiceImpl.java index 17bb0d78..e339973a 100644 --- a/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/facilitytype/M_facilitytypeServiceImpl.java @@ -28,46 +28,82 @@ import org.springframework.stereotype.Service; import com.iemr.admin.data.facilitytype.M_facilitytype; -import com.iemr.admin.data.manufacturer.M_Manufacturer; +import com.iemr.admin.data.store.M_FacilityLevel; +import com.iemr.admin.repository.facilitytype.M_FacilityLevelRepo; import com.iemr.admin.repository.facilitytype.M_facilitytypeRepo; @Service -public class M_facilitytypeServiceImpl implements M_facilitytypeInter{ +public class M_facilitytypeServiceImpl implements M_facilitytypeInter { @Autowired private M_facilitytypeRepo m_facilitytypeRepo; + @Autowired + private M_FacilityLevelRepo m_facilityLevelRepo; + @Override public ArrayList getAllFicilityData(Integer providerServiceMapID) { - ArrayList data=m_facilitytypeRepo.getAllFicilityData(providerServiceMapID); + ArrayList data = m_facilitytypeRepo.getAllFicilityData(providerServiceMapID); return data; } + @Override + public ArrayList getFacilityTypesByRuralUrban(Integer providerServiceMapID, String ruralUrban) { + return new ArrayList<>(m_facilitytypeRepo.findByProviderServiceMapIDAndRuralUrban(providerServiceMapID, ruralUrban)); + } + @Override public ArrayList addAllFicilityData(List addfacilityDetails) { - ArrayList data=(ArrayList) m_facilitytypeRepo.saveAll(addfacilityDetails); + for (M_facilitytype ft : addfacilityDetails) { + if (m_facilitytypeRepo.existsByFacilityTypeNameAndStateIDAndDeletedFalse( + ft.getFacilityTypeName(), ft.getStateID())) { + throw new RuntimeException("Facility type '" + ft.getFacilityTypeName() + "' already exists"); + } + } + ArrayList data = (ArrayList) m_facilitytypeRepo.saveAll(addfacilityDetails); return data; } @Override public M_facilitytype editAllFicilityData(Integer facilityTypeID) { - M_facilitytype data=m_facilitytypeRepo.findByFacilityTypeID(facilityTypeID); + M_facilitytype data = m_facilitytypeRepo.findByFacilityTypeID(facilityTypeID); return data; } @Override public M_facilitytype updateFacilityData(M_facilitytype allFacilityData) { - M_facilitytype data=m_facilitytypeRepo.save(allFacilityData); + M_facilitytype data = m_facilitytypeRepo.save(allFacilityData); return data; } @Override public Boolean checkFacilityTypeCode(M_facilitytype manufacturer) { // TODO Auto-generated method stub - List manuList=m_facilitytypeRepo.findByFacilityTypeCodeAndProviderServiceMapID(manufacturer.getFacilityTypeCode() ,manufacturer.getProviderServiceMapID()); - if(manuList.size()>0) + List manuList = m_facilitytypeRepo.findByFacilityTypeCodeAndProviderServiceMapID( + manufacturer.getFacilityTypeCode(), manufacturer.getProviderServiceMapID()); + if (manuList.size() > 0) return true; return false; } + @Override + public ArrayList getFacilityLevels() { + return m_facilityLevelRepo.findByDeletedFalseOrderByLevelName(); + } + + @Override + public ArrayList getFacilityTypesByBlock(Integer blockID) { + return new ArrayList<>(m_facilitytypeRepo.findFacilityTypesByBlock(blockID)); + } + + @Override + public ArrayList getFacilityTypesByState(Integer stateID) { + return new ArrayList<>(m_facilitytypeRepo.findByStateID(stateID)); + } + + @Override + public boolean checkFacilityTypeNameExists(String facilityTypeName, Integer stateID) { + return m_facilitytypeRepo.existsByFacilityTypeNameAndStateIDAndDeletedFalse(facilityTypeName, stateID); + } + } diff --git a/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingImpl.java b/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingImpl.java index 2d5ce00f..e12a8444 100644 --- a/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingImpl.java +++ b/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingImpl.java @@ -91,6 +91,11 @@ public ArrayList getAllFacilityMappedData(Integer provid return data; } + @Override + public ArrayList getItemMappingsByFacilityID(Integer facilityID) { + return v_fetchItemFacilityMapRepo.getItemMappingsByFacilityAndSubStores(facilityID); + } + @Override public List getItemMastersFromStoreID(Integer storeID) { // TODO Auto-generated method stub diff --git a/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingInter.java b/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingInter.java index d41d661e..54115cfc 100644 --- a/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingInter.java +++ b/src/main/java/com/iemr/admin/service/itemfacilitymapping/M_itemfacilitymappingInter.java @@ -39,7 +39,9 @@ public interface M_itemfacilitymappingInter{ ArrayList getsubitemforsubStote(Integer providerServiceMapID, Integer facilityID); ArrayList getAllFacilityMappedData(Integer providerServiceMapID); - + + ArrayList getItemMappingsByFacilityID(Integer facilityID); + List getItemMastersFromStoreID(Integer storeID); Integer deleteItemStoreMapping(M_itemfacilitymapping storeID); 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 009842c4..19ef7496 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/store/FacilityHierarchyService.java b/src/main/java/com/iemr/admin/service/store/FacilityHierarchyService.java new file mode 100644 index 00000000..d41ab4e4 --- /dev/null +++ b/src/main/java/com/iemr/admin/service/store/FacilityHierarchyService.java @@ -0,0 +1,5 @@ +package com.iemr.admin.service.store; + +public class FacilityHierarchyService { + +} diff --git a/src/main/java/com/iemr/admin/service/store/FacilityHierarchyServiceImpl.java b/src/main/java/com/iemr/admin/service/store/FacilityHierarchyServiceImpl.java new file mode 100644 index 00000000..e69de29b diff --git a/src/main/java/com/iemr/admin/service/store/StoreService.java b/src/main/java/com/iemr/admin/service/store/StoreService.java index 3c0edd2b..5f76ab2f 100644 --- a/src/main/java/com/iemr/admin/service/store/StoreService.java +++ b/src/main/java/com/iemr/admin/service/store/StoreService.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; +import com.iemr.admin.data.store.FacilityVillageMapping; import com.iemr.admin.data.store.M_Facility; import com.iemr.admin.data.store.M_facilityMap; import com.iemr.admin.data.store.V_FetchFacility; @@ -54,9 +55,23 @@ public interface StoreService { List getMapStore(V_FetchFacility facilitymap); Boolean checkStoreCode(M_Facility manufacturer); - - - - + ArrayList getFacilitiesByBlock(Integer blockID); + + ArrayList getAllFacilitiesByBlock(Integer blockID); + + ArrayList getFacilitiesByBlockAndLevel(Integer blockID, Integer levelValue, String ruralUrban); + + M_Facility createFacilityWithHierarchy(M_Facility facility, List villageIDs, Integer mainVillageID, List childFacilityIDs); + + List getMappedVillageIDs(Integer blockID); + + ArrayList getVillageMappingsByFacility(Integer facilityID); + + ArrayList getChildFacilitiesByParent(Integer parentFacilityID); + + M_Facility updateFacilityWithHierarchy(M_Facility facility, List villageIDs, Integer mainVillageID, List childFacilityIDs); + + M_Facility deleteFacilityWithHierarchy(Integer facilityID, String modifiedBy) throws Exception; + } diff --git a/src/main/java/com/iemr/admin/service/store/StoreServiceImpl.java b/src/main/java/com/iemr/admin/service/store/StoreServiceImpl.java index da1bba87..a08e8cd3 100644 --- a/src/main/java/com/iemr/admin/service/store/StoreServiceImpl.java +++ b/src/main/java/com/iemr/admin/service/store/StoreServiceImpl.java @@ -26,17 +26,22 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.iemr.admin.data.facilitytype.M_facilitytype; import com.iemr.admin.data.parkingPlace.M_Parkingplace; +import com.iemr.admin.data.store.FacilityVillageMapping; import com.iemr.admin.data.store.M_Facility; import com.iemr.admin.data.store.M_facilityMap; import com.iemr.admin.data.store.V_FetchFacility; import com.iemr.admin.data.vanMaster.M_Van; +import com.iemr.admin.repository.facilitytype.M_facilitytypeRepo; import com.iemr.admin.repository.parkingPlace.ParkingPlaceRepository; +import com.iemr.admin.repository.store.FacilityVillageMappingRepo; import com.iemr.admin.repository.store.MainStoreRepo; import com.iemr.admin.repository.store.V_FetchFacilityRepo; import com.iemr.admin.repository.vanMaster.VanMasterRepository; +import com.iemr.admin.service.employeemaster.AshaSupervisorMappingService; import com.iemr.admin.utils.exception.IEMRException; @Service @@ -54,6 +59,15 @@ public class StoreServiceImpl implements StoreService { @Autowired private V_FetchFacilityRepo fetchFacilityRepo; + @Autowired + private FacilityVillageMappingRepo facilityVillageMappingRepo; + + @Autowired + private AshaSupervisorMappingService ashaSupervisorMappingService; + + @Autowired + private M_facilitytypeRepo facilityTypeRepo; + // @Autowired // private SubStoreRepo subStoreRepo; @@ -86,7 +100,7 @@ public M_Facility getMainStore(Integer mainStoreID) { @Override public List getAllMainStore(Integer providerServiceMapID) { // TODO Auto-generated method stub - return (List) mainStoreRepo.findByProviderServiceMapIDOrderByFacilityName(providerServiceMapID); + return (List) mainStoreRepo.findByProviderServiceMapIDOrNullOrderByFacilityName(providerServiceMapID); } // @Override @@ -233,4 +247,288 @@ public Boolean checkStoreCode(M_Facility manufacturer) { return false; } + @Override + public ArrayList getFacilitiesByBlock(Integer blockID) { + return mainStoreRepo.findByBlockIDAndDeletedFalseOrderByFacilityName(blockID); + } + + @Override + public ArrayList getAllFacilitiesByBlock(Integer blockID) { + return mainStoreRepo.findByBlockIDOrderByFacilityName(blockID); + } + + @Override + public ArrayList getFacilitiesByBlockAndLevel(Integer blockID, Integer levelValue, String ruralUrban) { + if (ruralUrban == null || ruralUrban.isEmpty()) { + return mainStoreRepo.findByBlockIDAndLevelValue(blockID, levelValue); + } + return mainStoreRepo.findByBlockIDAndFacilityLevel(blockID, levelValue, ruralUrban); + } + + @Transactional + @Override + public M_Facility createFacilityWithHierarchy(M_Facility facility, List villageIDs, + Integer mainVillageID, List childFacilityIDs) { + if (mainStoreRepo.existsByFacilityNameAndBlockIDAndDeletedFalse(facility.getFacilityName(), facility.getBlockID())) { + throw new RuntimeException("Facility with this name already exists in this block"); + } + // Fix 20: validate that child facilities selected are exactly one level below this facility + // (parentFacilityID is not sent from frontend on create; the hierarchy is built via childFacilityIDs) + if (childFacilityIDs != null && !childFacilityIDs.isEmpty() + && facility.getFacilityTypeID() != null) { + M_facilitytype ft = facilityTypeRepo.findByFacilityTypeID(facility.getFacilityTypeID()); + if (ft != null && ft.getLevelValue() != null) { + for (Integer childID : childFacilityIDs) { + M_Facility child = mainStoreRepo.findByFacilityIDAndDeleted(childID, false); + if (child != null && child.getFacilityTypeID() != null) { + M_facilitytype childFt = facilityTypeRepo.findByFacilityTypeID(child.getFacilityTypeID()); + if (childFt != null && childFt.getLevelValue() != null + && !childFt.getLevelValue().equals(ft.getLevelValue() + 1)) { + throw new RuntimeException( + "Hierarchy level mismatch: selected child facility is not at the expected level. " + + "Children must be exactly one level below this facility."); + } + } + } + } + } + facility.setMainVillageID(mainVillageID); + M_Facility savedFacility = mainStoreRepo.save(facility); + + if (villageIDs != null && !villageIDs.isEmpty()) { + for (Integer villageID : villageIDs) { + FacilityVillageMapping existing = facilityVillageMappingRepo + .findByFacilityIDAndDistrictBranchIDAndDeletedTrue(savedFacility.getFacilityID(), villageID); + if (existing != null) { + existing.setDeleted(false); + existing.setModifiedBy(facility.getCreatedBy()); + facilityVillageMappingRepo.save(existing); + } else { + FacilityVillageMapping mapping = new FacilityVillageMapping(); + mapping.setFacilityID(savedFacility.getFacilityID()); + mapping.setDistrictBranchID(villageID); + mapping.setCreatedBy(facility.getCreatedBy()); + mapping.setDeleted(false); + facilityVillageMappingRepo.save(mapping); + } + } + } + + if (childFacilityIDs != null && !childFacilityIDs.isEmpty()) { + for (Integer childID : childFacilityIDs) { + M_Facility child = mainStoreRepo.findByFacilityID(childID); + if (child != null) { + child.setParentFacilityID(savedFacility.getFacilityID()); + child.setModifiedBy(facility.getCreatedBy()); + mainStoreRepo.save(child); + + // Only update store fields for NEW hierarchy facilities (PSMID is NULL) + // Existing stores (PSMID set) keep their store chain intact for inventory compatibility + if (child.getProviderServiceMapID() == null) { + if (child.getIsMainFacility() == null || child.getIsMainFacility()) { + mainStoreRepo.updateStoreFields(childID, false, + savedFacility.getFacilityID(), "SUB"); + } + } + } + } + } + + return savedFacility; + } + + @Override + public List getMappedVillageIDs(Integer blockID) { + return facilityVillageMappingRepo.findMappedVillageIDsByBlockID(blockID); + } + + @Override + public ArrayList getVillageMappingsByFacility(Integer facilityID) { + // Return empty if facility itself is deleted + M_Facility facility = mainStoreRepo.findByFacilityIDAndDeleted(facilityID, false); + if (facility == null) { + return new ArrayList<>(); + } + return facilityVillageMappingRepo.findByFacilityIDAndDeletedFalse(facilityID); + } + + @Override + public ArrayList getChildFacilitiesByParent(Integer parentFacilityID) { + return mainStoreRepo.findByParentFacilityIDAndDeletedFalseOrderByFacilityName(parentFacilityID); + } + + @Transactional + @Override + public M_Facility deleteFacilityWithHierarchy(Integer facilityID, String modifiedBy) throws Exception { + M_Facility facility = mainStoreRepo.findByFacilityID(facilityID); + if (facility == null) { + throw new Exception("Facility not found"); + } + // Fix 19: clear parentFacilityID on children (unlink from hierarchy, don't block) + // Revert children to MainStore since parent is being deleted + ArrayList children = mainStoreRepo.findByParentFacilityIDAndDeletedFalseOrderByFacilityName(facilityID); + for (M_Facility child : children) { + child.setParentFacilityID(null); + child.setModifiedBy(modifiedBy); + mainStoreRepo.save(child); + // Only revert store fields for new facilities (PSMID NULL) + if (child.getProviderServiceMapID() == null) { + mainStoreRepo.updateStoreFields(child.getFacilityID(), true, null, "MAIN"); + } + } + facility.setDeleted(true); + facility.setModifiedBy(modifiedBy); + M_Facility saved = mainStoreRepo.save(facility); + // Fix 8: cascade soft-delete all asha_supervisor_mapping rows for this facility + ashaSupervisorMappingService.cascadeDeleteByFacilityID(facilityID, modifiedBy); + // Cascade soft-delete facility_village_mapping rows + ArrayList villageMappings = facilityVillageMappingRepo.findByFacilityIDAndDeletedFalse(facilityID); + for (FacilityVillageMapping vm : villageMappings) { + vm.setDeleted(true); + vm.setModifiedBy(modifiedBy); + facilityVillageMappingRepo.save(vm); + } + return saved; + } + + @Transactional + @Override + public M_Facility updateFacilityWithHierarchy(M_Facility facility, List villageIDs, + Integer mainVillageID, List childFacilityIDs) { + M_Facility existing = mainStoreRepo.findByFacilityID(facility.getFacilityID()); + if (existing == null) { + throw new RuntimeException("Facility not found"); + } + + if (existing.getBlockID() != null && facility.getFacilityName() != null) { + if (mainStoreRepo.existsByFacilityNameAndBlockIDAndNotFacilityID(facility.getFacilityName(), existing.getBlockID(), facility.getFacilityID())) { + throw new RuntimeException("Facility with this name already exists in this block"); + } + } + + if (facility.getFacilityName() != null) { + existing.setFacilityName(facility.getFacilityName()); + } + if (facility.getFacilityDesc() != null) { + existing.setFacilityDesc(facility.getFacilityDesc()); + } + if (facility.getFacilityCode() != null) { + existing.setFacilityCode(facility.getFacilityCode()); + } + // Set hierarchy fields: facilityType, ruralUrban, and location + if (facility.getFacilityTypeID() != null) { + existing.setFacilityTypeID(facility.getFacilityTypeID()); + } + if (facility.getRuralUrban() != null) { + existing.setRuralUrban(facility.getRuralUrban()); + } + if (facility.getStateID() != null) { + existing.setStateID(facility.getStateID()); + } + if (facility.getDistrictID() != null) { + existing.setDistrictID(facility.getDistrictID()); + } + if (facility.getBlockID() != null) { + existing.setBlockID(facility.getBlockID()); + } + // Keep store relationships intact (isMainFacility, mainFacilityID, storeType) + // Only hierarchy columns are added. Store chain stays for inventory compatibility. + existing.setMainVillageID(mainVillageID); + existing.setModifiedBy(facility.getModifiedBy()); + M_Facility savedFacility = mainStoreRepo.save(existing); + + if (villageIDs != null) { + List oldMappings = facilityVillageMappingRepo + .findByFacilityIDAndDeletedFalse(facility.getFacilityID()); + // Build set of new village IDs for quick lookup + java.util.Set newVillageSet = new java.util.HashSet<>(villageIDs); + // Soft-delete old mappings that are NOT in the new list + for (FacilityVillageMapping old : oldMappings) { + if (!newVillageSet.contains(old.getDistrictBranchID())) { + old.setDeleted(true); + old.setModifiedBy(facility.getModifiedBy()); + facilityVillageMappingRepo.save(old); + } + } + // Build set of currently active village IDs + java.util.Set activeVillageSet = new java.util.HashSet<>(); + for (FacilityVillageMapping old : oldMappings) { + if (!Boolean.TRUE.equals(old.getDeleted())) { + activeVillageSet.add(old.getDistrictBranchID()); + } + } + // Add only truly new villages (not already active) + for (Integer villageID : villageIDs) { + if (!activeVillageSet.contains(villageID)) { + FacilityVillageMapping softDeleted = facilityVillageMappingRepo + .findByFacilityIDAndDistrictBranchIDAndDeletedTrue(savedFacility.getFacilityID(), villageID); + if (softDeleted != null) { + softDeleted.setDeleted(false); + softDeleted.setModifiedBy(facility.getModifiedBy()); + facilityVillageMappingRepo.save(softDeleted); + } else { + FacilityVillageMapping mapping = new FacilityVillageMapping(); + mapping.setFacilityID(savedFacility.getFacilityID()); + mapping.setDistrictBranchID(villageID); + mapping.setCreatedBy(facility.getModifiedBy()); + mapping.setDeleted(false); + facilityVillageMappingRepo.save(mapping); + } + } + } + } + + if (childFacilityIDs != null) { + // Fix 20: validate child levels before updating + if (!childFacilityIDs.isEmpty() && existing.getFacilityTypeID() != null) { + M_facilitytype ft = facilityTypeRepo.findByFacilityTypeID(existing.getFacilityTypeID()); + if (ft != null && ft.getLevelValue() != null) { + for (Integer childID : childFacilityIDs) { + M_Facility child = mainStoreRepo.findByFacilityIDAndDeleted(childID, false); + if (child != null && child.getFacilityTypeID() != null) { + M_facilitytype childFt = facilityTypeRepo.findByFacilityTypeID(child.getFacilityTypeID()); + if (childFt != null && childFt.getLevelValue() != null + && !childFt.getLevelValue().equals(ft.getLevelValue() + 1)) { + throw new RuntimeException( + "Hierarchy level mismatch: selected child facility is not at the expected level. " + + "Children must be exactly one level below this facility."); + } + } + } + } + } + // Revert old children to MainStore before re-linking + ArrayList oldChildren = mainStoreRepo + .findByParentFacilityIDAndDeletedFalseOrderByFacilityName(facility.getFacilityID()); + mainStoreRepo.clearParentFacilityID(facility.getFacilityID(), facility.getModifiedBy()); + for (M_Facility oldChild : oldChildren) { + if (!childFacilityIDs.contains(oldChild.getFacilityID())) { + // Child was removed — revert to MainStore only for new facilities (PSMID NULL) + if (oldChild.getProviderServiceMapID() == null) { + mainStoreRepo.updateStoreFields(oldChild.getFacilityID(), true, null, "MAIN"); + } + } + } + + for (Integer childID : childFacilityIDs) { + M_Facility child = mainStoreRepo.findByFacilityID(childID); + if (child != null) { + child.setParentFacilityID(savedFacility.getFacilityID()); + child.setModifiedBy(facility.getModifiedBy()); + mainStoreRepo.save(child); + + // Only update store fields for NEW hierarchy facilities (PSMID is NULL) + if (child.getProviderServiceMapID() == null) { + if (child.getIsMainFacility() == null || child.getIsMainFacility()) { + mainStoreRepo.updateStoreFields(childID, false, + savedFacility.getFacilityID(), "SUB"); + } + } + } + } + } + + return savedFacility; + } + } 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 14ff8cb9..165120e1 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/to/employeemaster/Previleges1097_3.java b/src/main/java/com/iemr/admin/to/employeemaster/Previleges1097_3.java index 519c4b0d..d8bb0f33 100644 --- a/src/main/java/com/iemr/admin/to/employeemaster/Previleges1097_3.java +++ b/src/main/java/com/iemr/admin/to/employeemaster/Previleges1097_3.java @@ -27,11 +27,14 @@ public class Previleges1097_3 { Priveleges1097_2[] ID; private Integer providerServiceMapID; private Integer workingLocationID; + private Integer stateID; + private Integer districtID; private Integer blockID; private String blockName; private String[] villageID; private String[] villageName; - + private Integer facilityID; + public Integer getProviderServiceMapID() { return providerServiceMapID; } @@ -50,6 +53,18 @@ public Priveleges1097_2[] getID() { public void setID(Priveleges1097_2[] iD) { this.ID = iD; } + public Integer getStateID() { + return stateID; + } + public void setStateID(Integer stateID) { + this.stateID = stateID; + } + public Integer getDistrictID() { + return districtID; + } + public void setDistrictID(Integer districtID) { + this.districtID = districtID; + } public Integer getBlockID() { return blockID; } @@ -74,8 +89,10 @@ public String[] getVillageName() { public void setVillageName(String[] villageName) { this.villageName = villageName; } - - - - + public Integer getFacilityID() { + return facilityID; + } + public void setFacilityID(Integer facilityID) { + this.facilityID = facilityID; + } } diff --git a/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java b/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java index fc94da1a..2eca1607 100644 --- a/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java +++ b/src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java @@ -77,25 +77,6 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo return; } } - - // Set CORS headers and handle OPTIONS request only if origin is valid and allowed - if (origin != null && isOriginAllowed(origin)) { - addCorsHeaders(response, origin); - logger.info("Origin Validated | Origin: {} | Method: {} | URI: {}", origin, method, uri); - - if ("OPTIONS".equalsIgnoreCase(method)) { - // OPTIONS (preflight) - respond with full allowed methods - response.setStatus(HttpServletResponse.SC_OK); - return; - } - } else { - logger.warn("Origin [{}] is NOT allowed. CORS headers NOT added.", origin); - - if ("OPTIONS".equalsIgnoreCase(method)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Origin not allowed for OPTIONS request"); - return; - } - } logger.info("JwtUserIdValidationFilter invoked for path: " + path); @@ -130,6 +111,7 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo } + try { String jwtFromCookie = getJwtTokenFromCookies(request); String jwtFromHeader = request.getHeader(Constants.JWT_TOKEN); @@ -170,7 +152,7 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo } catch (Exception e) { logger.error("Authorization error: ", e); - response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authorization error: "); + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized: Invalid or missing token"); } } 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 2aacef90..9fdb90fe 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); }