Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Develop #887

Closed
wants to merge 95 commits into from
Closed

Develop #887

wants to merge 95 commits into from

Conversation

Hari-egov
Copy link
Collaborator

@Hari-egov Hari-egov commented Aug 8, 2024

Summary by CodeRabbit

  • New Features

    • Introduced ledger reporting capabilities for water connection services, allowing users to generate detailed financial reports based on consumer data.
    • Enhanced anonymization function for user data privacy, masking alternate characters in strings.
    • Added new properties for rounded financial values, improving accuracy in monetary calculations across various components.
    • Expanded SQL query capabilities in water connection management for enhanced reporting and data analysis.
  • Bug Fixes

    • Improved handling of tenant filtering and city selection logic to enhance user experience.
  • Style

    • Enhanced UI styles for dropdown components and overall layout improvements for better user navigation.
  • Documentation

    • Updated documentation to reflect new methods and functionalities related to ledger reporting and user data handling.
  • Chores

    • Cleaned up code by removing unnecessary comments and improving readability in various components.

Copy link

coderabbitai bot commented Aug 8, 2024

Walkthrough

The recent updates enhance the billing and water connection services by introducing new fields for rounded financial values, improving tax calculations, and streamlining reporting processes. UI components have been refined for better user experience, while new functionalities for managing water connection data have been added. Overall, these changes promote precision, usability, and maintainability within the system.

Changes

Files Change Summary
business-services/billing-service/.../AggregatedDemandDetailResponse.java, .../DemandService.java New fields for rounded-off values added to response and service classes, enhancing financial calculations. The service logic has been updated to include these new fields in tax and net due calculations, improving accuracy in billing.
frontend/mgramseva/lib/components/.../new_consumer_bill.dart, .../demand_list.dart, .../demand_list.g.dart UI logic modified to better display financial information, including a new nullable double attribute for the current month's rounded-off value in demand details. Enhancements ensure accurate handling and display of financial data.
frontend/micro-ui/web/micro-ui-internals/.../UICustomizations.js, .../OpenView.js Anonymization logic improved for better data privacy. A new function was added for mobile detail interactions, enriching the UI component's functionality.
municipal-services/ws-services/.../WaterDaoImpl.java, .../WsQueryBuilder.java, .../WaterService.java New methods for generating ledger reports introduced, enhancing data retrieval capabilities. SQL queries have been updated to support comprehensive water connection data extraction, significantly improving reporting features.
municipal-services/ws-services/.../WaterController.java, .../DemandLedgerReport.java, .../LedgerReport.java New classes and APIs for ledger reporting added, designed for structured data representation and API responses. This includes new models for payment and demand ledger reports, facilitating improved financial management in water services.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant BillingService
    participant WaterService
    
    User->>UI: Request ledger report
    UI->>BillingService: Fetch rounded-off values
    BillingService->>BillingService: Calculate current month due
    BillingService->>UI: Return updated financial data
    UI->>WaterService: Retrieve water connection details
    WaterService->>WaterService: Generate ledger report
    WaterService->>UI: Send ledger report data
    UI->>User: Display ledger report
Loading

🐇 In the realm of code so bright,
New fields leap in joyful flight!
Rounding dues, oh what a treat,
Enhancing numbers, oh so sweet!
UI shines with data fair,
A hop, a skip—no worries, care! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Outside diff range, codebase verification and nitpick comments (9)
municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java (1)

16-16: Consider initializing demand with a default constructor.

Currently, demand is initialized to null. If DemandLedgerReport has a default state, consider using it to avoid potential NullPointerException when accessing its properties.

- private DemandLedgerReport demand=null;
+ private DemandLedgerReport demand = new DemandLedgerReport();
frontend/mgramseva/lib/model/demand/demand_list.dart (1)

146-147: Ensure integration of currentmonthRoundOff into application logic.

The property currentmonthRoundOff is defined and serialized but is not used in any business logic or UI components. To fully utilize this property, ensure it is integrated into the relevant parts of the application where financial rounding information is needed.

  • Verify that currentmonthRoundOff is used in calculations or displayed in the UI where applicable.
Analysis chain

Ensure proper usage of the new property currentmonthRoundOff.

The addition of currentmonthRoundOff enhances the data structure by allowing it to store financial rounding information. Ensure that this new property is correctly utilized in the application logic and that any necessary data validation or handling is implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new property `currentmonthRoundOff` in the codebase.

# Test: Search for the usage of `currentmonthRoundOff`. Expect: Proper handling and usage in related logic.
rg --type dart $'currentmonthRoundOff'

Length of output: 534


Script:

#!/bin/bash
# Search for the usage of `currentmonthRoundOff` throughout the Dart codebase to verify its integration into application logic.
rg --type dart 'currentmonthRoundOff' --glob '!frontend/mgramseva/lib/model/demand/demand_list.g.dart'

Length of output: 281

frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js (1)

183-183: Impact of Disabling Column Sorting

Disabling enableColumnSort will affect the sorting functionality in the ResultsTable and MobileSearchResults components, as these components use this property to determine whether sorting should be enabled or disabled. Ensure this change aligns with user requirements and does not negatively impact usability, especially if sorting is a critical feature.

  • ResultsTable.js: Uses enableColumnSort to set disableSort and autoSort.
  • MobileSearchResults.js: Similarly uses enableColumnSort for sorting behavior.
Analysis chain

Consider the impact of disabling column sorting.

Changing enableColumnSort from true to false affects user interaction by removing the ability to sort columns in the search results. Ensure that this change aligns with user requirements and does not negatively impact usability.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of disabling column sorting in the codebase.

# Test: Check for any references to column sorting functionality. Expect: No references to sorting features that rely on this property.
rg --type js $'enableColumnSort'

Length of output: 1089

frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (1)

353-391: LGTM! Consider converting to Tailwind CSS.

The new styles for the dropdown component enhance its visual presentation and interaction behavior. As per the TODO comment, consider converting these styles to Tailwind CSS for consistency and maintainability.

municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java (1)

248-255: Add parameter validation and error handling in ledgerReport method.

The ledgerReport method in WaterServiceImpl.java directly returns data from the DAO without validating input parameters or handling potential errors. This could lead to unhandled exceptions or incorrect data processing. Consider adding validation and error handling to improve robustness.

  • Location: municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java
  • Related DAO Call: municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java
Analysis chain

Ensure parameter validation and error handling.

The new endpoint should validate all input parameters and handle potential errors gracefully. Verify that the waterService.ledgerReport method handles errors and edge cases correctly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify parameter validation and error handling in `waterService.ledgerReport`.

# Test: Search for the `ledgerReport` method implementation. Expect: Proper validation and error handling.
ast-grep --lang java --pattern $'class WaterService {
  $$$
  List<Map<String, Object>> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year, RequestInfoWrapper requestInfoWrapper) {
    $$$
  }
  $$$
}'

Length of output: 590


Script:

#!/bin/bash
# Description: Search for the `ledgerReport` method across the codebase to verify its existence and implementation.
rg 'List<Map<String, Object>> ledgerReport' -A 10

Length of output: 3835

frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js (1)

243-267: Remove commented-out code.

The commented-out code within the handleRemoveUnit function should be removed to improve readability and maintainability.

-      // console.log(jurisdictions,"jurisdictions");
-      // console.log(jurisdictionsData,"jurisdictionsData");
-      // setJuristictionsData((pre) => pre.filter((el) => el.key !== unit.key));
-      // setjurisdictions(jurisdictions.filter((element) => element.key !== unit.key));
-      // setjurisdictions((prev) => prev.filter((el) => el.key !== unit.key));
municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java (1)

679-688: Improve logging for clarity.

The current logging statement concatenates the query and prepared statement, which can be hard to read. Consider separating them for better clarity.

log.info("Query for consumer demand not generated: {}", query);
log.info("Prepared statement: {}", preparedStatement);
municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java (1)

11-11: Remove unused import DateTimeParseException.

The import DateTimeParseException is not used in the code. Consider removing it to clean up the imports.

- import java.time.format.DateTimeParseException;
frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js (1)

66-80: Consider renaming the parameter tenantId.

The function initRequestBodyWithOutTenent is designed to work without a tenant ID, yet it takes tenantId as a parameter. Consider renaming this parameter to better reflect its purpose or usage.

- const initRequestBodyWithOutTenent = (tenantId) => ({
+ const initRequestBodyWithOutTenent = () => ({
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7a3e5a1 and cc34a75.

Files selected for processing (27)
  • business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java (1 hunks)
  • business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java (4 hunks)
  • frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart (1 hunks)
  • frontend/mgramseva/lib/model/demand/demand_list.dart (1 hunks)
  • frontend/mgramseva/lib/model/demand/demand_list.g.dart (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (3 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js (7 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js (4 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java (4 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java (3 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java (1 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java (2 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java (2 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java (2 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java (1 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java (1 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java (1 hunks)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java (1 hunks)
Files skipped from review due to trivial changes (2)
  • frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js
Additional context used
Biome
frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js

[error] 392-426: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 394-395: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Additional comments not posted (30)
municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java (1)

15-28: Well-structured class for payment ledger data.

The class is well-structured with appropriate use of BigDecimal for monetary values. The initialization of paid and balanceLeft with BigDecimal.ZERO is a good practice.

business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java (1)

32-33: New fields added for rounding off financial values.

The fields currentmonthRoundOff and totalAreasRoundOff have been added to enhance the precision of financial data handling. Ensure that these fields are correctly utilized in the calculations and data processing logic.

Also applies to: 38-39

Verification successful

Verification Successful: Fields are used in calculations.

The fields currentmonthRoundOff and totalAreasRoundOff are correctly utilized in the DemandService class for financial calculations, such as in the computation of currentmonthTotalDue and netdue.

  • currentmonthRoundOff is involved in the calculation of currentmonthTotalDue.
  • totalAreasRoundOff is involved in the calculation of netdue.

These usages confirm that the fields are integrated into the data processing logic as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new fields `currentmonthRoundOff` and `totalAreasRoundOff`.

# Test: Search for occurrences of the new fields. Expect: Usage in calculations or data processing.
rg --type java 'currentmonthRoundOff|totalAreasRoundOff'

Length of output: 1743

municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java (1)

1-67: New class DemandLedgerReport added.

This class represents a demand ledger report with fields for consumer information and financial details. The fields are initialized with default values, which is a good practice. Ensure that this class is correctly integrated into the system and utilized where needed.

Verification successful

DemandLedgerReport Class Integration Verified

The DemandLedgerReport class is integrated and utilized within the system. It is part of the LedgerReport class, which is used in the WaterController to handle ledger report responses, confirming its correct integration into the service layer.

  • LedgerReport is used in WaterController for the getLedgerReport method.
  • LedgerReport is mapped in LedgerReportRowMapper.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and usage of the new class `DemandLedgerReport`.

# Test: Search for occurrences of `DemandLedgerReport`. Expect: Usage in service or controller layers.
rg --type java 'DemandLedgerReport'

Length of output: 866


Script:

#!/bin/bash
# Description: Verify the integration and usage of the `LedgerReport` class to check indirect usage of `DemandLedgerReport`.

# Test: Search for occurrences of `LedgerReport` in service or controller layers.
rg --type java 'LedgerReport'

Length of output: 6531

municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java (1)

59-59: New method ledgerReport added to WaterService interface.

This method enhances the service by providing ledger report capabilities. Ensure that the method is implemented correctly in classes that implement this interface and that it is tested adequately.

frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1)

81-81: Verify role-based access control.

The addition of roles: ["DIV_ADMIN", "STATE_ADMIN"] restricts access to the HR_SEARCH_USER link. Ensure that role-based access is correctly implemented and tested.

frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js (2)

49-50: Improve tenant filtering logic.

The tenant filtering logic in useEffect is more efficient. Ensure that the filtering criteria align with business requirements.

Verification successful

Tenant filtering logic is implemented with specific criteria.

The filtering logic in ChangeCity.js excludes tenants with the code "pb" unless they match the tenantId, and includes others if their code is in tenantIds. Ensure this aligns with the intended business rules.

  • File: frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js
  • Logic: Exclude "pb" tenants unless matching tenantId; include others if in tenantIds.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify tenant filtering logic.

# Test: Search for tenant filtering implementation. Expect: Correct filtering criteria in useEffect.
rg --type javascript 'const filteredArray = mdmsData.MdmsRes\["tenant"\]\["tenants"\]\.filter'

Length of output: 131


Script:

#!/bin/bash
# Correcting the file type for JavaScript and searching for tenant filtering logic.
rg --type js 'const filteredArray = mdmsData.MdmsRes\["tenant"\]\["tenants"\]\.filter'

Length of output: 263


Script:

#!/bin/bash
# Extracting the filtering logic details from ChangeCity.js to verify the criteria.
rg --type js -A 5 'const filteredArray = mdmsData.MdmsRes\["tenant"\]\["tenants"\]\.filter' frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js

Length of output: 474


23-24: Enhance role filtering logic.

The use of loggedInData for role filtering in handleChangeCity improves readability and reduces redundancy. Ensure that the session data structure supports this change.

Verification successful

Session data structure supports role filtering logic.

The session data structure used in ChangeCity.js for role filtering by tenant ID is correctly implemented and supported by the current code. The roles are accessed and filtered appropriately based on the selected city.

  • ChangeCity.js: Roles are filtered based on tenantId to update loggedInData.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify session data structure for role filtering.

# Test: Search for session data usage. Expect: Correct structure for `citizen.userRequestObject`.
rg --type javascript 'Digit.SessionStorage.get\("citizen.userRequestObject"\)'

Length of output: 115


Script:

#!/bin/bash
# Description: Re-run the search for session data usage without specifying file type.

# Test: Search for session data usage. Expect: Correct structure for `citizen.userRequestObject`.
rg 'Digit.SessionStorage.get\("citizen.userRequestObject"\)'

Length of output: 414


Script:

#!/bin/bash
# Extract code surrounding the usage of `Digit.SessionStorage.get("citizen.userRequestObject")` in ChangeCity.js
rg -A 10 -B 10 'Digit.SessionStorage.get\("citizen.userRequestObject"\)' frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js

# Extract code surrounding the usage of `Digit.SessionStorage.get("citizen.userRequestObject")` in Ulb/index.js
rg -A 10 -B 10 'Digit.SessionStorage.get\("citizen.userRequestObject"\)' frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Ulb/index.js

Length of output: 2170

frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js (2)

23-27: Manage dropdown visibility with isOpen.

The isOpen state effectively manages the visibility of the dropdown menu. Ensure that this logic is consistent across different user interactions.

Verification successful

Dropdown visibility managed correctly with isOpen.

The isOpen state is used consistently to manage the visibility of the dropdown menu. It is toggled by the handleClick function and used in conditional rendering to display the dropdown content. No issues found with the current implementation.

  • isOpen is toggled correctly in handleClick.
  • Conditional rendering of dropdown based on isOpen.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify dropdown visibility management.

# Test: Search for isOpen state usage. Expect: Correct toggle logic for dropdown visibility.
rg --type javascript 'const \[isOpen, setIsOpen\] = useState'

Length of output: 98


Script:

#!/bin/bash
# Find all JavaScript files and search for isOpen state usage to verify dropdown visibility management.
fd -e js -e jsx -e ts -e tsx | xargs rg 'const \[isOpen, setIsOpen\] = useState'

Length of output: 216


Script:

#!/bin/bash
# Search for all occurrences of isOpen within TopBar.js to verify its usage and ensure consistent logic.
rg 'isOpen' frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js -A 3

Length of output: 418


39-41: Adjust logo display logic based on URL path.

The logic for displaying logos based on the URL path enhances context-sensitive interface. Ensure that this logic handles all relevant paths correctly.

frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js (2)

6-19: Review the new anonymization logic.

The anonymizeHalfString function now anonymizes alternate characters instead of replacing the first half. Ensure this logic meets the intended privacy requirements and does not inadvertently expose sensitive information.


79-86: Check the functionality of the new MobileDetailsOnClick method.

The MobileDetailsOnClick method constructs a URL for viewing wage seeker details. Ensure that the logic correctly handles all necessary parameters and that the constructed URL is accurate and secure.

frontend/mgramseva/lib/model/demand/demand_list.g.dart (1)

145-146: LGTM!

The addition of the currentmonthRoundOff property to the AggragateDemandDetails class and its integration into the JSON serialization/deserialization functions is correctly implemented.

Also applies to: 179-179

frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js (3)

8-21: LGTM! Enhanced privacy with alternate character masking.

The updated anonymization logic enhances privacy by masking every alternate character.


90-114: LGTM! New request criteria for online transactions.

The request criteria is well-configured to fetch and sort online transactions.


246-272: LGTM! New date formatting function.

The function correctly converts epoch time to a user-friendly date string.

frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)

11-23: LGTM! Enhanced privacy with alternate character masking.

The updated anonymization logic enhances privacy by masking every alternate character.

frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js (1)

235-240: LGTM!

The filterJurisdictions function is correctly implemented to filter jurisdictions based on division boundaries.

frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart (1)

246-254: LGTM!

The updated logic for displaying advance amounts improves clarity by handling zero amounts separately. This change is well-implemented.

business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java (5)

723-724: Ensure correct initialization of round-off variables.

The variables currentmonthRoundOff and totalAreasRoundOff are initialized to BigDecimal.ZERO. Ensure that they are correctly updated in the subsequent logic.

Verification successful

Initialization and Update of Round-Off Variables are Correct

The variables currentmonthRoundOff and totalAreasRoundOff are correctly initialized and updated. The stream operations filter, map, and reduce the relevant data accurately to compute the round-off values.

  • currentmonthRoundOff and totalAreasRoundOff are updated using streams that filter by "WS_Round_Off" and calculate the difference between taxAmount and collectionAmount.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and updates of `currentmonthRoundOff` and `totalAreasRoundOff`.

# Test: Search for the usage of these variables. Expect: Proper calculations and updates.
rg --type java 'currentmonthRoundOff|totalAreasRoundOff'

Length of output: 1743


Script:

#!/bin/bash
# Description: Inspect the stream operations updating `currentmonthRoundOff` and `totalAreasRoundOff`.

# Extract surrounding lines for context on the stream operations.
rg --type java -A 5 'currentmonthRoundOff = currentMonthDemandDetailList.stream' 
rg --type java -A 5 'totalAreasRoundOff = remainingMonthDemandDetailList.stream'

Length of output: 2103


772-778: Review the inclusion of "WS_Round_Off" in tax head codes.

The list taxHeadCodesToFilterWithoutPenalty now includes "WS_Round_Off". Ensure that this inclusion is consistent with the business logic and requirements.


731-734: Check the logic for calculating currentmonthRoundOff.

Ensure that the logic for calculating currentmonthRoundOff correctly handles all scenarios, especially when there are no entries with the tax head code "WS_Round_Off".

Verification successful

The logic for calculating currentmonthRoundOff is correct. The code correctly handles scenarios where there are no entries with the tax head code "WS_Round_Off" by returning zero, using a reduction with BigDecimal.ZERO as the identity value. This ensures that the calculation is robust and consistent with similar patterns in the code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the calculation logic for `currentmonthRoundOff`.

# Test: Search for the calculation logic. Expect: Correct filtering and mapping.
rg --type java 'currentmonthRoundOff'

Length of output: 1144


Script:

#!/bin/bash
# Search for the context around the calculation of `currentmonthRoundOff` in DemandService.java
rg --type java -A 10 -B 10 'currentmonthRoundOff =' business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java

Length of output: 1476


744-744: Verify the calculation of currentmonthTotalDue.

The calculation of currentmonthTotalDue includes currentmonthRoundOff. Ensure that all components are correctly included and calculated.

Verification successful

Calculation of currentmonthTotalDue is verified successfully.

The components currentmonthBill, currentMonthPenalty, and currentmonthRoundOff are correctly included and calculated before being used in the final calculation of currentmonthTotalDue. Each component is initialized, calculated using a stream operation, and logged for verification. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the calculation logic for `currentmonthTotalDue`.

# Test: Search for the calculation logic. Expect: Proper inclusion of all components.
rg --type java 'currentmonthTotalDue'

Length of output: 990


Script:

#!/bin/bash
# Description: Verify the initialization and calculation logic for components of `currentmonthTotalDue`.

# Search for the calculation logic of `currentmonthBill`.
rg --type java 'currentmonthBill'

# Search for the calculation logic of `currentMonthPenalty`.
rg --type java 'currentMonthPenalty'

# Search for the calculation logic of `currentmonthRoundOff`.
rg --type java 'currentmonthRoundOff'

Length of output: 3623


818-818: Verify the calculation of netdue.

The calculation of netdue includes currentmonthRoundOff. Ensure that all relevant components are correctly included and calculated.

Verification successful

Verification Successful: Calculation of netdue is Correct

The calculation of netdue includes all relevant components (currentmonthBill, totalAreas, remainingAdvance, currentmonthRoundOff) and they are correctly calculated and summed. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the calculation logic for `netdue`.

# Test: Search for the calculation logic. Expect: Proper inclusion of all components.
rg --type java 'netdue'

Length of output: 585


Script:

#!/bin/bash
# Search for the definitions and calculations of the components involved in the `netdue` calculation.
rg --type java 'currentmonthBill|totalAreas|remainingAdvance|currentmonthRoundOff' -A 5

Length of output: 15314

municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java (1)

867-872: Review the new ledgerReport method.

The method ledgerReport retrieves ledger reports based on specified parameters. Ensure that the method handles all edge cases and that waterDaoImpl.getLedgerReport is correctly implemented.

Verification successful

The ledgerReport method is correctly implemented. The method handles edge cases such as invalid fiscal year formats and correctly applies pagination using offset and limit. The underlying database query is constructed and executed properly, ensuring accurate results. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `ledgerReport`.

# Test: Search for the implementation of `getLedgerReport`. Expect: Correct handling of parameters and return values.
rg --type java 'getLedgerReport'

Length of output: 912


Script:

#!/bin/bash
# Description: Retrieve the implementation details of `getLedgerReport` in `WaterDaoImpl`.

# Search for the implementation of `getLedgerReport` in `WaterDaoImpl.java`.
rg --type java --context 10 'getLedgerReport' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java

Length of output: 1150


Script:

#!/bin/bash
# Description: Retrieve additional implementation details of `getLedgerReport` in `WaterDaoImpl`.

# Search for more context around the `getLedgerReport` method to understand database interaction and parameter usage.
rg --type java --context 20 'getLedgerReport' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java

Length of output: 2333


Script:

#!/bin/bash
# Description: Retrieve the full implementation of `getLedgerReport` to check the usage of `offset` and `limit`.

# Search for the complete implementation of `getLedgerReport` in `WaterDaoImpl`.
rg --type java --context 50 'getLedgerReport' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java

Length of output: 4789

municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java (5)

701-703: Ensure correct usage of WATER_PLANE_SEARCH_QUERY.

The method getSearchQueryStringForPlaneSearch uses WATER_PLANE_SEARCH_QUERY. Verify that the query is correctly applied and that all filters are properly handled.

Verification successful

Correct usage of WATER_PLANE_SEARCH_QUERY verified.

The WATER_PLANE_SEARCH_QUERY is properly utilized in the getSearchQueryStringForPlaneSearch method, with filters applied through applyFiltersForPlaneSearch. The query construction and filter application are handled correctly.

  • The WATER_PLANE_SEARCH_QUERY is initialized as a StringBuilder.
  • Filters are conditionally appended based on the SearchCriteria.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `WATER_PLANE_SEARCH_QUERY` in `getSearchQueryStringForPlaneSearch`.

# Test: Search for the method implementation. Expect: Correct query application and filter handling.
rg --type java 'getSearchQueryStringForPlaneSearch'

Length of output: 684


Script:

#!/bin/bash
# Description: Check the usage of WATER_PLANE_SEARCH_QUERY in WsQueryBuilder.java.

# Search for the definition and usage of WATER_PLANE_SEARCH_QUERY in WsQueryBuilder.java
rg 'WATER_PLANE_SEARCH_QUERY' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java -A 10

Length of output: 2705


209-210: Verify the TAX_AMOUNT_QUERY.

The query TAX_AMOUNT_QUERY calculates the sum of tax amounts. Ensure that the query logic is correct and efficient.

Verification successful

The TAX_AMOUNT_QUERY logic is correct and efficiently used.

The query in getMonthlyTaxAmount correctly sums tax amounts for a given consumerCode and startDate, using appropriate parameters and execution method. No issues found.

  • Location: LedgerReportRowMapper.java, method getMonthlyTaxAmount.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the logic of `TAX_AMOUNT_QUERY`.

# Test: Search for the usage of this query. Expect: Correct calculation logic.
rg --type java 'TAX_AMOUNT_QUERY'

Length of output: 455


Script:

#!/bin/bash
# Find the method implementations in LedgerReportRowMapper.java where TAX_AMOUNT_QUERY is used
ast-grep --lang java --pattern 'class LedgerReportRowMapper {
  $$$
  $_() {
    $$$
    wsQueryBuilder.TAX_AMOUNT_QUERY
    $$$
  }
  $$$
}'

Length of output: 143


Script:

#!/bin/bash
# Search for TAX_AMOUNT_QUERY in LedgerReportRowMapper.java with context lines
rg 'TAX_AMOUNT_QUERY' -A 5 -B 5 municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java

Length of output: 645


212-214: Check the TOTAL_AMOUNT_PAID_QUERY.

The query TOTAL_AMOUNT_PAID_QUERY calculates the total amount paid. Verify that the query logic is correct and handles all edge cases.

Verification successful

The TOTAL_AMOUNT_PAID_QUERY logic is correct. The query correctly sums the totalamountpaid for a given consumerCode before a specified startDate, excluding 'CANCELLED' payments. The result handling defaults to zero when no records are found, which is appropriate.

  • Usage in LedgerReportRowMapper.java confirms correct parameterization and result handling.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the logic of `TOTAL_AMOUNT_PAID_QUERY`.

# Test: Search for the usage of this query. Expect: Correct calculation logic.
rg --type java 'TOTAL_AMOUNT_PAID_QUERY'

Length of output: 480


Script:

#!/bin/bash
# Description: Find the method in LedgerReportRowMapper.java that uses TOTAL_AMOUNT_PAID_QUERY to understand its usage.
ast-grep --lang java --pattern 'class LedgerReportRowMapper { $$$ }'

Length of output: 70


Script:

#!/bin/bash
# Description: List all method definitions in LedgerReportRowMapper.java to identify the usage of TOTAL_AMOUNT_PAID_QUERY.
ast-grep --lang java --pattern 'method $_($_) { $$$ }' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java

Length of output: 174


Script:

#!/bin/bash
# Description: Search for the usage of TOTAL_AMOUNT_PAID_QUERY in LedgerReportRowMapper.java to understand its context.
rg 'TOTAL_AMOUNT_PAID_QUERY' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java -A 10

Length of output: 642


197-207: Review the LEDGER_REPORT_QUERY for completeness.

The query LEDGER_REPORT_QUERY retrieves ledger details. Ensure that it covers all necessary fields and conditions for accurate reporting.

Verification successful

The LEDGER_REPORT_QUERY is complete and accurate.

The query is used without further modifications in WaterDaoImpl.java, and the parameters added to the preparedStatement match the placeholders in the query. Therefore, it covers all necessary fields and conditions for accurate reporting.

  • File: municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of `LEDGER_REPORT_QUERY`.

# Test: Search for the usage of this query. Expect: Correct field selections and conditions.
rg --type java 'LEDGER_REPORT_QUERY'

Length of output: 472


Script:

#!/bin/bash
# Description: Check for modifications to the `query` object in `WaterDaoImpl.java` after it is initialized with `LEDGER_REPORT_QUERY`.

# Find where the query object is used or modified after initialization
rg --type java --after-context 10 'StringBuilder query = new StringBuilder\(wsQueryBuilder\.LEDGER_REPORT_QUERY\)' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java

Length of output: 655


Script:

#!/bin/bash
# Description: Check for further modifications to the `query` object in `WaterDaoImpl.java`.

# Search for further modifications or usage of the `query` object
rg --type java --after-context 20 'query\.append' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java

Length of output: 13709


70-85: Ensure correctness of the WATER_PLANE_SEARCH_QUERY.

The new query WATER_PLANE_SEARCH_QUERY retrieves various fields related to water connections. Verify that all joins and fields are correct and necessary.

Verification successful

The WATER_PLANE_SEARCH_QUERY is correctly constructed and used. The methods applyFiltersForPlaneSearch and addPaginationWrapperForPlaneSearch handle the query appropriately by adding necessary filters and pagination. No issues were found with the joins or field selections in the query.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of `WATER_PLANE_SEARCH_QUERY`.

# Test: Search for the usage of this query. Expect: Correct joins and field selections.
rg --type java 'WATER_PLANE_SEARCH_QUERY'

Length of output: 519


Script:

#!/bin/bash
# Description: Search for the usage of the StringBuilder initialized with WATER_PLANE_SEARCH_QUERY in WsQueryBuilder.java.

# Test: Find all usages of the StringBuilder initialized with WATER_PLANE_SEARCH_QUERY.
rg --type java 'StringBuilder query = new StringBuilder\(WATER_PLANE_SEARCH_QUERY\)' -A 20

Length of output: 3374


Script:

#!/bin/bash
# Description: Search for the implementation of applyFiltersForPlaneSearch and addPaginationWrapperForPlaneSearch methods.

# Test: Find the implementation of applyFiltersForPlaneSearch method.
rg --type java 'public StringBuilder applyFiltersForPlaneSearch'

# Test: Find the implementation of addPaginationWrapperForPlaneSearch method.
rg --type java 'addPaginationWrapperForPlaneSearch'

Length of output: 1005


Script:

#!/bin/bash
# Description: Extract the implementation details of applyFiltersForPlaneSearch and addPaginationWrapperForPlaneSearch methods.

# Extract the implementation of applyFiltersForPlaneSearch method.
rg --type java 'public StringBuilder applyFiltersForPlaneSearch' -A 30

# Extract the implementation of addPaginationWrapperForPlaneSearch method.
rg --type java 'private String addPaginationWrapperForPlaneSearch' -A 30

Length of output: 13782

frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js (1)

1496-1503: Review the use of tenantId in parameters.

The method initWithOutTenent is intended to work without a tenant ID, yet it still uses tenantId in the parameters. This might cause confusion and should be reviewed to ensure consistency with the function's purpose.

public class LedgerReportResponse
{
@JsonProperty("ledgerReport")
private List<Map<String, Object>> ledgerReport;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider defining a specific class for ledgerReport entries.

Using List<Map<String, Object>> provides flexibility but sacrifices type safety and can lead to runtime errors if the map structure is inconsistent. Consider defining a dedicated class to represent entries in ledgerReport.

public class LedgerReportEntry {
    // Define specific fields here
}

Comment on lines +176 to +178
if (ledgerReport.getDemand() == null) {
log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle potential null values in ledger report.

Add a null check for ledgerReport.getDemand() to avoid potential NullPointerException.

if (ledgerReport.getDemand() == null) {
    log.warn("DemandLedgerReport is null for LedgerReport: {}", ledgerReport);
    continue;
}

URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode)
.append("&").append("tenantId=").append(tenantId);
Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper);
log.info("line 226 response " + response.toString());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve logging practices.

Consider using parameterized logging instead of string concatenation for better performance and security.

- log.info("line 226 response " + response.toString());
+ log.info("line 226 response {}", response);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
log.info("line 226 response " + response.toString());
log.info("line 226 response {}", response);

ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno"));
ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno"));
ledgerReport.getDemand().setUserId(resultSet.getString("uuid"));
log.info("Data inserted into map " + ledgerReport.toString());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve logging practices.

Consider using parameterized logging instead of string concatenation for better performance and security.

- log.info("Data inserted into map " + ledgerReport.toString());
+ log.info("Data inserted into map {}", ledgerReport);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
log.info("Data inserted into map " + ledgerReport.toString());
log.info("Data inserted into map {}", ledgerReport);

Comment on lines +183 to +229
if(STATE_ADMIN){
if(!isEdit){
setjurisdictions((prev) => [
...prev,
{
key: prev.length + 1,
hierarchy: null,
boundaryType: null,
boundary: null,
division: null,
divisionBoundary: [],
roles: [],
},
]);
setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index })));
}else{
setJuristictionsData((prev) => [
...prev,
{
key: prev.length + 1,
hierarchy: null,
boundaryType: null,
boundary: null,
division: null,
divisionBoundary: [],
roles: [],
},
]);
setJuristictionsData((prev) => prev.map((unit, index) => ({ ...unit, key: index })));
}

}else{
setjurisdictions((prev) => [
...prev,
{
key: prev.length + 1,
hierarchy: null,
boundaryType: null,
boundary: null,
division: null,
divisionBoundary: [],
roles: [],
},
]);
setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index })));

}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to eliminate duplicate logic.

The logic for adding a new jurisdiction and updating keys is duplicated for different conditions. Consider refactoring this to a helper function to improve maintainability.

const addJurisdiction = (setFunction) => {
  setFunction((prev) => [
    ...prev,
    {
      key: prev.length + 1,
      hierarchy: null,
      boundaryType: null,
      boundary: null,
      division: null,
      divisionBoundary: [],
      roles: [],
    },
  ]);
  setFunction((prev) => prev.map((unit, index) => ({ ...unit, key: index })));
};

// Usage
if (STATE_ADMIN) {
  if (!isEdit) {
    addJurisdiction(setjurisdictions);
  } else {
    addJurisdiction(setJuristictionsData);
  }
} else {
  addJurisdiction(setjurisdictions);
}

Comment on lines +692 to +744
public List<Map<String, Object>> getLedgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) {
String[] years = year.split("-");
if (years.length != 2) {
throw new IllegalArgumentException("Invalid fiscal year format");
}
int startYear = Integer.parseInt(years[0]);
int endYear = Integer.parseInt(years[1]);

LocalDate startDate = LocalDate.of(startYear, 4, 1);
LocalDate endDate = LocalDate.of(startYear + 1, 3, 31);

Long startDateTime = LocalDateTime.of(startDate.getYear(), startDate.getMonth(), startDate.getDayOfMonth(), 0, 0, 0)
.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
Long endDateTime = LocalDateTime.of(endDate, LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();

StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY);

List<Object> preparedStatement = new ArrayList<>();
preparedStatement.add(consumercode);
preparedStatement.add(tenantId);
preparedStatement.add(startDateTime);
preparedStatement.add(endDateTime);

Integer newlimit = wsConfiguration.getDefaultLimit();
Integer newoffset = wsConfiguration.getDefaultOffset();
if (limit == null && offset == null)
newlimit = wsConfiguration.getMaxLimit();
if (limit != null && limit <= wsConfiguration.getMaxLimit())
newlimit = limit;
if (limit != null && limit >= wsConfiguration.getMaxLimit())
newlimit = wsConfiguration.getMaxLimit();

if (offset != null)
newoffset = offset;

if (newlimit > 0) {
query.append(" offset ? limit ? ;");
preparedStatement.add(newoffset);
preparedStatement.add(newlimit);
}

log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement);
ledgerReportRowMapper.setTenantId(tenantId);
ledgerReportRowMapper.setRequestInfo(requestInfoWrapper);
ledgerReportRowMapper.setStartYear(startYear);
ledgerReportRowMapper.setEndYear(endYear);
ledgerReportRowMapper.setConsumerCode(consumercode);
List<Map<String, Object>> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper);
int fromIndex = Math.min(newoffset, ledgerReportList.size());
int toIndex = Math.min(fromIndex + newlimit, ledgerReportList.size());
return ledgerReportList.subList(fromIndex, toIndex);
// return ledgerReportList;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance fiscal year validation.

The current validation checks the format but not the numeric nature of the years. Consider adding checks to ensure both parts are valid numbers.

if (years.length != 2 || !years[0].matches("\\d{4}") || !years[1].matches("\\d{4}")) {
    throw new IllegalArgumentException("Invalid fiscal year format");
}

Comment on lines +394 to +395
<Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a unique key to the mapped elements.

Each element in a list should have a unique key to help React identify changes.

- <Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
+ <Card key={item.txnId} style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
<Card key={item.txnId} style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
Tools
Biome

[error] 394-395: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Comment on lines +392 to +426
{onlineTransactions && onlineTransactions.map((item) => {
return (
<Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
<Row
label={t("OP_TRANSACTION_ID")}
text={item.txnId || t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
/>
<Row label={t("OP_RECEIPT_AMT")} text={"₹ " + item.txnAmount || t("ES_COMMON_NA")}

textStyle={{ fontWeight: "500" }}

rowContainerStyle={{ border: "none" }} />
<Row
label={t("OP_RECEIPT_PAID_DATE")}
text={item?.auditDetails.createdTime ? convertEpochToDateString(item?.auditDetails.createdTime) : t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
textStyle={{ color: "#757575", fontWeight: "500" }}


/>

<Row label={t("OP_TRANSACTION_STATUS")} text={item.txnStatus || t("ES_COMMON_NA")}
textStyle={

item.txnStatus == "FAILURE" ? { color: "#D4351C", fontWeight: "500" } : { color: "#00703C", fontWeight: "500" }}
rowContainerStyle={{ border: "none" }} />

</StatusTable>
</Card>

);
})
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use optional chaining for safer access.

Consider using optional chaining to safely access properties and avoid runtime errors.

- {onlineTransactions && onlineTransactions.map((item) => {
+ {onlineTransactions?.map((item) => {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{onlineTransactions && onlineTransactions.map((item) => {
return (
<Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
<Row
label={t("OP_TRANSACTION_ID")}
text={item.txnId || t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
/>
<Row label={t("OP_RECEIPT_AMT")} text={"₹ " + item.txnAmount || t("ES_COMMON_NA")}
textStyle={{ fontWeight: "500" }}
rowContainerStyle={{ border: "none" }} />
<Row
label={t("OP_RECEIPT_PAID_DATE")}
text={item?.auditDetails.createdTime ? convertEpochToDateString(item?.auditDetails.createdTime) : t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
textStyle={{ color: "#757575", fontWeight: "500" }}
/>
<Row label={t("OP_TRANSACTION_STATUS")} text={item.txnStatus || t("ES_COMMON_NA")}
textStyle={
item.txnStatus == "FAILURE" ? { color: "#D4351C", fontWeight: "500" } : { color: "#00703C", fontWeight: "500" }}
rowContainerStyle={{ border: "none" }} />
</StatusTable>
</Card>
);
})
}
{onlineTransactions?.map((item) => {
return (
<Card style={{ maxWidth: "95vw", paddingLeft: "1.5rem", marginTop: "2rem" }}>
<StatusTable>
<Row
label={t("OP_TRANSACTION_ID")}
text={item.txnId || t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
/>
<Row label={t("OP_RECEIPT_AMT")} text={"₹ " + item.txnAmount || t("ES_COMMON_NA")}
textStyle={{ fontWeight: "500" }}
rowContainerStyle={{ border: "none" }} />
<Row
label={t("OP_RECEIPT_PAID_DATE")}
text={item?.auditDetails.createdTime ? convertEpochToDateString(item?.auditDetails.createdTime) : t("ES_COMMON_NA")}
rowContainerStyle={{ border: "none" }}
textStyle={{ color: "#757575", fontWeight: "500" }}
/>
<Row label={t("OP_TRANSACTION_STATUS")} text={item.txnStatus || t("ES_COMMON_NA")}
textStyle={
item.txnStatus == "FAILURE" ? { color: "#D4351C", fontWeight: "500" } : { color: "#00703C", fontWeight: "500" }}
rowContainerStyle={{ border: "none" }} />
</StatusTable>
</Card>
);
})
}
Tools
Biome

[error] 392-426: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 394-395: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cc34a75 and f6933a2.

Files selected for processing (1)
  • municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java (1 hunks)
Additional comments not posted (3)
municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java (3)

210-211: LGTM! Ensure input validation for TAX_AMOUNT_QUERY.

The TAX_AMOUNT_QUERY is straightforward and calculates the sum of tax amounts for active demands. Ensure that input parameters are properly validated to prevent SQL injection vulnerabilities.

Verification successful

Input Handling for TAX_AMOUNT_QUERY is Secure

The TAX_AMOUNT_QUERY is executed using jdbcTemplate.queryForObject, which employs prepared statements. This approach ensures that input parameters are handled securely, mitigating the risk of SQL injection.

  • Location: LedgerReportRowMapper.java, method using taxAmountQuery.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the input handling for `TAX_AMOUNT_QUERY` to ensure proper validation.

# Test: Search for the query usage and check input handling. Expect: Proper validation before query execution.
rg --type java $'TAX_AMOUNT_QUERY'

Length of output: 455


Script:

#!/bin/bash
# Description: Check how inputs are handled for `TAX_AMOUNT_QUERY` in `LedgerReportRowMapper.java`.

# Find methods in `LedgerReportRowMapper.java` where `TAX_AMOUNT_QUERY` is executed.
rg --type java -A 10 'taxAmountQuery' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java

Length of output: 952


198-208: LGTM! Verify the usage of LEDGER_REPORT_QUERY.

The LEDGER_REPORT_QUERY is well-constructed for retrieving connection holder and demand details. Ensure that this query is used appropriately within the application to avoid any unintended side effects.

Verification successful

Usage of LEDGER_REPORT_QUERY is verified and secure.

The LEDGER_REPORT_QUERY is used in the getLedgerReport method of WaterDaoImpl.java. It is executed using a parameterized query with jdbcTemplate.query, which helps prevent SQL injection. The implementation appears secure and appropriate.

  • Location:
    • municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java: Method getLedgerReport
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `LEDGER_REPORT_QUERY` within the codebase.

# Test: Search for the query usage. Expect: Occurrences where it is used in query execution.
rg --type java $'LEDGER_REPORT_QUERY'

Length of output: 472


Script:

#!/bin/bash
# Description: Search for the usage of the `query` variable in `WaterDaoImpl.java` to understand how it is executed.

# Test: Look for occurrences of `query` to see how it is used in the class.
rg --type java 'query' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java -A 10

Length of output: 21528


213-215: LGTM! Ensure input validation for TOTAL_AMOUNT_PAID_QUERY.

The TOTAL_AMOUNT_PAID_QUERY is correctly structured to calculate the total amount paid. Ensure that input parameters are properly validated to prevent SQL injection vulnerabilities.

Verification successful

Input parameters for TOTAL_AMOUNT_PAID_QUERY are safely handled.

The method getMonthlyTotalAmountPaid in LedgerReportRowMapper.java uses jdbcTemplate.queryForObject with parameterized queries, ensuring that inputs are properly handled and SQL injection is prevented. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the input handling for `TOTAL_AMOUNT_PAID_QUERY` to ensure proper validation.

# Test: Search for the query usage and check input handling. Expect: Proper validation before query execution.
rg --type java $'TOTAL_AMOUNT_PAID_QUERY'

Length of output: 480


Script:

#!/bin/bash
# Description: Locate the method in LedgerReportRowMapper.java where TOTAL_AMOUNT_PAID_QUERY is used and check input handling.

# Find the method using TOTAL_AMOUNT_PAID_QUERY in LedgerReportRowMapper.java
rg --type java --context 10 'totalAmountPaidQuery' municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java

Length of output: 1101

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f6933a2 and f9c815c.

Files selected for processing (2)
  • frontend/micro-ui/web/.babelrc (1 hunks)
  • frontend/micro-ui/web/webpack.config.js (1 hunks)
Additional comments not posted (2)
frontend/micro-ui/web/.babelrc (1)

2-8: Optional chaining plugin addition is appropriate.

The addition of @babel/plugin-proposal-optional-chaining is a good enhancement for supporting modern JavaScript syntax. The formatting improvements also enhance readability.

frontend/micro-ui/web/webpack.config.js (1)

15-21: Enhanced Babel loader configuration is well-implemented.

The use of an object structure for the Babel loader with specified presets and plugins, including @babel/plugin-proposal-optional-chaining, is a robust enhancement for handling modern JavaScript and React syntax.

@Hari-egov Hari-egov closed this Aug 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants