diff --git a/backend/muster-roll/src/main/java/org/egov/config/MusterRollServiceConfiguration.java b/backend/muster-roll/src/main/java/org/egov/config/MusterRollServiceConfiguration.java index 1c84630a17..880aef0276 100644 --- a/backend/muster-roll/src/main/java/org/egov/config/MusterRollServiceConfiguration.java +++ b/backend/muster-roll/src/main/java/org/egov/config/MusterRollServiceConfiguration.java @@ -80,6 +80,8 @@ public class MusterRollServiceConfiguration { private String attendanceLogEndpoint; @Value("${works.attendance.register.search.endpoint}") private String attendanceRegisterEndpoint; + @Value("${works.attendance.register.update.endpoint}") + private String attendanceRegisterUpdateEndpoint; @Value("${works.attendance.register.search.limit}") private String attendanceRegisterSearchLimit; @@ -105,6 +107,9 @@ public class MusterRollServiceConfiguration { @Value("${kafka.topics.notification.sms}") private String smsNotificationTopic; + @Value("${notification.sms.enabled:false}") + private boolean sendNotificationEnabled; + //Expense Service @Value("${works.expense.calculator.host}") private String expenseCalculatorServiceHost; @@ -127,6 +132,36 @@ public class MusterRollServiceConfiguration { @Value("${works.contract.service.code}") private String contractServiceCode; + @Value("${musterroll.update.recompute.attendance.enabled:true}") + private boolean recomputeAttendanceEnabled; + + @Value("${musterroll.individual.entry.roles.enabled:false}") + private boolean individualEntryRolesEnabled; + + @Value("${musterroll.validate.start.date.monday.enabled:true}") + private boolean validateStartDateMondayEnabled; + + @Value("${musterroll.add.bank.account.details.enabled:true}") + private boolean addBankAccountDetails; + + @Value("${musterroll.update.attendance.register.payment.status.enabled:true}") + private boolean updateAttendanceRegisterPaymentStatusEnabled; + + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + @PostConstruct public void initialize() { TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); diff --git a/backend/muster-roll/src/main/java/org/egov/repository/querybuilder/MusterRollQueryBuilder.java b/backend/muster-roll/src/main/java/org/egov/repository/querybuilder/MusterRollQueryBuilder.java index 6a1058a3c8..f19cbfe6e6 100644 --- a/backend/muster-roll/src/main/java/org/egov/repository/querybuilder/MusterRollQueryBuilder.java +++ b/backend/muster-roll/src/main/java/org/egov/repository/querybuilder/MusterRollQueryBuilder.java @@ -84,6 +84,10 @@ private StringBuilder prepareSearchQuery(MusterRollSearchCriteria searchCriteria addClauseIfRequired(preparedStmtList, queryBuilder); queryBuilder.append(" muster.attendance_register_id=? "); preparedStmtList.add(searchCriteria.getRegisterId()); + } else if (searchCriteria.getRegisterIds() != null && !searchCriteria.getRegisterIds().isEmpty()) { + addClauseIfRequired(preparedStmtList, queryBuilder); + queryBuilder.append(" muster.attendance_register_id IN (").append(createQuery(searchCriteria.getRegisterIds())).append(")"); + addToPreparedStatement(preparedStmtList, searchCriteria.getRegisterIds()); } else if (registerIds != null && !registerIds.isEmpty()) { addClauseIfRequired(preparedStmtList, queryBuilder); queryBuilder.append(" muster.attendance_register_id IN (").append(createQuery(registerIds)).append(")"); diff --git a/backend/muster-roll/src/main/java/org/egov/service/CalculationService.java b/backend/muster-roll/src/main/java/org/egov/service/CalculationService.java index 2439dd0c9a..1a59f7c2e0 100644 --- a/backend/muster-roll/src/main/java/org/egov/service/CalculationService.java +++ b/backend/muster-roll/src/main/java/org/egov/service/CalculationService.java @@ -114,7 +114,6 @@ public void createAttendance(MusterRollRequest musterRollRequest, boolean isCrea //Add all absentee individualIds as well individualIds.addAll(absenteesList.stream().map(entry-> entry.getIndividualId()).collect(Collectors.toSet())); List individuals = fetchIndividualDetails(individualIds, musterRollRequest.getRequestInfo(),musterRoll.getTenantId(),musterRoll); - List bankAccounts = fetchBankaccountDetails(individualIds, musterRollRequest.getRequestInfo(),musterRoll.getTenantId()); for (Map.Entry> entry : individualExitAttendanceMap.entrySet()) { IndividualEntry individualEntry = new IndividualEntry(); @@ -197,29 +196,33 @@ public void createAttendance(MusterRollRequest musterRollRequest, boolean isCrea individualEntries.add(individualEntry); } - // Loop through and set individual and bank account details - for (IndividualEntry entry : individualEntries) { - - // Set individual details in additionalDetails - if (!CollectionUtils.isEmpty(individuals) /* && !CollectionUtils.isEmpty(bankAccounts) */) { - Individual individual = individuals.stream() - .filter(ind -> ind.getId().equalsIgnoreCase(entry.getIndividualId())).findFirst() - .orElse(null); - BankAccount bankAccount = bankAccounts.stream() - .filter(account -> account.getReferenceId().equalsIgnoreCase(entry.getIndividualId())) - .findFirst().orElse(null); - - if (individual != null /* && bankAccount != null */) { - setAdditionalDetails(entry, individualEntriesFromRequest, mdmsV2Data, individual, - bankAccount, isCreate); - } else { - log.info( - "CalculationService::createAttendance::No match found in individual and bank account service for the individual id from attendance log - " - + entry.getIndividualId()); - } - - } - } + if(config.isAddBankAccountDetails()) { + List bankAccounts = fetchBankaccountDetails(individualIds, musterRollRequest.getRequestInfo(),musterRoll.getTenantId()); + // Loop through and set individual and bank account details + for (IndividualEntry entry : individualEntries) { + + // Set individual details in additionalDetails + if (!CollectionUtils.isEmpty(individuals) /* && !CollectionUtils.isEmpty(bankAccounts) */) { + Individual individual = individuals.stream() + .filter(ind -> ind.getId().equalsIgnoreCase(entry.getIndividualId())).findFirst() + .orElse(null); + BankAccount bankAccount = bankAccounts.stream() + .filter(account -> account.getReferenceId().equalsIgnoreCase(entry.getIndividualId())) + .findFirst().orElse(null); + + if (individual != null /* && bankAccount != null */) { + setAdditionalDetails(entry, individualEntriesFromRequest, mdmsV2Data, individual, + bankAccount, isCreate); + } else { + log.info( + "CalculationService::createAttendance::No match found in individual and bank account service for the individual id from attendance log - " + + entry.getIndividualId()); + } + + } + } + } + musterRoll.setIndividualEntries(individualEntries); log.debug("CalculationService::createAttendance::Individuals::size::"+musterRoll.getIndividualEntries().size()); diff --git a/backend/muster-roll/src/main/java/org/egov/service/MusterRollService.java b/backend/muster-roll/src/main/java/org/egov/service/MusterRollService.java index 34ff246e74..ffc0c5297d 100644 --- a/backend/muster-roll/src/main/java/org/egov/service/MusterRollService.java +++ b/backend/muster-roll/src/main/java/org/egov/service/MusterRollService.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.stream.Collectors; +import static org.egov.util.MusterRollServiceConstants.ACTION_APPROVE; import static org.egov.util.MusterRollServiceConstants.STATUS_APPROVED; @Service @@ -211,6 +212,18 @@ public MusterRollRequest updateMusterRoll(MusterRollRequest musterRollRequest) { calculationService.updateAttendance(musterRollRequest,mdmsData); } workflowService.updateWorkflowStatus(musterRollRequest); + if(config.isUpdateAttendanceRegisterPaymentStatusEnabled() && musterRollRequest.getWorkflow().getAction().equals(ACTION_APPROVE)) { + AttendanceRegisterResponse attendanceRegisterResponse = musterRollServiceUtil + .fetchAttendanceRegister(musterRollRequest.getMusterRoll(), musterRollRequest.getRequestInfo()); + List attendanceRegisters = attendanceRegisterResponse.getAttendanceRegister(); + if(attendanceRegisters == null || attendanceRegisters.isEmpty()) { + log.error("No attendance registers found to update the status"); + throw new CustomException("MusterRollService::updateMusterRoll::updateAttendanceRegister", "No attendance registers found to update the status"); + } + AttendanceRegister attendanceRegister = attendanceRegisters.get(0); + attendanceRegister.setPaymentStatus(STATUS_APPROVED); + musterRollServiceUtil.updateAttendanceRegister(attendanceRegister, musterRollRequest.getRequestInfo()); + } musterRollProducer.push(serviceConfiguration.getUpdateMusterRollTopic(), musterRollRequest); try { @@ -270,7 +283,7 @@ private MusterRoll fetchExistingMusterRoll(MusterRoll musterRoll) { * @return */ private boolean isComputeAttendance (MusterRoll musterRoll) { - if (musterRoll.getAdditionalDetails() != null) { + if (config.isRecomputeAttendanceEnabled() && musterRoll.getAdditionalDetails() != null) { try { JsonNode node = mapper.readTree(mapper.writeValueAsString(musterRoll.getAdditionalDetails())); if (node.findValue(COMPUTE_ATTENDENSE) != null && StringUtils.isNotBlank(node.findValue(COMPUTE_ATTENDENSE).textValue())) { diff --git a/backend/muster-roll/src/main/java/org/egov/service/NotificationService.java b/backend/muster-roll/src/main/java/org/egov/service/NotificationService.java index 3766b940d2..7e756d03b8 100644 --- a/backend/muster-roll/src/main/java/org/egov/service/NotificationService.java +++ b/backend/muster-roll/src/main/java/org/egov/service/NotificationService.java @@ -42,6 +42,7 @@ public NotificationService(MusterRollProducer musterRollProducer, NotificationUt */ public void sendNotificationToCBO(MusterRollRequest musterRollRequest){ String action = musterRollRequest.getWorkflow().getAction(); + if(!config.isSendNotificationEnabled()) return; if(action.equalsIgnoreCase(WF_SEND_BACK_TO_CBO_CODE) || action.equalsIgnoreCase(WF_APPROVE_CODE)) { Map cboDetails = notificationUtil.getCBOContactPersonDetails(musterRollRequest); String amount = notificationUtil.getExpenseAmount(musterRollRequest); diff --git a/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceConstants.java b/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceConstants.java index f35a0da604..56c928adf5 100644 --- a/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceConstants.java +++ b/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceConstants.java @@ -15,6 +15,7 @@ public class MusterRollServiceConstants { public static final String ENTRY_EVENT = "ENTRY"; public static final String EXIT_EVENT = "EXIT"; public static final String STATUS_APPROVED = "APPROVED"; + public static final String ACTION_APPROVE = "APPROVE"; public static final String TENANT_ID = "tenantId"; public static final String CONTRACT_NUMBER = "contractNumber"; public static final String REQUEST_INFO = "RequestInfo"; diff --git a/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceUtil.java b/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceUtil.java index 0d150e8e43..9bdac55677 100644 --- a/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceUtil.java +++ b/backend/muster-roll/src/main/java/org/egov/util/MusterRollServiceUtil.java @@ -9,11 +9,14 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.Role; +import org.egov.common.contract.user.UserDetailResponse; import org.egov.common.models.individual.Identifier; import org.egov.common.models.individual.Individual; import org.egov.common.models.individual.Skill; import org.egov.config.MusterRollServiceConfiguration; import org.egov.tracer.model.CustomException; +import org.egov.tracer.model.ServiceCallException; import org.egov.web.models.*; import org.egov.works.services.common.models.bankaccounts.BankAccount; import org.egov.works.services.common.models.bankaccounts.BankAccountDetails; @@ -29,10 +32,12 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; -import static org.egov.util.MusterRollServiceConstants.*; @Component @Slf4j @@ -42,14 +47,19 @@ public class MusterRollServiceUtil { private final RestTemplate restTemplate; + private final UserUtil userUtil; + private final MusterRollServiceConfiguration config; private static final String SKILL_CODE = "skillCode"; + private static final String ROLES = "roles"; + @Autowired - public MusterRollServiceUtil(ObjectMapper mapper, RestTemplate restTemplate, MusterRollServiceConfiguration config) { + public MusterRollServiceUtil(ObjectMapper mapper, RestTemplate restTemplate, UserUtil userUtil, MusterRollServiceConfiguration config) { this.mapper = mapper; this.restTemplate = restTemplate; - this.config = config; + this.userUtil = userUtil; + this.config = config; } /** @@ -140,6 +150,17 @@ public void populateAdditionalDetails(Object mdmsData, IndividualEntry individua } } + if(config.isIndividualEntryRolesEnabled()) { + UserDetailResponse userDetailResponse = userUtil.searchUsersByIndividualIds(Collections.singletonList(individualEntry.getId())); + List roles = userDetailResponse.getUser().stream().findFirst() + .orElseThrow(() -> new CustomException( + "MusterRollServiceUtil::populateAdditionalDetails::USER SEARCH ERROR", + "No user found for the individual id " + individualEntry.getId()) + ) + .getRoles().stream().map(Role::getCode).toList(); + additionalDetails.put(ROLES, roles); + } + try { individualEntry.setAdditionalDetails(mapper.readValue(additionalDetails.toString(), Object.class)); } catch (IOException e) { @@ -266,4 +287,30 @@ public AttendanceRegisterResponse fetchAttendanceRegister(MusterRoll musterRoll, } return attendanceRegisterResponse; } + + public AttendanceRegisterResponse updateAttendanceRegister(AttendanceRegister attendanceRegister, RequestInfo requestInfo) { + log.info("updateAttendanceRegister::Update attendance register with tenantId::" + attendanceRegister.getTenantId() + + " and register ID: " + attendanceRegister.getId()); + + StringBuilder uri = new StringBuilder(); + uri.append(config.getAttendanceLogHost()).append(config.getAttendanceRegisterUpdateEndpoint()); + + AttendanceRegisterResponse response = null; + + AttendanceRegisterRequest attendanceRegisterRequest = AttendanceRegisterRequest.builder() + .attendanceRegister(Collections.singletonList(attendanceRegister)) + .requestInfo(requestInfo) + .build(); + try { + response = restTemplate.postForObject(uri.toString(), attendanceRegisterRequest, AttendanceRegisterResponse.class); + } catch (HttpClientErrorException e) { + throw new ServiceCallException(e.getResponseBodyAsString()); + } catch (Exception e) { + Map map = new HashMap<>(); + map.put(e.getCause().getClass().getName(), e.getMessage()); + throw new CustomException(map); + } + + return response; + } } diff --git a/backend/muster-roll/src/main/java/org/egov/util/UserUtil.java b/backend/muster-roll/src/main/java/org/egov/util/UserUtil.java index ee51c870e8..716fc00371 100644 --- a/backend/muster-roll/src/main/java/org/egov/util/UserUtil.java +++ b/backend/muster-roll/src/main/java/org/egov/util/UserUtil.java @@ -4,10 +4,11 @@ import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; import org.egov.common.contract.user.UserDetailResponse; +import org.egov.common.contract.user.UserSearchRequest; +import org.egov.config.MusterRollServiceConfiguration; import org.egov.repository.ServiceRequestRepository; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.text.ParseException; @@ -20,26 +21,20 @@ @Component public class UserUtil { + private final ObjectMapper mapper; - private ObjectMapper mapper; + private final ServiceRequestRepository serviceRequestRepository; - private ServiceRequestRepository serviceRequestRepository; + private final MusterRollServiceConfiguration config; - @Value("${egov.user.create.path}") - private String userCreateEndpoint; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.user.update.path}") - private String userUpdateEndpoint; private static final String LAST_MODIFIED_DATE = "lastModifiedDate"; private static final String PWD_EXPIRY_DATE = "pwdExpiryDate"; @Autowired - public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository) { + public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository, MusterRollServiceConfiguration config) { this.mapper = mapper; this.serviceRequestRepository = serviceRequestRepository; + this.config = config; } /** @@ -52,9 +47,9 @@ public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepo public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { String dobFormat = null; - if (uri.toString().contains(userSearchEndpoint) || uri.toString().contains(userUpdateEndpoint)) + if (uri.toString().contains(config.getUserSearchEndpoint()) || uri.toString().contains(config.getUserUpdateEndpoint())) dobFormat = "yyyy-MM-dd"; - else if (uri.toString().contains(userCreateEndpoint)) + else if (uri.toString().contains(config.getUserCreateEndpoint())) dobFormat = "dd/MM/yyyy"; try { LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userRequest); @@ -65,6 +60,17 @@ else if (uri.toString().contains(userCreateEndpoint)) } } + public UserDetailResponse searchUsersByIndividualIds(List individualIds) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder + .append(config.getUserHost()) + .append(config.getUserContextPath()) + .append(config.getUserSearchEndpoint()); + UserSearchRequest userSearchRequest = new UserSearchRequest(); + userSearchRequest.setUuid(individualIds); + return userCall(userSearchRequest, stringBuilder); + } + /** * Parses date formats to long for all users in responseMap diff --git a/backend/muster-roll/src/main/java/org/egov/validator/MusterRollValidator.java b/backend/muster-roll/src/main/java/org/egov/validator/MusterRollValidator.java index 8a5d84e45e..fb40749c4a 100644 --- a/backend/muster-roll/src/main/java/org/egov/validator/MusterRollValidator.java +++ b/backend/muster-roll/src/main/java/org/egov/validator/MusterRollValidator.java @@ -180,7 +180,7 @@ private void validateCreateMusterRollRequest(MusterRoll musterRoll) { //Check if the startDate is Monday - UI sends the epoch time in IST LocalDate startDate = Instant.ofEpochMilli(musterRoll.getStartDate().longValue()).atZone(ZoneId.of(serviceConfiguration.getTimeZone())).toLocalDate(); - if (startDate.getDayOfWeek() != DayOfWeek.MONDAY) { + if (serviceConfiguration.isValidateStartDateMondayEnabled() && startDate.getDayOfWeek() != DayOfWeek.MONDAY) { throw new CustomException("START_DATE_MONDAY","StartDate should be Monday"); } musterRoll.setStartDate(new BigDecimal(startDate.atStartOfDay(ZoneId.of(serviceConfiguration.getTimeZone())).toInstant().toEpochMilli())); diff --git a/backend/muster-roll/src/main/java/org/egov/web/controllers/MusterRollApiController.java b/backend/muster-roll/src/main/java/org/egov/web/controllers/MusterRollApiController.java index 5cbed9ef0b..ba83e9160e 100644 --- a/backend/muster-roll/src/main/java/org/egov/web/controllers/MusterRollApiController.java +++ b/backend/muster-roll/src/main/java/org/egov/web/controllers/MusterRollApiController.java @@ -10,6 +10,7 @@ import org.egov.web.models.MusterRollRequest; import org.egov.web.models.MusterRollResponse; import org.egov.web.models.MusterRollSearchCriteria; +import org.egov.web.models.MusterRollSearchRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -58,11 +59,17 @@ public ResponseEntity musterRollV1CreatePost(@ApiParam(value } @RequestMapping(value = "/_search", method = RequestMethod.POST) - public ResponseEntity attendanceV1SearchPOST(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @Valid @ModelAttribute MusterRollSearchCriteria searchCriteria) { + public ResponseEntity musterRollV1SearchPOST(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @Valid @ModelAttribute MusterRollSearchCriteria searchCriteria) { MusterRollResponse musterRollResponse = musterRollService.searchMusterRolls(requestInfoWrapper, searchCriteria); return new ResponseEntity(musterRollResponse, HttpStatus.OK); } + @RequestMapping(value = "/v2/_search", method = RequestMethod.POST) + public ResponseEntity musterRollV2SearchPOST(@Valid @RequestBody MusterRollSearchRequest request) { + MusterRollResponse musterRollResponse = musterRollService.searchMusterRolls(request, request.getMusterRoll()); + return new ResponseEntity(musterRollResponse, HttpStatus.OK); + } + @RequestMapping(value = "/_update", method = RequestMethod.POST) public ResponseEntity musterRollV1UpdatePost(@ApiParam(value = "Request object to update the muster roll", required = true) @Valid @RequestBody MusterRollRequest body) { MusterRollRequest musterRollRequest = musterRollService.updateMusterRoll(body); diff --git a/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegister.java b/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegister.java index 04c58ec780..fad9d4d84e 100644 --- a/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegister.java +++ b/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegister.java @@ -59,6 +59,12 @@ public class AttendanceRegister { @JsonProperty("additionalDetails") private Object additionalDetails = null; + @JsonProperty("localityCode") + private String localityCode; + + @JsonProperty("paymentStatus") + private String paymentStatus; + public AttendanceRegister addStaffItem(StaffPermission staffItem) { if (this.staff == null) { diff --git a/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegisterRequest.java b/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegisterRequest.java new file mode 100644 index 0000000000..e90ab6cc11 --- /dev/null +++ b/backend/muster-roll/src/main/java/org/egov/web/models/AttendanceRegisterRequest.java @@ -0,0 +1,71 @@ +package org.egov.web.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.request.RequestInfo; + +public class AttendanceRegisterRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo = null; + @JsonProperty("attendanceRegister") + private List attendanceRegister = null; + + public static AttendanceRegisterRequestBuilder builder() { + return new AttendanceRegisterRequestBuilder(); + } + + public RequestInfo getRequestInfo() { + return this.requestInfo; + } + + public List getAttendanceRegister() { + return this.attendanceRegister; + } + + @JsonProperty("RequestInfo") + public void setRequestInfo(final RequestInfo requestInfo) { + this.requestInfo = requestInfo; + } + + @JsonProperty("attendanceRegister") + public void setAttendanceRegister(final List attendanceRegister) { + this.attendanceRegister = attendanceRegister; + } + + public AttendanceRegisterRequest(final RequestInfo requestInfo, final List attendanceRegister) { + this.requestInfo = requestInfo; + this.attendanceRegister = attendanceRegister; + } + + public AttendanceRegisterRequest() { + } + + public static class AttendanceRegisterRequestBuilder { + private RequestInfo requestInfo; + private List attendanceRegister; + + AttendanceRegisterRequestBuilder() { + } + + @JsonProperty("RequestInfo") + public AttendanceRegisterRequestBuilder requestInfo(final RequestInfo requestInfo) { + this.requestInfo = requestInfo; + return this; + } + + @JsonProperty("attendanceRegister") + public AttendanceRegisterRequestBuilder attendanceRegister(final List attendanceRegister) { + this.attendanceRegister = attendanceRegister; + return this; + } + + public AttendanceRegisterRequest build() { + return new AttendanceRegisterRequest(this.requestInfo, this.attendanceRegister); + } + + public String toString() { + return "AttendanceRegisterRequest.AttendanceRegisterRequestBuilder(requestInfo=" + this.requestInfo + ", attendanceRegister=" + this.attendanceRegister + ")"; + } + } +} + diff --git a/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchCriteria.java b/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchCriteria.java index f0e66ea2c3..b1c5ee659a 100644 --- a/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchCriteria.java +++ b/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchCriteria.java @@ -31,6 +31,9 @@ public class MusterRollSearchCriteria { @JsonProperty("registerId") private String registerId; + @JsonProperty("registerIds") + private List registerIds; + @JsonProperty("fromDate") private BigDecimal fromDate; diff --git a/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchRequest.java b/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchRequest.java new file mode 100644 index 0000000000..feb477ccbb --- /dev/null +++ b/backend/muster-roll/src/main/java/org/egov/web/models/MusterRollSearchRequest.java @@ -0,0 +1,21 @@ +package org.egov.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.egov.common.contract.models.RequestInfoWrapper; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class MusterRollSearchRequest extends RequestInfoWrapper { + @JsonProperty("musterRoll") + @NotNull(message = "Muster Roll is mandatory") + @Valid + private MusterRollSearchCriteria musterRoll = null; +} diff --git a/backend/muster-roll/src/main/resources/application.properties b/backend/muster-roll/src/main/resources/application.properties index 5d8bbfe492..acea94c792 100644 --- a/backend/muster-roll/src/main/resources/application.properties +++ b/backend/muster-roll/src/main/resources/application.properties @@ -89,6 +89,7 @@ egov.localization.search.endpoint=/localization/messages/v1/_search works.attendance.log.host=https://unified-dev.digit.org works.attendance.log.search.endpoint=/attendance/log/v1/_search works.attendance.register.search.endpoint=/attendance/v1/_search +works.attendance.register.update.endpoint=/attendance/v1/_update works.attendance.register.search.limit=100 #--------------Contract Service---------------------# @@ -116,3 +117,10 @@ works.bankaccounts.search.endpoint=/bankaccount-service/bankaccount/v1/_search #-----------Contract service code------------# works.contract.service.code=WORKS-CONTRACT + +#-----------Muster roll update api config------------# +musterroll.update.recompute.attendance.enabled=true +musterroll.individual.entry.roles.enabled=false +musterroll.validate.start.date.monday.enabled=true +musterroll.add.bank.account.details.enabled=true +musterroll.update.attendance.register.payment.status.enabled=false diff --git a/backend/muster-roll/src/test/java/org/egov/validator/MusterRollValidatorTest.java b/backend/muster-roll/src/test/java/org/egov/validator/MusterRollValidatorTest.java index 89ded1ba23..11ce333991 100644 --- a/backend/muster-roll/src/test/java/org/egov/validator/MusterRollValidatorTest.java +++ b/backend/muster-roll/src/test/java/org/egov/validator/MusterRollValidatorTest.java @@ -47,6 +47,7 @@ void setUp() throws Exception { lenient().when(mdmsUtils.mDMSCall(any(MusterRollRequest.class), any(String.class))).thenReturn(mdmsResponse); lenient().when(serviceConfiguration.getTimeZone()).thenReturn("Asia/Kolkata"); + lenient().when(serviceConfiguration.isValidateStartDateMondayEnabled()).thenReturn(true); } diff --git a/build/build-config.yml b/build/build-config.yml index c8f2b4670a..538423934d 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -42,6 +42,13 @@ config: image-name: "muster-roll" - work-dir: "backend/muster-roll/src/main/resources/db" image-name: "muster-roll-db" + - name: "builds/digit-works/backend/health-muster-roll" + build: + - work-dir: "backend/muster-roll" + dockerfile: "build/maven-java17/Dockerfile" + image-name: "health-muster-roll" + - work-dir: "backend/muster-roll/src/main/resources/db" + image-name: "health-muster-roll-db" - name: "builds/digit-works/backend/estimates" build: - work-dir: "backend/estimates"