-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #815
Develop #815
Conversation
Iste 41 billing
ISTE 173 - BUILD even with Develop
ISTE-44-pending issue: added chnages asked by anniket for bill genrat…
Remarks Localization Changes
WalkthroughThe changes introduce new fields, enhancements, and fixes to the billing service module, particularly focusing on user ID handling, bill notifications, and database schema updates. Similarly, the frontend components received updates for improved user interface and data processing, including new fields and refactors. These modifications collectively enhance the functionality and maintainability of the billing and water connection services. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant BillingService
participant DB
User->>Frontend: Request New Bill
Frontend->>BillingService: Fetch Bill Details
BillingService->>DB: Query Bill Data with User ID
DB-->>BillingService: Return Bill Data
BillingService->>Frontend: Send Bill Details
Frontend->>User: Display Bill
User->>Frontend: Request Bill Cancellation
Frontend->>BillingService: Send Cancellation Request
BillingService->>DB: Update Bill Status
DB-->>BillingService: Confirm Update
BillingService->>Frontend: Send Confirmation
BillingService->>NotificationService: Send Notification for Cancellation
NotificationService-->>User: Notify Cancellation
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 25
Outside diff range and nitpick comments (5)
business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepositoryV2.java (1)
87-88
: Commented out code should be removed if not needed.It appears that the lines setting
consumerCode
andtenantId
have been commented out. If these lines are no longer necessary, consider removing them to keep the codebase clean and maintainable.frontend/mgramseva/lib/providers/household_register_provider.dart (2)
376-376
: Clarify the handling of 'Metered' connection types.The code for handling 'Metered' connection types seems a bit convoluted and might benefit from a helper method or clearer inline comments to explain why certain checks are necessary.
Also applies to: 379-379, 382-382
641-649
: Consider simplifying the header translation process.The process of translating headers for the Excel and PDF generation is repetitive and could be simplified by creating a method that handles the translation based on a list of keys, reducing code duplication and increasing readability.
frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart (1)
[!TIP]
Codebase VerificationThe shell script results indicate that the imports for 'dart:convert' and 'dart:developer' are present in the file but are not being used anywhere else in the code. This suggests that these imports might be unnecessary.
- frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart: 'dart:convert' and 'dart:developer' are imported but not used.
Analysis chain
Line range hint
1-2
: Ensure proper usage of newly added imports.
The shell script did not return any output, indicating that 'dart:convert' and 'dart:developer' might not be used in the file. To confirm this, we should check the entire file for any potential usage that might have been missed.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if 'dart:convert' and 'dart:developer' are used in the file. # Test: Search for usage of 'dart:convert' and 'dart:developer' functions. Expect: At least one occurrence of each. rg --type dart $'import "dart:convert";' rg --type dart $'import "dart:developer";'Length of output: 85
Script:
#!/bin/bash # Description: Verify if 'dart:convert' and 'dart:developer' are used in the file 'consumer_details.dart'. # Test: Search for any usage of 'dart:convert' and 'dart:developer' functions in the file. rg 'dart:convert' frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart rg 'dart:developer' frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dartLength of output: 227
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java (1)
Line range hint
1031-1053
: This large commented block should be removed to keep the code clean and maintainable. If this logic might be needed later, consider maintaining it in a version control system or a separate documentation area rather than commenting it out in the codebase.- /*if (isForConnectionNo) { - WaterConnection connection = calculation.getWaterConnection(); - if (connection == null) { - List<WaterConnection> waterConnectionList = calculatorUtils.getWaterConnection(requestInfo, - calculation.getConnectionNo(), calculation.getTenantId()); - int size = waterConnectionList.size(); - connection = waterConnectionList.get(size - 1); - - } - -// if(connection.getApplicationType().equalsIgnoreCase("MODIFY_WATER_CONNECTION")){ -// WaterConnectionRequest waterConnectionRequest = WaterConnectionRequest.builder().waterConnection(connection) -// .requestInfo(requestInfo).build(); -// Property property = wsCalculationUtil.getProperty(waterConnectionRequest); -// User owner = property.getOwners().get(0).toCommonUser(); -// if (!CollectionUtils.isEmpty(waterConnectionRequest.getWaterConnection().getConnectionHolders())) { -// owner = waterConnectionRequest.getWaterConnection().getConnectionHolders().get(0).toCommonUser(); -// } -// if(!(demand.getPayer().getUuid().equalsIgnoreCase(owner.getUuid()))) -// demand.setPayer(owner); -// } - -}*/
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (36)
- business-services/billing-service/src/main/java/org/egov/demand/model/BillV2.java (1 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepositoryV2.java (2 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BillQueryBuilder.java (3 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapperV2.java (1 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/service/BillServicev2.java (6 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/util/Constants.java (1 hunks)
- business-services/billing-service/src/main/java/org/egov/demand/web/validator/BillValidator.java (2 hunks)
- business-services/billing-service/src/main/resources/application.properties (1 hunks)
- business-services/billing-service/src/main/resources/db/migration/main/V20221130141020__egbs_bill_alter_add_userid.sql (1 hunks)
- business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql (1 hunks)
- frontend/mgramseva/lib/components/dashboard/bills_table.dart (6 hunks)
- frontend/mgramseva/lib/components/house_connection_and_bill/generate_new_bill.dart (1 hunks)
- frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart (5 hunks)
- frontend/mgramseva/lib/model/connection/property.dart (4 hunks)
- frontend/mgramseva/lib/model/connection/property.g.dart (2 hunks)
- frontend/mgramseva/lib/model/connection/water_connection.dart (1 hunks)
- frontend/mgramseva/lib/model/connection/water_connection.g.dart (4 hunks)
- frontend/mgramseva/lib/model/expenses_details/expenses_details.g.dart (4 hunks)
- frontend/mgramseva/lib/providers/collect_payment_provider.dart (6 hunks)
- frontend/mgramseva/lib/providers/common_provider.dart (1 hunks)
- frontend/mgramseva/lib/providers/consumer_details_provider.dart (11 hunks)
- frontend/mgramseva/lib/providers/household_register_provider.dart (10 hunks)
- frontend/mgramseva/lib/providers/search_connection_provider.dart (3 hunks)
- frontend/mgramseva/lib/repository/billing_service_repo.dart (1 hunks)
- frontend/mgramseva/lib/screeens/connection_results/connection_details_card.dart (1 hunks)
- frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart (4 hunks)
- frontend/mgramseva/lib/screeens/consumer_details/consumer_details_walk_through/walk_through.dart (3 hunks)
- frontend/mgramseva/lib/screeens/household_detail/household_detail.dart (2 hunks)
- frontend/mgramseva/lib/screeens/household_register/household_list.dart (2 hunks)
- frontend/mgramseva/lib/utils/constants/i18_key_constants.dart (7 hunks)
- frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart (7 hunks)
- frontend/mgramseva/lib/utils/validators/validators.dart (1 hunks)
- frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (3 hunks)
- municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandGenerationConsumer.java (2 hunks)
- municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java (3 hunks)
- municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java (1 hunks)
Files skipped from review due to trivial changes (7)
- business-services/billing-service/src/main/resources/application.properties
- business-services/billing-service/src/main/resources/db/migration/main/V20221130141020__egbs_bill_alter_add_userid.sql
- frontend/mgramseva/lib/providers/common_provider.dart
- frontend/mgramseva/lib/repository/billing_service_repo.dart
- frontend/mgramseva/lib/screeens/connection_results/connection_details_card.dart
- frontend/mgramseva/lib/screeens/household_detail/household_detail.dart
- frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart
Additional context used
Gitleaks
frontend/mgramseva/lib/utils/validators/validators.dart
58-58: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
64-64: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
68-68: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
Additional comments not posted (45)
business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql (4)
1-1
: The use ofIF NOT EXISTS
is a good practice to ensure idempotency of the migration script. Well done.
3-3
: Proper usage of JOIN in the UPDATE statement to ensure accurate data association between bills and bill details.
5-5
: Setting theconsumercode
column as NOT NULL is a good enforcement of data integrity.
7-7
: The conditional index on active bills is an efficient way to handle uniqueness where it matters, reducing overhead on non-active entries.frontend/mgramseva/lib/screeens/household_register/household_list.dart (1)
1-2
: The addition ofdart:convert
anddart:developer
suggests enhanced data handling and debugging capabilities. Ensure these imports are utilized effectively within the file.frontend/mgramseva/lib/screeens/consumer_details/consumer_details_walk_through/walk_through.dart (3)
96-99
: Proper configuration ofRadioButtonFieldBuilder
for handling consumer payment types. Ensure that all necessary validation and event handling logic is in place.
103-108
: The addition of a required text field for consumer remarks is a good practice to ensure that important user feedback is not omitted.
66-66
: The use ofitemAsString
to handle string representation of items in dropdowns enhances user interface flexibility. Verify that all item types are correctly handled by this method.Also applies to: 79-79, 92-92
Verification successful
The
itemAsString
function is indeed used within theSelectFieldBuilder
class, and it is passed as a required parameter. This confirms that the function is intended to handle the string representation of items and is correctly integrated within the widget.
- frontend/mgramseva/lib/widgets/select_field_builder.dart:
final String Function(dynamic) itemAsString;
required this.itemAsString
itemAsString: widget.itemAsString
This implementation ensures that
itemAsString
is used consistently across different instances ofSelectFieldBuilder
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all item types used in SelectFieldBuilder are correctly handled by the itemAsString method. # Test: Search for all usages of SelectFieldBuilder to ensure correct handling. rg --type dart $'SelectFieldBuilder'Length of output: 3538
Script:
#!/bin/bash # Description: Verify the implementation of itemAsString method in SelectFieldBuilder. # Search for the definition of itemAsString within SelectFieldBuilder. ast-grep --lang dart --pattern $'class SelectFieldBuilder extends StatefulWidget { $$$ itemAsString($_) { $$$ } $$$ }' frontend/mgramseva/lib/widgets/select_field_builder.dartLength of output: 188
Script:
#!/bin/bash # Description: Verify if itemAsString is passed as a parameter to SelectFieldBuilder. # Search for the constructor of SelectFieldBuilder. ast-grep --lang dart --pattern $'class SelectFieldBuilder extends StatefulWidget { const SelectFieldBuilder($_) { $$$ } }' frontend/mgramseva/lib/widgets/select_field_builder.dartLength of output: 188
Script:
#!/bin/bash # Description: Verify if itemAsString is passed as a parameter to SelectFieldBuilder in its usage context. # Search for instances of SelectFieldBuilder and check for itemAsString being passed as a parameter. rg --type dart 'SelectFieldBuilder' -A 5Length of output: 19430
Script:
#!/bin/bash # Description: Verify if itemAsString is used within the SelectFieldBuilder class or its state. # Search for itemAsString within the SelectFieldBuilder class and its state. rg --type dart 'itemAsString' frontend/mgramseva/lib/widgets/select_field_builder.dartLength of output: 353
frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (2)
50-59
: Ensure that the conditional rendering logic formoduleForDivisionUser
aligns with the intended access control requirements. It seems to only display for users with bothDIV_ADMIN
andMDMS_ADMIN
roles. If this is as intended, the implementation is correct.
91-91
: The spread operator to includemoduleForDivisionUser
inpropsForModuleCard.links
is used correctly. Ensure that this does not introduce any duplicates or override any existing properties unintentionally.frontend/mgramseva/lib/providers/search_connection_provider.dart (1)
64-72
: The methodvalidatesearchConnectionDetails
uses a conditional query based onisNameSearch
. Ensure that this logic is clearly documented, as it's crucial for understanding the flow of data and conditions under which different queries are executed.business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapperV2.java (1)
53-53
: The extraction ofuserId
from the result set and its assignment to theBillV2
object is implemented correctly. Ensure that the column nameb_payerid
consistently corresponds touserId
across all database scripts and queries.frontend/mgramseva/lib/model/expenses_details/expenses_details.g.dart (4)
58-60
: Converting dates and tax periods fromnum
toint
ensures that they are handled as whole numbers, which is typical for date and period representations. This is a good practice for clarity and to prevent potential fractional date issues.Also applies to: 67-68
125-126
: Converting timestamp fieldscreatedTime
andlastModifiedTime
fromnum
toint
is suitable for timestamp data, which should be represented as integers. Ensure these fields are consistently handled as integers throughout the application.
12-12
: The conversion oftotalCount
fromnum
toint
is a good practice for ensuring type safety. However, make sure that this change is reflected everywheretotalCount
is utilized to avoid runtime type errors.Verification successful
The search results indicate that
totalCount
is used in various files and contexts. Here are the key points:
- Assignments and Initializations:
totalCount
is being assigned values from JSON and other sources, often with explicit type conversion toint
.- Comparisons and Calculations:
totalCount
is used in comparisons and arithmetic operations, which require it to be an integer.- Widget Constructors and Parameters:
totalCount
is passed as a parameter to widgets, where it is expected to be an integer.The change to ensure
totalCount
is converted to an integer inexpenses_details.g.dart
appears to be correctly reflected in other parts of the codebase, as all instances treattotalCount
as an integer.
frontend/mgramseva/lib/widgets/pagination.dart
usestotalCount
as anint
.frontend/mgramseva/lib/screeens/notifications/notification_screen.dart
and other screen files handletotalCount
as an integer.frontend/mgramseva/lib/providers
files also treattotalCount
as an integer in all relevant contexts.- The JSON serialization and deserialization in
frontend/mgramseva/lib/model
files ensuretotalCount
is an integer.No issues were found with the usage of
totalCount
after ensuring its type safety as an integer.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of totalCount to ensure it's correctly handled as an integer. rg --type dart 'totalCount'Length of output: 9410
108-108
: Castingid
fromnum
toint
is a prudent change for ensuring consistency in data types, particularly for identifiers which should be integers. Ensure that thisid
handling aligns with backend expectations.frontend/mgramseva/lib/model/connection/water_connection.g.dart (2)
18-18
: Converting fields likemeterInstallationDate
,proposedTaps
,noOfTaps
,previousReadingDate
, andpreviousReading
fromnum
toint
ensures correct data type usage for these fields, which typically should not have decimal values. This is a good implementation for data integrity.Also applies to: 22-23, 29-30
86-87
: The conversion ofinitialMeterReading
andmeterReading
fromnum
toint
is appropriate as meter readings are typically whole numbers. Additionally, addingremarks
as a string aligns with the need for textual user comments. Ensure these fields are used consistently across the application.Also applies to: 99-99
frontend/mgramseva/lib/utils/validators/validators.dart (1)
58-58
: The detected 'Generic API Key' issues by the static analysis tool seem to be false positives, as the lines in question involve dynamic key translation for error messages and do not include any sensitive API keys.Also applies to: 64-64, 68-68
Tools
Gitleaks
58-58: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
frontend/mgramseva/lib/components/dashboard/bills_table.dart (2)
117-132
: The addition of sorting functionality with visual indicators (Icons.arrow_upward
andIcons.arrow_downward_sharp
) enhances user interactivity by providing clear feedback on the sorting status. Ensure that the callback and state management for sorting are robust to prevent UI inconsistencies.
142-146
: The methodcolumnRowIncreasedHeight
dynamically adjusts row height based on label length, which is a thoughtful UI enhancement. However, ensure this method is tested across different devices to maintain a consistent user experience.business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BillQueryBuilder.java (2)
25-27
: Addition of new fields inINSERT_BILL_QUERY
.The addition of
payerid
andconsumercode
to theINSERT_BILL_QUERY
aligns with the database schema changes and is correctly positioned in the query.
51-51
: Adjustment of fields inBILL_BASE_QUERY
.The modification of
BILL_BASE_QUERY
to includepayerid
is consistent with the new database schema. Good attention to detail in maintaining the query structure.frontend/mgramseva/lib/model/connection/property.dart (1)
191-192
: Addition ofremarks
field and corresponding controller inOwners
.The addition of the
remarks
field and its corresponding controller in theOwners
class is well implemented. The use ofTextEditingController
for handling form inputs is appropriate and follows Flutter best practices.Also applies to: 209-211, 222-222, 231-231
frontend/mgramseva/lib/model/connection/water_connection.dart (1)
333-335
: Addition ofremarks
field inAdditionalDetails
.The addition of the
remarks
field in theAdditionalDetails
class ofwater_connection.dart
is correctly implemented. This field will help in capturing additional information related to water connections, enhancing data richness.business-services/billing-service/src/main/java/org/egov/demand/util/Constants.java (1)
178-189
: New constants for bill cancellation reasons and messages are correctly declared and follow the existing naming conventions.frontend/mgramseva/lib/model/connection/property.g.dart (2)
144-144
: Ensure theremarks
field is correctly handled in thefromJson
method.
184-184
: Ensure theremarks
field is correctly handled in thetoJson
method.municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java (1)
199-202
: Direct use oftenantId
fromcriteria
simplifies the code by avoiding unnecessary variable declarations.business-services/billing-service/src/main/java/org/egov/demand/service/BillServicev2.java (5)
103-106
: The addition of imports related to user handling and object mapping is a good move if these functionalities are being utilized in the service methods.Ensure all new functionalities using these imports are properly implemented and covered by unit tests.
147-154
: The autowired fieldsproducer
,mapper
, and the Kafka topic for bill cancellation are well initialized. This setup is crucial for the new functionality related to bill cancellation.
[APROVED]
Verify that these beans (Producer
,ObjectMapper
) are correctly configured in the Spring context and that the Kafka topic is correctly defined in your application properties.
Line range hint
173-184
: The methodcancelBill
has been modified to include a validation step and to send notifications after updating the bill status. This is a robust design that ensures data integrity and user notification.It's recommended to add error handling for potential exceptions from
billRepository.updateBillStatus
andsendNotificationForBillCancellation
to enhance the method's robustness.
188-205
: ThesendNotificationForBillCancellation
method is well implemented to handle the logic of sending notifications only if there are relevant bills. It uses the newly addedproducer
bean to push notifications.Consider adding logging before returning from the method when there are no bills or consumer codes, to aid in debugging and operational monitoring.
469-469
: The addition of theuserId
in theBillV2
builder is aligned with the new requirement to track the user associated with a bill. This is crucial for auditing and tracking purposes.Ensure that the
userId
is always populated correctly before being set here to avoid data inconsistencies.frontend/mgramseva/lib/providers/consumer_details_provider.dart (3)
2-3
: The imports fordart:convert
anddart:developer
have been added as part of this PR. Ensure their usage aligns with the new functionality introduced in this file.
454-464
: The methodgetProperty
has been modified to include new logic for handling properties. Ensure that the new logic correctly integrates with the existing functionalities and doesn't introduce regressions.
20-20
: The import ofsearch_connection_provider.dart
has been added. Verify that the functionalities from this provider are integrated properly and used efficiently within this file.frontend/mgramseva/lib/providers/household_register_provider.dart (1)
357-358
: Ensure proper formatting of the mobile number.The
maskMobileNumber
method is used here. Verify that this method handles all edge cases correctly, such as input lengths different from 10, non-numeric characters, etc.frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart (1)
265-265
: The implementation ofCustomDetailsCard
here seems to be missing a line number. Please verify if this is an intended part of the code or if there was an omission in the provided code snippet.Verification successful
The
CustomDetailsCard
is indeed used in thenew_consumer_bill.dart
file at line 265. However, to ensure that the implementation is complete and correctly placed, we need to verify the surrounding context and ensure no lines are missing in the provided code snippet.
The surrounding lines of the
CustomDetailsCard
usage innew_consumer_bill.dart
indicate that it is part of a larger widget structure and includes logical conditions. The provided snippet appears to be complete and correctly placed within the widget tree.
- Location in codebase:
frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart
at line 265No missing lines or omissions were found around the
CustomDetailsCard
implementation in the provided context.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the presence of `CustomDetailsCard` implementation in the provided code snippet. # Test: Search for `CustomDetailsCard` usage. Expect: At least one occurrence. rg --type dart 'CustomDetailsCard'Length of output: 586
Script:
#!/bin/bash # Description: Extract surrounding lines of the `CustomDetailsCard` usage in `new_consumer_bill.dart` to verify completeness. # Test: Display lines around the usage of `CustomDetailsCard` in `new_consumer_bill.dart`. rg --type dart -A 10 -B 10 'CustomDetailsCard' frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dartLength of output: 1494
frontend/mgramseva/lib/utils/constants/i18_key_constants.dart (5)
44-49
: Ensure the newly added constants align with the naming conventions and usage consistency across the application.
418-419
: The newly added constantsCONSUMER_REMARKS_REQUIRED
andCONSUMER_REMARKS
are well-defined. Ensure their usage is consistent with the application's functionality regarding consumer remarks.
501-504
: The constants related to service rates are correctly added. Ensure they are used in the corresponding service rate calculations and validations within the application.
654-654
: The addition ofCONSUMER_REMARKS_MSG
is consistent with the other message constants. Ensure it is used in the correct context within the consumer-related walkthroughs or help sections.
484-484
: The addition ofREMARKS_VALIDATION
is appropriate. Verify that this validation is implemented wherever remarks are input or edited in the application.Verification successful
The
REMARKS_VALIDATION
key is used in theconsumerRemarksValidator
function invalidators.dart
, ensuring that remarks are validated correctly.
frontend/mgramseva/lib/utils/validators/validators.dart
:consumerRemarksValidator
functionScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of REMARKS_VALIDATION in the application. # Test: Search for the usage of REMARKS_VALIDATION. Expect: Usage in form validations. rg --type dart $'REMARKS_VALIDATION'Length of output: 403
Script:
#!/bin/bash # Extract the function or method in validators.dart that uses REMARKS_VALIDATION. ast-grep --lang dart --pattern $'$_() { $$$ REMARKS_VALIDATION $$$ }' frontend/mgramseva/lib/utils/validators/validators.dartLength of output: 132
Script:
#!/bin/bash # List all functions in validators.dart ast-grep --lang dart --pattern $'$_() { $$$ }' frontend/mgramseva/lib/utils/validators/validators.dartLength of output: 103
Script:
#!/bin/bash # Search for function definitions in validators.dart and inspect the surrounding lines for REMARKS_VALIDATION. rg '^[a-zA-Z_]+\s+[a-zA-Z_]+\s*\([^)]*\)\s*\{' frontend/mgramseva/lib/utils/validators/validators.dart -A 10Length of output: 110
Script:
#!/bin/bash # Search for REMARKS_VALIDATION in validators.dart and display surrounding lines for context. rg 'REMARKS_VALIDATION' frontend/mgramseva/lib/utils/validators/validators.dart -C 5Length of output: 742
frontend/mgramseva/lib/screeens/consumer_details/consumer_details.dart (1)
649-680
: Add handling for theremarks
field inConsumerDetails
.This change correctly implements the handling for the
remarks
field when the consumer status is "Inactive". It aligns with the backend changes whereremarks
was added to theProperty
model.
@@ -129,6 +132,7 @@ class Common { | |||
|
|||
String get CONNECTION_ID => 'CONNECTION_ID'; //Connection ID | |||
String get CONSUMER_NAME => 'CONSUMER_NAME'; //Consumer Name | |||
String get CONSUMER_REMARKS => 'CONSUMER_REMARKS'; //Consumer Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment for CONSUMER_REMARKS
seems to be a copy-paste error from the previous line. It should be updated to reflect the actual usage of the constant.
- String get CONSUMER_REMARKS => 'CONSUMER_REMARKS'; //Consumer Name
+ String get CONSUMER_REMARKS => 'CONSUMER_REMARKS'; //Consumer Remarks
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.
String get CONSUMER_REMARKS => 'CONSUMER_REMARKS'; //Consumer Name | |
String get CONSUMER_REMARKS => 'CONSUMER_REMARKS'; //Consumer Remarks |
|
||
const ADMIN = Digit.Utils.hrmsAccess(); | ||
const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]); | ||
const DIV_ADMIN = Digit.UserService.hasAccess(["DIV_ADMIN"]); | ||
const MDMS_ADMIN = Digit.UserService.hasAccess(["MDMS_ADMIN"]); | ||
if (!ADMIN) { | ||
return null; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more descriptive variable name for role checks, such as isAdmin
, isStateAdmin
, etc., instead of generic names like ADMIN
, STATE_ADMIN
. This enhances readability and maintainability.
if (value.waterConnectionData!.length > 0 || | ||
value.waterConnection!.length > 0) | ||
{ | ||
waterConnections = value, | ||
Navigator.pushNamed( | ||
context, Routes.SEARCH_CONSUMER_RESULT, | ||
arguments: {...inputJson, ...arguments, "isNameSearch" : isNameSearch }) | ||
context, Routes.SEARCH_CONSUMER_RESULT, arguments: { | ||
...inputJson, | ||
...arguments, | ||
"isNameSearch": isNameSearch | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The navigation logic after fetching connection results is complex and could benefit from further abstraction or at least detailed comments explaining each step, especially the conditions under which navigation occurs.
@@ -62,6 +62,7 @@ | |||
import java.util.UUID; | |||
import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing java.util.stream.Stream
seems unnecessary as there is no visible usage of streams that would necessitate this import in the provided code.
Please verify if the Stream
import is used elsewhere in the file. If not, consider removing it to clean up unused imports.
/*for (CalculationCriteria criteria : request.getCalculationCriteria()) { | ||
Boolean genratedemand = true; | ||
wsCalulationWorkflowValidator.applicationValidation(request.getRequestInfo(), criteria.getTenantId(), | ||
criteria.getConnectionNo(), genratedemand); | ||
} | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out code for application validation within the generateDemandInBatch
method seems to be deactivated for a reason. However, leaving commented code in production can lead to confusion and clutter.
Consider removing the commented-out code if it's no longer needed, or provide a clear comment on why it's retained (e.g., for potential future use).
@@ -159,7 +159,7 @@ class HouseholdRegisterProvider with ChangeNotifier { | |||
(waterConnectionsDetails?.totalCount ?? 0)) | |||
? (waterConnectionsDetails!.totalCount!) | |||
: (offset + limit) - 1)); | |||
} catch (e, s) { | |||
} catch (e, s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider more descriptive error messaging.
Improving the error message sent to the streamController.addError
could enhance debugging and user feedback. Instead of a generic 'error', consider providing a more specific message or using the exception message.
TableHeader(i18.common.CONNECTION_ID, | ||
isSortingRequired: true, | ||
isAscendingOrder: | ||
sortBy != null && sortBy!.key == 'connectionNumber' | ||
? sortBy!.isAscending | ||
: null, | ||
apiKey: 'connectionNumber', | ||
callBack: onSort), | ||
TableHeader(i18.common.NAME, isSortingRequired: false), | ||
TableHeader(i18.common.GENDER, isSortingRequired: false), | ||
TableHeader(i18.consumer.FATHER_SPOUSE_NAME, isSortingRequired: false), | ||
TableHeader(i18.common.MOBILE_NUMBER, isSortingRequired: false), | ||
TableHeader(i18.consumer.OLD_CONNECTION_ID, isSortingRequired: false), | ||
TableHeader(i18.consumer.CONSUMER_CATEGORY, isSortingRequired: false), | ||
TableHeader(i18.consumer.CONSUMER_SUBCATEGORY, | ||
isSortingRequired: false), | ||
TableHeader(i18.searchWaterConnection.PROPERTY_TYPE, | ||
isSortingRequired: false), | ||
TableHeader(i18.searchWaterConnection.CONNECTION_TYPE, | ||
isSortingRequired: false), | ||
TableHeader(i18.demandGenerate.METER_READING_DATE, | ||
isSortingRequired: false), | ||
TableHeader(i18.searchWaterConnection.METER_NUMBER, | ||
isSortingRequired: false), | ||
TableHeader(i18.demandGenerate.PREV_METER_READING_LABEL, | ||
isSortingRequired: false), | ||
TableHeader(i18.consumer.ARREARS_ON_CREATION, isSortingRequired: false), | ||
TableHeader(i18.consumer.CORE_PENALTY_ON_CREATION, | ||
isSortingRequired: false), | ||
TableHeader(i18.consumer.CORE_ADVANCE_ON_CREATION, | ||
isSortingRequired: false), | ||
TableHeader(i18.common.CORE_TOTAL_BILL_AMOUNT, | ||
isSortingRequired: false), | ||
TableHeader(i18.billDetails.TOTAL_AMOUNT_COLLECTED, | ||
isSortingRequired: false), | ||
TableHeader(i18.common.CORE_ADVANCE_AS_ON_TODAY, | ||
isSortingRequired: false), | ||
TableHeader(i18.householdRegister.PENDING_COLLECTIONS, | ||
isSortingRequired: true, | ||
isAscendingOrder: | ||
sortBy != null && sortBy!.key == 'collectionPendingAmount' | ||
? sortBy!.isAscending | ||
: null, | ||
apiKey: 'collectionPendingAmount', | ||
callBack: onSort), | ||
TableHeader(i18.common.CREATED_ON_DATE, isSortingRequired: false), | ||
TableHeader(i18.householdRegister.LAST_BILL_GEN_DATE, | ||
isSortingRequired: true, | ||
apiKey: 'lastDemandGeneratedDate', | ||
isAscendingOrder: | ||
sortBy != null && sortBy!.key == 'lastDemandGeneratedDate' | ||
? sortBy!.isAscending | ||
: null, | ||
callBack: onSort), | ||
TableHeader(i18.householdRegister.ACTIVE_INACTIVE, | ||
isSortingRequired: false, apiKey: 'status'), | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor to improve maintainability by reducing redundancy.
The creation of TableHeader
instances is repetitive with many shared parameters. Consider creating a helper method to generate these headers to reduce redundancy and improve code maintainability.
TableHeader createTableHeader(String key, bool isSortingRequired, {bool? isAscendingOrder}) {
return TableHeader(
i18.common.translate(key),
isSortingRequired: isSortingRequired,
isAscendingOrder: isAscendingOrder,
apiKey: key,
callBack: onSort
);
}
Then replace the repetitive TableHeader
instantiations with calls to this new method.
@@ -377,13 +409,12 @@ class HouseholdRegisterProvider with ChangeNotifier { | |||
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}', | |||
), | |||
TableData( | |||
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}', | |||
'${connection.status.toString().toLowerCase() == Constants.CONNECTION_STATUS.last.toLowerCase() ? 'Y' : 'N'}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure consistent use of enums or constants for status checks.
The comparison of connection.status
is done using a string comparison. This can be error-prone and hard to maintain. Consider using enums or defined constants for such comparisons to improve code safety and readability.
'${connection.connectionNo ?? ''} ${connection.connectionType == 'Metered' ? '- M' : ''}', | ||
'${connection.connectionHolders?.first.name ?? ''}', | ||
'${connection.connectionHolders?.first.fatherOrHusbandName ?? ''}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '₹ 0' : '₹ 0'}', | ||
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}', | ||
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}' | ||
]) | ||
.toList() ?? | ||
[]; | ||
var excelTableData = waterConnectionsDetails.waterConnection | ||
?.map<List<String>>((connection) => [ | ||
'${commonProvider.userDetails?.selectedtenant?.city?.code ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.tenantId ?? 'NA')}', | ||
'${connection.tenantId ?? 'NA'}', | ||
'${connection.connectionHolders?.first.name ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.connectionHolders?.first.gender ?? 'NA')}', | ||
'${connection.connectionHolders?.first.fatherOrHusbandName ?? 'NA'}', | ||
maskMobileNumber('${connection.connectionHolders?.first.mobileNumber ?? 'NA'}'), | ||
'${connection.oldConnectionNo ?? 'NA'}', | ||
'${connection.connectionNo ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.category ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.subCategory ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.propertyType ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.connectionType ?? 'NA')}', | ||
'${connection.connectionType == 'Metered' ?connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? 'NA')) :'NA' :'NA' }', | ||
'${connection.connectionType == 'Metered' ? connection.meterId :'NA' }', | ||
'${connection.connectionType == 'Metered' ? connection.additionalDetails?.meterReading :'NA' }', | ||
'${connection.arrears != null ? '₹ ${connection.arrears}' : '-'}', | ||
'${connection.penalty != null ? '₹ ${connection.penalty}' : '-'}', | ||
'${connection.advance != null ? '₹ ${connection.advance}' : '-'}', | ||
'${connection.additionalDetails?.totalAmount != null ? '₹ ${connection.additionalDetails?.totalAmount}' : '-'}', | ||
'${connection.additionalDetails?.collectionAmount != null ? '₹ ${connection.additionalDetails?.collectionAmount}' : '-'}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-' : '-'}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}', | ||
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate?.toInt()) : '-'}', | ||
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}', | ||
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}', | ||
'${commonProvider.userDetails?.selectedtenant?.city?.code ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.tenantId ?? 'NA')}', | ||
'${connection.tenantId ?? 'NA'}', | ||
'${connection.connectionHolders?.first.name ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.connectionHolders?.first.gender ?? 'NA')}', | ||
'${connection.connectionHolders?.first.fatherOrHusbandName ?? 'NA'}', | ||
maskMobileNumber( | ||
'${connection.connectionHolders?.first.mobileNumber ?? 'NA'}'), | ||
'${connection.oldConnectionNo ?? 'NA'}', | ||
'${connection.connectionNo ?? 'NA'}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.category ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.subCategory ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.additionalDetails?.propertyType ?? 'NA')}', | ||
'${ApplicationLocalizations.of(context).translate(connection.connectionType ?? 'NA')}', | ||
'${connection.connectionType == 'Metered' ? connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? 'NA')) : 'NA' : 'NA'}', | ||
'${connection.connectionType == 'Metered' ? connection.meterId : 'NA'}', | ||
'${connection.connectionType == 'Metered' ? connection.additionalDetails?.meterReading : 'NA'}', | ||
'${connection.arrears != null ? '₹ ${connection.arrears}' : '-'}', | ||
'${connection.penalty != null ? '₹ ${connection.penalty}' : '-'}', | ||
'${connection.advance != null ? '₹ ${connection.advance}' : '-'}', | ||
'${connection.additionalDetails?.totalAmount != null ? '₹ ${connection.additionalDetails?.totalAmount}' : '-'}', | ||
'${connection.additionalDetails?.collectionAmount != null ? '₹ ${connection.additionalDetails?.collectionAmount}' : '-'}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-' : '-'}', | ||
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}', | ||
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate?.toInt()) : '-'}', | ||
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}', | ||
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimize data transformation for PDF and Excel generation.
The transformation logic for PDF and Excel data generation is duplicated and could be refactored into a single method that accepts parameters to handle differences between PDF and Excel data requirements. This would reduce code duplication and improve maintainability.
: waterconnection.addharCtrl.text.trim(), | ||
"remarks": property.owners?.first.remarks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Ensure that the aadharNumber
field is sanitized and validated before use. The current codebase does not show specific sanitization or validation logic for this field, which is a potential security risk.
frontend/mgramseva/lib/providers/consumer_details_provider.dart
frontend/mgramseva/lib/model/connection/water_connection.dart
Analysis chain
The field aadharNumber
is conditionally added to additionalDetails
. Ensure that the Aadhar number is sanitized and validated before being used here to avoid potential security risks.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the sanitization and validation of `aadharNumber`.
# Test: Search for the validation logic of `aadharNumber` in the codebase.
rg --type dart $'validateAadharNumber'
Length of output: 37
Script:
#!/bin/bash
# Description: Broaden the search to verify the sanitization and validation of `aadharNumber`.
# Search for any references to `aadharNumber` in the codebase.
rg --type dart 'aadharNumber'
# Search for common validation functions or patterns that might be used for `aadharNumber`.
rg --type dart 'validate|sanitize|regex|pattern|isValid|isAadhar'
Length of output: 14640
Added chnages for penalty
There was a problem hiding this 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
Files selected for processing (1)
- business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java (1 hunks)
Additional comments not posted (1)
business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java (1)
687-687
: The change in rounding mode fromCEILING
toHALF_UP
fortotalApplicablePenalty
is correctly implemented. This should provide a more balanced rounding approach compared to always rounding up.
Summary by CodeRabbit
New Features
userId
in billing services to enhance user tracking and identification.Bug Fixes
Refactor
Chores
Documentation