From d8efbbe14400e19b7abbcaa702d491b5e475a669 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Wed, 11 Oct 2023 12:55:15 +0530 Subject: [PATCH 01/52] PFM-1419 : added change to search user based on role tenantid --- .../user/domain/model/UserSearchCriteria.java | 1 + .../egov/user/domain/service/UserService.java | 20 ++++ .../repository/UserRepository.java | 32 ++++++ .../builder/UserTypeQueryBuilder.java | 11 ++ .../contract/UserSearchByTenantsRequest.java | 102 ++++++++++++++++++ .../user/web/controller/UserController.java | 26 +++++ 6 files changed, 192 insertions(+) create mode 100644 core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java index a0dae3277..833f50686 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java @@ -29,6 +29,7 @@ public class UserSearchCriteria { private List sort; private UserType type; private String tenantId; + private List tenantIds; private List roleCodes; public void validate(boolean isInterServiceCall) { diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java index 34bf135d8..830ab6839 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java @@ -37,6 +37,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.util.ObjectUtils; import org.springframework.web.client.RestTemplate; import java.io.IOException; @@ -649,6 +650,25 @@ public void validatePassword(String password) { throw new CustomException(errorMap); } } + public List searchUsersByTenants(UserSearchCriteria searchCriteria, RequestInfo requestInfo) { + log.info("INSIDE USER SEARCH BY TENANT"); + //searchCriteria.validate(isInterServiceCall); + if(ObjectUtils.isEmpty(searchCriteria.getTenantIds())) { + return null; + } + + //searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); + /* encrypt here / encrypted searchcriteria will be used for search*/ + searchCriteria = encryptionDecryptionUtil.encryptObject(searchCriteria, "UserSearchCriteria", UserSearchCriteria.class); + List list = userRepository.findUserByTenant(searchCriteria); + + /* decrypt here / final reponse decrypted*/ + + list = encryptionDecryptionUtil.decryptObject(list, "UserList", User.class, requestInfo); + + setFileStoreUrlsByFileStoreIds(list); + return list; + } } diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index 99856a8c4..e7de7487f 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -574,4 +574,36 @@ private String getStateLevelTenant(String tenantId) { return tenantId.split("\\.")[0]; } + public List findUserByTenant(UserSearchCriteria userSearch) { + final List preparedStatementValues = new ArrayList<>(); + boolean RoleSearchHappend = false; + List userIds = new ArrayList<>(); + if (!isEmpty(userSearch.getRoleCodes()) && userSearch.getTenantId() != null) { + userIds = findUsersWithRole(userSearch); + RoleSearchHappend = true; + } + List users = new ArrayList<>(); + if (RoleSearchHappend) { + if (!CollectionUtils.isEmpty(userIds)) { + if (CollectionUtils.isEmpty(userSearch.getId())) + userSearch.setId(userIds); + else { + userSearch.setId(userSearch.getId().stream().filter(userIds::contains).collect(Collectors.toList())); + if (CollectionUtils.isEmpty(userSearch.getId())) + return users; + } + userSearch.setTenantId(null); + userSearch.setRoleCodes(null); + } else { + return users; + } + } + String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); + log.debug(queryStr); + + users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); + enrichRoles(users); + return users; + } + } diff --git a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java index f61a23a65..8291660d3 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java +++ b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java @@ -137,6 +137,12 @@ private void addWhereClause(final StringBuilder selectQuery, final List prepared selectQuery.append(" u.tenantid like ?"); preparedStatementValues.add("%"+userSearchCriteria.getTenantId().trim()+"%"); } + if (userSearchCriteria.getTenantIds() != null) { + isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); + selectQuery.append(" ur.role_tenantid IN (").append(getQueryForCollection(userSearchCriteria.getTenantIds(), + preparedStatementValues)).append(" )"); + preparedStatementValues.add("%"+userSearchCriteria.getTenantId().trim()+"%"); + } if (userSearchCriteria.getUserName() != null) { isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); @@ -240,6 +246,11 @@ private void addWhereClauseUserRoles(final StringBuilder selectQuery, final List selectQuery.append(" ur.role_tenantid like ? "); preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); } + if (userSearchCriteria.getTenantIds() != null) { + isAppendAndClause = addAndClauseIfRequired(false, selectQuery); + selectQuery.append(" ur.role_tenantid IN (" ).append(getQueryForCollection(userSearchCriteria.getTenantIds(), + preparedStatementValues)).append(" )"); + } if (!isEmpty(userSearchCriteria.getRoleCodes())) { diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java new file mode 100644 index 000000000..6466d7fc3 --- /dev/null +++ b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java @@ -0,0 +1,102 @@ +package org.egov.user.web.contract; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.egov.common.contract.request.RequestInfo; +import org.egov.user.config.UserServiceConstants; +import org.egov.user.domain.model.UserSearchCriteria; +import org.egov.user.domain.model.enums.UserType; + +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.util.Collections; +import java.util.List; + +@Getter +@Setter +@ToString +public class UserSearchByTenantsRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("id") + private List id; + + @JsonProperty("uuid") + private List uuid; + + @Size(max = 64) + @JsonProperty("userName") + private String userName; + + @Size(max = 100) + @JsonProperty("name") + private String name; + + @Pattern(regexp = UserServiceConstants.PATTERN_MOBILE) + @JsonProperty("mobileNumber") + private String mobileNumber; + + @Size(max = 20) + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + + @Size(max = 10) + @JsonProperty("pan") + private String pan; + + @Size(max = 128) + @JsonProperty("emailId") + private String emailId; + + @JsonProperty("fuzzyLogic") + private boolean fuzzyLogic; + + @JsonProperty("active") + @Setter + private Boolean active; + + @Pattern(regexp = UserServiceConstants.PATTERN_TENANT) + @Size(max = 256) + @JsonProperty("tenantIds") + private List tenantIds; + + @JsonProperty("pageSize") + private int pageSize; + + @JsonProperty("pageNumber") + private int pageNumber = 0; + + @JsonProperty("sort") + private List sort = Collections.singletonList("name"); + + @Size(max = 50) + @JsonProperty("userType") + private String userType; + + @JsonProperty("roleCodes") + private List roleCodes; + + public UserSearchCriteria toDomain() { + return UserSearchCriteria.builder() + .id(id) + .userName(userName) + .name(name) + .mobileNumber(mobileNumber) +// .pan(pan) + .emailId(emailId) + .fuzzyLogic(fuzzyLogic) + .active(active) + .limit(pageSize) + .offset(pageNumber) + .sort(sort) + .type(UserType.fromValue(userType)) + .tenantIds(tenantIds) + .roleCodes(roleCodes) + .uuid(uuid) + .build(); + } +} diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java b/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java index c16bd2201..f4567dd77 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java @@ -219,4 +219,30 @@ private boolean isMobileValidationRequired(HttpHeaders headers) { return true; } + @PostMapping("/_searchByTenant") + public UserSearchResponse getUserBytenant(@RequestBody @Valid UserSearchByTenantsRequest request, @RequestHeader HttpHeaders headers) { + + log.info("Received User search Request " + request); + if (request.getActive() == null) { + request.setActive(true); + } + return searchUsersBytenant(request, headers); + } + + private UserSearchResponse searchUsersBytenant(UserSearchByTenantsRequest request, HttpHeaders headers) { + UserSearchCriteria searchCriteria = request.toDomain(); + + if (!isInterServiceCall(headers)) { + if ((isEmpty(searchCriteria.getId()) && isEmpty(searchCriteria.getUuid())) && (searchCriteria.getLimit() > defaultSearchSize + || searchCriteria.getLimit() == 0)) + searchCriteria.setLimit(defaultSearchSize); + } + + List userModels = userService.searchUsersByTenants(searchCriteria, request.getRequestInfo()); + List userContracts = userModels.stream().map(UserSearchResponseContent::new) + .collect(Collectors.toList()); + ResponseInfo responseInfo = ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build(); + return new UserSearchResponse(responseInfo, userContracts); + } + } From 38c64d29a25a1755fb267029e0da7724844b04e6 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Wed, 11 Oct 2023 16:17:47 +0530 Subject: [PATCH 02/52] PFM-1419 : added change to search user based on role tenantid --- .../egov/user/web/contract/UserSearchByTenantsRequest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java index 6466d7fc3..2bc1d4f0b 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchByTenantsRequest.java @@ -61,6 +61,9 @@ public class UserSearchByTenantsRequest { @Pattern(regexp = UserServiceConstants.PATTERN_TENANT) @Size(max = 256) + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("tenantIds") private List tenantIds; @@ -94,6 +97,7 @@ public UserSearchCriteria toDomain() { .offset(pageNumber) .sort(sort) .type(UserType.fromValue(userType)) + .tenantId(tenantId) .tenantIds(tenantIds) .roleCodes(roleCodes) .uuid(uuid) From a83165eb3b13ab809f863b368127e19ac15c4c55 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Wed, 11 Oct 2023 16:36:58 +0530 Subject: [PATCH 03/52] PFM-1419 : added change to search user based on role tenantid --- .../org/egov/user/repository/builder/UserTypeQueryBuilder.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java index 8291660d3..6a61526f1 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java +++ b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java @@ -141,7 +141,6 @@ private void addWhereClause(final StringBuilder selectQuery, final List prepared isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); selectQuery.append(" ur.role_tenantid IN (").append(getQueryForCollection(userSearchCriteria.getTenantIds(), preparedStatementValues)).append(" )"); - preparedStatementValues.add("%"+userSearchCriteria.getTenantId().trim()+"%"); } if (userSearchCriteria.getUserName() != null) { From 28aaa5d1929582f309ae58297cea6f090601e5d0 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 12:11:31 +0530 Subject: [PATCH 04/52] PFM-1419 : added change to search user based on role tenantid --- .../egov/user/persistence/repository/UserRepository.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index e7de7487f..ccd180f05 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -105,8 +105,7 @@ public List findUsersWithRole(UserSearchCriteria userSearch) { final List preparedStatementValues = new ArrayList<>(); List usersIds = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQueryUserRoleSearch(userSearch, preparedStatementValues); - log.debug(queryStr); - + log.info("ROLE SEARCH QUERY:" + queryStr); usersIds = jdbcTemplate.queryForList(queryStr, preparedStatementValues.toArray(), Long.class); return usersIds; @@ -580,6 +579,7 @@ public List findUserByTenant(UserSearchCriteria userSearch) { List userIds = new ArrayList<>(); if (!isEmpty(userSearch.getRoleCodes()) && userSearch.getTenantId() != null) { userIds = findUsersWithRole(userSearch); + log.info("USER IDS:" + userIds); RoleSearchHappend = true; } List users = new ArrayList<>(); @@ -595,13 +595,15 @@ public List findUserByTenant(UserSearchCriteria userSearch) { userSearch.setTenantId(null); userSearch.setRoleCodes(null); } else { + return users; } } String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); - log.debug(queryStr); + log.info("SEARCH USER QUERY"+queryStr); users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); + log.info("USER SEARCH RESULT:"+users); enrichRoles(users); return users; } From 80d93b6fa6793f2c0a1a7871e7039078bc91c66f Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 12:33:17 +0530 Subject: [PATCH 05/52] PFM-1419 : added change to search user based on role tenantid --- .../org/egov/user/persistence/repository/UserRepository.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index ccd180f05..d94bab2af 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -603,7 +603,6 @@ public List findUserByTenant(UserSearchCriteria userSearch) { log.info("SEARCH USER QUERY"+queryStr); users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); - log.info("USER SEARCH RESULT:"+users); enrichRoles(users); return users; } From 30fb7f93c324f74349796c884fee189264805af2 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 12:47:08 +0530 Subject: [PATCH 06/52] PFM-1419 : added change to search user based on role tenantid --- .../org/egov/user/persistence/repository/UserRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index d94bab2af..4bdc211c6 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -577,7 +577,7 @@ public List findUserByTenant(UserSearchCriteria userSearch) { final List preparedStatementValues = new ArrayList<>(); boolean RoleSearchHappend = false; List userIds = new ArrayList<>(); - if (!isEmpty(userSearch.getRoleCodes()) && userSearch.getTenantId() != null) { + if (!isEmpty(userSearch.getRoleCodes()) && userSearch.getTenantIds() != null) { userIds = findUsersWithRole(userSearch); log.info("USER IDS:" + userIds); RoleSearchHappend = true; From a7dc60b2aa42a37eab5ebdf7b265295444b7e627 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 13:23:25 +0530 Subject: [PATCH 07/52] PFM-1419-Employees search HRMS : added change to search employee based on user role tenantid --- .../egov/hrms/config/PropertiesManager.java | 4 ++ .../egov/hrms/service/EmployeeService.java | 48 +++++++++++++++++++ .../org/egov/hrms/service/UserService.java | 17 +++++++ .../org/egov/hrms/utils/HRMSConstants.java | 2 + .../web/contract/EmployeeSearchCriteria.java | 2 + .../web/controller/EmployeeController.java | 9 ++++ .../src/main/resources/application.properties | 1 + 7 files changed, 83 insertions(+) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java index 95c16873c..720644512 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java @@ -64,6 +64,10 @@ public class PropertiesManager { @Value("${egov.user.search.endpoint}") public String userSearchEndpoint; + + @Value("${egov.user.search.tenant.endpoint}") + public String userSearchByTenantEndpoint; + @Value("${egov.user.create.endpoint}") public String userCreateEndpoint; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 7126b3535..d5e234fbd 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -561,4 +561,52 @@ public Map getEmployeeCountResponse(RequestInfo requestInfo, Stri return response; } + public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + boolean userChecked = false; + /*if(null == criteria.getIsActive() || criteria.getIsActive()) + criteria.setIsActive(true); + else + criteria.setIsActive(false);*/ + Map mapOfUsers = new HashMap(); + if((!CollectionUtils.isEmpty(criteria.getRoles())) && !CollectionUtils.isEmpty(criteria.getTenantIds())) { + Map userSearchCriteria = new HashMap<>(); + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTIDS,criteria.getTenantId()); + if( !CollectionUtils.isEmpty(criteria.getRoles()) ) + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); + UserResponse userResponse = userService.getUserByTenantids(requestInfo, userSearchCriteria); + userChecked =true; + if(!CollectionUtils.isEmpty(userResponse.getUser())) { + mapOfUsers.putAll(userResponse.getUser().stream() + .collect(Collectors.toMap(User::getUuid, Function.identity()))); + } + List userUUIDs = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(criteria.getUuids())) + criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); + else + criteria.setUuids(userUUIDs); + } + //checks if above criteria met and result is not null will check for name search if list of names are given as user search on name is not bulk api + List employees = new ArrayList<>(); + log.info("Employe search boolean:"+(!((!CollectionUtils.isEmpty(criteria.getRoles()))))); + if(!((!CollectionUtils.isEmpty(criteria.getRoles()) || !CollectionUtils.isEmpty(criteria.getNames()) || !StringUtils.isEmpty(criteria.getPhone())) && CollectionUtils.isEmpty(criteria.getUuids()))) + employees = repository.fetchEmployees(criteria, requestInfo); + List uuids = employees.stream().map(Employee :: getUuid).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(uuids)){ + Map UserSearchCriteria = new HashMap<>(); + UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); + if(mapOfUsers.isEmpty()){ + UserResponse userResponse = userService.getUserByTenantids(requestInfo, UserSearchCriteria); + if(!CollectionUtils.isEmpty(userResponse.getUser())) { + mapOfUsers = userResponse.getUser().stream() + .collect(Collectors.toMap(User :: getUuid, Function.identity())); + } + } + for(Employee employee: employees){ + employee.setUser(mapOfUsers.get(employee.getUuid())); + } + } + return EmployeeResponse.builder().responseInfo(factory.createResponseInfoFromRequestInfo(requestInfo, true)) + .employees(employees).build(); + } + } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java index 3cd3a8e0e..44aa4b299 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java @@ -124,6 +124,23 @@ public UserResponse getUser(RequestInfo requestInfo, Map UserSea return userResponse; } + public UserResponse getUserByTenantids(RequestInfo requestInfo, Map UserSearchCriteria ) { + StringBuilder uri = new StringBuilder(); + Map userSearchReq = new HashMap<>(); + userSearchReq.put("RequestInfo", requestInfo); + userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); + for( String key: UserSearchCriteria.keySet()) + userSearchReq.put(key, UserSearchCriteria.get(key)); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchByTenantEndpoint()); + UserResponse userResponse = new UserResponse(); + try { + userResponse = userCall(userSearchReq,uri); + }catch(Exception e) { + log.error("User search failed: ",e); + } + + return userResponse; + } /** diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index a0643ba7c..9a31c8d3e 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -41,6 +41,8 @@ public class HRMSConstants { public static final String HRMS_USER_SEARCH_CRITERA_UUID = "uuid"; public static final String HRMS_USER_SEARCH_CRITERA_ROLECODES = "roleCodes"; public static final String HRMS_USER_SEARCH_CRITERA_TENANTID = "tenantId"; + + public static final String HRMS_USER_SEARCH_CRITERA_TENANTIDS = "tenantIds"; public static final String HRMS_USER_SEARCH_CRITERA_MOBILENO = "mobileNumber"; public static final String HRMS_USER_SEARCH_CRITERA_NAME = "name"; public static final String HRMS_USER_SEARCH_CRITERA_USERNAME = "UserName"; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java index cce024177..306f863cc 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java @@ -49,6 +49,8 @@ public class EmployeeSearchCriteria { @Size(max = 250) public String tenantId; + + public List tenantIds; public String phone; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index 99a12ff50..dd16d90b3 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -120,6 +120,15 @@ public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestIn return new ResponseEntity<>(employeeResponse,HttpStatus.OK); } + @PostMapping(value = "/_searchListOfEmployee") + @ResponseBody + public ResponseEntity _searchListOfEmployee(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @ModelAttribute @Valid EmployeeSearchCriteria criteria) { + validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); + EmployeeResponse employeeResponse = employeeService.searchListOfEmployee(criteria, requestInfoWrapper.getRequestInfo()); + return new ResponseEntity<>(employeeResponse,HttpStatus.OK); + } + + @PostMapping("_count") @ResponseBody private ResponseEntity count(@RequestParam("tenantId") String tenantId, @RequestBody RequestInfo requestInfo) { diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 85dace878..99e094425 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -48,6 +48,7 @@ egov.environment.domain=https://dev.digit.org/ #user egov.user.host=https://dev.digit.org egov.user.search.endpoint=/user/v1/_search +egov.user.search.tenant.endpoint=/user/_searchByTenant egov.user.create.endpoint=/user/users/_createnovalidate egov.user.update.endpoint=/user/users/_updatenovalidate From b5fadc06499a9c5426eb887acb580e5ffe452244 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 14:12:58 +0530 Subject: [PATCH 08/52] PFM-1419-Employees search HRMS : added change to search employee based on user role tenantid --- .../java/org/egov/hrms/service/EmployeeService.java | 12 ++++++++++-- .../egov/hrms/web/controller/EmployeeController.java | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index d5e234fbd..cba22dce8 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -574,34 +574,42 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re if( !CollectionUtils.isEmpty(criteria.getRoles()) ) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); UserResponse userResponse = userService.getUserByTenantids(requestInfo, userSearchCriteria); + log.info("user responsesize:"+userResponse.getUser().size() ); userChecked =true; if(!CollectionUtils.isEmpty(userResponse.getUser())) { mapOfUsers.putAll(userResponse.getUser().stream() .collect(Collectors.toMap(User::getUuid, Function.identity()))); } + log.info("Map of User length:"+mapOfUsers.size()); List userUUIDs = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(criteria.getUuids())) criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); else criteria.setUuids(userUUIDs); } + log.info("criteria:"+criteria.getUuids().size()); + log.info("criteria list :"+criteria); //checks if above criteria met and result is not null will check for name search if list of names are given as user search on name is not bulk api List employees = new ArrayList<>(); log.info("Employe search boolean:"+(!((!CollectionUtils.isEmpty(criteria.getRoles()))))); - if(!((!CollectionUtils.isEmpty(criteria.getRoles()) || !CollectionUtils.isEmpty(criteria.getNames()) || !StringUtils.isEmpty(criteria.getPhone())) && CollectionUtils.isEmpty(criteria.getUuids()))) - employees = repository.fetchEmployees(criteria, requestInfo); + employees = repository.fetchEmployees(criteria, requestInfo); + log.info("innside fetch employee if true:"+ employees.size()); List uuids = employees.stream().map(Employee :: getUuid).collect(Collectors.toList()); + log.info("uuids:" +uuids.size()); if(!CollectionUtils.isEmpty(uuids)){ Map UserSearchCriteria = new HashMap<>(); UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); if(mapOfUsers.isEmpty()){ UserResponse userResponse = userService.getUserByTenantids(requestInfo, UserSearchCriteria); + log.info("mapOfUsers not empty:"+userResponse.getUser().size()); if(!CollectionUtils.isEmpty(userResponse.getUser())) { + log.info("mapOfUsers not empty and user reponse size:"+userResponse.getUser().size()); mapOfUsers = userResponse.getUser().stream() .collect(Collectors.toMap(User :: getUuid, Function.identity())); } } for(Employee employee: employees){ + log.info("employee uuid:"+employee.getUuid()); employee.setUser(mapOfUsers.get(employee.getUuid())); } } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index dd16d90b3..dc116b7e3 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -122,8 +122,8 @@ public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestIn @PostMapping(value = "/_searchListOfEmployee") @ResponseBody - public ResponseEntity _searchListOfEmployee(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @ModelAttribute @Valid EmployeeSearchCriteria criteria) { - validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); + public ResponseEntity _searchListOfEmployee(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @RequestBody @Valid EmployeeSearchCriteria criteria) { + //validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); EmployeeResponse employeeResponse = employeeService.searchListOfEmployee(criteria, requestInfoWrapper.getRequestInfo()); return new ResponseEntity<>(employeeResponse,HttpStatus.OK); } From 48088ccdc419d1a75b0ee9f840a556604b3147e6 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 14:26:02 +0530 Subject: [PATCH 09/52] PFM-1419-Employees search HRMS : added change to search employee based on user role tenantid --- .../src/main/java/org/egov/hrms/service/EmployeeService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index cba22dce8..91f415f8c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -570,7 +570,7 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re Map mapOfUsers = new HashMap(); if((!CollectionUtils.isEmpty(criteria.getRoles())) && !CollectionUtils.isEmpty(criteria.getTenantIds())) { Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTIDS,criteria.getTenantId()); + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTIDS,criteria.getTenantIds()); if( !CollectionUtils.isEmpty(criteria.getRoles()) ) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); UserResponse userResponse = userService.getUserByTenantids(requestInfo, userSearchCriteria); From 35cf7c83e3b15e47e42435950bc7fc420ccd9520 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 14:27:16 +0530 Subject: [PATCH 10/52] PFM-1419-Employees search HRMS : added change to search employee based on user role tenantid --- .../src/main/java/org/egov/hrms/service/EmployeeService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 91f415f8c..97f65a53c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -600,7 +600,7 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re Map UserSearchCriteria = new HashMap<>(); UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); if(mapOfUsers.isEmpty()){ - UserResponse userResponse = userService.getUserByTenantids(requestInfo, UserSearchCriteria); + UserResponse userResponse = userService.getUser(requestInfo, UserSearchCriteria); log.info("mapOfUsers not empty:"+userResponse.getUser().size()); if(!CollectionUtils.isEmpty(userResponse.getUser())) { log.info("mapOfUsers not empty and user reponse size:"+userResponse.getUser().size()); From 17cf93fbeb6d9ec0b2704a4ccdb5ae80c5feb681 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 12 Oct 2023 14:54:14 +0530 Subject: [PATCH 11/52] PFM-1419-Employees search HRMS : added change to search employee based on user role tenantid --- .../src/main/java/org/egov/hrms/service/UserService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java index 44aa4b299..03edf00d5 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java @@ -78,6 +78,9 @@ public class UserService { @Value("${egov.user.search.endpoint}") private String userSearchEndpoint; + @Value("${egov.user.search.tenant.endpoint}") + private String userSearchByTenantEndpoint; + @Value("${egov.user.update.endpoint}") private String userUpdateEndpoint; @@ -152,7 +155,7 @@ public UserResponse getUserByTenantids(RequestInfo requestInfo, Map Date: Fri, 13 Oct 2023 14:33:35 +0530 Subject: [PATCH 12/52] PFM-1419-User search : added change to search user based on user role tenantid --- .../user/domain/model/UserSearchCriteria.java | 1 + .../egov/user/domain/service/UserService.java | 12 ++++++++++-- .../persistence/repository/UserRepository.java | 2 +- .../repository/builder/UserTypeQueryBuilder.java | 16 ++++++++++++---- .../user/web/contract/UserSearchRequest.java | 4 ++++ 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java index 833f50686..e8d2260e4 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java @@ -30,6 +30,7 @@ public class UserSearchCriteria { private UserType type; private String tenantId; private List tenantIds; + private boolean isStateLevelSearch; private List roleCodes; public void validate(boolean isInterServiceCall) { diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java index 830ab6839..d9275a48f 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java @@ -181,9 +181,17 @@ public List searchUsers(UserSearchCriteria sear boolean isInterServiceCall, RequestInfo requestInfo) { searchCriteria.validate(isInterServiceCall); - - searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); + if(!ObjectUtils.isEmpty(searchCriteria.isStateLevelSearch())) { + if (searchCriteria.isStateLevelSearch()) { + searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); + } + } else { + searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); + } /* encrypt here / encrypted searchcriteria will be used for search*/ + log.info("Search Criteria:"+searchCriteria.getTenantId()); + log.info("Search Criteria:"+searchCriteria); + searchCriteria = encryptionDecryptionUtil.encryptObject(searchCriteria, "UserSearchCriteria", UserSearchCriteria.class); diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index 4bdc211c6..125b55288 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -86,7 +86,7 @@ public List findAll(UserSearchCriteria userSearch) { } } String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); - log.debug(queryStr); + log.info(queryStr); users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); diff --git a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java index 6a61526f1..7d2763078 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java +++ b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java @@ -45,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; import java.util.Iterator; import java.util.List; @@ -240,11 +241,18 @@ private void addWhereClauseUserRoles(final StringBuilder selectQuery, final List selectQuery.append(" WHERE"); boolean isAppendAndClause = false; - if (userSearchCriteria.getTenantId() != null) { - isAppendAndClause = addAndClauseIfRequired(false, selectQuery); - selectQuery.append(" ur.role_tenantid like ? "); - preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); + if (userSearchCriteria.getTenantId() != null ) { + if(ObjectUtils.isEmpty(userSearchCriteria.isStateLevelSearch())){ + isAppendAndClause = addAndClauseIfRequired(false, selectQuery); + selectQuery.append(" ur.role_tenantid like ? "); + preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); + } else { + isAppendAndClause = addAndClauseIfRequired(false, selectQuery); + selectQuery.append(" ur.role_tenantid = ?"); + preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); + } } + if (userSearchCriteria.getTenantIds() != null) { isAppendAndClause = addAndClauseIfRequired(false, selectQuery); selectQuery.append(" ur.role_tenantid IN (" ).append(getQueryForCollection(userSearchCriteria.getTenantIds(), diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java index 6dabfec0e..bca11799e 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java @@ -70,6 +70,9 @@ public class UserSearchRequest { @JsonProperty("pageNumber") private int pageNumber = 0; + @JsonProperty("isStateLevelSearch") + private boolean isStateLevelSearch; + @JsonProperty("sort") private List sort = Collections.singletonList("name"); @@ -95,6 +98,7 @@ public UserSearchCriteria toDomain() { .sort(sort) .type(UserType.fromValue(userType)) .tenantId(tenantId) + .isStateLevelSearch(isStateLevelSearch) .roleCodes(roleCodes) .uuid(uuid) .build(); From 8c5c9b3e9bdabfa100e32e797d804c553cb23732 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 15:21:31 +0530 Subject: [PATCH 13/52] PFM-1419-User search : added change to search user based on user role tenantid --- .../java/org/egov/user/domain/model/UserSearchCriteria.java | 2 +- .../main/java/org/egov/user/domain/service/UserService.java | 4 ++-- .../org/egov/user/persistence/repository/UserRepository.java | 1 + .../egov/user/repository/builder/UserTypeQueryBuilder.java | 5 +++-- .../java/org/egov/user/web/contract/UserSearchRequest.java | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java index e8d2260e4..1445c6a09 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java @@ -30,7 +30,7 @@ public class UserSearchCriteria { private UserType type; private String tenantId; private List tenantIds; - private boolean isStateLevelSearch; + private Boolean isStateLevelSearch; private List roleCodes; public void validate(boolean isInterServiceCall) { diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java index d9275a48f..cbdc60643 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java @@ -181,8 +181,8 @@ public List searchUsers(UserSearchCriteria sear boolean isInterServiceCall, RequestInfo requestInfo) { searchCriteria.validate(isInterServiceCall); - if(!ObjectUtils.isEmpty(searchCriteria.isStateLevelSearch())) { - if (searchCriteria.isStateLevelSearch()) { + if(!ObjectUtils.isEmpty(searchCriteria.getIsStateLevelSearch())) { + if (searchCriteria.getIsStateLevelSearch()) { searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); } } else { diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index 125b55288..645383550 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -69,6 +69,7 @@ public List findAll(UserSearchCriteria userSearch) { userIds = findUsersWithRole(userSearch); RoleSearchHappend = true; } + log.info("User role serach Count:"+userIds.size()); List users = new ArrayList<>(); if (RoleSearchHappend) { if (!CollectionUtils.isEmpty(userIds)) { diff --git a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java index 7d2763078..cdc4c407b 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java +++ b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java @@ -242,14 +242,15 @@ private void addWhereClauseUserRoles(final StringBuilder selectQuery, final List boolean isAppendAndClause = false; if (userSearchCriteria.getTenantId() != null ) { - if(ObjectUtils.isEmpty(userSearchCriteria.isStateLevelSearch())){ + if(ObjectUtils.isEmpty(userSearchCriteria.getIsStateLevelSearch())){ isAppendAndClause = addAndClauseIfRequired(false, selectQuery); selectQuery.append(" ur.role_tenantid like ? "); preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); } else { isAppendAndClause = addAndClauseIfRequired(false, selectQuery); selectQuery.append(" ur.role_tenantid = ?"); - preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); + preparedStatementValues.add(userSearchCriteria.getTenantId()); + } } diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java index bca11799e..f02a0edcc 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/contract/UserSearchRequest.java @@ -71,7 +71,7 @@ public class UserSearchRequest { private int pageNumber = 0; @JsonProperty("isStateLevelSearch") - private boolean isStateLevelSearch; + private Boolean isStateLevelSearch; @JsonProperty("sort") private List sort = Collections.singletonList("name"); From e426c46b60450ec98749a17678088f66dbfa65bf Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 15:27:06 +0530 Subject: [PATCH 14/52] PFM-1419-User search : added change to Employee search based on user role tenantid --- .../hrms/repository/EmployeeRepository.java | 17 ++++++++++++++ .../egov/hrms/service/EmployeeService.java | 22 +++++++++++++++++++ .../org/egov/hrms/utils/HRMSConstants.java | 2 ++ .../web/contract/EmployeeSearchCriteria.java | 2 ++ .../web/controller/EmployeeController.java | 11 ++++++++++ 5 files changed, 54 insertions(+) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java index 518fb1dcf..0ffca7026 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java @@ -110,6 +110,23 @@ public Map fetchEmployeeCount(String tenantId){ Map response = new HashMap<>(); List preparedStmtList = new ArrayList<>(); + String query = queryBuilder.getEmployeeCountQuery(tenantId, preparedStmtList); + log.info("query; "+query); + try { + response=jdbcTemplate.query(query, preparedStmtList.toArray(),countRowMapper); + }catch(Exception e) { + log.error("Exception while making the db call: ",e); + log.error("query; "+query); + } + return response; + } + + public Map fetchEmployeeCountv1(String tenantId, List roles){ + Map response = new HashMap<>(); + List preparedStmtList = new ArrayList<>(); + + + String query = queryBuilder.getEmployeeCountQuery(tenantId, preparedStmtList); log.info("query; "+query); try { diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 97f65a53c..70ccef0d5 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -62,6 +62,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; import java.util.*; import java.util.function.Function; @@ -149,6 +150,8 @@ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requ userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_MOBILENO,criteria.getPhone()); if( !CollectionUtils.isEmpty(criteria.getRoles()) ) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); + if(!ObjectUtils.isEmpty(criteria.isStateLevelSearch)) + userSearchCriteria.put(HRMSConstants.HRMS_IS_STATE_LEVEL_SEARCH_CODE, criteria.getIsStateLevelSearch()); UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); userChecked =true; if(!CollectionUtils.isEmpty(userResponse.getUser())) { @@ -561,6 +564,25 @@ public Map getEmployeeCountResponse(RequestInfo requestInfo, Stri return response; } + public Map getEmployeeCountResponseV1(RequestInfo requestInfo, List roles, String tenantId, boolean isStateLevelSearch){ + //EmployeeResponse employeeResponse = employeeService.search(criteria, requestInfoWrapper.getRequestInfo()); + Map response = new HashMap<>(); + Map results = new HashMap<>(); + ResponseInfo responseInfo = factory.createResponseInfoFromRequestInfo(requestInfo, true); + + response.put("ResponseInfo",responseInfo); + results = repository.fetchEmployeeCountv1(tenantId, roles); + + if(CollectionUtils.isEmpty(results) || results.get("totalEmployee").equalsIgnoreCase("0")){ + Map error = new HashMap<>(); + error.put("NO_RECORDS","No records found for the tenantId: "+tenantId); + throw new CustomException(error); + } + + response.put("EmployeCount",results); + return response; + } + public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { boolean userChecked = false; /*if(null == criteria.getIsActive() || criteria.getIsActive()) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 9a31c8d3e..ed2ae342c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -9,6 +9,8 @@ public class HRMSConstants { public static final String HRMS_MDMS_HR_MASTERS_CODE = "egov-hrms"; public static final String HRMS_AC_ROLES_MASTERS_CODE = "ACCESSCONTROL-ROLES"; public static final String HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE = "egov-location"; + + public static final String HRMS_IS_STATE_LEVEL_SEARCH_CODE = "isStateLevelSearch"; public static final String HRMS_MDMS_DEPT_CODE = "Department"; public static final String HRMS_MDMS_DESG_CODE = "Designation"; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java index 306f863cc..eed0dd147 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java @@ -47,6 +47,8 @@ public class EmployeeSearchCriteria { public Boolean isActive; + public Boolean isStateLevelSearch; + @Size(max = 250) public String tenantId; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index dc116b7e3..4b6d20f9c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -56,6 +56,7 @@ import javax.validation.Valid; import java.util.HashMap; +import java.util.List; import java.util.Map; @Slf4j @@ -139,5 +140,15 @@ private ResponseEntity count(@RequestParam("tenantId") String tenantId, @Requ return new ResponseEntity<>(response,HttpStatus.OK); } + @PostMapping("v1/_count") + @ResponseBody + private ResponseEntity countV1(@RequestParam("tenantId") String tenantId, @RequestParam("roles") List roles , @RequestParam("isStateLevelSearch") boolean isStateLevelSearch, @RequestBody RequestInfo requestInfo) { + + Map response = new HashMap<>(); + validator.validateEmployeeCountRequest(tenantId); + response = employeeService.getEmployeeCountResponseV1(requestInfo,roles,tenantId,isStateLevelSearch); + return new ResponseEntity<>(response,HttpStatus.OK); + } + } \ No newline at end of file From 5f4efbe5413368411f8f99b35e40ad80c2b35775 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 15:52:02 +0530 Subject: [PATCH 15/52] PFM-1419-User search : added change to Employee search based on user role tenantid --- .../repository/builder/UserTypeQueryBuilder.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java index cdc4c407b..0c523c5e6 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java +++ b/core-services/egov-user/src/main/java/org/egov/user/repository/builder/UserTypeQueryBuilder.java @@ -242,14 +242,20 @@ private void addWhereClauseUserRoles(final StringBuilder selectQuery, final List boolean isAppendAndClause = false; if (userSearchCriteria.getTenantId() != null ) { - if(ObjectUtils.isEmpty(userSearchCriteria.getIsStateLevelSearch())){ + if(ObjectUtils.isEmpty(userSearchCriteria.getIsStateLevelSearch()) ){ isAppendAndClause = addAndClauseIfRequired(false, selectQuery); selectQuery.append(" ur.role_tenantid like ? "); preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); } else { - isAppendAndClause = addAndClauseIfRequired(false, selectQuery); - selectQuery.append(" ur.role_tenantid = ?"); - preparedStatementValues.add(userSearchCriteria.getTenantId()); + if(!userSearchCriteria.getIsStateLevelSearch()) { + isAppendAndClause = addAndClauseIfRequired(false, selectQuery); + selectQuery.append(" ur.role_tenantid = ?"); + preparedStatementValues.add(userSearchCriteria.getTenantId()); + } else { + isAppendAndClause = addAndClauseIfRequired(false, selectQuery); + selectQuery.append(" ur.role_tenantid like ? "); + preparedStatementValues.add( '%' + userSearchCriteria.getTenantId().trim() + '%'); + } } } From a62c7a57500e768e069e8f7187eaa0f2d4a93bc1 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 15:59:25 +0530 Subject: [PATCH 16/52] PFM-1419-User search : added change to Employee search based on user role tenantid --- .../java/org/egov/hrms/web/validator/EmployeeValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java index d20b81405..91a98fa68 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java @@ -251,7 +251,7 @@ private void validateMdmsData(Employee employee, Map errorMap, M public void validateDataConsistency(Employee employee, Map errorMap, Map> mdmsData, Employee existingEmp, RequestInfo requestInfo) { validateUserData(existingEmp,employee,errorMap, requestInfo); validateConsistencyAssignment(existingEmp,employee,errorMap); - validateConsistencyJurisdiction(existingEmp,employee,errorMap); + //validateConsistencyJurisdiction(existingEmp,employee,errorMap); validateConsistencyDepartmentalTest(existingEmp,employee,errorMap); validateConsistencyEducationalDetails(existingEmp,employee,errorMap); validateConsistencyServiceHistory(existingEmp, employee, errorMap); From dd2d07b0fbb37378b5643299769a30c503fba612 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 16:53:47 +0530 Subject: [PATCH 17/52] PFM-1419-User search : added change to Employee search based on user role tenantid --- .../main/java/org/egov/hrms/service/EmployeeService.java | 6 +++++- .../src/main/java/org/egov/hrms/utils/HRMSConstants.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 70ccef0d5..8b9902450 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -152,6 +152,9 @@ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requ userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); if(!ObjectUtils.isEmpty(criteria.isStateLevelSearch)) userSearchCriteria.put(HRMSConstants.HRMS_IS_STATE_LEVEL_SEARCH_CODE, criteria.getIsStateLevelSearch()); + if(!ObjectUtils.isEmpty(criteria.getIsActive())) + userSearchCriteria.put(HRMSConstants.HRMS_IS_ACTIVE_SEARCH_CODE, criteria.getIsActive()); + UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); userChecked =true; if(!CollectionUtils.isEmpty(userResponse.getUser())) { @@ -565,7 +568,8 @@ public Map getEmployeeCountResponse(RequestInfo requestInfo, Stri } public Map getEmployeeCountResponseV1(RequestInfo requestInfo, List roles, String tenantId, boolean isStateLevelSearch){ - //EmployeeResponse employeeResponse = employeeService.search(criteria, requestInfoWrapper.getRequestInfo()); + EmployeeSearchCriteria criteria= EmployeeSearchCriteria.builder().roles(roles).tenantId(tenantId).isStateLevelSearch(isStateLevelSearch).build(); + EmployeeResponse employeeResponse = search(criteria, requestInfo); Map response = new HashMap<>(); Map results = new HashMap<>(); ResponseInfo responseInfo = factory.createResponseInfoFromRequestInfo(requestInfo, true); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index ed2ae342c..ebd703cc3 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -11,6 +11,8 @@ public class HRMSConstants { public static final String HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE = "egov-location"; public static final String HRMS_IS_STATE_LEVEL_SEARCH_CODE = "isStateLevelSearch"; + + public static final String HRMS_IS_ACTIVE_SEARCH_CODE="active"; public static final String HRMS_MDMS_DEPT_CODE = "Department"; public static final String HRMS_MDMS_DESG_CODE = "Designation"; From 6865753d7b43019944d91bc8c2e8b88756ba2b74 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 13 Oct 2023 17:28:24 +0530 Subject: [PATCH 18/52] PFM-1419-User search : added change to Employee count API based on user role tenantid --- .../hrms/repository/EmployeeRepository.java | 17 ----------------- .../org/egov/hrms/service/EmployeeService.java | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java index 0ffca7026..518fb1dcf 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java @@ -110,23 +110,6 @@ public Map fetchEmployeeCount(String tenantId){ Map response = new HashMap<>(); List preparedStmtList = new ArrayList<>(); - String query = queryBuilder.getEmployeeCountQuery(tenantId, preparedStmtList); - log.info("query; "+query); - try { - response=jdbcTemplate.query(query, preparedStmtList.toArray(),countRowMapper); - }catch(Exception e) { - log.error("Exception while making the db call: ",e); - log.error("query; "+query); - } - return response; - } - - public Map fetchEmployeeCountv1(String tenantId, List roles){ - Map response = new HashMap<>(); - List preparedStmtList = new ArrayList<>(); - - - String query = queryBuilder.getEmployeeCountQuery(tenantId, preparedStmtList); log.info("query; "+query); try { diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 8b9902450..bbca31544 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -568,20 +568,27 @@ public Map getEmployeeCountResponse(RequestInfo requestInfo, Stri } public Map getEmployeeCountResponseV1(RequestInfo requestInfo, List roles, String tenantId, boolean isStateLevelSearch){ - EmployeeSearchCriteria criteria= EmployeeSearchCriteria.builder().roles(roles).tenantId(tenantId).isStateLevelSearch(isStateLevelSearch).build(); - EmployeeResponse employeeResponse = search(criteria, requestInfo); - Map response = new HashMap<>(); + EmployeeSearchCriteria activeEmployeeCriteria= EmployeeSearchCriteria.builder().roles(roles).tenantId(tenantId).isStateLevelSearch(isStateLevelSearch).isActive(true).build(); + EmployeeResponse activeEmployeeResponse = search(activeEmployeeCriteria, requestInfo); + EmployeeSearchCriteria inActiveEmployeeCriteria= EmployeeSearchCriteria.builder().roles(roles).tenantId(tenantId).isStateLevelSearch(isStateLevelSearch).isActive(false).build(); + EmployeeResponse inActiveEmployeeResponse = search(inActiveEmployeeCriteria, requestInfo); + Integer activeEmployeeCount= activeEmployeeResponse.getEmployees().size(); + Integer inActiveEmployeeCount = inActiveEmployeeResponse.getEmployees().size(); + Integer totalcount = activeEmployeeCount + inActiveEmployeeCount; Map results = new HashMap<>(); + Map response = new HashMap<>(); ResponseInfo responseInfo = factory.createResponseInfoFromRequestInfo(requestInfo, true); response.put("ResponseInfo",responseInfo); - results = repository.fetchEmployeeCountv1(tenantId, roles); - if(CollectionUtils.isEmpty(results) || results.get("totalEmployee").equalsIgnoreCase("0")){ + if(totalcount == 0){ Map error = new HashMap<>(); error.put("NO_RECORDS","No records found for the tenantId: "+tenantId); throw new CustomException(error); } + results.put("totalEmployee",totalcount.toString()); + results.put("activeEmployee",activeEmployeeCount.toString()); + results.put("inactiveEmployee",inActiveEmployeeCount.toString()); response.put("EmployeCount",results); return response; From 3aa9929bab45890be494965bbcd01a86f8cb4ed8 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 19 Oct 2023 09:57:57 +0530 Subject: [PATCH 19/52] PFM-1419-User search : added change to Employee count API based on user role tenantid --- .../src/main/java/org/egov/hrms/service/EmployeeService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index bbca31544..62a575227 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -252,6 +252,7 @@ private void enrichUser(Employee employee) { pwdParams.add(employee.getTenantId()); pwdParams.add(employee.getUser().getName().toUpperCase()); employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); + log.info("password:"+employee.getUser().getPassword()); employee.getUser().setUserName(employee.getCode()); employee.getUser().setActive(true); employee.getUser().setType(UserType.EMPLOYEE.toString()); From 394b66b0353743f11d29c37b33fe21f0b90e7b6b Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 26 Oct 2023 12:55:04 +0530 Subject: [PATCH 20/52] removing size validation --- .../egov-hrms/src/main/java/org/egov/hrms/model/Employee.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java index e75d2f8bb..40e8f42db 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java @@ -85,7 +85,7 @@ public class Employee { @Valid @NotEmpty - @Size(min = 1,max = 50) + @Size(min = 1,max = 5000) private List jurisdictions = new ArrayList<>(); From 4b62b2d92973d418b8e30ba64c0b8b69a638fd16 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 2 Nov 2023 19:09:14 +0530 Subject: [PATCH 21/52] Added division wise search --- .../main/java/org/egov/user/web/controller/UserController.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java b/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java index f4567dd77..26dd4992b 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/controller/UserController.java @@ -223,9 +223,6 @@ private boolean isMobileValidationRequired(HttpHeaders headers) { public UserSearchResponse getUserBytenant(@RequestBody @Valid UserSearchByTenantsRequest request, @RequestHeader HttpHeaders headers) { log.info("Received User search Request " + request); - if (request.getActive() == null) { - request.setActive(true); - } return searchUsersBytenant(request, headers); } From 5cd43207850d8a54ea150eed29bed38ebf35bfd6 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 2 Nov 2023 19:36:05 +0530 Subject: [PATCH 22/52] Added division wise search --- .../java/org/egov/hrms/service/EmployeeService.java | 1 + .../egov/hrms/web/controller/EmployeeController.java | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 62a575227..ccf69f41b 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -601,6 +601,7 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re criteria.setIsActive(true); else criteria.setIsActive(false);*/ + log.info("criteria :" + criteria.getRoles()); Map mapOfUsers = new HashMap(); if((!CollectionUtils.isEmpty(criteria.getRoles())) && !CollectionUtils.isEmpty(criteria.getTenantIds())) { Map userSearchCriteria = new HashMap<>(); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index 4b6d20f9c..8860c3d39 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -43,10 +43,7 @@ import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; import org.egov.hrms.service.EmployeeService; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.EmployeeResponse; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.egov.hrms.web.contract.RequestInfoWrapper; +import org.egov.hrms.web.contract.*; import org.egov.hrms.web.validator.EmployeeValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -123,9 +120,10 @@ public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestIn @PostMapping(value = "/_searchListOfEmployee") @ResponseBody - public ResponseEntity _searchListOfEmployee(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @RequestBody @Valid EmployeeSearchCriteria criteria) { + public ResponseEntity _searchListOfEmployee(@RequestBody @Valid EmployeeSearchByTenantRequestWrapper employeeSearchByTenantRequestWrapper) { //validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); - EmployeeResponse employeeResponse = employeeService.searchListOfEmployee(criteria, requestInfoWrapper.getRequestInfo()); + log.info("criteria::"+ employeeSearchByTenantRequestWrapper.getCriteria()); + EmployeeResponse employeeResponse = employeeService.searchListOfEmployee(employeeSearchByTenantRequestWrapper.getCriteria(), employeeSearchByTenantRequestWrapper.getRequestInfo()); return new ResponseEntity<>(employeeResponse,HttpStatus.OK); } From 489f99fb6b2463feb6757d84fd336ef75bcf1e17 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 2 Nov 2023 20:00:08 +0530 Subject: [PATCH 23/52] Added division wise search --- .../EmployeeSearchByTenantRequestWrapper.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchByTenantRequestWrapper.java diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchByTenantRequestWrapper.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchByTenantRequestWrapper.java new file mode 100644 index 000000000..7f2d67d25 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchByTenantRequestWrapper.java @@ -0,0 +1,33 @@ +package org.egov.hrms.web.contract; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.model.Employee; +import org.hibernate.validator.constraints.NotEmpty; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; + +@Validated +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EmployeeSearchByTenantRequestWrapper { + @NotNull + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @Valid + @JsonProperty("criteria") + private EmployeeSearchCriteria criteria; + +} + + From ef094293a40fa89e2c7d9a2434814b4b4d1e84c8 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Fri, 3 Nov 2023 14:07:53 +0530 Subject: [PATCH 24/52] Added logic to allow number to add in tenantid --- .../main/java/org/egov/user/config/UserServiceConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/config/UserServiceConstants.java b/core-services/egov-user/src/main/java/org/egov/user/config/UserServiceConstants.java index 78e1c2ff1..82d0f9e54 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/config/UserServiceConstants.java +++ b/core-services/egov-user/src/main/java/org/egov/user/config/UserServiceConstants.java @@ -59,7 +59,7 @@ public class UserServiceConstants { public static final String PATTERN_GENDER = "^[a-zA-Z ]*$"; public static final String PATTERN_MOBILE = "(^$|[0-9]{10})"; public static final String PATTERN_CITY = "^[a-zA-Z. ]*$"; - public static final String PATTERN_TENANT = "^[a-zA-Z. ]*$"; + public static final String PATTERN_TENANT = "^[a-zA-Z.0-9 ]*$"; public static final String PATTERN_PINCODE = "^[1-9][0-9]{5}$"; } From 95588ece38a220045d4240eb9f40bf7ce2856f55 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 7 Nov 2023 17:42:47 +0530 Subject: [PATCH 25/52] Added log lines --- .../hrms/web/validator/EmployeeValidator.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java index 91a98fa68..242f6d699 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java @@ -465,12 +465,21 @@ private void validateJurisdicton(Employee employee, Map errorMap List hierarchyTypes = JsonPath.read(boundaryMap,hierarchy_type_path); List boundaryTypes = JsonPath.read(boundaryMap,boundary_type_path); List boundaryValues = JsonPath.read(boundaryMap,boundary_value_path); - if(!hierarchyTypes.contains(jurisdiction.getHierarchy())) + if(!hierarchyTypes.contains(jurisdiction.getHierarchy())) { + log.info("Tenant:" +jurisdiction.getTenantId()); + log.info("jurisdiction hirarchy: "+ jurisdiction.getHierarchy() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_MSG); - if(!boundaryTypes.contains(jurisdiction.getBoundaryType())) + } + if(!boundaryTypes.contains(jurisdiction.getBoundaryType())) { + log.info("Tenant:" +jurisdiction.getTenantId()); + log.info(" Boundary type: "+ jurisdiction.getBoundaryType() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_MSG); - if(!boundaryValues.contains(jurisdiction.getBoundary())) + } + if(!boundaryValues.contains(jurisdiction.getBoundary())) { + log.info("Tenant:" +jurisdiction.getTenantId()); + log.info(" Boundary:"+jurisdiction.getBoundary() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_MSG); + } } From 02d30e1e7c562e022190ba4be4d9a322ce001cc0 Mon Sep 17 00:00:00 2001 From: Debasish Chakraborty <117706910+debasishchakraborty-egovt@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:45:06 +0530 Subject: [PATCH 26/52] Update Employee.java --- .../egov-hrms/src/main/java/org/egov/hrms/model/Employee.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java index e75d2f8bb..291094387 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java @@ -85,7 +85,7 @@ public class Employee { @Valid @NotEmpty - @Size(min = 1,max = 50) + @Size(min = 1,max = 5000) private List jurisdictions = new ArrayList<>(); @@ -132,4 +132,4 @@ public class Employee { private User user; -} \ No newline at end of file +} From 70674cf16b0af17171cc1ca98b9860718acb0d8a Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 1 Feb 2024 15:13:40 +0530 Subject: [PATCH 27/52] Removed log lines --- .../main/java/org/egov/user/domain/service/UserService.java | 3 --- .../org/egov/user/persistence/repository/UserRepository.java | 1 - 2 files changed, 4 deletions(-) diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java index cbdc60643..2cc31af39 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java @@ -189,8 +189,6 @@ public List searchUsers(UserSearchCriteria sear searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); } /* encrypt here / encrypted searchcriteria will be used for search*/ - log.info("Search Criteria:"+searchCriteria.getTenantId()); - log.info("Search Criteria:"+searchCriteria); @@ -659,7 +657,6 @@ public void validatePassword(String password) { } } public List searchUsersByTenants(UserSearchCriteria searchCriteria, RequestInfo requestInfo) { - log.info("INSIDE USER SEARCH BY TENANT"); //searchCriteria.validate(isInterServiceCall); if(ObjectUtils.isEmpty(searchCriteria.getTenantIds())) { return null; diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index 645383550..70a83edef 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -580,7 +580,6 @@ public List findUserByTenant(UserSearchCriteria userSearch) { List userIds = new ArrayList<>(); if (!isEmpty(userSearch.getRoleCodes()) && userSearch.getTenantIds() != null) { userIds = findUsersWithRole(userSearch); - log.info("USER IDS:" + userIds); RoleSearchHappend = true; } List users = new ArrayList<>(); From 11d9bd4ba0e409a0d32704eb981d9d21be0aab90 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Thu, 1 Feb 2024 15:36:55 +0530 Subject: [PATCH 28/52] Removed log lines --- .../src/main/java/org/egov/hrms/service/EmployeeService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index ccf69f41b..102c387de 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -622,8 +622,6 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re else criteria.setUuids(userUUIDs); } - log.info("criteria:"+criteria.getUuids().size()); - log.info("criteria list :"+criteria); //checks if above criteria met and result is not null will check for name search if list of names are given as user search on name is not bulk api List employees = new ArrayList<>(); log.info("Employe search boolean:"+(!((!CollectionUtils.isEmpty(criteria.getRoles()))))); From 3e4a966aca0a122a5fededf3144b08d1cbe49ebf Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:16:13 +0530 Subject: [PATCH 29/52] PFM-5577 (#711) --- .../bill_generation_details_provider.dart | 90 ++++++++++--------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index 16dc0647e..eaab79238 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -360,47 +360,48 @@ class BillGenerationProvider with ChangeNotifier { navigatorKey.currentContext!, listen: false); var rate = rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').toList(); - showDialog(context: context, builder: (context)=>AlertDialog( - surfaceTintColor: Colors.white, - title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), - content: Container( - height: 370, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), - SizedBox(height: 10,), - FittedBox( - child: DataTable( - border: TableBorder.all( + if(selectedBillPeriod!=null){ + showDialog(context: context, builder: (context)=>AlertDialog( + surfaceTintColor: Colors.white, + title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), + content: Container( + height: 370, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), + SizedBox(height: 10,), + FittedBox( + child: DataTable( + border: TableBorder.all( width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.grey,), columns: [ - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )),], rows: [ - ...rate.map((e) => DataRow(cells: [ - DataCell(Text( - "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), - DataCell(Text("${e.minimumCharge}")) - ])).toList() - ],), + color: Colors.grey,), columns: [ + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )),], rows: [ + ...rate.map((e) => DataRow(cells: [ + DataCell(Text( + "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), + DataCell(Text("${e.minimumCharge}")) + ])).toList() + ],), + ), + SizedBox(height: 10,), + Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. + ], ), - SizedBox(height: 10,), - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. - ], ), - ), - actions: + actions: (rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').length- rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered' && element.minimumCharge==0).length == 0 ) ? [TextButton(onPressed: (){ @@ -445,11 +446,14 @@ class BillGenerationProvider with ChangeNotifier { })); } }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.YES)}')), - TextButton(onPressed: (){ - Navigator.pop(context); - }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),] - , - )); + TextButton(onPressed: (){ + Navigator.pop(context); + }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),] + , + )); + }else{ + Notifiers.getToastMessage(context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); //Please select billing cycle + } } else { autoValidation = true; notifyListeners(); From f6ff0f14517bb10dc3bb003f93ef8cc6ab45bbab Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Sun, 4 Feb 2024 13:18:29 +0530 Subject: [PATCH 30/52] PFM-5577 (#712) * PFM-5577 --- .../lib/providers/bill_generation_details_provider.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index eaab79238..b4af33f53 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -182,6 +182,7 @@ class BillGenerationProvider with ChangeNotifier { billGenerateDetails.billYear = null; selectedBillCycle = null; billGenerateDetails.billCycle = null; + selectedBillPeriod = null; notifyListeners(); } void onChangeOfBillCycle(cycle) { From ebd43da728bb3cac7d98e746ae120e44c374bee6 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Sun, 4 Feb 2024 14:16:19 +0530 Subject: [PATCH 31/52] Develop (#713) * PFM-5577 * PFM-5577 * PFM-4085,PFM-4082 added S.No --- .../lib/providers/reports_provider.dart | 50 +++++++++++++++---- .../lib/screeens/reports/reports.dart | 4 ++ .../utils/constants/i18_key_constants.dart | 1 + 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 395e5e86f..fd169ff9e 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -52,6 +52,11 @@ class ReportsProvider with ChangeNotifier { selectedBillCycle = null; billingcycleCtrl.clear(); billingyearCtrl.clear(); + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -110,10 +115,10 @@ class ReportsProvider with ChangeNotifier { ]; List get vendorReportHeaderList => [ + TableHeader(i18.common.BILL_ID), TableHeader(i18.expense.VENDOR_NAME), TableHeader(i18.common.MOBILE_NUMBER), TableHeader(i18.expense.EXPENSE_TYPE), - TableHeader(i18.common.BILL_ID), ]; void onChangeOfPageLimit( @@ -245,10 +250,10 @@ class ReportsProvider with ChangeNotifier { String? typeOfExpense = CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); String? billId = CommonMethods.truncateWithEllipsis(20, data.billId!); return TableDataRow([ + TableData('${billId ?? '-'}'), TableData('${vendorName ?? '-'}'), TableData('${data.mobileNo ?? '-'}'), TableData('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), - TableData('${billId ?? '-'}'), ]); } @@ -263,6 +268,11 @@ class ReportsProvider with ChangeNotifier { billingcycleCtrl.clear(); selectedBillCycle = null; selectedBillPeriod = null; + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -279,6 +289,11 @@ class ReportsProvider with ChangeNotifier { .toLocal() .toString(), dateFormat: "dd/MM/yyyy"); + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -745,6 +760,7 @@ class ReportsProvider with ChangeNotifier { //Create a Excel document. //Creating a workbook. + headers.insert(0, '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.S_NO)}'); final Workbook workbook = Workbook(); //Accessing via index final Worksheet sheet = workbook.worksheets[0]; @@ -754,20 +770,25 @@ class ReportsProvider with ChangeNotifier { sheet.enableSheetCalculations(); int dataStartRow = 2; int headersStartRow = 1; - // //Set data in the worksheet. + // //Set data in the worksheet.s if (optionalData.isEmpty) { sheet.getRangeByName('A1:D1').columnWidth = 32.5; sheet.getRangeByName('A1:D1').cellStyle.hAlign = HAlignType.center; } else { - sheet.getRangeByName('A1:D1').columnWidth = 32.5; - sheet.getRangeByName('A2:D2').columnWidth = 32.5; - sheet.getRangeByName('A2:D2').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A1:A${tableData.length+1}').columnWidth = 12.5; + sheet.getRangeByName('A1:A${tableData.length+1}').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A1:A${tableData.length+1}').autoFit(); + sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').columnWidth = 32.5; + sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('B2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').columnWidth = 32.5; + sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.bold = true; dataStartRow = 3; headersStartRow = 2; for (int i = 0; i < optionalData.length; i++) { sheet .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[i].label}1') + '${CommonMethods.getAlphabetsWithKeyValue()[i+1].label}1') .setText( optionalData[CommonMethods.getAlphabetsWithKeyValue()[i].key]); } @@ -782,10 +803,17 @@ class ReportsProvider with ChangeNotifier { for (int i = dataStartRow; i < tableData.length + dataStartRow; i++) { for (int j = 0; j < headers.length; j++) { - sheet - .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') - .setText(tableData[i - dataStartRow][j]); + if(j==0){ + sheet + .getRangeByName( + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + .setText('${i - dataStartRow+1}'); + }else{ + sheet + .getRangeByName( + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + .setText(tableData[i - dataStartRow][j - 1]); + } sheet .getRangeByName( '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') diff --git a/frontend/mgramseva/lib/screeens/reports/reports.dart b/frontend/mgramseva/lib/screeens/reports/reports.dart index 53305da4a..02f245535 100644 --- a/frontend/mgramseva/lib/screeens/reports/reports.dart +++ b/frontend/mgramseva/lib/screeens/reports/reports.dart @@ -55,6 +55,10 @@ class _Reports extends State with SingleTickerProviderStateMixin { navigatorKey.currentContext!, listen: false); reportsProvider.getFinancialYearList(); + reportsProvider.clearBillingSelection(); + reportsProvider.clearBuildTableData(); + reportsProvider.clearTableData(); + } showTable(bool status, String title) { diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 1a6634757..27c7708d6 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -38,6 +38,7 @@ class Login { class Common { const Common(); String get CONTINUE => 'CORE_COMMON_CONTINUE'; + String get S_NO => 'S_NO'; String get LAST_BILL_CYCLE_MONTH => 'LAST_BILL_CYCLE_MONTH'; String get CONSUMER_COUNT => 'CONSUMER_COUNT'; String get LAST_BILL_CYCLE_DEMAND_NOT_GENERATED => 'LAST_BILL_CYCLE_DEMAND_NOT_GENERATED'; From 25495436b4597f15162ed119aacf6e13a669c70e Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Sun, 4 Feb 2024 15:04:03 +0530 Subject: [PATCH 32/52] Develop (#714) * PFM-5577 * PFM-5577 * PFM-4085,PFM-4082 added S.No * bumped web version --- frontend/mgramseva/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/package.json b/frontend/mgramseva/package.json index 7734c7a85..96a15c476 100644 --- a/frontend/mgramseva/package.json +++ b/frontend/mgramseva/package.json @@ -1,5 +1,5 @@ { "name": "mgramseva", - "version": "1.2.18", + "version": "1.2.20", "license": "egov" } From 11e528451e9744003aa459aadd76e68fbb84ed38 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Wed, 7 Feb 2024 15:07:05 +0530 Subject: [PATCH 33/52] Adding default password. --- .../src/main/java/org/egov/hrms/service/EmployeeService.java | 4 +++- .../src/main/java/org/egov/hrms/utils/HRMSConstants.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 102c387de..71fc8d420 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -251,7 +251,9 @@ private void enrichUser(Employee employee) { pwdParams.add(employee.getUser().getMobileNumber()); pwdParams.add(employee.getTenantId()); pwdParams.add(employee.getUser().getName().toUpperCase()); - employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); + //TODO:Add localition of sms and add template to register SMS + //employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); + employee.getUser().setPassword(HRMSConstants.HRMS_USER_DEFAULT_PASSWORD); log.info("password:"+employee.getUser().getPassword()); employee.getUser().setUserName(employee.getCode()); employee.getUser().setActive(true); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index ebd703cc3..997f00955 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -46,6 +46,8 @@ public class HRMSConstants { public static final String HRMS_USER_SEARCH_CRITERA_ROLECODES = "roleCodes"; public static final String HRMS_USER_SEARCH_CRITERA_TENANTID = "tenantId"; + public static final String HRMS_USER_DEFAULT_PASSWORD="eGov@123"; + public static final String HRMS_USER_SEARCH_CRITERA_TENANTIDS = "tenantIds"; public static final String HRMS_USER_SEARCH_CRITERA_MOBILENO = "mobileNumber"; public static final String HRMS_USER_SEARCH_CRITERA_NAME = "name"; From d7d0bcce1782325fba020712485c6319937e9ccf Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 8 Feb 2024 15:25:13 +0530 Subject: [PATCH 34/52] PFM-4855 --- .../ws-calculator/src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/municipal-services/ws-calculator/src/main/resources/application.properties b/municipal-services/ws-calculator/src/main/resources/application.properties index c1860ade8..9b8bb7a36 100644 --- a/municipal-services/ws-calculator/src/main/resources/application.properties +++ b/municipal-services/ws-calculator/src/main/resources/application.properties @@ -22,6 +22,7 @@ spring.kafka.consumer.group-id=egov-ws-calc-services spring.kafka.consumer.properties.spring.json.use.type.headers=false spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.consumer.properties.max.poll.interval.ms=600000 $KAFKA TOPIC DETAILS egov.watercalculatorservice.createdemand.topic=ws-generate-demand From 65150fa4658ce88f7c6a27c915c88abfacc50a1b Mon Sep 17 00:00:00 2001 From: Saloni <103189799+saloni041@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:35:10 +0530 Subject: [PATCH 35/52] Update application.properties (#726) --- .../ws-calculator/src/main/resources/application.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/municipal-services/ws-calculator/src/main/resources/application.properties b/municipal-services/ws-calculator/src/main/resources/application.properties index 9b8bb7a36..c1860ade8 100644 --- a/municipal-services/ws-calculator/src/main/resources/application.properties +++ b/municipal-services/ws-calculator/src/main/resources/application.properties @@ -22,7 +22,6 @@ spring.kafka.consumer.group-id=egov-ws-calc-services spring.kafka.consumer.properties.spring.json.use.type.headers=false spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.consumer.properties.max.poll.interval.ms=600000 $KAFKA TOPIC DETAILS egov.watercalculatorservice.createdemand.topic=ws-generate-demand From 562d9757bdc7c0465c39ce92af26d780e8dba0d5 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Mon, 12 Feb 2024 11:51:56 +0530 Subject: [PATCH 36/52] removed juristrictionn validation!! --- .../java/org/egov/hrms/web/validator/EmployeeValidator.java | 2 +- .../egov-hrms/src/main/resources/application.properties | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java index 242f6d699..d9001b3b6 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java @@ -234,7 +234,7 @@ private void validateMdmsData(Employee employee, Map errorMap, M validateEmployee(employee, errorMap, mdmsData); validateAssignments(employee, errorMap, mdmsData); validateServiceHistory(employee, errorMap, mdmsData); - validateJurisdicton(employee, errorMap, mdmsData, boundaryMap); + //validateJurisdicton(employee, errorMap, mdmsData, boundaryMap); validateEducationalDetails(employee, errorMap, mdmsData); validateDepartmentalTest(employee, errorMap, mdmsData); } diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 99e094425..92fec5b97 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -30,6 +30,8 @@ egov.services.data_sync_employee.required = false egov.mdms.host=https://dev.digit.org egov.mdms.search.endpoint=/egov-mdms-service/v1/_search #egov.mdms.search.endpoint=/egov-mdms-service-test/v1/_search +egov.mdms.search.endpoint.old= /egov-mdms-service/v1/_search +egov.mdms.host.old=https://dev.digit.org #filestore urls egov.filestore.host=https://dev.digit.org From 213858914b8311736ec58764caa11271844c49b5 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 13 Feb 2024 13:56:26 +0530 Subject: [PATCH 37/52] PFM-4855 --- .../ws-calculator/src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/municipal-services/ws-calculator/src/main/resources/application.properties b/municipal-services/ws-calculator/src/main/resources/application.properties index c1860ade8..9b8bb7a36 100644 --- a/municipal-services/ws-calculator/src/main/resources/application.properties +++ b/municipal-services/ws-calculator/src/main/resources/application.properties @@ -22,6 +22,7 @@ spring.kafka.consumer.group-id=egov-ws-calc-services spring.kafka.consumer.properties.spring.json.use.type.headers=false spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.consumer.properties.max.poll.interval.ms=600000 $KAFKA TOPIC DETAILS egov.watercalculatorservice.createdemand.topic=ws-generate-demand From 022ad7b6807455f9b0d0c8437e09ad96f705390e Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Wed, 28 Feb 2024 12:10:19 +0530 Subject: [PATCH 38/52] PFM:1419 : Added chnages to remove log lines and remove hardcoded password !! --- .../org/egov/hrms/service/EmployeeService.java | 15 +-------------- .../java/org/egov/hrms/service/UserService.java | 1 - .../java/org/egov/hrms/utils/HRMSConstants.java | 3 --- .../hrms/web/controller/EmployeeController.java | 2 -- .../hrms/web/validator/EmployeeValidator.java | 6 ------ .../persistence/repository/UserRepository.java | 2 -- 6 files changed, 1 insertion(+), 28 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index 71fc8d420..f75cf0cb9 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -234,7 +234,6 @@ private void createUser(Employee employee, RequestInfo requestInfo) { employee.getUser().setUuid(user.getUuid()); }catch(Exception e) { log.error("Exception while creating user: ",e); - log.error("request: "+request); throw new CustomException(ErrorConstants.HRMS_USER_CREATION_FAILED_CODE, ErrorConstants.HRMS_USER_CREATION_FAILED_MSG); } @@ -252,9 +251,7 @@ private void enrichUser(Employee employee) { pwdParams.add(employee.getTenantId()); pwdParams.add(employee.getUser().getName().toUpperCase()); //TODO:Add localition of sms and add template to register SMS - //employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); - employee.getUser().setPassword(HRMSConstants.HRMS_USER_DEFAULT_PASSWORD); - log.info("password:"+employee.getUser().getPassword()); + employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); employee.getUser().setUserName(employee.getCode()); employee.getUser().setActive(true); employee.getUser().setType(UserType.EMPLOYEE.toString()); @@ -363,7 +360,6 @@ private void updateUser(Employee employee, RequestInfo requestInfo) { userService.updateUser(request); }catch(Exception e) { log.error("Exception while updating user: ",e); - log.error("request: "+request); throw new CustomException(ErrorConstants.HRMS_USER_UPDATION_FAILED_CODE, ErrorConstants.HRMS_USER_UPDATION_FAILED_MSG); } @@ -603,7 +599,6 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re criteria.setIsActive(true); else criteria.setIsActive(false);*/ - log.info("criteria :" + criteria.getRoles()); Map mapOfUsers = new HashMap(); if((!CollectionUtils.isEmpty(criteria.getRoles())) && !CollectionUtils.isEmpty(criteria.getTenantIds())) { Map userSearchCriteria = new HashMap<>(); @@ -611,13 +606,11 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re if( !CollectionUtils.isEmpty(criteria.getRoles()) ) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); UserResponse userResponse = userService.getUserByTenantids(requestInfo, userSearchCriteria); - log.info("user responsesize:"+userResponse.getUser().size() ); userChecked =true; if(!CollectionUtils.isEmpty(userResponse.getUser())) { mapOfUsers.putAll(userResponse.getUser().stream() .collect(Collectors.toMap(User::getUuid, Function.identity()))); } - log.info("Map of User length:"+mapOfUsers.size()); List userUUIDs = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(criteria.getUuids())) criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); @@ -626,25 +619,19 @@ public EmployeeResponse searchListOfEmployee(EmployeeSearchCriteria criteria, Re } //checks if above criteria met and result is not null will check for name search if list of names are given as user search on name is not bulk api List employees = new ArrayList<>(); - log.info("Employe search boolean:"+(!((!CollectionUtils.isEmpty(criteria.getRoles()))))); employees = repository.fetchEmployees(criteria, requestInfo); - log.info("innside fetch employee if true:"+ employees.size()); List uuids = employees.stream().map(Employee :: getUuid).collect(Collectors.toList()); - log.info("uuids:" +uuids.size()); if(!CollectionUtils.isEmpty(uuids)){ Map UserSearchCriteria = new HashMap<>(); UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); if(mapOfUsers.isEmpty()){ UserResponse userResponse = userService.getUser(requestInfo, UserSearchCriteria); - log.info("mapOfUsers not empty:"+userResponse.getUser().size()); if(!CollectionUtils.isEmpty(userResponse.getUser())) { - log.info("mapOfUsers not empty and user reponse size:"+userResponse.getUser().size()); mapOfUsers = userResponse.getUser().stream() .collect(Collectors.toMap(User :: getUuid, Function.identity())); } } for(Employee employee: employees){ - log.info("employee uuid:"+employee.getUuid()); employee.setUser(mapOfUsers.get(employee.getUuid())); } } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java index 03edf00d5..b13c04696 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java @@ -130,7 +130,6 @@ public UserResponse getUser(RequestInfo requestInfo, Map UserSea public UserResponse getUserByTenantids(RequestInfo requestInfo, Map UserSearchCriteria ) { StringBuilder uri = new StringBuilder(); Map userSearchReq = new HashMap<>(); - userSearchReq.put("RequestInfo", requestInfo); userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); for( String key: UserSearchCriteria.keySet()) userSearchReq.put(key, UserSearchCriteria.get(key)); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 997f00955..86293fc3a 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -45,9 +45,6 @@ public class HRMSConstants { public static final String HRMS_USER_SEARCH_CRITERA_UUID = "uuid"; public static final String HRMS_USER_SEARCH_CRITERA_ROLECODES = "roleCodes"; public static final String HRMS_USER_SEARCH_CRITERA_TENANTID = "tenantId"; - - public static final String HRMS_USER_DEFAULT_PASSWORD="eGov@123"; - public static final String HRMS_USER_SEARCH_CRITERA_TENANTIDS = "tenantIds"; public static final String HRMS_USER_SEARCH_CRITERA_MOBILENO = "mobileNumber"; public static final String HRMS_USER_SEARCH_CRITERA_NAME = "name"; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index 8860c3d39..1bf065440 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -121,8 +121,6 @@ public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestIn @PostMapping(value = "/_searchListOfEmployee") @ResponseBody public ResponseEntity _searchListOfEmployee(@RequestBody @Valid EmployeeSearchByTenantRequestWrapper employeeSearchByTenantRequestWrapper) { - //validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); - log.info("criteria::"+ employeeSearchByTenantRequestWrapper.getCriteria()); EmployeeResponse employeeResponse = employeeService.searchListOfEmployee(employeeSearchByTenantRequestWrapper.getCriteria(), employeeSearchByTenantRequestWrapper.getRequestInfo()); return new ResponseEntity<>(employeeResponse,HttpStatus.OK); } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java index d9001b3b6..8238ae857 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java @@ -466,18 +466,12 @@ private void validateJurisdicton(Employee employee, Map errorMap List boundaryTypes = JsonPath.read(boundaryMap,boundary_type_path); List boundaryValues = JsonPath.read(boundaryMap,boundary_value_path); if(!hierarchyTypes.contains(jurisdiction.getHierarchy())) { - log.info("Tenant:" +jurisdiction.getTenantId()); - log.info("jurisdiction hirarchy: "+ jurisdiction.getHierarchy() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_MSG); } if(!boundaryTypes.contains(jurisdiction.getBoundaryType())) { - log.info("Tenant:" +jurisdiction.getTenantId()); - log.info(" Boundary type: "+ jurisdiction.getBoundaryType() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_MSG); } if(!boundaryValues.contains(jurisdiction.getBoundary())) { - log.info("Tenant:" +jurisdiction.getTenantId()); - log.info(" Boundary:"+jurisdiction.getBoundary() ); errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_MSG); } } diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java index 70a83edef..0f6e5685f 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/repository/UserRepository.java @@ -69,7 +69,6 @@ public List findAll(UserSearchCriteria userSearch) { userIds = findUsersWithRole(userSearch); RoleSearchHappend = true; } - log.info("User role serach Count:"+userIds.size()); List users = new ArrayList<>(); if (RoleSearchHappend) { if (!CollectionUtils.isEmpty(userIds)) { @@ -106,7 +105,6 @@ public List findUsersWithRole(UserSearchCriteria userSearch) { final List preparedStatementValues = new ArrayList<>(); List usersIds = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQueryUserRoleSearch(userSearch, preparedStatementValues); - log.info("ROLE SEARCH QUERY:" + queryStr); usersIds = jdbcTemplate.queryForList(queryStr, preparedStatementValues.toArray(), Long.class); return usersIds; From 350debaa5ecd12d2ccf7496719eeb639bf1589c8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 28 Feb 2024 13:32:08 +0530 Subject: [PATCH 39/52] PFM-5688 updated message template --- .../org/egov/hrms/service/NotificationService.java | 13 +++++++++---- .../java/org/egov/hrms/utils/HRMSConstants.java | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index 1168d41fb..e7128cfa0 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -65,7 +65,7 @@ public class NotificationService { * @param pwdMap */ public void sendNotification(EmployeeRequest request, Map pwdMap) { - String message = getMessage(request,HRMSConstants.HRMS_EMP_CREATE_LOCLZN_CODE); + String message = getMessage(request,HRMSConstants.ON_BOARD_EMPLOYEE); if(StringUtils.isEmpty(message)) { log.info("SMS content has not been configured for this case"); return; @@ -149,9 +149,14 @@ public String getMessage(EmployeeRequest request,String msgCode) { * @return */ public String buildMessage(Employee employee, String message, Map pwdMap) { - message = message.replace("$username", employee.getCode()).replace("$password", pwdMap.get(employee.getUuid())) - .replace("$employeename", employee.getUser().getName()); - message = message.replace("$applink", appLink); +// message = message.replace("$username", employee.getCode()).replace("$password", pwdMap.get(employee.getUuid())) +// .replace("$employeename", employee.getUser().getName()); +// message = message.replace("$applink", appLink); + message=message.replace("{USER}", employee.getCode()); + message=message.replace("{LINK}",appLink); + message=message.replace("{PHNO}",employee.getUser().getMobileNumber()); + message=message.replace("{PASSWORD}",pwdMap.get(employee.getUuid())); + log.info("Message send to user at time of onboard "+message); return message; } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 86293fc3a..645f6f288 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -32,6 +32,7 @@ public class HRMSConstants { public static final String HRMS_EMP_CREATE_LOCLZN_CODE = "hrms.employee.create.notification"; + public static final String ON_BOARD_EMPLOYEE ="SMS_ON_BOARD_EMPLOYEE"; public static final String HRMS_EMP_REACTIVATE_LOCLZN_CODE = "hrms.employee.reactivation.notification"; public static final String HRMS_LOCALIZATION_MODULE_CODE = "egov-hrms"; public static final String HRMS_LOCALIZATION_ENG_LOCALE_CODE = "en_IN"; From 364b8c2f66add4bad04297a9e8bd6e12e472ab9d Mon Sep 17 00:00:00 2001 From: Debasish Chakraborty <117706910+debasishchakraborty-egovt@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:13:58 +0530 Subject: [PATCH 40/52] Update UserService.java --- .../src/main/java/org/egov/hrms/service/UserService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java index b13c04696..f367601e1 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java @@ -130,6 +130,7 @@ public UserResponse getUser(RequestInfo requestInfo, Map UserSea public UserResponse getUserByTenantids(RequestInfo requestInfo, Map UserSearchCriteria ) { StringBuilder uri = new StringBuilder(); Map userSearchReq = new HashMap<>(); + userSearchReq.put("RequestInfo", requestInfo); userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); for( String key: UserSearchCriteria.keySet()) userSearchReq.put(key, UserSearchCriteria.get(key)); @@ -211,4 +212,4 @@ private Long dateTolong(String date,String format){ } -} \ No newline at end of file +} From f5e0cb3afc5516cd79246b6999836ba65c5040f6 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 29 Feb 2024 14:25:59 +0530 Subject: [PATCH 41/52] PFM-5688 updated message template --- .../main/java/org/egov/hrms/service/NotificationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index e7128cfa0..44fe4432c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -152,7 +152,7 @@ public String buildMessage(Employee employee, String message, Map Date: Tue, 5 Mar 2024 22:29:33 +0530 Subject: [PATCH 42/52] PFM-5064 Restrict to show path two months only --- .../providers/consumer_details_provider.dart | 33 ++++++ .../consumer_details/consumer_details.dart | 7 +- .../mgramseva/lib/utils/common_methods.dart | 108 +++++++++++++++++- 3 files changed, 143 insertions(+), 5 deletions(-) diff --git a/frontend/mgramseva/lib/providers/consumer_details_provider.dart b/frontend/mgramseva/lib/providers/consumer_details_provider.dart index 2048a5d92..138a88e35 100644 --- a/frontend/mgramseva/lib/providers/consumer_details_provider.dart +++ b/frontend/mgramseva/lib/providers/consumer_details_provider.dart @@ -625,6 +625,39 @@ class ConsumerProvider with ChangeNotifier { } return >[]; } + //Displaying Billing Cycle Vaule (EX- JAN-2021,,) + List> getBillingCycleMonthCountCurrent(TaxPeriod? billYear) { + var dates = >[]; + if (billYear!=null) { + DatePeriod ytd; + var fromDate = DateFormats.getFormattedDateToDateTime( + DateFormats.timeStampToDate(billYear?.fromDate)) as DateTime; + + var toDate = DateFormats.getFormattedDateToDateTime( + DateFormats.timeStampToDate(billYear?.toDate)) as DateTime; + + ytd = DatePeriod(fromDate,toDate,DateType.YTD); + + /// Get months based on selected billing year + var months = CommonMethods.getPastMonthUntilFinancialYTDMonthCount(ytd); + + /// if selected year is future year means all the months will be removed + if(fromDate.year > ytd.endDate.year) months.clear(); + + for (var i = 0; i < months.length; i++) { + var prevMonth = months[i].startDate; + var r = {"code": prevMonth, "name": '${ApplicationLocalizations.of(navigatorKey.currentContext!) + .translate((Constants.MONTHS[prevMonth.month - 1])) + + " - " + + prevMonth.year.toString()}'}; + dates.add(r); + } + } + if (dates.length > 0 && waterconnection.connectionType == 'Non_Metered') { + return dates; + } + return >[]; + } incrementIndex(index, consumerGenderKey) async { if (boundaryList.length > 1) { diff --git a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart index 226c66d02..7b71d911d 100644 --- a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart +++ b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart @@ -512,8 +512,8 @@ class _ConsumerDetailsState extends State { '', consumerProvider .onChangeOfBillYear, - consumerProvider - .getFinancialYearList(), + [consumerProvider + .getFinancialYearList().first], true, itemAsString: (i) =>'${ApplicationLocalizations.of(context).translate(i.financialYear)}', controller: consumerProvider @@ -532,7 +532,8 @@ class _ConsumerDetailsState extends State { consumerProvider .onChangeBillingCycle, consumerProvider - .getBillingCycle(), + .getBillingCycleMonthCountCurrent(consumerProvider + .billYear), true, itemAsString: (i) =>"${ApplicationLocalizations.of(context).translate(i['name'])}", controller: consumerProvider diff --git a/frontend/mgramseva/lib/utils/common_methods.dart b/frontend/mgramseva/lib/utils/common_methods.dart index 633b4d38f..5443a7d2c 100644 --- a/frontend/mgramseva/lib/utils/common_methods.dart +++ b/frontend/mgramseva/lib/utils/common_methods.dart @@ -57,7 +57,60 @@ class CommonMethods { * rahul.dev@egovernments.org * * */ - + static var daysInMonthLeap = [ + 31, + 29, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31 + ]; + static var daysInMonth = [ + 31, + 28, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31 + ]; + static bool isLeapYear(int year) { + if (year % 4 == 0) { + if (year % 100 == 0) { + if (year % 400 == 0) { + return true; + } else { + return false; + } + } else { + return true; + } + } else { + return false; + } + } + static int daysToSub(int monthCount, int year) { + var days = 0; + for (int i = 0; i < monthCount; i++) { + if (isLeapYear(year)) { + days += daysInMonthLeap[i]; + } else { + days += daysInMonth[i]; + } + } + return days; + } static List getPastMonthUntilFinancialYTD(DatePeriod ytd, {bool showCurrentMonth = false}) { var monthList = []; @@ -109,7 +162,58 @@ class CommonMethods { .toList(); return list; } - + static List getPastMonthUntilFinancialYTDMonthCount(DatePeriod ytd, + {int monthCount=2,bool showCurrentMonth = false}) { + var monthList = []; + final currentTime = DateTime.now(); + DatePeriod newDT = DatePeriod(ytd.endDate.subtract(Duration(days: daysToSub(monthCount,currentTime.year))), ytd.endDate, DateType.MONTH); + if (currentTime.year < newDT.startDate.year) { + return []; + } + if (currentTime.year == newDT.startDate.year) { + //when current year is same as start year of financial year + for (int i = newDT.startDate.month; + i <= (showCurrentMonth ? currentTime.month : currentTime.month - 1); + i++) { + monthList.add(DateTime(currentTime.year, i)); + } + } else if (currentTime.year == newDT.endDate.year) { + //when current year is same as end year of financial year + for (int i = newDT.startDate.month; i <= 12; i++) { + monthList.add(DateTime(newDT.startDate.year, i)); + } + for (int i = 1; + i <= + (currentTime.month <= newDT.endDate.month + ? showCurrentMonth + ? currentTime.month + : currentTime.month - 1 + : newDT.endDate.month); + /* + * if current month is less than or equal to end month of financial year + * we are using months less than current month and if it is more than + * end month of financial year we are using till end month of financial + * year + */ + i++) { + monthList.add(DateTime(newDT.endDate.year, i)); + } + } else { + for (int i = newDT.startDate.month; i <= 12; i++) { + monthList.add(DateTime(newDT.startDate.year, i)); + } + for (int i = 1; i <= newDT.endDate.month; i++) { + monthList.add(DateTime(newDT.endDate.year, i)); + } + } + var list = monthList + .map((e) => DatePeriod(DateTime(e.year, e.month, 1), + DateTime(e.year, e.month + 1, 0, 23, 59, 59, 999), DateType.MONTH)) + .toList() + .reversed + .toList(); + return list; + } static List getPastMonthIncludingCurrentMonthUntilFinancialYTD( DatePeriod ytd) { var monthList = []; From f8649496be8b1ab5281eb3af365664059ba4a93d Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:34:04 +0530 Subject: [PATCH 43/52] PFM-5064 fix daysToSub --- frontend/mgramseva/lib/utils/common_methods.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/mgramseva/lib/utils/common_methods.dart b/frontend/mgramseva/lib/utils/common_methods.dart index 5443a7d2c..6964be456 100644 --- a/frontend/mgramseva/lib/utils/common_methods.dart +++ b/frontend/mgramseva/lib/utils/common_methods.dart @@ -100,13 +100,17 @@ class CommonMethods { return false; } } - static int daysToSub(int monthCount, int year) { - var days = 0; + static int daysToSubtract(int monthCount, int year,int currentMonth) { + int days = 0; for (int i = 0; i < monthCount; i++) { - if (isLeapYear(year)) { - days += daysInMonthLeap[i]; + if (currentMonth - i < 0) { + days += isLeapYear(year - 1) + ? daysInMonthLeap[12 - (currentMonth - i).abs()] + : daysInMonth[12 - (currentMonth - i).abs()]; } else { - days += daysInMonth[i]; + days += isLeapYear(year) + ? daysInMonthLeap[currentMonth - i] + : daysInMonth[currentMonth - i]; } } return days; From 0b2d86be8f94a2a560e6990694385651f1bfeda1 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:37:11 +0530 Subject: [PATCH 44/52] PFM-5064 fix daysToSubtract --- frontend/mgramseva/lib/utils/common_methods.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/utils/common_methods.dart b/frontend/mgramseva/lib/utils/common_methods.dart index 6964be456..4f671094c 100644 --- a/frontend/mgramseva/lib/utils/common_methods.dart +++ b/frontend/mgramseva/lib/utils/common_methods.dart @@ -170,7 +170,7 @@ class CommonMethods { {int monthCount=2,bool showCurrentMonth = false}) { var monthList = []; final currentTime = DateTime.now(); - DatePeriod newDT = DatePeriod(ytd.endDate.subtract(Duration(days: daysToSub(monthCount,currentTime.year))), ytd.endDate, DateType.MONTH); + DatePeriod newDT = DatePeriod(ytd.endDate.subtract(Duration(days: daysToSubtract(monthCount,currentTime.year,currentTime.month))), ytd.endDate, DateType.MONTH); if (currentTime.year < newDT.startDate.year) { return []; } From 5eb1b1c8a821ee87c017d4692522e171b2045858 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 6 Mar 2024 13:43:28 +0530 Subject: [PATCH 45/52] PFM-5688 updated message template --- .../src/main/java/org/egov/hrms/model/SMSRequest.java | 2 +- .../main/java/org/egov/hrms/service/NotificationService.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java index 31c92e38e..730289fca 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java @@ -15,5 +15,5 @@ public class SMSRequest { private String mobileNumber; private String message; - + private String tenantId; } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index 44fe4432c..ebcd35f8d 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -72,7 +72,8 @@ public void sendNotification(EmployeeRequest request, Map pwdMap } for(Employee employee: request.getEmployees()) { message = buildMessage(employee, message, pwdMap); - SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).build(); + SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).tenantId(employee.getTenantId()).build(); + log.info(smsRequest.toString()); producer.push(smsTopic, smsRequest); } } From 905de86daa4108328440dc95a61d5ec1974441e9 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 6 Mar 2024 13:59:21 +0530 Subject: [PATCH 46/52] PFM-5688 updated message template --- .../src/main/java/org/egov/hrms/service/NotificationService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index ebcd35f8d..03757ab8f 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -73,7 +73,6 @@ public void sendNotification(EmployeeRequest request, Map pwdMap for(Employee employee: request.getEmployees()) { message = buildMessage(employee, message, pwdMap); SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).tenantId(employee.getTenantId()).build(); - log.info(smsRequest.toString()); producer.push(smsTopic, smsRequest); } } From 5dd28ad7d585e9a62f810493b50806072b10f64a Mon Sep 17 00:00:00 2001 From: Debasish Chakraborty <117706910+debasishchakraborty-egovt@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:12:32 +0530 Subject: [PATCH 47/52] Update build-config.yml --- build/build-config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/build-config.yml b/build/build-config.yml index ea8c9c688..d5922742a 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -134,3 +134,8 @@ config: dockerfile: "build/maven/Dockerfile" - work-dir: "business-services/egov-apportion-service/src/main/resources/db" image-name: "egov-apportion-service-db" + - name: "builds/mGramSeva/utilities/egov-penalty-schedular" + build: + - work-dir: "utilities/egov-penalty-schedular" + image-name: "egov-penalty-schedular" + dockerfile: "build/maven/Dockerfile" From 482d8a577d9aad9774e1398c0a0dcefd3412ee5c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 7 Mar 2024 15:58:31 +0530 Subject: [PATCH 48/52] PFM-5810 added flag isSMSForUserCreationEnable at time of sending sms to users. --- .../java/org/egov/hrms/config/PropertiesManager.java | 3 +++ .../org/egov/hrms/service/NotificationService.java | 10 ++++++++-- .../src/main/resources/application.properties | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java index 720644512..3b04dd0f8 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java @@ -114,4 +114,7 @@ public class PropertiesManager { @Value("${state.level.tenant.id}") public String stateLevelTenantId; + + @Value("${sms.user.creation.enabled}") + public boolean isSMSForUserCreationEnable; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java index 03757ab8f..9285e191b 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java @@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.config.PropertiesManager; import org.egov.hrms.model.Employee; import org.egov.hrms.model.SMSRequest; import org.egov.hrms.producer.HRMSProducer; @@ -35,6 +36,9 @@ public class NotificationService { @Autowired private RestTemplate restTemplate; + @Autowired + private PropertiesManager propertiesManager; + @Value("${kafka.topics.notification.sms}") private String smsTopic; @@ -57,7 +61,6 @@ public class NotificationService { private String envHost; - /** * Sends notification by putting the sms content onto the core-sms topic * @@ -73,7 +76,10 @@ public void sendNotification(EmployeeRequest request, Map pwdMap for(Employee employee: request.getEmployees()) { message = buildMessage(employee, message, pwdMap); SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).tenantId(employee.getTenantId()).build(); - producer.push(smsTopic, smsRequest); + if(propertiesManager.isSMSForUserCreationEnable()) + { + producer.push(smsTopic, smsRequest); + } } } diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 92fec5b97..bbeb4a68a 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -102,4 +102,5 @@ logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.S log4j.logger.org.springframework.jdbc.core = TRACE -state.level.tenant.id=pb \ No newline at end of file +state.level.tenant.id=pb +sms.user.creation.enabled=true \ No newline at end of file From f5a006a874a7334efed65bf31ff0dcc50af6fcc1 Mon Sep 17 00:00:00 2001 From: Gowtham-egov <112694085+Gowtham-egov@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:19:56 +0530 Subject: [PATCH 49/52] Update build-config.yml --- build/build-config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/build-config.yml b/build/build-config.yml index d5922742a..dcde66e1d 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -134,8 +134,8 @@ config: dockerfile: "build/maven/Dockerfile" - work-dir: "business-services/egov-apportion-service/src/main/resources/db" image-name: "egov-apportion-service-db" - - name: "builds/mGramSeva/utilities/egov-penalty-schedular" - build: + - name: "builds/mGramSeva/utilities/egov-penalty-schedular" + build: - work-dir: "utilities/egov-penalty-schedular" image-name: "egov-penalty-schedular" dockerfile: "build/maven/Dockerfile" From 9f57eaf272c4a500b0d2cb86085eedf95c7367ee Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:02:02 +0530 Subject: [PATCH 50/52] PFM-5680: Thermal Printer Advance Fix --- .../house_connection_and_bill/consumer_bill_payment.dart | 4 ++-- .../mgramseva/lib/providers/collect_payment_provider.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/mgramseva/lib/components/house_connection_and_bill/consumer_bill_payment.dart b/frontend/mgramseva/lib/components/house_connection_and_bill/consumer_bill_payment.dart index 6800b26dd..11e3be5d9 100644 --- a/frontend/mgramseva/lib/components/house_connection_and_bill/consumer_bill_payment.dart +++ b/frontend/mgramseva/lib/components/house_connection_and_bill/consumer_bill_payment.dart @@ -230,9 +230,9 @@ class ConsumerBillPaymentsState extends State { .toString()) + ' only')), getPrinterLabel( - i18.consumerReciepts.CONSUMER_PENDING_AMOUNT, + (item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE, ('₹' + - ((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)) + ((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)).abs() .toString())), SizedBox( height: 8, diff --git a/frontend/mgramseva/lib/providers/collect_payment_provider.dart b/frontend/mgramseva/lib/providers/collect_payment_provider.dart index 2e8f00870..51d78de5d 100644 --- a/frontend/mgramseva/lib/providers/collect_payment_provider.dart +++ b/frontend/mgramseva/lib/providers/collect_payment_provider.dart @@ -398,9 +398,9 @@ class CollectPaymentProvider with ChangeNotifier { .toString()) + ' only')), getPrinterLabel( - i18.consumerReciepts.CONSUMER_PENDING_AMOUNT, + (item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE, ('₹' + - ((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)) + ((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)).abs() .toString())), SizedBox( height: 8, From 77d5a9521baeb6be218eb309983b861b9af8ab8d Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:19:49 +0530 Subject: [PATCH 51/52] PFM-5064 consumer_details_provider.dart --- .../lib/providers/consumer_details_provider.dart | 15 +++++++++++++-- .../consumer_details/consumer_details.dart | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/mgramseva/lib/providers/consumer_details_provider.dart b/frontend/mgramseva/lib/providers/consumer_details_provider.dart index 138a88e35..54dcdd62a 100644 --- a/frontend/mgramseva/lib/providers/consumer_details_provider.dart +++ b/frontend/mgramseva/lib/providers/consumer_details_provider.dart @@ -639,7 +639,7 @@ class ConsumerProvider with ChangeNotifier { ytd = DatePeriod(fromDate,toDate,DateType.YTD); /// Get months based on selected billing year - var months = CommonMethods.getPastMonthUntilFinancialYTDMonthCount(ytd); + var months = CommonMethods.getPastMonthUntilFinancialYTD(ytd); /// if selected year is future year means all the months will be removed if(fromDate.year > ytd.endDate.year) months.clear(); @@ -700,7 +700,18 @@ class ConsumerProvider with ChangeNotifier { } return []; } - + List getLastFinancialYearList(int count) { + return getFinancialYearList().length>count?getFinancialYearList().sublist(0,count):getFinancialYearList(); + } + List> newFunction({int pastMonthCount = 2}){ + List financialYears = getFinancialYearList(); + var dates = >[]; + financialYears.forEach((year) { + dates.addAll(getBillingCycleMonthCountCurrent(year)); + }); + dates.sort((a, b) => b['code'].compareTo(a['code'])); + return dates.toList().length>2?dates.toList().sublist(0,2):dates.toList(); + } void onChangeOfAmountType(value) { waterconnection.paymentType = value; diff --git a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart index 7b71d911d..808d2a8eb 100644 --- a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart +++ b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart @@ -438,7 +438,7 @@ class _ConsumerDetailsState extends State { .waterconnection .previousReadingDateCtrl, firstDate: - DateTime.fromMillisecondsSinceEpoch(consumerProvider.languageList?.mdmsRes?.billingService?.taxPeriodList!.first.fromDate??0), + DateTime.fromMillisecondsSinceEpoch(consumerProvider.getLastFinancialYearList(2).reversed.first.fromDate??0), lastDate: DateTime.now(), onChangeOfDate: From 94e656f737c8106ac6f81bcb4ac21c60e88315fc Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:23:25 +0530 Subject: [PATCH 52/52] PFM-5064 consumer_details_provider.dart --- .../providers/consumer_details_provider.dart | 2 +- .../consumer_details/consumer_details.dart | 41 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/frontend/mgramseva/lib/providers/consumer_details_provider.dart b/frontend/mgramseva/lib/providers/consumer_details_provider.dart index 54dcdd62a..5fbb5efc5 100644 --- a/frontend/mgramseva/lib/providers/consumer_details_provider.dart +++ b/frontend/mgramseva/lib/providers/consumer_details_provider.dart @@ -703,7 +703,7 @@ class ConsumerProvider with ChangeNotifier { List getLastFinancialYearList(int count) { return getFinancialYearList().length>count?getFinancialYearList().sublist(0,count):getFinancialYearList(); } - List> newFunction({int pastMonthCount = 2}){ + List> newBillingCycleFunction({int pastMonthCount = 2}){ List financialYears = getFinancialYearList(); var dates = >[]; financialYears.forEach((year) { diff --git a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart index 808d2a8eb..c1b7e490c 100644 --- a/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart +++ b/frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart @@ -503,25 +503,25 @@ class _ConsumerDetailsState extends State { false ? Wrap( children: [ - SelectFieldBuilder( - i18.demandGenerate - .BILLING_YEAR_LABEL, - consumerProvider - .billYear, - '', - '', - consumerProvider - .onChangeOfBillYear, - [consumerProvider - .getFinancialYearList().first], - true, - itemAsString: (i) =>'${ApplicationLocalizations.of(context).translate(i.financialYear)}', - controller: consumerProvider - .waterconnection - .billingCycleYearCtrl, - key: Keys.bulkDemand - .BULK_DEMAND_BILLING_YEAR, - ), + // SelectFieldBuilder( + // i18.demandGenerate + // .BILLING_YEAR_LABEL, + // consumerProvider + // .billYear, + // '', + // '', + // consumerProvider + // .onChangeOfBillYear, + // consumerProvider + // .getFinancialYearList(), + // true, + // itemAsString: (i) =>'${ApplicationLocalizations.of(context).translate(i.financialYear)}', + // controller: consumerProvider + // .waterconnection + // .billingCycleYearCtrl, + // key: Keys.bulkDemand + // .BULK_DEMAND_BILLING_YEAR, + // ), SelectFieldBuilder( i18.consumer .CONSUMER_BILLING_CYCLE, @@ -532,8 +532,7 @@ class _ConsumerDetailsState extends State { consumerProvider .onChangeBillingCycle, consumerProvider - .getBillingCycleMonthCountCurrent(consumerProvider - .billYear), + .newBillingCycleFunction(), true, itemAsString: (i) =>"${ApplicationLocalizations.of(context).translate(i['name'])}", controller: consumerProvider