fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] rrpawar96 commented on a change in pull request #738: GSIM and GLIM with test cases (FINERACT-603)
Date Mon, 20 Apr 2020 22:07:34 GMT

rrpawar96 commented on a change in pull request #738:
URL: https://github.com/apache/fineract/pull/738#discussion_r411724492



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
##########
@@ -365,11 +387,106 @@ public CommandProcessingResult submitApplication(final JsonCommand
command) {
                 createAndPersistCalendarInstanceForInterestRecalculation(newLoanApplication);
             }
 
+
+            // loan account number generation
+            String accountNumber="";
+            GroupLoanIndividualMonitoringAccount glimAccount;
+            BigDecimal applicationId=BigDecimal.ZERO;
+            Boolean isLastChildApplication=false;
+
+
             if (newLoanApplication.isAccountNumberRequiresAutoGeneration()) {
-                final AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository
-                        .findByAccountType(EntityAccountType.LOAN);
-                newLoanApplication.updateAccountNo(this.accountNumberGenerator.generate(newLoanApplication,
accountNumberFormat));
-                this.loanRepositoryWrapper.save(newLoanApplication);
+
+                 final AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository.findByAccountType(EntityAccountType.LOAN);
+                // if application is of GLIM type
+                if(newLoanApplication.getLoanType()==4)
+                {
+                    Group group= this.groupRepository.findOneWithNotFoundDetection(groupId);
+
+                    //GLIM specific parameters
+                    if(command.bigDecimalValueOfParameterNamedDefaultToNullIfZero("applicationId")!=null)
+                    {
+                        applicationId=command.bigDecimalValueOfParameterNamedDefaultToNullIfZero("applicationId");
+                    }
+
+                    if(command.booleanObjectValueOfParameterNamed("lastApplication")!=null)
+                    {
+                        isLastChildApplication=command.booleanPrimitiveValueOfParameterNamed("lastApplication");
+                    }
+
+                    if(command.booleanObjectValueOfParameterNamed("isParentAccount")!=null)
+                    {
+
+                        //empty table check
+                            if(glimRepository.count()!=0)
+                            {
+                                //**************Parent-Not an empty table********************
+                                accountNumber=this.accountNumberGenerator.generate(newLoanApplication,
accountNumberFormat);
+                                newLoanApplication.updateAccountNo(accountNumber+"-1");

Review comment:
       Yes, hyphens have been removed. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message