nikpawar89 commented on a change in pull request #738: GSIM and GLIM with test
cases (FINERACT-603)
URL: https://github.com/apache/fineract/pull/738#discussion_r410975072
##########
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:
Including hyphens in account number would increase readability but some of
the central banks won't like.
I am aware of such incident, where one of the MF had account number with
hyphen printed on cheque and clearing house refused to process it.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services